Go to the documentation of this file.
106 using namespace llvm;
108 #define DEBUG_TYPE "loop-idiom"
110 STATISTIC(NumMemSet,
"Number of memset's formed from loop stores");
111 STATISTIC(NumMemCpy,
"Number of memcpy's formed from loop load+stores");
113 NumShiftUntilBitTest,
114 "Number of uncountable loops recognized as 'shift until bitttest' idiom");
119 cl::desc(
"Options to disable Loop Idiom Recognize Pass."),
126 cl::desc(
"Proceed with loop idiom recognize pass, but do "
127 "not convert loop(s) to memset."),
134 cl::desc(
"Proceed with loop idiom recognize pass, but do "
135 "not convert loop(s) to memcpy."),
140 "use-lir-code-size-heurs",
141 cl::desc(
"Use loop idiom recognition code size heuristics when compiling"
147 class LoopIdiomRecognize {
148 Loop *CurLoop =
nullptr;
157 bool ApplyCodeSizeHeuristics;
158 std::unique_ptr<MemorySSAUpdater> MSSAU;
167 : AA(AA), DT(DT), LI(LI), SE(SE), TLI(TLI),
TTI(
TTI),
DL(
DL), ORE(ORE) {
169 MSSAU = std::make_unique<MemorySSAUpdater>(MSSA);
172 bool runOnLoop(
Loop *L);
178 StoreListMap StoreRefsForMemset;
179 StoreListMap StoreRefsForMemsetPattern;
180 StoreList StoreRefsForMemcpy;
182 bool HasMemsetPattern;
186 enum LegalStoreKind {
191 UnorderedAtomicMemcpy,
199 bool runOnCountableLoop();
205 enum class ForMemset {
No,
Yes };
210 bool processLoopStridedStore(
Value *DestPtr,
unsigned StoreSize,
215 bool NegStride,
bool IsLoopMemset =
false);
217 bool avoidLIRForMultiBlockLoop(
bool IsMemset =
false,
218 bool IsLoopMemset =
false);
224 bool runOnNoncountableLoop();
226 bool recognizePopcount();
229 bool recognizeAndInsertFFS();
234 bool IsCntPhiUsedOutsideLoop);
236 bool recognizeShiftUntilBitTest();
241 class LoopIdiomRecognizeLegacyPass :
public LoopPass {
245 explicit LoopIdiomRecognizeLegacyPass() :
LoopPass(
ID) {
257 AliasAnalysis *AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
258 DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
259 LoopInfo *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
260 ScalarEvolution *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
262 &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(
265 &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
268 auto *MSSAAnalysis = getAnalysisIfAvailable<MemorySSAWrapperPass>();
271 MSSA = &MSSAAnalysis->getMSSA();
278 LoopIdiomRecognize LIR(AA, DT, LI, SE, TLI,
TTI, MSSA,
DL, ORE);
279 return LIR.runOnLoop(L);
309 LoopIdiomRecognize LIR(&AR.
AA, &AR.
DT, &AR.
LI, &AR.
SE, &AR.
TLI, &AR.
TTI,
311 if (!LIR.runOnLoop(&L))
321 "Recognize loop idioms",
false,
false)
332 I->eraseFromParent();
341 bool LoopIdiomRecognize::runOnLoop(
Loop *L) {
350 if (
Name ==
"memset" ||
Name ==
"memcpy")
354 ApplyCodeSizeHeuristics =
357 HasMemset = TLI->
has(LibFunc_memset);
358 HasMemsetPattern = TLI->
has(LibFunc_memset_pattern16);
359 HasMemcpy = TLI->
has(LibFunc_memcpy);
361 if (HasMemset || HasMemsetPattern || HasMemcpy)
363 return runOnCountableLoop();
365 return runOnNoncountableLoop();
368 bool LoopIdiomRecognize::runOnCountableLoop() {
370 assert(!isa<SCEVCouldNotCompute>(BECount) &&
371 "runOnCountableLoop() called on a loop without a predictable"
372 "backedge-taken count");
376 if (
const SCEVConstant *BECst = dyn_cast<SCEVConstant>(BECount))
377 if (BECst->getAPInt() == 0)
395 bool MadeChange =
false;
403 MadeChange |= runOnLoopBlock(
BB, BECount, ExitBlocks);
436 if (
DL->isBigEndian())
452 unsigned ArraySize = 16 /
Size;
457 LoopIdiomRecognize::LegalStoreKind
460 if (
SI->isVolatile())
463 if (!
SI->isUnordered())
467 if (
SI->getMetadata(LLVMContext::MD_nontemporal))
470 Value *StoredVal =
SI->getValueOperand();
471 Value *StorePtr =
SI->getPointerOperand();
490 dyn_cast<SCEVAddRecExpr>(SE->
getSCEV(StorePtr));
495 if (!isa<SCEVConstant>(StoreEv->
getOperand(1)))
508 bool UnorderedAtomic =
SI->isUnordered() && !
SI->isSimple();
517 return LegalStoreKind::Memset;
523 return LegalStoreKind::MemsetPattern;
531 unsigned StoreSize =
DL->getTypeStoreSize(
SI->getValueOperand()->getType());
532 if (StoreSize != Stride && StoreSize != -Stride)
536 LoadInst *LI = dyn_cast<LoadInst>(
SI->getValueOperand());
558 UnorderedAtomic = UnorderedAtomic || LI->
isAtomic();
559 return UnorderedAtomic ? LegalStoreKind::UnorderedAtomicMemcpy
560 : LegalStoreKind::Memcpy;
566 void LoopIdiomRecognize::collectStores(
BasicBlock *
BB) {
567 StoreRefsForMemset.clear();
568 StoreRefsForMemsetPattern.clear();
569 StoreRefsForMemcpy.clear();
576 switch (isLegalStore(
SI)) {
580 case LegalStoreKind::Memset: {
583 StoreRefsForMemset[Ptr].push_back(
SI);
585 case LegalStoreKind::MemsetPattern: {
588 StoreRefsForMemsetPattern[Ptr].push_back(
SI);
590 case LegalStoreKind::Memcpy:
591 case LegalStoreKind::UnorderedAtomicMemcpy:
592 StoreRefsForMemcpy.push_back(
SI);
595 assert(
false &&
"unhandled return value");
604 bool LoopIdiomRecognize::runOnLoopBlock(
610 for (
unsigned i = 0,
e = ExitBlocks.size();
i !=
e; ++
i)
614 bool MadeChange =
false;
621 for (
auto &SL : StoreRefsForMemset)
622 MadeChange |= processLoopStores(SL.second, BECount, ForMemset::Yes);
624 for (
auto &SL : StoreRefsForMemsetPattern)
625 MadeChange |= processLoopStores(SL.second, BECount, ForMemset::No);
628 for (
auto &
SI : StoreRefsForMemcpy)
629 MadeChange |= processLoopStoreOfLoopLoad(
SI, BECount);
634 if (
MemSetInst *MSI = dyn_cast<MemSetInst>(Inst)) {
636 if (!processLoopMemSet(MSI, BECount))
653 const SCEV *BECount, ForMemset For) {
661 for (
unsigned i = 0,
e = SL.size();
i <
e; ++
i) {
664 Value *FirstStoredVal = SL[
i]->getValueOperand();
665 Value *FirstStorePtr = SL[
i]->getPointerOperand();
667 cast<SCEVAddRecExpr>(SE->
getSCEV(FirstStorePtr));
669 unsigned FirstStoreSize =
DL->getTypeStoreSize(SL[
i]->getValueOperand()->
getType());
672 if (FirstStride == FirstStoreSize || -FirstStride == FirstStoreSize) {
677 Value *FirstSplatValue =
nullptr;
678 Constant *FirstPatternValue =
nullptr;
680 if (For == ForMemset::Yes)
685 assert((FirstSplatValue || FirstPatternValue) &&
686 "Expected either splat value or pattern value.");
694 for (
j =
i + 1;
j <
e; ++
j)
695 IndexQueue.push_back(
j);
696 for (
j =
i;
j > 0; --
j)
697 IndexQueue.push_back(
j - 1);
699 for (
auto &k : IndexQueue) {
700 assert(SL[k]->
isSimple() &&
"Expected only non-volatile stores.");
701 Value *SecondStorePtr = SL[k]->getPointerOperand();
703 cast<SCEVAddRecExpr>(SE->
getSCEV(SecondStorePtr));
706 if (FirstStride != SecondStride)
709 Value *SecondStoredVal = SL[k]->getValueOperand();
710 Value *SecondSplatValue =
nullptr;
711 Constant *SecondPatternValue =
nullptr;
713 if (For == ForMemset::Yes)
718 assert((SecondSplatValue || SecondPatternValue) &&
719 "Expected either splat value or pattern value.");
722 if (For == ForMemset::Yes) {
723 if (isa<UndefValue>(FirstSplatValue))
724 FirstSplatValue = SecondSplatValue;
725 if (FirstSplatValue != SecondSplatValue)
728 if (isa<UndefValue>(FirstPatternValue))
729 FirstPatternValue = SecondPatternValue;
730 if (FirstPatternValue != SecondPatternValue)
735 ConsecutiveChain[SL[
i]] = SL[k];
744 bool Changed =
false;
758 unsigned StoreSize = 0;
762 if (TransformedStores.
count(
I))
766 StoreSize +=
DL->getTypeStoreSize(
I->getValueOperand()->getType());
768 I = ConsecutiveChain[
I];
778 if (StoreSize != Stride && StoreSize != -Stride)
781 bool NegStride = StoreSize == -Stride;
783 if (processLoopStridedStore(StorePtr, StoreSize,
785 StoredVal, HeadStore, AdjacentStores, StoreEv,
786 BECount, NegStride)) {
787 TransformedStores.
insert(AdjacentStores.
begin(), AdjacentStores.
end());
796 bool LoopIdiomRecognize::processLoopMemSet(
MemSetInst *MSI,
797 const SCEV *BECount) {
816 uint64_t SizeInBytes = cast<ConstantInt>(MSI->
getLength())->getZExtValue();
817 if ((SizeInBytes >> 32) != 0)
827 if (SizeInBytes != Stride && SizeInBytes != -Stride)
838 bool NegStride = SizeInBytes == -Stride;
839 return processLoopStridedStore(
841 SplatValue, MSI, MSIs, Ev, BECount, NegStride,
true);
849 const SCEV *BECount,
unsigned StoreSize,
859 if (
const SCEVConstant *BECst = dyn_cast<SCEVConstant>(BECount))
872 if (IgnoredStores.
count(&
I) == 0 &&
884 Type *IntPtr,
unsigned StoreSize,
898 unsigned StoreSize,
Loop *CurLoop,
900 const SCEV *NumBytesS;
907 if (
DL->getTypeSizeInBits(BECount->
getType()).getFixedSize() <
908 DL->getTypeSizeInBits(IntPtr).getFixedSize() &&
921 if (StoreSize != 1) {
930 bool LoopIdiomRecognize::processLoopStridedStore(
934 const SCEV *BECount,
bool NegStride,
bool IsLoopMemset) {
941 assert((SplatValue || PatternValue) &&
942 "Expected either splat value or pattern value.");
953 Type *DestInt8PtrTy =
Builder.getInt8PtrTy(DestAS);
956 bool Changed =
false;
973 Expander.expandCodeFor(Start, DestInt8PtrTy, Preheader->
getTerminator());
985 StoreSize, *AA, Stores))
988 if (avoidLIRForMultiBlockLoop(
true, IsLoopMemset))
993 const SCEV *NumBytesS =
1002 Expander.expandCodeFor(NumBytesS, IntIdxTy, Preheader->
getTerminator());
1006 NewCall =
Builder.CreateMemSet(BasePtr, SplatValue, NumBytes,
1010 Type *Int8PtrTy = DestInt8PtrTy;
1013 StringRef FuncName =
"memset_pattern16";
1015 Int8PtrTy, Int8PtrTy, IntIdxTy);
1022 PatternValue,
".memset_pattern");
1026 NewCall =
Builder.CreateCall(MSP, {
BasePtr, PatternPtr, NumBytes});
1031 MemoryAccess *NewMemAcc = MSSAU->createMemoryAccessInBB(
1033 MSSAU->insertDef(cast<MemoryDef>(NewMemAcc),
true);
1037 <<
" from store to: " << *Ev <<
" at: " << *TheStore
1043 <<
"Transformed loop-strided store into a call to "
1050 for (
auto *
I : Stores) {
1052 MSSAU->removeMemoryAccess(
I,
true);
1056 MSSAU->getMemorySSA()->verifyMemorySSA();
1058 ExpCleaner.markResultUsed();
1065 bool LoopIdiomRecognize::processLoopStoreOfLoopLoad(
StoreInst *
SI,
1066 const SCEV *BECount) {
1067 assert(
SI->isUnordered() &&
"Expected only non-volatile non-ordered stores.");
1069 Value *StorePtr =
SI->getPointerOperand();
1072 unsigned StoreSize =
DL->getTypeStoreSize(
SI->getValueOperand()->getType());
1073 bool NegStride = StoreSize == -Stride;
1076 LoadInst *LI = cast<LoadInst>(
SI->getValueOperand());
1094 bool Changed =
false;
1096 unsigned StrAS =
SI->getPointerAddressSpace();
1097 Type *IntIdxTy =
Builder.getIntNTy(
DL->getIndexSizeInBits(StrAS));
1109 Value *StoreBasePtr = Expander.expandCodeFor(
1124 StoreSize, *AA, Stores))
1136 Value *LoadBasePtr = Expander.expandCodeFor(
1140 StoreSize, *AA, Stores))
1143 if (avoidLIRForMultiBlockLoop())
1148 const SCEV *NumBytesS =
1152 Expander.expandCodeFor(NumBytesS, IntIdxTy, Preheader->
getTerminator());
1159 NewCall =
Builder.CreateMemCpy(StoreBasePtr,
SI->getAlign(), LoadBasePtr,
1164 const Align StoreAlign =
SI->getAlign();
1166 if (StoreAlign < StoreSize || LoadAlign < StoreSize)
1179 NewCall =
Builder.CreateElementUnorderedAtomicMemCpy(
1180 StoreBasePtr, StoreAlign, LoadBasePtr, LoadAlign, NumBytes,
1186 MemoryAccess *NewMemAcc = MSSAU->createMemoryAccessInBB(
1188 MSSAU->insertDef(cast<MemoryDef>(NewMemAcc),
true);
1192 <<
" from load ptr=" << *LoadEv <<
" at: " << *LI <<
"\n"
1193 <<
" from store ptr=" << *StoreEv <<
" at: " << *
SI
1199 <<
"Formed a call to "
1207 MSSAU->removeMemoryAccess(
SI,
true);
1210 MSSAU->getMemorySSA()->verifyMemorySSA();
1212 ExpCleaner.markResultUsed();
1219 bool LoopIdiomRecognize::avoidLIRForMultiBlockLoop(
bool IsMemset,
1220 bool IsLoopMemset) {
1221 if (ApplyCodeSizeHeuristics && CurLoop->
getNumBlocks() > 1) {
1222 if (CurLoop->
isOutermost() && (!IsMemset || !IsLoopMemset)) {
1224 <<
" : LIR " << (IsMemset ?
"Memset" :
"Memcpy")
1225 <<
" avoided: multi-block top-level loop\n");
1233 bool LoopIdiomRecognize::runOnNoncountableLoop() {
1236 <<
"] Noncountable Loop %"
1239 return recognizePopcount() || recognizeAndInsertFFS() ||
1240 recognizeShiftUntilBitTest();
1250 bool JmpOnZero =
false) {
1259 if (!CmpZero || !CmpZero->
isZero())
1270 return Cond->getOperand(0);
1279 auto *PhiX = dyn_cast<PHINode>(VarX);
1280 if (PhiX && PhiX->getParent() == LoopEntry &&
1281 (PhiX->getOperand(0) == DefX || PhiX->
getOperand(1) == DefX))
1317 Value *VarX1, *VarX0;
1320 DefX2 = CountInst =
nullptr;
1321 VarX1 = VarX0 =
nullptr;
1322 PhiX = CountPhi =
nullptr;
1328 dyn_cast<BranchInst>(LoopEntry->
getTerminator()), LoopEntry))
1329 DefX2 = dyn_cast<Instruction>(
T);
1336 if (!DefX2 || DefX2->
getOpcode() != Instruction::And)
1341 if ((SubOneOp = dyn_cast<BinaryOperator>(DefX2->
getOperand(0))))
1345 SubOneOp = dyn_cast<BinaryOperator>(DefX2->
getOperand(1));
1347 if (!SubOneOp || SubOneOp->
getOperand(0) != VarX1)
1366 CountInst =
nullptr;
1368 IterE = LoopEntry->
end();
1369 Iter != IterE; Iter++) {
1375 if (!Inc || !Inc->
isOne())
1383 bool LiveOutLoop =
false;
1385 if ((cast<Instruction>(U))->
getParent() != LoopEntry) {
1405 auto *PreCondBr = dyn_cast<BranchInst>(PreCondBB->
getTerminator());
1410 CntInst = CountInst;
1450 Value *VarX =
nullptr;
1459 dyn_cast<BranchInst>(LoopEntry->
getTerminator()), LoopEntry))
1460 DefX = dyn_cast<Instruction>(
T);
1465 if (!DefX || !DefX->
isShift())
1467 IntrinID = DefX->
getOpcode() == Instruction::Shl ? Intrinsic::cttz :
1470 if (!Shft || !Shft->
isOne())
1494 IterE = LoopEntry->
end();
1495 Iter != IterE; Iter++) {
1521 bool LoopIdiomRecognize::recognizeAndInsertFFS() {
1533 size_t IdiomCanonicalSize = 6;
1536 CntInst, CntPhi, DefX))
1539 bool IsCntPhiUsedOutsideLoop =
false;
1541 if (!CurLoop->
contains(cast<Instruction>(U))) {
1542 IsCntPhiUsedOutsideLoop =
true;
1545 bool IsCntInstUsedOutsideLoop =
false;
1547 if (!CurLoop->
contains(cast<Instruction>(U))) {
1548 IsCntInstUsedOutsideLoop =
true;
1553 if (IsCntInstUsedOutsideLoop && IsCntPhiUsedOutsideLoop)
1559 bool ZeroCheck =
false;
1568 if (!IsCntPhiUsedOutsideLoop) {
1572 auto *PreCondBI = dyn_cast<BranchInst>(PreCondBB->getTerminator());
1597 std::distance(InstWithoutDebugIt.begin(), InstWithoutDebugIt.end());
1606 transformLoopToCountable(IntrinID, PH, CntInst, CntPhi, InitX, DefX,
1608 IsCntPhiUsedOutsideLoop);
1616 bool LoopIdiomRecognize::recognizePopcount() {
1630 if (LoopBody->
size() >= 20) {
1640 if (!EntryBI || EntryBI->isConditional())
1648 auto *PreCondBI = dyn_cast<BranchInst>(PreCondBB->getTerminator());
1649 if (!PreCondBI || PreCondBI->isUnconditional())
1658 transformLoopToPopcount(PreCondBB, CntInst, CntPhi, Val);
1664 Value *Ops[] = {Val};
1720 void LoopIdiomRecognize::transformLoopToCountable(
1723 bool ZeroCheck,
bool IsCntPhiUsedOutsideLoop) {
1737 if (IsCntPhiUsedOutsideLoop) {
1738 if (DefX->
getOpcode() == Instruction::AShr)
1739 InitXNext =
Builder.CreateAShr(InitX, 1);
1740 else if (DefX->
getOpcode() == Instruction::LShr)
1741 InitXNext =
Builder.CreateLShr(InitX, 1);
1742 else if (DefX->
getOpcode() == Instruction::Shl)
1743 InitXNext =
Builder.CreateShl(InitX, 1);
1753 Value *NewCount = Count;
1754 if (IsCntPhiUsedOutsideLoop)
1757 NewCount =
Builder.CreateZExtOrTrunc(NewCount, CntInst->
getType());
1760 if (cast<ConstantInt>(CntInst->
getOperand(1))->isOne()) {
1763 ConstantInt *InitConst = dyn_cast<ConstantInt>(CntInitVal);
1764 if (!InitConst || !InitConst->
isZero())
1765 NewCount =
Builder.CreateAdd(NewCount, CntInitVal);
1769 NewCount =
Builder.CreateSub(CntInitVal, NewCount);
1782 ICmpInst *LbCond = cast<ICmpInst>(LbBr->getCondition());
1786 Builder.SetInsertPoint(LbCond);
1801 if (IsCntPhiUsedOutsideLoop)
1811 void LoopIdiomRecognize::transformLoopToPopcount(
BasicBlock *PreCondBB,
1815 auto *PreCondBr = cast<BranchInst>(PreCondBB->
getTerminator());
1824 Value *PopCnt, *PopCntZext, *NewCount, *TripCnt;
1827 NewCount = PopCntZext =
1828 Builder.CreateZExtOrTrunc(PopCnt, cast<IntegerType>(CntPhi->
getType()));
1830 if (NewCount != PopCnt)
1831 (cast<Instruction>(NewCount))->setDebugLoc(
DL);
1838 ConstantInt *InitConst = dyn_cast<ConstantInt>(CntInitVal);
1839 if (!InitConst || !InitConst->
isZero()) {
1840 NewCount =
Builder.CreateAdd(NewCount, CntInitVal);
1841 (cast<Instruction>(NewCount))->setDebugLoc(
DL);
1850 ICmpInst *PreCond = cast<ICmpInst>(PreCondBr->getCondition());
1852 Value *Opnd0 = PopCntZext;
1857 ICmpInst *NewPreCond = cast<ICmpInst>(
1859 PreCondBr->setCondition(NewPreCond);
1887 ICmpInst *LbCond = cast<ICmpInst>(LbBr->getCondition());
1892 Builder.SetInsertPoint(LbCond);
1895 "tcdec",
false,
true));
1923 : SubPattern(SP), L(L) {}
1925 template <
typename ITy>
bool match(ITy *V) {
1931 template <
typename Ty>
1962 " Performing shift-until-bittest idiom detection.\n");
1972 assert(LoopPreheaderBB &&
"There is always a loop preheader.");
1974 using namespace PatternMatch;
1979 Value *CmpLHS, *CmpRHS;
1990 auto MatchVariableBitMask = [&]() {
1999 auto MatchConstantBitMask = [&]() {
2005 auto MatchDecomposableConstantBitMask = [&]() {
2013 if (!MatchVariableBitMask() && !MatchConstantBitMask() &&
2014 !MatchDecomposableConstantBitMask()) {
2020 auto *CurrXPN = dyn_cast<PHINode>(CurrX);
2021 if (!CurrXPN || CurrXPN->getParent() != LoopHeaderBB) {
2026 BaseX = CurrXPN->getIncomingValueForBlock(LoopPreheaderBB);
2028 dyn_cast<Instruction>(CurrXPN->getIncomingValueForBlock(LoopHeaderBB));
2039 "Should only get equality predicates here.");
2042 if (Pred != ICmpInst::Predicate::ICMP_EQ) {
2049 if (TrueBB != LoopHeaderBB) {
2108 bool LoopIdiomRecognize::recognizeShiftUntilBitTest() {
2109 bool MadeChange =
false;
2111 Value *
X, *BitMask, *BitPos, *XCurr;
2116 " shift-until-bittest idiom detection failed.\n");
2126 assert(LoopPreheaderBB &&
"There is always a loop preheader.");
2129 assert(LoopPreheaderBB &&
"There is only a single successor.");
2135 Type *Ty =
X->getType();
2149 " Intrinsic is too costly, not beneficial\n");
2164 BitPos->
getName() +
".lowbitmask");
2166 Builder.CreateOr(LowBitMask, BitMask, BitPos->
getName() +
".mask");
2169 IntrID, Ty, {XMasked,
Builder.getTrue()},
2170 nullptr, XMasked->
getName() +
".numleadingzeros");
2173 XMasked->
getName() +
".numactivebits",
true,
2175 Value *XMaskedLeadingOnePos =
2177 XMasked->
getName() +
".leadingonepos",
false,
2181 BitPos, XMaskedLeadingOnePos, CurLoop->
getName() +
".backedgetakencount",
2185 Value *LoopTripCount =
2187 CurLoop->
getName() +
".tripcount",
true,
2196 if (
auto *
I = dyn_cast<Instruction>(NewX))
2197 I->copyIRFlags(XNext,
true);
2209 NewXNext =
Builder.CreateShl(
X, LoopTripCount);
2218 if (
auto *
I = dyn_cast<Instruction>(NewXNext))
2219 I->copyIRFlags(XNext,
true);
2238 true, Bitwidth != 2);
2241 auto *IVCheck =
Builder.CreateICmpEQ(IVNext, LoopTripCount,
2242 CurLoop->
getName() +
".ivcheck");
2243 Builder.CreateCondBr(IVCheck, SuccessorBB, LoopHeaderBB);
2248 IV->addIncoming(IVNext, LoopHeaderBB);
2259 ++NumShiftUntilBitTest;
static cl::opt< bool, true > DisableLIRPAll("disable-" DEBUG_TYPE "-all", cl::desc("Options to disable Loop Idiom Recognize Pass."), cl::location(DisableLIRP::All), cl::init(false), cl::ReallyHidden)
A set of analyses that are preserved following a run of a transformation pass.
bool RecursivelyDeleteTriviallyDeadInstructions(Value *V, const TargetLibraryInfo *TLI=nullptr, MemorySSAUpdater *MSSAU=nullptr, std::function< void(Value *)> AboutToDeleteCallback=std::function< void(Value *)>())
If the specified value is a trivially dead instruction, delete it.
bool hasLoopInvariantBackedgeTakenCount(const Loop *L)
Return true if the specified loop has an analyzable loop-invariant backedge-taken count.
bool isLoopInvariant(const Value *V) const
Return true if the specified value is loop invariant.
unsigned getDestAlignment() const
FIXME: Remove this function once transition to Align is over.
bool isLoopEntryGuardedByCond(const Loop *L, ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS)
Test whether entry to the loop is protected by a conditional between LHS and RHS.
const SCEV * getNegativeSCEV(const SCEV *V, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap)
Return the SCEV object corresponding to -V.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
bool isKnownNonNegative(const Value *V, const DataLayout &DL, unsigned Depth=0, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr, bool UseInstrInfo=true)
Returns true if the give value is known to be non-negative.
Match loop-invariant value.
BlockT * getExitBlock() const
If getExitBlocks would return exactly one block, return that block.
Value handle that is nullable, but tries to track the Value.
A parsed version of the target data layout string in and methods for querying it.
constexpr static LocationSize afterPointer()
Any location after the base pointer (but still within the underlying object).
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
InstListType::iterator iterator
Instruction iterators...
bool isAffine() const
Return true if this represents an expression A + B*x where A and B are loop invariant values.
LLVM_NODISCARD bool isModOrRefSet(const ModRefInfo MRI)
const Function * getParent() const
Return the enclosing method, or null if none.
const SCEV * getStart() const
ScalarTy getFixedSize() const
LocationClass< Ty > location(Ty &L)
Represents a single loop in the control flow graph.
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
This class uses information about analyze scalars to rewrite expressions in canonical form.
Reference model for inliner Oz decision policy Note this model is also referenced by test Transforms Inline ML tests if replacing it
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static bool detectPopcountIdiom(Loop *CurLoop, BasicBlock *PreCondBB, Instruction *&CntInst, PHINode *&CntPhi, Value *&Var)
Return true iff the idiom is detected in the loop.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
The main scalar evolution driver.
bool hasNoUnsignedWrap() const
Determine whether the no unsigned wrap flag is set.
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE,...
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
void initializeLoopIdiomRecognizeLegacyPassPass(PassRegistry &)
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
typename vector_type::const_iterator iterator
void getLoopAnalysisUsage(AnalysisUsage &AU)
Helper to consistently add the set of standard passes to a loop pass's AnalysisUsage.
brc_match< Cond_t, bind_ty< BasicBlock >, bind_ty< BasicBlock > > m_Br(const Cond_t &C, BasicBlock *&T, BasicBlock *&F)
The instances of the Type class are immutable: once they are created, they are never changed.
bool isEquality() const
Return true if this predicate is either EQ or NE.
Pass * createLoopIdiomPass()
Value * isBytewiseValue(Value *V, const DataLayout &DL)
If the specified value can be set by repeating the same byte in memory, return the i8 value that it i...
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
bool isConsecutiveAccess(Value *A, Value *B, const DataLayout &DL, ScalarEvolution &SE, bool CheckType=true)
Returns true if the memory operations A and B are consecutive.
DiagnosticInfoOptimizationBase::Argument NV
static bool All
When true, the entire pass is disabled.
@ ICMP_SLE
signed less or equal
static Constant * getExactLogBase2(Constant *C)
If C is a scalar/fixed width vector of known powers of 2, then this function returns a new scalar/fix...
const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
void setUnnamedAddr(UnnamedAddr Val)
Class to represent array types.
Value * getPointerOperand()
const SCEV * getTruncateOrZeroExtend(const SCEV *V, Type *Ty, unsigned Depth=0)
Return a SCEV corresponding to a conversion of the input value to the specified type.
BinaryOp_match< LHS, RHS, Instruction::And, true > m_c_And(const LHS &L, const RHS &R)
Matches an And with LHS and RHS in either order.
Align getAlign() const
Return the alignment of the access that is being performed.
std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Simple and conservative implementation of LoopSafetyInfo that can give false-positive answers to its ...
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
bool isScalable() const
Returns whether the size is scaled by a runtime quantity (vscale).
ConstantInt * getInt1(bool V)
Get a constant value representing either true or false.
unsigned getNumBlocks() const
Get the number of blocks in this loop in constant time.
block_iterator block_end() const
Analysis the ScalarEvolution expression for r is< loop > Outside the loop
LLVM Basic Block Representation.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const SCEV * getMulExpr(SmallVectorImpl< const SCEV * > &Ops, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Get a canonical multiply expression, or something simpler if possible.
bool dominates(const BasicBlock *BB, const Use &U) const
Return true if the (end of the) basic block BB dominates the use U.
bool isSafeToExpand(const SCEV *S, ScalarEvolution &SE)
Return true if the given expression is safe to expand in the sense that all materialized values are s...
This is the shared class of boolean and integer constants.
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Return the function type for an intrinsic.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
Value * getValueOperand()
Legacy analysis pass which computes MemorySSA.
iterator begin()
Get an iterator to the beginning of the SetVector.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
const SCEV * getOne(Type *Ty)
Return a SCEV for the constant 1 of a specific type.
bool match(Val *V, const Pattern &P)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
(vector float) vec_cmpeq(*A, *B) C
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
Represent the analysis usage information of a pass.
unsigned getAlignment() const
Return the alignment of the access that is being performed FIXME: Remove this function once transitio...
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Value * getIncomingValueForBlock(const BasicBlock *BB) const
ArrayRef< BlockT * > getBlocks() const
Get a list of the basic blocks which make up this loop.
static Constant * getAllOnesValue(Type *Ty)
BinaryOps getOpcode() const
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
STATISTIC(NumFunctions, "Total number of functions")
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
static LocationSize precise(uint64_t Value)
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.
const Value * getUnderlyingObject(const Value *V, unsigned MaxLookup=6)
This method strips off any GEP address adjustments and pointer casts from the specified value,...
match_LoopInvariant< Ty > m_LoopInvariant(const Ty &M, const Loop *L)
Matches if the value is loop-invariant.
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
const Instruction * getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
This struct is a compact representation of a valid (non-zero power of two) alignment.
static const SCEV * getStartForNegStride(const SCEV *Start, const SCEV *BECount, Type *IntPtr, unsigned StoreSize, ScalarEvolution *SE)
StringRef getName() const
unsigned getIntegerBitWidth() const
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
This class wraps the llvm.memset intrinsic.
cst_pred_ty< is_one > m_One()
Match an integer 1 or a vector with all elements equal to 1.
Value * getCondition() const
const SCEV * getSCEV(Value *V)
Return a SCEV expression for the full generality of the specified expression.
block_iterator block_begin() const
cst_pred_ty< is_power2 > m_Power2()
Match an integer or vector power-of-2.
static APInt getStoreStride(const SCEVAddRecExpr *StoreEv)
static cl::opt< bool > UseLIRCodeSizeHeurs("use-lir-code-size-heurs", cl::desc("Use loop idiom recognition code size heuristics when compiling" "with -Os/-Oz"), cl::init(true), cl::Hidden)
PreservedAnalyses getLoopPassPreservedAnalyses()
Returns the minimum set of Analyses that all loop passes must preserve.
ArrayRef< BasicBlock * >::const_iterator block_iterator
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
This class represents an analyzed expression in the program.
is_zero m_Zero()
Match any null constant or a vector with all elements equal to 0.
An instruction for storing to memory.
This is an important base class in LLVM.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
This instruction compares its operands according to the predicate given to the constructor.
Module * getParent()
Get the module that this global value is contained inside of...
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
void getUniqueExitBlocks(SmallVectorImpl< BlockT * > &ExitBlocks) const
Return all unique successor blocks of this loop.
static CallInst * createPopcntIntrinsic(IRBuilder<> &IRBuilder, Value *Val, const DebugLoc &DL)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
static bool mayLoopAccessLocation(Value *Ptr, ModRefInfo Access, Loop *L, const SCEV *BECount, unsigned StoreSize, AliasAnalysis &AA, SmallPtrSetImpl< Instruction * > &IgnoredStores)
mayLoopAccessLocation - Return true if the specified loop might access the specified pointer location...
Encapsulates MemorySSA, including all data associated with memory accesses.
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
initializer< Ty > init(const Ty &Val)
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
BinaryOp_match< LHS, RHS, Instruction::And > m_And(const LHS &L, const RHS &R)
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
This class represents a constant integer value.
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void replaceUsesOutsideBlock(Value *V, BasicBlock *BB)
replaceUsesOutsideBlock - Go through the uses list for this definition and make each use point to "V"...
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static bool detectShiftUntilZeroIdiom(Loop *CurLoop, const DataLayout &DL, Intrinsic::ID &IntrinID, Value *&InitX, Instruction *&CntInst, PHINode *&CntPhi, Instruction *&DefX)
Return true if the idiom is detected in the loop.
bool has(LibFunc F) const
Tests whether a library function is available.
Helper to remove instructions inserted during SCEV expansion, unless they are marked as used.
static ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
A Module instance is used to store all the information related to an LLVM module.
An analysis that produces MemorySSA for a function.
void computeLoopSafetyInfo(const Loop *CurLoop) override
Computes safety information for a loop checks loop body & header for the possibility of may throw exc...
static const SCEV * getNumBytes(const SCEV *BECount, Type *IntPtr, unsigned StoreSize, Loop *CurLoop, const DataLayout *DL, ScalarEvolution *SE)
Compute the number of bytes as a SCEV from the backedge taken count.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
class_match< Value > m_Value()
Match an arbitrary value and ignore it.
Class for arbitrary precision integers.
void setOperand(unsigned i, Value *Val)
bool insert(const value_type &X)
Insert a new element into the SetVector.
static cl::opt< bool, true > DisableLIRPMemcpy("disable-" DEBUG_TYPE "-memcpy", cl::desc("Proceed with loop idiom recognize pass, but do " "not convert loop(s) to memcpy."), cl::location(DisableLIRP::Memcpy), cl::init(false), cl::ReallyHidden)
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first found DebugLoc that has a DILocation, given a range of instructions.
match_combine_and< LTy, RTy > m_CombineAnd(const LTy &L, const RTy &R)
Combine two pattern matchers matching L && R.
Value * getDest() const
This is just like getRawDest, but it strips off any cast instructions (including addrspacecast) that ...
iterator_range< filter_iterator< BasicBlock::const_iterator, std::function< bool(const Instruction &)> > > instructionsWithoutDebug(bool SkipPseudoOp=false) const
Return a const iterator range over the instructions in the block, skipping any debug instructions.
cst_pred_ty< icmp_pred_with_threshold > m_SpecificInt_ICMP(ICmpInst::Predicate Predicate, const APInt &Threshold)
Match an integer or vector with every element comparing 'pred' (eg/ne/...) to Threshold.
SmallVector< MachineOperand, 4 > Cond
StringRef - Represent a constant reference to a string, i.e.
const SCEV * getConstant(ConstantInt *V)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Type * getType() const
All values are typed, get the type of this value.
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
bool isOutermost() const
Return true if the loop does not have a parent (natural) loop.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
static cl::opt< TargetTransformInfo::TargetCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(TargetTransformInfo::TCK_RecipThroughput), cl::values(clEnumValN(TargetTransformInfo::TCK_RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(TargetTransformInfo::TCK_Latency, "latency", "Instruction latency"), clEnumValN(TargetTransformInfo::TCK_CodeSize, "code-size", "Code size"), clEnumValN(TargetTransformInfo::TCK_SizeAndLatency, "size-latency", "Code size and latency")))
static const Function * getParent(const Value *V)
LLVMContext & getContext() const
All values hold a context through their type.
@ Mod
The access may modify the value stored in memory.
self_iterator getIterator()
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
bool isMinusOne() const
This function will return true iff every bit in this constant is set to true.
StringRef getName() const
Return a constant reference to the value's name.
An instruction for reading from memory.
static Value * matchCondition(BranchInst *BI, BasicBlock *LoopEntry, bool JmpOnZero=false)
Check if the given conditional branch is based on the comparison between a variable and zero,...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
bool anyBlockMayThrow() const override
Returns true iff any block of the loop for which this info is contains an instruction that may throw ...
bool hasOptSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
static bool detectShiftUntilBitTestIdiom(Loop *CurLoop, Value *&BaseX, Value *&BitMask, Value *&BitPos, Value *&CurrX, Instruction *&NextX)
Return true if the idiom is detected in the loop.
const Instruction & front() const
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR, LPMUpdater &U)
static bool Memcpy
When true, Memcpy is disabled.
bool isAtomic() const
Return true if this instruction has an AtomicOrdering of unordered or higher.
void forgetLoop(const Loop *L)
This method should be called by the client when it has changed a loop in a way that may effect Scalar...
const Loop * getLoop() const
bool decomposeBitTestICmp(Value *LHS, Value *RHS, CmpInst::Predicate &Pred, Value *&X, APInt &Mask, bool LookThroughTrunc=true)
Decompose an icmp into the form ((X & Mask) pred 0) if possible.
const SCEV * getMinusSCEV(const SCEV *LHS, const SCEV *RHS, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Return LHS-RHS. Minus is represented in SCEV as A+B*-1.
Value * getLength() const
TargetTransformInfo & TTI
static Constant * getMemSetPatternValue(Value *V, const DataLayout *DL)
getMemSetPatternValue - If a strided store of the specified value is safe to turn into a memset_patte...
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
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...
static ConstantInt * getBool(LLVMContext &Context, bool V)
BasicBlock * GetInsertBlock() const
This node represents a polynomial recurrence on the trip count of the specified loop.
loop Recognize loop idioms
BlockT * getHeader() const
size_type count(const key_type &key) const
Count the number of elements of a given key in the SetVector.
Provides information about what library functions are available for the current target.
static Constant * get(ArrayType *T, ArrayRef< Constant * > V)
unsigned getNumBackEdges() const
Calculate the number of back edges to the loop header.
void setPredicate(Predicate P)
Set the predicate for this instruction to the specified value.
static bool isSimple(Instruction *I)
const APInt & getAPInt() const
iterator end()
Get an iterator to the end of the SetVector.
Pass interface - Implemented by all 'passes'.
const SCEV * getZeroExtendExpr(const SCEV *Op, Type *Ty, unsigned Depth=0)
@ PrivateLinkage
Like Internal, but omit from symbol table.
bool isVolatile() const
Return true if this is a load from a volatile memory location.
match_LoopInvariant(const SubPattern_t &SP, const Loop *L)
specificval_ty m_Specific(const Value *V)
Match if we have a specific specified value.
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
Value * getPointerOperand()
CmpClass_match< LHS, RHS, ICmpInst, ICmpInst::Predicate > m_ICmp(ICmpInst::Predicate &Pred, const LHS &L, const RHS &R)
bool hasNoSignedWrap() const
Determine whether the no signed wrap flag is set.
@ ICMP_UGT
unsigned greater than
bool inferLibFuncAttributes(Function &F, const TargetLibraryInfo &TLI)
Analyze the name and prototype of the given function and set any applicable attributes.
const BasicBlock * getParent() const
Predicate getPredicate() const
Return the predicate for this instruction.
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
INITIALIZE_PASS_BEGIN(LoopIdiomRecognizeLegacyPass, "loop-idiom", "Recognize loop idioms", false, false) INITIALIZE_PASS_END(LoopIdiomRecognizeLegacyPass
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Type * getType() const
Return the LLVM type of this SCEV expression.
A container for analyses that lazily runs them and caches their results.
const SCEV * getAddExpr(SmallVectorImpl< const SCEV * > &Ops, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Get a canonical add expression, or something simpler if possible.
static CallInst * createFFSIntrinsic(IRBuilder<> &IRBuilder, Value *Val, const DebugLoc &DL, bool ZeroCheck, Intrinsic::ID IID)
This class represents a function call, abstracting a target machine's calling convention.
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
static cl::opt< bool, true > DisableLIRPMemset("disable-" DEBUG_TYPE "-memset", cl::desc("Proceed with loop idiom recognize pass, but do " "not convert loop(s) to memset."), cl::location(DisableLIRP::Memset), cl::init(false), cl::ReallyHidden)
static void deleteDeadInstruction(Instruction *I)
AnalysisUsage & addRequired()
bool VerifyMemorySSA
Enables verification of MemorySSA.
void takeName(Value *V)
Transfer the name from V to this value.
class_match< BasicBlock > m_BasicBlock()
Match an arbitrary basic block value and ignore it.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Value * getOperand(unsigned i) const
void setAlignment(MaybeAlign Align)
const SCEV * getOperand(unsigned i) const
Conditional or Unconditional Branch instruction.
A vector that has set insertion semantics.
const SCEV * getBackedgeTakenCount(const Loop *L, ExitCountKind Kind=Exact)
If the specified loop has a predictable backedge-taken count, return it, otherwise return a SCEVCould...
LLVM_NODISCARD ModRefInfo intersectModRef(const ModRefInfo MRI1, const ModRefInfo MRI2)
static PHINode * getRecurrenceVar(Value *VarX, Instruction *DefX, BasicBlock *LoopEntry)
LLVM Value Representation.
BinaryOp_match< LHS, RHS, Instruction::Shl > m_Shl(const LHS &L, const RHS &R)
iterator_range< user_iterator > users()
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc)
getModRefInfo (for call sites) - Return information about whether a particular call site modifies or ...
bool isConditional() const
@ ModRef
The access may reference and may modify the value stored in memory.
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
BasicBlock * getSuccessor(unsigned i) const
Representation for a specific memory location.
static bool Memset
When true, Memset is disabled.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.