[llvm-bugs] [Bug 50220] New: Missing DSE for escaped local variable, affects pattern init
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue May 4 11:50:32 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50220
Bug ID: 50220
Summary: Missing DSE for escaped local variable, affects
pattern init
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: rnk at google.com
CC: llvm-bugs at lists.llvm.org
Consider this input:
$ cat t.c
void escape(int*);
int getval(void);
int missed_dse() {
int v1 = 0;
escape(&v1);
int v2 = 55555;
v2 = getval();
escape(&v2);
return v2 + v1;
}
DSE cannot eliminate the dead store of 55555:
$ clang -O2 t.c -o - -S -emit-llvm | grep store
store i32 0, i32* %v1, align 4, !tbaa !3
store i32 55555, i32* %v2, align 4, !tbaa !3
store i32 %call, i32* %v2, align 4, !tbaa !3
Our users noticed that the Chrome binary contains lots of stores of 0xAAAA
constants after enabling -fauto-var-init=pattern, and this pattern stood out.
I attempted to debug why this happens, and basically DSE thinks that the
`getval` call can read the 5555 store from v2, even though it has not been
escaped yet. It will be escaped later in the program, but that hasn't happened
at the point of the call.
--
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/20210504/5f650a62/attachment.html>
More information about the llvm-bugs
mailing list