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: unassignedb...@nondot.org
Reporter: david.bolvan...@gmail.com
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs