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");
70 Type *ExpectedType =
nullptr;
78 ExpectedType = LI->getType();
79 else if (LI->getType() != ExpectedType)
82 if (
SI->getValueOperand() == AI)
88 Type *StoreType =
SI->getValueOperand()->getType();
90 ExpectedType = StoreType;
91 else if (StoreType != ExpectedType)
94 if (!
II->isLifetimeStartOrEnd() && !
II->isDroppable() &&
95 II->getIntrinsicID() != Intrinsic::fake_use)
101 if (!GEPI->hasAllZeroIndices())
131class AssignmentTrackingInfo {
138 void init(AllocaInst *AI) {
139 SmallSet<DebugVariable, 2> Vars;
141 if (Vars.
insert(DebugVariable(DVR)).second)
142 DVRAssigns.push_back(DVR);
148 void updateForDeletedStore(
149 StoreInst *ToDelete, DIBuilder &DIB,
150 SmallPtrSet<DbgVariableRecord *, 8> *DVRAssignsToDelete)
const {
153 if (DVRAssigns.empty())
162 SmallSet<DebugVariableAggregate, 2> VarHasDbgAssignForStore;
163 auto InsertValueForAssign = [&](
auto *DbgAssign,
auto *&AssignList) {
164 VarHasDbgAssignForStore.
insert(DebugVariableAggregate(DbgAssign));
165 AssignList->insert(DbgAssign);
166 createDebugValue(DIB, DbgAssign->getValue(), DbgAssign->getVariable(),
167 DbgAssign->getExpression(), DbgAssign->getDebugLoc(),
171 InsertValueForAssign(Assign, DVRAssignsToDelete);
181 auto ConvertUnlinkedAssignToValue = [&](DbgVariableRecord *
Assign) {
182 if (VarHasDbgAssignForStore.
contains(DebugVariableAggregate(Assign)))
186 for_each(DVRAssigns, ConvertUnlinkedAssignToValue);
191 void updateForNewPhi(PHINode *NewPhi, DIBuilder &DIB)
const {
195 for (
auto *DVR : DVRAssigns)
199 void clear() { DVRAssigns.clear(); }
200 bool empty() {
return DVRAssigns.empty(); }
204 using DPUserVec = SmallVector<DbgVariableRecord *, 1>;
209 StoreInst *OnlyStore;
211 bool OnlyUsedInOneBlock;
220 AssignmentTrackingInfo AssignmentTracking;
223 DefiningBlocks.clear();
227 OnlyUsedInOneBlock =
true;
230 AssignmentTracking.clear();
235 void AnalyzeAlloca(AllocaInst *AI) {
241 for (User *U : AI->
users()) {
246 DefiningBlocks.push_back(
SI->getParent());
249 ValueType =
SI->getValueOperand()->getType();
251 assert(ValueType ==
SI->getValueOperand()->getType() &&
252 "All stores were checked to have used the same type");
262 "All loads where checked to have used the same type");
265 if (OnlyUsedInOneBlock) {
267 OnlyBlock =
User->getParent();
268 else if (OnlyBlock !=
User->getParent())
269 OnlyUsedInOneBlock =
false;
274 std::copy_if(AllDPUsers.
begin(), AllDPUsers.
end(),
275 std::back_inserter(DPUsers),
276 [](DbgVariableRecord *DVR) { return !DVR->isDbgAssign(); });
277 AssignmentTracking.init(AI);
281template <
typename T>
class VectorWithUndo {
286 void undo(
size_t S) {
288 while (S < Undo.size()) {
289 Vals[Undo.back().first] = Undo.back().second;
294 void resize(
size_t Sz) { Vals.resize(Sz); }
296 size_t undoSize()
const {
return Undo.size(); }
298 const T &operator[](
size_t Idx)
const {
return Vals[Idx]; }
300 void set(
size_t Idx,
const T &Val) {
301 if (Vals[Idx] == Val)
303 Undo.emplace_back(Idx, Vals[Idx]);
307 void init(
size_t Idx,
const T &Val) {
314struct RenamePassData {
315 RenamePassData(BasicBlock *
B, BasicBlock *
P,
size_t V,
size_t L)
316 : BB(
B), Pred(
P), UndoVals(
V), UndoLocs(
L) {}
330class LargeBlockInfo {
336 DenseMap<const Instruction *, unsigned> InstNumbers;
341 static bool isInterestingInstruction(
const Instruction *
I) {
347 unsigned getInstructionIndex(
const Instruction *
I) {
348 assert(isInterestingInstruction(
I) &&
349 "Not a load/store to/from an alloca?");
352 DenseMap<const Instruction *, unsigned>::iterator It = InstNumbers.find(
I);
353 if (It != InstNumbers.end())
361 for (
const Instruction &BBI : *BB)
362 if (isInterestingInstruction(&BBI))
363 InstNumbers[&BBI] = InstNo++;
364 It = InstNumbers.
find(
I);
366 assert(It != InstNumbers.end() &&
"Didn't insert instruction?");
370 void deleteValue(
const Instruction *
I) { InstNumbers.
erase(
I); }
372 void clear() { InstNumbers.clear(); }
375struct PromoteMem2Reg {
377 std::vector<AllocaInst *> Allocas;
385 const SimplifyQuery SQ;
388 DenseMap<AllocaInst *, unsigned> AllocaLookup;
395 DenseMap<std::pair<unsigned, unsigned>, PHINode *> NewPhiNodes;
399 DenseMap<PHINode *, unsigned> PhiToAllocaMap;
413 SmallPtrSet<DbgVariableRecord *, 8> DVRAssignsToDelete;
420 SmallVector<unsigned> BBNumPreds;
423 VectorWithUndo<Value *> IncomingVals;
426 VectorWithUndo<DebugLoc> IncomingLocs;
432 bool NoSignedZeros =
false;
437 : Allocas(Allocas.
begin(), Allocas.
end()), DT(DT),
439 AC(AC), SQ(DT.
getRoot()->getDataLayout(),
445 void RemoveFromAllocasList(
unsigned &AllocaIdx) {
446 Allocas[AllocaIdx] = Allocas.back();
451 unsigned getNumPreds(
const BasicBlock *BB) {
453 unsigned &NP = BBNumPreds[BB->
getNumber()];
460 const SmallPtrSetImpl<BasicBlock *> &DefBlocks,
461 SmallPtrSetImpl<BasicBlock *> &LiveInBlocks);
462 void RenamePass(BasicBlock *BB, BasicBlock *Pred);
463 bool QueuePhiNode(BasicBlock *BB,
unsigned AllocaIdx,
unsigned &
Version);
466 void cleanUpDbgAssigns() {
467 for (
auto *DVR : DVRAssignsToDelete)
468 DVR->eraseFromParent();
469 DVRAssignsToDelete.clear();
472 void pushToWorklist(BasicBlock *BB, BasicBlock *Pred) {
473 Worklist.emplace_back(BB, Pred, IncomingVals.undoSize(),
474 IncomingLocs.undoSize());
477 RenamePassData popFromWorklist() {
478 RenamePassData
R = Worklist.back();
480 IncomingVals.undo(
R.UndoVals);
481 IncomingLocs.undo(
R.UndoLocs);
516 if (AC && LI->
getMetadata(LLVMContext::MD_nonnull) &&
532 if (
I->isDroppable()) {
533 I->dropDroppableUse(U);
537 if (!
I->getType()->isVoidTy()) {
552 I->eraseFromParent();
574 bool RequireDominatingStore =
580 Info.UsingBlocks.clear();
584 if (UserInst == OnlyStore)
592 if (RequireDominatingStore) {
597 if (StoreIndex == -1)
598 StoreIndex = LBI.getInstructionIndex(OnlyStore);
600 if (
unsigned(StoreIndex) > LBI.getInstructionIndex(LI)) {
602 Info.UsingBlocks.push_back(StoreBB);
609 Info.UsingBlocks.push_back(LI->
getParent());
627 if (!Info.UsingBlocks.empty())
632 Info.AssignmentTracking.updateForDeletedStore(Info.OnlyStore, DIB,
654 Info.OnlyStore->eraseFromParent();
655 LBI.deleteValue(Info.OnlyStore);
678 AllocaInst *AI,
const AllocaInfo &Info, LargeBlockInfo &LBI,
688 StoresByIndexTy StoresByIndex;
692 StoresByIndex.
push_back(std::make_pair(LBI.getInstructionIndex(
SI),
SI));
705 unsigned LoadIdx = LBI.getInstructionIndex(LI);
710 std::make_pair(LoadIdx,
static_cast<StoreInst *
>(
nullptr)),
713 if (
I == StoresByIndex.begin()) {
714 if (StoresByIndex.empty())
724 ReplVal = std::prev(
I)->second->getOperand(0);
744 Info.AssignmentTracking.updateForDeletedStore(
SI, DIB, DVRAssignsToDelete);
752 SI->eraseFromParent();
771void PromoteMem2Reg::run() {
774 AllocaATInfo.
resize(Allocas.size());
775 AllocaDPUsers.
resize(Allocas.size());
776 AllocaValueTypes.
resize(Allocas.size());
782 NoSignedZeros =
F.getFnAttribute(
"no-signed-zeros-fp-math").getValueAsBool();
784 for (
unsigned AllocaNum = 0; AllocaNum != Allocas.size(); ++AllocaNum) {
785 AllocaInst *AI = Allocas[AllocaNum];
789 "All allocas should be in the same function, which is same as DF!");
798 RemoveFromAllocasList(AllocaNum);
805 Info.AnalyzeAlloca(AI);
809 if (
Info.DefiningBlocks.size() == 1) {
811 &DVRAssignsToDelete)) {
813 RemoveFromAllocasList(AllocaNum);
821 if (
Info.OnlyUsedInOneBlock &&
823 &DVRAssignsToDelete)) {
825 RemoveFromAllocasList(AllocaNum);
830 if (BBNumPreds.
empty())
831 BBNumPreds.
resize(
F.getMaxBlockNumber());
834 if (!
Info.AssignmentTracking.empty())
835 AllocaATInfo[AllocaNum] =
Info.AssignmentTracking;
836 if (!
Info.DPUsers.empty())
837 AllocaDPUsers[AllocaNum] =
Info.DPUsers;
838 AllocaValueTypes[AllocaNum] =
Info.ValueType;
841 AllocaLookup[Allocas[AllocaNum]] = AllocaNum;
845 Info.DefiningBlocks);
849 SmallPtrSet<BasicBlock *, 32> LiveInBlocks;
856 IDF.setLiveInBlocks(LiveInBlocks);
857 IDF.setDefiningBlocks(DefBlocks);
859 IDF.calculate(PHIBlocks);
860 llvm::sort(PHIBlocks, [](BasicBlock *
A, BasicBlock *
B) {
861 return A->getNumber() <
B->getNumber();
865 for (BasicBlock *BB : PHIBlocks)
866 QueuePhiNode(BB, AllocaNum, CurrentVersion);
869 if (Allocas.empty()) {
878 IncomingVals.resize(Allocas.size());
879 for (
unsigned i = 0, e = Allocas.size(); i != e; ++i)
885 IncomingLocs.resize(Allocas.size());
886 for (
unsigned i = 0, e = Allocas.size(); i != e; ++i)
890 Visited.
resize(
F.getMaxBlockNumber(),
false);
893 pushToWorklist(&
F.front(),
nullptr);
896 RenamePassData RPD = popFromWorklist();
897 RenamePass(RPD.BB, RPD.Pred);
898 }
while (!Worklist.
empty());
901 for (Instruction *
A : Allocas) {
909 A->eraseFromParent();
913 for (
auto &DbgUsers : AllocaDPUsers) {
914 for (DbgVariableRecord *DbgItem : DbgUsers)
915 if (DbgItem->isAddressOfVariable() ||
916 DbgItem->getExpression()->startsWithDeref())
917 DbgItem->eraseFromParent();
924 bool EliminatedAPHI =
true;
925 while (EliminatedAPHI) {
926 EliminatedAPHI =
false;
932 for (DenseMap<std::pair<unsigned, unsigned>, PHINode *>::iterator
934 E = NewPhiNodes.
end();
936 PHINode *PN =
I->second;
943 EliminatedAPHI =
true;
955 for (
const auto &PhiNode : NewPhiNodes) {
958 PHINode *SomePHI = PhiNode.second;
960 if (&BB->
front() != SomePHI)
976 return A->getNumber() <
B->getNumber();
987 "PHI node has entry for a block which is not a predecessor!");
1002 for (BasicBlock *Pred : Preds)
1007 NewPhiNodes.clear();
1008 cleanUpDbgAssigns();
1016void PromoteMem2Reg::ComputeLiveInBlocks(
1017 AllocaInst *AI, AllocaInfo &Info,
1018 const SmallPtrSetImpl<BasicBlock *> &DefBlocks,
1019 SmallPtrSetImpl<BasicBlock *> &LiveInBlocks) {
1023 SmallVector<BasicBlock *, 64> LiveInBlockWorklist(
Info.UsingBlocks.begin(),
1024 Info.UsingBlocks.end());
1029 for (
unsigned i = 0, e = LiveInBlockWorklist.size(); i != e; ++i) {
1031 if (!DefBlocks.
count(BB))
1038 if (
SI->getOperand(1) != AI)
1043 LiveInBlockWorklist[i] = LiveInBlockWorklist.back();
1044 LiveInBlockWorklist.pop_back();
1060 while (!LiveInBlockWorklist.empty()) {
1061 BasicBlock *BB = LiveInBlockWorklist.pop_back_val();
1065 if (!LiveInBlocks.
insert(BB).second)
1077 LiveInBlockWorklist.push_back(
P);
1085bool PromoteMem2Reg::QueuePhiNode(BasicBlock *BB,
unsigned AllocaNo,
1088 PHINode *&PN = NewPhiNodes[std::make_pair(BB->
getNumber(), AllocaNo)];
1100 PhiToAllocaMap[PN] = AllocaNo;
1107 bool ApplyMergedLoc) {
1119void PromoteMem2Reg::RenamePass(BasicBlock *BB, BasicBlock *Pred) {
1125 if (PhiToAllocaMap.
count(APN)) {
1132 unsigned NewPHINumOperands = APN->getNumOperands();
1135 assert(NumEdges &&
"Must be at least one edge from Pred to BB!");
1140 unsigned AllocaNo = PhiToAllocaMap[APN];
1144 APN->getNumIncomingValues() > 0);
1147 for (
unsigned i = 0; i != NumEdges; ++i)
1148 APN->addIncoming(IncomingVals[AllocaNo], Pred);
1156 APN->setHasNoSignedZeros(
true);
1159 IncomingVals.set(AllocaNo, APN);
1160 AllocaATInfo[AllocaNo].updateForNewPhi(APN, DIB);
1161 for (DbgVariableRecord *DbgItem : AllocaDPUsers[AllocaNo])
1162 if (DbgItem->isAddressOfVariable())
1173 }
while (APN->getNumOperands() == NewPHINumOperands);
1190 DenseMap<AllocaInst *, unsigned>::iterator AI = AllocaLookup.
find(Src);
1191 if (AI == AllocaLookup.
end())
1194 Value *
V = IncomingVals[AI->second];
1207 DenseMap<AllocaInst *, unsigned>::iterator ai = AllocaLookup.
find(Dest);
1208 if (ai == AllocaLookup.
end())
1212 unsigned AllocaNo = ai->second;
1213 IncomingVals.set(AllocaNo,
SI->getOperand(0));
1216 IncomingLocs.set(AllocaNo,
SI->getDebugLoc());
1217 AllocaATInfo[AllocaNo].updateForDeletedStore(SI, DIB,
1218 &DVRAssignsToDelete);
1219 for (DbgVariableRecord *DbgItem : AllocaDPUsers[ai->second])
1220 if (DbgItem->isAddressOfVariable())
1222 SI->eraseFromParent();
1229 SmallPtrSet<BasicBlock *, 8> VisitedSuccs;
1232 if (VisitedSuccs.
insert(S).second)
1233 pushToWorklist(S, BB);
1239 if (Allocas.
empty())
1242 PromoteMem2Reg(Allocas, DT, AC).run();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Function Alias Analysis false
static const Function * getParent(const Value *V)
This file implements the BitVector class.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
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)
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
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.
LLVM_ABI 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 Function * getParent() const
Return the enclosing method, or null if none.
const Instruction & front() const
InstListType::iterator iterator
Instruction iterators...
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 LLVM_ABI ConstantInt * getTrue(LLVMContext &Context)
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
LLVM_ABI bool startsWithDeref() const
Return whether the first element a DW_OP_deref.
A parsed version of the target data layout string in and methods for querying it.
LLVM_ABI void eraseFromParent()
Record of a variable value-assignment, aka a non instruction representation of the dbg....
bool isValueOfVariable() const
Determine if this describes the value of a local variable.
bool isAddressOfVariable() const
Does this describe the address of a local variable.
DIExpression * getExpression() const
static LLVM_ABI DbgVariableRecord * createDbgVariableRecord(Value *Location, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
static DebugLoc getCompilerGenerated()
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.
LLVM_ABI 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.
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
LLVM_ABI 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.
LLVM_ABI void insertBefore(InstListType::iterator InsertPos)
Insert an unlinked instruction into a basic block immediately before the specified position.
LLVM_ABI 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 setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
LLVM_ABI void applyMergedLocation(DebugLoc LocA, DebugLoc LocB)
Merge 2 debug locations and apply it to the Instruction.
LLVM_ABI 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 PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
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.
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.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI 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.
LLVM_ABI bool isDroppable() const
A droppable user is a user for which uses can be dropped without affecting correctness and should be ...
Value * getOperand(unsigned i) const
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
LLVMContext & getContext() const
All values hold a context through their type.
iterator_range< user_iterator > users()
static LLVM_ABI void dropDroppableUse(Use &U)
Remove the droppable use U.
iterator_range< use_iterator > uses()
const ParentTy * getParent() const
self_iterator getIterator()
@ BasicBlock
Various leaf nodes.
LLVM_ABI Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > Tys={})
Look up the Function declaration of the intrinsic id in the Module M.
SmallVector< DbgVariableRecord * > getDVRAssignmentMarkers(const Instruction *Inst)
Return a range of dbg_assign records for which Inst performs the assignment they encode.
LLVM_ABI 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.
@ User
could "use" a pointer
friend class Instruction
Iterator for Instructions in a `BasicBlock.
LLVM_ABI iterator begin() const
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
UnaryFunction for_each(R &&Range, UnaryFunction F)
Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI 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...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
auto successors(const MachineBasicBlock *BB)
LLVM_ABI bool onlyUsedByLifetimeMarkersOrDroppableInsts(const Value *V)
Return true if the only users of this pointer are lifetime markers or droppable instructions.
LLVM_ABI void InsertDebugValueAtStoreLoc(DbgVariableRecord *DVR, StoreInst *SI, DIBuilder &Builder)
===------------------------------------------------------------------—===// Dbg Intrinsic utilities
constexpr from_range_t from_range
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...
auto pred_size(const MachineBasicBlock *BB)
LLVM_ABI bool isAllocaPromotable(const AllocaInst *AI)
Return true if this alloca is legal for promotion.
LLVM_ABI Value * simplifyInstruction(Instruction *I, const SimplifyQuery &Q)
See if we can compute a simplified version of this instruction.
FunctionAddr VTableAddr uintptr_t uintptr_t Version
auto reverse(ContainerTy &&C)
void sort(IteratorTy Start, IteratorTy End)
LLVM_ABI void ConvertDebugDeclareToDebugValue(DbgVariableRecord *DVR, StoreInst *SI, DIBuilder &Builder)
Inserts a dbg.value record before a store to an alloca'd value that has an associated dbg....
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
IDFCalculator< false > ForwardIDFCalculator
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI 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.
LLVM_ABI bool onlyUsedByLifetimeMarkers(const Value *V)
Return true if the only users of this pointer are lifetime markers.
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...
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
auto predecessors(const MachineBasicBlock *BB)
LLVM_ABI 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.
LLVM_ABI void findDbgUsers(Value *V, SmallVectorImpl< DbgVariableRecord * > &DbgVariableRecords)
Finds the debug info records describing a value.
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::...