[llvm-bugs] [Bug 47430] New: Missing fold &a[i] - &a[j] => i - j
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Sep 5 07:34:12 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47430
Bug ID: 47430
Summary: Missing fold &a[i] - &a[j] => i - j
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: llvm-bugs at lists.llvm.org
typedef __SIZE_TYPE__ size_t;
size_t a[64];
size_t f(size_t b, size_t c)
{
return &a[b] - &a[c];
}
Clang:
f(unsigned long, unsigned long): # @f(unsigned long, unsigned long)
sub rdi, rsi
lea rax, [8*rdi]
sar rax, 3
ret
a:
.zero 512
GCC:
f(unsigned long, unsigned long):
mov rax, rdi
sub rax, rsi
ret
a:
.zero 512
https://godbolt.org/z/7M8o5a
--
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/20200905/d3899062/attachment.html>
More information about the llvm-bugs
mailing list