[llvm-bugs] [Bug 33646] New: ThinLTO doesn't apply interprocedural DeadArgumentElimination optimization
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jun 29 10:33:24 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33646
Bug ID: 33646
Summary: ThinLTO doesn't apply interprocedural
DeadArgumentElimination optimization
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Interprocedural Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: charles.saternos at gmail.com
CC: llvm-bugs at lists.llvm.org
LTO will apply the deadargelim pass, but ThinLTO can't apply this optimization
right now.
$ cat a.cc
__attribute__((noinline))
int f(const int *x, int j) {
int k = *x;
return k + 1;
}
__attribute__((noinline))
int g(int *x) {
*x++;
return *x;
}
$ cat b.cc
#include <stdio.h>
extern int f(const int *x, int j);
extern int g(int *x);
int main(void) {
int x = 3;
printf("%d\n", f(&x, x));
g(&x);
printf("%d\n", x);
}
$ ../build/bin/clang++ a.cc b.cc -O3 --for-linker=-mllvm --for-linker=-stats
-flto=thin -fuse-ld=lld -o thin &>&1 | grep deadargelim
# nothing
$ ../build/bin/clang++ a.cc b.cc -O3 --for-linker=-mllvm --for-linker=-stats
-flto -fuse-ld=lld -o lto &>&1 | grep deadargelim
1 deadargelim - Number of unread args removed
1 deadargelim - Number of unused return values removed
--
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/20170629/ad83490e/attachment.html>
More information about the llvm-bugs
mailing list