[llvm-commits] [llvm] r161507 - /llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Wed Aug 8 11:19:58 PDT 2012
Author: stoklund
Date: Wed Aug 8 13:19:58 2012
New Revision: 161507
URL: http://llvm.org/viewvc/llvm-project?rev=161507&view=rev
Log:
Get the MispredictPenalty from MCSchedModel.
Thanks, Andy!
Modified:
llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp
Modified: llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp?rev=161507&r1=161506&r2=161507&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp Wed Aug 8 13:19:58 2012
@@ -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 @@
class EarlyIfConverter : public MachineFunctionPass {
const TargetInstrInfo *TII;
const TargetRegisterInfo *TRI;
+ const MCSchedModel *SchedModel;
MachineRegisterInfo *MRI;
MachineDominatorTree *DomTree;
MachineLoopInfo *Loops;
@@ -602,9 +604,6 @@
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 @@
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 @@
<< ((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>();
More information about the llvm-commits
mailing list