[llvm-bugs] [Bug 50074] New: DSE fails to remove/fold stores
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Apr 22 03:54:28 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50074
Bug ID: 50074
Summary: DSE fails to remove/fold stores
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
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
void dse_fold(unsigned char* p, unsigned char* q, int i){
p[i]=0;
q[i]=0;
// ...
p[i]++;
}
void dse_fold2(unsigned char* p, unsigned char* q, int i){
p[i]=0;
q[i]=0;
// ...
p[i] = 1;
}
void dse_fold3(unsigned char* p, unsigned char* q, int i){
p[i]=0;
q[i]=0;
// ...
p[i] += 100;
}
LLVM -O3:
dse_fold(unsigned char*, unsigned char*, int): #
@dse_fold(unsigned char*, unsigned char*, int)
movsxd rax, edx
mov byte ptr [rdi + rax], 0
mov byte ptr [rsi + rax], 0
add byte ptr [rdi + rax], 1
ret
dse_fold2(unsigned char*, unsigned char*, int): #
@dse_fold2(unsigned char*, unsigned char*, int)
movsxd rax, edx
mov byte ptr [rsi + rax], 0
mov byte ptr [rdi + rax], 1
ret
dse_fold3(unsigned char*, unsigned char*, int): #
@dse_fold3(unsigned char*, unsigned char*, int)
movsxd rax, edx
mov byte ptr [rdi + rax], 0
mov byte ptr [rsi + rax], 0
add byte ptr [rdi + rax], 100
ret
GCC -O3:
dse_fold(unsigned char*, unsigned char*, int):
movsx rdx, edx
mov BYTE PTR [rsi+rdx], 0
mov BYTE PTR [rdi+rdx], 1
ret
dse_fold2(unsigned char*, unsigned char*, int):
movsx rdx, edx
mov BYTE PTR [rsi+rdx], 0
mov BYTE PTR [rdi+rdx], 1
ret
dse_fold3(unsigned char*, unsigned char*, int):
movsx rdx, edx
mov BYTE PTR [rsi+rdx], 0
mov BYTE PTR [rdi+rdx], 100
ret
https://godbolt.org/z/7bbrs6P5M
--
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/20210422/adb8652f/attachment.html>
More information about the llvm-bugs
mailing list