summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-08-07 07:14:14 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-08-07 07:14:14 +0000
commitb1aeeed03e2e8960d156c3ab164374f3f0ae60aa (patch)
treed9f911ebaab7b244c619e2aac11b683098cda380 /llvm
parente26a285c8fa6da40454d55a475689aa106abe8ff (diff)
downloadbcm5719-llvm-b1aeeed03e2e8960d156c3ab164374f3f0ae60aa.tar.gz
bcm5719-llvm-b1aeeed03e2e8960d156c3ab164374f3f0ae60aa.zip
Another coalescer bug. When a dead copy is eliminated, transfer the kill to a def of the exact register rather than a super-register.
llvm-svn: 78376
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp11
-rw-r--r--llvm/test/CodeGen/Thumb2/2009-08-07-CoalescerBug.ll16
2 files changed, 22 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
index b57bbc2ca5e..5688d8d6cff 100644
--- a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
@@ -888,12 +888,13 @@ static void PropagateDeadness(LiveInterval &li, MachineInstr *CopyMI,
MachineInstr *DefMI =
li_->getInstructionFromIndex(li_->getDefIndex(LRStart));
if (DefMI && DefMI != CopyMI) {
- int DeadIdx = DefMI->findRegisterDefOperandIdx(li.reg, false, tri_);
- if (DeadIdx != -1) {
+ int DeadIdx = DefMI->findRegisterDefOperandIdx(li.reg, false);
+ if (DeadIdx != -1)
DefMI->getOperand(DeadIdx).setIsDead();
- // A dead def should have a single cycle interval.
- ++LRStart;
- }
+ else
+ DefMI->addOperand(MachineOperand::CreateReg(li.reg,
+ true, true, false, true));
+ ++LRStart;
}
}
diff --git a/llvm/test/CodeGen/Thumb2/2009-08-07-CoalescerBug.ll b/llvm/test/CodeGen/Thumb2/2009-08-07-CoalescerBug.ll
new file mode 100644
index 00000000000..4cd5b1e365c
--- /dev/null
+++ b/llvm/test/CodeGen/Thumb2/2009-08-07-CoalescerBug.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -mtriple=armv7-eabi -mattr=+vfp2
+; PR4686
+
+ %a = type { i32 (...)** }
+ %b = type { %a }
+ %c = type { float, float, float, float }
+
+declare arm_aapcs_vfpcc float @bar(%c*)
+
+define arm_aapcs_vfpcc void @foo(%b* %x, %c* %y) {
+entry:
+ %0 = call arm_aapcs_vfpcc float @bar(%c* %y) ; <float> [#uses=0]
+ %1 = fadd float undef, undef ; <float> [#uses=1]
+ store float %1, float* undef, align 8
+ ret void
+}
OpenPOWER on IntegriCloud