Hi,
Here is a simple test on which (I swear!) clang used to perform load
widening.
Not any more. What's happened?
% cat lw.cc
struct S {
int a;
unsigned char x, y, z, w;
};
int foo(S *s) {
if (s->x == 0 && s->y == 0) return 0;
return 1;
}
% clang -O2 -S -o - lw.cc | grep '(%'
cmpb $0, 4(%rdi)
cmpb $0, 5(%rdi)
% gcc -O2 -S -o - lw.cc | grep '(%'
cmpw $0, 4(%rdi)
%
--kcc
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20121123/ec7ea7a4/attachment.html>
On Thu, Nov 22, 2012 at 8:44 PM, Kostya Serebryany <kcc at google.com> wrote:> Hi, > > Here is a simple test on which (I swear!) clang used to perform load > widening. > Not any more. What's happened?clang isn't setting the alignment on the load of "s->x" aggressively enough for the LLVM optimizers to kick in. Granted, even if you do fix that, we still generate completely ridiculous code, but that's a separate issue. -Eli
Possibly Parallel Threads
- [LLVMdev] load widening conflicts with AddressSanitizer
- [LLVMdev] load widening conflicts with AddressSanitizer
- [PATCH] new *br: Show handoff data
- [LLVMdev] load widening conflicts with AddressSanitizer
- [LLVMdev] load widening conflicts with AddressSanitizer