https://bugs.llvm.org/show_bug.cgi?id=33604
Bug ID: 33604
Summary: ThinLTO doesn't know about constant return values
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Interprocedural Optimizations
Assignee: unassignedb...@nondot.org
Reporter: dav...@freebsd.org
CC: charles.sater...@gmail.com, davi...@google.com,
joker....@gmail.com, llvm-bugs@lists.llvm.org,
tejohn...@google.com
As Charles, our GSoC student working on ThinLTO was looking for opportunities
to improve ThinLTO, here's something that came to my mind.
I'm not sure whether we want to go in this direction, but it's a start.
$ cat a.c
__attribute__((noinline))
int patatino(void) {
return 47;
}
$ cat b.c
extern int patatino(void);
int main(void) {
return patatino();
}
$ ../clang a.c b.c -flto -fuse-ld=lld -Wl,-save-temps -o patatino-lto
$ objdump -d patatino-lto
[...]
0000000000201190 <main>:
201190: 55 push %rbp
201191: 48 89 e5 mov %rsp,%rbp
201194: 48 83 ec 10 sub $0x10,%rsp
201198: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
20119f: e8 dc ff ff ff callq 201180 <patatino>
2011a4: b8 2f 00 00 00 mov $0x2f,%eax
2011a9: 48 83 c4 10 add $0x10,%rsp
2011ad: 5d pop %rbp
2011ae: c3 retq
With ThinLTO:
$ ../clang a.c b.c -flto=thin -fuse-ld=lld -Wl,-save-temps -o patatino-thin
$ $ objdump -d ./patatino-thin
[...]
0000000000201190 <main>:
201190: 55 push %rbp
201191: 48 89 e5 mov %rsp,%rbp
201194: 48 83 ec 10 sub $0x10,%rsp
201198: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
20119f: e8 dc ff ff ff callq 201180 <patatino>
2011a4: 48 83 c4 10 add $0x10,%rsp
2011a8: 5d pop %rbp
2011a9: c3 retq
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs