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