<html>
    <head>
      <base href="https://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 --- - [ScalarEvolution] createNodeForGEP over-optimistic about preserving nsw"
   href="https://llvm.org/bugs/show_bug.cgi?id=23527">23527</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ScalarEvolution] createNodeForGEP over-optimistic about preserving nsw
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>Global Analyses
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>wujingyue@gmail.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>[Copied from llvmdev@]

I was looking at ScalarEvolution::createNodeForGEP
(<a href="http://llvm.org/docs/doxygen/html/ScalarEvolution_8cpp_source.html#l03702">http://llvm.org/docs/doxygen/html/ScalarEvolution_8cpp_source.html#l03702</a>),
and noticed that the code that applies nsw flags to the resultant SCEV is
inconsistent with the comment. 

While the comment says

03709   // Don't blindly transfer the inbounds flag from the GEP instruction to
the
03710   // Add expression, because the Instruction may be guarded by control
flow
03711   // and the no-overflow bits may not be valid for the expression in any
03712   // context.
03713   SCEV::NoWrapFlags Wrap = GEP->isInBounds() ? SCEV::FlagNSW :
SCEV::FlagAnyWrap;

the code still transfers nsw to LocalOffset and BaseS+TotalOffset.</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>