File: exception-pointer-register.ll

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (120 lines) | stat: -rw-r--r-- 3,302 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
; RUN:   | FileCheck %s -check-prefix=RV32I
; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
; RUN:   | FileCheck %s -check-prefix=RV64I
;
; Before getExceptionPointerRegister() and getExceptionSelectorRegister()
; lowering hooks were defined this would trigger an assertion during live
; variable analysis

declare void @foo(i1* %p);
declare void @bar(i1* %p);
declare dso_local i32 @__gxx_personality_v0(...)

define void @caller(i1* %p) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
; RV32I-LABEL: caller:
; RV32I:       # %bb.0: # %entry
; RV32I-NEXT:    addi sp, sp, -16
; RV32I-NEXT:    .cfi_def_cfa_offset 16
; RV32I-NEXT:    sw ra, 12(sp)
; RV32I-NEXT:    sw s0, 8(sp)
; RV32I-NEXT:    sw s1, 4(sp)
; RV32I-NEXT:    .cfi_offset ra, -4
; RV32I-NEXT:    .cfi_offset s0, -8
; RV32I-NEXT:    .cfi_offset s1, -12
; RV32I-NEXT:    mv s0, a0
; RV32I-NEXT:    beqz a0, .LBB0_2
; RV32I-NEXT:  # %bb.1: # %bb2
; RV32I-NEXT:  .Ltmp0:
; RV32I-NEXT:    mv a0, s0
; RV32I-NEXT:    call bar
; RV32I-NEXT:  .Ltmp1:
; RV32I-NEXT:    j .LBB0_3
; RV32I-NEXT:  .LBB0_2: # %bb1
; RV32I-NEXT:  .Ltmp2:
; RV32I-NEXT:    mv a0, s0
; RV32I-NEXT:    call foo
; RV32I-NEXT:  .Ltmp3:
; RV32I-NEXT:  .LBB0_3: # %end2
; RV32I-NEXT:    lw s1, 4(sp)
; RV32I-NEXT:    lw s0, 8(sp)
; RV32I-NEXT:    lw ra, 12(sp)
; RV32I-NEXT:    addi sp, sp, 16
; RV32I-NEXT:    ret
; RV32I-NEXT:  .LBB0_4: # %lpad
; RV32I-NEXT:  .Ltmp4:
; RV32I-NEXT:    mv s1, a0
; RV32I-NEXT:    mv a0, s0
; RV32I-NEXT:    call callee
; RV32I-NEXT:    mv a0, s1
; RV32I-NEXT:    call _Unwind_Resume
;
; RV64I-LABEL: caller:
; RV64I:       # %bb.0: # %entry
; RV64I-NEXT:    addi sp, sp, -32
; RV64I-NEXT:    .cfi_def_cfa_offset 32
; RV64I-NEXT:    sd ra, 24(sp)
; RV64I-NEXT:    sd s0, 16(sp)
; RV64I-NEXT:    sd s1, 8(sp)
; RV64I-NEXT:    .cfi_offset ra, -8
; RV64I-NEXT:    .cfi_offset s0, -16
; RV64I-NEXT:    .cfi_offset s1, -24
; RV64I-NEXT:    mv s0, a0
; RV64I-NEXT:    beqz a0, .LBB0_2
; RV64I-NEXT:  # %bb.1: # %bb2
; RV64I-NEXT:  .Ltmp0:
; RV64I-NEXT:    mv a0, s0
; RV64I-NEXT:    call bar
; RV64I-NEXT:  .Ltmp1:
; RV64I-NEXT:    j .LBB0_3
; RV64I-NEXT:  .LBB0_2: # %bb1
; RV64I-NEXT:  .Ltmp2:
; RV64I-NEXT:    mv a0, s0
; RV64I-NEXT:    call foo
; RV64I-NEXT:  .Ltmp3:
; RV64I-NEXT:  .LBB0_3: # %end2
; RV64I-NEXT:    ld s1, 8(sp)
; RV64I-NEXT:    ld s0, 16(sp)
; RV64I-NEXT:    ld ra, 24(sp)
; RV64I-NEXT:    addi sp, sp, 32
; RV64I-NEXT:    ret
; RV64I-NEXT:  .LBB0_4: # %lpad
; RV64I-NEXT:  .Ltmp4:
; RV64I-NEXT:    mv s1, a0
; RV64I-NEXT:    mv a0, s0
; RV64I-NEXT:    call callee
; RV64I-NEXT:    mv a0, s1
; RV64I-NEXT:    call _Unwind_Resume
entry:
  %0 = icmp eq i1* %p, null
  br i1 %0, label %bb1, label %bb2

bb1:
  invoke void @foo(i1* %p) to label %end1 unwind label %lpad

bb2:
  invoke void @bar(i1* %p) to label %end2 unwind label %lpad

lpad:
  %1 = landingpad { i8*, i32 } cleanup
  call void @callee(i1* %p)
  resume { i8*, i32 } %1

end1:
  ret void

end2:
  ret void
}

define internal void @callee(i1* %p) {
; RV32I-LABEL: callee:
; RV32I:       # %bb.0:
; RV32I-NEXT:    ret
;
; RV64I-LABEL: callee:
; RV64I:       # %bb.0:
; RV64I-NEXT:    ret
  ret void
}