diff options
author | Cameron Zwarich <zwarich@apple.com> | 2011-10-17 21:54:46 +0000 |
---|---|---|
committer | Cameron Zwarich <zwarich@apple.com> | 2011-10-17 21:54:46 +0000 |
commit | 419eb3668b5cec965a1764f626084d647462a9c6 (patch) | |
tree | 097dd9e72eaef2a4073e8a55dad20e107f981251 /lib/CodeGen/OptimizePHIs.cpp | |
parent | f2ddbcdcb9f3ad8b6e0f68792325449e90563bd4 (diff) | |
download | llvm-419eb3668b5cec965a1764f626084d647462a9c6.tar.gz llvm-419eb3668b5cec965a1764f626084d647462a9c6.tar.bz2 llvm-419eb3668b5cec965a1764f626084d647462a9c6.tar.xz |
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
Diffstat (limited to 'lib/CodeGen/OptimizePHIs.cpp')
-rw-r--r-- | lib/CodeGen/OptimizePHIs.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/OptimizePHIs.cpp b/lib/CodeGen/OptimizePHIs.cpp index c05be130ec..85fa041800 100644 --- a/lib/CodeGen/OptimizePHIs.cpp +++ b/lib/CodeGen/OptimizePHIs.cpp @@ -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; |