[PATCH] D21035: [PM] Preserve the correct set of passes for GVN
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 6 12:27:05 PDT 2016
davide created this revision.
davide added reviewers: chandlerc, bogner, sanjoy.
davide added a subscriber: llvm-commits.
Not sure if this is just an oversight, or there's a real reason why we don't want to cache DominatorTree and GlobalsAA when the IR is mutated as the old PM does. Thanks!
http://reviews.llvm.org/D21035
Files:
lib/Transforms/Scalar/GVN.cpp
Index: lib/Transforms/Scalar/GVN.cpp
===================================================================
--- lib/Transforms/Scalar/GVN.cpp
+++ lib/Transforms/Scalar/GVN.cpp
@@ -594,7 +594,12 @@
auto &AA = AM.getResult<AAManager>(F);
auto &MemDep = AM.getResult<MemoryDependenceAnalysis>(F);
bool Changed = runImpl(F, AC, DT, TLI, AA, &MemDep);
- return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
+ if (!Changed)
+ return PreservedAnalyses::all();
+ PreservedAnalyses PA;
+ PA.preserve<DominatorTreeAnalysis>();
+ PA.preserve<GlobalsAA>();
+ return PA;
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21035.59762.patch
Type: text/x-patch
Size: 647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160606/934c95ba/attachment.bin>
More information about the llvm-commits
mailing list