<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 2:05 AM, Carlo Alberto Ferraris wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
  

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  
  <div bgcolor="#FFFFFF" text="#000000">
    Consider this IR fragment produced after -O3:<br>
    <blockquote type="cite"><tt>%7:<br>
        %8 = phi i8* [ blockaddress(@0, %19), %19 ], [ %12, %11 ]<br>
        %9 = phi i32 [ %20, %19 ], [ 0, %11 ]<br>
        indirectbr i8* %8, [label %4, label %19]<br>
        <br>
        %19:</tt>
      <tt><br>
        %20 = add nsw i32 %9, 1<br>
        %21 = icmp eq i32 %9, 9999<br>
        br i1 %21, label %16, label %7</tt></blockquote>
    the br in %19 should be optimized to branch directly to itself
    rather than going back to %7 (note that the arg %8 to the indirectbr
    will always be the address of %19 when coming from %19).<br>
    Is this a known missed optimization?<br></div></blockquote></div><br><div>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.</div><div><br></div><div>Cameron</div></body></html>