[llvm-commits] [llvm] r115239 - /llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp

Owen Anderson resistor at mac.com
Thu Sep 30 16:48:38 PDT 2010


Author: resistor
Date: Thu Sep 30 18:48:38 2010
New Revision: 115239

URL: http://llvm.org/viewvc/llvm-project?rev=115239&view=rev
Log:
Temporarily add a flag to make it easier to compare the new-style ARM if
conversion heuristics to the old-style ones.

Modified:
    llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=115239&r1=115238&r2=115239&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Thu Sep 30 18:48:38 2010
@@ -40,6 +40,10 @@
 EnableARM3Addr("enable-arm-3-addr-conv", cl::Hidden,
                cl::desc("Enable ARM 2-addr to 3-addr conv"));
 
+static cl::opt<bool>
+OldARMIfConv("old-arm-if-conversion", cl::Hidden,
+             cl::desc("Use old-style ARM if-conversion heuristics"));
+
 ARMBaseInstrInfo::ARMBaseInstrInfo(const ARMSubtarget& STI)
   : TargetInstrInfoImpl(ARMInsts, array_lengthof(ARMInsts)),
     Subtarget(STI) {
@@ -1201,6 +1205,16 @@
   if (!NumInstrs)
     return false;
   
+  // Use old-style heuristics
+  if (OldARMIfConv) {
+    if (Subtarget.getCPUString() == "generic")
+      // Generic (and overly aggressive) if-conversion limits for testing.
+      return NumInstrs <= 10;
+    else if (Subtarget.hasV7Ops())
+      return NumInstrs <= 3;
+    return NumInstrs <= 2;
+  }
+  
   // Attempt to estimate the relative costs of predication versus branching.
   float UnpredCost = Probability * NumInstrs;
   UnpredCost += 1.0; // The branch itself
@@ -1216,6 +1230,11 @@
 isProfitableToIfCvt(MachineBasicBlock &TMBB, unsigned NumT,
                     MachineBasicBlock &FMBB, unsigned NumF,
                     float Probability) const {
+  // Use old-style if-conversion heuristics
+  if (OldARMIfConv) {
+    return NumT && NumF && NumT <= 2 && NumF <= 2;
+  }
+
   if (!NumT || !NumF)
     return false;
   





More information about the llvm-commits mailing list