1 ;; This test checks if CFI instructions for all callee saved registers are emitted
2 ;; correctly with basic block sections.
3 ; RUN: llc %s -mtriple=x86_64 -filetype=asm --basic-block-sections=all --frame-pointer=all -o - | FileCheck --check-prefix=SECTIONS_CFI %s
5 ; SECTIONS_CFI: _Z3foob:
6 ; SECTIONS_CFI: .cfi_offset %rbp, -16
7 ; SECTIONS_CFI: .cfi_offset [[RA:%r.+]], -56
8 ; SECTIONS_CFI-NEXT: .cfi_offset [[RB:%r.+]], -48
9 ; SECTIONS_CFI-NEXT: .cfi_offset [[RC:%r.+]], -40
10 ; SECTIONS_CFI-NEXT: .cfi_offset [[RD:%r.+]], -32
11 ; SECTIONS_CFI-NEXT: .cfi_offset [[RE:%r.+]], -24
13 ; SECTIONS_CFI: _Z3foob.__part.1:
14 ; SECTIONS_CFI: .cfi_offset %rbp, -16
15 ; SECTIONS_CFI: .cfi_offset [[RA]], -56
16 ; SECTIONS_CFI-NEXT: .cfi_offset [[RB]], -48
17 ; SECTIONS_CFI-NEXT: .cfi_offset [[RC]], -40
18 ; SECTIONS_CFI-NEXT: .cfi_offset [[RD]], -32
19 ; SECTIONS_CFI-NEXT: .cfi_offset [[RE]], -24
21 ; SECTIONS_CFI: _Z3foob.__part.2:
22 ; SECTIONS_CFI: .cfi_offset %rbp, -16
23 ; SECTIONS_CFI: .cfi_offset [[RA]], -56
24 ; SECTIONS_CFI-NEXT: .cfi_offset [[RB]], -48
25 ; SECTIONS_CFI-NEXT: .cfi_offset [[RC]], -40
26 ; SECTIONS_CFI-NEXT: .cfi_offset [[RD]], -32
27 ; SECTIONS_CFI-NEXT: .cfi_offset [[RE]], -24
31 ;; if (b) // adds a basic block
32 ;; // clobber all callee-save registers to force them to be callee-saved and to
33 ;; // be described by cfi_offset directives.
34 ;; asm("nop" ::: "r12", "r13", "r14", "r15", "rbx");
37 define dso_local void @_Z3foob(i1 zeroext %b) {
39 %b.addr = alloca i8, align 1
40 %frombool = zext i1 %b to i8
41 store i8 %frombool, ptr %b.addr, align 1
42 %0 = load i8, ptr %b.addr, align 1
43 %tobool = trunc i8 %0 to i1
44 br i1 %tobool, label %if.then, label %if.end
46 if.then: ; preds = %entry
47 call void asm sideeffect "nop", "~{r12},~{r13},~{r14},~{r15},~{rbx},~{dirflag},~{fpsr},~{flags}"() #1, !srcloc !2
50 if.end: ; preds = %if.then, %entry