[PATCH] D30934: De-duplicate the two implementations of ARMBaseInstrInfo::isProfitableToIfCvt() [NFC]

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 06:50:56 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL297738: De-duplicate the two implementations of ARMBaseInstrInfo::isProfitableToIfCvt()… (authored by askrobov).

Changed prior to commit:
  https://reviews.llvm.org/D30934?vs=91704&id=91709#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30934

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


Index: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -1789,25 +1789,17 @@
       }
     }
   }
-
-  // Attempt to estimate the relative costs of predication versus branching.
-  // Here we scale up each component of UnpredCost to avoid precision issue when
-  // scaling NumCycles by Probability.
-  const unsigned ScalingUpFactor = 1024;
-  unsigned UnpredCost = Probability.scale(NumCycles * ScalingUpFactor);
-  UnpredCost += ScalingUpFactor; // The branch itself
-  UnpredCost += Subtarget.getMispredictionPenalty() * ScalingUpFactor / 10;
-
-  return (NumCycles + ExtraPredCycles) * ScalingUpFactor <= UnpredCost;
+  return isProfitableToIfCvt(MBB, NumCycles, ExtraPredCycles,
+                             MBB, 0, 0, Probability);
 }
 
 bool ARMBaseInstrInfo::
-isProfitableToIfCvt(MachineBasicBlock &TMBB,
+isProfitableToIfCvt(MachineBasicBlock &,
                     unsigned TCycles, unsigned TExtra,
-                    MachineBasicBlock &FMBB,
+                    MachineBasicBlock &,
                     unsigned FCycles, unsigned FExtra,
                     BranchProbability Probability) const {
-  if (!TCycles || !FCycles)
+  if (!TCycles)
     return false;
 
   // Attempt to estimate the relative costs of predication versus branching.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30934.91709.patch
Type: text/x-patch
Size: 1434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170314/e0ed189c/attachment.bin>


More information about the llvm-commits mailing list