mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 08:17:40 +00:00
Correctly handle <undef> tied uses when rewriting after a split.
This fixes PR10463. A two-address instruction with an <undef> use operand was incorrectly rewritten so the def and use no longer used the same register, violating the tie constraint. Fix this by always rewriting <undef> operands with the register a def operand would use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135885 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -938,15 +938,11 @@ void SplitEditor::rewriteAssigned(bool ExtendRanges) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// <undef> operands don't really read the register, so just assign them to
|
||||
// the complement.
|
||||
if (MO.isUse() && MO.isUndef()) {
|
||||
MO.setReg(Edit->get(0)->reg);
|
||||
continue;
|
||||
}
|
||||
|
||||
// <undef> operands don't really read the register, so it doesn't matter
|
||||
// which register we choose. When the use operand is tied to a def, we must
|
||||
// use the same register as the def, so just do that always.
|
||||
SlotIndex Idx = LIS.getInstructionIndex(MI);
|
||||
if (MO.isDef())
|
||||
if (MO.isDef() || MO.isUndef())
|
||||
Idx = MO.isEarlyClobber() ? Idx.getUseIndex() : Idx.getDefIndex();
|
||||
|
||||
// Rewrite to the mapped register at Idx.
|
||||
|
||||
Reference in New Issue
Block a user