[llvm-bugs] [Bug 28665] New: [InstSimplify] missing analysis for bit manipulation intrinsics

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 22 09:16:37 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28665

            Bug ID: 28665
           Summary: [InstSimplify] missing analysis for bit manipulation
                    intrinsics
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160722/ad66cdb3/attachment.html>


More information about the llvm-bugs mailing list