49 cl::desc(
"Convert noalias attributes to metadata during inlining."));
54 cl::desc(
"Convert align attributes to assumptions during inlining."));
57 bool InsertLifetime) {
61 bool InsertLifetime) {
67 class InvokeInliningInfo {
76 : OuterResumeDest(II->getUnwindDest()), InnerResumeDest(nullptr),
77 CallerLPad(nullptr), InnerEHValuesPHI(nullptr) {
83 for (; isa<PHINode>(
I); ++
I) {
89 CallerLPad = cast<LandingPadInst>(
I);
95 return OuterResumeDest;
112 void addIncomingPHIValuesFor(
BasicBlock *BB)
const {
113 addIncomingPHIValuesForInto(BB, OuterResumeDest);
118 for (
unsigned i = 0, e = UnwindDestPHIValues.size(); i != e; ++i, ++
I) {
127 BasicBlock *InvokeInliningInfo::getInnerResumeDest() {
128 if (InnerResumeDest)
return InnerResumeDest;
133 OuterResumeDest->splitBasicBlock(SplitPoint,
134 OuterResumeDest->getName() +
".body");
137 const unsigned PHICapacity = 2;
142 for (
unsigned i = 0, e = UnwindDestPHIValues.size(); i != e; ++i, ++
I) {
143 PHINode *OuterPHI = cast<PHINode>(
I);
145 OuterPHI->
getName() +
".lpad-body",
148 InnerPHI->addIncoming(OuterPHI, OuterResumeDest);
153 "eh.lpad-body", InsertPoint);
155 InnerEHValuesPHI->addIncoming(CallerLPad, OuterResumeDest);
158 return InnerResumeDest;
165 void InvokeInliningInfo::forwardResume(
ResumeInst *RI,
174 addIncomingPHIValuesForInto(Src, Dest);
176 InnerEHValuesPHI->addIncoming(RI->
getOperand(0), Src);
186 InvokeInliningInfo &Invoke) {
210 Invoke.getOuterResumeDest(),
211 InvokeArgs, CI->
getName(), BB);
225 Invoke.addIncomingPHIValuesFor(BB);
245 InvokeInliningInfo Invoke(II);
250 if (
InvokeInst *II = dyn_cast<InvokeInst>(I->getTerminator()))
258 InlinedLPad->reserveClauses(OuterNum);
259 for (
unsigned OuterIdx = 0; OuterIdx != OuterNum; ++OuterIdx)
260 InlinedLPad->addClause(OuterLPad->
getClause(OuterIdx));
262 InlinedLPad->setCleanup(
true);
270 if (
ResumeInst *RI = dyn_cast<ResumeInst>(BB->getTerminator()))
271 Invoke.forwardResume(RI, InlinedLPads);
312 while (!Queue.empty()) {
313 const MDNode *M = cast<MDNode>(Queue.pop_back_val());
327 MDMap[*
I].reset(DummyNodes.
back().get());
336 for (
unsigned i = 0, ie = (*I)->getNumOperands(); i != ie; ++i) {
337 const Metadata *V = (*I)->getOperand(i);
338 if (
const MDNode *M = dyn_cast<MDNode>(V))
341 NewOps.
push_back(const_cast<Metadata *>(V));
345 MDTuple *TempM = cast<MDTuple>(MDMap[*
I]);
346 assert(TempM->isTemporary() &&
"Expected temporary node");
354 VMI != VMIE; ++VMI) {
406 E = CalledFunc->
arg_end(); I != E; ++
I) {
407 if (I->hasNoAliasAttr() && !I->hasNUses(0))
411 if (NoAliasArgs.
empty())
417 DT.
recalculate(const_cast<Function&>(*CalledFunc));
430 MDB.createAnonymousAliasScopeDomain(CalledFunc->
getName());
431 for (
unsigned i = 0, e = NoAliasArgs.
size(); i != e; ++i) {
439 Name +=
": argument ";
446 MDNode *NewScope = MDB.createAnonymousAliasScope(NewDomain, Name);
447 NewScopes.
insert(std::make_pair(A, NewScope));
453 VMI != VMIE; ++VMI) {
454 if (
const Instruction *I = dyn_cast<Instruction>(VMI->first)) {
462 bool IsArgMemOnlyCall =
false, IsFuncCall =
false;
465 if (
const LoadInst *LI = dyn_cast<LoadInst>(I))
466 PtrArgs.
push_back(LI->getPointerOperand());
467 else if (
const StoreInst *
SI = dyn_cast<StoreInst>(I))
469 else if (
const VAArgInst *VAAI = dyn_cast<VAArgInst>(I))
470 PtrArgs.
push_back(VAAI->getPointerOperand());
472 PtrArgs.
push_back(CXI->getPointerOperand());
473 else if (
const AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(I))
474 PtrArgs.
push_back(RMWI->getPointerOperand());
479 if (ICS.doesNotAccessMemory())
487 IsArgMemOnlyCall =
true;
491 AE = ICS.arg_end(); AI != AE; ++AI) {
497 if (IsArgMemOnlyCall && !(*AI)->getType()->isPointerTy())
508 if (PtrArgs.
empty() && !IsFuncCall)
518 for (
unsigned i = 0, ie = PtrArgs.
size(); i != ie; ++i) {
523 for (
Value *O : Objects)
529 bool CanDeriveViaCapture =
false, UsesAliasingPtr =
false;
530 for (
const Value *V : ObjSet) {
534 bool IsNonPtrConst = isa<ConstantInt>(V) || isa<ConstantFP>(V) ||
535 isa<ConstantPointerNull>(V) ||
536 isa<ConstantDataVector>(V) || isa<UndefValue>(V);
543 if (
const Argument *
A = dyn_cast<Argument>(V)) {
544 if (!
A->hasNoAliasAttr())
545 UsesAliasingPtr =
true;
547 UsesAliasingPtr =
true;
554 if (!isa<Argument>(V) &&
556 CanDeriveViaCapture =
true;
561 if (IsFuncCall && !IsArgMemOnlyCall)
562 CanDeriveViaCapture =
true;
573 if (!ObjSet.count(
A) && (!CanDeriveViaCapture ||
586 if (!NoAliases.
empty())
602 bool CanAddScopes = !UsesAliasingPtr;
603 if (CanAddScopes && IsFuncCall)
604 CanAddScopes = IsArgMemOnlyCall;
631 bool DTCalculated =
false;
637 unsigned Align = I->getType()->isPointerTy() ? I->getParamAlignment() : 0;
638 if (Align && !I->hasByValOrInAllocaAttr() && !I->hasNUses(0)) {
654 .CreateAlignmentAssumption(
DL, Arg, Align);
679 if (CalleeNode == CallerNode) {
680 CallCache.assign(I, E);
681 I = CallCache.begin();
685 for (; I != E; ++
I) {
686 const Value *OrigCall = I->first;
690 if (VMI == VMap.
end() || VMI->
second ==
nullptr)
714 if (!I->second->getFunction())
733 Type *AggTy = cast<PointerType>(Src->
getType())->getElementType();
741 Builder.CreateMemCpy(Dst, Src, Size, 1);
749 unsigned ByValAlignment) {
762 if (ByValAlignment <= 1)
785 Align = std::max(Align, ByValAlignment);
788 &*Caller->
begin()->begin());
800 switch (II->getIntrinsicID()) {
802 case Intrinsic::lifetime_start:
803 case Intrinsic::lifetime_end:
822 if (U->getType() != Int8PtrTy)
continue;
823 if (U->stripPointerCasts() != AI)
continue;
840 while (
DILocation *IA = CurInlinedAt->getInlinedAt()) {
854 for (
auto I = InlinedAtLocations.
rbegin(), E = InlinedAtLocations.
rend();
858 Ctx, MD->getLine(), MD->getColumn(), MD->getScope(), Last);
880 Ctx, InlinedAtNode->getLine(), InlinedAtNode->getColumn(),
881 InlinedAtNode->getScope(), InlinedAtNode->getInlinedAt());
888 for (; FI != Fn->
end(); ++FI) {
899 if (
auto *AI = dyn_cast<AllocaInst>(BI))
900 if (isa<Constant>(AI->getArraySize()))
903 BI->setDebugLoc(TheCallDL);
920 bool InsertLifetime) {
923 "Instruction not in function!");
944 if (CalledFunc->
hasGC()) {
945 if (!Caller->
hasGC())
947 else if (CalledFunc->
getGC() != Caller->
getGC())
960 if (CalledPersonality) {
961 if (!CallerPersonality)
967 else if (CalledPersonality != CallerPersonality)
989 "No varargs calls can be inlined!");
996 E = CalledFunc->
arg_end(); I != E; ++
I, ++AI, ++ArgNo) {
997 Value *ActualArg = *AI;
1006 if (ActualArg != *AI)
1010 VMap[
I] = ActualArg;
1023 false, Returns,
".i",
1024 &InlinedFunctionInfo, TheCall);
1027 FirstNewBlock = LastBlock; ++FirstNewBlock;
1030 for (std::pair<Value*, Value*> &
Init : ByValInit)
1032 FirstNewBlock, IFI);
1060 E = FirstNewBlock->end(); I != E; ) {
1079 while (isa<AllocaInst>(I) &&
1080 isa<Constant>(cast<AllocaInst>(I)->getArraySize())) {
1089 FirstNewBlock->getInstList(),
1098 bool InlinedMustTailCalls =
false;
1101 if (
CallInst *CI = dyn_cast<CallInst>(TheCall))
1102 CallSiteTailKind = CI->getTailCallKind();
1125 ChildTCK =
std::min(CallSiteTailKind, ChildTCK);
1141 for (
unsigned ai = 0, ae = IFI.
StaticAllocas.size(); ai != ae; ++ai) {
1155 uint64_t AllocaTypeSize =
DL.getTypeAllocSize(AllocaType);
1156 uint64_t AllocaArraySize = AIArraySize->getLimitedValue();
1159 if (AllocaArraySize == 0)
1164 if (AllocaArraySize != ~0ULL &&
1165 UINT64_MAX / AllocaArraySize >= AllocaTypeSize) {
1167 AllocaArraySize * AllocaTypeSize);
1171 builder.CreateLifetimeStart(AI, AllocaSize);
1175 if (InlinedMustTailCalls &&
1178 IRBuilder<>(RI).CreateLifetimeEnd(AI, AllocaSize);
1193 .CreateCall(StackSave, {},
"savedstack");
1202 IRBuilder<>(RI).CreateCall(StackRestore, SavedPtr);
1208 if (
InvokeInst *II = dyn_cast<InvokeInst>(TheCall))
1215 if (InlinedMustTailCalls) {
1218 bool NeedBitCast = !TheCall->
use_empty() && TheCall->
getType() != NewRetTy;
1225 if (!ReturnedMustTail) {
1234 auto *OldCast = dyn_cast_or_null<BitCastInst>(RI->getReturnValue());
1237 OldCast->eraseFromParent();
1251 if (Returns.
size() == 1 && std::distance(FirstNewBlock, Caller->
end()) == 1) {
1254 FirstNewBlock->begin(), FirstNewBlock->end());
1260 if (
InvokeInst *II = dyn_cast<InvokeInst>(TheCall)) {
1278 Returns[0]->eraseFromParent();
1291 BranchInst *CreatedBranchToNormalDest =
nullptr;
1292 if (
InvokeInst *II = dyn_cast<InvokeInst>(TheCall)) {
1301 CalledFunc->
getName()+
".exit");
1308 CalledFunc->
getName()+
".exit");
1315 assert(Br && Br->
getOpcode() == Instruction::Br &&
1316 "splitBasicBlock broken!");
1324 FirstNewBlock, Caller->
end());
1331 if (Returns.
size() > 1) {
1336 AfterCallBB->
begin());
1345 for (
unsigned i = 0, e = Returns.
size(); i != e; ++i) {
1348 "Ret value not consistent in function!");
1356 for (
unsigned i = 0, e = Returns.
size(); i != e; ++i) {
1367 if (CreatedBranchToNormalDest)
1369 }
else if (!Returns.
empty()) {
1373 if (TheCall == Returns[0]->getReturnValue())
1380 BasicBlock *ReturnBB = Returns[0]->getParent();
1388 if (CreatedBranchToNormalDest)
1389 CreatedBranchToNormalDest->
setDebugLoc(Returns[0]->getDebugLoc());
1392 Returns[0]->eraseFromParent();
1410 assert(cast<BranchInst>(Br)->isUnconditional() &&
"splitBasicBlock broken!");
1411 BasicBlock *CalleeEntry = cast<BranchInst>(Br)->getSuccessor(0);
void setPersonalityFn(Constant *C)
ReturnInst - Return a value (possibly void), from a function.
const Value * getCalledValue() const
getCalledValue - Get a pointer to the function that is invoked by this instruction.
iplist< Instruction >::iterator eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing basic block and deletes it...
void push_back(const T &Elt)
A parsed version of the target data layout string in and methods for querying it. ...
void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs=false)
Notify the BasicBlock that the predecessor Pred is no longer able to reach it.
void addIncoming(Value *V, BasicBlock *BB)
addIncoming - Add an incoming value to the end of the PHI list
static cl::opt< bool > EnableNoAliasConversion("enable-noalias-to-md-conversion", cl::init(true), cl::Hidden, cl::desc("Convert noalias attributes to metadata during inlining."))
unsigned getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign, const DataLayout &DL, const Instruction *CxtI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr)
getOrEnforceKnownAlignment - If the specified pointer has an alignment that we can determine...
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
LLVM Argument representation.
MDNode * getScope() const
CallGraph * CG
CG - If non-null, InlineFunction will update the callgraph to reflect the changes it makes...
ValTy * getArgument(unsigned ArgNo) const
bool onlyReadsMemory() const
Determine if the function does not access or only reads memory.
A Module instance is used to store all the information related to an LLVM module. ...
Constant * getClause(unsigned Idx) const
Get the value of the clause at index Idx.
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
bool InlineFunction(CallInst *C, InlineFunctionInfo &IFI, bool InsertLifetime=true)
InlineFunction - This function inlines the called function into the basic block of the caller...
InstrTy * getInstruction() const
AtomicCmpXchgInst - an instruction that atomically checks whether a specified value is in a memory lo...
CallInst * getTerminatingMustTailCall()
Returns the call instruction marked 'musttail' prior to the terminating return instruction of this ba...
unsigned getNumOperands() const
Return number of MDNode operands.
unsigned getPrefTypeAlignment(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
ModRefBehavior
ModRefBehavior - Summary of how a function affects memory in the program.
const char * getGC() const
CallInst - This class represents a function call, abstracting a target machine's calling convention...
static void AddAlignmentAssumptions(CallSite CS, InlineFunctionInfo &IFI)
If the inlined function has non-byval align arguments, then add .assume-based alignment assumptions t...
Type * getReturnType() const
const Function * getParent() const
Return the enclosing method, or null if none.
FunTy * getCaller() const
getCaller - Return the caller function for this call site
LoadInst - an instruction for reading from memory.
static IntegerType * getInt64Ty(LLVMContext &C)
AtomicRMWInst - an instruction that atomically reads a memory location, combines it with another valu...
void GetUnderlyingObjects(Value *V, SmallVectorImpl< Value * > &Objects, const DataLayout &DL, LoopInfo *LI=nullptr, unsigned MaxLookup=6)
This method is similar to GetUnderlyingObject except that it can look through phi and select instruct...
User::const_op_iterator arg_iterator
arg_iterator - The type of iterator to use when looping over actual arguments at this call site...
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
InlineFunctionInfo - This class captures the data input to the InlineFunction call, and records the auxiliary results produced by it.
iterator end()
Get an iterator to the end of the SetVector.
A node in the call graph for a module.
static void AddAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap, const DataLayout &DL, AliasAnalysis *AA)
If the inlined function has noalias arguments, then add new alias scopes for each noalias argument...
StringRef getName() const
Return a constant reference to the value's name.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
iterator begin()
Instruction iterator methods.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
void addCalledFunction(CallSite CS, CallGraphNode *M)
Adds a function to the list of functions called by this one.
std::vector< CallRecord >::iterator iterator
void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, ValueToValueMapTy &VMap, bool ModuleLevelChanges, SmallVectorImpl< ReturnInst * > &Returns, const char *NameSuffix="", ClonedCodeInfo *CodeInfo=nullptr, Instruction *TheCall=nullptr)
CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto, except that it does some simpl...
Value * getReturnValue() const
Convenience accessor. Returns null if there is no return value.
DILocation * get() const
Get the underlying DILocation.
A Use represents the edge between a Value definition and its users.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
bool doesNotThrow() const
Determine if the call cannot unwind.
This file contains the simple types necessary to represent the attributes associated with functions a...
static void CloneAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap)
When inlining a function that contains noalias scope metadata, this metadata needs to be cloned so th...
Number of individual test Apply this number of consecutive mutations to each input exit after the first new interesting input is found the minimized corpus is saved into the first input directory Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
bool isMustTailCall() const
LandingPadInst * getLandingPadInst() const
getLandingPadInst - Get the landingpad instruction from the landing pad block (the unwind destination...
bool doesNotThrow() const
Determine if the call cannot unwind.
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
static void UpdateCallGraphAfterInlining(CallSite CS, Function::iterator FirstNewBlock, ValueToValueMapTy &VMap, InlineFunctionInfo &IFI)
Once we have cloned code over from a callee into the caller, update the specified callgraph to reflec...
bool insert(const value_type &X)
Insert a new element into the SetVector.
LLVMContext & getContext() const
getContext - Return the LLVMContext in which this type was uniqued.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
const BasicBlock & back() const
iterator find(const KeyT &Val)
iterator begin()
Get an iterator to the beginning of the SetVector.
bool empty() const
Determine if the SetVector is empty or not.
static std::string utostr(uint64_t X, bool isNeg=false)
static void HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB, InvokeInliningInfo &Invoke)
When we inline a basic block into an invoke, we have to turn all of the calls that can throw into inv...
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
unsigned getNumClauses() const
getNumClauses - Get the number of clauses for this landing pad.
StoreInst - an instruction for storing to memory.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
void replaceAllUsesWith(Metadata *MD)
RAUW a temporary.
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Return a temporary node.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Type * getElementType() const
static unsigned getKnownAlignment(Value *V, const DataLayout &DL, const Instruction *CxtI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr)
getKnownAlignment - Try to infer an alignment for the specified pointer.
BasicBlock * getNormalDest() const
PointerType - Class to represent pointers.
bool mayReadOrWriteMemory() const
mayReadOrWriteMemory - Return true if this instruction may read or write memory.
static bool isUsedByLifetimeMarker(Value *V)
static cl::opt< bool > PreserveAlignmentAssumptions("preserve-alignment-assumptions-during-inlining", cl::init(true), cl::Hidden, cl::desc("Convert align attributes to assumptions during inlining."))
void clear()
Clear the cache of .assume intrinsics for a function.
initializer< Ty > init(const Ty &Val)
LandingPadInst - The landingpad instruction holds all of the information necessary to generate correc...
Subclasses of this class are all able to terminate a basic block.
void setDebugLoc(DebugLoc Loc)
setDebugLoc - Set the debug location information for this instruction.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
BranchInst - Conditional or Unconditional Branch instruction.
FunTy * getCalledFunction() const
getCalledFunction - Return the function being called if this is a direct call, otherwise return null ...
OnlyAccessesArgumentPointees - The only memory references in this function (if it has any) are non-vo...
This is an important base class in LLVM.
PointerType * getType() const
getType - Overload to return most specific pointer type
ResumeInst - Resume the propagation of an exception.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isByValArgument(unsigned ArgNo) const
Determine whether this argument is passed by value.
ReturnInst * CreateRet(Value *V)
Create a 'ret <val>' instruction.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Interval::pred_iterator pred_begin(Interval *I)
pred_begin/pred_end - define methods so that Intervals may be used just like BasicBlocks can with the...
bool hasPersonalityFn() const
Get the personality function associated with this function.
const DebugLoc & getDebugLoc() const
getDebugLoc - Return the debug location for this node as a DebugLoc.
SmallVector< WeakVH, 8 > InlinedCalls
InlinedCalls - InlineFunction fills this in with callsites that were inlined from the callee...
AssumptionCacheTracker * ACT
const InstListType & getInstList() const
Return the underlying instruction list container.
static bool hasLifetimeMarkers(AllocaInst *AI)
Value * getOperand(unsigned i) const
Interval::pred_iterator pred_end(Interval *I)
void setTailCallKind(TailCallKind TCK)
static UndefValue * get(Type *T)
get() - Static factory methods - Return an 'undef' object of the specified type.
VAArgInst - This class represents the va_arg llvm instruction, which returns an argument of the speci...
LLVMContext & getContext() const
All values hold a context through their type.
OnlyReadsArgumentPointees - The only memory references in this function (if it has any) are non-volat...
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS)
getModRefBehavior - Return the behavior when calling the given call site.
iterator erase(iterator where)
void setMetadata(unsigned KindID, MDNode *Node)
setMetadata - Set the metadata of the specified kind to the specified node.
bool isIdentifiedFunctionLocal(const Value *V)
isIdentifiedFunctionLocal - Return true if V is umabigously identified at the function-level.
static void HandleByValArgumentInit(Value *Dst, Value *Src, Module *M, BasicBlock *InsertBlock, InlineFunctionInfo &IFI)
const MDOperand & getOperand(unsigned I) const
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
A SetVector that performs no allocations if smaller than a certain size.
const BasicBlockListType & getBasicBlockList() const
BasicBlock * getUnwindDest() const
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
This is the shared class of boolean and integer constants.
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
MDNode * getMetadata(unsigned KindID) const
getMetadata - Get the metadata of given kind attached to this Instruction.
TailCallKind getTailCallKind() const
unsigned arg_size() const
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=nullptr)
static void fixupLineNumbers(Function *Fn, Function::iterator FI, Instruction *TheCall)
Update inlined instructions' line numbers to to encode location where these instructions are inlined...
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...
const BasicBlock & getEntryBlock() const
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
void splice(iterator where, iplist &L2)
void setOperand(unsigned i, Value *Val)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
bool replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, DIBuilder &Builder, bool Deref)
Replaces llvm.dbg.declare instruction when an alloca is replaced with a new value.
Value * getIncomingValueForBlock(const BasicBlock *BB) const
iterator_range< user_iterator > users()
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
void setGC(const char *Str)
const AttributeSet & getAttributes() const
getAttributes - Return the parameter attributes for this call.
bool ContainsCalls
ContainsCalls - This is set to true if the cloned code contains a normal call instruction.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
SmallVector< AllocaInst *, 4 > StaticAllocas
StaticAllocas - InlineFunction fills this in with all static allocas that get copied into the caller...
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
The basic data container for the call graph of a Module of IR.
Constant * getPersonalityFn() const
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
ImmutableCallSite - establish a view to a call site for examination.
static MDNode * concatenate(MDNode *A, MDNode *B)
Methods for metadata merging.
iplist< BasicBlock >::iterator eraseFromParent()
Unlink 'this' from the containing function and delete it.
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
FunctionType * getFunctionType() const
static Value * HandleByValArgument(Value *Arg, Instruction *TheCall, const Function *CalledFunc, InlineFunctionInfo &IFI, unsigned ByValAlignment)
When inlining a call site that has a byval argument, we have to make the implicit memcpy explicit by ...
ClonedCodeInfo - This struct can be used to capture information about code being cloned, while it is being cloned.
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
LLVMContext & getContext() const
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
reverse_iterator rbegin()
bool ContainsDynamicAllocas
ContainsDynamicAllocas - This is set to true if the cloned code contains a 'dynamic' alloca...
unsigned getParamAlignment(unsigned i) const
Extract the alignment for a call or parameter (0=unknown).
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
vector_type::const_iterator iterator
unsigned getOpcode() const
getOpcode() returns a member of one of the enums like Instruction::Add.
A vector that has set insertion semantics.
void removeCallEdgeFor(CallSite CS)
Removes the edge in the node for the specified call site.
const Value * getArraySize() const
getArraySize - Get the number of elements allocated.
InvokeInst - Invoke instruction.
AssumptionCache & getAssumptionCache(Function &F)
Get the cached assumptions for a function.
IterTy arg_begin() const
arg_begin/arg_end - Return iterators corresponding to the actual argument list for a call site...
static DebugLoc updateInlinedAtInfo(DebugLoc DL, DILocation *InlinedAtNode, LLVMContext &Ctx, DenseMap< const DILocation *, DILocation * > &IANodes)
Rebuild the entire inlined-at chain for this instruction so that the top of the chain now is inlined-...
bool isCleanup() const
isCleanup - Return 'true' if this landingpad instruction is a cleanup.
void recalculate(FT &F)
recalculate - compute a dominator tree for the given function
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
std::vector< CallRecord > CalledFunctionsVector
Value * SimplifyInstruction(Instruction *I, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr)
SimplifyInstruction - See if we can compute a simplified version of this instruction.
static void Split(std::vector< std::string > &V, StringRef S)
Split - Splits a string of comma separated items in to a vector of strings.
Type * getAllocatedType() const
getAllocatedType - Return the type that is being allocated by the instruction.
const BasicBlock * getParent() const
IntrinsicInst - A useful wrapper class for inspecting calls to intrinsic functions.
AllocaInst - an instruction to allocate memory on the stack.
bool PointerMayBeCapturedBefore(const Value *V, bool ReturnCaptures, bool StoreCaptures, const Instruction *I, DominatorTree *DT, bool IncludeI=false)
PointerMayBeCapturedBefore - Return true if this pointer value may be captured by the enclosing funct...
static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock, ClonedCodeInfo &InlinedCodeInfo)
If we inlined an invoke site, we need to convert calls in the body of the inlined function into invok...