Skip to content

Commit e78cea0

Browse files
committed
[X86][test] Precommit D122541 tests for prologue/epilogue CFI
Currently there is no CFI_INSTRUCTION MIR test with .ll input. This patch adds some -stop-after=prologepilog tests.
1 parent ae4dce8 commit e78cea0

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

llvm/test/CodeGen/X86/cfi-xmm.ll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc -mtriple x86_64-w64-windows-gnu -filetype=asm -exception-model=dwarf -o - %s | FileCheck %s
2+
; RUN: llc < %s -mtriple x86_64-w64-windows-gnu -exception-model=dwarf -stop-after=prologepilog | FileCheck %s --check-prefix=PEI
23

34
define void @_Z1fv() {
45
entry:
@@ -19,3 +20,16 @@ entry:
1920
; CHECK: addq $40, %rsp
2021
; CHECK: retq
2122
; CHECK: .cfi_endproc
23+
24+
; PEI-LABEL: name: _Z1fv
25+
; PEI: $rsp = frame-setup SUB64ri8 $rsp, 40, implicit-def dead $eflags
26+
; PEI-NEXT: frame-setup MOVAPSmr $rsp, 1, $noreg, 16, $noreg, killed $xmm15 :: (store (s128) into %fixed-stack.1)
27+
; PEI-NEXT: frame-setup MOVAPSmr $rsp, 1, $noreg, 0, $noreg, killed $xmm10 :: (store (s128) into %fixed-stack.0)
28+
; PEI-NEXT: {{^ +}}CFI_INSTRUCTION def_cfa_offset 48
29+
; PEI-NEXT: {{^ +}}CFI_INSTRUCTION offset $xmm10, -48
30+
; PEI-NEXT: {{^ +}}CFI_INSTRUCTION offset $xmm15, -32
31+
; PEI-NEXT: INLINEASM {{.*}}
32+
; PEI-NEXT: $xmm10 = MOVAPSrm $rsp, 1, $noreg, 0, $noreg :: (load (s128) from %fixed-stack.0)
33+
; PEI-NEXT: $xmm15 = MOVAPSrm $rsp, 1, $noreg, 16, $noreg :: (load (s128) from %fixed-stack.1)
34+
; PEI-NEXT: $rsp = frame-destroy ADD64ri8 $rsp, 40, implicit-def dead $eflags
35+
; PEI-NEXT: RET 0

llvm/test/CodeGen/X86/epilogue-cfi-fp.ll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
; RUN: llc -O0 %s -o - | FileCheck %s
2+
; RUN: llc -O0 %s -o - | FileCheck %s
3+
; RUN: llc < %s -stop-after=prologepilog | FileCheck %s --check-prefix=PEI
24

35
target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
46
target triple = "i686-pc-linux"
@@ -11,6 +13,11 @@ define i32 @foo(i32 %i, i32 %j, i32 %k, i32 %l, i32 %m) #0 {
1113
; CHECK-NEXT: .cfi_def_cfa %esp, 4
1214
; CHECK-NEXT: retl
1315

16+
; PEI-LABEL: name: foo
17+
; PEI: $ebp = frame-destroy POP32r implicit-def $esp, implicit $esp
18+
; PEI-NEXT: {{^ +}}CFI_INSTRUCTION def_cfa $esp, 4
19+
; PEI-NEXT: RET 0, killed $eax
20+
1421
entry:
1522
%i.addr = alloca i32, align 4
1623
%j.addr = alloca i32, align 4

llvm/test/CodeGen/X86/push-cfi.ll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; RUN: llc < %s -mtriple=i686-pc-linux | FileCheck %s -check-prefix=LINUX -check-prefix=CHECK
22
; RUN: llc < %s -mtriple=i686-apple-darwin | FileCheck %s -check-prefix=DARWIN -check-prefix=CHECK
3+
; RUN: llc < %s -mtriple=i686-pc-linux -stop-after=prologepilog | FileCheck %s --check-prefix=PEI
34

45
declare i32 @__gxx_personality_v0(...)
56
declare void @good(i32 %a, i32 %b, i32 %c, i32 %d)
@@ -25,6 +26,12 @@ declare void @empty()
2526
; LINUX: .cfi_adjust_cfa_offset -16
2627
; DARWIN-NOT: .cfi_escape
2728
; DARWIN-NOT: pushl
29+
30+
; PEI-LABEL: name: test1_nofp
31+
; PEI: $esp = frame-setup SUB32ri8 $esp, 12, implicit-def dead $eflags
32+
; PEI-NEXT: {{^ +}}CFI_INSTRUCTION def_cfa_offset 16
33+
; PEI-NOT: frame-setup CFI_INSTRUCTION
34+
; PEI: ...
2835
define void @test1_nofp() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
2936
entry:
3037
invoke void @good(i32 1, i32 2, i32 3, i32 4)

llvm/test/CodeGen/X86/throws-cfi-fp.ll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc %s -o - | FileCheck %s
2+
; RUN: llc < %s -stop-after=prologepilog | FileCheck %s --check-prefix=PEI
23

34
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
45
target triple = "x86_64-unknown-linux-gnu"
@@ -19,6 +20,22 @@ define void @_Z6throwsv() #0 personality i8* bitcast (i32 (...)* @__gxx_personal
1920
; CHECK-NEXT: .LBB0_1:
2021
; CHECK-NEXT: .cfi_def_cfa %rbp, 16
2122

23+
; PEI-LABEL: name: _Z6throwsv
24+
; PEI: frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
25+
; PEI-NEXT: {{^ +}}CFI_INSTRUCTION def_cfa_offset 16
26+
; PEI-NEXT: {{^ +}}CFI_INSTRUCTION offset $rbp, -16
27+
; PEI-NEXT: $rbp = frame-setup MOV64rr $rsp
28+
; PEI-NEXT: {{^ +}}CFI_INSTRUCTION def_cfa_register $rbp
29+
; PEI-NEXT: frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
30+
; PEI-NEXT: frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
31+
; PEI-NEXT: {{^ +}}CFI_INSTRUCTION offset $rbx, -24
32+
; PEI: bb.4.try.cont:
33+
; PEI-NEXT: $rsp = frame-destroy ADD64ri8 $rsp, 8, implicit-def dead $eflags
34+
; PEI-NEXT: $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
35+
; PEI-NEXT: $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
36+
; PEI-NEXT: {{^ +}}CFI_INSTRUCTION def_cfa $rsp, 8
37+
; PEI-NEXT: RET 0
38+
2239
entry:
2340
%.b5 = load i1, i1* @_ZL11ShouldThrow, align 1
2441
br i1 %.b5, label %if.then, label %try.cont

0 commit comments

Comments
 (0)