[llvm-bugs] [Bug 49543] New: [InstCombine] Failure to fold sext(trunc(ashr(x, bw-1)) -> sext(ashr(x, bw-1)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 11 10:17:46 PST 2021


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

            Bug ID: 49543
           Summary: [InstCombine] Failure to fold sext(trunc(ashr(x,bw-1))
                    -> sext(ashr(x,bw-1)
           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,
                    nikita.ppv at gmail.com, spatel+llvm at rotateright.com

Alive2: https://alive2.llvm.org/ce/z/A3FMem

define i64 @src(i32 %a0) {
  %a = ashr i32 %a0, 16 ; all valid 16 -> 31
  %b = trunc i32 %a to i16
  %c = sext i16 %b to i64
  ret i64 %c
}

define i64 @tgt(i32 %a0) {
  %a = ashr i32 %a0, 16
  %c = sext i32 %a to i64
  ret i64 %c
}

https://c.godbolt.org/z/zh7ffM

-- 
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/20210311/38c0d7e3/attachment.html>


More information about the llvm-bugs mailing list