<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:spatel+llvm@rotateright.com" title="Sanjay Patel <spatel+llvm@rotateright.com>"> <span class="fn">Sanjay Patel</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - wrong code at -O3 on x86_64-linux-gnu (affecting all clang versions from 2.9 to trunk)"
   href="http://llvm.org/bugs/show_bug.cgi?id=19659">bug 19659</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>DUPLICATE
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - wrong code at -O3 on x86_64-linux-gnu (affecting all clang versions from 2.9 to trunk)"
   href="http://llvm.org/bugs/show_bug.cgi?id=19659#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - wrong code at -O3 on x86_64-linux-gnu (affecting all clang versions from 2.9 to trunk)"
   href="http://llvm.org/bugs/show_bug.cgi?id=19659">bug 19659</a>
              from <span class="vcard"><a class="email" href="mailto:spatel+llvm@rotateright.com" title="Sanjay Patel <spatel+llvm@rotateright.com>"> <span class="fn">Sanjay Patel</span></a>
</span></b>
        <pre>Resolving as a duplicate of <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - IndVarSimplify miscompile"
   href="show_bug.cgi?id=18223">bug 18223</a>.

The IR going into indvars has:
define i32 @main() #0 {
...
; <label>:3                                       ; preds = %12, %.split.us
  %4 = phi i32 [ 0, %.split.us ], [ %13, %12 ]
  %5 = phi i32 [ 0, %.split.us ], [ %13, %12 ]
  %6 = add i32 %5, -1
  %7 = icmp ult i32 %6, %4

Before r209487, indvars/SCEV transforms the icmp ult:
INDVARS: Eliminated comparison:   %7 = icmp ult i32 %6, %4

because both sides of the icmp are SCEVAddRecExprs, and we incorrectly
determine that the comparison is always false.

After r209487, we don't change the icmp and the output is correct for the
reduced IR test case as well as the original C test case.

*** This bug has been marked as a duplicate of <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - IndVarSimplify miscompile"
   href="show_bug.cgi?id=18223">bug 18223</a> ***</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>