203 #define DEBUG_TYPE "loop-predication" 205 STATISTIC(TotalConsidered,
"Number of guards considered");
206 STATISTIC(TotalWidened,
"Number of checks widened");
208 using namespace llvm;
226 cl::desc(
"scale factor for the latch probability. Value should be greater " 227 "than 1. Lower values are ignored"));
230 "loop-predication-predicate-widenable-branches-to-deopt",
cl::Hidden,
231 cl::desc(
"Whether or not we should predicate guards " 232 "expressed as widenable branches to deoptimize blocks"),
244 : Pred(Pred), IV(IV), Limit(Limit) {}
247 dbgs() <<
"LoopICmp Pred = " << Pred <<
", IV = " << *IV
248 <<
", Limit = " << *Limit <<
"\n";
264 bool isSupportedStep(
const SCEV* Step);
282 bool isLoopInvariantValue(
const SCEV* S);
306 bool isLoopProfitableToPredicate();
314 : AA(AA), DT(DT), SE(SE), LI(LI), BPI(BPI) {};
315 bool runOnLoop(
Loop *L);
318 class LoopPredicationLegacyPass :
public LoopPass {
321 LoopPredicationLegacyPass() :
LoopPass(ID) {
333 auto *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
334 auto *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
335 auto *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
337 getAnalysis<BranchProbabilityInfoWrapperPass>().getBPI();
338 auto *AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
340 return LP.runOnLoop(L);
348 "Loop predication",
false,
false)
355 return new LoopPredicationLegacyPass();
363 Function *
F = L.getHeader()->getParent();
366 if (!LP.runOnLoop(&L))
373 LoopPredication::parseLoopICmp(
ICmpInst *ICI) {
378 const SCEV *LHSS = SE->getSCEV(LHS);
379 if (isa<SCEVCouldNotCompute>(LHSS))
381 const SCEV *RHSS = SE->getSCEV(RHS);
382 if (isa<SCEVCouldNotCompute>(RHSS))
386 if (SE->isLoopInvariant(LHSS, L)) {
396 return LoopICmp(Pred, AR, RHSS);
404 assert(Ty == RHS->
getType() &&
"expandCheck operands have different types?");
406 if (SE->isLoopInvariant(LHS, L) && SE->isLoopInvariant(RHS, L)) {
408 if (SE->isLoopEntryGuardedByCond(L, Pred, LHS, RHS))
417 IRBuilder<> Builder(findInsertPt(Guard, {LHSV, RHSV}));
437 const LoopICmp LatchCheck,
438 Type *RangeCheckType) {
443 "Expected latch check IV type to be larger than range check operand " 449 if (!Limit || !Start)
463 return Start->getAPInt().getActiveBits() < RangeCheckTypeBitSize &&
464 Limit->getAPInt().getActiveBits() < RangeCheckTypeBitSize;
472 const LoopICmp LatchCheck,
473 Type *RangeCheckType) {
475 auto *LatchType = LatchCheck.IV->getType();
476 if (RangeCheckType == LatchType)
485 LoopICmp NewLatchCheck;
486 NewLatchCheck.Pred = LatchCheck.Pred;
489 if (!NewLatchCheck.IV)
491 NewLatchCheck.Limit = SE.
getTruncateExpr(LatchCheck.Limit, RangeCheckType);
493 <<
"can be represented as range check type:" 494 << *RangeCheckType <<
"\n");
495 LLVM_DEBUG(
dbgs() <<
"LatchCheck.IV: " << *NewLatchCheck.IV <<
"\n");
496 LLVM_DEBUG(
dbgs() <<
"LatchCheck.Limit: " << *NewLatchCheck.Limit <<
"\n");
497 return NewLatchCheck;
500 bool LoopPredication::isSupportedStep(
const SCEV* Step) {
509 return Preheader->getTerminator();
517 for (
const SCEV *
Op : Ops)
518 if (!SE->isLoopInvariant(
Op, L) ||
521 return Preheader->getTerminator();
524 bool LoopPredication::isLoopInvariantValue(
const SCEV* S) {
544 if (SE->isLoopInvariant(S, L))
552 if (
const SCEVUnknown *U = dyn_cast<SCEVUnknown>(S))
553 if (
const auto *LI = dyn_cast<LoadInst>(U->getValue()))
555 if (AA->pointsToConstantMemory(LI->getOperand(0)) ||
556 LI->hasMetadata(LLVMContext::MD_invariant_load))
562 LoopICmp LatchCheck, LoopICmp RangeCheck,
564 auto *Ty = RangeCheck.IV->getType();
571 const SCEV *GuardStart = RangeCheck.IV->getStart();
572 const SCEV *GuardLimit = RangeCheck.Limit;
573 const SCEV *LatchStart = LatchCheck.IV->getStart();
574 const SCEV *LatchLimit = LatchCheck.Limit;
578 if (!isLoopInvariantValue(GuardStart) ||
579 !isLoopInvariantValue(GuardLimit) ||
580 !isLoopInvariantValue(LatchStart) ||
581 !isLoopInvariantValue(LatchLimit)) {
593 SE->getAddExpr(SE->getMinusSCEV(GuardLimit, GuardStart),
594 SE->getMinusSCEV(LatchStart, SE->getOne(Ty)));
595 auto LimitCheckPred =
603 expandCheck(Expander, Guard, LimitCheckPred, LatchLimit, RHS);
604 auto *FirstIterationCheck = expandCheck(Expander, Guard, RangeCheck.Pred,
605 GuardStart, GuardLimit);
606 IRBuilder<> Builder(findInsertPt(Guard, {FirstIterationCheck, LimitCheck}));
607 return Builder.
CreateAnd(FirstIterationCheck, LimitCheck);
611 LoopICmp LatchCheck, LoopICmp RangeCheck,
613 auto *Ty = RangeCheck.IV->getType();
614 const SCEV *GuardStart = RangeCheck.IV->getStart();
615 const SCEV *GuardLimit = RangeCheck.Limit;
616 const SCEV *LatchStart = LatchCheck.IV->getStart();
617 const SCEV *LatchLimit = LatchCheck.Limit;
621 if (!isLoopInvariantValue(GuardStart) ||
622 !isLoopInvariantValue(GuardLimit) ||
623 !isLoopInvariantValue(LatchStart) ||
624 !isLoopInvariantValue(LatchLimit)) {
635 auto *PostDecLatchCheckIV = LatchCheck.IV->getPostIncExpr(*SE);
636 if (RangeCheck.IV != PostDecLatchCheckIV) {
638 << *PostDecLatchCheckIV
639 <<
" and RangeCheckIV: " << *RangeCheck.IV <<
"\n");
647 auto LimitCheckPred =
649 auto *FirstIterationCheck = expandCheck(Expander, Guard,
651 GuardStart, GuardLimit);
652 auto *LimitCheck = expandCheck(Expander, Guard, LimitCheckPred, LatchLimit,
654 IRBuilder<> Builder(findInsertPt(Guard, {FirstIterationCheck, LimitCheck}));
655 return Builder.CreateAnd(FirstIterationCheck, LimitCheck);
663 RC.IV->getStepRecurrence(*SE)->isOne() &&
683 auto RangeCheck = parseLoopICmp(ICI);
685 LLVM_DEBUG(
dbgs() <<
"Failed to parse the loop latch condition!\n");
692 << RangeCheck->Pred <<
")!\n");
695 auto *RangeCheckIV = RangeCheck->IV;
696 if (!RangeCheckIV->isAffine()) {
700 auto *Step = RangeCheckIV->getStepRecurrence(*SE);
703 if (!isSupportedStep(Step)) {
704 LLVM_DEBUG(
dbgs() <<
"Range check and latch have IVs different steps!\n");
707 auto *Ty = RangeCheckIV->getType();
709 if (!CurrLatchCheckOpt) {
711 "corresponding to range type: " 716 LoopICmp CurrLatchCheck = *CurrLatchCheckOpt;
720 CurrLatchCheck.IV->getStepRecurrence(*SE)->getType() &&
721 "Range and latch steps should be of same type!");
722 if (Step != CurrLatchCheck.IV->getStepRecurrence(*SE)) {
723 LLVM_DEBUG(
dbgs() <<
"Range and latch have different step values!\n");
728 return widenICmpRangeCheckIncrementingLoop(CurrLatchCheck, *RangeCheck,
732 return widenICmpRangeCheckDecrementingLoop(CurrLatchCheck, *RangeCheck,
741 unsigned NumWidened = 0;
749 Value *WideableCond =
nullptr;
752 if (!Visited.
insert(Condition).second)
764 m_Intrinsic<Intrinsic::experimental_widenable_condition>())) {
766 WideableCond = Condition;
770 if (
ICmpInst *ICI = dyn_cast<ICmpInst>(Condition)) {
771 if (
auto NewRangeCheck = widenICmpRangeCheck(ICI, Expander,
773 Checks.
push_back(NewRangeCheck.getValue());
781 }
while (!Worklist.
empty());
791 bool LoopPredication::widenGuardConditions(
IntrinsicInst *Guard,
798 unsigned NumWidened = collectChecks(Checks, Guard->
getOperand(0), Expander,
803 TotalWidened += NumWidened;
816 bool LoopPredication::widenWidenableBranchGuardConditions(
824 unsigned NumWidened = collectChecks(Checks, BI->
getCondition(),
829 TotalWidened += NumWidened;
838 "Stopped being a guard after transform?");
861 "One of the latch's destinations must be the header");
868 auto Result = parseLoopICmp(ICI);
870 LLVM_DEBUG(
dbgs() <<
"Failed to parse the loop latch condition!\n");
879 if (!Result->IV->isAffine()) {
884 auto *Step = Result->IV->getStepRecurrence(*SE);
885 if (!isSupportedStep(Step)) {
886 LLVM_DEBUG(
dbgs() <<
"Unsupported loop stride(" << *Step <<
")!\n");
902 if (IsUnsupportedPredicate(Step, Result->Pred)) {
903 LLVM_DEBUG(
dbgs() <<
"Unsupported loop latch predicate(" << Result->Pred
912 bool LoopPredication::isLoopProfitableToPredicate() {
920 if (ExitEdges.
size() == 1)
929 assert(LatchBlock &&
"Should have a single latch at this point!");
930 auto *LatchTerm = LatchBlock->getTerminator();
931 assert(LatchTerm->getNumSuccessors() == 2 &&
932 "expected to be an exiting block with 2 succs!");
933 unsigned LatchBrExitIdx =
934 LatchTerm->getSuccessor(0) == L->
getHeader() ? 1 : 0;
936 BPI->getEdgeProbability(LatchBlock, LatchBrExitIdx);
941 if (ScaleFactor < 1) {
944 <<
"Ignored user setting for loop-predication-latch-probability-scale: " 949 const auto LatchProbabilityThreshold =
950 LatchExitProbability * ScaleFactor;
952 for (
const auto &ExitEdge : ExitEdges) {
954 BPI->getEdgeProbability(ExitEdge.first, ExitEdge.second);
957 if (ExitingBlockProbability > LatchProbabilityThreshold)
994 return cast<BranchInst>(Term);
1009 for (
BasicBlock *ExitingBB : ExitingBlocks) {
1011 if (isa<SCEVCouldNotCompute>(ExitCount))
1014 "We should only have known counts for exiting blocks that " 1018 if (ExitCounts.
size() < 2)
1062 if (ExitingBlocks.
empty())
1073 const SCEV *LatchEC = SE->getExitCount(L, Latch);
1074 if (isa<SCEVCouldNotCompute>(LatchEC))
1084 bool Invalidate =
false;
1086 for (
auto *ExitingBB : ExitingBlocks) {
1087 if (LI->getLoopFor(ExitingBB) != L)
1114 !SE->isLoopInvariant(MinEC, L) ||
1122 auto *IP = cast<Instruction>(WidenableBR->getCondition());
1123 IP->moveBefore(WidenableBR);
1127 bool Changed =
false;
1128 Value *MinECV =
nullptr;
1129 for (
BasicBlock *ExitingBB : ExitingBlocks) {
1133 if (LI->getLoopFor(ExitingBB) != L)
1145 const SCEV *ExitCount = SE->getExitCount(L, ExitingBB);
1146 if (isa<SCEVCouldNotCompute>(ExitCount) ||
1164 Value *RHS = MinECV;
1170 assert(!Latch || DT->dominates(ExitingBB, Latch));
1193 bool LoopPredication::runOnLoop(
Loop *
Loop) {
1204 bool HasIntrinsicGuards = GuardDecl && !GuardDecl->
use_empty();
1205 auto *WCDecl = M->getFunction(
1207 bool HasWidenableConditions =
1209 if (!HasIntrinsicGuards && !HasWidenableConditions)
1212 DL = &M->getDataLayout();
1218 auto LatchCheckOpt = parseLoopLatchICmp();
1221 LatchCheck = *LatchCheckOpt;
1226 if (!isLoopProfitableToPredicate()) {
1234 for (
const auto BB : L->
blocks()) {
1241 cast<BranchInst>(BB->getTerminator()));
1245 bool Changed =
false;
1246 for (
auto *Guard : Guards)
1247 Changed |= widenGuardConditions(Guard, Expander);
1248 for (
auto *Guard : GuardsAsWidenableBranches)
1249 Changed |= widenWidenableBranchGuardConditions(Guard, Expander);
1250 Changed |= predicateLoopExits(L, Expander);
Pass interface - Implemented by all 'passes'.
BinaryOp_match< LHS, RHS, Instruction::And > m_And(const LHS &L, const RHS &R)
A parsed version of the target data layout string in and methods for querying it. ...
class_match< Value > m_Value()
Match an arbitrary value and ignore it.
Value * CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="")
BlockT * getLoopLatch() const
If there is a single latch block for this loop, return it.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
PreservedAnalyses getLoopPassPreservedAnalyses()
Returns the minimum set of Analyses that all loop passes must preserve.
STATISTIC(TotalConsidered, "Number of guards considered")
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
bool isSafeToExpandAt(const SCEV *S, const Instruction *InsertionPoint, ScalarEvolution &SE)
Return true if the given expression is safe to expand in the sense that all materialized values are d...
void push_back(const T &Elt)
The main scalar evolution driver.
Value * CreateFreeze(Value *V, const Twine &Name="")
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
BasicBlock * getSuccessor(unsigned i) const
bool isMonotonicPredicate(const SCEVAddRecExpr *LHS, ICmpInst::Predicate Pred, bool &Increasing)
Return true if, for all loop invariant X, the predicate "LHS `Pred` X" is monotonically increasing or...
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
Value * getCondition() const
TypeSize getTypeSizeInBits(Type *Ty) const
Size examples:
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...
LLVMContext & getContext() const
Get the context in which this basic block lives.
bool hasLoopInvariantOperands(const Instruction *I) const
Return true if all the operands of the specified instruction are loop invariant.
INITIALIZE_PASS_BEGIN(LoopPredicationLegacyPass, "loop-predication", "Loop predication", false, false) INITIALIZE_PASS_END(LoopPredicationLegacyPass
void dump() const
Support for debugging, callable in GDB: V->dump()
bool match(Val *V, const Pattern &P)
AnalysisUsage & addRequired()
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
#define INITIALIZE_PASS_DEPENDENCY(depName)
const CallInst * getTerminatingDeoptimizeCall() const
Returns the call instruction calling @llvm.experimental.deoptimize prior to the terminating return in...
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
const Loop * getLoop() const
A Use represents the edge between a Value definition and its users.
static cl::opt< float > LatchExitProbabilityScale("loop-predication-latch-probability-scale", cl::Hidden, cl::init(2.0), cl::desc("scale factor for the latch probability. Value should be greater " "than 1. Lower values are ignored"))
BlockT * getHeader() const
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
Analysis pass which computes BranchProbabilityInfo.
bool isKnownPredicate(ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS)
Test if the given expression is known to satisfy the condition described by Pred, LHS...
static const SCEV * getMinAnalyzeableBackedgeTakenCount(ScalarEvolution &SE, DominatorTree &DT, Loop *L)
Return the minimum of all analyzeable exit counts.
Type * getType() const
All values are typed, get the type of this value.
This node represents a polynomial recurrence on the trip count of the specified loop.
const BasicBlock * getSingleSuccessor() const
Return the successor of this block if it has a single successor.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
const SCEV * getExitCount(const Loop *L, BasicBlock *ExitingBlock, ExitCountKind Kind=Exact)
Return the number of times the backedge executes before the given exit would be taken; if not exactly...
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Legacy analysis pass which computes BranchProbabilityInfo.
Value * getOperand(unsigned i) const
static cl::opt< bool > EnableIVTruncation("loop-predication-enable-iv-truncation", cl::Hidden, cl::init(true))
const SCEV * getCouldNotCompute()
This means that we are dealing with an entirely unknown SCEV value, and only represent it as its LLVM...
initializer< Ty > init(const Ty &Val)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
A set of analyses that are preserved following a run of a transformation pass.
const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
void setInsertPoint(Instruction *IP)
Set the current insertion point.
ConstantInt * getTrue()
Get the constant value for i1 true.
Conditional or Unconditional Branch instruction.
bool isPointerTy() const
True if this is an instance of PointerType.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Represent the analysis usage information of a pass.
bool parseWidenableBranch(const User *U, Value *&Condition, Value *&WidenableCondition, BasicBlock *&IfTrueBB, BasicBlock *&IfFalseBB)
If U is widenable branch looking like: cond = ...
Pass * createLoopPredicationPass()
This instruction compares its operands according to the predicate given to the constructor.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Value * expandCodeFor(const SCEV *SH, Type *Ty, Instruction *I)
Insert code to directly compute the specified SCEV expression into the program.
bool RecursivelyDeleteTriviallyDeadInstructions(Value *V, const TargetLibraryInfo *TLI=nullptr, MemorySSAUpdater *MSSAU=nullptr)
If the specified value is a trivially dead instruction, delete it.
void getExitingBlocks(SmallVectorImpl< BlockT *> &ExitingBlocks) const
Return all blocks inside the loop that have successors outside of the loop.
const SCEV * getUMinFromMismatchedTypes(const SCEV *LHS, const SCEV *RHS)
Promote the operands to the wider of the types using zero-extension, and then perform a umin operatio...
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
static void normalizePredicate(ScalarEvolution *SE, Loop *L, LoopICmp &RC)
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
bool isLoopInvariant(const Value *V) const
Return true if the specified value is loop invariant.
void getExitEdges(SmallVectorImpl< Edge > &ExitEdges) const
Return all pairs of (inside_block,outside_block).
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
static BranchInst * FindWidenableTerminatorAboveLoop(Loop *L, LoopInfo &LI)
If we can (cheaply) find a widenable branch which controls entry into the loop, return it...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
bool isAllOnesValue() const
Return true if the expression is a constant all-ones value.
Type * getType() const
Return the LLVM type of this SCEV expression.
An analysis over an "inner" IR unit that provides access to an analysis manager over a "outer" IR uni...
static cl::opt< bool > LoopPredication("indvars-predicate-loops", cl::Hidden, cl::init(true), cl::desc("Predicate conditions in read only loops"))
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool dominates(const Instruction *Def, const Use &U) const
Return true if Def dominates a use in User.
Module.h This file contains the declarations for the Module class.
LLVM_NODISCARD T pop_back_val()
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.
bool isConditional() const
static ConstantInt * getTrue(LLVMContext &Context)
Predicate getFlippedStrictnessPredicate() const
For predicate of kind "is X or equal to 0" returns the predicate "is X".
bool isGuard(const User *U)
Returns true iff U has semantics of a guard expressed in a form of call of llvm.experimental.guard intrinsic.
void setOperand(unsigned i, Value *Val)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static cl::opt< bool > EnableCountDownLoop("loop-predication-enable-count-down-loop", cl::Hidden, cl::init(true))
This class uses information about analyze scalars to rewrite expressions in canonical form...
void widenWidenableBranch(BranchInst *WidenableBR, Value *NewCond)
Given a branch we know is widenable (defined per Analysis/GuardUtils.h), widen it such that condition...
static cl::opt< bool > PredicateWidenableBranchGuards("loop-predication-predicate-widenable-branches-to-deopt", cl::Hidden, cl::desc("Whether or not we should predicate guards " "expressed as widenable branches to deoptimize blocks"), cl::init(true))
ConstantInt * getFalse()
Get the constant value for i1 false.
static Optional< LoopICmp > generateLoopLatchCheck(const DataLayout &DL, ScalarEvolution &SE, const LoopICmp LatchCheck, Type *RangeCheckType)
Virtual Register Rewriter
Predicate getPredicate() const
Return the predicate for this instruction.
Analysis providing branch probability information.
This class represents an analyzed expression in the program.
LLVM_NODISCARD bool empty() const
unsigned greater or equal
Represents a single loop in the control flow graph.
bool isEquality() const
Return true if this predicate is either EQ or NE.
void getLoopAnalysisUsage(AnalysisUsage &AU)
Helper to consistently add the set of standard passes to a loop pass's AnalysisUsage.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static cl::opt< bool > SkipProfitabilityChecks("loop-predication-skip-profitability-checks", cl::Hidden, cl::init(false))
Value * CreateAnd(Value *LHS, Value *RHS, const Twine &Name="")
void setCondition(Value *V)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void initializeLoopPredicationLegacyPassPass(PassRegistry &)
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR, LPMUpdater &U)
bool isOne() const
Return true if the expression is a constant one.
LLVM Value Representation.
const SCEV * getTruncateExpr(const SCEV *Op, Type *Ty, unsigned Depth=0)
bool isGuardAsWidenableBranch(const User *U)
Returns true iff U has semantics of a guard expressed in a form of a widenable conditional branch to ...
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
A container for analyses that lazily runs them and caches their results.
static bool isSafeToTruncateWideIVType(const DataLayout &DL, ScalarEvolution &SE, const LoopICmp LatchCheck, Type *RangeCheckType)
iterator_range< block_iterator > blocks() const
static bool isVeryLikelyToDeopt(BasicBlock *BB)
Return true if we can be fairly sure that executing block BB will probably lead to executing an __llv...
A wrapper class for inspecting calls to intrinsic functions.
This class represents a constant integer value.
const BasicBlock * getUniqueSuccessor() const
Return the successor of this block if it has a unique successor.