[PATCH] D47149: [SCCP] Mark DominatorTreeAnalysis as preserved.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 21 09:46:07 PDT 2018
fhahn created this revision.
fhahn added reviewers: dberlin, efriedma, davide.
fhahn added a dependent revision: D45330: [IPSCCP] Use PredicateInfo to propagate facts from cmp instructions..
SCCP does not change the CFG, so we should be able to mark the dominator
tree analysis as preserved.
https://reviews.llvm.org/D47149
Files:
lib/Transforms/IPO/SCCP.cpp
lib/Transforms/Scalar/SCCP.cpp
test/Other/opt-O2-pipeline.ll
test/Other/opt-O3-pipeline.ll
test/Other/opt-Os-pipeline.ll
Index: test/Other/opt-Os-pipeline.ll
===================================================================
--- test/Other/opt-Os-pipeline.ll
+++ test/Other/opt-Os-pipeline.ll
@@ -120,7 +120,6 @@
; CHECK-NEXT: Memory Dependence Analysis
; CHECK-NEXT: MemCpy Optimization
; CHECK-NEXT: Sparse Conditional Constant Propagation
-; CHECK-NEXT: Dominator Tree Construction
; CHECK-NEXT: Demanded bits analysis
; CHECK-NEXT: Bit-Tracking Dead Code Elimination
; CHECK-NEXT: Basic Alias Analysis (stateless AA impl)
Index: test/Other/opt-O3-pipeline.ll
===================================================================
--- test/Other/opt-O3-pipeline.ll
+++ test/Other/opt-O3-pipeline.ll
@@ -138,7 +138,6 @@
; CHECK-NEXT: Memory Dependence Analysis
; CHECK-NEXT: MemCpy Optimization
; CHECK-NEXT: Sparse Conditional Constant Propagation
-; CHECK-NEXT: Dominator Tree Construction
; CHECK-NEXT: Demanded bits analysis
; CHECK-NEXT: Bit-Tracking Dead Code Elimination
; CHECK-NEXT: Basic Alias Analysis (stateless AA impl)
Index: test/Other/opt-O2-pipeline.ll
===================================================================
--- test/Other/opt-O2-pipeline.ll
+++ test/Other/opt-O2-pipeline.ll
@@ -134,7 +134,6 @@
; CHECK-NEXT: Memory Dependence Analysis
; CHECK-NEXT: MemCpy Optimization
; CHECK-NEXT: Sparse Conditional Constant Propagation
-; CHECK-NEXT: Dominator Tree Construction
; CHECK-NEXT: Demanded bits analysis
; CHECK-NEXT: Bit-Tracking Dead Code Elimination
; CHECK-NEXT: Basic Alias Analysis (stateless AA impl)
Index: lib/Transforms/Scalar/SCCP.cpp
===================================================================
--- lib/Transforms/Scalar/SCCP.cpp
+++ lib/Transforms/Scalar/SCCP.cpp
@@ -1776,6 +1776,7 @@
return PreservedAnalyses::all();
auto PA = PreservedAnalyses();
+ PA.preserve<DominatorTreeAnalysis>();
PA.preserve<GlobalsAA>();
return PA;
}
@@ -1798,6 +1799,7 @@
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<TargetLibraryInfoWrapperPass>();
+ AU.addPreserved<DominatorTreeWrapperPass>();
AU.addPreserved<GlobalsAAWrapperPass>();
}
Index: lib/Transforms/IPO/SCCP.cpp
===================================================================
--- lib/Transforms/IPO/SCCP.cpp
+++ lib/Transforms/IPO/SCCP.cpp
@@ -1,5 +1,6 @@
#include "llvm/Transforms/IPO/SCCP.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/IR/Dominators.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Scalar/SCCP.h"
@@ -10,7 +11,10 @@
auto &TLI = AM.getResult<TargetLibraryAnalysis>(M);
if (!runIPSCCP(M, DL, &TLI))
return PreservedAnalyses::all();
- return PreservedAnalyses::none();
+
+ PreservedAnalyses PA;
+ PA.preserve<DominatorTreeAnalysis>();
+ return PA;
}
namespace {
@@ -39,6 +43,7 @@
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<TargetLibraryInfoWrapperPass>();
+ AU.addPreserved<DominatorTreeWrapperPass>();
}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47149.147805.patch
Type: text/x-patch
Size: 3159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180521/3c52aac0/attachment-0001.bin>
More information about the llvm-commits
mailing list