[PATCH] D23782: GVNHoist: Use the pass version of MemorySSA and preserve it.
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 22 22:50:50 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279504: GVNHoist: Use the pass version of MemorySSA and preserve it. (authored by dannyb).
Changed prior to commit:
https://reviews.llvm.org/D23782?vs=68893&id=68956#toc
Repository:
rL LLVM
https://reviews.llvm.org/D23782
Files:
llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
Index: llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
+++ llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
@@ -199,17 +199,15 @@
// cases reduce critical path (by exposing more ILP).
class GVNHoist {
public:
- GVNHoist(DominatorTree *Dt, AliasAnalysis *Aa, MemoryDependenceResults *Md,
- bool OptForMinSize)
- : DT(Dt), AA(Aa), MD(Md), OptForMinSize(OptForMinSize),
+ GVNHoist(DominatorTree *DT, AliasAnalysis *AA, MemoryDependenceResults *MD,
+ MemorySSA *MSSA, bool OptForMinSize)
+ : DT(DT), AA(AA), MD(MD), MSSA(MSSA), OptForMinSize(OptForMinSize),
HoistingGeps(OptForMinSize), HoistedCtr(0) {}
bool run(Function &F) {
VN.setDomTree(DT);
VN.setAliasAnalysis(AA);
VN.setMemDep(MD);
bool Res = false;
- MemorySSA M(F, AA, DT);
- MSSA = &M;
// Perform DFS Numbering of instructions.
unsigned BBI = 0;
for (const BasicBlock *BB : depth_first(&F.getEntryBlock())) {
@@ -246,11 +244,11 @@
DominatorTree *DT;
AliasAnalysis *AA;
MemoryDependenceResults *MD;
+ MemorySSA *MSSA;
const bool OptForMinSize;
const bool HoistingGeps;
DenseMap<const Value *, unsigned> DFSNumber;
BBSideEffectsSet BBSideEffects;
- MemorySSA *MSSA;
int HoistedCtr;
enum InsKind { Unknown, Scalar, Load, Store };
@@ -932,16 +930,19 @@
auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
auto &AA = getAnalysis<AAResultsWrapperPass>().getAAResults();
auto &MD = getAnalysis<MemoryDependenceWrapperPass>().getMemDep();
+ auto &MSSA = getAnalysis<MemorySSAWrapperPass>().getMSSA();
- GVNHoist G(&DT, &AA, &MD, F.optForMinSize());
+ GVNHoist G(&DT, &AA, &MD, &MSSA, F.optForMinSize());
return G.run(F);
}
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<AAResultsWrapperPass>();
AU.addRequired<MemoryDependenceWrapperPass>();
+ AU.addRequired<MemorySSAWrapperPass>();
AU.addPreserved<DominatorTreeWrapperPass>();
+ AU.addPreserved<MemorySSAWrapperPass>();
}
};
} // namespace
@@ -951,20 +952,22 @@
DominatorTree &DT = AM.getResult<DominatorTreeAnalysis>(F);
AliasAnalysis &AA = AM.getResult<AAManager>(F);
MemoryDependenceResults &MD = AM.getResult<MemoryDependenceAnalysis>(F);
-
- GVNHoist G(&DT, &AA, &MD, F.optForMinSize());
+ MemorySSA &MSSA = AM.getResult<MemorySSAAnalysis>(F).getMSSA();
+ GVNHoist G(&DT, &AA, &MD, &MSSA, F.optForMinSize());
if (!G.run(F))
return PreservedAnalyses::all();
PreservedAnalyses PA;
PA.preserve<DominatorTreeAnalysis>();
+ PA.preserve<MemorySSAAnalysis>();
return PA;
}
char GVNHoistLegacyPass::ID = 0;
INITIALIZE_PASS_BEGIN(GVNHoistLegacyPass, "gvn-hoist",
"Early GVN Hoisting of Expressions", false, false)
INITIALIZE_PASS_DEPENDENCY(MemoryDependenceWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
INITIALIZE_PASS_END(GVNHoistLegacyPass, "gvn-hoist",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23782.68956.patch
Type: text/x-patch
Size: 3221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160823/7aa7acd7/attachment.bin>
More information about the llvm-commits
mailing list