Files
clang-p2996/llvm/test/CodeGen/X86/cfi-basic-block-sections-1.ll
Sriraman Tallam 34e70d722d Append ".__part." to every basic block section symbol.
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
2020-12-23 11:35:44 -08:00

87 lines
2.5 KiB
LLVM

; RUN: llc -O0 %s --basic-block-sections=all -mtriple=x86_64 -filetype=asm --frame-pointer=all -o - | FileCheck --check-prefix=SECTIONS_CFI %s
; RUN: llc -O0 %s --basic-block-sections=all -mtriple=x86_64 -filetype=asm --frame-pointer=none -o - | FileCheck --check-prefix=SECTIONS_NOFP_CFI %s
; RUN: llc -O0 %s --basic-block-sections=all -mtriple=x86_64 -filetype=obj --frame-pointer=all -o - | llvm-dwarfdump --eh-frame - | FileCheck --check-prefix=EH_FRAME %s
;; void f1();
;; void f3(bool b) {
;; if (b)
;; f1();
;; }
; SECTIONS_CFI: _Z2f3b:
; SECTIONS_CFI: .cfi_startproc
; SECTIONS_CFI: .cfi_def_cfa_offset 16
; SECTIONS_CFI: .cfi_offset %rbp, -16
; SECTIONS_CFI: .cfi_def_cfa_register %rbp
; SECTIONS_CFI: .cfi_endproc
; SECTIONS_CFI: _Z2f3b.__part.1:
; SECTIONS_CFI-NEXT: .cfi_startproc
; SECTIONS_CFI-NEXT: .cfi_def_cfa %rbp, 16
; SECTIONS_CFI-NEXT: .cfi_offset %rbp, -16
; SECTIONS_CFI: .cfi_endproc
; SECTIONS_CFI: _Z2f3b.__part.2:
; SECTIONS_CFI-NEXT: .cfi_startproc
; SECTIONS_CFI-NEXT: .cfi_def_cfa %rbp, 16
; SECTIONS_CFI-NEXT: .cfi_offset %rbp, -16
; SECTIONS_CFI: .cfi_def_cfa
; SECTIONS_CFI: .cfi_endproc
; SECTIONS_NOFP_CFI: _Z2f3b:
; SECTIONS_NOFP_CFI: .cfi_startproc
; SECTIONS_NOFP_CFI: .cfi_def_cfa_offset 16
; SECTIONS_NOFP_CFI: .cfi_endproc
; SECTIONS_NOFP_CFI: _Z2f3b.__part.1:
; SECTIONS_NOFP_CFI-NEXT: .cfi_startproc
; SECTIONS_NOFP_CFI-NEXT: .cfi_def_cfa %rsp, 16
; SECTIONS_NOFP_CFI: .cfi_endproc
; SECTIONS_NOFP_CFI: _Z2f3b.__part.2:
; SECTIONS_NOFP_CFI-NEXT: .cfi_startproc
; SECTIONS_NOFP_CFI-NEXT: .cfi_def_cfa %rsp, 16
; SECTIONS_NOFP_CFI: .cfi_endproc
;; There must be 1 CIE and 3 FDEs.
; EH_FRAME: CIE
; EH_FRAME: DW_CFA_def_cfa
; EH_FRAME: DW_CFA_offset
; EH_FRAME: FDE cie=
; EH_FRAME: DW_CFA_def_cfa_offset
; EH_FRAME: DW_CFA_offset
; EH_FRAME: DW_CFA_def_cfa_register
; EH_FRAME: FDE cie=
; EH_FRAME: DW_CFA_def_cfa
; EH_FRAME: DW_CFA_offset
; EH_FRAME: FDE cie=
; EH_FRAME: DW_CFA_def_cfa
; EH_FRAME: DW_CFA_offset
; Function Attrs: noinline optnone uwtable
define dso_local void @_Z2f3b(i1 zeroext %b) {
entry:
%b.addr = alloca i8, align 1
%frombool = zext i1 %b to i8
store i8 %frombool, i8* %b.addr, align 1
%0 = load i8, i8* %b.addr, align 1
%tobool = trunc i8 %0 to i1
br i1 %tobool, label %if.then, label %if.end
if.then: ; preds = %entry
call void @_Z2f1v()
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
declare dso_local void @_Z2f1v()