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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to