mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
Switch CodeMetrics itself over to use TTI to determine if an instruction
is free. The whole CodeMetrics API should probably be reworked more, but this is enough to allow deleting the duplicate code there for computing whether an instruction is free. All of the passes using this have been updated to pull in TTI and hand it to the CodeMetrics stuff. Further, a dead CodeMetrics API (analyzeFunction) is nuked for lack of users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173036 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -23,11 +23,9 @@ class BasicBlock;
|
|||||||
class Function;
|
class Function;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
class DataLayout;
|
class DataLayout;
|
||||||
|
class TargetTransformInfo;
|
||||||
class Value;
|
class Value;
|
||||||
|
|
||||||
/// \brief Check whether an instruction is likely to be "free" when lowered.
|
|
||||||
bool isInstructionFree(const Instruction *I, const DataLayout *TD = 0);
|
|
||||||
|
|
||||||
/// \brief Check whether a call will lower to something small.
|
/// \brief Check whether a call will lower to something small.
|
||||||
///
|
///
|
||||||
/// This tests checks whether this callsite will lower to something
|
/// This tests checks whether this callsite will lower to something
|
||||||
@ -87,10 +85,7 @@ struct CodeMetrics {
|
|||||||
NumInlineCandidates(0), NumVectorInsts(0), NumRets(0) {}
|
NumInlineCandidates(0), NumVectorInsts(0), NumRets(0) {}
|
||||||
|
|
||||||
/// \brief Add information about a block to the current state.
|
/// \brief Add information about a block to the current state.
|
||||||
void analyzeBasicBlock(const BasicBlock *BB, const DataLayout *TD = 0);
|
void analyzeBasicBlock(const BasicBlock *BB, const TargetTransformInfo &TTI);
|
||||||
|
|
||||||
/// \brief Add information about a function to the current state.
|
|
||||||
void analyzeFunction(Function *F, const DataLayout *TD = 0);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/Analysis/CodeMetrics.h"
|
#include "llvm/Analysis/CodeMetrics.h"
|
||||||
|
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||||
#include "llvm/IR/DataLayout.h"
|
#include "llvm/IR/DataLayout.h"
|
||||||
#include "llvm/IR/Function.h"
|
#include "llvm/IR/Function.h"
|
||||||
#include "llvm/IR/IntrinsicInst.h"
|
#include "llvm/IR/IntrinsicInst.h"
|
||||||
@ -54,77 +55,15 @@ bool llvm::callIsSmall(ImmutableCallSite CS) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool llvm::isInstructionFree(const Instruction *I, const DataLayout *TD) {
|
|
||||||
if (isa<PHINode>(I))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// If a GEP has all constant indices, it will probably be folded with
|
|
||||||
// a load/store.
|
|
||||||
if (const GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(I))
|
|
||||||
return GEP->hasAllConstantIndices();
|
|
||||||
|
|
||||||
if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
|
|
||||||
switch (II->getIntrinsicID()) {
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
case Intrinsic::dbg_declare:
|
|
||||||
case Intrinsic::dbg_value:
|
|
||||||
case Intrinsic::invariant_start:
|
|
||||||
case Intrinsic::invariant_end:
|
|
||||||
case Intrinsic::lifetime_start:
|
|
||||||
case Intrinsic::lifetime_end:
|
|
||||||
case Intrinsic::objectsize:
|
|
||||||
case Intrinsic::ptr_annotation:
|
|
||||||
case Intrinsic::var_annotation:
|
|
||||||
// These intrinsics don't count as size.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (const CastInst *CI = dyn_cast<CastInst>(I)) {
|
|
||||||
// Noop casts, including ptr <-> int, don't count.
|
|
||||||
if (CI->isLosslessCast())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
Value *Op = CI->getOperand(0);
|
|
||||||
// An inttoptr cast is free so long as the input is a legal integer type
|
|
||||||
// which doesn't contain values outside the range of a pointer.
|
|
||||||
if (isa<IntToPtrInst>(CI) && TD &&
|
|
||||||
TD->isLegalInteger(Op->getType()->getScalarSizeInBits()) &&
|
|
||||||
Op->getType()->getScalarSizeInBits() <= TD->getPointerSizeInBits())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// A ptrtoint cast is free so long as the result is large enough to store
|
|
||||||
// the pointer, and a legal integer type.
|
|
||||||
if (isa<PtrToIntInst>(CI) && TD &&
|
|
||||||
TD->isLegalInteger(Op->getType()->getScalarSizeInBits()) &&
|
|
||||||
Op->getType()->getScalarSizeInBits() >= TD->getPointerSizeInBits())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// trunc to a native type is free (assuming the target has compare and
|
|
||||||
// shift-right of the same width).
|
|
||||||
if (TD && isa<TruncInst>(CI) &&
|
|
||||||
TD->isLegalInteger(TD->getTypeSizeInBits(CI->getType())))
|
|
||||||
return true;
|
|
||||||
// Result of a cmp instruction is often extended (to be used by other
|
|
||||||
// cmp instructions, logical or return instructions). These are usually
|
|
||||||
// nop on most sane targets.
|
|
||||||
if (isa<CmpInst>(CI->getOperand(0)))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// analyzeBasicBlock - Fill in the current structure with information gleaned
|
/// analyzeBasicBlock - Fill in the current structure with information gleaned
|
||||||
/// from the specified block.
|
/// from the specified block.
|
||||||
void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
|
void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
|
||||||
const DataLayout *TD) {
|
const TargetTransformInfo &TTI) {
|
||||||
++NumBlocks;
|
++NumBlocks;
|
||||||
unsigned NumInstsBeforeThisBB = NumInsts;
|
unsigned NumInstsBeforeThisBB = NumInsts;
|
||||||
for (BasicBlock::const_iterator II = BB->begin(), E = BB->end();
|
for (BasicBlock::const_iterator II = BB->begin(), E = BB->end();
|
||||||
II != E; ++II) {
|
II != E; ++II) {
|
||||||
if (isInstructionFree(II, TD))
|
if (TargetTransformInfo::TCC_Free == TTI.getUserCost(&*II))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Special handling for calls.
|
// Special handling for calls.
|
||||||
@ -195,18 +134,3 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
|
|||||||
// Remember NumInsts for this BB.
|
// Remember NumInsts for this BB.
|
||||||
NumBBInsts[BB] = NumInsts - NumInstsBeforeThisBB;
|
NumBBInsts[BB] = NumInsts - NumInstsBeforeThisBB;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeMetrics::analyzeFunction(Function *F, const DataLayout *TD) {
|
|
||||||
// If this function contains a call that "returns twice" (e.g., setjmp or
|
|
||||||
// _setjmp) and it isn't marked with "returns twice" itself, never inline it.
|
|
||||||
// This is a hack because we depend on the user marking their local variables
|
|
||||||
// as volatile if they are live across a setjmp call, and they probably
|
|
||||||
// won't do this in callers.
|
|
||||||
exposesReturnsTwice = F->callsFunctionThatReturnsTwice() &&
|
|
||||||
!F->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
|
||||||
Attribute::ReturnsTwice);
|
|
||||||
|
|
||||||
// Look at the size of the callee.
|
|
||||||
for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
|
|
||||||
analyzeBasicBlock(&*BB, TD);
|
|
||||||
}
|
|
||||||
|
@ -258,6 +258,9 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned getUserCost(const User *U) const {
|
unsigned getUserCost(const User *U) const {
|
||||||
|
if (isa<PHINode>(U))
|
||||||
|
return TCC_Free; // Model all PHI nodes as free.
|
||||||
|
|
||||||
if (const GEPOperator *GEP = dyn_cast<GEPOperator>(U))
|
if (const GEPOperator *GEP = dyn_cast<GEPOperator>(U))
|
||||||
// In the basic model we just assume that all-constant GEPs will be
|
// In the basic model we just assume that all-constant GEPs will be
|
||||||
// folded into their uses via addressing modes.
|
// folded into their uses via addressing modes.
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "llvm/Analysis/InstructionSimplify.h"
|
#include "llvm/Analysis/InstructionSimplify.h"
|
||||||
#include "llvm/Analysis/LoopPass.h"
|
#include "llvm/Analysis/LoopPass.h"
|
||||||
#include "llvm/Analysis/ScalarEvolution.h"
|
#include "llvm/Analysis/ScalarEvolution.h"
|
||||||
|
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||||
#include "llvm/Analysis/ValueTracking.h"
|
#include "llvm/Analysis/ValueTracking.h"
|
||||||
#include "llvm/IR/Function.h"
|
#include "llvm/IR/Function.h"
|
||||||
#include "llvm/IR/IntrinsicInst.h"
|
#include "llvm/IR/IntrinsicInst.h"
|
||||||
@ -51,6 +52,7 @@ namespace {
|
|||||||
AU.addRequiredID(LCSSAID);
|
AU.addRequiredID(LCSSAID);
|
||||||
AU.addPreservedID(LCSSAID);
|
AU.addPreservedID(LCSSAID);
|
||||||
AU.addPreserved<ScalarEvolution>();
|
AU.addPreserved<ScalarEvolution>();
|
||||||
|
AU.addRequired<TargetTransformInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool runOnLoop(Loop *L, LPPassManager &LPM);
|
bool runOnLoop(Loop *L, LPPassManager &LPM);
|
||||||
@ -59,11 +61,13 @@ namespace {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
LoopInfo *LI;
|
LoopInfo *LI;
|
||||||
|
const TargetTransformInfo *TTI;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
char LoopRotate::ID = 0;
|
char LoopRotate::ID = 0;
|
||||||
INITIALIZE_PASS_BEGIN(LoopRotate, "loop-rotate", "Rotate Loops", false, false)
|
INITIALIZE_PASS_BEGIN(LoopRotate, "loop-rotate", "Rotate Loops", false, false)
|
||||||
|
INITIALIZE_AG_DEPENDENCY(TargetTransformInfo)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
|
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
||||||
@ -75,6 +79,7 @@ Pass *llvm::createLoopRotatePass() { return new LoopRotate(); }
|
|||||||
/// the loop is rotated at least once.
|
/// the loop is rotated at least once.
|
||||||
bool LoopRotate::runOnLoop(Loop *L, LPPassManager &LPM) {
|
bool LoopRotate::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||||
LI = &getAnalysis<LoopInfo>();
|
LI = &getAnalysis<LoopInfo>();
|
||||||
|
TTI = &getAnalysis<TargetTransformInfo>();
|
||||||
|
|
||||||
// Simplify the loop latch before attempting to rotate the header
|
// Simplify the loop latch before attempting to rotate the header
|
||||||
// upward. Rotation may not be needed if the loop tail can be folded into the
|
// upward. Rotation may not be needed if the loop tail can be folded into the
|
||||||
@ -278,7 +283,7 @@ bool LoopRotate::rotateLoop(Loop *L) {
|
|||||||
// duplicate blocks inside it.
|
// duplicate blocks inside it.
|
||||||
{
|
{
|
||||||
CodeMetrics Metrics;
|
CodeMetrics Metrics;
|
||||||
Metrics.analyzeBasicBlock(OrigHeader);
|
Metrics.analyzeBasicBlock(OrigHeader, *TTI);
|
||||||
if (Metrics.notDuplicatable) {
|
if (Metrics.notDuplicatable) {
|
||||||
DEBUG(dbgs() << "LoopRotation: NOT rotating - contains non duplicatable"
|
DEBUG(dbgs() << "LoopRotation: NOT rotating - contains non duplicatable"
|
||||||
<< " instructions: "; L->dump());
|
<< " instructions: "; L->dump());
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "llvm/Analysis/CodeMetrics.h"
|
#include "llvm/Analysis/CodeMetrics.h"
|
||||||
#include "llvm/Analysis/LoopPass.h"
|
#include "llvm/Analysis/LoopPass.h"
|
||||||
#include "llvm/Analysis/ScalarEvolution.h"
|
#include "llvm/Analysis/ScalarEvolution.h"
|
||||||
|
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||||
#include "llvm/IR/DataLayout.h"
|
#include "llvm/IR/DataLayout.h"
|
||||||
#include "llvm/IR/IntrinsicInst.h"
|
#include "llvm/IR/IntrinsicInst.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
@ -90,6 +91,7 @@ namespace {
|
|||||||
AU.addPreservedID(LCSSAID);
|
AU.addPreservedID(LCSSAID);
|
||||||
AU.addRequired<ScalarEvolution>();
|
AU.addRequired<ScalarEvolution>();
|
||||||
AU.addPreserved<ScalarEvolution>();
|
AU.addPreserved<ScalarEvolution>();
|
||||||
|
AU.addRequired<TargetTransformInfo>();
|
||||||
// FIXME: Loop unroll requires LCSSA. And LCSSA requires dom info.
|
// FIXME: Loop unroll requires LCSSA. And LCSSA requires dom info.
|
||||||
// If loop unroll does not preserve dom info then LCSSA pass on next
|
// If loop unroll does not preserve dom info then LCSSA pass on next
|
||||||
// loop will receive invalid dom info.
|
// loop will receive invalid dom info.
|
||||||
@ -101,6 +103,7 @@ namespace {
|
|||||||
|
|
||||||
char LoopUnroll::ID = 0;
|
char LoopUnroll::ID = 0;
|
||||||
INITIALIZE_PASS_BEGIN(LoopUnroll, "loop-unroll", "Unroll loops", false, false)
|
INITIALIZE_PASS_BEGIN(LoopUnroll, "loop-unroll", "Unroll loops", false, false)
|
||||||
|
INITIALIZE_AG_DEPENDENCY(TargetTransformInfo)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
|
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
||||||
@ -113,11 +116,12 @@ Pass *llvm::createLoopUnrollPass(int Threshold, int Count, int AllowPartial) {
|
|||||||
|
|
||||||
/// ApproximateLoopSize - Approximate the size of the loop.
|
/// ApproximateLoopSize - Approximate the size of the loop.
|
||||||
static unsigned ApproximateLoopSize(const Loop *L, unsigned &NumCalls,
|
static unsigned ApproximateLoopSize(const Loop *L, unsigned &NumCalls,
|
||||||
bool &NotDuplicatable, const DataLayout *TD) {
|
bool &NotDuplicatable,
|
||||||
|
const TargetTransformInfo &TTI) {
|
||||||
CodeMetrics Metrics;
|
CodeMetrics Metrics;
|
||||||
for (Loop::block_iterator I = L->block_begin(), E = L->block_end();
|
for (Loop::block_iterator I = L->block_begin(), E = L->block_end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
Metrics.analyzeBasicBlock(*I, TD);
|
Metrics.analyzeBasicBlock(*I, TTI);
|
||||||
NumCalls = Metrics.NumInlineCandidates;
|
NumCalls = Metrics.NumInlineCandidates;
|
||||||
NotDuplicatable = Metrics.notDuplicatable;
|
NotDuplicatable = Metrics.notDuplicatable;
|
||||||
|
|
||||||
@ -134,6 +138,7 @@ static unsigned ApproximateLoopSize(const Loop *L, unsigned &NumCalls,
|
|||||||
bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
|
bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||||
LoopInfo *LI = &getAnalysis<LoopInfo>();
|
LoopInfo *LI = &getAnalysis<LoopInfo>();
|
||||||
ScalarEvolution *SE = &getAnalysis<ScalarEvolution>();
|
ScalarEvolution *SE = &getAnalysis<ScalarEvolution>();
|
||||||
|
const TargetTransformInfo &TTI = getAnalysis<TargetTransformInfo>();
|
||||||
|
|
||||||
BasicBlock *Header = L->getHeader();
|
BasicBlock *Header = L->getHeader();
|
||||||
DEBUG(dbgs() << "Loop Unroll: F[" << Header->getParent()->getName()
|
DEBUG(dbgs() << "Loop Unroll: F[" << Header->getParent()->getName()
|
||||||
@ -181,11 +186,10 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
|
|||||||
|
|
||||||
// Enforce the threshold.
|
// Enforce the threshold.
|
||||||
if (Threshold != NoThreshold) {
|
if (Threshold != NoThreshold) {
|
||||||
const DataLayout *TD = getAnalysisIfAvailable<DataLayout>();
|
|
||||||
unsigned NumInlineCandidates;
|
unsigned NumInlineCandidates;
|
||||||
bool notDuplicatable;
|
bool notDuplicatable;
|
||||||
unsigned LoopSize = ApproximateLoopSize(L, NumInlineCandidates,
|
unsigned LoopSize = ApproximateLoopSize(L, NumInlineCandidates,
|
||||||
notDuplicatable, TD);
|
notDuplicatable, TTI);
|
||||||
DEBUG(dbgs() << " Loop Size = " << LoopSize << "\n");
|
DEBUG(dbgs() << " Loop Size = " << LoopSize << "\n");
|
||||||
if (notDuplicatable) {
|
if (notDuplicatable) {
|
||||||
DEBUG(dbgs() << " Not unrolling loop which contains non duplicatable"
|
DEBUG(dbgs() << " Not unrolling loop which contains non duplicatable"
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "llvm/Analysis/LoopInfo.h"
|
#include "llvm/Analysis/LoopInfo.h"
|
||||||
#include "llvm/Analysis/LoopPass.h"
|
#include "llvm/Analysis/LoopPass.h"
|
||||||
#include "llvm/Analysis/ScalarEvolution.h"
|
#include "llvm/Analysis/ScalarEvolution.h"
|
||||||
|
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||||
#include "llvm/IR/Constants.h"
|
#include "llvm/IR/Constants.h"
|
||||||
#include "llvm/IR/DerivedTypes.h"
|
#include "llvm/IR/DerivedTypes.h"
|
||||||
#include "llvm/IR/Function.h"
|
#include "llvm/IR/Function.h"
|
||||||
@ -101,7 +102,7 @@ namespace {
|
|||||||
|
|
||||||
// Analyze loop. Check its size, calculate is it possible to unswitch
|
// Analyze loop. Check its size, calculate is it possible to unswitch
|
||||||
// it. Returns true if we can unswitch this loop.
|
// it. Returns true if we can unswitch this loop.
|
||||||
bool countLoop(const Loop* L);
|
bool countLoop(const Loop* L, const TargetTransformInfo &TTI);
|
||||||
|
|
||||||
// Clean all data related to given loop.
|
// Clean all data related to given loop.
|
||||||
void forgetLoop(const Loop* L);
|
void forgetLoop(const Loop* L);
|
||||||
@ -170,6 +171,7 @@ namespace {
|
|||||||
AU.addPreservedID(LCSSAID);
|
AU.addPreservedID(LCSSAID);
|
||||||
AU.addPreserved<DominatorTree>();
|
AU.addPreserved<DominatorTree>();
|
||||||
AU.addPreserved<ScalarEvolution>();
|
AU.addPreserved<ScalarEvolution>();
|
||||||
|
AU.addRequired<TargetTransformInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -221,7 +223,7 @@ namespace {
|
|||||||
|
|
||||||
// Analyze loop. Check its size, calculate is it possible to unswitch
|
// Analyze loop. Check its size, calculate is it possible to unswitch
|
||||||
// it. Returns true if we can unswitch this loop.
|
// it. Returns true if we can unswitch this loop.
|
||||||
bool LUAnalysisCache::countLoop(const Loop* L) {
|
bool LUAnalysisCache::countLoop(const Loop *L, const TargetTransformInfo &TTI) {
|
||||||
|
|
||||||
std::pair<LoopPropsMapIt, bool> InsertRes =
|
std::pair<LoopPropsMapIt, bool> InsertRes =
|
||||||
LoopsProperties.insert(std::make_pair(L, LoopProperties()));
|
LoopsProperties.insert(std::make_pair(L, LoopProperties()));
|
||||||
@ -243,7 +245,7 @@ bool LUAnalysisCache::countLoop(const Loop* L) {
|
|||||||
for (Loop::block_iterator I = L->block_begin(),
|
for (Loop::block_iterator I = L->block_begin(),
|
||||||
E = L->block_end();
|
E = L->block_end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
Metrics.analyzeBasicBlock(*I);
|
Metrics.analyzeBasicBlock(*I, TTI);
|
||||||
|
|
||||||
Props.SizeEstimation = std::min(Metrics.NumInsts, Metrics.NumBlocks * 5);
|
Props.SizeEstimation = std::min(Metrics.NumInsts, Metrics.NumBlocks * 5);
|
||||||
Props.CanBeUnswitchedCount = MaxSize / (Props.SizeEstimation);
|
Props.CanBeUnswitchedCount = MaxSize / (Props.SizeEstimation);
|
||||||
@ -334,6 +336,7 @@ void LUAnalysisCache::cloneData(const Loop* NewLoop, const Loop* OldLoop,
|
|||||||
char LoopUnswitch::ID = 0;
|
char LoopUnswitch::ID = 0;
|
||||||
INITIALIZE_PASS_BEGIN(LoopUnswitch, "loop-unswitch", "Unswitch loops",
|
INITIALIZE_PASS_BEGIN(LoopUnswitch, "loop-unswitch", "Unswitch loops",
|
||||||
false, false)
|
false, false)
|
||||||
|
INITIALIZE_AG_DEPENDENCY(TargetTransformInfo)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
|
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
|
||||||
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
INITIALIZE_PASS_DEPENDENCY(LCSSA)
|
||||||
@ -424,7 +427,7 @@ bool LoopUnswitch::processCurrentLoop() {
|
|||||||
|
|
||||||
// Probably we reach the quota of branches for this loop. If so
|
// Probably we reach the quota of branches for this loop. If so
|
||||||
// stop unswitching.
|
// stop unswitching.
|
||||||
if (!BranchesInfo.countLoop(currentLoop))
|
if (!BranchesInfo.countLoop(currentLoop, getAnalysis<TargetTransformInfo>()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Loop over all of the basic blocks in the loop. If we find an interior
|
// Loop over all of the basic blocks in the loop. If we find an interior
|
||||||
|
Reference in New Issue
Block a user