diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp index 75585fcc8026..7d017095c88c 100644 --- a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp @@ -78,6 +78,7 @@ #include "llvm/InitializePasses.h" #include "llvm/Pass.h" #include "llvm/Support/Casting.h" +#include "llvm/Support/DebugCounter.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" @@ -93,6 +94,9 @@ using namespace PatternMatch; static const unsigned UnknownAddressSpace = std::numeric_limits<unsigned>::max(); +DEBUG_COUNTER(StraightLineStrengthReduceCounter, "slsr-counter", + "Controls whether rewriteCandidateWithBasis is executed."); + namespace { class StraightLineStrengthReduceLegacyPass : public FunctionPass { @@ -268,8 +272,8 @@ FunctionPass *llvm::createStraightLineStrengthReducePass() { bool StraightLineStrengthReduce::isBasisFor(const Candidate &Basis, const Candidate &C) { return (Basis.Ins != C.Ins && // skip the same instruction - // They must have the same type too. Basis.Base == C.Base doesn't - // guarantee their types are the same (PR23975). + // They must have the same type too. Basis.Base == C.Base + // doesn't guarantee their types are the same (PR23975). Basis.Ins->getType() == C.Ins->getType() && // Basis must dominate C in order to rewrite C with respect to Basis. DT->dominates(Basis.Ins->getParent(), C.Ins->getParent()) && @@ -610,6 +614,9 @@ Value *StraightLineStrengthReduce::emitBump(const Candidate &Basis, void StraightLineStrengthReduce::rewriteCandidateWithBasis( const Candidate &C, const Candidate &Basis) { + if (!DebugCounter::shouldExecute(StraightLineStrengthReduceCounter)) + return; + assert(C.CandidateKind == Basis.CandidateKind && C.Base == Basis.Base && C.Stride == Basis.Stride); // We run rewriteCandidateWithBasis on all candidates in a post-order, so the |
