<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 --- - range metadata can be ignored" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23848&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=1aL1w7j2gUIbNh9z_5wZ96BM3ELWH2sPAg-4G-6hG7k&s=Rl3z73gSfRP6pYg1dDJSMbm2OEk5m0Cil10mNSA6zdc&e=">23848</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>range metadata can be ignored
          </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>Linux
          </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>pitrou@free.fr
          </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=14474" name="attach_14474" title="IR file reproducing the issue">attachment 14474</a> <a href="attachment.cgi?id=14474&action=edit" title="IR file reproducing the issue">[details]</a></span>
IR file reproducing the issue

If you take the attached IR file and try to optimize it using "opt -O3 -S
shape_is_pos.ll", you will get the following output (i.e. LLVM doesn't realize
the condition is always true):

define i1 @is_positive(i64 %arg) #0 {
entry:
  %result = icmp sgt i64 %arg, -1
  ret i1 %result
}

OTOH if you uncomment the two lines were llvm.assume is called, you get the
following (the return code is properly optimized to true):

define i1 @is_positive(i64 %arg) #0 {
entry:
  %is_pos = icmp sgt i64 %arg, -1
  tail call void @llvm.assume(i1 %is_pos)
  ret i1 true
}


(this is something I stumbled on, in a more complicated form, in Numba;
unfortunately llvm.assume() can also pessimize some of our benchmarks)</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>