[llvm-bugs] [Bug 50575] New: [InstCombine] remove unnecessary truncate

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 3 11:05:19 PDT 2021


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

            Bug ID: 50575
           Summary: [InstCombine] remove unnecessary truncate
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org

Forking this off from bug 49543 - we can eliminate an intermediate cast in a
sequence like this by using 'ashr' to replicate the signbit: 

define i64 @src(i32 %a0) {
  %a = lshr i32 %a0, 24
  %b = trunc i32 %a to i8
  %c = sext i8 %b to i64
  ret i64 %c
}

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

-- 
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/20210603/d5cda9a9/attachment.html>


More information about the llvm-bugs mailing list