Lines Matching +full:assert +full:- +full:falling +full:- +full:edge

1 //===- LazyValueInfo.cpp - Value constraint analysis ------------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
46 #define DEBUG_TYPE "lazy-value-info"
56 INITIALIZE_PASS_BEGIN(LazyValueInfoWrapperPass, "lazy-value-info",
60 INITIALIZE_PASS_END(LazyValueInfoWrapperPass, "lazy-value-info",
136 //===----------------------------------------------------------------------===//
138 //===----------------------------------------------------------------------===//
163 /// the per-value lattice elements, as well as a separate set for
184 return It->second.get(); in getBlockEntry()
192 return It->second.get(); in getOrCreateBlockEntry()
206 // Insert over-defined values into their own cache to reduce memory in insertResult()
209 Entry->OverDefined.insert(Val); in insertResult()
211 Entry->LatticeElements.insert({Val, Result}); in insertResult()
222 if (Entry->OverDefined.count(V)) in getCachedValueInfo()
225 auto LatticeIt = Entry->LatticeElements.find_as(V); in getCachedValueInfo()
226 if (LatticeIt == Entry->LatticeElements.end()) in getCachedValueInfo()
229 return LatticeIt->second; in getCachedValueInfo()
236 if (!Entry->NonNullPointers) { in isNonNullAtEndOfBlock()
237 Entry->NonNullPointers = InitFn(BB); in isNonNullAtEndOfBlock()
238 for (Value *V : *Entry->NonNullPointers) in isNonNullAtEndOfBlock()
242 return Entry->NonNullPointers->count(V); in isNonNullAtEndOfBlock()
245 /// clear - Empty the cache.
267 Pair.second->LatticeElements.erase(V); in eraseValue()
268 Pair.second->OverDefined.erase(V); in eraseValue()
269 if (Pair.second->NonNullPointers) in eraseValue()
270 Pair.second->NonNullPointers->erase(V); in eraseValue()
281 Parent->eraseValue(*this); in deleted()
290 // When an edge in the graph has been threaded, values that we could not in threadEdgeImpl()
304 if (!Entry || Entry->OverDefined.empty()) in threadEdgeImpl()
306 SmallVector<Value *, 4> ValsToClear(Entry->OverDefined.begin(), in threadEdgeImpl()
307 Entry->OverDefined.end()); in threadEdgeImpl()
309 // Use a worklist to perform a depth-first search of OldSucc's successors. in threadEdgeImpl()
322 if (OI == BlockCache.end() || OI->second->OverDefined.empty()) in threadEdgeImpl()
324 auto &ValueSet = OI->second->OverDefined; in threadEdgeImpl()
365 // splitting the code and then transitioning to a has-a relationship.
376 /// Keeps track of which block-value pairs are in BlockValueStack.
386 << BV.first->getName() << "\n"); in pushBlockValue()
477 /// value for the specified Value* that is true on the specified edge.
505 /// This is the update interface to inform the cache that an edge from
523 // Because of the design of the overdefined cache currently being per-block in solve()
524 // to avoid naming-related issues (IE it wants to try to give different in solve()
545 assert(BlockValueSet.count(e) && "Stack value should be in BlockValueSet!"); in solve()
551 assert(BlockValueStack.size() == StackSize && in solve()
556 assert(BBLV && "Result should be in cache!"); in solve()
558 dbgs() << "POP " << *e.second << " in " << e.first->getName() << " = " in solve()
566 assert(BlockValueStack.size() == StackSize + 1 && in solve()
594 switch (BBI->getOpcode()) { in getFromRangeMetadata()
599 if (std::optional<ConstantRange> Range = cast<CallBase>(BBI)->getRange()) in getFromRangeMetadata()
603 if (MDNode *Ranges = BBI->getMetadata(LLVMContext::MD_range)) in getFromRangeMetadata()
604 if (isa<IntegerType>(BBI->getType())) { in getFromRangeMetadata()
610 // Nothing known - will be intersected with other facts in getFromRangeMetadata()
615 assert(!isa<Constant>(Val) && "Value should not be constant"); in solveBlockValue()
616 assert(!TheCache.getCachedValueInfo(Val, BB) && in solveBlockValue()
633 if (!BBI || BBI->getParent() != BB) in solveBlockValueImpl()
645 // and the like to prove non-nullness, but it's not clear that's worth it in solveBlockValueImpl()
646 // compile time wise. The context-insensitive value walk done inside in solveBlockValueImpl()
651 PointerType *PT = dyn_cast<PointerType>(BBI->getType()); in solveBlockValueImpl()
655 if (BBI->getType()->isIntOrIntVectorTy()) { in solveBlockValueImpl()
672 LLVM_DEBUG(dbgs() << " compute BB '" << BB->getName() in solveBlockValueImpl()
673 << "' - unknown inst def found.\n"); in solveBlockValueImpl()
679 if (Ptr->getType()->getPointerAddressSpace() == 0) in AddNonNullPointer()
686 AddNonNullPointer(L->getPointerOperand(), PtrSet); in AddNonNullPointersByInstruction()
688 AddNonNullPointer(S->getPointerOperand(), PtrSet); in AddNonNullPointersByInstruction()
690 if (MI->isVolatile()) return; in AddNonNullPointersByInstruction()
693 ConstantInt *Len = dyn_cast<ConstantInt>(MI->getLength()); in AddNonNullPointersByInstruction()
694 if (!Len || Len->isZero()) return; in AddNonNullPointersByInstruction()
696 AddNonNullPointer(MI->getRawDest(), PtrSet); in AddNonNullPointersByInstruction()
698 AddNonNullPointer(MTI->getRawSource(), PtrSet); in AddNonNullPointersByInstruction()
703 if (NullPointerIsDefined(BB->getParent(), in isNonNullAtEndOfBlock()
704 Val->getType()->getPointerAddressSpace())) in isNonNullAtEndOfBlock()
707 Val = Val->stripInBoundsOffsets(); in isNonNullAtEndOfBlock()
721 if (BB->isEntryBlock()) { in solveBlockValueNonLocal()
722 assert(isa<Argument>(Val) && "Unknown live-in to the entry block"); in solveBlockValueNonLocal()
723 if (std::optional<ConstantRange> Range = cast<Argument>(Val)->getRange()) in solveBlockValueNonLocal()
748 LLVM_DEBUG(dbgs() << " compute BB '" << BB->getName() in solveBlockValueNonLocal()
749 << "' - overdefined because of pred '" in solveBlockValueNonLocal()
750 << Pred->getName() << "' (non local).\n"); in solveBlockValueNonLocal()
756 assert(!Result.isOverdefined()); in solveBlockValueNonLocal()
767 for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { in solveBlockValuePHINode()
768 BasicBlock *PhiBB = PN->getIncomingBlock(i); in solveBlockValuePHINode()
769 Value *PhiVal = PN->getIncomingValue(i); in solveBlockValuePHINode()
784 LLVM_DEBUG(dbgs() << " compute BB '" << BB->getName() in solveBlockValuePHINode()
785 << "' - overdefined because of pred (local).\n"); in solveBlockValuePHINode()
792 assert(!Result.isOverdefined() && "Possible PHI in entry block?"); in solveBlockValuePHINode()
804 BasicBlock *BB = BBI->getParent(); in intersectAssumeOrGuardBlockValueConstantRange()
805 for (auto &AssumeVH : AC->assumptionsFor(Val)) { in intersectAssumeOrGuardBlockValueConstantRange()
813 if (I->getParent() != BB || !isValidAssumeForContext(I, BBI)) in intersectAssumeOrGuardBlockValueConstantRange()
816 BBLV = intersect(BBLV, *getValueFromCondition(Val, I->getArgOperand(0), in intersectAssumeOrGuardBlockValueConstantRange()
822 if (GuardDecl && !GuardDecl->use_empty() && in intersectAssumeOrGuardBlockValueConstantRange()
823 BBI->getIterator() != BB->begin()) { in intersectAssumeOrGuardBlockValueConstantRange()
825 make_range(std::next(BBI->getIterator().getReverse()), BB->rend())) { in intersectAssumeOrGuardBlockValueConstantRange()
837 PointerType *PTy = dyn_cast<PointerType>(Val->getType()); in intersectAssumeOrGuardBlockValueConstantRange()
838 if (PTy && BB->getTerminator() == BBI && in intersectAssumeOrGuardBlockValueConstantRange()
848 getBlockValue(SI->getTrueValue(), BB, SI); in solveBlockValueSelect()
854 getBlockValue(SI->getFalseValue(), BB, SI); in solveBlockValueSelect()
860 const ConstantRange &TrueCR = TrueVal.asConstantRange(SI->getType()); in solveBlockValueSelect()
861 const ConstantRange &FalseCR = FalseVal.asConstantRange(SI->getType()); in solveBlockValueSelect()
868 ((LHS == SI->getTrueValue() && RHS == SI->getFalseValue()) || in solveBlockValueSelect()
869 (RHS == SI->getTrueValue() && LHS == SI->getFalseValue()))) { in solveBlockValueSelect()
890 if (LHS == SI->getTrueValue()) in solveBlockValueSelect()
893 if (LHS == SI->getFalseValue()) in solveBlockValueSelect()
900 if (LHS == SI->getTrueValue()) in solveBlockValueSelect()
903 if (LHS == SI->getFalseValue()) in solveBlockValueSelect()
912 Value *Cond = SI->getCondition(); in solveBlockValueSelect()
917 intersect(TrueVal, *getValueFromCondition(SI->getTrueValue(), Cond, in solveBlockValueSelect()
921 intersect(FalseVal, *getValueFromCondition(SI->getFalseValue(), Cond, in solveBlockValueSelect()
936 return OptVal->asConstantRange(V->getType()); in getRangeFor()
944 switch (CI->getOpcode()) { in solveBlockValueCast()
951 LLVM_DEBUG(dbgs() << " compute BB '" << BB->getName() in solveBlockValueCast()
952 << "' - overdefined (unknown cast).\n"); in solveBlockValueCast()
959 std::optional<ConstantRange> LHSRes = getRangeFor(CI->getOperand(0), CI, BB); in solveBlockValueCast()
965 const unsigned ResultBitWidth = CI->getType()->getScalarSizeInBits(); in solveBlockValueCast()
970 return ValueLatticeElement::getRange(LHSRange.castOp(CI->getOpcode(), in solveBlockValueCast()
983 std::optional<ConstantRange> LHSRes = getRangeFor(I->getOperand(0), I, BB); in solveBlockValueBinaryOpImpl()
987 std::optional<ConstantRange> RHSRes = getRangeFor(I->getOperand(1), I, BB); in solveBlockValueBinaryOpImpl()
998 assert(BO->getOperand(0)->getType()->isSized() && in solveBlockValueBinaryOp()
1001 unsigned NoWrapKind = OBO->getNoWrapKind(); in solveBlockValueBinaryOp()
1005 return CR1.overflowingBinaryOp(BO->getOpcode(), CR2, NoWrapKind); in solveBlockValueBinaryOp()
1011 return CR1.binaryOp(BO->getOpcode(), CR2); in solveBlockValueBinaryOp()
1020 return CR1.binaryOp(WO->getBinaryOp(), CR2); in solveBlockValueOverflowIntrinsic()
1027 if (!ConstantRange::isIntrinsicSupported(II->getIntrinsicID())) { in solveBlockValueIntrinsic()
1028 LLVM_DEBUG(dbgs() << " compute BB '" << BB->getName() in solveBlockValueIntrinsic()
1029 << "' - unknown intrinsic.\n"); in solveBlockValueIntrinsic()
1034 for (Value *Op : II->args()) { in solveBlockValueIntrinsic()
1042 II->getIntrinsicID(), OpRanges)), in solveBlockValueIntrinsic()
1050 getBlockValue(IEI->getOperand(1), BB, IEI); in solveBlockValueInsertElement()
1056 getBlockValue(IEI->getOperand(0), BB, IEI); in solveBlockValueInsertElement()
1067 if (auto *WO = dyn_cast<WithOverflowInst>(EVI->getAggregateOperand())) in solveBlockValueExtractValue()
1068 if (EVI->getNumIndices() == 1 && *EVI->idx_begin() == 0) in solveBlockValueExtractValue()
1074 EVI->getAggregateOperand(), EVI->getIndices(), in solveBlockValueExtractValue()
1075 EVI->getDataLayout())) in solveBlockValueExtractValue()
1078 LLVM_DEBUG(dbgs() << " compute BB '" << BB->getName() in solveBlockValueExtractValue()
1079 << "' - overdefined (unknown extractvalue).\n"); in solveBlockValueExtractValue()
1099 Offset = -*C; in matchICmpOperand()
1123 ConstantRange RHSRange(RHS->getType()->getScalarSizeInBits(), in getValueFromSimpleICmpCondition()
1126 RHSRange = ConstantRange(CI->getValue()); in getValueFromSimpleICmpCondition()
1129 getBlockValue(RHS, CxtI->getParent(), CxtI); in getValueFromSimpleICmpCondition()
1132 RHSRange = R->asConstantRange(RHS->getType()); in getValueFromSimpleICmpCondition()
1154 assert(Pred == ICmpInst::ICMP_SLT && "Must be signed predicate"); in getRangeViaSLT()
1156 return Invert ? CR->inverse() : CR; in getRangeViaSLT()
1162 Value *LHS = ICI->getOperand(0); in getValueFromICmpCondition()
1163 Value *RHS = ICI->getOperand(1); in getValueFromICmpCondition()
1165 // Get the predicate that must hold along the considered edge. in getValueFromICmpCondition()
1167 isTrueDest ? ICI->getPredicate() : ICI->getInversePredicate(); in getValueFromICmpCondition()
1170 if (ICI->isEquality() && LHS == Val) { in getValueFromICmpCondition()
1178 Type *Ty = Val->getType(); in getValueFromICmpCondition()
1179 if (!Ty->isIntegerTy()) in getValueFromICmpCondition()
1182 unsigned BitWidth = Ty->getScalarSizeInBits(); in getValueFromICmpCondition()
1225 // icmp slt (ashr X, ShAmtC), C --> icmp slt X, C << ShAmtC in getValueFromICmpCondition()
1232 EdgePred, *C, [&](const APInt &RHS) -> std::optional<ConstantRange> { in getValueFromICmpCondition()
1252 // the edge value calculation. in getValueFromOverflowCondition()
1254 if (WO->getLHS() != Val || !match(WO->getRHS(), m_APInt(C))) in getValueFromOverflowCondition()
1259 WO->getBinaryOp(), *C, WO->getNoWrapKind()); in getValueFromOverflowCondition()
1276 if (auto *WO = dyn_cast<WithOverflowInst>(EVI->getAggregateOperand())) in getValueFromCondition()
1277 if (EVI->getNumIndices() == 1 && *EVI->idx_begin() == 1) in getValueFromCondition()
1305 // if (L && R) -> intersect L and R in getValueFromCondition()
1306 // if (!(L || R)) -> intersect !L and !R in getValueFromCondition()
1307 // if (L || R) -> union L and R in getValueFromCondition()
1308 // if (!(L && R)) -> union !L and !R in getValueFromCondition()
1310 LV->mergeIn(*RV); in getValueFromCondition()
1319 return is_contained(Usr->operands(), Op); in usesOperand()
1337 assert(isOperationFoldable(Usr) && "Precondition"); in constantFoldUser()
1338 Constant* OpConst = Constant::getIntegerValue(Op->getType(), OpConstVal); in constantFoldUser()
1341 assert(CI->getOperand(0) == Op && "Operand 0 isn't Op"); in constantFoldUser()
1343 simplifyCastInst(CI->getOpcode(), OpConst, in constantFoldUser()
1344 CI->getDestTy(), DL))) { in constantFoldUser()
1345 return ValueLatticeElement::getRange(ConstantRange(C->getValue())); in constantFoldUser()
1348 bool Op0Match = BO->getOperand(0) == Op; in constantFoldUser()
1349 bool Op1Match = BO->getOperand(1) == Op; in constantFoldUser()
1350 assert((Op0Match || Op1Match) && in constantFoldUser()
1352 Value *LHS = Op0Match ? OpConst : BO->getOperand(0); in constantFoldUser()
1353 Value *RHS = Op1Match ? OpConst : BO->getOperand(1); in constantFoldUser()
1355 simplifyBinOp(BO->getOpcode(), LHS, RHS, DL))) { in constantFoldUser()
1356 return ValueLatticeElement::getRange(ConstantRange(C->getValue())); in constantFoldUser()
1359 assert(cast<FreezeInst>(Usr)->getOperand(0) == Op && "Operand 0 isn't Op"); in constantFoldUser()
1365 /// Compute the value of Val on the edge BBFrom -> BBTo.
1371 if (BranchInst *BI = dyn_cast<BranchInst>(BBFrom->getTerminator())) { in getEdgeValueLocal()
1374 if (BI->isConditional() && in getEdgeValueLocal()
1375 BI->getSuccessor(0) != BI->getSuccessor(1)) { in getEdgeValueLocal()
1376 bool isTrueDest = BI->getSuccessor(0) == BBTo; in getEdgeValueLocal()
1377 assert(BI->getSuccessor(!isTrueDest) == BBTo && in getEdgeValueLocal()
1379 Value *Condition = BI->getCondition(); in getEdgeValueLocal()
1386 Type::getInt1Ty(Val->getContext()), isTrueDest)); in getEdgeValueLocal()
1395 if (!Result->isOverdefined()) in getEdgeValueLocal()
1399 assert(Result->isOverdefined() && "Result isn't overdefined"); in getEdgeValueLocal()
1403 if (isa<IntegerType>(Usr->getType()) && isOperationFoldable(Usr)) { in getEdgeValueLocal()
1404 const DataLayout &DL = BBTo->getDataLayout(); in getEdgeValueLocal()
1410 // ; %Val is true on the edge to %then. in getEdgeValueLocal()
1419 // ; %Val is 94 on the edge to %then. in getEdgeValueLocal()
1423 for (unsigned i = 0; i < Usr->getNumOperands(); ++i) { in getEdgeValueLocal()
1424 Value *Op = Usr->getOperand(i); in getEdgeValueLocal()
1436 if (!Result->isOverdefined()) in getEdgeValueLocal()
1441 // If the edge was formed by a switch on the value, then we may know exactly in getEdgeValueLocal()
1443 if (SwitchInst *SI = dyn_cast<SwitchInst>(BBFrom->getTerminator())) { in getEdgeValueLocal()
1444 Value *Condition = SI->getCondition(); in getEdgeValueLocal()
1445 if (!isa<IntegerType>(Val->getType())) in getEdgeValueLocal()
1456 assert((Condition == Val || ValUsesConditionAndMayBeFoldable) && in getEdgeValueLocal()
1459 bool DefaultCase = SI->getDefaultDest() == BBTo; in getEdgeValueLocal()
1460 unsigned BitWidth = Val->getType()->getIntegerBitWidth(); in getEdgeValueLocal()
1463 for (auto Case : SI->cases()) { in getEdgeValueLocal()
1464 APInt CaseValue = Case.getCaseValue()->getValue(); in getEdgeValueLocal()
1468 const DataLayout &DL = BBTo->getDataLayout(); in getEdgeValueLocal()
1492 /// Compute the value of Val on the edge BBFrom -> BBTo or the value at
1493 /// the basic block if the edge does not constrain Val.
1511 getBlockValue(Val, BBFrom, BBFrom->getTerminator()); in getEdgeValue()
1532 << BB->getName() << "'\n"); in getValueInBlock()
1534 assert(BlockValueStack.empty() && BlockValueSet.empty()); in getValueInBlock()
1539 assert(OptResult && "Value not available after solving"); in getValueInBlock()
1548 LLVM_DEBUG(dbgs() << "LVI Getting value " << *V << " at '" << CxtI->getName() in getValueAt()
1566 LLVM_DEBUG(dbgs() << "LVI Getting edge value " << *V << " from '" in getValueOnEdge()
1567 << FromBB->getName() << "' to '" << ToBB->getName() in getValueOnEdge()
1573 // As the worklist only explicitly tracks block values (but not edge values) in getValueOnEdge()
1574 // we may have to call solve() multiple times, as the edge value calculation in getValueOnEdge()
1587 ValueLatticeElement VL = getValueInBlock(V, CxtI->getParent(), CxtI); in getValueAtUse()
1596 auto *CurrI = cast<Instruction>(CurrU->getUser()); in getValueAtUse()
1600 if (!isGuaranteedNotToBeUndef(SI->getCondition(), AC)) in getValueAtUse()
1602 if (CurrU->getOperandNo() == 1) in getValueAtUse()
1604 *getValueFromCondition(V, SI->getCondition(), /*IsTrueDest*/ true, in getValueAtUse()
1606 else if (CurrU->getOperandNo() == 2) in getValueAtUse()
1608 *getValueFromCondition(V, SI->getCondition(), /*IsTrueDest*/ false, in getValueAtUse()
1611 // TODO: Use non-local query? in getValueAtUse()
1612 CondVal = *getEdgeValueLocal(V, PHI->getIncomingBlock(*CurrU), in getValueAtUse()
1613 PHI->getParent(), /*UseBlockValue*/ false); in getValueAtUse()
1618 // Only follow one-use chain, to allow direct intersection of conditions. in getValueAtUse()
1621 // Stop walking if we hit a non-speculatable instruction. Even if the in getValueAtUse()
1627 if (!CurrI->hasOneUse() || !isSafeToSpeculativelyExecute(CurrI)) in getValueAtUse()
1629 CurrU = &*CurrI->use_begin(); in getValueAtUse()
1639 //===----------------------------------------------------------------------===//
1641 //===----------------------------------------------------------------------===//
1647 Impl->clear(); in runOnFunction()
1664 assert(M && "getCache() called with a null Module"); in getOrCreateImpl()
1665 const DataLayout &DL = M->getDataLayout(); in getOrCreateImpl()
1667 M->getFunction(Intrinsic::getName(Intrinsic::experimental_guard)); in getOrCreateImpl()
1716 V = V->stripPointerCasts(); in isKnownNonConstant()
1728 BasicBlock *BB = CxtI->getParent(); in getConstant()
1730 getOrCreateImpl(BB->getModule()).getValueInBlock(V, BB, CxtI); in getConstant()
1737 return ConstantInt::get(V->getType(), *SingleVal); in getConstant()
1744 BasicBlock *BB = CxtI->getParent(); in getConstantRange()
1746 getOrCreateImpl(BB->getModule()).getValueInBlock(V, BB, CxtI); in getConstantRange()
1747 return Result.asConstantRange(V->getType(), UndefAllowed); in getConstantRange()
1754 getOrCreateImpl(Inst->getModule()).getValueAtUse(U); in getConstantRangeAtUse()
1755 return Result.asConstantRange(U->getType(), UndefAllowed); in getConstantRangeAtUse()
1759 /// constant on the specified edge. Return null if not.
1763 Module *M = FromBB->getModule(); in getConstantOnEdge()
1772 return ConstantInt::get(V->getType(), *SingleVal); in getConstantOnEdge()
1781 Module *M = FromBB->getModule(); in getConstantRangeOnEdge()
1785 return Result.asConstantRange(V->getType(), /*UndefAllowed*/ true); in getConstantRangeOnEdge()
1795 Type *ResTy = CmpInst::makeCmpResultType(C->getType()); in getPredicateResult()
1798 ConstantRange RHS = C->toConstantRange(); in getPredicateResult()
1810 // !C1 == C -> false iff C1 == C. in getPredicateResult()
1813 if (Res && Res->isNullValue()) in getPredicateResult()
1816 // !C1 != C -> true iff C1 == C. in getPredicateResult()
1819 if (Res && Res->isNullValue()) in getPredicateResult()
1829 /// be true or false on the specified CFG edge. Pred is a CmpInst predicate.
1834 Module *M = FromBB->getModule(); in getPredicateOnEdge()
1838 return getPredicateResult(Pred, C, Result, M->getDataLayout()); in getPredicateOnEdge()
1846 // return it quickly. But this is only a fastpath, and falling in getPredicateAt()
1848 Module *M = CxtI->getModule(); in getPredicateAt()
1849 const DataLayout &DL = M->getDataLayout(); in getPredicateAt()
1850 if (V->getType()->isPointerTy() && C->isNullValue() && in getPredicateAt()
1851 isKnownNonZero(V->stripPointerCastsSameRepresentation(), DL)) { in getPredicateAt()
1852 Type *ResTy = CmpInst::makeCmpResultType(C->getType()); in getPredicateAt()
1861 UseBlockValue ? Impl.getValueInBlock(V, CxtI->getParent(), CxtI) in getPredicateAt()
1871 // predicate back along each incoming edge to see if we can prove it in getPredicateAt()
1887 // CFG and/or value graph, but there are non-obvious compile time vs quality in getPredicateAt()
1889 BasicBlock *BB = CxtI->getParent(); in getPredicateAt()
1899 // each edge. This is useful for eliminating cases where the predicate is in getPredicateAt()
1902 if (PHI->getParent() == BB) { in getPredicateAt()
1904 for (unsigned i = 0, e = PHI->getNumIncomingValues(); i < e; i++) { in getPredicateAt()
1905 Value *Incoming = PHI->getIncomingValue(i); in getPredicateAt()
1906 BasicBlock *PredBB = PHI->getIncomingBlock(i); in getPredicateAt()
1926 if (!isa<Instruction>(V) || cast<Instruction>(V)->getParent() != BB) { in getPredicateAt()
1927 // For predecessor edge, determine if the comparison is true or false in getPredicateAt()
1928 // on that edge. If they're all true or all false, we can conclude in getPredicateAt()
1957 // Got two non-Constant values. Try to determine the comparison results based in getPredicateAt()
1959 // non-overlapping ranges. in getPredicateAt()
1961 Module *M = CxtI->getModule(); in getPredicateAt()
1963 getOrCreateImpl(M).getValueInBlock(LHS, CxtI->getParent(), CxtI); in getPredicateAt()
1968 getOrCreateImpl(M).getValueInBlock(RHS, CxtI->getParent(), CxtI); in getPredicateAt()
1969 Type *Ty = CmpInst::makeCmpResultType(LHS->getType()); in getPredicateAt()
1970 return L.getCompare(Pred, Ty, R, M->getDataLayout()); in getPredicateAt()
1978 Impl->threadEdge(PredBB, OldSucc, NewSucc); in threadEdge()
1983 Impl->forgetValue(V); in forgetValue()
1988 Impl->eraseBlock(BB); in eraseBlock()
1993 Impl->clear(); in clear()
1998 Impl->printLVI(F, DTree, OS); in printLVI()
2005 auto *F = BB->getParent(); in emitBasicBlockStartAnnot()
2006 for (const auto &Arg : F->args()) { in emitBasicBlockStartAnnot()
2007 ValueLatticeElement Result = LVIImpl->getValueInBlock( in emitBasicBlockStartAnnot()
2022 auto *ParentBB = I->getParent(); in emitInstructionAnnot()
2032 ValueLatticeElement Result = LVIImpl->getValueInBlock( in emitInstructionAnnot()
2035 BB->printAsOperand(OS, false); in emitInstructionAnnot()
2047 for (const auto *U : I->users()) in emitInstructionAnnot()
2049 if (!isa<PHINode>(UseI) || DT.dominates(ParentBB, UseI->getParent())) in emitInstructionAnnot()
2050 printResult(UseI->getParent()); in emitInstructionAnnot()