|
LLVM
10.0.0
|
#include "llvm/Transforms/Scalar/IndVarSimplify.h"#include "llvm/ADT/APFloat.h"#include "llvm/ADT/APInt.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/DenseMap.h"#include "llvm/ADT/None.h"#include "llvm/ADT/Optional.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallPtrSet.h"#include "llvm/ADT/SmallSet.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/iterator_range.h"#include "llvm/Analysis/LoopInfo.h"#include "llvm/Analysis/LoopPass.h"#include "llvm/Analysis/ScalarEvolution.h"#include "llvm/Analysis/ScalarEvolutionExpander.h"#include "llvm/Analysis/ScalarEvolutionExpressions.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/Analysis/TargetTransformInfo.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/IR/BasicBlock.h"#include "llvm/IR/Constant.h"#include "llvm/IR/ConstantRange.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/DerivedTypes.h"#include "llvm/IR/Dominators.h"#include "llvm/IR/Function.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/InstrTypes.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/Module.h"#include "llvm/IR/Operator.h"#include "llvm/IR/PassManager.h"#include "llvm/IR/PatternMatch.h"#include "llvm/IR/Type.h"#include "llvm/IR/Use.h"#include "llvm/IR/User.h"#include "llvm/IR/Value.h"#include "llvm/IR/ValueHandle.h"#include "llvm/InitializePasses.h"#include "llvm/Pass.h"#include "llvm/Support/Casting.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Compiler.h"#include "llvm/Support/Debug.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/MathExtras.h"#include "llvm/Support/raw_ostream.h"#include "llvm/Transforms/Scalar.h"#include "llvm/Transforms/Scalar/LoopPassManager.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include "llvm/Transforms/Utils/Local.h"#include "llvm/Transforms/Utils/LoopUtils.h"#include "llvm/Transforms/Utils/SimplifyIndVar.h"#include <cassert>#include <cstdint>#include <utility>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "indvars" |
Enumerations | |
| enum | ReplaceExitVal { NeverRepl, OnlyCheapRepl, NoHardUse, AlwaysRepl } |
Functions | |
| STATISTIC (NumWidened, "Number of indvars widened") | |
| STATISTIC (NumReplaced, "Number of exit values replaced") | |
| STATISTIC (NumLFTR, "Number of loop exit tests replaced") | |
| STATISTIC (NumElimExt, "Number of IV sign/zero extends eliminated") | |
| STATISTIC (NumElimIV, "Number of congruent IVs eliminated") | |
| static Instruction * | getInsertPointForUses (Instruction *User, Value *Def, DominatorTree *DT, LoopInfo *LI) |
| Determine the insertion point for this user. More... | |
| static bool | ConvertToSInt (const APFloat &APF, int64_t &IntVal) |
| Convert APF to an integer, if possible. More... | |
| static void | visitIVCast (CastInst *Cast, WideIVInfo &WI, ScalarEvolution *SE, const TargetTransformInfo *TTI) |
| Update information about the induction variable that is extended by this sign or zero extend operation. More... | |
| static void | truncateIVUse (NarrowIVDefUse DU, DominatorTree *DT, LoopInfo *LI) |
| This IV user cannot be widened. More... | |
| static PHINode * | getLoopPhiForCounter (Value *IncV, Loop *L) |
| Given an Value which is hoped to be part of an add recurance in the given loop, return the associated Phi node if so. More... | |
| static bool | isLoopExitTestBasedOn (Value *V, BasicBlock *ExitingBB) |
| Whether the current loop exit test is based on this value. More... | |
| static bool | needsLFTR (Loop *L, BasicBlock *ExitingBB) |
| linearFunctionTestReplace policy. More... | |
| static bool | mustExecuteUBIfPoisonOnPathTo (Instruction *Root, Instruction *OnPathTo, DominatorTree *DT) |
| Return true if undefined behavior would provable be executed on the path to OnPathTo if Root produced a posion result. More... | |
| static bool | hasConcreteDefImpl (Value *V, SmallPtrSetImpl< Value *> &Visited, unsigned Depth) |
| Recursive helper for hasConcreteDef(). More... | |
| static bool | hasConcreteDef (Value *V) |
| Return true if the given value is concrete. More... | |
| static bool | AlmostDeadIV (PHINode *Phi, BasicBlock *LatchBlock, Value *Cond) |
| Return true if this IV has any uses other than the (soon to be rewritten) loop exit test. More... | |
| static bool | isLoopCounter (PHINode *Phi, Loop *L, ScalarEvolution *SE) |
| Return true if the given phi is a "counter" in L. More... | |
| static PHINode * | FindLoopCounter (Loop *L, BasicBlock *ExitingBB, const SCEV *BECount, ScalarEvolution *SE, DominatorTree *DT) |
| Search the loop header for a loop counter (anadd rec w/step of one) suitable for use by LFTR. More... | |
| static Value * | genLoopLimit (PHINode *IndVar, BasicBlock *ExitingBB, const SCEV *ExitCount, bool UsePostInc, Loop *L, SCEVExpander &Rewriter, ScalarEvolution *SE) |
| Insert an IR expression which computes the value held by the IV IndVar (which must be an loop counter w/unit stride) after the backedge of loop L is taken ExitCount times. More... | |
| static const SCEV * | getMaxBackedgeTakenCount (ScalarEvolution &SE, DominatorTree &DT, Loop *L) |
| Return a symbolic upper bound for the backedge taken count of the loop. More... | |
| INITIALIZE_PASS_BEGIN (IndVarSimplifyLegacyPass, "indvars", "Induction Variable Simplification", false, false) INITIALIZE_PASS_END(IndVarSimplifyLegacyPass | |
Variables | |
| static cl::opt< bool > | VerifyIndvars ("verify-indvars", cl::Hidden, cl::desc("Verify the ScalarEvolution result after running indvars")) |
| static cl::opt< ReplaceExitVal > | ReplaceExitValue ("replexitval", cl::Hidden, cl::init(OnlyCheapRepl), cl::desc("Choose the strategy to replace exit value in IndVarSimplify"), cl::values(clEnumValN(NeverRepl, "never", "never replace exit value"), clEnumValN(OnlyCheapRepl, "cheap", "only replace exit value when the cost is cheap"), clEnumValN(NoHardUse, "noharduse", "only replace exit values when loop def likely dead"), clEnumValN(AlwaysRepl, "always", "always replace exit value whenever possible"))) |
| static cl::opt< bool > | UsePostIncrementRanges ("indvars-post-increment-ranges", cl::Hidden, cl::desc("Use post increment control-dependent ranges in IndVarSimplify"), cl::init(true)) |
| static cl::opt< bool > | DisableLFTR ("disable-lftr", cl::Hidden, cl::init(false), cl::desc("Disable Linear Function Test Replace optimization")) |
| static cl::opt< bool > | LoopPredication ("indvars-predicate-loops", cl::Hidden, cl::init(true), cl::desc("Predicate conditions in read only loops")) |
| indvars | |
| Induction Variable | Simplification |
| Induction Variable | false |
| #define DEBUG_TYPE "indvars" |
Definition at line 91 of file IndVarSimplify.cpp.
Referenced by getMaxBackedgeTakenCount().
| enum ReplaceExitVal |
| Enumerator | |
|---|---|
| NeverRepl | |
| OnlyCheapRepl | |
| NoHardUse | |
| AlwaysRepl | |
Definition at line 106 of file IndVarSimplify.cpp.
|
static |
Return true if this IV has any uses other than the (soon to be rewritten) loop exit test.
Definition at line 2205 of file IndVarSimplify.cpp.
Convert APF to an integer, if possible.
Definition at line 288 of file IndVarSimplify.cpp.
References llvm::PHINode::addIncoming(), assert(), llvm::CmpInst::BAD_ICMP_PREDICATE, llvm::SCEVExpander::clearInsertPoint(), llvm::MCID::Compare, llvm::LoopBase< BlockT, LoopT >::contains(), llvm::APFloat::convertToInteger(), llvm::PHINode::Create(), CreateAdd(), llvm::dbgs(), llvm::dyn_cast(), llvm::numbers::e, E, llvm::SmallVectorImpl< T >::emplace_back(), llvm::SmallVectorBase::empty(), llvm::Instruction::eraseFromParent(), llvm::SCEVExpander::expandCodeFor(), llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::CmpInst::FCMP_UEQ, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::ConstantInt::get(), llvm::UndefValue::get(), llvm::Value::getContext(), llvm::BasicBlock::getFirstInsertionPt(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::Type::getInt32Ty(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::Value::getName(), llvm::PHINode::getNumIncomingValues(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::LoopBase< BlockT, LoopT >::getParentLoop(), llvm::CmpInst::getPredicate(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::LoopBase< BlockT, LoopT >::getUniqueExitBlocks(), llvm::ConstantFP::getValueAPF(), H, llvm::Value::hasOneUse(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::SmallPtrSetImpl< PtrType >::insert(), Int32Ty, llvm::BranchInst::isConditional(), llvm::SCEVExpander::isHighCostExpansion(), llvm::isInstructionTriviallyDead(), llvm::isInt< 32 >(), llvm::Loop::isLCSSAForm(), llvm::Loop::isRecursivelyLCSSAForm(), llvm::isSafeToExpand(), LLVM_DEBUG, llvm::makeMutableArrayRef(), llvm::Instruction::mayHaveSideEffects(), OnlyCheapRepl, llvm::APFloatBase::opOK, P, llvm::BasicBlock::phis(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::RecursivelyDeleteTriviallyDeadInstructions(), llvm::Value::replaceAllUsesWith(), Rewriter, llvm::APFloatBase::rmTowardZero, llvm::PHINode::setIncomingValue(), llvm::SmallVectorBase::size(), llvm::Value::takeName(), llvm::Value::use_empty(), llvm::Instruction::user_back(), llvm::Value::user_begin(), and llvm::Value::users().
|
static |
Search the loop header for a loop counter (anadd rec w/step of one) suitable for use by LFTR.
If multiple counters are available, select the "best" one based profitable heuristics.
BECount may be an i8* pointer type. The pointer difference is already valid count without scaling the address stride, so it remains a pointer expression as far as SCEV is concerned.
Definition at line 2248 of file IndVarSimplify.cpp.
References llvm::SCEV::getType(), and llvm::ScalarEvolution::getTypeSizeInBits().
Referenced by getMaxBackedgeTakenCount().
|
static |
Insert an IR expression which computes the value held by the IV IndVar (which must be an loop counter w/unit stride) after the backedge of loop L is taken ExitCount times.
Definition at line 2332 of file IndVarSimplify.cpp.
References assert(), llvm::LoopBase< BlockT, LoopT >::contains(), llvm::SCEVExpander::expandCodeFor(), llvm::ScalarEvolution::getAddExpr(), llvm::Value::getContext(), llvm::ScalarEvolution::getEffectiveSCEVType(), llvm::PHINode::getIncomingValueForBlock(), llvm::Type::getInt64Ty(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::ScalarEvolution::getOne(), llvm::ScalarEvolution::getSCEV(), llvm::ScalarEvolution::getSizeOfExpr(), llvm::SCEVAddRecExpr::getStart(), llvm::SCEVAddRecExpr::getStepRecurrence(), llvm::BasicBlock::getTerminator(), llvm::ScalarEvolution::getTruncateExpr(), llvm::ScalarEvolution::getTruncateOrZeroExtend(), llvm::SCEV::getType(), llvm::Value::getType(), llvm::ScalarEvolution::getTypeSizeInBits(), llvm::ScalarEvolution::getZeroExtendExpr(), llvm::SCEVNAryExpr::hasNoSignedWrap(), llvm::SCEVNAryExpr::hasNoUnsignedWrap(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::Type::isIntegerTy(), isLoopCounter(), isLoopExitTestBasedOn(), llvm::ScalarEvolution::isLoopInvariant(), llvm::SCEV::isOne(), llvm::Type::isPointerTy(), mustExecuteUBIfPoisonOnPathTo(), and P.
|
static |
Determine the insertion point for this user.
By default, insert immediately before the user. SCEVExpander or LICM will hoist loop invariants out of the loop. For PHI nodes, there may be multiple uses, so compute the nearest common dominator for the incoming blocks. A nullptr can be returned if no viable location is found: it may happen if User is a PHI and Def only comes to this PHI from unreachable blocks.
Definition at line 238 of file IndVarSimplify.cpp.
References assert(), llvm::tgtok::Def, llvm::DominatorTree::dominates(), llvm::dyn_cast(), llvm::numbers::e, llvm::DominatorTreeBase< NodeT, IsPostDom >::findNearestCommonDominator(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getParent(), llvm::BasicBlock::getTerminator(), llvm::DominatorTree::isReachableFromEntry(), and llvm_unreachable.
Referenced by truncateIVUse().
Given an Value which is hoped to be part of an add recurance in the given loop, return the associated Phi node if so.
Otherwise, return null. Note that this is less general than SCEVs AddRec checking.
Definition at line 2021 of file IndVarSimplify.cpp.
References llvm::MCID::Add, llvm::dyn_cast(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::User::getNumOperands(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::Loop::isLoopInvariant(), and LLVM_FALLTHROUGH.
Referenced by isLoopCounter().
|
static |
Return a symbolic upper bound for the backedge taken count of the loop.
This is more general than getConstantMaxBackedgeTakenCount as it returns an arbitrary expression as opposed to only constants. TODO: Move into the ScalarEvolution class.
Definition at line 2657 of file IndVarSimplify.cpp.
References llvm::all_of(), assert(), B, llvm::LoopBase< BlockT, LoopT >::blocks(), llvm::SCEVExpander::clear(), llvm::ScalarEvolution::ConstantMaximum, llvm::LoopBase< BlockT, LoopT >::contains(), DEBUG_TYPE, llvm::DeleteDeadPHIs(), llvm::SCEVExpander::disableCanonicalMode(), llvm::DominatorTree::dominates(), llvm::dyn_cast(), llvm::numbers::e, llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorImpl< T >::erase(), llvm::SCEVExpander::expandCodeFor(), FindLoopCounter(), llvm::ConstantInt::get(), llvm::BranchInst::getCondition(), llvm::ScalarEvolution::getCouldNotCompute(), llvm::ScalarEvolution::getExitCount(), llvm::LoopBase< BlockT, LoopT >::getExitingBlocks(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::SCEVAddRecExpr::getLoop(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::Value::getName(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::SCEV::getType(), llvm::Value::getType(), llvm::ScalarEvolution::getUMinFromMismatchedTypes(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_ULT, llvm::SmallSet< T, N, C >::insert(), llvm::SCEVExpander::isHighCostExpansion(), llvm::Type::isIntegerTy(), llvm::Loop::isLoopSimplifyForm(), llvm::Loop::isRecursivelyLCSSAForm(), llvm::isSafeToExpand(), llvm::SCEV::isZero(), llvm_unreachable, llvm::Instruction::mayHaveSideEffects(), llvm::Instruction::mayThrow(), needsLFTR(), NeverRepl, llvm::BasicBlock::phis(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::RecursivelyDeleteTriviallyDeadInstructions(), llvm::remove_if(), llvm::SCEVExpander::replaceCongruentIVs(), llvm::SmallVectorImpl< T >::resize(), Rewriter, llvm::BranchInst::setCondition(), llvm::SCEVExpander::setDebugType(), llvm::SCEVExpander::setInsertPoint(), llvm::SmallVectorBase::size(), llvm::sort(), llvm::succ_begin(), llvm::Value::use_empty(), and VerifyIndvars.
Return true if the given value is concrete.
We must prove that undef can never reach it.
TODO: If we decide that this is a good approach to checking for undef, we may factor it into a common location.
Definition at line 2197 of file IndVarSimplify.cpp.
References hasConcreteDefImpl(), and llvm::SmallPtrSetImpl< PtrType >::insert().
|
static |
Recursive helper for hasConcreteDef().
Unfortunately, this currently boils down to checking that all operands are constant and listing instructions that may hide undef.
Definition at line 2164 of file IndVarSimplify.cpp.
References llvm::dyn_cast(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::Instruction::mayReadFromMemory(), and llvm::User::operands().
Referenced by hasConcreteDef().
| INITIALIZE_PASS_BEGIN | ( | IndVarSimplifyLegacyPass | , |
| "indvars" | , | ||
| "Induction Variable Simplification" | , | ||
| false | , | ||
| false | |||
| ) |
Referenced by llvm::IndVarSimplifyPass::run().
|
static |
Return true if the given phi is a "counter" in L.
A counter is an add recurance (of integer or pointer type) with an arbitrary start, and a step of 1. Note that L must have exactly one latch.
Definition at line 2220 of file IndVarSimplify.cpp.
References assert(), llvm::dyn_cast(), llvm::PHINode::getBasicBlockIndex(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::PHINode::getIncomingValue(), llvm::SCEVAddRecExpr::getLoop(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), getLoopPhiForCounter(), llvm::Instruction::getParent(), llvm::ScalarEvolution::getSCEV(), llvm::SCEVAddRecExpr::getStepRecurrence(), llvm::Value::getType(), llvm::SCEVAddRecExpr::isAffine(), llvm::SCEV::isOne(), and llvm::ScalarEvolution::isSCEVable().
Referenced by genLoopLimit().
|
static |
Whether the current loop exit test is based on this value.
Currently this is limited to a direct use in the loop condition.
Definition at line 2059 of file IndVarSimplify.cpp.
References llvm::dyn_cast(), llvm::BranchInst::getCondition(), llvm::User::getOperand(), and llvm::BasicBlock::getTerminator().
Referenced by genLoopLimit().
|
static |
Return true if undefined behavior would provable be executed on the path to OnPathTo if Root produced a posion result.
Note that this doesn't say anything about whether OnPathTo is actually executed or whether Root is actually poison. This can be used to assess whether a new use of Root can be added at a location which is control equivalent with OnPathTo (such as immediately before it) without introducing UB which didn't previously exist. Note that a false result conveys no information.
Definition at line 2126 of file IndVarSimplify.cpp.
References llvm::DominatorTree::dominates(), llvm::SmallVectorBase::empty(), llvm::SmallSet< T, N, C >::insert(), llvm::mustTriggerUB(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::propagatesFullPoison(), llvm::SmallVectorTemplateBase< T >::push_back(), and llvm::Value::users().
Referenced by genLoopLimit().
|
static |
linearFunctionTestReplace policy.
Return true unless we can show that the current exit test is already sufficiently canonical.
Definition at line 2072 of file IndVarSimplify.cpp.
References assert(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::BasicBlock::getTerminator(), and llvm::Loop::isLoopInvariant().
Referenced by getMaxBackedgeTakenCount().
| STATISTIC | ( | NumWidened | , |
| "Number of indvars widened" | |||
| ) |
| STATISTIC | ( | NumReplaced | , |
| "Number of exit values replaced" | |||
| ) |
| STATISTIC | ( | NumLFTR | , |
| "Number of loop exit tests replaced" | |||
| ) |
| STATISTIC | ( | NumElimExt | , |
| "Number of IV sign/ | zero | ||
| ) |
| STATISTIC | ( | NumElimIV | , |
| "Number of congruent IVs eliminated" | |||
| ) |
|
static |
This IV user cannot be widened.
Replace this use of the original narrow IV with a truncation of the new wide IV to isolate and eliminate the narrow IV.
Definition at line 1345 of file IndVarSimplify.cpp.
References llvm::MCID::Add, llvm::PHINode::addIncoming(), assert(), llvm::SmallVectorTemplateCommon< T >::back(), llvm::BasicBlock::begin(), C, llvm::LoopBase< BlockT, LoopT >::contains(), llvm::BinaryOperator::Create(), llvm::PHINode::Create(), llvm::IRBuilder< T, Inserter >::CreateTrunc(), llvm::dbgs(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::SCEVExpander::expandCodeFor(), llvm::BasicBlock::front(), llvm::LoopBase< BlockT, LoopT >::getBlocks(), llvm::BasicBlock::getFirstInsertionPt(), llvm::LoopBase< BlockT, LoopT >::getHeader(), getInsertPointForUses(), llvm::CmpInst::getInversePredicate(), llvm::SCEVAddRecExpr::getLoop(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::Intrinsic::getName(), llvm::Value::getName(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::SCEVAddRecExpr::getStart(), llvm::SCEVAddRecExpr::getStepRecurrence(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::SCEV::getType(), llvm::Value::getType(), llvm::OverflowingBinaryOperator::hasNoSignedWrap(), llvm::OverflowingBinaryOperator::hasNoUnsignedWrap(), llvm::SCEVExpander::hoistIVInc(), I, llvm::CmpInst::ICMP_SGE, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::APInt::isNonNegative(), llvm::CmpInst::isSigned(), LLVM_DEBUG, llvm::SPII::Load, llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_ICmp(), llvm::PatternMatch::m_NSWAdd(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::make_range(), llvm::ConstantRange::makeAllowedICmpRegion(), llvm::PatternMatch::match(), llvm::OverflowingBinaryOperator::NoSignedWrap, P, llvm::SmallVectorTemplateBase< T >::pop_back(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::replaceAllDbgUsesWith(), llvm::Value::replaceAllUsesWith(), llvm::Instruction::setDebugLoc(), llvm::simplifyUsersOfIV(), llvm::Unknown, llvm::Value::users(), llvm::Value::uses(), and visitIVCast().
|
static |
Update information about the induction variable that is extended by this sign or zero extend operation.
This is used to determine the final width of the IV before actually widening it.
Definition at line 895 of file IndVarSimplify.cpp.
References llvm::MCID::Add, assert(), llvm::BinaryOperator::Create(), llvm::IRBuilder< T, Inserter >::CreateSExt(), llvm::IRBuilder< T, Inserter >::CreateZExt(), llvm::dbgs(), llvm::tgtok::Def, llvm::dyn_cast(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::TargetTransformInfo::getArithmeticInstrCost(), llvm::Module::getDataLayout(), llvm::ScalarEvolution::getEffectiveSCEVType(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::SCEVAddRecExpr::getLoop(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::Instruction::getModule(), llvm::Value::getName(), llvm::Instruction::getOpcode(), llvm::CastInst::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::LoopBase< BlockT, LoopT >::getParentLoop(), llvm::BasicBlock::getTerminator(), llvm::SCEV::getType(), llvm::Value::getType(), llvm::ScalarEvolution::getTypeSizeInBits(), llvm::OverflowingBinaryOperator::hasNoSignedWrap(), llvm::OverflowingBinaryOperator::hasNoUnsignedWrap(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::ConstantRange::intersectWith(), llvm::DataLayout::isLegalInteger(), llvm::Loop::isLoopInvariant(), LLVM_DEBUG, llvm_unreachable, llvm::None, llvm::IRBuilderBase::SetInsertPoint(), std::swap(), and llvm::Unknown.
Referenced by truncateIVUse().
|
static |
| Induction Variable false |
Definition at line 3212 of file IndVarSimplify.cpp.
| indvars |
Definition at line 3212 of file IndVarSimplify.cpp.
|
static |
Referenced by llvm::LoopPredicationPass::run().
|
static |
| Induction Variable Simplification |
Definition at line 3212 of file IndVarSimplify.cpp.
|
static |
|
static |
Referenced by getMaxBackedgeTakenCount().
1.8.13