diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-06-22 17:31:01 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-06-22 17:31:01 +0000 |
commit | 834a9cdbb78c1a16c8ceecb018a324a3ba31c365 (patch) | |
tree | a71998d5032ca227226e400bc7ceea0d2bcd29a2 | |
parent | 35ac4b0c45dba62f59ebceddd6cd4605a27857f8 (diff) |
Use MRI::isConstantPhysReg() to check remat feasibility.
Don't depend on LiveIntervals::hasInterval() to determine if a physreg
is reserved and constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159013 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/LiveRangeEdit.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/CodeGen/LiveRangeEdit.cpp b/lib/CodeGen/LiveRangeEdit.cpp index 434388b94e..261d860e01 100644 --- a/lib/CodeGen/LiveRangeEdit.cpp +++ b/lib/CodeGen/LiveRangeEdit.cpp @@ -82,12 +82,16 @@ bool LiveRangeEdit::allUsesAvailableAt(const MachineInstr *OrigMI, UseIdx = UseIdx.getRegSlot(true); for (unsigned i = 0, e = OrigMI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = OrigMI->getOperand(i); - if (!MO.isReg() || !MO.getReg() || MO.isDef()) - continue; - // Reserved registers are OK. - if (MO.isUndef() || !LIS.hasInterval(MO.getReg())) + if (!MO.isReg() || !MO.getReg() || !MO.readsReg()) continue; + // We can't remat physreg uses, unless it is a constant. + if (TargetRegisterInfo::isPhysicalRegister(MO.getReg())) { + if (MRI.isConstantPhysReg(MO.getReg(), VRM->getMachineFunction())) + continue; + return false; + } + LiveInterval &li = LIS.getInterval(MO.getReg()); const VNInfo *OVNI = li.getVNInfoAt(OrigIdx); if (!OVNI) |