LLVM  6.0.0svn
Macros | Functions | Variables
InductiveRangeCheckElimination.cpp File Reference
#include "llvm/ADT/Optional.h"
#include "llvm/Analysis/BranchProbabilityInfo.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/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/LoopSimplify.h"
#include "llvm/Transforms/Utils/LoopUtils.h"
Include dependency graph for InductiveRangeCheckElimination.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "irce"
 

Functions

 INITIALIZE_PASS_BEGIN (InductiveRangeCheckElimination, "irce", "Inductive range check elimination", false, false) INITIALIZE_PASS_END(InductiveRangeCheckElimination
 
static void DisableAllLoopOptsOnLoop (Loop &L)
 
static bool CanBeMax (ScalarEvolution &SE, const SCEV *S, bool Signed)
 
static bool SumCanReachMax (ScalarEvolution &SE, const SCEV *S1, const SCEV *S2, bool Signed)
 
static bool CanBeMin (ScalarEvolution &SE, const SCEV *S, bool Signed)
 
static bool SumCanReachMin (ScalarEvolution &SE, const SCEV *S1, const SCEV *S2, bool Signed)
 
static Optional< InductiveRangeCheck::Range > IntersectRange (ScalarEvolution &SE, const Optional< InductiveRangeCheck::Range > &R1, const InductiveRangeCheck::Range &R2)
 

Variables

static cl::opt< unsignedLoopSizeCutoff ("irce-loop-size-cutoff", cl::Hidden, cl::init(64))
 
static cl::opt< boolPrintChangedLoops ("irce-print-changed-loops", cl::Hidden, cl::init(false))
 
static cl::opt< boolPrintRangeChecks ("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< boolSkipProfitabilityChecks ("irce-skip-profitability-checks", cl::Hidden, cl::init(false))
 
static cl::opt< boolAllowUnsignedLatchCondition ("irce-allow-unsigned-latch", cl::Hidden, cl::init(false))
 
static const charClonedLoopTag = "irce.loop.clone"
 
 irce
 
Inductive range check elimination
 
Inductive range check false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "irce"

Definition at line 87 of file InductiveRangeCheckElimination.cpp.

Function Documentation

◆ CanBeMax()

static bool CanBeMax ( ScalarEvolution SE,
const SCEV S,
bool  Signed 
)
static

◆ CanBeMin()

static bool CanBeMin ( ScalarEvolution SE,
const SCEV S,
bool  Signed 
)
static

◆ DisableAllLoopOptsOnLoop()

static void DisableAllLoopOptsOnLoop ( Loop L)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( InductiveRangeCheckElimination  ,
"irce"  ,
"Inductive range check elimination ,
false  ,
false   
)

◆ IntersectRange()

static Optional<InductiveRangeCheck::Range> IntersectRange ( ScalarEvolution SE,
const Optional< InductiveRangeCheck::Range > &  R1,
const InductiveRangeCheck::Range &  R2 
)
static

◆ SumCanReachMax()

static bool SumCanReachMax ( ScalarEvolution SE,
const SCEV S1,
const SCEV S2,
bool  Signed 
)
static

◆ SumCanReachMin()

static bool SumCanReachMin ( ScalarEvolution SE,
const SCEV S1,
const SCEV S2,
bool  Signed 
)
static

Definition at line 692 of file InductiveRangeCheckElimination.cpp.

References llvm::LoopBase< BlockT, LoopT >::addBasicBlockToLoop(), llvm::LoopBase< BlockT, LoopT >::addChildLoop(), llvm::PHINode::addIncoming(), AllowUnsignedLatchCondition, assert(), B, llvm::sys::path::begin(), llvm::LoopBase< BlockT, LoopT >::blocks(), C, CanBeMax(), CanBeMin(), llvm::CloneBasicBlock(), ClonedLoopTag, llvm::LoopBase< BlockT, LoopT >::contains(), llvm::BasicBlock::Create(), llvm::PHINode::Create(), llvm::BranchInst::Create(), llvm::IRBuilder< T, Inserter >::CreateCondBr(), llvm::IRBuilder< T, Inserter >::CreateICmpSGT(), llvm::IRBuilder< T, Inserter >::CreateICmpSLT(), llvm::IRBuilder< T, Inserter >::CreateICmpUGT(), llvm::IRBuilder< T, Inserter >::CreateICmpULT(), llvm::IRBuilder< T, Inserter >::CreateNot(), D, llvm::dbgs(), DEBUG, DisableAllLoopOptsOnLoop(), llvm::dyn_cast(), llvm::sys::path::end(), llvm::WebAssembly::End, llvm::Instruction::eraseFromParent(), llvm::SCEVExpander::expandCodeFor(), F(), llvm::SCEV::FlagAnyWrap, llvm::SCEV::FlagNSW, llvm::formLCSSARecursively(), llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::MDNode::get(), llvm::ScalarEvolution::getAddExpr(), llvm::IntegerType::getBitWidth(), getBitWidth(), llvm::BranchInst::getCondition(), llvm::ScalarEvolution::getConstant(), llvm::Type::getContext(), llvm::Module::getDataLayout(), llvm::BranchProbabilityInfo::getEdgeProbability(), llvm::ScalarEvolution::getExitCount(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValueForBlock(), llvm::ScalarEvolution::getLoopDisposition(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::Instruction::getMetadata(), llvm::ScalarEvolution::getMinusSCEV(), llvm::APInt::getMinValue(), llvm::BasicBlock::getModule(), llvm::Value::getName(), llvm::ScalarEvolution::getNegativeSCEV(), llvm::PHINode::getNumIncomingValues(), llvm::getOffset(), llvm::ScalarEvolution::getOne(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::LoopBase< BlockT, LoopT >::getParentLoop(), llvm::CmpInst::getPredicate(), llvm::ScalarEvolution::getSCEV(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::ScalarEvolution::getSignExtendExpr(), llvm::ScalarEvolution::getSMaxExpr(), llvm::ScalarEvolution::getSMinExpr(), llvm::SCEVAddRecExpr::getStart(), llvm::SCEVAddRecExpr::getStepRecurrence(), llvm::BranchInst::getSuccessor(), llvm::CmpInst::getSwappedPredicate(), llvm::BasicBlock::getTerminator(), llvm::SCEV::getType(), llvm::SCEVNAryExpr::getType(), llvm::Value::getType(), llvm::ScalarEvolution::getUMaxExpr(), llvm::ScalarEvolution::getUMinExpr(), llvm::SCEVConstant::getValue(), llvm::Optional< T >::getValue(), llvm::Optional< T >::hasValue(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm::SCEVAddRecExpr::isAffine(), llvm::ScalarEvolution::isKnownNonNegative(), llvm::ScalarEvolution::isKnownNonPositive(), llvm::ScalarEvolution::isKnownPredicate(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), llvm::LoopBase< BlockT, LoopT >::isLoopExiting(), llvm::Loop::isLoopSimplifyForm(), llvm::ConstantInt::isMinusOne(), llvm::ConstantInt::isOne(), llvm::BranchInst::isUnconditional(), llvm::SCEV::isZero(), llvm::ConstantInt::isZero(), Kind, llvm::ScalarEvolution::LoopInvariant, llvm::AArch64CC::LS, llvm::makeArrayRef(), MaxExitProbReciprocal, llvm::None, llvm::RemapInstruction(), llvm::sys::fs::remove(), llvm::User::replaceUsesOfWith(), llvm::RF_IgnoreMissingLocals, llvm::RF_NoModuleLevelChanges, llvm::X86ISD::SBB, llvm::PHINode::setIncomingValue(), llvm::IRBuilderBase::SetInsertPoint(), llvm::Value::setName(), llvm::simplifyLoop(), SkipProfitabilityChecks, llvm::successors(), SumCanReachMax(), and std::swap().

Variable Documentation

◆ AllowUnsignedLatchCondition

cl::opt<bool> AllowUnsignedLatchCondition("irce-allow-unsigned-latch", cl::Hidden, cl::init(false))
static

Referenced by SumCanReachMin().

◆ ClonedLoopTag

const char* ClonedLoopTag = "irce.loop.clone"
static

Definition at line 85 of file InductiveRangeCheckElimination.cpp.

Referenced by SumCanReachMin().

◆ elimination

Inductive range check elimination

Definition at line 226 of file InductiveRangeCheckElimination.cpp.

◆ false

Inductive range check false

Definition at line 226 of file InductiveRangeCheckElimination.cpp.

◆ irce

irce

Definition at line 226 of file InductiveRangeCheckElimination.cpp.

◆ LoopSizeCutoff

cl::opt<unsigned> LoopSizeCutoff("irce-loop-size-cutoff", cl::Hidden, cl::init(64))
static

Referenced by IntersectRange().

◆ MaxExitProbReciprocal

cl::opt<int> MaxExitProbReciprocal("irce-max-exit-prob-reciprocal", cl::Hidden, cl::init(10))
static

Referenced by SumCanReachMin().

◆ PrintChangedLoops

cl::opt<bool> PrintChangedLoops("irce-print-changed-loops", cl::Hidden, cl::init(false))
static

Referenced by IntersectRange().

◆ PrintRangeChecks

cl::opt<bool> PrintRangeChecks("irce-print-range-checks", cl::Hidden, cl::init(false))
static

Referenced by IntersectRange().

◆ SkipProfitabilityChecks

cl::opt<bool> SkipProfitabilityChecks("irce-skip-profitability-checks", cl::Hidden, cl::init(false))
static

Referenced by SumCanReachMin().