diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2018-08-01 23:14:14 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2018-08-01 23:14:14 +0000 |
commit | 213d1d23efcd3220c098a8b9238fcf1a0fa1e327 (patch) | |
tree | 88c3248ee5b521355579fb102a5545c9f3f0d0e4 /llvm/lib/Transforms/Scalar | |
parent | 28c7e41c0942877bf058470dc1f3f7ecfed43dba (diff) | |
download | bcm5719-llvm-213d1d23efcd3220c098a8b9238fcf1a0fa1e327.tar.gz bcm5719-llvm-213d1d23efcd3220c098a8b9238fcf1a0fa1e327.zip |
Reland r338431: "Add DebugCounters to DivRemPairs"
(Previously reverted in r338442)
I'm told that the breakage came from us using an x86 triple on configs
that didn't have x86 enabled. This is remedied by moving the
debugcounter test to an x86 directory (where there's also a
opt-bisect-isel.ll test for similar reasons).
I can't repro the reverse-iteration failure mentioned in the revert with
this patch, so I assume that a misconfiguration on my end is what caused
that.
Original commit message:
Add DebugCounters to DivRemPairs
For people who don't use DebugCounters, NFCI.
Patch by Zhizhou Yang!
Differential Revision: https://reviews.llvm.org/D50033
llvm-svn: 338653
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r-- | llvm/lib/Transforms/Scalar/DivRemPairs.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/DivRemPairs.cpp b/llvm/lib/Transforms/Scalar/DivRemPairs.cpp index e1bc590c5c9..ffcf34f1cf7 100644 --- a/llvm/lib/Transforms/Scalar/DivRemPairs.cpp +++ b/llvm/lib/Transforms/Scalar/DivRemPairs.cpp @@ -21,6 +21,7 @@ #include "llvm/IR/Dominators.h" #include "llvm/IR/Function.h" #include "llvm/Pass.h" +#include "llvm/Support/DebugCounter.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/BypassSlowDivision.h" using namespace llvm; @@ -29,6 +30,8 @@ using namespace llvm; STATISTIC(NumPairs, "Number of div/rem pairs"); STATISTIC(NumHoisted, "Number of instructions hoisted"); STATISTIC(NumDecomposed, "Number of instructions decomposed"); +DEBUG_COUNTER(DRPCounter, "div-rem-pairs-transform", + "Controls transformations in div-rem-pairs pass"); /// Find matching pairs of integer div/rem ops (they have the same numerator, /// denominator, and signedness). If they exist in different basic blocks, bring @@ -93,6 +96,9 @@ static bool optimizeDivRem(Function &F, const TargetTransformInfo &TTI, if (!DivDominates && !DT.dominates(RemInst, DivInst)) continue; + if (!DebugCounter::shouldExecute(DRPCounter)) + continue; + if (HasDivRemOp) { // The target has a single div/rem operation. Hoist the lower instruction // to make the matched pair visible to the backend. |