@@ -64,6 +64,11 @@ ImplicationSearchThreshold(
64
64
" condition to use to thread over a weaker condition" ),
65
65
cl::init(3 ), cl::Hidden);
66
66
67
+ static cl::opt<bool > PrintLVIAfterJumpThreading (
68
+ " print-lvi-after-jump-threading" ,
69
+ cl::desc (" Print the LazyValueInfo cache after JumpThreading" ), cl::init(false ),
70
+ cl::Hidden);
71
+
67
72
namespace {
68
73
// / This pass performs 'jump threading', which looks at blocks that have
69
74
// / multiple predecessors and multiple successors. If one or more of the
@@ -93,6 +98,8 @@ namespace {
93
98
bool runOnFunction (Function &F) override ;
94
99
95
100
void getAnalysisUsage (AnalysisUsage &AU) const override {
101
+ if (PrintLVIAfterJumpThreading)
102
+ AU.addRequired <DominatorTreeWrapperPass>();
96
103
AU.addRequired <AAResultsWrapperPass>();
97
104
AU.addRequired <LazyValueInfoWrapperPass>();
98
105
AU.addPreserved <LazyValueInfoWrapperPass>();
@@ -137,8 +144,14 @@ bool JumpThreading::runOnFunction(Function &F) {
137
144
BFI.reset (new BlockFrequencyInfo (F, *BPI, LI));
138
145
}
139
146
140
- return Impl.runImpl (F, TLI, LVI, AA, HasProfileData, std::move (BFI),
141
- std::move (BPI));
147
+ bool Changed = Impl.runImpl (F, TLI, LVI, AA, HasProfileData, std::move (BFI),
148
+ std::move (BPI));
149
+ if (PrintLVIAfterJumpThreading) {
150
+ dbgs () << " LVI for function '" << F.getName () << " ':\n " ;
151
+ LVI->printLVI (F, getAnalysis<DominatorTreeWrapperPass>().getDomTree (),
152
+ dbgs ());
153
+ }
154
+ return Changed;
142
155
}
143
156
144
157
PreservedAnalyses JumpThreadingPass::run (Function &F,
0 commit comments