diff options
author | Chris Lattner <sabre@nondot.org> | 2008-12-04 00:07:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-12-04 00:07:59 +0000 |
commit | 77ee977fcfc29bdcec2d704eabe3464317e1db94 (patch) | |
tree | d7126f1e814fab2a095fb8e49045aeb895a6e1dd /lib/Transforms/Scalar/JumpThreading.cpp | |
parent | cef874ae2b97ba29f10e68d1d2eb21f28a3dc263 (diff) |
add a debugging option to help track down j-t problems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r-- | lib/Transforms/Scalar/JumpThreading.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp index c5acdd4e53..ec4bbf9d5b 100644 --- a/lib/Transforms/Scalar/JumpThreading.cpp +++ b/lib/Transforms/Scalar/JumpThreading.cpp @@ -36,6 +36,11 @@ Threshold("jump-threading-threshold", cl::desc("Max block size to duplicate for jump threading"), cl::init(6), cl::Hidden); +static cl::opt<int> +DebugIterations("jump-threading-debug", + cl::desc("Stop jump threading after N iterations"), + cl::init(-1), 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 @@ -104,11 +109,15 @@ bool JumpThreading::runOnFunction(Function &F) { // If the block is trivially dead, zap it. This eliminates the successor // edges which simplifies the CFG. if (pred_begin(BB) == pred_end(BB) && - BB != &BB->getParent()->getEntryBlock()) { + BB != &BB->getParent()->getEntryBlock() && + DebugIterations != 0) { DOUT << " JT: Deleting dead block '" << BB->getNameStart() << "' with terminator: " << *BB->getTerminator(); DeleteDeadBlock(BB); Changed = true; + + if (DebugIterations != -1) + DebugIterations = DebugIterations-1; } } AnotherIteration = Changed; @@ -183,6 +192,10 @@ static unsigned getJumpThreadDuplicationCost(const BasicBlock *BB) { /// ProcessBlock - If there are any predecessors whose control can be threaded /// through to a successor, transform them now. bool JumpThreading::ProcessBlock(BasicBlock *BB) { + if (DebugIterations == 0) return false; + if (DebugIterations != -1) + DebugIterations = DebugIterations-1; + // If this block has a single predecessor, and if that pred has a single // successor, merge the blocks. This encourages recursive jump threading // because now the condition in this block can be threaded through |