Index: llvm/lib/Transforms/Vectorize/VectorCombine.cpp =================================================================== --- llvm/lib/Transforms/Vectorize/VectorCombine.cpp +++ 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 @@ STATISTIC(NumVecCmp, "Number of vector compares formed"); STATISTIC(NumVecBO, "Number of vector binops formed"); +static cl::opt 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 @@ /// 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.