[llvm-commits] [llvm] r161626 - in /llvm/trunk: lib/Target/Mips/MipsISelDAGToDAG.cpp test/CodeGen/Mips/swzero.ll
Jakob Stoklund Olesen
stoklund at 2pi.dk
Thu Aug 9 15:08:24 PDT 2012
Author: stoklund
Date: Thu Aug 9 17:08:24 2012
New Revision: 161626
URL: http://llvm.org/viewvc/llvm-project?rev=161626&view=rev
Log:
Don't modify MO while use_iterator is still pointing to it.
Modified:
llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp
llvm/trunk/test/CodeGen/Mips/swzero.ll
Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=161626&r1=161625&r2=161626&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Thu Aug 9 17:08:24 2012
@@ -242,13 +242,14 @@
// Replace uses with ZeroReg.
for (MachineRegisterInfo::use_iterator U = MRI->use_begin(DstReg),
- E = MRI->use_end(); U != E; ++U) {
+ E = MRI->use_end(); U != E;) {
MachineOperand &MO = U.getOperand();
+ unsigned OpNo = U.getOperandNo();
MachineInstr *MI = MO.getParent();
+ ++U;
// Do not replace if it is a phi's operand or is tied to def operand.
- if (MI->isPHI() || MI->isRegTiedToDefOperand(U.getOperandNo()) ||
- MI->isPseudo())
+ if (MI->isPHI() || MI->isRegTiedToDefOperand(OpNo) || MI->isPseudo())
continue;
MO.setReg(ZeroReg);
Modified: llvm/trunk/test/CodeGen/Mips/swzero.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/swzero.ll?rev=161626&r1=161625&r2=161626&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/swzero.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/swzero.ll Thu Aug 9 17:08:24 2012
@@ -4,6 +4,7 @@
define void @zero_u(%struct.unaligned* nocapture %p) nounwind {
entry:
+; CHECK: swl $zero
; CHECK: swr $zero
%x = getelementptr inbounds %struct.unaligned* %p, i32 0, i32 0
store i32 0, i32* %x, align 1
More information about the llvm-commits
mailing list