summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineCSE.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2012-02-17 00:27:16 +0000
committerLang Hames <lhames@gmail.com>2012-02-17 00:27:16 +0000
commitc2e08db4e5a8e1b3c253fb07c6eb736dfb66fe59 (patch)
tree1dfa9e9067a1530c776e314b56ea664d734edb28 /lib/CodeGen/MachineCSE.cpp
parentaf8b34dae90fd6d146a3b4a83b50751ed21f07c8 (diff)
downloadllvm-c2e08db4e5a8e1b3c253fb07c6eb736dfb66fe59.tar.gz
llvm-c2e08db4e5a8e1b3c253fb07c6eb736dfb66fe59.tar.bz2
llvm-c2e08db4e5a8e1b3c253fb07c6eb736dfb66fe59.tar.xz
Re-enable 150652 and 150654 - Make FPSCR non-reserved, and make MachineCSE bail on reserved registers. This *should* be safe as of r150786.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150769 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineCSE.cpp')
-rw-r--r--lib/CodeGen/MachineCSE.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/CodeGen/MachineCSE.cpp b/lib/CodeGen/MachineCSE.cpp
index 3031d4588b..491a22caf0 100644
--- a/lib/CodeGen/MachineCSE.cpp
+++ b/lib/CodeGen/MachineCSE.cpp
@@ -63,6 +63,8 @@ namespace {
virtual void releaseMemory() {
ScopeMap.clear();
Exps.clear();
+ AllocatableRegs.clear();
+ ReservedRegs.clear();
}
private:
@@ -76,6 +78,8 @@ namespace {
ScopedHTType VNT;
SmallVector<MachineInstr*, 64> Exps;
unsigned CurrVN;
+ BitVector AllocatableRegs;
+ BitVector ReservedRegs;
bool PerformTrivialCoalescing(MachineInstr *MI, MachineBasicBlock *MBB);
bool isPhysDefTriviallyDead(unsigned Reg,
@@ -236,9 +240,9 @@ bool MachineCSE::PhysRegDefsReach(MachineInstr *CSMI, MachineInstr *MI,
return false;
for (unsigned i = 0, e = PhysDefs.size(); i != e; ++i) {
- if (TRI->isInAllocatableClass(PhysDefs[i]))
- // Avoid extending live range of physical registers unless
- // they are unallocatable.
+ if (AllocatableRegs.test(PhysDefs[i]) || ReservedRegs.test(PhysDefs[i]))
+ // Avoid extending live range of physical registers if they are
+ //allocatable or reserved.
return false;
}
CrossMBB = true;
@@ -588,5 +592,7 @@ bool MachineCSE::runOnMachineFunction(MachineFunction &MF) {
MRI = &MF.getRegInfo();
AA = &getAnalysis<AliasAnalysis>();
DT = &getAnalysis<MachineDominatorTree>();
+ AllocatableRegs = TRI->getAllocatableSet(MF);
+ ReservedRegs = TRI->getReservedRegs(MF);
return PerformCSE(DT->getRootNode());
}