xref: /llvm-project/bolt/test/runtime/pie-exceptions-split.test (revision 777e268b8168b326db54ecacb62733ee926bb781)
1*777e268bSElvina Yakubova## Check that BOLT successfully splits C++ exception-handling code for
2*777e268bSElvina Yakubova## PIEs or shared objects.
3*777e268bSElvina Yakubova
4*777e268bSElvina YakubovaREQUIRES: system-linux,bolt-runtime
5*777e268bSElvina Yakubova
6*777e268bSElvina YakubovaRUN: %clangxx %cxxflags -pie -fPIC %p/Inputs/exceptions_split.cpp -Wl,-q -o %t
7*777e268bSElvina YakubovaRUN: llvm-bolt %t -o %t.instr --instrument --instrumentation-file=%t.fdata
8*777e268bSElvina Yakubova
9*777e268bSElvina Yakubova## Record profile with invocation that does not throw exceptions.
10*777e268bSElvina YakubovaRUN: %t.instr
11*777e268bSElvina Yakubova
12*777e268bSElvina YakubovaRUN: llvm-bolt %t -o %t.bolt --data %t.fdata --reorder-blocks=ext-tsp \
13*777e268bSElvina YakubovaRUN:   --split-functions --split-eh --print-after-lowering \
14*777e268bSElvina YakubovaRUN:   --print-only=main 2>&1 | FileCheck %s
15*777e268bSElvina Yakubova
16*777e268bSElvina Yakubova## All calls to printf() should be from exception handling code that was
17*777e268bSElvina Yakubova## recorded as cold during the profile collection run. Check that the calls
18*777e268bSElvina Yakubova## are placed after the split point.
19*777e268bSElvina YakubovaCHECK-NOT: printf
20*777e268bSElvina YakubovaCHECK: HOT-COLD SPLIT POINT
21*777e268bSElvina YakubovaCHECK:     printf
22*777e268bSElvina Yakubova
23*777e268bSElvina Yakubova## Verify the output still executes correctly when the exception path is being
24*777e268bSElvina Yakubova## taken.
25*777e268bSElvina YakubovaRUN: %t.bolt arg1 arg2 arg3 2>&1 | FileCheck --check-prefix=CHECK-BOLTED %s
26*777e268bSElvina Yakubova
27*777e268bSElvina YakubovaCHECK-BOLTED:      catch 2
28*777e268bSElvina YakubovaCHECK-BOLTED-NEXT: catch 1
29