aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-08-08 18:19:58 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-08-08 18:19:58 +0000
commit0fac6aa076450f5474feb2ec697b7d63d33fa567 (patch)
tree90358463e2a50370ec3afd4a3794df5c88ab6797 /lib
parent9469dd3a717a0dbe45bf668903ed804f27028b0a (diff)
downloadexternal_llvm-0fac6aa076450f5474feb2ec697b7d63d33fa567.zip
external_llvm-0fac6aa076450f5474feb2ec697b7d63d33fa567.tar.gz
external_llvm-0fac6aa076450f5474feb2ec697b7d63d33fa567.tar.bz2
Get the MispredictPenalty from MCSchedModel.
Thanks, Andy! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161507 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/EarlyIfConversion.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/EarlyIfConversion.cpp b/lib/CodeGen/EarlyIfConversion.cpp
index 8adaa6d..0db442a 100644
--- a/lib/CodeGen/EarlyIfConversion.cpp
+++ b/lib/CodeGen/EarlyIfConversion.cpp
@@ -31,6 +31,7 @@
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
+#include "llvm/MC/MCInstrItineraries.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Support/CommandLine.h"
@@ -513,6 +514,7 @@ namespace {
class EarlyIfConverter : public MachineFunctionPass {
const TargetInstrInfo *TII;
const TargetRegisterInfo *TRI;
+ const MCSchedModel *SchedModel;
MachineRegisterInfo *MRI;
MachineDominatorTree *DomTree;
MachineLoopInfo *Loops;
@@ -602,9 +604,6 @@ bool EarlyIfConverter::shouldConvertIf() {
if (!MinInstr)
MinInstr = Traces->getEnsemble(MachineTraceMetrics::TS_MinInstrCount);
- // MCSchedModel doesn't yet provide a misprediction penalty.
- unsigned MispredictPenalty = 10;
-
// Compare the critical path through TBB and FBB. If the difference is
// greater than the branch misprediction penalty, it would never pay to
// if-convert. The triangle/diamond topology guarantees that these traces
@@ -615,8 +614,9 @@ bool EarlyIfConverter::shouldConvertIf() {
unsigned TBBCrit = TBBTrace.getCriticalPath();
unsigned FBBCrit = FBBTrace.getCriticalPath();
unsigned ExtraCrit = TBBCrit > FBBCrit ? TBBCrit-FBBCrit : FBBCrit-TBBCrit;
- if (ExtraCrit >= MispredictPenalty) {
- DEBUG(dbgs() << "Critical path difference too large.\n");
+ if (ExtraCrit >= SchedModel->MispredictPenalty) {
+ DEBUG(dbgs() << "Critical path difference larger than "
+ << SchedModel->MispredictPenalty << ".\n");
return false;
}
return true;
@@ -644,6 +644,7 @@ bool EarlyIfConverter::runOnMachineFunction(MachineFunction &MF) {
<< ((Value*)MF.getFunction())->getName() << '\n');
TII = MF.getTarget().getInstrInfo();
TRI = MF.getTarget().getRegisterInfo();
+ SchedModel = MF.getTarget().getInstrItineraryData()->SchedModel;
MRI = &MF.getRegInfo();
DomTree = &getAnalysis<MachineDominatorTree>();
Loops = getAnalysisIfAvailable<MachineLoopInfo>();