Fix PR2289: vr defined by multiple implicit_def as result of coalescing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51648 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2008-05-28 17:40:10 +00:00
parent 33d3d4ad40
commit d77d4f98fb
2 changed files with 19 additions and 6 deletions

View File

@ -751,7 +751,7 @@ bool SimpleRegisterCoalescing::CanCoalesceWithImpDef(MachineInstr *CopyMI,
/// 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 @@ void SimpleRegisterCoalescing::RemoveCopiesFromValNo(LiveInterval &li,
++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 @@ void SimpleRegisterCoalescing::RemoveCopiesFromValNo(LiveInterval &li,
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();
}
}
}

View File

@ -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)