[llvm-commits] [llvm] r156663 - in /llvm/trunk: lib/Target/Mips/MipsISelDAGToDAG.cpp test/CodeGen/Mips/atomic.ll
Akira Hatanaka
ahatanaka at mips.com
Fri May 11 16:22:18 PDT 2012
Author: ahatanak
Date: Fri May 11 18:22:18 2012
New Revision: 156663
URL: http://llvm.org/viewvc/llvm-project?rev=156663&view=rev
Log:
Do not replace operands of pseudo instructions with register $zero.
Modified:
llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp
llvm/trunk/test/CodeGen/Mips/atomic.ll
Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=156663&r1=156662&r2=156663&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Fri May 11 18:22:18 2012
@@ -213,7 +213,8 @@
MachineInstr *MI = MO.getParent();
// 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;
MO.setReg(ZeroReg);
Modified: llvm/trunk/test/CodeGen/Mips/atomic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/atomic.ll?rev=156663&r1=156662&r2=156663&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/atomic.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/atomic.ll Fri May 11 18:22:18 2012
@@ -242,3 +242,19 @@
; 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.
+ at 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
+}
More information about the llvm-commits
mailing list