Fix pr4552. Stack slot coloring with register must take care not to generate illegal ams.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76258 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng
2009-07-17 22:42:51 +00:00
parent b4b53e5c13
commit 59959cd966
2 changed files with 71 additions and 0 deletions

View File

@@ -503,6 +503,15 @@ bool StackSlotColoring::PropagateBackward(MachineBasicBlock::iterator MII,
if (Reg == OldReg) {
if (MO.isImplicit())
return false;
// Abort the use is actually a sub-register def. We don't have enough
// information to figure out if it is really legal.
if (MO.getSubReg() ||
TID.getOpcode() == TargetInstrInfo::EXTRACT_SUBREG ||
TID.getOpcode() == TargetInstrInfo::INSERT_SUBREG ||
TID.getOpcode() == TargetInstrInfo::SUBREG_TO_REG)
return false;
const TargetRegisterClass *RC = getInstrOperandRegClass(TRI, TID, i);
if (RC && !RC->contains(NewReg))
return false;
@@ -561,12 +570,19 @@ bool StackSlotColoring::PropagateForward(MachineBasicBlock::iterator MII,
if (MO.isDef() || MO.isImplicit())
return false;
// Abort the use is actually a sub-register use. We don't have enough
// information to figure out if it is really legal.
if (MO.getSubReg() ||
TID.getOpcode() == TargetInstrInfo::EXTRACT_SUBREG)
return false;
const TargetRegisterClass *RC = getInstrOperandRegClass(TRI, TID, i);
if (RC && !RC->contains(NewReg))
return false;
FoundUse = true;
if (MO.isKill())
FoundKill = true;
Uses.push_back(&MO);
} else if (TRI->regsOverlap(Reg, NewReg) ||
TRI->regsOverlap(Reg, OldReg))