59#define DEBUG_TYPE "mem2reg"
61STATISTIC(NumLocalPromoted,
"Number of alloca's promoted within one block");
62STATISTIC(NumSingleStore,
"Number of alloca's promoted with a single store");
63STATISTIC(NumDeadAlloca,
"Number of dead alloca's removed");
64STATISTIC(NumPHIInsert,
"Number of PHI nodes inserted");
69 if (
const LoadInst *LI = dyn_cast<LoadInst>(U)) {
74 }
else if (
const StoreInst *SI = dyn_cast<StoreInst>(U)) {
75 if (SI->getValueOperand() == AI ||
83 if (!
II->isLifetimeStartOrEnd() && !
II->isDroppable())
85 }
else if (
const BitCastInst *BCI = dyn_cast<BitCastInst>(U)) {
89 if (!GEPI->hasAllZeroIndices())
121 DIB.insertDbgValueIntrinsic(NewValue, Variable,
Expression, DI, InsertBefore);
125class AssignmentTrackingInfo {
147 void updateForDeletedStore(
163 auto InsertValueForAssign = [&](
auto *DbgAssign,
auto *&AssignList) {
165 AssignList->insert(DbgAssign);
166 createDebugValue(DIB, DbgAssign->getValue(), DbgAssign->getVariable(),
167 DbgAssign->getExpression(), DbgAssign->getDebugLoc(),
171 InsertValueForAssign(Assign, DbgAssignsToDelete);
173 InsertValueForAssign(Assign, DVRAssignsToDelete);
183 auto ConvertUnlinkedAssignToValue = [&](
auto *
Assign) {
188 for_each(DbgAssigns, ConvertUnlinkedAssignToValue);
189 for_each(DVRAssigns, ConvertUnlinkedAssignToValue);
198 for (
auto *DAI : DbgAssigns)
200 for (
auto *DVR : DVRAssigns)
208 bool empty() {
return DbgAssigns.empty() && DVRAssigns.
empty(); }
220 bool OnlyUsedInOneBlock;
226 AssignmentTrackingInfo AssignmentTracking;
229 DefiningBlocks.
clear();
233 OnlyUsedInOneBlock =
true;
236 AssignmentTracking.clear();
261 if (OnlyUsedInOneBlock) {
263 OnlyBlock =
User->getParent();
264 else if (OnlyBlock !=
User->getParent())
265 OnlyUsedInOneBlock =
false;
268 DbgUserVec AllDbgUsers;
271 std::copy_if(AllDbgUsers.begin(), AllDbgUsers.end(),
273 return !isa<DbgAssignIntrinsic>(DII);
275 std::copy_if(AllDPUsers.
begin(), AllDPUsers.
end(),
276 std::back_inserter(DPUsers),
278 AssignmentTracking.init(AI);
283struct RenamePassData {
284 using ValVector = std::vector<Value *>;
285 using LocationVector = std::vector<DebugLoc>;
301class LargeBlockInfo {
312 static bool isInterestingInstruction(
const Instruction *
I) {
313 return (isa<LoadInst>(
I) && isa<AllocaInst>(
I->getOperand(0))) ||
314 (isa<StoreInst>(
I) && isa<AllocaInst>(
I->getOperand(1)));
319 assert(isInterestingInstruction(
I) &&
320 "Not a load/store to/from an alloca?");
324 if (It != InstNumbers.
end())
333 if (isInterestingInstruction(&BBI))
334 InstNumbers[&BBI] = InstNo++;
335 It = InstNumbers.
find(
I);
337 assert(It != InstNumbers.
end() &&
"Didn't insert instruction?");
346struct PromoteMem2Reg {
348 std::vector<AllocaInst *> Allocas;
399 : Allocas(Allocas.
begin(), Allocas.
end()), DT(DT),
401 AC(AC), SQ(DT.
getRoot()->getDataLayout(),
407 void RemoveFromAllocasList(
unsigned &AllocaIdx) {
408 Allocas[AllocaIdx] = Allocas.back();
415 unsigned &NP = BBNumPreds[BB->
getNumber()];
425 RenamePassData::ValVector &IncVals,
426 RenamePassData::LocationVector &IncLocs,
427 std::vector<RenamePassData> &Worklist);
428 bool QueuePhiNode(
BasicBlock *BB,
unsigned AllocaIdx,
unsigned &Version);
431 void cleanUpDbgAssigns() {
432 for (
auto *DAI : DbgAssignsToDelete)
433 DAI->eraseFromParent();
434 DbgAssignsToDelete.clear();
435 for (
auto *DVR : DVRAssignsToDelete)
436 DVR->eraseFromParent();
437 DVRAssignsToDelete.clear();
458 if (isa<UndefValue>(Val) && LI->
hasMetadata(LLVMContext::MD_noundef)) {
471 if (AC && LI->
getMetadata(LLVMContext::MD_nonnull) &&
483 if (isa<LoadInst>(
I) || isa<StoreInst>(
I))
487 if (
I->isDroppable()) {
488 I->dropDroppableUse(U);
492 if (!
I->getType()->isVoidTy()) {
497 Instruction *Inst = cast<Instruction>(UU.getUser());
507 I->eraseFromParent();
531 bool RequireDominatingStore =
537 Info.UsingBlocks.clear();
541 if (UserInst == OnlyStore)
543 LoadInst *LI = cast<LoadInst>(UserInst);
549 if (RequireDominatingStore) {
554 if (StoreIndex == -1)
555 StoreIndex = LBI.getInstructionIndex(OnlyStore);
557 if (
unsigned(StoreIndex) > LBI.getInstructionIndex(LI)) {
559 Info.UsingBlocks.push_back(StoreBB);
584 if (!
Info.UsingBlocks.empty())
589 Info.AssignmentTracking.updateForDeletedStore(
590 Info.OnlyStore, DIB, DbgAssignsToDelete, DVRAssignsToDelete);
594 auto ConvertDebugInfoForStore = [&](
auto &Container) {
595 for (
auto *DbgItem : Container) {
596 if (DbgItem->isAddressOfVariable()) {
598 DbgItem->eraseFromParent();
599 }
else if (DbgItem->getExpression()->startsWithDeref()) {
600 DbgItem->eraseFromParent();
604 ConvertDebugInfoForStore(
Info.DbgUsers);
605 ConvertDebugInfoForStore(
Info.DPUsers);
611 Info.OnlyStore->eraseFromParent();
612 LBI.deleteValue(
Info.OnlyStore);
647 StoresByIndexTy StoresByIndex;
650 if (
StoreInst *SI = dyn_cast<StoreInst>(U))
651 StoresByIndex.
push_back(std::make_pair(LBI.getInstructionIndex(SI), SI));
660 LoadInst *LI = dyn_cast<LoadInst>(U);
664 unsigned LoadIdx = LBI.getInstructionIndex(LI);
669 std::make_pair(LoadIdx,
static_cast<StoreInst *
>(
nullptr)),
672 if (
I == StoresByIndex.begin()) {
673 if (StoresByIndex.empty())
683 ReplVal = std::prev(
I)->second->getOperand(0);
703 Info.AssignmentTracking.updateForDeletedStore(SI, DIB, DbgAssignsToDelete,
706 auto DbgUpdateForStore = [&](
auto &Container) {
707 for (
auto *DbgItem : Container) {
708 if (DbgItem->isAddressOfVariable()) {
713 DbgUpdateForStore(
Info.DbgUsers);
714 DbgUpdateForStore(
Info.DPUsers);
716 SI->eraseFromParent();
725 auto DbgUpdateForAlloca = [&](
auto &Container) {
726 for (
auto *DbgItem : Container)
727 if (DbgItem->isAddressOfVariable() ||
728 DbgItem->getExpression()->startsWithDeref())
729 DbgItem->eraseFromParent();
731 DbgUpdateForAlloca(
Info.DbgUsers);
732 DbgUpdateForAlloca(
Info.DPUsers);
738void PromoteMem2Reg::run() {
741 AllocaDbgUsers.
resize(Allocas.size());
742 AllocaATInfo.
resize(Allocas.size());
743 AllocaDPUsers.
resize(Allocas.size());
749 NoSignedZeros =
F.getFnAttribute(
"no-signed-zeros-fp-math").getValueAsBool();
751 for (
unsigned AllocaNum = 0; AllocaNum != Allocas.size(); ++AllocaNum) {
756 "All allocas should be in the same function, which is same as DF!");
765 RemoveFromAllocasList(AllocaNum);
772 Info.AnalyzeAlloca(AI);
776 if (
Info.DefiningBlocks.size() == 1) {
778 &DbgAssignsToDelete, &DVRAssignsToDelete)) {
780 RemoveFromAllocasList(AllocaNum);
788 if (
Info.OnlyUsedInOneBlock &&
790 &DbgAssignsToDelete, &DVRAssignsToDelete)) {
792 RemoveFromAllocasList(AllocaNum);
797 if (BBNumPreds.
empty())
798 BBNumPreds.
resize(
F.getMaxBlockNumber());
801 if (!
Info.DbgUsers.empty())
802 AllocaDbgUsers[AllocaNum] =
Info.DbgUsers;
803 if (!
Info.AssignmentTracking.empty())
804 AllocaATInfo[AllocaNum] =
Info.AssignmentTracking;
805 if (!
Info.DPUsers.empty())
806 AllocaDPUsers[AllocaNum] =
Info.DPUsers;
809 AllocaLookup[Allocas[AllocaNum]] = AllocaNum;
813 Info.DefiningBlocks.end());
824 IDF.setLiveInBlocks(LiveInBlocks);
825 IDF.setDefiningBlocks(DefBlocks);
827 IDF.calculate(PHIBlocks);
829 return A->getNumber() <
B->getNumber();
834 QueuePhiNode(BB, AllocaNum, CurrentVersion);
837 if (Allocas.empty()) {
846 RenamePassData::ValVector Values(Allocas.size());
847 for (
unsigned i = 0, e = Allocas.size(); i != e; ++i)
852 RenamePassData::LocationVector
Locations(Allocas.size());
855 Visited.
resize(
F.getMaxBlockNumber());
859 std::vector<RenamePassData> RenamePassWorkList;
860 RenamePassWorkList.emplace_back(&
F.front(),
nullptr, std::move(Values),
861 std::move(Locations));
863 RenamePassData RPD = std::move(RenamePassWorkList.back());
864 RenamePassWorkList.pop_back();
866 RenamePass(RPD.BB, RPD.Pred, RPD.Values, RPD.Locations, RenamePassWorkList);
867 }
while (!RenamePassWorkList.empty());
878 A->eraseFromParent();
882 auto RemoveDbgDeclares = [&](
auto &Container) {
883 for (
auto &DbgUsers : Container) {
884 for (
auto *DbgItem : DbgUsers)
885 if (DbgItem->isAddressOfVariable() ||
886 DbgItem->getExpression()->startsWithDeref())
887 DbgItem->eraseFromParent();
890 RemoveDbgDeclares(AllocaDbgUsers);
891 RemoveDbgDeclares(AllocaDPUsers);
897 bool EliminatedAPHI =
true;
898 while (EliminatedAPHI) {
899 EliminatedAPHI =
false;
907 E = NewPhiNodes.
end();
916 EliminatedAPHI =
true;
930 E = NewPhiNodes.
end();
936 if (&BB->
front() != SomePHI)
952 return A->getNumber() <
B->getNumber();
963 "PHI node has entry for a block which is not a predecessor!");
975 while ((SomePHI = dyn_cast<PHINode>(BBI++)) &&
992void PromoteMem2Reg::ComputeLiveInBlocks(
1000 Info.UsingBlocks.end());
1005 for (
unsigned i = 0, e = LiveInBlockWorklist.size(); i != e; ++i) {
1007 if (!DefBlocks.
count(BB))
1013 if (
StoreInst *SI = dyn_cast<StoreInst>(
I)) {
1014 if (
SI->getOperand(1) != AI)
1019 LiveInBlockWorklist[i] = LiveInBlockWorklist.
back();
1020 LiveInBlockWorklist.pop_back();
1026 if (
LoadInst *LI = dyn_cast<LoadInst>(
I))
1036 while (!LiveInBlockWorklist.empty()) {
1037 BasicBlock *BB = LiveInBlockWorklist.pop_back_val();
1041 if (!LiveInBlocks.
insert(BB).second)
1053 LiveInBlockWorklist.push_back(
P);
1061bool PromoteMem2Reg::QueuePhiNode(
BasicBlock *BB,
unsigned AllocaNo,
1062 unsigned &Version) {
1072 PN =
PHINode::Create(Allocas[AllocaNo]->getAllocatedType(), getNumPreds(BB),
1073 Allocas[AllocaNo]->
getName() +
"." +
Twine(Version++));
1076 PhiToAllocaMap[PN] = AllocaNo;
1083 bool ApplyMergedLoc) {
1096 RenamePassData::ValVector &IncomingVals,
1097 RenamePassData::LocationVector &IncomingLocs,
1098 std::vector<RenamePassData> &Worklist) {
1105 if (PhiToAllocaMap.
count(APN)) {
1112 unsigned NewPHINumOperands = APN->getNumOperands();
1115 assert(NumEdges &&
"Must be at least one edge from Pred to BB!");
1120 unsigned AllocaNo = PhiToAllocaMap[APN];
1124 APN->getNumIncomingValues() > 0);
1127 for (
unsigned i = 0; i != NumEdges; ++i)
1128 APN->addIncoming(IncomingVals[AllocaNo], Pred);
1135 if (isa<FPMathOperator>(APN) && NoSignedZeros)
1136 APN->setHasNoSignedZeros(
true);
1139 IncomingVals[AllocaNo] = APN;
1140 AllocaATInfo[AllocaNo].updateForNewPhi(APN, DIB);
1141 auto ConvertDbgDeclares = [&](
auto &Container) {
1142 for (
auto *DbgItem : Container)
1143 if (DbgItem->isAddressOfVariable())
1146 ConvertDbgDeclares(AllocaDbgUsers[AllocaNo]);
1147 ConvertDbgDeclares(AllocaDPUsers[AllocaNo]);
1151 APN = dyn_cast<PHINode>(PNI);
1157 }
while (APN->getNumOperands() == NewPHINumOperands);
1169 if (
LoadInst *LI = dyn_cast<LoadInst>(
I)) {
1175 if (AI == AllocaLookup.
end())
1178 Value *
V = IncomingVals[AI->second];
1184 }
else if (
StoreInst *SI = dyn_cast<StoreInst>(
I)) {
1187 AllocaInst *Dest = dyn_cast<AllocaInst>(
SI->getPointerOperand());
1192 if (ai == AllocaLookup.
end())
1196 unsigned AllocaNo = ai->second;
1197 IncomingVals[AllocaNo] =
SI->getOperand(0);
1200 IncomingLocs[AllocaNo] =
SI->getDebugLoc();
1201 AllocaATInfo[AllocaNo].updateForDeletedStore(SI, DIB, &DbgAssignsToDelete,
1202 &DVRAssignsToDelete);
1203 auto ConvertDbgDeclares = [&](
auto &Container) {
1204 for (
auto *DbgItem : Container)
1205 if (DbgItem->isAddressOfVariable())
1208 ConvertDbgDeclares(AllocaDbgUsers[ai->second]);
1209 ConvertDbgDeclares(AllocaDPUsers[ai->second]);
1210 SI->eraseFromParent();
1229 if (VisitedSuccs.
insert(*I).second)
1230 Worklist.emplace_back(*
I, Pred, IncomingVals, IncomingLocs);
1238 if (Allocas.
empty())
1241 PromoteMem2Reg(Allocas, DT, AC).run();
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static const Function * getParent(const Value *V)
This file implements the BitVector class.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Analysis containing CSE Info
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static void clear(coro::Shape &Shape)
static DeltaTreeNode * getRoot(void *Root)
This file defines the DenseMap class.
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
Module.h This file contains the declarations for the Module class.
uint64_t IntrinsicInst * II
static StringRef getName(Value *V)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void ComputeLiveInBlocks(const SmallPtrSetImpl< BasicBlock * > &UsingBlocks, const SmallPtrSetImpl< BasicBlock * > &DefBlocks, SmallPtrSetImpl< BasicBlock * > &LiveInBlocks, PredIteratorCache &PredCache)
Given sets of UsingBlocks and DefBlocks, compute the set of LiveInBlocks.
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
This class represents a conversion between pointers from one address space to another.
an instruction to allocate memory on the stack
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool empty() const
empty - Check if the array is empty.
A cache of @llvm.assume calls within a function.
void registerAssumption(AssumeInst *CI)
Add an @llvm.assume intrinsic to this function's cache.
LLVM Basic Block Representation.
unsigned getNumber() const
iterator begin()
Instruction iterator methods.
const Instruction & front() const
const Function * getParent() const
Return the enclosing method, or null if none.
InstListType::iterator iterator
Instruction iterators...
const Instruction & back() const
This class represents a no-op cast from one type to another.
bool test(unsigned Idx) const
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
This class represents a function call, abstracting a target machine's calling convention.
static CallInst * Create(FunctionType *Ty, Value *F, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
static ConstantInt * getTrue(LLVMContext &Context)
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
A parsed version of the target data layout string in and methods for querying it.
This represents the llvm.dbg.assign instruction.
This is the common base class for debug info intrinsics for variables.
Record of a variable value-assignment, aka a non instruction representation of the dbg....
static DbgVariableRecord * createDbgVariableRecord(Value *Location, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
Identifies a unique instance of a whole variable (discards/ignores fragment information).
Identifies a unique instance of a variable.
iterator find(const_arg_type_t< KeyT > Val)
bool erase(const KeyT &Val)
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
bool dominates(const BasicBlock *BB, const Use &U) const
Return true if the (end of the) basic block BB dominates the use U.
Class representing an expression and its matching format.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
This instruction compares its operands according to the predicate given to the constructor.
void insertBefore(Instruction *InsertPos)
Insert an unlinked instruction into a basic block immediately before the specified instruction.
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
bool hasMetadata() const
Return true if this instruction has any metadata attached to it.
InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
Instruction * user_back()
Specialize the methods defined in Value, as we know that an instruction can only be used by other ins...
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
void applyMergedLocation(DILocation *LocA, DILocation *LocB)
Merge 2 debug locations and apply it to the Instruction.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
void insertAfter(Instruction *InsertPos)
Insert an unlinked instruction into a basic block immediately after the specified instruction.
A wrapper class for inspecting calls to intrinsic functions.
This is an important class for using LLVM in a threaded context.
An instruction for reading from memory.
Value * getPointerOperand()
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
unsigned getNumIncomingValues() const
Return the number of incoming edges.
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
bool contains(const T &V) const
Check if the SmallSet contains the given element.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
typename SuperClass::iterator iterator
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
A Use represents the edge between a Value definition and its users.
Value * getOperand(unsigned i) const
bool isDroppable() const
A droppable user is a user for which uses can be dropped without affecting correctness and should be ...
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
iterator_range< user_iterator > users()
static void dropDroppableUse(Use &U)
Remove the droppable use U.
LLVMContext & getContext() const
All values hold a context through their type.
iterator_range< use_iterator > uses()
const ParentTy * getParent() const
self_iterator getIterator()
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=std::nullopt)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
AssignmentMarkerRange getAssignmentMarkers(DIAssignID *ID)
Return a range of dbg.assign intrinsics which use \ID as an operand.
SmallVector< DbgVariableRecord * > getDVRAssignmentMarkers(const Instruction *Inst)
void deleteAssignmentMarkers(const Instruction *Inst)
Delete the llvm.dbg.assign intrinsics linked to Inst.
initializer< Ty > init(const Ty &Val)
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
const_iterator end(StringRef path)
Get end iterator over path.
This is an optimization pass for GlobalISel generic memory operations.
UnaryFunction for_each(R &&Range, UnaryFunction F)
Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly.
void PromoteMemToReg(ArrayRef< AllocaInst * > Allocas, DominatorTree &DT, AssumptionCache *AC=nullptr)
Promote the specified list of alloca instructions into scalar registers, inserting PHI nodes as appro...
void findDbgUsers(SmallVectorImpl< DbgVariableIntrinsic * > &DbgInsts, Value *V, SmallVectorImpl< DbgVariableRecord * > *DbgVariableRecords=nullptr)
Finds the debug info intrinsics describing a value.
auto successors(const MachineBasicBlock *BB)
bool onlyUsedByLifetimeMarkersOrDroppableInsts(const Value *V)
Return true if the only users of this pointer are lifetime markers or droppable instructions.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
bool isAllocaPromotable(const AllocaInst *AI)
Return true if this alloca is legal for promotion.
Value * simplifyInstruction(Instruction *I, const SimplifyQuery &Q)
See if we can compute a simplified version of this instruction.
void sort(IteratorTy Start, IteratorTy End)
void ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII, StoreInst *SI, DIBuilder &Builder)
===------------------------------------------------------------------—===// Dbg Intrinsic utilities
bool isKnownNonZero(const Value *V, const SimplifyQuery &Q, unsigned Depth=0)
Return true if the given value is known to be non-zero when defined.
RNSuccIterator< NodeRef, BlockT, RegionT > succ_begin(NodeRef Node)
bool onlyUsedByLifetimeMarkers(const Value *V)
Return true if the only users of this pointer are lifetime markers.
RNSuccIterator< NodeRef, BlockT, RegionT > succ_end(NodeRef Node)
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
auto predecessors(const MachineBasicBlock *BB)
bool isGuaranteedNotToBePoison(const Value *V, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)
Returns true if V cannot be poison, but may be undef.
unsigned pred_size(const MachineBasicBlock *BB)
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Function object to check whether the first component of a container supported by std::get (like std::...