<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jul 7, 2011, at 4:33 AM, Carlo Alberto Ferraris wrote:</div><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000">
    Il 07/07/2011 11:14, Cameron Zwarich ha scritto:
    <blockquote class=" cite" id="mid_CE4ADB4B-68E0-4916-A1B4-1851B2B494A6_apple_com" cite="mid:CE4ADB4B-68E0-4916-A1B4-1851B2B494A6@apple.com" type="cite">I haven't read the code in detail, but it looks like
      JumpThreading at least attempts to thread across indirect
      branches. You can either try to fix it or file a bug with your
      test case.<br>
    </blockquote>
    In the source it says "<a href="http://llvm.org/docs/doxygen/html/JumpThreading_8cpp_source.html#l00914">If
      the predecessor is an indirect goto, we can't split the edge.</a>"
    Why would that be the case?<br>
    </div></blockquote><div><br></div><div>Splitting an edge creates a block which executes when leaving a</div><div>specific block to go to a specific successor.  The only way to split an</div><div>indirect goto is to insert code before the jump which checks for a</div><div>specific destination address.  This is very likely to be a pessimization.</div><div><br></div><div>To answer your original question, the current implementation design</div><div>for indirect goto is intentionally based around having a single block</div><div>that terminates in an indirectbr.  Otherwise the CFG of a</div><div>context-threaded interpreter loop becomes inherently O(N^2): there</div><div>are N instruction labels, each of which has approximately N</div><div>predecessors.  We rely on a code-generation optimization, tail</div><div>duplication, to actually restore the context-threading behavior.</div><div><br></div><div>In short, don't look at the IR for whether context-threading is</div><div>happening;  look at the generated code.</div></div><div><br></div><div>John.</div></body></html>