[llvm-bugs] [Bug 51784] New: [InstCombine] Failure to fold ctpop(( v & -v ) - 1) -> cttz(v, 0)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 7 09:37:23 PDT 2021


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

            Bug ID: 51784
           Summary: [InstCombine] Failure to fold ctpop(( v & -v ) - 1) ->
                    cttz(v, 0)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: lebedev.ri at gmail.com, llvm-bugs at lists.llvm.org,
                    spatel+llvm at rotateright.com

https://alive2.llvm.org/ce/z/kopg8_

define i8 @src(i8 %0) {
%1:
  %2 = sub i8 0, %0
  %3 = and i8 %2, %0
  %4 = add i8 %3, -1
  %5 = ctpop i8 %4
  ret i8 %5
}
=>
define i8 @tgt(i8 %0) {
%1:
  %2 = cttz i8 %0, 0
  ret i8 %2
}
Transformation seems to be correct!

-- 
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/20210907/a059fb77/attachment-0001.html>


More information about the llvm-bugs mailing list