summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/OptimizePHIs.cpp
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-10-17 21:54:46 +0000
committerCameron Zwarich <zwarich@apple.com>2011-10-17 21:54:46 +0000
commitd85bc104efe71bce234910a9e15039325e1cd2c8 (patch)
tree870b99db6f34bee2e2d65bc46c57612298fb5fd0 /llvm/lib/CodeGen/OptimizePHIs.cpp
parente7594abd8762ad83148739372d7b1fc1e1541540 (diff)
downloadbcm5719-llvm-d85bc104efe71bce234910a9e15039325e1cd2c8.tar.gz
bcm5719-llvm-d85bc104efe71bce234910a9e15039325e1cd2c8.zip
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. llvm-svn: 142287
Diffstat (limited to 'llvm/lib/CodeGen/OptimizePHIs.cpp')
-rw-r--r--llvm/lib/CodeGen/OptimizePHIs.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/OptimizePHIs.cpp b/llvm/lib/CodeGen/OptimizePHIs.cpp
index c05be130ec6..85fa0418008 100644
--- a/llvm/lib/CodeGen/OptimizePHIs.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud