[llvm] 25c6544 - [VectorCombine] add a debug flag to skip all transforms

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 12:16:30 PST 2020


Author: Sanjay Patel
Date: 2020-02-26T15:15:42-05:00
New Revision: 25c6544f32eec4fd563f5531cec1d42b5c9c3e13

URL: https://github.com/llvm/llvm-project/commit/25c6544f32eec4fd563f5531cec1d42b5c9c3e13
DIFF: https://github.com/llvm/llvm-project/commit/25c6544f32eec4fd563f5531cec1d42b5c9c3e13.diff

LOG: [VectorCombine] add a debug flag to skip all transforms

As suggested in D75145 -

I'm not sure why, but several passes have this kind of disable/enable flag
implemented at the pass manager level. But that means we have to duplicate
the flag for both pass managers and add code to check the flag every time
the pass appears in the pipeline.

We want a debug option to see if this pass is misbehaving regardless of the
pass managers, so just add a disablement check at the single point before
any transforms run.

Differential Revision: https://reviews.llvm.org/D75204

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index 30c058af3079..76c63dd23850 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -23,6 +23,7 @@
 #include "llvm/IR/PatternMatch.h"
 #include "llvm/InitializePasses.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Transforms/Vectorize.h"
 #include "llvm/Transforms/Utils/Local.h"
 
@@ -33,6 +34,10 @@ using namespace llvm::PatternMatch;
 STATISTIC(NumVecCmp, "Number of vector compares formed");
 STATISTIC(NumVecBO, "Number of vector binops formed");
 
+static cl::opt<bool> DisableVectorCombine(
+    "disable-vector-combine", cl::init(false), cl::Hidden,
+    cl::desc("Disable all vector combine transforms"));
+
 /// Compare the relative costs of extracts followed by scalar operation vs.
 /// vector operation followed by extract:
 /// opcode (extelt V0, C), (extelt V1, C) --> extelt (opcode V0, V1), C
@@ -175,6 +180,9 @@ static bool foldExtractExtract(Instruction &I, const TargetTransformInfo &TTI) {
 /// handled in the callers of this function.
 static bool runImpl(Function &F, const TargetTransformInfo &TTI,
                     const DominatorTree &DT) {
+  if (DisableVectorCombine)
+    return false;
+
   bool MadeChange = false;
   for (BasicBlock &BB : F) {
     // Ignore unreachable basic blocks.


        


More information about the llvm-commits mailing list