45using namespace PatternMatch;
47#define DEBUG_TYPE "lazy-value-info"
58 "Lazy Value Information Analysis",
false,
true)
110 if (
A.isOverdefined())
112 if (
B.isOverdefined())
122 if (!
A.isConstantRange() || !
B.isConstantRange()) {
129 A.getConstantRange().intersectWith(
B.getConstantRange());
133 std::move(
Range),
A.isConstantRangeIncludingUndef() ||
134 B.isConstantRangeIncludingUndef());
143 class LazyValueInfoCache;
144 struct LVIValueHandle final :
public CallbackVH {
145 LazyValueInfoCache *Parent;
147 LVIValueHandle(
Value *V, LazyValueInfoCache *
P =
nullptr)
150 void deleted()
override;
151 void allUsesReplacedWith(
Value *V)
override {
162class LazyValueInfoCache {
167 struct BlockCacheEntry {
172 std::optional<NonNullPointerSet> NonNullPointers;
181 const BlockCacheEntry *getBlockEntry(
BasicBlock *BB)
const {
182 auto It = BlockCache.
find_as(BB);
183 if (It == BlockCache.
end())
185 return It->second.get();
188 BlockCacheEntry *getOrCreateBlockEntry(
BasicBlock *BB) {
189 auto It = BlockCache.
find_as(BB);
190 if (It == BlockCache.
end())
191 It = BlockCache.
insert({BB, std::make_unique<BlockCacheEntry>()}).first;
193 return It->second.get();
196 void addValueHandle(
Value *Val) {
197 auto HandleIt = ValueHandles.
find_as(Val);
198 if (HandleIt == ValueHandles.
end())
199 ValueHandles.
insert({Val,
this});
205 BlockCacheEntry *
Entry = getOrCreateBlockEntry(BB);
209 if (
Result.isOverdefined())
210 Entry->OverDefined.insert(Val);
217 std::optional<ValueLatticeElement> getCachedValueInfo(
Value *V,
219 const BlockCacheEntry *
Entry = getBlockEntry(BB);
223 if (
Entry->OverDefined.count(V))
226 auto LatticeIt =
Entry->LatticeElements.find_as(V);
227 if (LatticeIt ==
Entry->LatticeElements.end())
230 return LatticeIt->second;
236 BlockCacheEntry *
Entry = getOrCreateBlockEntry(BB);
237 if (!
Entry->NonNullPointers) {
238 Entry->NonNullPointers = InitFn(BB);
243 return Entry->NonNullPointers->count(V);
249 ValueHandles.
clear();
253 void eraseValue(
Value *V);
266void LazyValueInfoCache::eraseValue(
Value *V) {
267 for (
auto &Pair : BlockCache) {
268 Pair.second->LatticeElements.erase(V);
269 Pair.second->OverDefined.erase(V);
270 if (Pair.second->NonNullPointers)
271 Pair.second->NonNullPointers->erase(V);
274 auto HandleIt = ValueHandles.
find_as(V);
275 if (HandleIt != ValueHandles.
end())
276 ValueHandles.
erase(HandleIt);
279void LVIValueHandle::deleted() {
282 Parent->eraseValue(*
this);
285void LazyValueInfoCache::eraseBlock(
BasicBlock *BB) {
286 BlockCache.erase(BB);
289void LazyValueInfoCache::threadEdgeImpl(
BasicBlock *OldSucc,
301 std::vector<BasicBlock*> worklist;
302 worklist.push_back(OldSucc);
304 const BlockCacheEntry *
Entry = getBlockEntry(OldSucc);
305 if (!Entry ||
Entry->OverDefined.empty())
308 Entry->OverDefined.end());
314 while (!worklist.empty()) {
319 if (ToUpdate == NewSucc)
continue;
322 auto OI = BlockCache.find_as(ToUpdate);
323 if (OI == BlockCache.end() || OI->second->OverDefined.empty())
325 auto &ValueSet = OI->second->OverDefined;
327 bool changed =
false;
328 for (
Value *V : ValsToClear) {
329 if (!ValueSet.erase(V))
337 if (!changed)
continue;
355 : LVIImpl(
L), DT(DTree) {}
357 void emitBasicBlockStartAnnot(
const BasicBlock *BB,
368 LazyValueInfoCache TheCache;
380 bool pushBlockValue(
const std::pair<BasicBlock *, Value *> &BV) {
381 if (!BlockValueSet.
insert(BV).second)
385 << BV.first->getName() <<
"\n");
397 std::optional<ValueLatticeElement> getBlockValue(
Value *Val,
BasicBlock *BB,
407 std::optional<ValueLatticeElement> solveBlockValueImpl(
Value *Val,
409 std::optional<ValueLatticeElement> solveBlockValueNonLocal(
Value *Val,
411 std::optional<ValueLatticeElement> solveBlockValuePHINode(
PHINode *PN,
413 std::optional<ValueLatticeElement> solveBlockValueSelect(
SelectInst *S,
417 std::optional<ValueLatticeElement> solveBlockValueBinaryOpImpl(
421 std::optional<ValueLatticeElement>
423 std::optional<ValueLatticeElement> solveBlockValueCast(
CastInst *CI,
425 std::optional<ValueLatticeElement>
427 std::optional<ValueLatticeElement> solveBlockValueIntrinsic(
IntrinsicInst *
II,
429 std::optional<ValueLatticeElement>
431 std::optional<ValueLatticeElement>
434 void intersectAssumeOrGuardBlockValueConstantRange(
Value *Val,
444 std::optional<ValueLatticeElement>
449 std::optional<ValueLatticeElement>
450 getValueFromICmpCondition(
Value *Val,
ICmpInst *ICI,
bool isTrueDest,
453 std::optional<ValueLatticeElement>
455 bool UseBlockValue,
unsigned Depth = 0);
457 std::optional<ValueLatticeElement> getEdgeValueLocal(
Value *Val,
490 LazyValueInfoAnnotatedWriter Writer(
this, DTree);
491 F.print(
OS, &Writer);
501 TheCache.eraseBlock(BB);
510 : AC(AC),
DL(
DL), GuardDecl(GuardDecl) {}
514void LazyValueInfoImpl::solve() {
516 BlockValueStack.begin(), BlockValueStack.end());
518 unsigned processedCount = 0;
519 while (!BlockValueStack.empty()) {
531 dbgs() <<
"Giving up on stack because we are getting too deep\n");
533 while (!StartingStack.empty()) {
534 std::pair<BasicBlock *, Value *> &
e = StartingStack.back();
535 TheCache.insertResult(
e.second,
e.first,
537 StartingStack.pop_back();
539 BlockValueSet.clear();
540 BlockValueStack.clear();
543 std::pair<BasicBlock *, Value *>
e = BlockValueStack.back();
544 assert(BlockValueSet.count(e) &&
"Stack value should be in BlockValueSet!");
545 unsigned StackSize = BlockValueStack.size();
548 if (solveBlockValue(
e.second,
e.first)) {
550 assert(BlockValueStack.size() == StackSize &&
551 BlockValueStack.back() == e &&
"Nothing should have been pushed!");
553 std::optional<ValueLatticeElement> BBLV =
554 TheCache.getCachedValueInfo(
e.second,
e.first);
555 assert(BBLV &&
"Result should be in cache!");
557 dbgs() <<
"POP " << *
e.second <<
" in " <<
e.first->getName() <<
" = "
561 BlockValueStack.pop_back();
562 BlockValueSet.erase(e);
565 assert(BlockValueStack.size() == StackSize + 1 &&
566 "Exactly one element should have been pushed!");
571std::optional<ValueLatticeElement>
575 if (
Constant *VC = dyn_cast<Constant>(Val))
578 if (std::optional<ValueLatticeElement> OptLatticeVal =
579 TheCache.getCachedValueInfo(Val, BB)) {
580 intersectAssumeOrGuardBlockValueConstantRange(Val, *OptLatticeVal, CxtI);
581 return OptLatticeVal;
585 if (!pushBlockValue({ BB, Val }))
596 case Instruction::Call:
597 case Instruction::Invoke:
598 if (std::optional<ConstantRange>
Range = cast<CallBase>(BBI)->
getRange())
601 case Instruction::Load:
603 if (isa<IntegerType>(BBI->
getType())) {
614 assert(!isa<Constant>(Val) &&
"Value should not be constant");
615 assert(!TheCache.getCachedValueInfo(Val, BB) &&
616 "Value should not be in cache");
620 std::optional<ValueLatticeElement> Res = solveBlockValueImpl(Val, BB);
625 TheCache.insertResult(Val, BB, *Res);
629std::optional<ValueLatticeElement>
633 return solveBlockValueNonLocal(Val, BB);
635 if (
PHINode *PN = dyn_cast<PHINode>(BBI))
636 return solveBlockValuePHINode(PN, BB);
638 if (
auto *SI = dyn_cast<SelectInst>(BBI))
639 return solveBlockValueSelect(SI, BB);
655 if (
auto *CI = dyn_cast<CastInst>(BBI))
656 return solveBlockValueCast(CI, BB);
659 return solveBlockValueBinaryOp(BO, BB);
661 if (
auto *IEI = dyn_cast<InsertElementInst>(BBI))
662 return solveBlockValueInsertElement(IEI, BB);
664 if (
auto *EVI = dyn_cast<ExtractValueInst>(BBI))
665 return solveBlockValueExtractValue(EVI, BB);
667 if (
auto *
II = dyn_cast<IntrinsicInst>(BBI))
668 return solveBlockValueIntrinsic(
II, BB);
672 <<
"' - unknown inst def found.\n");
678 if (
Ptr->getType()->getPointerAddressSpace() == 0)
684 if (
LoadInst *L = dyn_cast<LoadInst>(
I)) {
686 }
else if (
StoreInst *S = dyn_cast<StoreInst>(
I)) {
689 if (
MI->isVolatile())
return;
693 if (!Len || Len->isZero())
return;
701bool LazyValueInfoImpl::isNonNullAtEndOfBlock(
Value *Val,
BasicBlock *BB) {
707 return TheCache.isNonNullAtEndOfBlock(Val, BB, [](
BasicBlock *BB) {
708 NonNullPointerSet NonNullPointers;
711 return NonNullPointers;
715std::optional<ValueLatticeElement>
716LazyValueInfoImpl::solveBlockValueNonLocal(
Value *Val,
BasicBlock *BB) {
721 assert(isa<Argument>(Val) &&
"Unknown live-in to the entry block");
722 if (std::optional<ConstantRange>
Range = cast<Argument>(Val)->
getRange())
737 std::optional<ValueLatticeElement> EdgeResult = getEdgeValue(Val, Pred, BB);
742 Result.mergeIn(*EdgeResult);
746 if (
Result.isOverdefined()) {
748 <<
"' - overdefined because of pred '"
749 << Pred->getName() <<
"' (non local).\n");
759std::optional<ValueLatticeElement>
772 std::optional<ValueLatticeElement> EdgeResult =
773 getEdgeValue(PhiVal, PhiBB, BB, PN);
778 Result.mergeIn(*EdgeResult);
782 if (
Result.isOverdefined()) {
784 <<
"' - overdefined because of pred (local).\n");
791 assert(!
Result.isOverdefined() &&
"Possible PHI in entry block?");
797void LazyValueInfoImpl::intersectAssumeOrGuardBlockValueConstantRange(
799 BBI = BBI ? BBI : dyn_cast<Instruction>(Val);
811 auto *
I = cast<CallInst>(AssumeVH);
815 BBLV =
intersect(BBLV, *getValueFromCondition(Val,
I->getArgOperand(0),
821 if (GuardDecl && !GuardDecl->
use_empty() &&
828 *getValueFromCondition(Val,
Cond,
true,
838 isNonNullAtEndOfBlock(Val, BB))
843std::optional<ValueLatticeElement>
846 std::optional<ValueLatticeElement> OptTrueVal =
847 getBlockValue(
SI->getTrueValue(), BB, SI);
852 std::optional<ValueLatticeElement> OptFalseVal =
853 getBlockValue(
SI->getFalseValue(), BB, SI);
867 ((LHS ==
SI->getTrueValue() && RHS ==
SI->getFalseValue()) ||
868 (RHS ==
SI->getTrueValue() && LHS ==
SI->getFalseValue()))) {
874 return TrueCR.
smin(FalseCR);
876 return TrueCR.
umin(FalseCR);
878 return TrueCR.
smax(FalseCR);
880 return TrueCR.
umax(FalseCR);
884 ResultCR,
TrueVal.isConstantRangeIncludingUndef() ||
885 FalseVal.isConstantRangeIncludingUndef());
889 if (LHS ==
SI->getTrueValue())
891 TrueCR.
abs(),
TrueVal.isConstantRangeIncludingUndef());
892 if (LHS ==
SI->getFalseValue())
894 FalseCR.
abs(),
FalseVal.isConstantRangeIncludingUndef());
899 if (LHS ==
SI->getTrueValue())
902 if (LHS ==
SI->getFalseValue())
930std::optional<ConstantRange>
932 std::optional<ValueLatticeElement> OptVal = getBlockValue(V, BB, CxtI);
935 return OptVal->asConstantRange(
V->getType());
938std::optional<ValueLatticeElement>
944 case Instruction::Trunc:
945 case Instruction::SExt:
946 case Instruction::ZExt:
951 <<
"' - overdefined (unknown cast).\n");
958 std::optional<ConstantRange> LHSRes = getRangeFor(CI->
getOperand(0), CI, BB);
973std::optional<ValueLatticeElement>
974LazyValueInfoImpl::solveBlockValueBinaryOpImpl(
982 std::optional<ConstantRange> LHSRes = getRangeFor(
I->getOperand(0),
I, BB);
986 std::optional<ConstantRange> RHSRes = getRangeFor(
I->getOperand(1),
I, BB);
995std::optional<ValueLatticeElement>
998 "all operands to binary operators are sized");
999 if (
auto *OBO = dyn_cast<OverflowingBinaryOperator>(BO)) {
1000 unsigned NoWrapKind = OBO->getNoWrapKind();
1001 return solveBlockValueBinaryOpImpl(
1008 return solveBlockValueBinaryOpImpl(
1014std::optional<ValueLatticeElement>
1017 return solveBlockValueBinaryOpImpl(
1023std::optional<ValueLatticeElement>
1028 <<
"' - unknown intrinsic.\n");
1034 std::optional<ConstantRange>
Range = getRangeFor(
Op,
II, BB);
1036 return std::nullopt;
1041 II->getIntrinsicID(), OpRanges)),
1045std::optional<ValueLatticeElement>
1048 std::optional<ValueLatticeElement> OptEltVal =
1051 return std::nullopt;
1054 std::optional<ValueLatticeElement> OptVecVal =
1057 return std::nullopt;
1063std::optional<ValueLatticeElement>
1068 return solveBlockValueOverflowIntrinsic(WO, BB);
1075 return getBlockValue(V, BB, EVI);
1078 <<
"' - overdefined (unknown extractvalue).\n");
1116std::optional<ValueLatticeElement>
1121 bool UseBlockValue) {
1124 if (
ConstantInt *CI = dyn_cast<ConstantInt>(RHS)) {
1126 }
else if (UseBlockValue) {
1127 std::optional<ValueLatticeElement>
R =
1128 getBlockValue(RHS, CxtI->
getParent(), CxtI);
1130 return std::nullopt;
1139static std::optional<ConstantRange>
1142 bool Invert =
false;
1149 if (
RHS.isMaxSignedValue())
1150 return std::nullopt;
1154 if (
auto CR = Fn(
RHS))
1155 return Invert ? CR->inverse() : CR;
1156 return std::nullopt;
1159std::optional<ValueLatticeElement> LazyValueInfoImpl::getValueFromICmpCondition(
1160 Value *Val,
ICmpInst *ICI,
bool isTrueDest,
bool UseBlockValue) {
1168 if (isa<Constant>(RHS)) {
1172 else if (!isa<UndefValue>(RHS))
1184 return getValueFromSimpleICmpCondition(EdgePred, RHS,
Offset, ICI,
1189 return getValueFromSimpleICmpCondition(SwappedPred, LHS,
Offset, ICI,
1226 const APInt *ShAmtC;
1231 EdgePred, *
C, [&](
const APInt &RHS) -> std::optional<ConstantRange> {
1233 if ((
New.ashr(*ShAmtC)) != RHS)
1234 return std::nullopt;
1267std::optional<ValueLatticeElement>
1269 bool IsTrueDest,
bool UseBlockValue,
1272 return getValueFromICmpCondition(Val, ICI, IsTrueDest, UseBlockValue);
1274 if (
auto *EVI = dyn_cast<ExtractValueInst>(
Cond))
1284 return getValueFromCondition(Val,
N, !IsTrueDest, UseBlockValue,
Depth);
1295 std::optional<ValueLatticeElement> LV =
1296 getValueFromCondition(Val, L, IsTrueDest, UseBlockValue,
Depth);
1298 return std::nullopt;
1299 std::optional<ValueLatticeElement> RV =
1300 getValueFromCondition(Val, R, IsTrueDest, UseBlockValue,
Depth);
1302 return std::nullopt;
1308 if (IsTrueDest ^ IsAnd) {
1326 return isa<CastInst>(Usr) || isa<BinaryOperator>(Usr) || isa<FreezeInst>(Usr);
1334 const APInt &OpConstVal,
1339 if (
auto *CI = dyn_cast<CastInst>(Usr)) {
1341 if (
auto *
C = dyn_cast_or_null<ConstantInt>(
1346 }
else if (
auto *BO = dyn_cast<BinaryOperator>(Usr)) {
1349 assert((Op0Match || Op1Match) &&
1350 "Operand 0 nor Operand 1 isn't a match");
1353 if (
auto *
C = dyn_cast_or_null<ConstantInt>(
1357 }
else if (isa<FreezeInst>(Usr)) {
1358 assert(cast<FreezeInst>(Usr)->getOperand(0) ==
Op &&
"Operand 0 isn't Op");
1365std::optional<ValueLatticeElement>
1373 if (BI->isConditional() &&
1374 BI->getSuccessor(0) != BI->getSuccessor(1)) {
1375 bool isTrueDest = BI->getSuccessor(0) == BBTo;
1376 assert(BI->getSuccessor(!isTrueDest) == BBTo &&
1377 "BBTo isn't a successor of BBFrom");
1378 Value *Condition = BI->getCondition();
1383 if (Condition == Val)
1389 std::optional<ValueLatticeElement>
Result =
1390 getValueFromCondition(Val, Condition, isTrueDest, UseBlockValue);
1392 return std::nullopt;
1394 if (!
Result->isOverdefined())
1397 if (
User *Usr = dyn_cast<User>(Val)) {
1398 assert(
Result->isOverdefined() &&
"Result isn't overdefined");
1412 APInt ConditionVal(1, isTrueDest ? 1 : 0);
1422 for (
unsigned i = 0; i < Usr->getNumOperands(); ++i) {
1423 Value *
Op = Usr->getOperand(i);
1425 Op, Condition, isTrueDest,
false);
1426 if (std::optional<APInt> OpConst =
1435 if (!
Result->isOverdefined())
1443 Value *Condition =
SI->getCondition();
1444 if (!isa<IntegerType>(Val->
getType()))
1446 bool ValUsesConditionAndMayBeFoldable =
false;
1447 if (Condition != Val) {
1449 if (
User *Usr = dyn_cast<User>(Val))
1452 if (!ValUsesConditionAndMayBeFoldable)
1455 assert((Condition == Val || ValUsesConditionAndMayBeFoldable) &&
1456 "Condition != Val nor Val doesn't use Condition");
1458 bool DefaultCase =
SI->getDefaultDest() == BBTo;
1462 for (
auto Case :
SI->cases()) {
1463 APInt CaseValue = Case.getCaseValue()->getValue();
1465 if (ValUsesConditionAndMayBeFoldable) {
1466 User *Usr = cast<User>(Val);
1481 if (Case.getCaseSuccessor() != BBTo && Condition == Val)
1483 }
else if (Case.getCaseSuccessor() == BBTo)
1484 EdgesVals = EdgesVals.
unionWith(EdgeVal);
1493std::optional<ValueLatticeElement>
1497 if (
Constant *VC = dyn_cast<Constant>(Val))
1500 std::optional<ValueLatticeElement> LocalResult =
1501 getEdgeValueLocal(Val, BBFrom, BBTo,
true);
1503 return std::nullopt;
1509 std::optional<ValueLatticeElement> OptInBlock =
1512 return std::nullopt;
1523 intersectAssumeOrGuardBlockValueConstantRange(Val,
InBlock, CxtI);
1530 LLVM_DEBUG(
dbgs() <<
"LVI Getting block end value " << *V <<
" at '"
1533 assert(BlockValueStack.empty() && BlockValueSet.empty());
1534 std::optional<ValueLatticeElement> OptResult = getBlockValue(V, BB, CxtI);
1537 OptResult = getBlockValue(V, BB, CxtI);
1538 assert(OptResult &&
"Value not available after solving");
1550 if (
auto *
C = dyn_cast<Constant>(V))
1554 if (
auto *
I = dyn_cast<Instruction>(V))
1556 intersectAssumeOrGuardBlockValueConstantRange(V, Result, CxtI);
1565 LLVM_DEBUG(
dbgs() <<
"LVI Getting edge value " << *V <<
" from '"
1569 std::optional<ValueLatticeElement> Result =
1570 getEdgeValue(V, FromBB, ToBB, CxtI);
1576 Result = getEdgeValue(V, FromBB, ToBB, CxtI);
1585 auto *CxtI = cast<Instruction>(U.getUser());
1590 const Use *CurrU = &U;
1592 const unsigned MaxUsesToInspect = 3;
1593 for (
unsigned I = 0;
I < MaxUsesToInspect; ++
I) {
1594 std::optional<ValueLatticeElement> CondVal;
1595 auto *CurrI = cast<Instruction>(CurrU->getUser());
1596 if (
auto *SI = dyn_cast<SelectInst>(CurrI)) {
1601 if (CurrU->getOperandNo() == 1)
1603 *getValueFromCondition(V, SI->getCondition(),
true,
1605 else if (CurrU->getOperandNo() == 2)
1607 *getValueFromCondition(V, SI->getCondition(),
false,
1609 }
else if (
auto *
PHI = dyn_cast<PHINode>(CurrI)) {
1611 CondVal = *getEdgeValueLocal(V,
PHI->getIncomingBlock(*CurrU),
1612 PHI->getParent(),
false);
1635 TheCache.threadEdgeImpl(OldSucc, NewSucc);
1643 Info.AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(
F);
1645 if (
auto *Impl = Info.getImpl())
1663 assert(M &&
"getCache() called with a null Module");
1682 if (
auto *Impl = getImpl()) {
1715 V = V->stripPointerCasts();
1717 if (isa<AllocaInst>(V))
1731 if (Result.isConstant())
1732 return Result.getConstant();
1733 if (Result.isConstantRange()) {
1736 return ConstantInt::get(V->getType(), *SingleVal);
1742 bool UndefAllowed) {
1746 return Result.asConstantRange(V->getType(), UndefAllowed);
1750 bool UndefAllowed) {
1751 auto *Inst = cast<Instruction>(U.getUser());
1754 return Result.asConstantRange(U->getType(), UndefAllowed);
1766 if (Result.isConstant())
1767 return Result.getConstant();
1768 if (Result.isConstantRange()) {
1771 return ConstantInt::get(V->getType(), *SingleVal);
1784 return Result.asConstantRange(V->getType(),
true);
1842 bool UseBlockValue) {
1849 if (V->getType()->isPointerTy() &&
C->isNullValue() &&
1858 auto &Impl = getOrCreateImpl(M);
1860 UseBlockValue ? Impl.getValueInBlock(V, CxtI->
getParent(), CxtI)
1861 : Impl.getValueAt(V, CxtI);
1900 if (
auto *
PHI = dyn_cast<PHINode>(V))
1901 if (
PHI->getParent() == BB) {
1903 for (
unsigned i = 0, e =
PHI->getNumIncomingValues(); i < e; i++) {
1912 Baseline = (i == 0) ? Result
1913 : (Baseline == Result ? Baseline
1925 if (!isa<Instruction>(V) || cast<Instruction>(V)->getParent() != BB) {
1932 while (++PI != PE) {
1934 if (Ret != Baseline)
1949 bool UseBlockValue) {
1950 if (
auto *
C = dyn_cast<Constant>(
RHS))
1952 if (
auto *
C = dyn_cast<Constant>(
LHS))
1959 if (UseBlockValue) {
1963 if (L.isOverdefined())
1969 return L.getCompare(Pred, Ty, R, M->getDataLayout());
1976 if (
auto *Impl = getImpl())
1977 Impl->threadEdge(PredBB, OldSucc, NewSucc);
1981 if (
auto *Impl = getImpl())
1982 Impl->forgetValue(V);
1986 if (
auto *Impl = getImpl())
1987 Impl->eraseBlock(BB);
1991 if (
auto *Impl = getImpl())
1996 if (
auto *Impl = getImpl())
1997 Impl->printLVI(
F, DTree,
OS);
2001void LazyValueInfoAnnotatedWriter::emitBasicBlockStartAnnot(
2005 for (
const auto &Arg :
F->args()) {
2008 if (Result.isUnknown())
2010 OS <<
"; LatticeVal for: '" << Arg <<
"' is: " << Result <<
"\n";
2018void LazyValueInfoAnnotatedWriter::emitInstructionAnnot(
2021 auto *ParentBB =
I->getParent();
2028 auto printResult = [&](
const BasicBlock *BB) {
2029 if (!BlocksContainingLVI.
insert(BB).second)
2033 OS <<
"; LatticeVal for: '" << *
I <<
"' in BB: '";
2038 printResult(ParentBB);
2041 for (
const auto *BBSucc :
successors(ParentBB))
2042 if (DT.dominates(ParentBB, BBSucc))
2043 printResult(BBSucc);
2046 for (
const auto *U :
I->users())
2047 if (
auto *UseI = dyn_cast<Instruction>(U))
2048 if (!isa<PHINode>(UseI) || DT.dominates(ParentBB, UseI->getParent()))
2049 printResult(UseI->getParent());
2055 OS <<
"LVI for function '" <<
F.getName() <<
"':\n";
2058 LVI.printLVI(
F, DTree,
OS);
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
block Block Frequency Analysis
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static void clear(coro::Shape &Shape)
Given that RA is a live value
This file defines the DenseSet and SmallDenseSet classes.
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
static std::optional< ConstantRange > getRange(Value *V, const InstrInfoQuery &IIQ)
Helper method to get range from metadata or attribute.
static bool isOperationFoldable(User *Usr)
static void AddNonNullPointersByInstruction(Instruction *I, NonNullPointerSet &PtrSet)
static std::optional< ConstantRange > getRangeViaSLT(CmpInst::Predicate Pred, APInt RHS, function_ref< std::optional< ConstantRange >(const APInt &)> Fn)
static bool hasSingleValue(const ValueLatticeElement &Val)
Returns true if this lattice value represents at most one possible value.
static const unsigned MaxProcessedPerValue
static bool usesOperand(User *Usr, Value *Op)
static ValueLatticeElement constantFoldUser(User *Usr, Value *Op, const APInt &OpConstVal, const DataLayout &DL)
static void AddNonNullPointer(Value *Ptr, NonNullPointerSet &PtrSet)
static ValueLatticeElement getFromRangeMetadata(Instruction *BBI)
static ValueLatticeElement intersect(const ValueLatticeElement &A, const ValueLatticeElement &B)
Combine two sets of facts about the same value into a single set of facts.
static Constant * getPredicateResult(CmpInst::Predicate Pred, Constant *C, const ValueLatticeElement &Val, const DataLayout &DL)
static ValueLatticeElement getValueFromOverflowCondition(Value *Val, WithOverflowInst *WO, bool IsTrueDest)
static bool isKnownNonConstant(Value *V)
Returns true if we can statically tell that this value will never be a "useful" constant.
static bool matchICmpOperand(APInt &Offset, Value *LHS, Value *Val, ICmpInst::Predicate Pred)
Module.h This file contains the declarations for the Module class.
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
uint64_t IntrinsicInst * II
FunctionAnalysisManager FAM
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
const SmallVectorImpl< MachineOperand > & Cond
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool InBlock(const Value *V, const BasicBlock *BB)
Class for arbitrary precision integers.
APInt zext(unsigned width) const
Zero extend to a new width.
static APInt getSignedMinValue(unsigned numBits)
Gets minimum signed value of APInt for a specific bit width.
static APInt getZero(unsigned numBits)
Get the '0' value for the specified bit-width.
This templated class represents "all analyses that operate over <a particular IR unit>" (e....
API to communicate dependencies between analyses during invalidation.
A container for analyses that lazily runs them and caches their results.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
This class represents an incoming formal argument to a Function.
A function analysis which provides an AssumptionCache.
An immutable pass that tracks lazily created AssumptionCache objects.
A cache of @llvm.assume calls within a function.
void clear()
Clear the cache of @llvm.assume intrinsics for a function.
MutableArrayRef< ResultElem > assumptionsFor(const Value *V)
Access the list of assumptions which affect this value.
LLVM Basic Block Representation.
iterator begin()
Instruction iterator methods.
bool isEntryBlock() const
Return true if this is the entry block of the containing function.
const Function * getParent() const
Return the enclosing method, or null if none.
const DataLayout & getDataLayout() const
Get the data layout of the module this basic block belongs to.
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...
const Instruction & back() const
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
unsigned getNoWrapKind() const
Returns one of OBO::NoSignedWrap or OBO::NoUnsignedWrap.
Instruction::BinaryOps getBinaryOp() const
Returns the binary operation underlying the intrinsic.
BinaryOps getOpcode() const
Conditional or Unconditional Branch instruction.
Value handle with callbacks on RAUW and destruction.
This is the base class for all instructions that perform data casts.
Instruction::CastOps getOpcode() const
Return the opcode of this CastInst.
Type * getDestTy() const
Return the destination type, as a convenience.
static Type * makeCmpResultType(Type *opnd_type)
Create a result type for fcmp/icmp.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
@ ICMP_SLT
signed less than
@ ICMP_SLE
signed less or equal
@ ICMP_UGE
unsigned greater or equal
@ ICMP_UGT
unsigned greater than
@ ICMP_SGT
signed greater than
@ ICMP_ULT
unsigned less than
@ ICMP_SGE
signed greater or equal
@ ICMP_ULE
unsigned less or equal
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE,...
Predicate getPredicate() const
Return the predicate for this instruction.
This is the shared class of boolean and integer constants.
static ConstantInt * getTrue(LLVMContext &Context)
static ConstantInt * getFalse(LLVMContext &Context)
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
This class represents a range of values.
ConstantRange subtract(const APInt &CI) const
Subtract the specified constant from the endpoints of this constant range.
const APInt * getSingleElement() const
If this set contains a single element, return it, otherwise return null.
static ConstantRange fromKnownBits(const KnownBits &Known, bool IsSigned)
Initialize a range based on a known bits constraint.
ConstantRange castOp(Instruction::CastOps CastOp, uint32_t BitWidth) const
Return a new range representing the possible values resulting from an application of the specified ca...
ConstantRange umin(const ConstantRange &Other) const
Return a new range representing the possible values resulting from an unsigned minimum of a value in ...
APInt getUnsignedMin() const
Return the smallest unsigned value contained in the ConstantRange.
ConstantRange difference(const ConstantRange &CR) const
Subtract the specified range from this range (aka relative complement of the sets).
bool icmp(CmpInst::Predicate Pred, const ConstantRange &Other) const
Does the predicate Pred hold between ranges this and Other? NOTE: false does not mean that inverse pr...
static ConstantRange intrinsic(Intrinsic::ID IntrinsicID, ArrayRef< ConstantRange > Ops)
Compute range of intrinsic result for the given operand ranges.
bool isEmptySet() const
Return true if this set contains no members.
ConstantRange abs(bool IntMinIsPoison=false) const
Calculate absolute value range.
static bool isIntrinsicSupported(Intrinsic::ID IntrinsicID)
Returns true if ConstantRange calculations are supported for intrinsic with IntrinsicID.
ConstantRange overflowingBinaryOp(Instruction::BinaryOps BinOp, const ConstantRange &Other, unsigned NoWrapKind) const
Return a new range representing the possible values resulting from an application of the specified ov...
bool isSingleElement() const
Return true if this set contains exactly one member.
ConstantRange umax(const ConstantRange &Other) const
Return a new range representing the possible values resulting from an unsigned maximum of a value in ...
static ConstantRange makeAllowedICmpRegion(CmpInst::Predicate Pred, const ConstantRange &Other)
Produce the smallest range such that all values that may satisfy the given predicate with any value c...
ConstantRange unionWith(const ConstantRange &CR, PreferredRangeType Type=Smallest) const
Return the range that results from the union of this range with another range.
static ConstantRange makeExactICmpRegion(CmpInst::Predicate Pred, const APInt &Other)
Produce the exact range such that all values in the returned range satisfy the given predicate with a...
ConstantRange inverse() const
Return a new range that is the logical not of the current set.
static ConstantRange makeMaskNotEqualRange(const APInt &Mask, const APInt &C)
Initialize a range containing all values X that satisfy (X & Mask) != C.
static ConstantRange getNonEmpty(APInt Lower, APInt Upper)
Create non-empty constant range with the given bounds.
ConstantRange smin(const ConstantRange &Other) const
Return a new range representing the possible values resulting from a signed minimum of a value in thi...
uint32_t getBitWidth() const
Get the bit width of this ConstantRange.
ConstantRange smax(const ConstantRange &Other) const
Return a new range representing the possible values resulting from a signed maximum of a value in thi...
ConstantRange binaryOp(Instruction::BinaryOps BinOp, const ConstantRange &Other) const
Return a new range representing the possible values resulting from an application of the specified bi...
static ConstantRange makeExactNoWrapRegion(Instruction::BinaryOps BinOp, const APInt &Other, unsigned NoWrapKind)
Produce the range that contains X if and only if "X BinOp Other" does not wrap.
This is an important base class in LLVM.
static Constant * getIntegerValue(Type *Ty, const APInt &V)
Return the value for an integer or pointer constant, or a vector thereof, with the given scalar value...
bool isNullValue() const
Return true if this is the value that would be returned by getNullValue.
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
iterator find_as(const LookupKeyT &Val)
Alternate version of find() which allows a different, and possibly less expensive,...
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Implements a dense probed hash-table based set.
Analysis pass which computes a DominatorTree.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
FunctionPass class - This class is used to implement most global optimizations.
This instruction compares its operands according to the predicate given to the constructor.
static bool isEquality(Predicate P)
Return true if this predicate is either EQ or NE.
This instruction inserts a single (scalar) element into a VectorType value.
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
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 DataLayout & getDataLayout() const
Get the data layout of the module this instruction belongs to.
A wrapper class for inspecting calls to intrinsic functions.
Analysis to compute lazy value information.
Result run(Function &F, FunctionAnalysisManager &FAM)
ValueLatticeElement getValueOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB, Instruction *CxtI=nullptr)
This is the query interface to determine the lattice value for the specified Value* that is true on t...
ValueLatticeElement getValueAt(Value *V, Instruction *CxtI)
This is the query interface to determine the lattice value for the specified Value* at the specified ...
void threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc, BasicBlock *NewSucc)
This is the update interface to inform the cache that an edge from PredBB to OldSucc has been threade...
void printLVI(Function &F, DominatorTree &DTree, raw_ostream &OS)
Printing the LazyValueInfo Analysis.
void forgetValue(Value *V)
This is part of the update interface to remove information related to this value from the cache.
void eraseBlock(BasicBlock *BB)
This is part of the update interface to inform the cache that a block has been deleted.
void clear()
Complete flush all previously computed values.
LazyValueInfoImpl(AssumptionCache *AC, const DataLayout &DL, Function *GuardDecl)
ValueLatticeElement getValueInBlock(Value *V, BasicBlock *BB, Instruction *CxtI=nullptr)
This is the query interface to determine the lattice value for the specified Value* at the context in...
ValueLatticeElement getValueAtUse(const Use &U)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Wrapper around LazyValueInfo.
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
LazyValueInfoWrapperPass()
This pass computes, caches, and vends lazy value constraint information.
void eraseBlock(BasicBlock *BB)
Inform the analysis cache that we have erased a block.
ConstantRange getConstantRangeAtUse(const Use &U, bool UndefAllowed)
Return the ConstantRange constraint that is known to hold for the value at a specific use-site.
ConstantRange getConstantRange(Value *V, Instruction *CxtI, bool UndefAllowed)
Return the ConstantRange constraint that is known to hold for the specified value at the specified in...
void threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc, BasicBlock *NewSucc)
Inform the analysis cache that we have threaded an edge from PredBB to OldSucc to be from PredBB to N...
Constant * getPredicateOnEdge(CmpInst::Predicate Pred, Value *V, Constant *C, BasicBlock *FromBB, BasicBlock *ToBB, Instruction *CxtI=nullptr)
Determine whether the specified value comparison with a constant is known to be true or false on the ...
Constant * getConstantOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB, Instruction *CxtI=nullptr)
Determine whether the specified value is known to be a constant on the specified edge.
ConstantRange getConstantRangeOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB, Instruction *CxtI=nullptr)
Return the ConstantRage constraint that is known to hold for the specified value on the specified edg...
Constant * getConstant(Value *V, Instruction *CxtI)
Determine whether the specified value is known to be a constant at the specified instruction.
void printLVI(Function &F, DominatorTree &DTree, raw_ostream &OS)
Print the \LazyValueInfo Analysis.
void forgetValue(Value *V)
Remove information related to this value from the cache.
void clear()
Complete flush all previously computed values.
Constant * getPredicateAt(CmpInst::Predicate Pred, Value *V, Constant *C, Instruction *CxtI, bool UseBlockValue)
Determine whether the specified value comparison with a constant is known to be true or false at the ...
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
Handle invalidation events in the new pass manager.
An instruction for reading from memory.
This is the common base class for memset/memcpy/memmove.
This class wraps the llvm.memcpy/memmove intrinsics.
A Module instance is used to store all the information related to an LLVM module.
BasicBlock * getIncomingBlock(unsigned i) const
Return incoming basic block number i.
Value * getIncomingValue(unsigned i) const
Return incoming value number x.
unsigned getNumIncomingValues() const
Return the number of incoming edges.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
This class represents the LLVM 'select' instruction.
Implements a dense probed hash-table based set with some number of buckets stored inline.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
The instances of the Type class are immutable: once they are created, they are never changed.
unsigned getIntegerBitWidth() const
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
static IntegerType * getInt1Ty(LLVMContext &C)
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
bool isIntegerTy() const
True if this is an instance of IntegerType.
A Use represents the edge between a Value definition and its users.
Value * getOperand(unsigned i) const
This class represents lattice values for constants.
static ValueLatticeElement getRange(ConstantRange CR, bool MayIncludeUndef=false)
bool isOverdefined() const
static ValueLatticeElement getNot(Constant *C)
bool isNotConstant() const
std::optional< APInt > asConstantInteger() const
const ConstantRange & getConstantRange(bool UndefAllowed=true) const
Returns the constant range for this value.
bool isConstantRange(bool UndefAllowed=true) const
Returns true if this value is a constant range.
static ValueLatticeElement get(Constant *C)
Constant * getNotConstant() const
Constant * getConstant() const
bool mergeIn(const ValueLatticeElement &RHS, MergeOptions Opts=MergeOptions())
Updates this object to approximate both this object and RHS.
static ValueLatticeElement getOverdefined()
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
const Value * stripInBoundsOffsets(function_ref< void(const Value *)> Func=[](const Value *) {}) const
Strip off pointer casts and inbounds GEPs.
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
LLVMContext & getContext() const
All values hold a context through their type.
StringRef getName() const
Return a constant reference to the value's name.
Represents an op.with.overflow intrinsic.
std::pair< iterator, bool > insert(const ValueT &V)
iterator find_as(const LookupKeyT &Val)
Alternative version of find() which allows a different, and possibly less expensive,...
bool erase(const ValueT &V)
An efficient, type-erasing, non-owning reference to a callable.
const ParentTy * getParent() const
self_iterator getIterator()
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr 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.
@ C
The default llvm calling convention, compatible with C.
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
BinaryOp_match< LHS, RHS, Instruction::And > m_And(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::AShr > m_AShr(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::URem > m_URem(const LHS &L, const RHS &R)
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.
CastInst_match< OpTy, TruncInst > m_Trunc(const OpTy &Op)
Matches Trunc.
bool match(Val *V, const Pattern &P)
specificval_ty m_Specific(const Value *V)
Match if we have a specific specified value.
auto m_LogicalOr()
Matches L || R where L and R are arbitrary values.
match_combine_or< BinaryOp_match< LHS, RHS, Instruction::Add >, DisjointOr_match< LHS, RHS > > m_AddLike(const LHS &L, const RHS &R)
Match either "add" or "or disjoint".
apint_match m_APInt(const APInt *&Res)
Match a ConstantInt or splatted ConstantVector, binding the specified pointer to the contained APInt.
class_match< Value > m_Value()
Match an arbitrary value and ignore it.
auto m_LogicalAnd()
Matches L && R where L and R are arbitrary values.
BinaryOp_match< cst_pred_ty< is_all_ones >, ValTy, Instruction::Xor, true > m_Not(const ValTy &V)
Matches a 'Not' as 'xor V, -1' or 'xor -1, V'.
BinaryOp_match< LHS, RHS, Instruction::Or, true > m_c_Or(const LHS &L, const RHS &R)
Matches an Or with LHS and RHS in either order.
match_combine_or< LTy, RTy > m_CombineOr(const LTy &L, const RTy &R)
Combine two pattern matchers matching L || R.
This is an optimization pass for GlobalISel generic memory operations.
pred_iterator pred_end(BasicBlock *BB)
bool isValidAssumeForContext(const Instruction *I, const Instruction *CxtI, const DominatorTree *DT=nullptr, bool AllowEphemerals=false)
Return true if it is valid to use the assumptions provided by an assume intrinsic,...
auto successors(const MachineBasicBlock *BB)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
const Value * getUnderlyingObject(const Value *V, unsigned MaxLookup=6)
This method strips off any GEP address adjustments, pointer casts or llvm.threadlocal....
Constant * ConstantFoldCompareInstOperands(unsigned Predicate, Constant *LHS, Constant *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const Instruction *I=nullptr)
Attempt to constant fold a compare instruction (icmp/fcmp) with the specified operands.
bool isGuaranteedNotToBeUndef(const Value *V, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)
Returns true if V cannot be undef, but may be poison.
ConstantRange getConstantRangeFromMetadata(const MDNode &RangeMD)
Parse out a conservative ConstantRange from !range metadata.
Value * simplifyCastInst(unsigned CastOpc, Value *Op, Type *Ty, const SimplifyQuery &Q)
Given operands for a CastInst, fold the result or return null.
FunctionPass * createLazyValueInfoPass()
createLazyValueInfoPass - This creates an instance of the LazyValueInfo pass.
pred_iterator pred_begin(BasicBlock *BB)
constexpr unsigned MaxAnalysisRecursionDepth
@ SPF_ABS
Floating point maxnum.
@ SPF_NABS
Absolute value.
@ SPF_UMIN
Signed minimum.
@ SPF_UMAX
Signed maximum.
@ SPF_SMAX
Unsigned minimum.
SelectPatternResult matchSelectPattern(Value *V, Value *&LHS, Value *&RHS, Instruction::CastOps *CastOp=nullptr, unsigned Depth=0)
Pattern match integer [SU]MIN, [SU]MAX and ABS idioms, returning the kind and providing the out param...
bool NullPointerIsDefined(const Function *F, unsigned AS=0)
Check whether null pointer dereferencing is considered undefined behavior for a given function or an ...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isSafeToSpeculativelyExecute(const Instruction *I, const Instruction *CtxI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr, const TargetLibraryInfo *TLI=nullptr, bool UseVariableInfo=true)
Return true if the instruction does not have any effects besides calculating the result and does not ...
Value * simplifyExtractValueInst(Value *Agg, ArrayRef< unsigned > Idxs, const SimplifyQuery &Q)
Given operands for an ExtractValueInst, fold the result or return null.
bool isKnownNonZero(const Value *V, const SimplifyQuery &Q, unsigned Depth=0)
Return true if the given value is known to be non-zero when defined.
Value * simplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for a BinaryOperator, fold the result or return null.
DWARFExpression::Operation Op
constexpr unsigned BitWidth
auto predecessors(const MachineBasicBlock *BB)
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
void initializeLazyValueInfoWrapperPassPass(PassRegistry &)
A special type used by analysis passes to provide an address that identifies that particular analysis...
Incoming for lane maks phi as machine instruction, incoming register Reg and incoming block Block are...
SelectPatternFlavor Flavor
static bool isMinOrMax(SelectPatternFlavor SPF)
When implementing this min/max pattern as fcmp; select, does the fcmp have to be ordered?