Every basic block section symbol created by -fbasic-block-sections will contain ".__part." to know that this symbol corresponds to a basic block fragment of the function. This patch solves two problems: a) Like D89617, we want function symbols with suffixes to be properly qualified so that external tools like profile aggregators know exactly what this symbol corresponds to. b) The current basic block naming just adds a ".N" to the symbol name where N is some integer. This collides with how clang creates __cxx_global_var_init.N. clang creates these symbol names to call constructor functions and basic block symbol naming should not use the same style. Fixed all the test cases and added an extra test for __cxx_global_var_init breakage. Differential Revision: https://reviews.llvm.org/D93082
89 lines
2.9 KiB
LLVM
89 lines
2.9 KiB
LLVM
; BB cluster section test for exception handling.
|
|
;
|
|
; Test1: Basic blocks #1 and #3 are landing pads and must be in the same section.
|
|
; Basic block 2 will be placed in a unique section, but #1 and #3 are placed in the special exception section.
|
|
; The rest will be placed in a section along with the entry basic block.
|
|
; RUN: echo '!main' > %t1
|
|
; RUN: echo '!!1 2' >> %t1
|
|
; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t1 | FileCheck %s -check-prefix=LINUX-SECTIONS1
|
|
;
|
|
; Test2: Basic blocks #1, #2, and #3 go into a separate section.
|
|
; No separate exception section will be created as #1 and #3 are already in one section.
|
|
; The rest will be placed in a section along with the entry basic block.
|
|
; RUN: echo '!main' > %t2
|
|
; RUN: echo '!!1 2 3' >> %t2
|
|
; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t2 | FileCheck %s -check-prefix=LINUX-SECTIONS2
|
|
|
|
@_ZTIi = external constant i8*
|
|
|
|
define i32 @main() uwtable optsize ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
|
|
entry:
|
|
invoke void @_Z1fv() optsize
|
|
to label %try.cont unwind label %lpad1
|
|
|
|
lpad1:
|
|
%0 = landingpad { i8*, i32 }
|
|
cleanup
|
|
catch i8* bitcast (i8** @_ZTIi to i8*)
|
|
br label %eh.resume1
|
|
|
|
try.cont:
|
|
invoke void @_Z2fv() optsize
|
|
to label %try.cont unwind label %lpad2
|
|
ret i32 0
|
|
|
|
lpad2:
|
|
%2 = landingpad { i8*, i32 }
|
|
cleanup
|
|
catch i8* bitcast (i8** @_ZTIi to i8*)
|
|
br label %eh.resume2
|
|
|
|
eh.resume1:
|
|
resume { i8*, i32 } %0
|
|
|
|
eh.resume2:
|
|
resume { i8*, i32 } %2
|
|
}
|
|
|
|
declare void @_Z1fv() optsize
|
|
|
|
declare void @_Z2fv() optsize
|
|
|
|
declare i32 @__gxx_personality_v0(...)
|
|
|
|
; LINUX-SECTIONS1: .section .text.main,"ax",@progbits
|
|
; LINUX-SECTIONS1-LABEL: main:
|
|
; LINUX-SECTIONS1-NOT: .section
|
|
; LINUX-SECTIONS1-LABEL: .LBB0_4:
|
|
; LINUX-SECTIONS1-NOT: .section
|
|
; LINUX-SECTIONS1-LABEL: .LBB0_5:
|
|
; LINUX-SECTIONS1-NOT: .section
|
|
; LINUX-SECTIONS1-LABEL: .LBB0_6:
|
|
; LINUX-SECTIONS1: .section .text.main,"ax",@progbits,unique,1
|
|
; LINUX-SECTIONS1-LABEL: main.__part.0:
|
|
; LINUX-SECTIONS1: .section .text.eh.main,"ax",@progbits
|
|
; LINUX-SECTIONS1-LABEL: main.eh:
|
|
; LINUX-SECTIONS1-NOT: .section
|
|
; LINUX-SECTIONS1-LABEL: .LBB0_3:
|
|
; LINUX-SECTIONS1-NOT: .section
|
|
; LINUX-SECTIONS1: .section .text.main,"ax",@progbits
|
|
; LINUX-SECTIONS1-LABEL: .Lfunc_end0
|
|
|
|
|
|
; LINUX-SECTIONS2: .section .text.main,"ax",@progbits
|
|
; LINUX-SECTIONS2-LABEL: main:
|
|
; LINUX-SECTIONS2-NOT: .section
|
|
; LINUX-SECTIONS2-LABEL: .LBB0_4:
|
|
; LINUX-SECTIONS2-NOT: .section
|
|
; LINUX-SECTIONS2-LABEL: .LBB0_5:
|
|
; LINUX-SECTIONS2-NOT: .section
|
|
; LINUX-SECTIONS2-LABEL: .LBB0_6:
|
|
; LINUX-SECTIONS2: .section .text.main,"ax",@progbits,unique,1
|
|
; LINUX-SECTIONS2-LABEL: main.__part.0:
|
|
; LINUX-SECTIONS2-NOT: .section
|
|
; LINUX-SECTIONS2-LABEL: .LBB0_2:
|
|
; LINUX-SECTIONS2-NOT: .section
|
|
; LINUX-SECTIONS2-LABEL: .LBB0_3:
|
|
; LINUX-SECTIONS2: .section .text.main,"ax",@progbits
|
|
; LINUX-SECTIONS2-LABEL: .Lfunc_end0
|