80 cl::desc(
"Convert noalias attributes to metadata during inlining."));
85 cl::desc(
"Convert align attributes to assumptions during inlining."));
88 AAResults *CalleeAAR,
bool InsertLifetime) {
93 AAResults *CalleeAAR,
bool InsertLifetime) {
100 class LandingPadInliningInfo {
111 PHINode *InnerEHValuesPHI =
nullptr;
123 for (; isa<PHINode>(
I); ++
I) {
129 CallerLPad = cast<LandingPadInst>(
I);
135 return OuterResumeDest;
152 void addIncomingPHIValuesFor(
BasicBlock *BB)
const {
153 addIncomingPHIValuesForInto(BB, OuterResumeDest);
158 for (
unsigned i = 0, e = UnwindDestPHIValues.
size(); i != e; ++i, ++
I) {
168 BasicBlock *LandingPadInliningInfo::getInnerResumeDest() {
169 if (InnerResumeDest)
return InnerResumeDest;
174 OuterResumeDest->splitBasicBlock(SplitPoint,
175 OuterResumeDest->getName() +
".body");
178 const unsigned PHICapacity = 2;
181 Instruction *InsertPoint = &InnerResumeDest->front();
183 for (
unsigned i = 0, e = UnwindDestPHIValues.size(); i != e; ++i, ++
I) {
184 PHINode *OuterPHI = cast<PHINode>(
I);
186 OuterPHI->
getName() +
".lpad-body",
189 InnerPHI->addIncoming(OuterPHI, OuterResumeDest);
194 "eh.lpad-body", InsertPoint);
196 InnerEHValuesPHI->addIncoming(CallerLPad, OuterResumeDest);
199 return InnerResumeDest;
206 void LandingPadInliningInfo::forwardResume(
215 addIncomingPHIValuesForInto(Src, Dest);
217 InnerEHValuesPHI->addIncoming(RI->
getOperand(0), Src);
223 if (
auto *FPI = dyn_cast<FuncletPadInst>(EHPad))
224 return FPI->getParentPad();
236 while (!Worklist.
empty()) {
243 Value *UnwindDestToken =
nullptr;
244 if (
auto *CatchSwitch = dyn_cast<CatchSwitchInst>(CurrentPad)) {
245 if (CatchSwitch->hasUnwindDest()) {
246 UnwindDestToken = CatchSwitch->getUnwindDest()->getFirstNonPHI();
254 for (
auto HI = CatchSwitch->handler_begin(),
255 HE = CatchSwitch->handler_end();
256 HI != HE && !UnwindDestToken; ++
HI) {
258 auto *CatchPad = cast<CatchPadInst>(HandlerBlock->
getFirstNonPHI());
264 if (!isa<CleanupPadInst>(Child) && !isa<CatchSwitchInst>(Child))
268 auto Memo = MemoMap.
find(ChildPad);
269 if (Memo == MemoMap.
end()) {
276 Value *ChildUnwindDestToken = Memo->second;
277 if (!ChildUnwindDestToken)
283 if (isa<ConstantTokenNone>(ChildUnwindDestToken)) {
284 UnwindDestToken = ChildUnwindDestToken;
292 auto *CleanupPad = cast<CleanupPadInst>(CurrentPad);
294 if (
auto *CleanupRet = dyn_cast<CleanupReturnInst>(U)) {
295 if (
BasicBlock *RetUnwindDest = CleanupRet->getUnwindDest())
296 UnwindDestToken = RetUnwindDest->getFirstNonPHI();
301 Value *ChildUnwindDestToken;
302 if (
auto *Invoke = dyn_cast<InvokeInst>(U)) {
303 ChildUnwindDestToken = Invoke->getUnwindDest()->getFirstNonPHI();
304 }
else if (isa<CleanupPadInst>(U) || isa<CatchSwitchInst>(U)) {
306 auto Memo = MemoMap.
find(ChildPad);
307 if (Memo == MemoMap.
end()) {
314 ChildUnwindDestToken = Memo->second;
315 if (!ChildUnwindDestToken)
324 if (isa<Instruction>(ChildUnwindDestToken) &&
327 UnwindDestToken = ChildUnwindDestToken;
333 if (!UnwindDestToken)
341 if (
auto *UnwindPad = dyn_cast<Instruction>(UnwindDestToken))
344 UnwindParent =
nullptr;
345 bool ExitedOriginalPad =
false;
347 ExitedPad && ExitedPad != UnwindParent;
350 if (isa<CatchPadInst>(ExitedPad))
352 MemoMap[ExitedPad] = UnwindDestToken;
353 ExitedOriginalPad |= (ExitedPad == EHPad);
356 if (ExitedOriginalPad)
357 return UnwindDestToken;
388 if (
auto *CPI = dyn_cast<CatchPadInst>(EHPad))
389 EHPad = CPI->getCatchSwitch();
392 auto Memo = MemoMap.
find(EHPad);
393 if (Memo != MemoMap.
end())
398 assert((UnwindDestToken ==
nullptr) != (MemoMap.
count(EHPad) != 0));
400 return UnwindDestToken;
407 MemoMap[EHPad] =
nullptr;
413 Value *AncestorToken;
418 if (isa<CatchPadInst>(AncestorPad))
427 assert(!MemoMap.
count(AncestorPad) || MemoMap[AncestorPad]);
428 auto AncestorMemo = MemoMap.
find(AncestorPad);
429 if (AncestorMemo == MemoMap.
end()) {
432 UnwindDestToken = AncestorMemo->second;
436 LastUselessPad = AncestorPad;
437 MemoMap[LastUselessPad] =
nullptr;
439 TempMemos.
insert(LastUselessPad);
457 while (!Worklist.
empty()) {
459 auto Memo = MemoMap.
find(UselessPad);
460 if (Memo != MemoMap.
end() && Memo->second) {
488 MemoMap[UselessPad] = UnwindDestToken;
489 if (
auto *CatchSwitch = dyn_cast<CatchSwitchInst>(UselessPad)) {
490 assert(CatchSwitch->getUnwindDest() ==
nullptr &&
"Expected useless pad");
491 for (
BasicBlock *HandlerBlock : CatchSwitch->handlers()) {
492 auto *CatchPad = HandlerBlock->getFirstNonPHI();
495 (!isa<InvokeInst>(U) ||
497 cast<InvokeInst>(U)->getUnwindDest()->getFirstNonPHI()) ==
499 "Expected useless pad");
500 if (isa<CatchSwitchInst>(U) || isa<CleanupPadInst>(U))
501 Worklist.
push_back(cast<Instruction>(U));
505 assert(isa<CleanupPadInst>(UselessPad));
507 assert(!isa<CleanupReturnInst>(U) &&
"Expected useless pad");
508 assert((!isa<InvokeInst>(U) ||
510 cast<InvokeInst>(U)->getUnwindDest()->getFirstNonPHI()) ==
512 "Expected useless pad");
513 if (isa<CatchSwitchInst>(U) || isa<CleanupPadInst>(U))
514 Worklist.
push_back(cast<Instruction>(U));
519 return UnwindDestToken;
547 if (
F->getIntrinsicID() == Intrinsic::experimental_deoptimize ||
548 F->getIntrinsicID() == Intrinsic::experimental_guard)
559 auto *FuncletPad = cast<Instruction>(FuncletBundle->Inputs[0]);
560 Value *UnwindDestToken =
562 if (UnwindDestToken && !isa<ConstantTokenNone>(UnwindDestToken))
566 if (
auto *CatchPad = dyn_cast<CatchPadInst>(FuncletPad))
567 MemoKey = CatchPad->getCatchSwitch();
569 MemoKey = FuncletPad;
570 assert(FuncletUnwindMap->count(MemoKey) &&
571 (*FuncletUnwindMap)[MemoKey] == UnwindDestToken &&
572 "must get memoized to avoid confusing later searches");
597 LandingPadInliningInfo Invoke(II);
603 if (
InvokeInst *II = dyn_cast<InvokeInst>(
I->getTerminator()))
611 InlinedLPad->reserveClauses(OuterNum);
612 for (
unsigned OuterIdx = 0; OuterIdx != OuterNum; ++OuterIdx)
613 InlinedLPad->addClause(OuterLPad->
getClause(OuterIdx));
615 InlinedLPad->setCleanup(
true);
622 &*BB, Invoke.getOuterResumeDest()))
625 Invoke.addIncomingPHIValuesFor(NewBB);
628 if (
ResumeInst *RI = dyn_cast<ResumeInst>(BB->getTerminator()))
629 Invoke.forwardResume(RI, InlinedLPads);
669 for (
Value *V : UnwindDestPHIValues) {
681 if (
auto *CRI = dyn_cast<CleanupReturnInst>(BB->getTerminator())) {
682 if (CRI->unwindsToCaller()) {
683 auto *CleanupPad = CRI->getCleanupPad();
685 CRI->eraseFromParent();
692 isa<ConstantTokenNone>(FuncletUnwindMap[CleanupPad]));
693 FuncletUnwindMap[CleanupPad] =
703 if (
auto *CatchSwitch = dyn_cast<CatchSwitchInst>(I)) {
704 if (CatchSwitch->unwindsToCaller()) {
705 Value *UnwindDestToken;
706 if (
auto *ParentPad =
707 dyn_cast<Instruction>(CatchSwitch->getParentPad())) {
717 if (UnwindDestToken && !isa<ConstantTokenNone>(UnwindDestToken))
730 CatchSwitch->getParentPad(), UnwindDest,
731 CatchSwitch->getNumHandlers(), CatchSwitch->getName(),
733 for (
BasicBlock *PadBB : CatchSwitch->handlers())
739 FuncletUnwindMap[NewCatchSwitch] = UnwindDestToken;
740 Replacement = NewCatchSwitch;
742 }
else if (!isa<FuncletPadInst>(I)) {
748 I->replaceAllUsesWith(Replacement);
749 I->eraseFromParent();
759 &*BB, UnwindDest, &FuncletUnwindMap))
768 UnwindDest->removePredecessor(InvokeBB);
782 VMI != VMIE; ++VMI) {
829 while (!Queue.empty()) {
830 const MDNode *M = cast<MDNode>(Queue.pop_back_val());
841 for (
const MDNode *I : MD) {
843 MDMap[
I].reset(DummyNodes.
back().get());
849 for (
const MDNode *I : MD) {
851 for (
unsigned i = 0, ie = I->getNumOperands(); i != ie; ++i) {
852 const Metadata *V = I->getOperand(i);
853 if (
const MDNode *M = dyn_cast<MDNode>(V))
856 NewOps.
push_back(const_cast<Metadata *>(V));
860 MDTuple *TempM = cast<MDTuple>(MDMap[
I]);
861 assert(TempM->isTemporary() &&
"Expected temporary node");
863 TempM->replaceAllUsesWith(NewM);
869 VMI != VMIE; ++VMI) {
924 if (NoAliasArgs.
empty())
930 DT.
recalculate(const_cast<Function&>(*CalledFunc));
943 MDB.createAnonymousAliasScopeDomain(CalledFunc->
getName());
944 for (
unsigned i = 0, e = NoAliasArgs.
size(); i != e; ++i) {
952 Name +=
": argument ";
959 MDNode *NewScope = MDB.createAnonymousAliasScope(NewDomain, Name);
960 NewScopes.
insert(std::make_pair(A, NewScope));
966 VMI != VMIE; ++VMI) {
967 if (
const Instruction *
I = dyn_cast<Instruction>(VMI->first)) {
975 bool IsArgMemOnlyCall =
false, IsFuncCall =
false;
978 if (
const LoadInst *LI = dyn_cast<LoadInst>(
I))
979 PtrArgs.
push_back(LI->getPointerOperand());
982 else if (
const VAArgInst *VAAI = dyn_cast<VAArgInst>(
I))
983 PtrArgs.
push_back(VAAI->getPointerOperand());
985 PtrArgs.
push_back(CXI->getPointerOperand());
987 PtrArgs.
push_back(RMWI->getPointerOperand());
992 if (ICS.doesNotAccessMemory())
1000 IsArgMemOnlyCall =
true;
1020 if (PtrArgs.
empty() && !IsFuncCall)
1030 for (
const Value *V : PtrArgs) {
1033 Objects, DL,
nullptr);
1041 bool CanDeriveViaCapture =
false, UsesAliasingPtr =
false;
1042 for (
const Value *V : ObjSet) {
1046 bool IsNonPtrConst = isa<ConstantInt>(V) || isa<ConstantFP>(V) ||
1047 isa<ConstantPointerNull>(V) ||
1048 isa<ConstantDataVector>(V) || isa<UndefValue>(V);
1055 if (
const Argument *A = dyn_cast<Argument>(V)) {
1056 if (!A->hasNoAliasAttr())
1057 UsesAliasingPtr =
true;
1059 UsesAliasingPtr =
true;
1066 if (!isa<Argument>(V) &&
1068 CanDeriveViaCapture =
true;
1073 if (IsFuncCall && !IsArgMemOnlyCall)
1074 CanDeriveViaCapture =
true;
1084 for (
const Argument *A : NoAliasArgs) {
1085 if (!ObjSet.count(A) && (!CanDeriveViaCapture ||
1098 if (!NoAliases.
empty())
1114 bool CanAddScopes = !UsesAliasingPtr;
1115 if (CanAddScopes && IsFuncCall)
1116 CanAddScopes = IsArgMemOnlyCall;
1119 for (
const Argument *A : NoAliasArgs) {
1120 if (ObjSet.count(A))
1124 if (!Scopes.
empty())
1145 bool DTCalculated =
false;
1150 if (Align && !
Arg.hasByValOrInAllocaAttr() && !
Arg.
hasNUses(0)) {
1151 if (!DTCalculated) {
1153 DTCalculated =
true;
1163 .CreateAlignmentAssumption(DL, ArgVal, Align);
1189 if (CalleeNode == CallerNode) {
1190 CallCache.assign(I,
E);
1191 I = CallCache.begin();
1192 E = CallCache.end();
1195 for (; I !=
E; ++
I) {
1196 const Value *OrigCall = I->first;
1200 if (VMI == VMap.
end() || VMI->
second ==
nullptr)
1224 if (!I->second->getFunction())
1243 Type *AggTy = cast<PointerType>(Src->
getType())->getElementType();
1251 Builder.CreateMemCpy(Dst, 1, Src, 1, Size);
1259 unsigned ByValAlignment) {
1273 if (ByValAlignment <= 1)
1295 Align =
std::max(Align, ByValAlignment);
1299 &*Caller->
begin()->begin());
1311 switch (II->getIntrinsicID()) {
1313 case Intrinsic::lifetime_start:
1314 case Intrinsic::lifetime_end:
1328 if (Ty == Int8PtrTy)
1333 if (U->getType() != Int8PtrTy)
continue;
1334 if (U->stripPointerCasts() != AI)
continue;
1362 Ctx, InlinedAtNode->getLine(), InlinedAtNode->getColumn(),
1363 InlinedAtNode->getScope(), InlinedAtNode->getInlinedAt());
1370 for (; FI != Fn->
end(); ++FI) {
1373 if (
DebugLoc DL = BI->getDebugLoc()) {
1376 auto IDL =
DebugLoc::get(DL.getLine(), DL.getCol(), DL.getScope(), IA);
1377 BI->setDebugLoc(IDL);
1381 if (CalleeHasDebugInfo)
1390 if (
auto *AI = dyn_cast<AllocaInst>(BI))
1394 BI->setDebugLoc(TheCallDL);
1411 for (
auto const &Entry : VMap) {
1412 if (!isa<BasicBlock>(Entry.first) || !Entry.second)
1414 auto *OrigBB = cast<BasicBlock>(Entry.first);
1415 auto *ClonedBB = cast<BasicBlock>(Entry.second);
1417 if (!ClonedBBs.
insert(ClonedBB).second) {
1427 BasicBlock *EntryClone = cast<BasicBlock>(VMap.lookup(&CalleeEntryBlock));
1443 uint64_t CallCount =
1444 std::min(CallSiteCount.hasValue() ? CallSiteCount.getValue() : 0,
1447 for (
auto const &Entry : VMap)
1448 if (isa<CallInst>(Entry.first))
1449 if (
auto *CI = dyn_cast_or_null<CallInst>(Entry.second))
1450 CI->updateProfWeight(CallCount, CalleeEntryCount.
getCount());
1453 if (VMap.count(&BB))
1455 if (
CallInst *CI = dyn_cast<CallInst>(&
I))
1456 CI->updateProfWeight(CalleeEntryCount.
getCount() - CallCount,
1472 if (!CalleeCount.hasValue() || !PSI)
1475 if (!CallCount.hasValue())
1479 if (CallCount.getValue() > CalleeCount.getCount())
1480 CalleeCount.setCount(0);
1482 CalleeCount.setCount(CalleeCount.getCount() - CallCount.getValue());
1495 AAResults *CalleeAAR,
bool InsertLifetime,
1499 &&
"Instruction not in function!");
1536 if (CalledFunc->
hasGC()) {
1537 if (!Caller->
hasGC())
1539 else if (CalledFunc->
getGC() != Caller->
getGC())
1556 if (CalledPersonality) {
1557 if (!CallerPersonality)
1563 else if (CalledPersonality != CallerPersonality)
1570 if (CallerPersonality) {
1576 CallSiteEHPad = cast<FuncletPadInst>(ParentFunclet->
Inputs.front());
1580 if (CallSiteEHPad) {
1584 if (isa<CleanupPadInst>(CallSiteEHPad)) {
1587 for (
const BasicBlock &CalledBB : *CalledFunc) {
1588 if (isa<CatchSwitchInst>(CalledBB.getFirstNonPHI()))
1595 for (
const BasicBlock &CalledBB : *CalledFunc) {
1596 if (CalledBB.isEHPad())
1606 bool EHPadForCallUnwindsLocally =
false;
1607 if (CallSiteEHPad && CS.
isCall()) {
1609 Value *CallSiteUnwindDestToken =
1612 EHPadForCallUnwindsLocally =
1613 CallSiteUnwindDestToken &&
1614 !isa<ConstantTokenNone>(CallSiteUnwindDestToken);
1639 E = CalledFunc->
arg_end();
I !=
E; ++
I, ++AI, ++ArgNo) {
1640 Value *ActualArg = *AI;
1649 if (ActualArg != *AI)
1653 VMap[&*
I] = ActualArg;
1666 false, Returns,
".i",
1667 &InlinedFunctionInfo, TheCall);
1669 FirstNewBlock = LastBlock; ++FirstNewBlock;
1674 CalledFunc->
front());
1682 for (std::pair<Value*, Value*> &
Init : ByValInit)
1684 &*FirstNewBlock, IFI);
1712 std::vector<Value *> MergedDeoptArgs;
1713 MergedDeoptArgs.reserve(ParentDeopt->Inputs.size() +
1714 ChildOB.Inputs.size());
1716 MergedDeoptArgs.insert(MergedDeoptArgs.end(),
1717 ParentDeopt->Inputs.begin(),
1718 ParentDeopt->Inputs.end());
1719 MergedDeoptArgs.insert(MergedDeoptArgs.end(), ChildOB.Inputs.begin(),
1720 ChildOB.Inputs.end());
1722 OpDefs.
emplace_back(
"deopt", std::move(MergedDeoptArgs));
1726 if (isa<CallInst>(I))
1764 if (
auto *II = dyn_cast<IntrinsicInst>(&
I))
1765 if (II->getIntrinsicID() == Intrinsic::assume)
1777 E = FirstNewBlock->end();
I !=
E; ) {
1796 while (isa<AllocaInst>(
I) &&
1806 InsertPoint, FirstNewBlock->getInstList(), AI->
getIterator(),
I);
1823 bool InlinedMustTailCalls =
false, InlinedDeoptimizeCalls =
false;
1826 if (
CallInst *CI = dyn_cast<CallInst>(TheCall))
1827 CallSiteTailKind = CI->getTailCallKind();
1835 for (
auto II = BB->begin(); II != BB->end();) {
1843 if (!VarArgsToForward.
empty() &&
1844 ((ForwardVarArgsTo &&
1851 for (
unsigned ArgNo = 0;
1876 InlinedDeoptimizeCalls |=
1877 F->getIntrinsicID() == Intrinsic::experimental_deoptimize;
1896 ChildTCK = std::min(CallSiteTailKind, ChildTCK);
1912 for (
unsigned ai = 0, ae = IFI.
StaticAllocas.size(); ai != ae; ++ai) {
1929 uint64_t AllocaTypeSize = DL.getTypeAllocSize(AllocaType);
1930 uint64_t AllocaArraySize = AIArraySize->getLimitedValue();
1933 if (AllocaArraySize == 0)
1942 AllocaArraySize * AllocaTypeSize);
1946 builder.CreateLifetimeStart(AI, AllocaSize);
1950 if (InlinedMustTailCalls &&
1953 if (InlinedDeoptimizeCalls &&
1956 IRBuilder<>(RI).CreateLifetimeEnd(AI, AllocaSize);
1971 .CreateCall(StackSave, {},
"savedstack");
1982 IRBuilder<>(RI).CreateCall(StackRestore, SavedPtr);
1990 if (
auto *II = dyn_cast<InvokeInst>(TheCall)) {
1991 BasicBlock *UnwindDest = II->getUnwindDest();
1993 if (isa<LandingPadInst>(FirstNonPHI)) {
2004 if (CallSiteEHPad) {
2019 if (CalledFn && CalledFn->isIntrinsic() && CS.
doesNotThrow())
2045 if (
auto *CleanupRet = dyn_cast<CleanupReturnInst>(BB->getTerminator()))
2046 if (CleanupRet->unwindsToCaller() && EHPadForCallUnwindsLocally)
2053 if (
auto *CatchSwitch = dyn_cast<CatchSwitchInst>(I)) {
2054 if (isa<ConstantTokenNone>(CatchSwitch->getParentPad()))
2055 CatchSwitch->setParentPad(CallSiteEHPad);
2057 auto *FPI = cast<FuncletPadInst>(
I);
2058 if (isa<ConstantTokenNone>(FPI->getParentPad()))
2059 FPI->setParentPad(CallSiteEHPad);
2064 if (InlinedDeoptimizeCalls) {
2074 Returns.
erase(NewEnd, Returns.
end());
2078 Caller->
getParent(), Intrinsic::experimental_deoptimize,
2105 "Expected at least the deopt operand bundle");
2109 Builder.CreateCall(NewDeoptIntrinsic, CallArgs, OpBundles);
2112 Builder.CreateRetVoid();
2114 Builder.CreateRet(NewDeoptCall);
2126 if (InlinedMustTailCalls) {
2129 bool NeedBitCast = !TheCall->
use_empty() && TheCall->
getType() != NewRetTy;
2136 if (!ReturnedMustTail) {
2145 auto *OldCast = dyn_cast_or_null<BitCastInst>(RI->getReturnValue());
2148 OldCast->eraseFromParent();
2176 if (Returns.
size() == 1 && std::distance(FirstNewBlock, Caller->
end()) == 1) {
2179 FirstNewBlock->getInstList(),
2180 FirstNewBlock->begin(), FirstNewBlock->end());
2186 if (
InvokeInst *II = dyn_cast<InvokeInst>(TheCall)) {
2204 Returns[0]->eraseFromParent();
2217 BranchInst *CreatedBranchToNormalDest =
nullptr;
2218 if (
InvokeInst *II = dyn_cast<InvokeInst>(TheCall)) {
2228 CalledFunc->
getName() +
".exit");
2235 CalledFunc->
getName() +
".exit");
2249 "splitBasicBlock broken!");
2264 if (Returns.
size() > 1) {
2269 &AfterCallBB->
front());
2278 for (
unsigned i = 0, e = Returns.
size(); i != e; ++i) {
2281 "Ret value not consistent in function!");
2288 for (
unsigned i = 0, e = Returns.
size(); i != e; ++i) {
2299 if (CreatedBranchToNormalDest)
2301 }
else if (!Returns.
empty()) {
2305 if (TheCall == Returns[0]->getReturnValue())
2312 BasicBlock *ReturnBB = Returns[0]->getParent();
2320 if (CreatedBranchToNormalDest)
2321 CreatedBranchToNormalDest->
setDebugLoc(Returns[0]->getDebugLoc());
2324 Returns[0]->eraseFromParent();
2342 assert(cast<BranchInst>(Br)->isUnconditional() &&
"splitBasicBlock broken!");
2343 BasicBlock *CalleeEntry = cast<BranchInst>(Br)->getSuccessor(0);
bool onlyReadsMemory() const
Determine if the function does not access or only reads memory.
Return a value (possibly void), from a function.
bool isIntrinsic() const
isIntrinsic - Returns true if the function's name starts with "llvm.".
SymbolTableList< Instruction >::iterator 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. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs=false)
Notify the BasicBlock that the predecessor Pred is no longer able to reach it.
DILocation * get() const
Get the underlying DILocation.
void addIncoming(Value *V, BasicBlock *BB)
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)
Try to ensure that the alignment of V is at least PrefAlign bytes.
static void updateCallProfile(Function *Callee, const ValueToValueMapTy &VMap, const ProfileCount &CalleeEntryCount, const Instruction *TheCall, ProfileSummaryInfo *PSI, BlockFrequencyInfo *CallerBFI)
Update the branch metadata for cloned call instructions.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents an incoming formal argument to a Function.
bool replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, DIBuilder &Builder, bool DerefBefore, int Offset, bool DerefAfter)
Replaces llvm.dbg.declare instruction when the alloca it describes is replaced with a new value...
iterator erase(iterator where)
Compute iterated dominance frontiers using a linear time algorithm.
CallGraph * CG
CG - If non-null, InlineFunction will update the callgraph to reflect the changes it makes...
A Module instance is used to store all the information related to an LLVM module. ...
an instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
static DebugLoc appendInlinedAt(DebugLoc DL, DILocation *InlinedAt, LLVMContext &Ctx, DenseMap< const MDNode *, MDNode *> &Cache, bool ReplaceLast=false)
Rebuild the entire inlined-at chain for this instruction so that the top of the chain now is inlined-...
std::function< AssumptionCache &(Function &)> * GetAssumptionCache
void recalculate(ParentType &Func)
recalculate - compute a dominator tree for the given function
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
unsigned getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
Analysis providing profile information.
const CallInst * getTerminatingMustTailCall() const
Returns the call instruction marked 'musttail' prior to the terminating return instruction of this ba...
This class represents a function call, abstracting a target machine's calling convention.
void setGC(std::string Str)
static void updateCalleeCount(BlockFrequencyInfo *CallerBFI, BasicBlock *CallBB, Instruction *CallInst, Function *Callee, ProfileSummaryInfo *PSI)
Update the entry count of callee after inlining.
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
A cache of @llvm.assume calls within a function.
bool isSwiftError() const
Return true if this alloca is used as a swifterror argument to a call.
uint64_t getFrequency() const
Returns the frequency as a fixpoint number scaled by the entry frequency.
LLVMContext & getContext() const
All values hold a context through their type.
static void AddAlignmentAssumptions(CallSite CS, InlineFunctionInfo &IFI)
If the inlined function has non-byval align arguments, then add .assume-based alignment assumptions t...
Optional< uint64_t > getProfileCount(const Instruction *CallInst, BlockFrequencyInfo *BFI)
Returns the profile count for CallInst.
static CallInst * Create(Value *Func, ArrayRef< Value *> Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
const MDOperand & getOperand(unsigned I) const
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
An instruction for reading from memory.
static void AddAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap, const DataLayout &DL, AAResults *CalleeAAR)
If the inlined function has noalias arguments, then add new alias scopes for each noalias argument...
static IntegerType * getInt64Ty(LLVMContext &C)
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
Constant * getClause(unsigned Idx) const
Get the value of the clause at index Idx.
void reserve(size_type N)
bool isMustTailCall() const
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.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
static void fixupLineNumbers(Function *Fn, Function::iterator FI, Instruction *TheCall, bool CalleeHasDebugInfo)
Update inlined instructions' line numbers to to encode location where these instructions are inlined...
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
iterator begin()
Instruction iterator methods.
Function::ProfileCount ProfileCount
bool InlineFunction(CallInst *C, InlineFunctionInfo &IFI, AAResults *CalleeAAR=nullptr, bool InsertLifetime=true)
InlineFunction - This function inlines the called function into the basic block of the caller...
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.
unsigned getAllocaAddrSpace() const
const CallInst * getTerminatingDeoptimizeCall() const
Returns the call instruction calling @llvm.experimental.deoptimize prior to the terminating return in...
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
ProfileCount getEntryCount() const
Get the entry count for this function.
FunctionType * getFunctionType() const
void setEntryCount(ProfileCount Count, const DenseSet< GlobalValue::GUID > *Imports=nullptr)
Set the entry count for this function.
static void HandleInlinedLandingPad(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...
PointerType * getType() const
Overload to return most specific pointer type.
TailCallKind getTailCallKind() const
A Use represents the edge between a Value definition and its users.
uint32_t getTagID() const
Return the tag of this operand bundle as an integer.
static void updateCallerBFI(BasicBlock *CallSiteBlock, const ValueToValueMapTy &VMap, BlockFrequencyInfo *CallerBFI, BlockFrequencyInfo *CalleeBFI, const BasicBlock &CalleeEntryBlock)
Update the block frequencies of the caller after a callee has been inlined.
ReturnInst * CreateRet(Value *V)
Create a 'ret <val>' instruction.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
AttributeSet getRetAttributes() const
The attributes for the ret value are returned.
InstrTy * getInstruction() const
static void CloneAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap)
When inlining a function that contains noalias scope metadata, this metadata needs to be cloned so th...
The only memory references in this function (if it has any) are non-volatile loads from objects point...
void setBlockFreqAndScale(const BasicBlock *ReferenceBB, uint64_t Freq, SmallPtrSetImpl< BasicBlock *> &BlocksToScale)
Set the frequency of ReferenceBB to Freq and scale the frequencies of the blocks in BlocksToScale suc...
unsigned getNumClauses() const
Get the number of clauses for this landing pad.
std::vector< CallRecord > CalledFunctionsVector
bool isScopedEHPersonality(EHPersonality Pers)
Returns true if this personality uses scope-style EH IR instructions: catchswitch, catchpad/ret, and cleanuppad/ret.
void addHandler(BasicBlock *Dest)
Add an entry to the switch instruction...
ValTy * getCalledValue() const
Return the pointer to function that is being called.
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...
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 * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
static void UpdatePHINodes(BasicBlock *OrigBB, BasicBlock *NewBB, ArrayRef< BasicBlock *> Preds, BranchInst *BI, bool HasLoopExit)
Update the PHI nodes in OrigBB to include the values coming from NewBB.
Type * getType() const
All values are typed, get the type of this value.
std::vector< WeakTrackingVH > OperandBundleCallSites
All cloned call sites that have operand bundles attached are appended to this vector.
bool insert(const value_type &X)
Insert a new element into the SetVector.
LandingPadInst * getLandingPadInst() const
Get the landingpad instruction from the landing pad block (the unwind destination).
ValTy * getArgOperand(unsigned i) const
LLVMContext & getContext() const
FunctionModRefBehavior
Summary of how a function affects memory in the program.
AttributeSet getParamAttributes(unsigned ArgNo) const
The attributes for the argument or parameter at the given index are returned.
bool isUsedWithInAlloca() const
Return true if this alloca is used as an inalloca argument to a call.
void setAttributes(AttributeList A)
Set the parameter attributes for this call.
iterator find(const KeyT &Val)
iterator begin()
Get an iterator to the beginning of the SetVector.
BlockFrequencyInfo * CalleeBFI
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
const std::string & getGC() const
An instruction for storing to memory.
bool hasPersonalityFn() const
Check whether this function has a personality function.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
void takeName(Value *V)
Transfer the name from V to this value.
AttributeList getAttributes() const
Return the parameter attributes for this call.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
amdgpu Simplify well known AMD library false Value * Callee
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Value * getOperand(unsigned i) const
Class to represent pointers.
static BasicBlock * HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB, BasicBlock *UnwindEdge, UnwindDestMemoTy *FuncletUnwindMap=nullptr)
When we inline a basic block into an invoke, we have to turn all of the calls that can throw into inv...
bool isCall() const
Return true if a CallInst is enclosed.
static bool isUsedByLifetimeMarker(Value *V)
iterator find(const_arg_type_t< KeyT > Val)
static cl::opt< bool > PreserveAlignmentAssumptions("preserve-alignment-assumptions-during-inlining", cl::init(true), cl::Hidden, cl::desc("Convert align attributes to assumptions during inlining."))
Optional< OperandBundleUse > getOperandBundle(StringRef Name) const
bool isVoidTy() const
Return true if this is 'void'.
const BasicBlock & getEntryBlock() const
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata *> MDs)
Return a temporary node.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
bool doesNotThrow() const
Determine if the call cannot unwind.
void setCallingConv(CallingConv::ID CC)
SmallVector< CallSite, 8 > InlinedCallSites
All of the new call sites inlined into the caller.
initializer< Ty > init(const Ty &Val)
Type * getReturnType() const
Returns the type of the ret val.
The landingpad instruction holds all of the information necessary to generate correct exception handl...
const Instruction * getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
Subclasses of this class are all able to terminate a basic block.
bool hasNUses(unsigned N) const
Return true if this Value has exactly N users.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
uint64_t getCount() const
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
DISubprogram * getSubprogram() const
Get the attached subprogram.
Conditional or Unconditional Branch instruction.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
Resume the propagation of an exception.
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata *> MDs)
Value * getIncomingValueForBlock(const BasicBlock *BB) const
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isPointerTy() const
True if this is an instance of PointerType.
const Instruction & front() const
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
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...
unsigned getPrefTypeAlignment(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS)
Return the behavior of the given call site.
bool hasOperandBundles() const
void splice(iterator where, iplist_impl &L2)
static Value * getUnwindDestTokenHelper(Instruction *EHPad, UnwindDestMemoTy &MemoMap)
Helper for getUnwindDestToken that does the descendant-ward part of the search.
static bool hasLifetimeMarkers(AllocaInst *AI)
The only memory references in this function (if it has any) are non-volatile loads and stores from ob...
Interval::pred_iterator pred_end(Interval *I)
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
self_iterator getIterator()
void setTailCallKind(TailCallKind TCK)
const Function * getFunction() const
Return the function this instruction belongs to.
auto remove_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly...
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
const Constant * stripPointerCasts() const
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs, and aliases.
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
iterator erase(const_iterator CI)
iterator_range< User::op_iterator > arg_operands()
Iteration adapter for range-for loops.
unsigned getNumArgOperands() const
Class to represent profile counts.
const Value * getArraySize() const
Get the number of elements allocated.
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value *> Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
void setCallingConv(CallingConv::ID CC)
bool isIdentifiedFunctionLocal(const Value *V)
Return true if V is umabigously identified at the function-level.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
static void HandleByValArgumentInit(Value *Dst, Value *Src, Module *M, BasicBlock *InsertBlock, InlineFunctionInfo &IFI)
const InstListType & getInstList() const
Return the underlying instruction list container.
A SetVector that performs no allocations if smaller than a certain size.
Iterator for intrusive lists based on ilist_node.
This is the shared class of boolean and integer constants.
static CatchSwitchInst * Create(Value *ParentPad, BasicBlock *UnwindDest, unsigned NumHandlers, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
ValTy * getArgument(unsigned ArgNo) const
OperandBundleUse getOperandBundleAt(unsigned Index) const
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Module.h This file contains the declarations for the Module class.
void setBlockFreq(const BasicBlock *BB, uint64_t Freq)
LLVM_NODISCARD T pop_back_val()
static Value * getParentPad(Value *EHPad)
Helper for getUnwindDestToken/getUnwindDestTokenHelper.
static cl::opt< bool > NoAliases("riscv-no-aliases", cl::desc("Disable the emission of assembler pseudo instructions"), cl::init(false), cl::Hidden)
static Value * getUnwindDestToken(Instruction *EHPad, UnwindDestMemoTy &MemoMap)
Given an EH pad, find where it unwinds.
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 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...
std::string utostr(uint64_t X, bool isNeg=false)
BlockFrequency getBlockFreq(const BasicBlock *BB) const
getblockFreq - Return block frequency.
void setOperand(unsigned i, Value *Val)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
FunctionType * getFunctionType() const
Returns the FunctionType for me.
bool isCleanup() const
Return 'true' if this landingpad instruction is a cleanup.
iterator_range< user_iterator > users()
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
amdgpu Simplify well known AMD library false Value Value * Arg
bool ContainsCalls
ContainsCalls - This is set to true if the cloned code contains a normal call instruction.
SmallVector< AllocaInst *, 4 > StaticAllocas
StaticAllocas - InlineFunction fills this in with all static allocas that get copied into the caller...
The basic data container for the call graph of a Module of IR.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
FunTy * getCaller() const
Return the caller function for this call site.
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
unsigned getNumOperandBundles() const
void registerAssumption(CallInst *CI)
Add an @llvm.assume intrinsic to this function's cache.
void emplace_back(ArgTypes &&... Args)
LLVM_NODISCARD bool empty() const
SmallVector< WeakTrackingVH, 8 > InlinedCalls
InlinedCalls - InlineFunction fills this in with callsites that were inlined from the callee...
void getOperandBundlesAsDefs(SmallVectorImpl< OperandBundleDef > &Defs) const
Optional< OperandBundleUse > getOperandBundle(StringRef Name) const
Return an operand bundle by name, if present.
StringRef getName() const
Return a constant reference to the value's name.
Establish a view to a call site for examination.
const Function * getParent() const
Return the enclosing method, or null if none.
static MDNode * concatenate(MDNode *A, MDNode *B)
Methods for metadata merging.
static void PropagateParallelLoopAccessMetadata(CallSite CS, ValueToValueMapTy &VMap)
When inlining a call site that has !llvm.mem.parallel_loop_access metadata, that metadata should be p...
SymbolTableList< BasicBlock >::iterator eraseFromParent()
Unlink 'this' from the containing function and delete it.
bool empty() const
Determine if the SetVector is empty or not.
bool doesNotThrow() const
Determine if the call cannot unwind.
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.
unsigned getKnownAlignment(Value *V, const DataLayout &DL, const Instruction *CxtI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr)
Try to infer an alignment for the specified pointer.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
const BasicBlockListType & getBasicBlockList() const
Get the underlying elements of the Function...
static ConstantTokenNone * get(LLVMContext &Context)
Return the ConstantTokenNone.
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
Value * getReturnValue() const
Convenience accessor. Returns null if there is no return value.
std::vector< CallRecord >::iterator iterator
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
unsigned changeToUnreachable(Instruction *I, bool UseLLVMTrap, bool PreserveLCSSA=false, DeferredDominance *DDT=nullptr)
Insert an unreachable instruction before the specified instruction, making it and the rest of the cod...
bool PointerMayBeCapturedBefore(const Value *V, bool ReturnCaptures, bool StoreCaptures, const Instruction *I, const DominatorTree *DT, bool IncludeI=false, OrderedBasicBlock *OBB=nullptr)
PointerMayBeCapturedBefore - Return true if this pointer value may be captured by the enclosing funct...
void getOperandBundlesAsDefs(SmallVectorImpl< OperandBundleDef > &Defs) const
Return the list of operand bundles attached to this instruction as a vector of OperandBundleDefs.
bool isByValArgument(unsigned ArgNo) const
Determine whether this argument is passed by value.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
FunTy * getCalledFunction() const
Return the function being called if this is a direct call, otherwise return null (if it's an indirect...
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...
static bool allocaWouldBeStaticInEntry(const AllocaInst *AI)
Return the result of AI->isStaticAlloca() if AI were moved to the entry block.
BlockFrequencyInfo * CallerBFI
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool ContainsDynamicAllocas
ContainsDynamicAllocas - This is set to true if the cloned code contains a 'dynamic' alloca...
const BasicBlock & front() const
bool isAsynchronousEHPersonality(EHPersonality Pers)
Returns true if this personality function catches asynchronous exceptions.
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
BasicBlock * getUnwindDest() const
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
Constant * getPersonalityFn() const
Get the personality function associated with this function.
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
A vector that has set insertion semantics.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
void removeCallEdgeFor(CallSite CS)
Removes the edge in the node for the specified call site.
static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB=nullptr, Instruction *InsertBefore=nullptr)
AttributeSet getFnAttributes() const
The function attributes are returned.
BasicBlock * changeToInvokeAndSplitBasicBlock(CallInst *CI, BasicBlock *UnwindEdge)
Convert the CallInst to InvokeInst with the specified unwind edge basic block.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
bool isEHPad() const
Return true if the instruction is a variety of EH-block.
void setPersonalityFn(Constant *Fn)
AttributeList getAttributes() const
Get the parameter attributes of the call.
const TerminatorInst * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
static void HandleInlinedEHPad(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...
unsigned getNumOperands() const
Return number of MDNode operands.
bool isEmpty() const
Return true if there are no attributes.
Value * SimplifyInstruction(Instruction *I, const SimplifyQuery &Q, OptimizationRemarkEmitter *ORE=nullptr)
See if we can compute a simplified version of this instruction.
Type * getElementType() const
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute >> Attrs)
Create an AttributeList with the specified parameters in it.
iterator_range< arg_iterator > args()
A wrapper class for inspecting calls to intrinsic functions.
const BasicBlock * getParent() const
an instruction to allocate memory on the stack
bool mayReadOrWriteMemory() const
Return true if this instruction may read or write memory.