[llvm-bugs] [Bug 40241] New: Very slow compilation at -O2 but not -O3 (long time spent in Virtual Register Rewriter)
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jan 7 00:12:33 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40241
Bug ID: 40241
Summary: Very slow compilation at -O2 but not -O3 (long time
spent in Virtual Register Rewriter)
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: tomasz.sniatowski+llvm at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Created attachment 21296
--> https://bugs.llvm.org/attachment.cgi?id=21296&action=edit
preprocessed source (gzipped to fit)
Building parts of v8 with non-default compiler flags for that project (-O / -g
levels tweaked), I get:
$ time ../../third_party/llvm-build/Release+Asserts/bin/clang++
-DV8_EMBEDDED_BUILTINS -DV8_TARGET_ARCH_ARM -I../.. -I../../v8
-Iclang_x86_v8_arm/gen/v8 -fPIC -m32 -g2 -O2 -std=c++14 -fno-exceptions
-c ../../v8/src/builtins/setup-builtins-internal.cc -o foo.o
real 18m53.837s
user 18m38.992s
sys 0m14.452s
With -O3 or -O below -O2, the build is fast (7-14s on the same machine).
Dropping the symbol level to below -g2, or dropping -fno-exceptions / -fPIC
also makes the build fast.
I'm attaching the preprocessed source that reproduces the issue on a recent
trunk )cdc28a6f803270bc24866026344cd100584ec118 / 350491) as follows:
$ clang++ -fPIC -m32 -g2 -O2 -std=c++14 -fno-exceptions -c
setup-builtins-internal.ii -o foo.o
It's large because it's a perf issue and not a crash so the minimization tools
aren't immediately useful. It is at least somewhat minimized from the original
issue which happened in a jumbo (unity build) compile, where the unit
containing this source took over *50* minutes to build in -O2 (and 30-ish
seconds in -O3).
Notably -ftime-reports shows most of the time is spent in Virtual Register
Rewriter
===-------------------------------------------------------------------------===
... Pass execution timing report ...
===-------------------------------------------------------------------------===
Total Execution Time: 1126.7400 seconds (1127.1255 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- ---
Name ---
1023.2560 ( 92.0%) 3.3200 ( 23.5%) 1026.5760 ( 91.1%) 1026.6591 ( 91.1%)
Virtual Register Rewriter
32.5960 ( 2.9%) 10.2840 ( 72.8%) 42.8800 ( 3.8%) 43.1881 ( 3.8%) X86
Assembly Printer
37.9080 ( 3.4%) 0.2120 ( 1.5%) 38.1200 ( 3.4%) 38.1153 ( 3.4%)
Greedy Register Allocator
--
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/20190107/f73a37b1/attachment.html>
More information about the llvm-bugs
mailing list