[LLVMbugs] [Bug 20974] New: Performance regression with LTO after gold plugin change in r217458
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Sep 17 05:20:22 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20974
Bug ID: 20974
Summary: Performance regression with LTO after gold plugin
change in r217458
Product: tools
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: gold-plugin
Assignee: unassignedbugs at nondot.org
Reporter: avolkov.intel at gmail.com
CC: llvmbugs at cs.uiuc.edu, rafael.espindola at gmail.com,
zinovy.nis at gmail.com
Classification: Unclassified
After change in r217458 in gold plugin there is a performance regression with
LTO due to symbol do not internalized.
$ cat a.c
extern int x;
void init_x()
{
x = 7;
}
$ cat b.c
#include <stdlib.h>
void init_x();
int x;
int main()
{
x = 0;
init_x();
return rand() % x;
}
On x86 Sandy Bridge processor running
clang -Ofast -flto b.c a.c
Before change here we have optimized remainder calculation:
00000000004005b0 <main>:
4005b0: 50 push %rax
4005b1: e8 da fe ff ff callq 400490 <rand at plt>
4005b6: 48 98 cltq
4005b8: 48 69 c8 93 24 49 92 imul $0xffffffff92492493,%rax,%rcx
4005bf: 48 c1 e9 20 shr $0x20,%rcx
4005c3: 89 c2 mov %eax,%edx
4005c5: 01 ca add %ecx,%edx
4005c7: 89 d1 mov %edx,%ecx
4005c9: c1 e9 1f shr $0x1f,%ecx
4005cc: c1 fa 02 sar $0x2,%edx
4005cf: 01 ca add %ecx,%edx
4005d1: 6b ca 07 imul $0x7,%edx,%ecx
4005d4: 29 c8 sub %ecx,%eax
4005d6: 5a pop %rdx
4005d7: c3 retq
After change remainder calculated through div with 2x drop in performance:
00000000004005b0 <main>:
4005b0: 50 push %rax
4005b1: c7 05 c1 13 00 00 07 movl $0x7,0x13c1(%rip) #
40197c <x>
4005b8: 00 00 00
4005bb: e8 d0 fe ff ff callq 400490 <rand at plt>
4005c0: 99 cltd
4005c1: f7 3d b5 13 00 00 idivl 0x13b5(%rip) # 40197c <x>
4005c7: 89 d0 mov %edx,%eax
4005c9: 5a pop %rdx
4005ca: c3 retq
--
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/20140917/983f44f1/attachment.html>
More information about the llvm-bugs
mailing list