mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Do not replace operands of pseudo instructions with register $zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156663 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -213,7 +213,8 @@ bool MipsDAGToDAGISel::ReplaceUsesWithZeroReg(MachineRegisterInfo *MRI,
|
|||||||
MachineInstr *MI = MO.getParent();
|
MachineInstr *MI = MO.getParent();
|
||||||
|
|
||||||
// Do not replace if it is a phi's operand or is tied to def operand.
|
// Do not replace if it is a phi's operand or is tied to def operand.
|
||||||
if (MI->isPHI() || MI->isRegTiedToDefOperand(U.getOperandNo()))
|
if (MI->isPHI() || MI->isRegTiedToDefOperand(U.getOperandNo()) ||
|
||||||
|
MI->isPseudo())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MO.setReg(ZeroReg);
|
MO.setReg(ZeroReg);
|
||||||
|
@ -242,3 +242,19 @@ entry:
|
|||||||
; CHECK: sync 0
|
; CHECK: sync 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; make sure that this assertion in
|
||||||
|
; TwoAddressInstructionPass::TryInstructionTransform does not fail:
|
||||||
|
;
|
||||||
|
; line 1203: assert(TargetRegisterInfo::isVirtualRegister(regB) &&
|
||||||
|
;
|
||||||
|
; it failed when MipsDAGToDAGISel::ReplaceUsesWithZeroReg replaced an
|
||||||
|
; operand of an atomic instruction with register $zero.
|
||||||
|
@a = external global i32
|
||||||
|
|
||||||
|
define i32 @zeroreg() nounwind {
|
||||||
|
entry:
|
||||||
|
%0 = cmpxchg i32* @a, i32 1, i32 0 seq_cst
|
||||||
|
%1 = icmp eq i32 %0, 1
|
||||||
|
%conv = zext i1 %1 to i32
|
||||||
|
ret i32 %conv
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user