<div>Chris, you are too quick!</div>
<div> </div>
<div>Thanks. (Or the response in the bug report.)<br></div>
<div>-John<br></div>
<div class="gmail_quote">On Wed, Nov 17, 2010 at 3:29 PM, John Thompson <span dir="ltr"><<a href="mailto:john.thompson.jtsoftware@gmail.com">john.thompson.jtsoftware@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>From my comment to the bug:</div>
<div> </div>
<div>It looks like a problem with the back end.</div>
<div> </div>
<div>I reduced the test case to:</div>
<div> </div>
<div>void func()<br>{<br>  unsigned int src = 0, dst = 0;<br>  static const unsigned long flagmask = 1;<br>  unsigned long flags = 1;<br>  unsigned long newflags = ~(0UL);</div>
<div>  asm (<br>    "pushfq \n"<br>    "andq %2, (%%rsp) \n"<br>    "orq  %3, (%%rsp) \n"<br>    "popfq \n"<br>    "addb %4, %1 \n"<br>    "pushfq \n"<br>    "popq %0 \n"<br>
       :<br>          "=&rm" (newflags) ,<br>          "=&rm" (*(unsigned char *)&dst)<br>       :<br>          "i" (~flagmask) ,<br>          "r" (flags & flagmask) ,<br>
          "r" (*(unsigned char *)&src) ,<br>          "1" (*(unsigned char *)&dst)<br>       : "cc");<br>}</div>
<div> </div>
<div>The constraints involved in the problem are index 1 and 5, which we see do match types in the above code.</div>
<div> </div>
<div>This change seems to fix it:</div>
<div> </div>
<div>Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp<br>===================================================================<br>--- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (revision 119175)<br>+++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (working copy)<br>
@@ -5545,9 +5545,6 @@<br>     // If this is an input or an indirect output, process the call argument.<br>     // BasicBlocks are labels, currently appearing only in asm's.<br>     if (OpInfo.CallOperandVal) {<br>-      // Strip bitcasts, if any.  This mostly comes up for functions.<br>
-      OpInfo.CallOperandVal = OpInfo.CallOperandVal->stripPointerCasts();<br>-<br>       if (const BasicBlock *BB = dyn_cast<BasicBlock>(OpInfo.CallOperandVal)) {<br>         OpInfo.CallOperand = DAG.getBasicBlock(FuncInfo.MBBMap[BB]);<br>
       } else {</div>
<div> </div>
<div>The removed code apparently was stripping the pointer cast.  I don't know the original reason for it.</div>
<div> </div>
<div>I ran the LLVM regression tests, test suite, and gcc tests, with no differences.  Does this seem like the correct fix?  If so, let me know and I'll check this in.  Or was there a reason for the cast stripping?</div>

<div> </div>
<div>It doesn't appear to be related to my inline asm work.</div>
<div> </div>
<div>-John<br><br clear="all"><br>-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com" target="_blank">John.Thompson.JTSoftware@gmail.com</a><br><br></div></blockquote></div><br><br clear="all"><br>
-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com">John.Thompson.JTSoftware@gmail.com</a><br><br>