<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - SCEV createNodeForPHI is too optimistic about NSW."
   href="http://llvm.org/bugs/show_bug.cgi?id=17452">17452</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SCEV createNodeForPHI is too optimistic about NSW.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>atrick@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11329" name="attach_11329" title="Unit test">attachment 11329</a> <a href="attachment.cgi?id=11329&action=edit" title="Unit test">[details]</a></span>
Unit test

SCEV::createNodeForPhi flags an AddRec expression as NSW if the value on the
backedge is flagged nsw. It disregards whether the value has the same form as
the expression, or is merely a subexression as in:

        %i.0 = phi i32 [ 0, %pre ], [ %tmp3, %loop ]
        %tmp2 = add i32 %i.0, 1
        %tmp3 = add nsw i32 %tmp2, 1
        %check = icmp slt i32 %i.0, %N

A unit test is attached. It could be appended to nsw.ll.

I believe it would be sufficient to test if one of the BEValue's operands is
the PHINode before propagating NSW without losing any important cases.</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>