|
LLVM
7.0.0
|
#include "llvm/Transforms/Scalar/InductiveRangeCheckElimination.h"#include "llvm/ADT/APInt.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/None.h"#include "llvm/ADT/Optional.h"#include "llvm/ADT/SmallPtrSet.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/StringRef.h"#include "llvm/ADT/Twine.h"#include "llvm/Analysis/BranchProbabilityInfo.h"#include "llvm/Analysis/LoopAnalysisManager.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/IR/BasicBlock.h"#include "llvm/IR/CFG.h"#include "llvm/IR/Constants.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/Instructions.h"#include "llvm/IR/Metadata.h"#include "llvm/IR/Module.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/Pass.h"#include "llvm/Support/BranchProbability.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/raw_ostream.h"#include "llvm/Transforms/Scalar.h"#include "llvm/Transforms/Utils/Cloning.h"#include "llvm/Transforms/Utils/LoopSimplify.h"#include "llvm/Transforms/Utils/LoopUtils.h"#include "llvm/Transforms/Utils/ValueMapper.h"#include <algorithm>#include <cassert>#include <iterator>#include <limits>#include <utility>#include <vector>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "irce" |
Functions | |
| INITIALIZE_PASS_BEGIN (IRCELegacyPass, "irce", "Inductive range check elimination", false, false) INITIALIZE_PASS_END(IRCELegacyPass | |
| static void | DisableAllLoopOptsOnLoop (Loop &L) |
| static bool | CannotBeMaxInLoop (const SCEV *BoundSCEV, Loop *L, ScalarEvolution &SE, bool Signed) |
| static bool | isSafeDecreasingBound (const SCEV *Start, const SCEV *BoundSCEV, const SCEV *Step, ICmpInst::Predicate Pred, unsigned LatchBrExitIdx, Loop *L, ScalarEvolution &SE) |
| Given a loop with an deccreasing induction variable, is it possible to safely calculate the bounds of a new loop using the given Predicate. More... | |
| static bool | isSafeIncreasingBound (const SCEV *Start, const SCEV *BoundSCEV, const SCEV *Step, ICmpInst::Predicate Pred, unsigned LatchBrExitIdx, Loop *L, ScalarEvolution &SE) |
| Given a loop with an increasing induction variable, is it possible to safely calculate the bounds of a new loop using the given Predicate. More... | |
| static bool | CannotBeMinInLoop (const SCEV *BoundSCEV, Loop *L, ScalarEvolution &SE, bool Signed) |
| static bool | isKnownNonNegativeInLoop (const SCEV *BoundSCEV, const Loop *L, ScalarEvolution &SE) |
| static bool | isKnownNegativeInLoop (const SCEV *BoundSCEV, const Loop *L, ScalarEvolution &SE) |
| static Optional< InductiveRangeCheck::Range > | IntersectSignedRange (ScalarEvolution &SE, const Optional< InductiveRangeCheck::Range > &R1, const InductiveRangeCheck::Range &R2) |
| static Optional< InductiveRangeCheck::Range > | IntersectUnsignedRange (ScalarEvolution &SE, const Optional< InductiveRangeCheck::Range > &R1, const InductiveRangeCheck::Range &R2) |
Variables | |
| static cl::opt< unsigned > | LoopSizeCutoff ("irce-loop-size-cutoff", cl::Hidden, cl::init(64)) |
| static cl::opt< bool > | PrintChangedLoops ("irce-print-changed-loops", cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | PrintRangeChecks ("irce-print-range-checks", cl::Hidden, cl::init(false)) |
| static cl::opt< int > | MaxExitProbReciprocal ("irce-max-exit-prob-reciprocal", cl::Hidden, cl::init(10)) |
| static cl::opt< bool > | SkipProfitabilityChecks ("irce-skip-profitability-checks", cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | AllowUnsignedLatchCondition ("irce-allow-unsigned-latch", cl::Hidden, cl::init(true)) |
| static const char * | ClonedLoopTag = "irce.loop.clone" |
| irce | |
| Inductive range check | elimination |
| Inductive range check | false |
| #define DEBUG_TYPE "irce" |
Definition at line 121 of file InductiveRangeCheckElimination.cpp.
|
static |
Definition at line 692 of file InductiveRangeCheckElimination.cpp.
References getBitWidth(), llvm::ScalarEvolution::getConstant(), llvm::APInt::getMaxValue(), llvm::APInt::getSignedMaxValue(), llvm::SCEV::getType(), llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_ULT, llvm::ScalarEvolution::isAvailableAtLoopEntry(), and llvm::ScalarEvolution::isLoopEntryGuardedByCond().
Referenced by isKnownNegativeInLoop().
|
static |
Definition at line 798 of file InductiveRangeCheckElimination.cpp.
References getBitWidth(), llvm::ScalarEvolution::getConstant(), llvm::APInt::getMinValue(), llvm::APInt::getSignedMinValue(), llvm::SCEV::getType(), llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_UGT, llvm::ScalarEvolution::isAvailableAtLoopEntry(), and llvm::ScalarEvolution::isLoopEntryGuardedByCond().
Referenced by isKnownNegativeInLoop().
|
static |
Definition at line 449 of file InductiveRangeCheckElimination.cpp.
References Context, llvm::NVPTXISD::Dummy, F(), llvm::ConstantInt::get(), llvm::ConstantAsMetadata::get(), llvm::MDString::get(), llvm::MDNode::get(), llvm::BasicBlock::getContext(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::PHINode::getIncomingBlock(), llvm::Type::getInt1Ty(), llvm::PHINode::getNumIncomingValues(), llvm::BasicBlock::getParent(), llvm::AArch64CC::LS, llvm::max(), llvm::MDNode::replaceOperandWith(), Result, llvm::PHINode::setIncomingBlock(), and llvm::Loop::setLoopID().
| INITIALIZE_PASS_BEGIN | ( | IRCELegacyPass | , |
| "irce" | , | ||
| "Inductive range check elimination" | , | ||
| false | , | ||
| false | |||
| ) |
|
static |
Definition at line 1775 of file InductiveRangeCheckElimination.cpp.
References assert(), llvm::ScalarEvolution::getSMaxExpr(), llvm::ScalarEvolution::getSMinExpr(), llvm::Optional< T >::getValue(), llvm::Optional< T >::hasValue(), llvm::None, and llvm::MipsISD::Ret.
Referenced by llvm::IRCEPass::run().
|
static |
Definition at line 1804 of file InductiveRangeCheckElimination.cpp.
References assert(), llvm::ScalarEvolution::getUMaxExpr(), llvm::ScalarEvolution::getUMinExpr(), llvm::Optional< T >::getValue(), llvm::Optional< T >::hasValue(), llvm::None, and llvm::MipsISD::Ret.
Referenced by llvm::IRCEPass::run().
|
static |
Definition at line 816 of file InductiveRangeCheckElimination.cpp.
References AllowUnsignedLatchCondition, assert(), B, CannotBeMaxInLoop(), CannotBeMinInLoop(), ClonedLoopTag, llvm::LoopBase< BlockT, LoopT >::contains(), llvm::dyn_cast(), llvm::SCEVExpander::expandCodeFor(), llvm::SCEV::FlagAnyWrap, llvm::SCEV::FlagNSW, llvm::SCEV::FlagNUW, llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::ScalarEvolution::getAddExpr(), llvm::IntegerType::getBitWidth(), llvm::BranchInst::getCondition(), llvm::Type::getContext(), llvm::Module::getDataLayout(), llvm::BranchProbabilityInfo::getEdgeProbability(), llvm::ScalarEvolution::getExitCount(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::ScalarEvolution::getLoopDisposition(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::Instruction::getMetadata(), llvm::ScalarEvolution::getMinusSCEV(), llvm::BasicBlock::getModule(), llvm::ScalarEvolution::getNegativeSCEV(), llvm::SCEVNAryExpr::getNoWrapFlags(), llvm::ScalarEvolution::getOne(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::CmpInst::getPredicate(), llvm::ScalarEvolution::getSCEV(), llvm::ScalarEvolution::getSignExtendExpr(), llvm::SCEVAddRecExpr::getStart(), llvm::SCEVAddRecExpr::getStepRecurrence(), llvm::BranchInst::getSuccessor(), llvm::CmpInst::getSwappedPredicate(), llvm::BasicBlock::getTerminator(), llvm::SCEV::getType(), llvm::Value::getType(), llvm::BranchProbability::getZero(), llvm::ScalarEvolution::getZero(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::SCEVAddRecExpr::isAffine(), llvm::ScalarEvolution::isAvailableAtLoopEntry(), llvm::ICmpInst::isEquality(), isKnownNonNegativeInLoop(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), llvm::LoopBase< BlockT, LoopT >::isLoopExiting(), llvm::Loop::isLoopSimplifyForm(), llvm::ConstantInt::isMinusOne(), llvm::ConstantInt::isNegative(), llvm::ConstantInt::isOne(), isSafeDecreasingBound(), isSafeIncreasingBound(), llvm::CmpInst::isSigned(), llvm::BranchInst::isUnconditional(), llvm::ConstantInt::isZero(), llvm::ScalarEvolution::LoopInvariant, MaxExitProbReciprocal, llvm::None, Result, llvm::Value::setName(), SkipProfitabilityChecks, and std::swap().
|
static |
Definition at line 809 of file InductiveRangeCheckElimination.cpp.
References llvm::SCEV::getType(), llvm::ScalarEvolution::getZero(), llvm::CmpInst::ICMP_SGE, llvm::ScalarEvolution::isAvailableAtLoopEntry(), and llvm::ScalarEvolution::isLoopEntryGuardedByCond().
Referenced by isKnownNegativeInLoop().
|
static |
Given a loop with an deccreasing induction variable, is it possible to safely calculate the bounds of a new loop using the given Predicate.
Definition at line 705 of file InductiveRangeCheckElimination.cpp.
Referenced by isKnownNegativeInLoop().
|
static |
Given a loop with an increasing induction variable, is it possible to safely calculate the bounds of a new loop using the given Predicate.
Definition at line 755 of file InductiveRangeCheckElimination.cpp.
Referenced by isKnownNegativeInLoop().
|
static |
Referenced by isKnownNegativeInLoop().
Definition at line 119 of file InductiveRangeCheckElimination.cpp.
Referenced by isKnownNegativeInLoop().
| Inductive range check elimination |
Definition at line 283 of file InductiveRangeCheckElimination.cpp.
| Inductive range check false |
Definition at line 283 of file InductiveRangeCheckElimination.cpp.
| irce |
Definition at line 283 of file InductiveRangeCheckElimination.cpp.
Referenced by llvm::IRCEPass::run().
|
static |
Referenced by isKnownNegativeInLoop().
Referenced by llvm::IRCEPass::run().
Referenced by llvm::IRCEPass::run().
|
static |
Referenced by isKnownNegativeInLoop().
1.8.13