<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 --- - [InstSimplify] missing analysis for bit manipulation intrinsics"
   href="https://llvm.org/bugs/show_bug.cgi?id=28665">28665</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[InstSimplify] missing analysis for bit manipulation intrinsics
          </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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>define i1 @ctlz_cmp_false(i32 %a) {
  %x = tail call i32 @llvm.ctlz.i32(i32 %a, i1 false) nounwind readnone
  %cmp = icmp ugt i32 %x, 32
  ret i1 %cmp
}

define i1 @cttz_cmp_false(i32 %a) {
  %x = tail call i32 @llvm.cttz.i32(i32 %a, i1 false) nounwind readnone
  %cmp = icmp ugt i32 %x, 32
  ret i1 %cmp
}

define i1 @ctpop_cmp_false(i32 %a) {
  %x = tail call i32 @llvm.ctpop.i32(i32 %a) nounwind readnone
  %cmp = icmp ugt i32 %x, 32
  ret i1 %cmp
}

declare i32 @llvm.cttz.i32(i32, i1) nounwind readnone
declare i32 @llvm.ctlz.i32(i32, i1) nounwind readnone
declare i32 @llvm.ctpop.i32(i32) nounwind readnone


-----------------------------------------------------------------------------

$ ./opt -instsimplify bitz.ll -S

(doesn't change anything)

Note that this does work:

define i1 @ctlz_cmp_true(i32 %a) {
  %x = tail call i32 @llvm.ctlz.i32(i32 %a, i1 false) nounwind readnone
  %cmp = icmp uge i32 %x, 0
  ret i1 %cmp
}

$ ./opt -instsimplify bitz.ll -S
...
define i1 @ctlz_cmp_true(i32 %a) {
  ret i1 true
}</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>