diff options
author | Davide Italiano <davide@freebsd.org> | 2017-07-28 02:57:43 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2017-07-28 02:57:43 +0000 |
commit | 01cb947abb9bae5b6cb9f01a58490ece36fbdf70 (patch) | |
tree | d313fcb5cd5ec1ae26413c1b0343afc2b09efbcb /llvm/lib/Transforms/Scalar/JumpThreading.cpp | |
parent | 7ce6ed49e8aa349dda3b6e5bac834d63a8733ee8 (diff) | |
download | bcm5719-llvm-01cb947abb9bae5b6cb9f01a58490ece36fbdf70.tar.gz bcm5719-llvm-01cb947abb9bae5b6cb9f01a58490ece36fbdf70.zip |
[JumpThreading] Add an option to dump LazyValueInfo after the run.
Differential Revision: https://reviews.llvm.org/D35973
llvm-svn: 309353
Diffstat (limited to 'llvm/lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/JumpThreading.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index c5557bef8cc..0da003b14ed 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -64,6 +64,11 @@ ImplicationSearchThreshold( "condition to use to thread over a weaker condition"), cl::init(3), cl::Hidden); +static cl::opt<bool> PrintLVIAfterJumpThreading( + "print-lvi-after-jump-threading", + cl::desc("Print the LazyValueInfo cache after JumpThreading"), cl::init(false), + cl::Hidden); + namespace { /// This pass performs 'jump threading', which looks at blocks that have /// multiple predecessors and multiple successors. If one or more of the @@ -93,6 +98,8 @@ namespace { bool runOnFunction(Function &F) override; void getAnalysisUsage(AnalysisUsage &AU) const override { + if (PrintLVIAfterJumpThreading) + AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<AAResultsWrapperPass>(); AU.addRequired<LazyValueInfoWrapperPass>(); AU.addPreserved<LazyValueInfoWrapperPass>(); @@ -137,8 +144,14 @@ bool JumpThreading::runOnFunction(Function &F) { BFI.reset(new BlockFrequencyInfo(F, *BPI, LI)); } - return Impl.runImpl(F, TLI, LVI, AA, HasProfileData, std::move(BFI), - std::move(BPI)); + bool Changed = Impl.runImpl(F, TLI, LVI, AA, HasProfileData, std::move(BFI), + std::move(BPI)); + if (PrintLVIAfterJumpThreading) { + dbgs() << "LVI for function '" << F.getName() << "':\n"; + LVI->printLVI(F, getAnalysis<DominatorTreeWrapperPass>().getDomTree(), + dbgs()); + } + return Changed; } PreservedAnalyses JumpThreadingPass::run(Function &F, |