summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-09-28 21:57:50 +0000
committerOwen Anderson <resistor@mac.com>2010-09-28 21:57:50 +0000
commita3181e2d79c831c310914b4b3e2786bf914b68ab (patch)
tree749db0b23e708a9641ee2b6ae89c2be7bba444f1 /llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
parent953b1afd5f9bedea3d180c71792dbb285d031a27 (diff)
downloadbcm5719-llvm-a3181e2d79c831c310914b4b3e2786bf914b68ab.tar.gz
bcm5719-llvm-a3181e2d79c831c310914b4b3e2786bf914b68ab.zip
Add a subtarget hook for reporting the misprediction penalty. Use this to provide more precise
cost modeling for if-conversion. Now if only we had a way to estimate the misprediction probability. Adjsut CodeGen/ARM/ifcvt10.ll. The pipeline on Cortex-A8 is long enough that it is still profitable to predicate an ldm, but the shorter pipeline on Cortex-A9 makes it unprofitable. llvm-svn: 114995
Diffstat (limited to 'llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index f92317c322c..c38b89534bf 100644
--- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -1203,7 +1203,8 @@ bool ARMBaseInstrInfo::isProfitableToIfCvt(MachineBasicBlock &MBB,
// Attempt to estimate the relative costs of predication versus branching.
float UnpredCost = Probability * NumInstrs;
- UnpredCost += 2.0; // FIXME: Should model a misprediction cost.
+ UnpredCost += 1.0; // The branch itself
+ UnpredCost += 0.1 * Subtarget.getMispredictionPenalty();
float PredCost = NumInstrs;
@@ -1220,7 +1221,8 @@ isProfitableToIfCvt(MachineBasicBlock &TMBB, unsigned NumT,
// Attempt to estimate the relative costs of predication versus branching.
float UnpredCost = Probability * NumT + (1.0 - Probability) * NumF;
- UnpredCost += 2.0; // FIXME: Should model a misprediction cost.
+ UnpredCost += 1.0; // The branch itself
+ UnpredCost += 0.1 * Subtarget.getMispredictionPenalty();
float PredCost = NumT + NumF;
OpenPOWER on IntegriCloud