• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
4
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
12
13; SECTIONS_CFI:      _Z3foob.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
20
21; SECTIONS_CFI:      _Z3foob.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
28
29
30;; void foo(bool b) {
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");
35;; }
36
37define dso_local void @_Z3foob(i1 zeroext %b) {
38entry:
39  %b.addr = alloca i8, align 1
40  %frombool = zext i1 %b to i8
41  store i8 %frombool, i8* %b.addr, align 1
42  %0 = load i8, i8* %b.addr, align 1
43  %tobool = trunc i8 %0 to i1
44  br i1 %tobool, label %if.then, label %if.end
45
46if.then:                                          ; preds = %entry
47  call void asm sideeffect "nop", "~{r12},~{r13},~{r14},~{r15},~{rbx},~{dirflag},~{fpsr},~{flags}"() #1, !srcloc !2
48  br label %if.end
49
50if.end:                                           ; preds = %if.then, %entry
51  ret void
52}
53!2 = !{i32 38}
54