[llvm-bugs] [Bug 49925] New: [X86] Faliure to produce LEA from add(trunc(add(x, y)), C)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 11 09:28:46 PDT 2021


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

            Bug ID: 49925
           Summary: [X86] Faliure to produce LEA from add(trunc(add(x,
                    y)), C)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: lebedev.ri at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, pengfei.wang at intel.com,
                    spatel+llvm at rotateright.com

int good(int x, int y) {
    return (x + y) - 31;
}
char bad(int x, int y) {
    return x + y - 31;
}


https://godbolt.org/z/adncTno96

good(int, int): # @good(int, int)
  leal -31(%rdi,%rsi), %eax
  retq
bad(int, int): # @bad(int, int)
  leal (%rdi,%rsi), %eax
  addb $-31, %al
  retq

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

It seems we don't even try to run LEA peephole on that outer i8 add.

-- 
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/20210411/f3099c64/attachment.html>


More information about the llvm-bugs mailing list