<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Feb 21, 2011, at 10:59 PM, Evan Cheng wrote:</div><blockquote type="cite"><div><font class="Apple-style-span" color="#000000"><br></font>On Feb 21, 2011, at 10:52 PM, Andrew Trick wrote:<br><br><blockquote type="cite">Author: atrick<br></blockquote><blockquote type="cite">Date: Tue Feb 22 00:52:56 2011<br></blockquote><blockquote type="cite">New Revision: 126190<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=126190&view=rev">http://llvm.org/viewvc/llvm-project?rev=126190&view=rev</a><br></blockquote><blockquote type="cite">Log:<br></blockquote><blockquote type="cite">VirtRegRewriter assertion fix.<br></blockquote><blockquote type="cite">Apparently it's ok for multiple operands to "kill" the same register.<br></blockquote><br>It is?<br><br>Evan<br></div></blockquote><div><br></div><div>Prior to the standard spiller, we have:</div><div>  MOV8mr %vreg34<kill>, 1, %noreg, 3, %noreg, %vreg34:sub_8bit<kill>; mem:ST1[%arrayidx833] GR32_ABCD:%vreg34</div><div><br></div><div>Before rewriting we have:</div><div>  %EAX<def> = MOV32rm <fi#0>, 1, %noreg, 0, %noreg; mem:LD4[FixedStack0]</div><div>  MOV8mr %EAX<kill>, 1, %noreg, 3, %noreg, %AL<kill>; mem:ST1[%arrayidx833]</div><div><br></div><div>After rewriting:</div><div>  %EAX<def> = MOV32rm <fi#0>, 1, %noreg, 0, %noreg; mem:LD4[FixedStack0]</div><div>  MOV8mr %EAX, 1, %noreg, 3, %noreg, %AL<kill>; mem:ST1[%arrayidx833]</div><div><br></div><div>It seems valid enough to me for a combination of passes that will hopefully soon be deprecated. I'm honestly not sure yet what the ideal rules should be for subreg kill flags.</div><div><br></div><div>-Andy</div><div><br></div><blockquote type="cite"><div><br><blockquote type="cite">Fixes PR9237.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Added:<br></blockquote><blockquote type="cite">   llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll<br></blockquote><blockquote type="cite">Modified:<br></blockquote><blockquote type="cite">   llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp<br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=126190&r1=126189&r2=126190&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=126190&r1=126189&r2=126190&view=diff</a><br></blockquote><blockquote type="cite">==============================================================================<br></blockquote><blockquote type="cite">--- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original)<br></blockquote><blockquote type="cite">+++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Feb 22 00:52:56 2011<br></blockquote><blockquote type="cite">@@ -478,7 +478,8 @@<br></blockquote><blockquote type="cite">  if (!RegKills[KReg])<br></blockquote><blockquote type="cite">    return;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-  assert(KillOps[KReg] == KillOp && "invalid superreg kill flags");<br></blockquote><blockquote type="cite">+  assert(KillOps[KReg]->getParent() == KillOp->getParent() &&<br></blockquote><blockquote type="cite">+         "invalid superreg kill flags");<br></blockquote><blockquote type="cite">  KillOps[KReg] = NULL;<br></blockquote><blockquote type="cite">  RegKills.reset(KReg);<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">@@ -487,7 +488,8 @@<br></blockquote><blockquote type="cite">  for (const unsigned *SR = TRI->getSubRegisters(KReg); *SR; ++SR) {<br></blockquote><blockquote type="cite">    DEBUG(dbgs() << "  Resurrect subreg " << TRI->getName(*SR) << "\n");<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-    assert(KillOps[*SR] == KillOp && "invalid subreg kill flags");<br></blockquote><blockquote type="cite">+    assert(KillOps[*SR]->getParent() == KillOp->getParent() &&<br></blockquote><blockquote type="cite">+           "invalid subreg kill flags");<br></blockquote><blockquote type="cite">    KillOps[*SR] = NULL;<br></blockquote><blockquote type="cite">    RegKills.reset(*SR);<br></blockquote><blockquote type="cite">  }<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Added: llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll<br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll?rev=126190&view=auto">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll?rev=126190&view=auto</a><br></blockquote><blockquote type="cite">==============================================================================<br></blockquote><blockquote type="cite">--- llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll (added)<br></blockquote><blockquote type="cite">+++ llvm/trunk/test/CodeGen/X86/2011-02-21-VirtRegRewriter-KillSubReg.ll Tue Feb 22 00:52:56 2011<br></blockquote><blockquote type="cite">@@ -0,0 +1,50 @@<br></blockquote><blockquote type="cite">+; RUN: llc < %s -O2 -march=x86 -mtriple=i386-pc-linux-gnu -relocation-model=pic | FileCheck %s<br></blockquote><blockquote type="cite">+; PR9237: Assertion in VirtRegRewriter.cpp, ResurrectConfirmedKill<br></blockquote><blockquote type="cite">+;         `KillOps[*SR] == KillOp && "invalid subreg kill flags"'<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+%t = type { i32 }<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+define i32 @foo(%t* %s) nounwind {<br></blockquote><blockquote type="cite">+entry:<br></blockquote><blockquote type="cite">+  br label %if.then735<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+if.then735:<br></blockquote><blockquote type="cite">+  %call747 = call i32 undef(%t* %s, i8* null, i8* undef, i32 128, i8* undef, i32 516) nounwind<br></blockquote><blockquote type="cite">+  br i1 undef, label %if.then751, label %if.then758<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+if.then751:<br></blockquote><blockquote type="cite">+  unreachable<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+if.then758:<br></blockquote><blockquote type="cite">+  %add761 = add i32 %call747, 4<br></blockquote><blockquote type="cite">+  %add763 = add i32 %add761, %call747<br></blockquote><blockquote type="cite">+  %add.ptr768 = getelementptr inbounds [516 x i8]* null, i32 0, i32 %add761<br></blockquote><blockquote type="cite">+  br i1 undef, label %cond.false783, label %cond.true771<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+cond.true771:<br></blockquote><blockquote type="cite">+  %call782 = call i8* @__memmove_chk(i8* %add.ptr768, i8* undef, i32 %call747, i32 undef)<br></blockquote><blockquote type="cite">+  br label %cond.end791<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+; CHECK: calll __memmove_chk<br></blockquote><blockquote type="cite">+cond.false783:<br></blockquote><blockquote type="cite">+  %call.i1035 = call i8* @__memmove_chk(i8* %add.ptr768, i8* undef, i32 %call747, i32 undef) nounwind<br></blockquote><blockquote type="cite">+  br label %cond.end791<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+cond.end791:<br></blockquote><blockquote type="cite">+  %conv801 = trunc i32 %call747 to i8<br></blockquote><blockquote type="cite">+  %add.ptr822.sum = add i32 %call747, 3<br></blockquote><blockquote type="cite">+  %arrayidx833 = getelementptr inbounds [516 x i8]* null, i32 0, i32 %add.ptr822.sum<br></blockquote><blockquote type="cite">+  store i8 %conv801, i8* %arrayidx833, align 1<br></blockquote><blockquote type="cite">+  %cmp841 = icmp eq i8* undef, null<br></blockquote><blockquote type="cite">+  br i1 %cmp841, label %if.end849, label %if.then843<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+if.then843:<br></blockquote><blockquote type="cite">+  unreachable<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+if.end849:<br></blockquote><blockquote type="cite">+  %call921 = call i32 undef(%t* %s, i8* undef, i8* undef, i32 %add763) nounwind<br></blockquote><blockquote type="cite">+  unreachable<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+declare i8* @__memmove_chk(i8*, i8*, i32, i32) nounwind<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">llvm-commits mailing list<br></blockquote><blockquote type="cite"><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br></blockquote><blockquote type="cite"><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote><br></div></blockquote></div><br></body></html>