When deleting a phi cycle after looking through copies, constrain the register

to match its final use.

With this change, all of test-suite compiles for Thumb2 with -verify-coalescing
enabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142287 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Cameron Zwarich 2011-10-17 21:54:46 +00:00
parent f2ddbcdcb9
commit 419eb3668b

View File

@ -165,7 +165,11 @@ bool OptimizePHIs::OptimizeBB(MachineBasicBlock &MBB) {
InstrSet PHIsInCycle;
if (IsSingleValuePHICycle(MI, SingleValReg, PHIsInCycle) &&
SingleValReg != 0) {
MRI->replaceRegWith(MI->getOperand(0).getReg(), SingleValReg);
unsigned OldReg = MI->getOperand(0).getReg();
if (!MRI->constrainRegClass(SingleValReg, MRI->getRegClass(OldReg)))
continue;
MRI->replaceRegWith(OldReg, SingleValReg);
MI->eraseFromParent();
++NumPHICycles;
Changed = true;