LLVM  9.0.0svn
Macros | Functions | Variables
LoopPredication.cpp File Reference
#include "llvm/Transforms/Scalar/LoopPredication.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/GuardUtils.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/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/LoopUtils.h"
Include dependency graph for LoopPredication.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "loop-predication"
 

Functions

 STATISTIC (TotalConsidered, "Number of guards considered")
 
 STATISTIC (TotalWidened, "Number of checks widened")
 
 INITIALIZE_PASS_BEGIN (LoopPredicationLegacyPass, "loop-predication", "Loop predication", false, false) INITIALIZE_PASS_END(LoopPredicationLegacyPass
 
static bool isSafeToTruncateWideIVType (const DataLayout &DL, ScalarEvolution &SE, const LoopICmp LatchCheck, Type *RangeCheckType)
 
static Optional< LoopICmp > generateLoopLatchCheck (const DataLayout &DL, ScalarEvolution &SE, const LoopICmp LatchCheck, Type *RangeCheckType)
 
static void normalizePredicate (ScalarEvolution *SE, Loop *L, LoopICmp &RC)
 

Variables

static cl::opt< boolEnableIVTruncation ("loop-predication-enable-iv-truncation", cl::Hidden, cl::init(true))
 
static cl::opt< boolEnableCountDownLoop ("loop-predication-enable-count-down-loop", cl::Hidden, cl::init(true))
 
static cl::opt< boolSkipProfitabilityChecks ("loop-predication-skip-profitability-checks", cl::Hidden, cl::init(false))
 
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"))
 
static cl::opt< boolPredicateWidenableBranchGuards ("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))
 
loop predication
 
loop Loop false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "loop-predication"

Definition at line 200 of file LoopPredication.cpp.

Function Documentation

◆ generateLoopLatchCheck()

static Optional<LoopICmp> generateLoopLatchCheck ( const DataLayout DL,
ScalarEvolution SE,
const LoopICmp  LatchCheck,
Type RangeCheckType 
)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( LoopPredicationLegacyPass  ,
"loop-predication ,
"Loop predication ,
false  ,
false   
)

◆ isSafeToTruncateWideIVType()

static bool isSafeToTruncateWideIVType ( const DataLayout DL,
ScalarEvolution SE,
const LoopICmp  LatchCheck,
Type RangeCheckType 
)
static

◆ normalizePredicate()

static void normalizePredicate ( ScalarEvolution SE,
Loop L,
LoopICmp &  RC 
)
static

Definition at line 648 of file LoopPredication.cpp.

References assert(), llvm::LoopBase< BlockT, LoopT >::blocks(), llvm::IRBuilder< T, Inserter >::CreateAnd(), llvm::dbgs(), llvm::Value::dump(), llvm::Loop::dump(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), generateLoopLatchCheck(), llvm::BranchInst::getCondition(), llvm::LoopBase< BlockT, LoopT >::getExitEdges(), llvm::Module::getFunction(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::CmpInst::getInversePredicate(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::BasicBlock::getModule(), llvm::Intrinsic::getName(), llvm::User::getOperand(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::SCEV::getType(), I, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SCEV::isAllOnesValue(), llvm::BranchInst::isConditional(), llvm::ICmpInst::isEquality(), llvm::isGuard(), llvm::isGuardAsWidenableBranch(), llvm::ScalarEvolution::isKnownPredicate(), llvm::SCEV::isOne(), LatchExitProbabilityScale, LLVM_DEBUG, llvm::PatternMatch::m_And(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::None, llvm::SmallVectorImpl< T >::pop_back_val(), PredicateWidenableBranchGuards, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::RecursivelyDeleteTriviallyDeadInstructions(), llvm::BranchInst::setCondition(), llvm::User::setOperand(), llvm::SmallVectorBase::size(), SkipProfitabilityChecks, and llvm::Value::use_empty().

◆ STATISTIC() [1/2]

STATISTIC ( TotalConsidered  ,
"Number of guards considered"   
)

◆ STATISTIC() [2/2]

STATISTIC ( TotalWidened  ,
"Number of checks widened"   
)

Variable Documentation

◆ EnableCountDownLoop

cl::opt<bool> EnableCountDownLoop("loop-predication-enable-count-down-loop", cl::Hidden, cl::init(true))
static

Referenced by generateLoopLatchCheck().

◆ EnableIVTruncation

cl::opt<bool> EnableIVTruncation("loop-predication-enable-iv-truncation", cl::Hidden, cl::init(true))
static

◆ false

loop Loop false

Definition at line 341 of file LoopPredication.cpp.

◆ LatchExitProbabilityScale

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"))
static

Referenced by normalizePredicate().

◆ PredicateWidenableBranchGuards

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))
static

Referenced by normalizePredicate().

◆ predication

loop Loop predication

Definition at line 341 of file LoopPredication.cpp.

◆ SkipProfitabilityChecks

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

Referenced by normalizePredicate().