summaryrefslogtreecommitdiff
path: root/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2012-01-07 03:35:48 +0000
committerEvan Cheng <evan.cheng@apple.com>2012-01-07 03:35:48 +0000
commit70017fb01bba634649f7f3b1dee33c6cda0721d0 (patch)
treeaa2d21a5531b1116e1be829be232e8e451ff56c6 /lib/CodeGen/BranchFolding.cpp
parentacdb4aaf9b1f2edd96163c27bcc4e0557014f51e (diff)
downloadllvm-70017fb01bba634649f7f3b1dee33c6cda0721d0.tar.gz
llvm-70017fb01bba634649f7f3b1dee33c6cda0721d0.tar.bz2
llvm-70017fb01bba634649f7f3b1dee33c6cda0721d0.tar.xz
Revert part of r147716. Looks like x87 instructions kill markers are all messed
up so branch folding pass can't use the scavenger. :-( This doesn't breaks anything currently. It just means targets which do not carefully update kill markers cannot run post-ra scheduler (not new, it has always been the case). We should fix this at some point since it's really hacky. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147719 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/BranchFolding.cpp')
-rw-r--r--lib/CodeGen/BranchFolding.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index 29e8545030..89894c37ee 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -180,7 +180,7 @@ bool BranchFolder::OptimizeFunction(MachineFunction &MF,
TRI = tri;
MMI = mmi;
- RS = new RegScavenger();
+ RS = TRI->requiresRegisterScavenging(MF) ? new RegScavenger() : NULL;
// Fix CFG. The later algorithms expect it to be right.
bool MadeChange = false;
@@ -368,14 +368,16 @@ static unsigned ComputeCommonTailLength(MachineBasicBlock *MBB1,
void BranchFolder::MaintainLiveIns(MachineBasicBlock *CurMBB,
MachineBasicBlock *NewMBB) {
- RS->enterBasicBlock(CurMBB);
- if (!CurMBB->empty())
- RS->forward(prior(CurMBB->end()));
- BitVector RegsLiveAtExit(TRI->getNumRegs());
- RS->getRegsUsed(RegsLiveAtExit, false);
- for (unsigned int i = 0, e = TRI->getNumRegs(); i != e; i++)
- if (RegsLiveAtExit[i])
- NewMBB->addLiveIn(i);
+ if (RS) {
+ RS->enterBasicBlock(CurMBB);
+ if (!CurMBB->empty())
+ RS->forward(prior(CurMBB->end()));
+ BitVector RegsLiveAtExit(TRI->getNumRegs());
+ RS->getRegsUsed(RegsLiveAtExit, false);
+ for (unsigned int i = 0, e = TRI->getNumRegs(); i != e; i++)
+ if (RegsLiveAtExit[i])
+ NewMBB->addLiveIn(i);
+ }
}
/// ReplaceTailWithBranchTo - Delete the instruction OldInst and everything