[llvm-commits] [llvm] r51648 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2008-05-28-CoalescerBug.ll
Evan Cheng
evan.cheng at apple.com
Wed May 28 10:40:35 PDT 2008
Author: evancheng
Date: Wed May 28 12:40:10 2008
New Revision: 51648
URL: http://llvm.org/viewvc/llvm-project?rev=51648&view=rev
Log:
Fix PR2289: vr defined by multiple implicit_def as result of coalescing.
Added:
llvm/trunk/test/CodeGen/X86/2008-05-28-CoalescerBug.ll
Modified:
llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=51648&r1=51647&r2=51648&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed May 28 12:40:10 2008
@@ -751,7 +751,7 @@
/// identity copies so they will be removed.
void SimpleRegisterCoalescing::RemoveCopiesFromValNo(LiveInterval &li,
VNInfo *VNI) {
- MachineInstr *ImpDef = NULL;
+ SmallVector<MachineInstr*, 4> ImpDefs;
MachineOperand *LastUse = NULL;
unsigned LastUseIdx = li_->getUseIndex(VNI->def);
for (MachineRegisterInfo::reg_iterator RI = mri_->reg_begin(li.reg),
@@ -761,8 +761,7 @@
++RI;
if (MO->isDef()) {
if (MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) {
- assert(!ImpDef && "Multiple implicit_def defining same register?");
- ImpDef = MI;
+ ImpDefs.push_back(MI);
}
continue;
}
@@ -790,9 +789,13 @@
if (LastUse)
LastUse->setIsKill();
else {
- // Remove dead implicit_def.
- li_->RemoveMachineInstrFromMaps(ImpDef);
- ImpDef->eraseFromParent();
+ // Remove dead implicit_def's.
+ while (!ImpDefs.empty()) {
+ MachineInstr *ImpDef = ImpDefs.back();
+ ImpDefs.pop_back();
+ li_->RemoveMachineInstrFromMaps(ImpDef);
+ ImpDef->eraseFromParent();
+ }
}
}
Added: llvm/trunk/test/CodeGen/X86/2008-05-28-CoalescerBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-05-28-CoalescerBug.ll?rev=51648&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2008-05-28-CoalescerBug.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2008-05-28-CoalescerBug.ll Wed May 28 12:40:10 2008
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | llc -mtriple=x86_64-unknown-linux-gnu
+; PR2289
+
+define void @_ada_ca11001() {
+entry:
+ %tmp59 = call i16 @ca11001_0__cartesian_assign( i8 zeroext 0, i8 zeroext 0, i16 undef ) ; <i16> [#uses=0]
+ unreachable
+}
+
+declare i16 @ca11001_0__cartesian_assign(i8 zeroext , i8 zeroext , i16)
More information about the llvm-commits
mailing list