diff options
author | Craig Topper <craig.topper@intel.com> | 2017-08-10 17:48:12 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2017-08-10 17:48:12 +0000 |
commit | cd13ebca5feb96a415119adbcd9a6df4f08f9d60 (patch) | |
tree | c524f79eca3281801916d49e833caa25edbb2447 /llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | |
parent | 9cd976d041de6006d208f3f20fd7d353a383a18b (diff) | |
download | bcm5719-llvm-cd13ebca5feb96a415119adbcd9a6df4f08f9d60.tar.gz bcm5719-llvm-cd13ebca5feb96a415119adbcd9a6df4f08f9d60.zip |
[InstCombine] Add a DEBUG_COUNTER to InstCombine to limit how many instructions are visited for debug
Sometimes it would be nice to stop InstCombine mid way through its combining to see the current IR. By using a debug counter we can place an upper limit on how many instructions to process.
This will also allow skipping the first X combines, but that has the potential to change later combines since earlier canonicalizations might have been skipped.
Differential Revision: https://reviews.llvm.org/D36553
llvm-svn: 310638
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstructionCombining.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 4b542d77d18..b07e2cc2d2a 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -60,6 +60,7 @@ #include "llvm/IR/ValueHandle.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/DebugCounter.h" #include "llvm/Support/KnownBits.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/InstCombine/InstCombine.h" @@ -79,6 +80,8 @@ STATISTIC(NumSunkInst , "Number of instructions sunk"); STATISTIC(NumExpand, "Number of expansions"); STATISTIC(NumFactor , "Number of factorizations"); STATISTIC(NumReassoc , "Number of reassociations"); +DEBUG_COUNTER(VisitCounter, "instcombine-visit", + "Controls which instructions are visited"); static cl::opt<bool> EnableExpensiveCombines("expensive-combines", @@ -2882,6 +2885,9 @@ bool InstCombiner::run() { continue; } + if (!DebugCounter::shouldExecute(VisitCounter)) + continue; + // Instruction isn't dead, see if we can constant propagate it. if (!I->use_empty() && (I->getNumOperands() == 0 || isa<Constant>(I->getOperand(0)))) { |