53 using namespace llvm::PatternMatch;
55 #define DEBUG_TYPE "local"
57 STATISTIC(NumRemoved,
"Number of unreachable basic blocks removed");
76 if (
BranchInst *BI = dyn_cast<BranchInst>(T)) {
77 if (BI->isUnconditional())
return false;
81 if (
ConstantInt *Cond = dyn_cast<ConstantInt>(BI->getCondition())) {
84 BasicBlock *Destination = Cond->getZExtValue() ? Dest1 : Dest2;
85 BasicBlock *OldDest = Cond->getZExtValue() ? Dest2 : Dest1;
101 if (Dest2 == Dest1) {
107 assert(BI->getParent() &&
"Terminator not inserted in block!");
112 Value *Cond = BI->getCondition();
113 BI->eraseFromParent();
114 if (DeleteDeadConditions)
129 if (isa<UnreachableInst>(DefaultDest->getFirstNonPHIOrDbg()) &&
130 SI->getNumCases() > 0) {
131 TheOnlyDest =
SI->case_begin()->getCaseSuccessor();
135 for (
auto i =
SI->case_begin(), e =
SI->case_end(); i != e;) {
137 if (i->getCaseValue() == CI) {
138 TheOnlyDest = i->getCaseSuccessor();
144 if (i->getCaseSuccessor() == DefaultDest) {
146 unsigned NCases =
SI->getNumCases();
154 auto *CI = mdconst::extract<ConstantInt>(MD->
getOperand(MD_i));
158 unsigned idx = i->getCaseIndex();
159 Weights[0] += Weights[idx+1];
165 createBranchWeights(Weights));
168 DefaultDest->removePredecessor(
SI->getParent());
169 i =
SI->removeCase(i);
177 if (i->getCaseSuccessor() != TheOnlyDest)
178 TheOnlyDest =
nullptr;
184 if (CI && !TheOnlyDest) {
187 TheOnlyDest =
SI->getDefaultDest();
200 if (Succ == TheOnlyDest)
201 TheOnlyDest =
nullptr;
207 Value *Cond =
SI->getCondition();
208 SI->eraseFromParent();
209 if (DeleteDeadConditions)
214 if (
SI->getNumCases() == 1) {
217 auto FirstCase = *
SI->case_begin();
219 FirstCase.getCaseValue(),
"cond");
223 FirstCase.getCaseSuccessor(),
224 SI->getDefaultDest());
228 mdconst::dyn_extract<ConstantInt>(MD->
getOperand(2));
230 mdconst::dyn_extract<ConstantInt>(MD->
getOperand(1));
236 SIDef->getValue().getZExtValue()));
245 SI->eraseFromParent();
254 dyn_cast<BlockAddress>(IBI->getAddress()->stripPointerCasts())) {
255 BasicBlock *TheOnlyDest = BA->getBasicBlock();
259 for (
unsigned i = 0, e = IBI->getNumDestinations(); i != e; ++i) {
260 if (IBI->getDestination(i) == TheOnlyDest)
261 TheOnlyDest =
nullptr;
266 IBI->eraseFromParent();
267 if (DeleteDeadConditions)
302 if (isa<TerminatorInst>(I))
313 if (DDI->getAddress())
330 if (II->getIntrinsicID() == Intrinsic::stacksave)
334 if (II->getIntrinsicID() == Intrinsic::lifetime_start ||
335 II->getIntrinsicID() == Intrinsic::lifetime_end)
336 return isa<UndefValue>(II->getArgOperand(1));
342 if (II->getIntrinsicID() == Intrinsic::assume ||
343 II->getIntrinsicID() == Intrinsic::experimental_guard) {
344 if (
ConstantInt *Cond = dyn_cast<ConstantInt>(II->getArgOperand(0)))
345 return !Cond->isZero();
355 if (
Constant *
C = dyn_cast<Constant>(CI->getArgOperand(0)))
356 return C->isNullValue() || isa<UndefValue>(
C);
399 }
while (!DeadInsts.
empty());
415 for (++UI; UI != UE; ++UI) {
431 I = cast<Instruction>(*
I->user_begin())) {
437 if (!Visited.
insert(
I).second) {
480 WorkList.
insert(cast<Instruction>(U));
485 bool Changed =
false;
506 bool MadeChange =
false;
523 assert(!BI->isTerminator());
529 if (!WorkList.count(I))
533 while (!WorkList.empty()) {
558 if (!isa<PHINode>(BB->
begin()))
567 while (
PHINode *PN = dyn_cast<PHINode>(PhiIt)) {
569 Value *OldPhiIt = PhiIt;
577 if (PhiIt != OldPhiIt) PhiIt = &BB->
front();
589 while (
PHINode *PN = dyn_cast<PHINode>(DestBB->
begin())) {
590 Value *NewVal = PN->getIncomingValue(0);
594 PN->eraseFromParent();
598 assert(PredBB &&
"Block doesn't have a single predecessor!");
636 return First == Second || isa<UndefValue>(First) || isa<UndefValue>(Second);
665 if (BBPN && BBPN->getParent() == BB) {
668 if (BBPreds.
count(IBB) &&
672 << Succ->
getName() <<
" is conflicting with "
673 << BBPN->getName() <<
" with regard to common predecessor "
685 if (BBPreds.
count(IBB) &&
688 << Succ->
getName() <<
" is conflicting with regard to common "
689 <<
"predecessor " << IBB->
getName() <<
"\n");
716 if (!isa<UndefValue>(OldVal)) {
718 IncomingValues.
find(BB)->second == OldVal) &&
719 "Expected OldVal to match incoming value from BB!");
721 IncomingValues.
insert(std::make_pair(BB, OldVal));
726 if (It != IncomingValues.
end())
return It->second;
745 if (!isa<UndefValue>(V))
746 IncomingValues.
insert(std::make_pair(BB, V));
760 if (!isa<UndefValue>(V))
continue;
764 if (It == IncomingValues.
end())
continue;
781 assert(OldVal &&
"No entry in PHI for Pred BB!");
798 if (isa<PHINode>(OldVal) && cast<PHINode>(OldVal)->
getParent() == BB) {
799 PHINode *OldValPN = cast<PHINode>(OldVal);
816 for (
unsigned i = 0, e = BBPreds.
size(); i != e; ++i) {
839 "TryToSimplifyUncondBranchFromEmptyBlock called on entry block!");
843 if (BB == Succ)
return false;
861 if (!Succ->getSinglePredecessor()) {
863 while (isa<PHINode>(*BBI)) {
864 for (
Use &U : BBI->uses()) {
865 if (
PHINode* PN = dyn_cast<PHINode>(U.getUser())) {
866 if (PN->getIncomingBlock(U) != BB)
876 DEBUG(
dbgs() <<
"Killing Trivial BB: \n" << *BB);
878 if (isa<PHINode>(Succ->begin())) {
892 if (Succ->getSinglePredecessor()) {
898 Succ->getInstList().
splice(Succ->getFirstNonPHI()->getIterator(),
903 assert(PN->use_empty() &&
"There shouldn't be any uses here!");
904 PN->eraseFromParent();
921 if (!Succ->hasName()) Succ->takeName(BB);
936 struct PHIDenseMapInfo {
937 static PHINode *getEmptyKey() {
940 static PHINode *getTombstoneKey() {
943 static unsigned getHashValue(
PHINode *PN) {
952 if (LHS == getEmptyKey() || LHS == getTombstoneKey() ||
953 RHS == getEmptyKey() || RHS == getTombstoneKey())
963 bool Changed =
false;
965 auto Inserted = PHISet.
insert(PN);
966 if (!Inserted.second) {
991 assert(PrefAlign > Align);
995 if (
AllocaInst *AI = dyn_cast<AllocaInst>(V)) {
1003 if (PrefAlign <= Align)
1010 AI->setAlignment(PrefAlign);
1014 if (
auto *GO = dyn_cast<GlobalObject>(V)) {
1017 if (PrefAlign <= Align)
1024 if (!GO->canIncreaseAlignment())
1027 GO->setAlignment(PrefAlign);
1040 "getOrEnforceKnownAlignment expects a pointer!");
1043 unsigned TrailZ = Known.countMinTrailingZeros();
1047 TrailZ =
std::min(TrailZ,
unsigned(
sizeof(
unsigned) * CHAR_BIT - 1));
1049 unsigned Align = 1u <<
std::min(Known.getBitWidth() - 1, TrailZ);
1054 if (PrefAlign > Align)
1076 DVI->getOffset() == 0 &&
1077 DVI->getVariable() == DIVar &&
1078 DVI->getExpression() == DIExpr)
1093 for (
auto *DVI : DbgValues) {
1094 assert(DVI->getValue() == APN);
1095 assert(DVI->getOffset() == 0);
1096 if ((DVI->getVariable() == DIVar) && (DVI->getExpression() == DIExpr))
1107 assert(DIVar &&
"Missing variable");
1126 if (
auto Fragment = DIExpr->getFragmentInfo()) {
1127 unsigned FragmentOffset = Fragment->OffsetInBits;
1129 DIExpr->elements_end() - 3);
1131 Ops.push_back(FragmentOffset);
1149 assert(DIVar &&
"Missing variable");
1169 assert(DIVar &&
"Missing variable");
1180 if (InsertionPt != BB->
end())
1198 if (
auto DDI = dyn_cast<DbgDeclareInst>(&BI))
1204 for (
auto &
I : Dbgs) {
1214 for (
auto &AIUse : AI->
uses()) {
1215 User *U = AIUse.getUser();
1217 if (AIUse.getOperandNo() == 1)
1219 }
else if (
LoadInst *LI = dyn_cast<LoadInst>(U)) {
1221 }
else if (
CallInst *CI = dyn_cast<CallInst>(U)) {
1225 DIB.insertDbgValueIntrinsic(AI, 0, DDI->
getVariable(),
1259 bool Deref,
int Offset) {
1266 assert(DIVar &&
"Missing variable");
1270 Builder.
insertDeclare(NewAddress, DIVar, DIExpr, Loc, InsertBefore);
1286 assert(DIVar &&
"Missing variable");
1291 if (!DIExpr || DIExpr->getNumElements() < 1 ||
1292 DIExpr->getElement(0) != dwarf::DW_OP_deref)
1301 Ops.
append(DIExpr->elements_begin() + 1, DIExpr->elements_end());
1314 for (
auto UI = MDV->use_begin(), UE = MDV->use_end(); UI != UE;) {
1316 if (
auto *DVI = dyn_cast<DbgValueInst>(U.
getUser()))
1325 auto MDWrap = [&](
Value *V) {
1329 if (isa<BitCastInst>(&I)) {
1331 for (
auto *DVI : DbgValues) {
1335 DEBUG(
dbgs() <<
"SALVAGE: " << *DVI <<
'\n');
1337 }
else if (
auto *
GEP = dyn_cast<GetElementPtrInst>(&I)) {
1339 for (
auto *DVI : DbgValues) {
1341 M.getDataLayout().getPointerSizeInBits(
GEP->getPointerAddressSpace());
1346 if (
GEP->accumulateConstantOffset(M.getDataLayout(),
Offset)) {
1347 auto *DIExpr = DVI->getExpression();
1355 DEBUG(
dbgs() <<
"SALVAGE: " << *DVI <<
'\n');
1358 }
else if (isa<LoadInst>(&I)) {
1360 for (
auto *DVI : DbgValues) {
1362 auto *DIExpr = DVI->getExpression();
1367 DEBUG(
dbgs() <<
"SALVAGE: " << *DVI <<
'\n');
1373 unsigned NumDeadInst = 0;
1377 while (EndInst != &BB->
front()) {
1386 if (!isa<DbgInfoIntrinsic>(Inst))
1394 bool PreserveLCSSA) {
1399 Successor->removePredecessor(BB, PreserveLCSSA);
1412 unsigned NumInstrsRemoved = 0;
1414 while (BBI != BBE) {
1415 if (!BBI->use_empty())
1420 return NumInstrsRemoved;
1467 InvokeArgs, OpBundles, CI->
getName(), BB);
1488 bool Changed =
false;
1499 if (
auto *II = dyn_cast<IntrinsicInst>(&
I)) {
1500 if (II->getIntrinsicID() == Intrinsic::assume) {
1509 if (II->getIntrinsicID() == Intrinsic::experimental_guard) {
1519 if (!isa<UnreachableInst>(II->getNextNode())) {
1527 if (
auto *CI = dyn_cast<CallInst>(&
I)) {
1528 Value *Callee = CI->getCalledValue();
1529 if (isa<ConstantPointerNull>(Callee) || isa<UndefValue>(Callee)) {
1534 if (CI->doesNotReturn()) {
1538 if (!isa<UnreachableInst>(CI->getNextNode())) {
1550 if (
auto *
SI = dyn_cast<StoreInst>(&
I)) {
1552 if (
SI->isVolatile())
continue;
1556 if (isa<UndefValue>(Ptr) ||
1557 (isa<ConstantPointerNull>(Ptr) &&
1558 SI->getPointerAddressSpace() == 0)) {
1567 if (
auto *II = dyn_cast<InvokeInst>(Terminator)) {
1569 Value *Callee = II->getCalledValue();
1570 if (isa<ConstantPointerNull>(Callee) || isa<UndefValue>(Callee)) {
1574 if (II->use_empty() && II->onlyReadsMemory()) {
1577 II->getUnwindDest()->removePredecessor(II->getParent());
1583 }
else if (
auto *CatchSwitch = dyn_cast<CatchSwitchInst>(Terminator)) {
1585 struct CatchPadDenseMapInfo {
1597 if (LHS == getEmptyKey() || LHS == getTombstoneKey() ||
1598 RHS == getEmptyKey() || RHS == getTombstoneKey())
1608 detail::DenseSetEmpty Empty;
1610 E = CatchSwitch->handler_end();
1613 auto *CatchPad = cast<CatchPadInst>(HandlerBB->
getFirstNonPHI());
1614 if (!HandlerSet.insert({CatchPad, Empty}).
second) {
1615 CatchSwitch->removeHandler(
I);
1627 }
while (!Worklist.empty());
1634 if (
auto *II = dyn_cast<InvokeInst>(TI)) {
1642 if (
auto *CRI = dyn_cast<CleanupReturnInst>(TI)) {
1644 UnwindDest = CRI->getUnwindDest();
1645 }
else if (
auto *CatchSwitch = dyn_cast<CatchSwitchInst>(TI)) {
1647 CatchSwitch->getParentPad(),
nullptr, CatchSwitch->getNumHandlers(),
1648 CatchSwitch->getName(), CatchSwitch);
1649 for (
BasicBlock *PadBB : CatchSwitch->handlers())
1652 NewTI = NewCatchSwitch;
1653 UnwindDest = CatchSwitch->getUnwindDest();
1678 NumRemoved += F.
size()-Reachable.
size();
1683 if (Reachable.
count(&*BB))
1691 BB->dropAllReferences();
1695 if (!Reachable.
count(&*
I))
1708 for (
const auto &MD : Metadata) {
1709 unsigned Kind = MD.first;
1764 if (isa<LoadInst>(K) || isa<StoreInst>(K))
1769 unsigned KnownIDs[] = {
1779 template <
typename RootType,
typename DominatesFn>
1781 const RootType &Root,
1782 const DominatesFn &Dominates) {
1789 if (!Dominates(Root, U))
1793 << *To <<
" in " << *U <<
"\n");
1807 auto *
I = cast<Instruction>(U.
getUser());
1808 if (
I->getParent() == BB)
1828 auto ProperlyDominates = [&DT](
const BasicBlock *BB,
const Use &U) {
1829 auto *
I = cast<Instruction>(U.getUser())->
getParent();
1840 if (
F->hasFnAttribute(
"gc-leaf-function"))
1843 if (
auto IID =
F->getIntrinsicID())
1845 return IID != Intrinsic::experimental_gc_statepoint &&
1846 IID != Intrinsic::experimental_deoptimize;
1854 auto *NewTy = NewLI.
getType();
1857 if (NewTy->isPointerTy()) {
1864 if (!NewTy->isIntegerTy())
1869 auto *ITy = cast<IntegerType>(NewTy);
1874 MDB.createRange(NonNullInt, NullInt));
1879 auto *NewTy = NewLI.
getType();
1885 if (!NewTy->isPointerTy())
1899 BitPart(
Value *
P,
unsigned BW) : Provider(P) {
1900 Provenance.resize(BW);
1909 enum { Unset = -1 };
1940 auto I = BPS.find(V);
1944 auto &Result = BPS[V] =
None;
1949 if (
I->getOpcode() == Instruction::Or) {
1951 MatchBitReversals, BPS);
1953 MatchBitReversals, BPS);
1958 if (!
A->Provider ||
A->Provider != B->Provider)
1961 Result = BitPart(
A->Provider, BitWidth);
1962 for (
unsigned i = 0; i <
A->Provenance.size(); ++i) {
1963 if (
A->Provenance[i] != BitPart::Unset &&
1964 B->Provenance[i] != BitPart::Unset &&
1965 A->Provenance[i] != B->Provenance[i])
1966 return Result =
None;
1968 if (
A->Provenance[i] == BitPart::Unset)
1969 Result->Provenance[i] = B->Provenance[i];
1971 Result->Provenance[i] =
A->Provenance[i];
1978 if (
I->isLogicalShift() && isa<ConstantInt>(
I->getOperand(1))) {
1980 cast<ConstantInt>(
I->getOperand(1))->getLimitedValue(~0U);
1982 if (BitShift > BitWidth)
1986 MatchBitReversals, BPS);
1992 auto &
P = Result->Provenance;
1993 if (
I->getOpcode() == Instruction::Shl) {
1994 P.erase(std::prev(
P.end(), BitShift),
P.end());
1995 P.insert(
P.begin(), BitShift, BitPart::Unset);
1997 P.erase(
P.begin(), std::next(
P.begin(), BitShift));
1998 P.insert(
P.end(), BitShift, BitPart::Unset);
2006 if (
I->getOpcode() == Instruction::And &&
2007 isa<ConstantInt>(
I->getOperand(1))) {
2008 APInt Bit(
I->getType()->getPrimitiveSizeInBits(), 1);
2009 const APInt &AndMask = cast<ConstantInt>(
I->getOperand(1))->getValue();
2013 unsigned NumMaskedBits = AndMask.countPopulation();
2014 if (!MatchBitReversals && NumMaskedBits % 8 != 0)
2018 MatchBitReversals, BPS);
2023 for (
unsigned i = 0; i < BitWidth; ++i,
Bit <<= 1)
2025 if ((AndMask & Bit) == 0)
2026 Result->Provenance[i] = BitPart::Unset;
2031 if (
I->getOpcode() == Instruction::ZExt) {
2033 MatchBitReversals, BPS);
2037 Result = BitPart(Res->Provider, BitWidth);
2038 auto NarrowBitWidth =
2039 cast<IntegerType>(cast<ZExtInst>(
I)->getSrcTy())->
getBitWidth();
2040 for (
unsigned i = 0; i < NarrowBitWidth; ++i)
2041 Result->Provenance[i] = Res->Provenance[i];
2042 for (
unsigned i = NarrowBitWidth; i < BitWidth; ++i)
2043 Result->Provenance[i] = BitPart::Unset;
2050 Result = BitPart(V, BitWidth);
2051 for (
unsigned i = 0; i < BitWidth; ++i)
2052 Result->Provenance[i] = i;
2057 unsigned BitWidth) {
2058 if (From % 8 != To % 8)
2064 return From == BitWidth - To - 1;
2068 unsigned BitWidth) {
2069 return From == BitWidth - To - 1;
2075 Instruction *
I,
bool MatchBSwaps,
bool MatchBitReversals,
2079 if (!MatchBSwaps && !MatchBitReversals)
2086 unsigned DemandedBW = BW;
2090 DemandedTy = cast<IntegerType>(Trunc->getType());
2096 std::map<Value *, Optional<BitPart>> BPS;
2100 auto &BitProvenance = Res->Provenance;
2104 bool OKForBSwap = DemandedBW % 16 == 0, OKForBitReverse =
true;
2105 for (
unsigned i = 0; i < DemandedBW; ++i) {
2113 if (OKForBSwap && MatchBSwaps)
2114 Intrin = Intrinsic::bswap;
2115 else if (OKForBitReverse && MatchBitReversals)
2116 Intrin = Intrinsic::bitreverse;
2120 if (ITy != DemandedTy) {
2122 Value *Provider = Res->Provider;
2123 IntegerType *ProviderTy = cast<IntegerType>(Provider->getType());
2125 if (DemandedTy != ProviderTy) {
2171 case Instruction::Invoke:
2178 if (isa<IntrinsicInst>(I))
2186 case Instruction::ShuffleVector:
2190 case Instruction::ExtractValue:
2193 case Instruction::InsertValue:
2196 case Instruction::Alloca:
2201 case Instruction::GetElementPtr:
2205 for (
auto E = std::next(It, OpIdx); It !=
E; ++It)
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
static void appendOffset(SmallVectorImpl< uint64_t > &Ops, int64_t Offset)
Append Ops with operations to apply the Offset.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
static bool markAliveBlocks(Function &F, SmallPtrSetImpl< BasicBlock * > &Reachable)
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. ...
bool replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, DIBuilder &Builder, bool Deref, int Offset=0)
Replaces llvm.dbg.declare instruction when the alloca it describes is replaced with a new value...
BranchInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, MDNode *BranchWeights=nullptr, MDNode *Unpredictable=nullptr)
Create a conditional 'br Cond, TrueDest, FalseDest' instruction.
class_match< UndefValue > m_Undef()
Match an arbitrary undef constant.
iterator_range< use_iterator > uses()
void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs=false)
Notify the BasicBlock that the predecessor Pred is no longer able to reach it.
static unsigned enforceKnownAlignment(Value *V, unsigned Align, unsigned PrefAlign, const DataLayout &DL)
enforceKnownAlignment - If the specified pointer points to an object that we control, modify the object's alignment to PrefAlign.
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
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.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents an incoming formal argument to a Function.
void replaceDbgValueForAlloca(AllocaInst *AI, Value *NewAllocaAddress, DIBuilder &Builder, int Offset=0)
Replaces multiple llvm.dbg.value instructions when the alloca it describes is replaced with a new val...
uint64_t getZExtValue() const
Get zero extended value.
const Instruction & back() const
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
STATISTIC(NumFunctions,"Total number of functions")
iterator erase(iterator where)
void dropUnknownNonDebugMetadata(ArrayRef< unsigned > KnownIDs)
Drop all unknown metadata except for debug locations.
static bool CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ)
CanPropagatePredecessorsForPHIs - Return true if we can fold BB, an almost-empty BB ending in an unco...
DbgDeclareInst * FindAllocaDbgDeclare(Value *V)
Finds the llvm.dbg.declare intrinsic corresponding to an alloca, if any.
match_zero m_Zero()
Match an arbitrary zero/null constant.
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs, and aliases.
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
Implements a dense probed hash-table based set.
This class represents zero extension of integer types.
unsigned getNumOperands() const
unsigned getNumOperands() const
Return number of MDNode operands.
value_op_iterator value_op_begin()
static MDNode * getMostGenericAliasScope(MDNode *A, MDNode *B)
This class represents a function call, abstracting a target machine's calling convention.
void MergeBasicBlockIntoOnlyPred(BasicBlock *BB, DominatorTree *DT=nullptr)
BB is a block with one predecessor and its predecessor is known to have one successor (BB!)...
bool mayHaveSideEffects() const
Return true if the instruction may have side effects.
void findDbgValues(SmallVectorImpl< DbgValueInst * > &DbgValues, Value *V)
Finds the llvm.dbg.value intrinsics describing a value.
static Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
A cache of .assume calls within a function.
bool isTokenTy() const
Return true if this is 'token'.
value_op_iterator value_op_end()
const Function * getParent() const
Return the enclosing method, or null if none.
static void replaceUndefValuesInPhi(PHINode *PN, const IncomingValueMap &IncomingValues)
Replace the incoming undef values to a phi with the values from a block-to-value map.
bool SimplifyInstructionsInBlock(BasicBlock *BB, const TargetLibraryInfo *TLI=nullptr)
Scan the specified basic block and try to simplify any instructions in it and recursively delete dead...
const Instruction & front() const
This class represents a sign extension of integer types.
An instruction for reading from memory.
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
void setOperand(unsigned I, Metadata *New)
Set an operand.
void RemovePredecessorAndSimplify(BasicBlock *BB, BasicBlock *Pred)
Like BasicBlock::removePredecessor, this method is called when we're about to delete Pred as a predec...
static Value * selectIncomingValueForBlock(Value *OldVal, BasicBlock *BB, IncomingValueMap &IncomingValues)
Determines the value to use as the phi node input for a block.
Type * getElementType() const
unsigned changeToUnreachable(Instruction *I, bool UseLLVMTrap, bool PreserveLCSSA=false)
Insert an unreachable instruction before the specified instruction, making it and the rest of the cod...
unsigned replaceDominatedUsesWith(Value *From, Value *To, DominatorTree &DT, const BasicBlockEdge &Edge)
Replace each use of 'From' with 'To' if that use is dominated by the given edge.
Instruction * insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd)
Insert a new llvm.dbg.value intrinsic call.
uint64_t getOffset() const
void eraseNode(NodeT *BB)
eraseNode - Removes a node from the dominator tree.
const CallInst * isFreeCall(const Value *I, const TargetLibraryInfo *TLI)
isFreeCall - Returns non-null if the value is a call to the builtin free()
StringRef getName() const
Return a constant reference to the value's name.
block_iterator block_end()
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
iterator begin()
Instruction iterator methods.
static Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
void setCallingConv(CallingConv::ID CC)
bool isBundleOperand(Value::const_user_iterator UI) const
Determine whether the passed iterator points to a bundle operand.
bool isArrayAllocation() const
Return true if there is an allocation size parameter to the allocation instruction that is not 1...
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Value * getAddress() const
The address of a basic block.
bool match(Val *V, const Pattern &P)
Value * removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty=true)
Remove an incoming value.
bool isIdenticalTo(const Instruction *I) const
Return true if the specified instruction is exactly identical to the current one. ...
const APInt & getValue() const
Return the constant as an APInt value reference.
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr it the function does no...
Instruction * insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd)
Insert a new llvm.dbg.declare intrinsic call.
A Use represents the edge between a Value definition and its users.
bool ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions=false, const TargetLibraryInfo *TLI=nullptr)
If a terminator instruction is predicated on a constant value, convert it into an unconditional branc...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
static const Optional< BitPart > & collectBitParts(Value *V, bool MatchBSwaps, bool MatchBitReversals, std::map< Value *, Optional< BitPart >> &BPS)
Analyze the specified subexpression and see if it is capable of providing pieces of a bswap or bitrev...
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
bool canSimplifyInvokeNoUnwind(const Function *F)
Only used in LLVM metadata.
static const unsigned MaximumAlignment
block_iterator block_begin()
LLVM_NODISCARD bool empty() const
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
static void replaceOneDbgValueForAlloca(DbgValueInst *DVI, Value *NewAddress, DIBuilder &Builder, int Offset)
void addHandler(BasicBlock *Dest)
Add an entry to the switch instruction...
User * getUser() const LLVM_READONLY
Returns the User that contains this Use.
Value handle that is nullable, but tries to track the Value.
bool insert(const value_type &X)
Insert a new element into the SetVector.
static void changeToCall(InvokeInst *II)
changeToCall - Convert the specified invoke into a normal call.
void copyNonnullMetadata(const LoadInst &OldLI, MDNode *N, LoadInst &NewLI)
Copy a nonnull metadata node to a new load instruction.
static bool isEqual(const Function &Caller, const Function &Callee)
match_combine_or< LTy, RTy > m_CombineOr(const LTy &L, const RTy &R)
Combine two pattern matchers matching L || R.
op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
bool contains(const APInt &Val) const
Return true if the specified value is in the set.
void salvageDebugInfo(Instruction &I)
Assuming the instruction I is going to be deleted, attempt to salvage any dbg.value intrinsics referr...
bool isMathLibCallNoop(CallSite CS, const TargetLibraryInfo *TLI)
Check whether the given call has no side-effects.
static bool areAllUsesEqual(Instruction *I)
areAllUsesEqual - Check whether the uses of a value are all the same.
static MDNode * intersect(MDNode *A, MDNode *B)
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
An instruction for storing to memory.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
bool isArrayTy() const
True if this is an instance of ArrayType.
bool EliminateDuplicatePHINodes(BasicBlock *BB)
Check for and eliminate duplicate PHI nodes in this block.
static void gatherIncomingValuesToPhi(PHINode *PN, IncomingValueMap &IncomingValues)
Create a map from block to value for the operands of a given phi.
void takeName(Value *V)
Transfer the name from V to this value.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
bool doesNotAccessMemory() const
Determine if the function does not access memory.
This class represents a truncation of integer types.
BasicBlock * getNormalDest() const
unsigned getNumIncomingValues() const
Return the number of incoming edges.
DenseMap< BasicBlock *, Value * > IncomingValueMap
use_iterator_impl< Use > use_iterator
void getOperandBundlesAsDefs(SmallVectorImpl< OperandBundleDef > &Defs) const
Return the list of operand bundles attached to this instruction as a vector of OperandBundleDefs.
iterator find(const_arg_type_t< KeyT > Val)
static MDNode * getMostGenericRange(MDNode *A, MDNode *B)
bool hasOptimizedCodeGen(LibFunc F) const
Tests if the function is both available and a candidate for optimized code generation.
Subclasses of this class are all able to terminate a basic block.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
ConstantRange getConstantRangeFromMetadata(const MDNode &RangeMD)
Parse out a conservative ConstantRange from !range metadata.
LLVM Basic Block Representation.
static bool LdStHasDebugValue(DILocalVariable *DIVar, DIExpression *DIExpr, Instruction *I)
===---------------------------------------------------------------——===// Dbg Intrinsic utilities ...
void getAllMetadataOtherThanDebugLoc(SmallVectorImpl< std::pair< unsigned, MDNode * >> &MDs) const
This does the same thing as getAllMetadata, except that it filters out the debug location.
DIExpression * getExpression() const
bool TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB)
BB is known to contain an unconditional branch, and contains no instructions other than PHI nodes...
Conditional or Unconditional Branch instruction.
void ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI, StoreInst *SI, DIBuilder &Builder)
===---------------------------------------------------------------——===// Dbg Intrinsic utilities ...
static MDNode * getMostGenericAlignmentOrDereferenceable(MDNode *A, MDNode *B)
static BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
This function has undefined behavior.
This is an important base class in LLVM.
PointerType * getType() const
Overload to return most specific pointer type.
bool canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx)
Given an instruction, is it legal to set operand OpIdx to a non-constant value?
int64_t getSExtValue() const
Get sign extended value.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const_iterator getFirstInsertionPt() const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
Indirect Branch Instruction.
std::pair< iterator, bool > insert(const ValueT &V)
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...
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
static bool CanMergeValues(Value *First, Value *Second)
CanMergeValues - Return true if we can choose one of these values to use in place of the other...
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
void splice(iterator where, iplist_impl &L2)
const InstListType & getInstList() const
Return the underlying instruction list container.
void copyRangeMetadata(const DataLayout &DL, const LoadInst &OldLI, MDNode *N, LoadInst &NewLI)
Copy a range metadata node to a new load instruction.
for(unsigned i=0, e=MI->getNumOperands();i!=e;++i)
unsigned getMDKindID(StringRef Name) const
getMDKindID - Return a unique non-zero ID for the specified metadata kind.
Value * getOperand(unsigned i) const
bool hasFnAttr(Attribute::AttrKind Kind) const
Return true if this function has the given attribute.
Interval::pred_iterator pred_end(Interval *I)
Value * getPointerOperand()
Value * CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name="")
self_iterator getIterator()
op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
Class to represent integer types.
bool callsGCLeafFunction(ImmutableCallSite CS)
Return true if the CallSite CS calls a gc leaf function.
op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
static MDNode * getMostGenericTBAA(MDNode *A, MDNode *B)
bool replaceDbgDeclare(Value *Address, Value *NewAddress, Instruction *InsertBefore, DIBuilder &Builder, bool Deref, int Offset)
Replaces llvm.dbg.declare instruction when the address it describes is replaced with a new value...
bool isPointerTy() const
True if this is an instance of PointerType.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
bool RecursivelyDeleteTriviallyDeadInstructions(Value *V, const TargetLibraryInfo *TLI=nullptr)
If the specified value is a trivially dead instruction, delete it.
static bool bitTransformIsCorrectForBitReverse(unsigned From, unsigned To, unsigned BitWidth)
LLVMContext & getContext() const
All values hold a context through their type.
bool LowerDbgDeclare(Function &F)
Lowers llvm.dbg.declare intrinsics into appropriate set of llvm.dbg.value intrinsics.
void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
static void redirectValuesFromPredecessorsToPhi(BasicBlock *BB, const PredBlockVector &BBPreds, PHINode *PN)
Replace a value flowing from a block to a phi with potentially multiple instances of that value flowi...
bool recursivelySimplifyInstruction(Instruction *I, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr)
Recursively attempt to simplify an instruction.
bool dominates(const Instruction *Def, const Use &U) const
Return true if Def dominates a use in User.
static InvokeInst * Create(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, const Twine &NameStr, Instruction *InsertBefore=nullptr)
const MDOperand & getOperand(unsigned I) const
DIExpression * getExpression() const
A SetVector that performs no allocations if smaller than a certain size.
Iterator for intrusive lists based on ilist_node.
void moveAfter(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it right after MovePos in the function M...
const BasicBlockListType & getBasicBlockList() const
Get the underlying elements of the Function...
BasicBlock * getUnwindDest() const
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)
Value * getIncomingValue(unsigned i) const
Return incoming value number x.
static unsigned replaceDominatedUsesWith(Value *From, Value *To, const RootType &Root, const DominatesFn &Dominates)
static bool bitTransformIsCorrectForBSwap(unsigned From, unsigned To, unsigned BitWidth)
bool removeUnreachableBlocks(Function &F, LazyValueInfo *LVI=nullptr)
Remove all blocks that can not be reached from the function's entry.
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Type * getType() const
All values are typed, get the type of this value.
Instruction * user_back()
Specialize the methods defined in Value, as we know that an instruction can only be used by other ins...
Provides information about what library functions are available for the current target.
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
bool RecursivelyDeleteDeadPHINode(PHINode *PN, const TargetLibraryInfo *TLI=nullptr)
If the specified value is an effectively dead PHI node, due to being a def-use chain of single-use no...
LLVM_NODISCARD T pop_back_val()
DIExpression * createExpression(ArrayRef< uint64_t > Addr=None)
Create a new descriptor for the specified variable which has a complex address expression for its add...
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.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
static BranchInst * Create(BasicBlock *IfTrue, Instruction *InsertBefore=nullptr)
const BasicBlock & getEntryBlock() const
unsigned removeAllNonTerminatorAndEHPadInstructions(BasicBlock *BB)
Remove all instructions from a basic block other than it's terminator and any present EH pad instruct...
Value handle that asserts if the Value is deleted.
const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
SmallVector< BasicBlock *, 16 > PredBlockVector
void setOperand(unsigned i, Value *Val)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
void setAttributes(AttributeList A)
Set the parameter attributes for this call.
Class for arbitrary precision integers.
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
bool exceedsNaturalStackAlignment(unsigned Align) const
Returns true if the given alignment exceeds the natural stack alignment.
Value * getIncomingValueForBlock(const BasicBlock *BB) const
iterator_range< user_iterator > users()
DomTreeNodeBase< NodeT > * getNode(NodeT *BB) const
getNode - return the (Post)DominatorTree node for the specified basic block.
InstListType::iterator iterator
Instruction iterators...
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
void removeUnwindEdge(BasicBlock *BB)
Replace 'BB's terminator with one that does not have an unwind successor block.
llvm_unreachable("Unknown RegBank!")
unsigned getOpcode() const
Return the opcode for this Instruction or ConstantExpr.
bool isEHPad() const
Return true if the instruction is a variety of EH-block.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's ...
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
AttributeList getAttributes() const
Return the parameter attributes for this invoke.
static bool simplifyAndDCEInstruction(Instruction *I, SmallSetVector< Instruction *, 16 > &WorkList, const DataLayout &DL, const TargetLibraryInfo *TLI)
static IntegerType * getInt32Ty(LLVMContext &C)
This represents the llvm.dbg.value instruction.
Establish a view to a call site for examination.
AttributeList getAttributes() const
Return the parameter attributes for this call.
void insertAfter(Instruction *InsertPos)
Insert an unlinked instruction into a basic block immediately after the specified instruction...
static Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
SymbolTableList< BasicBlock >::iterator eraseFromParent()
Unlink 'this' from the containing function and delete it.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
bool hasOneUse() const
Return true if there is exactly one user of this value.
user_iterator_impl< User > user_iterator
bool isAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI, bool LookThroughBitCast=false)
Tests if a value is a call or invoke to a library function that allocates memory (either malloc...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
bool recognizeBSwapOrBitReverseIdiom(Instruction *I, bool MatchBSwaps, bool MatchBitReversals, SmallVectorImpl< Instruction * > &InsertedInsts)
Try and match a bswap or bitreverse idiom.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
void destroyConstant()
Called if some element of this constant is no longer valid.
void maybeMarkSanitizerLibraryCallNoBuiltin(CallInst *CI, const TargetLibraryInfo *TLI)
Given a CallInst, check if it calls a string function known to CodeGen, and mark it with NoBuiltin if...
static bool PhiHasDebugValue(DILocalVariable *DIVar, DIExpression *DIExpr, PHINode *APN)
See if there is a dbg.value intrinsic for DIVar for the PHI node.
BasicBlock * splitBasicBlock(iterator I, const Twine &BBName="")
Split the basic block into two basic blocks at the specified instruction.
void combineMetadataForCSE(Instruction *K, const Instruction *J)
Combine the metadata of two instructions so that K can replace J.
void eraseBlock(BasicBlock *BB)
Inform the analysis cache that we have erased a block.
bool hasLocalLinkage() const
This pass computes, caches, and vends lazy value constraint information.
static bool isArray(AllocaInst *AI)
Determine whether this alloca is either a VLA or an array.
DILocalVariable * getVariable() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
user_iterator user_begin()
void setAttributes(AttributeList A)
Set the parameter attributes for this invoke.
const BasicBlock & front() const
LLVMContext & getContext() const
Get the context in which this basic block lives.
FunTy * getCalledFunction() const
Return the function being called if this is a direct call, otherwise return null (if it's an indirect...
Module * getParent()
Get the module that this global value is contained inside of...
bool isInstructionTriviallyDead(Instruction *I, const TargetLibraryInfo *TLI=nullptr)
Return true if the result produced by the instruction is not used, and the instruction has no side ef...
LLVM Value Representation.
succ_range successors(BasicBlock *BB)
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
DILocalVariable * getVariable() const
BranchInst * CreateBr(BasicBlock *Dest)
Create an unconditional 'br label X' instruction.
static CleanupReturnInst * Create(Value *CleanupPad, BasicBlock *UnwindBB=nullptr, Instruction *InsertBefore=nullptr)
static const Function * getParent(const Value *V)
static DIExpression * prepend(const DIExpression *DIExpr, bool Deref, int64_t Offset=0, bool StackValue=false)
Prepend DIExpr with a deref and offset operation and optionally turn it into a stack value...
void setCallingConv(CallingConv::ID CC)
uint64_t getTypeSizeInBits(Type *Ty) const
Size examples:
BasicBlock * changeToInvokeAndSplitBasicBlock(CallInst *CI, BasicBlock *UnwindEdge)
Convert the CallInst to InvokeInst with the specified unwind edge basic block.
bool wouldInstructionBeTriviallyDead(Instruction *I, const TargetLibraryInfo *TLI=nullptr)
Return true if the result produced by the instruction would have no side effects if it was not used...
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
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...
void setIncomingValue(unsigned i, Value *V)
static void Split(std::vector< std::string > &V, StringRef S)
Splits a string of comma separated items in to a vector of strings.
const Instruction * getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
static MDNode * getMostGenericFPMath(MDNode *A, MDNode *B)
void changeImmediateDominator(DomTreeNodeBase< NodeT > *N, DomTreeNodeBase< NodeT > *NewIDom)
changeImmediateDominator - This method is used to update the dominator tree information when a node's...
This represents the llvm.dbg.declare instruction.
Value * SimplifyInstruction(Instruction *I, const SimplifyQuery &Q, OptimizationRemarkEmitter *ORE=nullptr)
See if we can compute a simplified version of this instruction.
void computeKnownBits(const Value *V, KnownBits &Known, const DataLayout &DL, unsigned Depth=0, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
Determine which bits of V are known to be either zero or one and return them in the KnownZero/KnownOn...
void combineMetadata(Instruction *K, const Instruction *J, ArrayRef< unsigned > KnownIDs)
Combine the metadata of two instructions so that K can replace J.
const BasicBlock * getParent() const
unsigned replaceNonLocalUsesWith(Instruction *From, Value *To)
A wrapper class for inspecting calls to intrinsic functions.
an instruction to allocate memory on the stack
bool properlyDominates(const DomTreeNodeBase< NodeT > *A, const DomTreeNodeBase< NodeT > *B) const
properlyDominates - Returns true iff A dominates B and A != B.
bool isMetadataTy() const
Return true if this is 'metadata'.
gep_type_iterator gep_type_begin(const User *GEP)