summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-11-16 18:44:48 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-11-16 18:44:48 +0000
commit822ddde50d8bb95fecb055b84fe318ffa9708715 (patch)
tree668ee827e0f83defd6bb75e289da7008e0c0e896 /llvm/lib/CodeGen
parent80979b6ea6a3bef6b6e74b78798e2ee1d72b325f (diff)
downloadbcm5719-llvm-822ddde50d8bb95fecb055b84fe318ffa9708715.tar.gz
bcm5719-llvm-822ddde50d8bb95fecb055b84fe318ffa9708715.zip
Disable expensive two-address optimizations at -O0. rdar://10453055
llvm-svn: 144806
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/TwoAddressInstructionPass.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index 7a0fcb5651c..a2e81344d42 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -68,6 +68,7 @@ namespace {
MachineRegisterInfo *MRI;
LiveVariables *LV;
AliasAnalysis *AA;
+ CodeGenOpt::Level OptLevel;
// DistanceMap - Keep track the distance of a MI from the start of the
// current basic block.
@@ -571,6 +572,9 @@ bool
TwoAddressInstructionPass::isProfitableToCommute(unsigned regB, unsigned regC,
MachineInstr *MI, MachineBasicBlock *MBB,
unsigned Dist) {
+ if (OptLevel == CodeGenOpt::None)
+ return false;
+
// Determine if it's profitable to commute this two address instruction. In
// general, we want no uses between this instruction and the definition of
// the two-address register.
@@ -1193,6 +1197,9 @@ TryInstructionTransform(MachineBasicBlock::iterator &mi,
MachineFunction::iterator &mbbi,
unsigned SrcIdx, unsigned DstIdx, unsigned Dist,
SmallPtrSet<MachineInstr*, 8> &Processed) {
+ if (OptLevel == CodeGenOpt::None)
+ return false;
+
MachineInstr &MI = *mi;
const MCInstrDesc &MCID = MI.getDesc();
unsigned regA = MI.getOperand(DstIdx).getReg();
@@ -1388,6 +1395,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
InstrItins = TM.getInstrItineraryData();
LV = getAnalysisIfAvailable<LiveVariables>();
AA = &getAnalysis<AliasAnalysis>();
+ OptLevel = TM.getOptLevel();
bool MadeChange = false;
OpenPOWER on IntegriCloud