Switch LoopIdiomRecognize to directly use the TargetTransformInfo

interface rather than the ScalarTargetTransformInterface.

llvm-svn: 171616
This commit is contained in:
Chandler Carruth 2013-01-05 10:00:09 +00:00
parent 8f37342b38
commit 6fe147fb3a
1 changed files with 9 additions and 11 deletions

View File

@ -135,12 +135,12 @@ namespace {
DominatorTree *DT; DominatorTree *DT;
ScalarEvolution *SE; ScalarEvolution *SE;
TargetLibraryInfo *TLI; TargetLibraryInfo *TLI;
const ScalarTargetTransformInfo *STTI; const TargetTransformInfo *TTI;
public: public:
static char ID; static char ID;
explicit LoopIdiomRecognize() : LoopPass(ID) { explicit LoopIdiomRecognize() : LoopPass(ID) {
initializeLoopIdiomRecognizePass(*PassRegistry::getPassRegistry()); initializeLoopIdiomRecognizePass(*PassRegistry::getPassRegistry());
TD = 0; DT = 0; SE = 0; TLI = 0; STTI = 0; TD = 0; DT = 0; SE = 0; TLI = 0; TTI = 0;
} }
bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM);
@ -195,12 +195,10 @@ namespace {
return TLI ? TLI : (TLI = &getAnalysis<TargetLibraryInfo>()); return TLI ? TLI : (TLI = &getAnalysis<TargetLibraryInfo>());
} }
const ScalarTargetTransformInfo *getScalarTargetTransformInfo() { const TargetTransformInfo *getTargetTransformInfo() {
if (!STTI) { if (!TTI)
TargetTransformInfo *TTI = getAnalysisIfAvailable<TargetTransformInfo>(); TTI = getAnalysisIfAvailable<TargetTransformInfo>();
if (TTI) STTI = TTI->getScalarTargetTransformInfo(); return TTI;
}
return STTI;
} }
Loop *getLoop() const { return CurLoop; } Loop *getLoop() const { return CurLoop; }
@ -312,8 +310,8 @@ NclPopcountRecognize::NclPopcountRecognize(LoopIdiomRecognize &TheLIR):
} }
bool NclPopcountRecognize::preliminaryScreen() { bool NclPopcountRecognize::preliminaryScreen() {
const ScalarTargetTransformInfo *STTI = LIR.getScalarTargetTransformInfo(); const TargetTransformInfo *TTI = LIR.getTargetTransformInfo();
if (STTI->getPopcntHwSupport(32) != ScalarTargetTransformInfo::Fast) if (TTI->getPopcntHwSupport(32) != TargetTransformInfo::Fast)
return false; return false;
// Counting population are usually conducted by few arithmetic instrutions. // Counting population are usually conducted by few arithmetic instrutions.
@ -631,7 +629,7 @@ CallInst *NclPopcountRecognize::createPopcntIntrinsic(IRBuilderTy &IRBuilder,
/// call, and return true; otherwise, return false. /// call, and return true; otherwise, return false.
bool NclPopcountRecognize::recognize() { bool NclPopcountRecognize::recognize() {
if (!LIR.getScalarTargetTransformInfo()) if (!LIR.getTargetTransformInfo())
return false; return false;
LIR.getScalarEvolution(); LIR.getScalarEvolution();