[llvm] r226550 - [PM] Move the LoopInfo analysis pointer into the InstCombiner class
Chandler Carruth
chandlerc at gmail.com
Tue Jan 20 00:35:25 PST 2015
Author: chandlerc
Date: Tue Jan 20 02:35:24 2015
New Revision: 226550
URL: http://llvm.org/viewvc/llvm-project?rev=226550&view=rev
Log:
[PM] Move the LoopInfo analysis pointer into the InstCombiner class
along with the other analyses.
The most obvious reason why is because eventually I need to separate out
the pass layer from the rest of the instcombiner. However, it is also
probably a compile time win as every query through the pass manager
layer is pretty slow these days.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombine.h
llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombine.h?rev=226550&r1=226549&r2=226550&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombine.h (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombine.h Tue Jan 20 02:35:24 2015
@@ -12,6 +12,7 @@
#include "InstCombineWorklist.h"
#include "llvm/Analysis/AssumptionCache.h"
+#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/TargetFolder.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Dominators.h"
@@ -100,6 +101,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombin
const DataLayout *DL;
TargetLibraryInfo *TLI;
DominatorTree *DT;
+ LoopInfo *LI;
bool MadeIRChange;
LibCallSimplifier *Simplifier;
bool MinimizeSize;
@@ -115,7 +117,8 @@ public:
static char ID; // Pass identification, replacement for typeid
InstCombiner()
- : FunctionPass(ID), DL(nullptr), DT(nullptr), Builder(nullptr) {
+ : FunctionPass(ID), DL(nullptr), DT(nullptr), LI(nullptr),
+ Builder(nullptr) {
MinimizeSize = false;
initializeInstCombinerPass(*PassRegistry::getPassRegistry());
}
@@ -133,6 +136,8 @@ public:
DominatorTree *getDominatorTree() const { return DT; }
+ LoopInfo *getLoopInfo() const { return LI; }
+
TargetLibraryInfo *getTargetLibraryInfo() const { return TLI; }
// Visitation implementation - Implement instruction combining for different
Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=226550&r1=226549&r2=226550&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Tue Jan 20 02:35:24 2015
@@ -799,9 +799,7 @@ Instruction *InstCombiner::FoldOpIntoPhi
// If the incoming non-constant value is in I's block, we will remove one
// instruction, but insert another equivalent one, leading to infinite
// instcombine.
- auto *LIWP = getAnalysisIfAvailable<LoopInfoWrapperPass>();
- if (isPotentiallyReachable(I.getParent(), NonConstBB, DT,
- LIWP ? &LIWP->getLoopInfo() : nullptr))
+ if (isPotentiallyReachable(I.getParent(), NonConstBB, DT, LI))
return nullptr;
}
@@ -2975,6 +2973,8 @@ bool InstCombiner::runOnFunction(Functio
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
DL = DLP ? &DLP->getDataLayout() : nullptr;
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
+ auto *LIWP = getAnalysisIfAvailable<LoopInfoWrapperPass>();
+ LI = LIWP ? &LIWP->getLoopInfo() : nullptr;
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
// Minimizing size?
More information about the llvm-commits
mailing list