diff options
Diffstat (limited to 'lib/Target/Hexagon/HexagonGenMux.cpp')
-rw-r--r-- | lib/Target/Hexagon/HexagonGenMux.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Target/Hexagon/HexagonGenMux.cpp b/lib/Target/Hexagon/HexagonGenMux.cpp index 5a001d6ed9c1..e5af96468af1 100644 --- a/lib/Target/Hexagon/HexagonGenMux.cpp +++ b/lib/Target/Hexagon/HexagonGenMux.cpp @@ -40,6 +40,7 @@ #include "llvm/MC/MCInstrDesc.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/Pass.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/MathExtras.h" #include <algorithm> #include <cassert> @@ -56,6 +57,11 @@ namespace llvm { } // end namespace llvm +// Initialize this to 0 to always prefer generating mux by default. +static cl::opt<unsigned> MinPredDist("hexagon-gen-mux-threshold", cl::Hidden, + cl::init(0), cl::desc("Minimum distance between predicate definition and " + "farther of the two predicated uses")); + namespace { class HexagonGenMux : public MachineFunctionPass { @@ -269,11 +275,13 @@ bool HexagonGenMux::genMuxInBlock(MachineBasicBlock &B) { // There is now a complete definition of DR, i.e. we have the predicate // register, the definition if-true, and definition if-false. - // First, check if both definitions are far enough from the definition + // First, check if the definitions are far enough from the definition // of the predicate register. unsigned MinX = std::min(CI.TrueX, CI.FalseX); unsigned MaxX = std::max(CI.TrueX, CI.FalseX); - unsigned SearchX = (MaxX > 4) ? MaxX-4 : 0; + // Specifically, check if the predicate definition is within a prescribed + // distance from the farther of the two predicated instructions. + unsigned SearchX = (MaxX >= MinPredDist) ? MaxX-MinPredDist : 0; bool NearDef = false; for (unsigned X = SearchX; X < MaxX; ++X) { const DefUseInfo &DU = DUM.lookup(X); @@ -348,7 +356,7 @@ bool HexagonGenMux::genMuxInBlock(MachineBasicBlock &B) { return false; }; for (auto I = B.rbegin(), E = B.rend(); I != E; ++I) { - if (I->isDebugValue()) + if (I->isDebugInstr()) continue; // This isn't 100% accurate, but it's safe. // It won't detect (as a kill) a case like this |