-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Closed
Labels
Description
llvm-bolt crashes when optimizing clang binary built with -DLLVM_BUILD_TYPE=RelWithDebInfo
. Stacktrace is included below:
BOLT-INFO: shared object or position-independent executable detected
BOLT-INFO: Target architecture: x86_64
BOLT-INFO: BOLT version: 3f028c02ba6a24b7230fd5907a2b7ba076664a8b
BOLT-INFO: first alloc address is 0x0
BOLT-INFO: enabling relocation mode
BOLT-INFO: enabling lite mode
BOLT-WARNING: Failed to analyze 4027 relocations
BOLT-INFO: pre-processing profile using YAML profile reader
BOLT-INFO: forcing -jump-tables=move as PIC jump table was detected in function _ZN5clang13TreeTransformIN12_GLOBAL__N_120TemplateInstantiatorEE25TransformCXXNamedCastExprEPNS_16CXXNamedCastExprE.__uniq.55632760368638704870153814335850836202/1(*2)
BOLT-WARNING: 2 collisions detected while hashing binary objects. Use -v=1 to see the list.
BOLT-INFO: 10328 out of 137230 functions in the binary (7.5%) have non-empty execution profile
BOLT-INFO: 504 functions with profile could not be optimized
BOLT-INFO: the input contains 7820 (dynamic count : 475973) opportunities for macro-fusion optimization. Will fix instances on a hot path.
BOLT-INFO: 670206 instructions were shortened
BOLT-INFO: removed 1673 empty blocks
BOLT-INFO: ICF folded 733 out of 137545 functions in 4 passes. 1 functions had jump tables.
BOLT-INFO: Removing all identical functions will save 114.34 KB of code space. Folded functions were called 137574 times based on profile.
BOLT-INFO: simplified 178 out of 4471 loads from a statically computed address.
BOLT-INFO: dynamic loads simplified: 4828
BOLT-INFO: dynamic loads found: 86157
BOLT-INFO: inlined 1193 calls at 68 call sites in 2 iteration(s). Change in binary size: 113 bytes.
BOLT-INFO: 9050 PLT calls in the binary were optimized.
BOLT-INFO: basic block reordering modified layout of 7061 (5.16%) functions
BOLT-INFO: UCE removed 1 blocks and 7 bytes of code.
BOLT-INFO: splitting separates 11625846 hot bytes from 7895664 cold bytes (59.55% of split functions is hot).
BOLT-INFO: 176 Functions were reordered by LoopInversionPass
BOLT-INFO: hfsort+ reduced the number of chains from 10098 to 1125
BOLT-INFO: program-wide dynostats after all optimizations before SCTC and FOP:
26368242 : executed forward branches
3451088 : taken forward branches
5197677 : executed backward branches
2926258 : taken backward branches
1636564 : executed unconditional branches
2141777 : all function calls
730319 : indirect calls
351324 : PLT calls
214479309 : executed instructions
53996055 : executed load instructions
27601931 : executed store instructions
289730 : taken jump table branches
0 : taken unknown indirect branches
33202483 : total branches
8013910 : taken branches
25188573 : non-taken conditional branches
6377346 : taken conditional branches
31565919 : all conditional branches
25066576 : executed forward branches (-4.9%)
1517139 : taken forward branches (-56.0%)
6499343 : executed backward branches (+25.0%)
2791736 : taken backward branches (-4.6%)
1155686 : executed unconditional branches (-29.4%)
1789661 : all function calls (-16.4%)
730319 : indirect calls (=)
0 : PLT calls (-100.0%)
212861320 : executed instructions (-0.8%)
53991570 : executed load instructions (-0.0%)
27601932 : executed store instructions (+0.0%)
289730 : taken jump table branches (=)
0 : taken unknown indirect branches (=)
32721605 : total branches (-1.4%)
5464561 : taken branches (-31.8%)
27257044 : non-taken conditional branches (+8.2%)
4308875 : taken conditional branches (-32.4%)
31565919 : all conditional branches (=)
BOLT-INFO: SCTC: patched 27 tail calls (25 forward) tail calls (2 backward) from a total of 29 while removing 2 double jumps and removing 21 basic blocks totalling 105 bytes of code. CTCs total execution count is 1298 and the number of times CTCs are taken is 1269.
#0 0x0000000000f5b863 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (DIR/source/llvm-project/relwithdeb/stage1/install/bin/llvm-bolt+0xf5b863)
#1 0x0000000000f597dc llvm::sys::RunSignalHandlers() (DIR/source/llvm-project/relwithdeb/stage1/install/bin/llvm-bolt+0xf597dc)
#2 0x0000000000f5bcea SignalHandler(int) Signals.cpp:0:0
#3 0x00007f23fd456200 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12200)
#4 0x0000000001ba352b llvm::bolt::BinaryContext::addDebugFilenameToUnit(unsigned int, unsigned int, unsigned int) (DIR/source/llvm-project/relwithdeb/stage1/install/bin/llvm-bolt+0x1ba352b)
#5 0x0000000001bb394d (anonymous namespace)::BinaryEmitter::emitFunctionBody(llvm::bolt::BinaryFunction&, bool, bool) BinaryEmitter.cpp:0:0
#6 0x0000000001bb4895 (anonymous namespace)::BinaryEmitter::emitFunction(llvm::bolt::BinaryFunction&, bool) BinaryEmitter.cpp:0:0
#7 0x0000000001bb428b (anonymous namespace)::BinaryEmitter::emitFunctions()::$_3::operator()(std::vector<llvm::bolt::BinaryFunction*, std::allocator<llvm::bolt::BinaryFunction*>> const&) const BinaryEmitter.cpp:0:0
#8 0x0000000001bb2472 llvm::bolt::emitBinaryContext(llvm::MCStreamer&, llvm::bolt::BinaryContext&, llvm::StringRef) (DIR/source/llvm-project/relwithdeb/stage1/install/bin/llvm-bolt+0x1bb2472)
#9 0x0000000000fbd074 llvm::bolt::RewriteInstance::emitAndLink() (DIR/source/llvm-project/relwithdeb/stage1/install/bin/llvm-bolt+0xfbd074)
#10 0x0000000000fb54d0 llvm::bolt::RewriteInstance::run() (DIR/source/llvm-project/relwithdeb/stage1/install/bin/llvm-bolt+0xfb54d0)
#11 0x0000000000b31a6d main (DIR/source/llvm-project/relwithdeb/stage1/install/bin/llvm-bolt+0xb31a6d)
#12 0x00007f23fceac7fd __libc_start_main ./csu/../csu/libc-start.c:332:16
#13 0x0000000000b2fa0a _start (DIR/source/llvm-project/relwithdeb/stage1/install/bin/llvm-bolt+0xb2fa0a)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: DIR/source/llvm-project/relwithdeb/stage1/install/bin/llvm-bolt DIR/source/llvm-project/relwithdeb/pgo-labels/build/bin/clang-15 -o pgo-labels/build/bin/clang-15-bolt -b pgo-labels-compiler.yaml -reorder-blocks=ext-tsp -reorder-functions=hfsort+ -split-functions -update-debug-sections -split-all-cold -dyno-stats -icf=1 -use-gnu-stack -inline-small-functions -simplify-rodata-loads -plt=hot
Command terminated by signal 11
Command being timed: "DIR/source/llvm-project/relwithdeb/stage1/install/bin/llvm-bolt DIR/source/llvm-project/relwithdeb/pgo-labels/build/bin/clang-15 -o pgo-labels/build/bin/clang-15-bolt -b pgo-labels-compiler.yaml -reorder-blocks=ext-tsp -reorder-functions=hfsort+ -split-functions -update-debug-sections -split-all-cold -dyno-stats -icf=1 -use-gnu-stack -inline-small-functions -simplify-rodata-loads -plt=hot”