[MachineSinking] Conservatively clear kill flags after coalescing.
This solves the problem of having a kill flag inside a loop with a definition of the register prior to the loop: %vreg368<def> ... Inside loop: %vreg520<def> = COPY %vreg368 %vreg568<def,tied1> = add %vreg341<tied0>, %vreg520<kill> => was coalesced into => %vreg568<def,tied1> = add %vreg341<tied0>, %vreg368<kill> MachineVerifier then complained: *** Bad machine code: Virtual register killed in block, but needed live out. *** The kill flag for %vreg368 is incorrect, and is cleared by this patch. This is similar to the clearing done at the end of MachineSinking::SinkInstruction(). Patch provided by Jonas Paulsson. Reviewed by Quentin Colombet and Juergen Ributzka. llvm-svn: 217427
This commit is contained in:
parent
52dc3c8521
commit
57d315b7c1
|
@ -157,6 +157,11 @@ bool MachineSinking::PerformTrivialForwardCoalescing(MachineInstr *MI,
|
|||
DEBUG(dbgs() << "*** to: " << *MI);
|
||||
MRI->replaceRegWith(DstReg, SrcReg);
|
||||
MI->eraseFromParent();
|
||||
|
||||
// Conservatively, clear any kill flags, since it's possible that they are no
|
||||
// longer correct.
|
||||
MRI->clearKillFlags(SrcReg);
|
||||
|
||||
++NumCoalesces;
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue