@@ -5,57 +5,57 @@ target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1"
5
5
target triple = "wasm32-unknown-unknown"
6
6
7
7
%struct.quux = type { i32 }
8
- %struct.blam = type <{ %struct.quux }>
8
+ %struct.blam = type <{ i32 , %struct.quux }>
9
9
10
10
declare void @foo ()
11
- declare void @bar (%struct.quux* )
11
+ declare void @bar (ptr )
12
12
declare i32 @baz ()
13
13
declare i32 @__gxx_wasm_personality_v0 (...)
14
14
; Function Attrs: noreturn
15
15
declare void @llvm.wasm.rethrow () #0
16
16
17
17
; Test that a PHI in catchswitch BB are excluded from combining into a non-PHI
18
18
; instruction.
19
- define void @test0 (i1 %c1 ) personality i8* bitcast ( i32 (...)* @__gxx_wasm_personality_v0 to i8* ) {
19
+ define void @test0 (i1 %c1 ) personality ptr @__gxx_wasm_personality_v0 {
20
20
; CHECK-LABEL: @test0(
21
21
; CHECK-NEXT: bb:
22
22
; CHECK-NEXT: [[TMP0:%.*]] = alloca [[STRUCT_BLAM:%.*]], align 4
23
23
; CHECK-NEXT: br i1 [[C1:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
24
24
; CHECK: bb1:
25
- ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_BLAM]], %struct.blam* [[TMP0]], i32 0, i32 0
25
+ ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_BLAM]], ptr [[TMP0]], i32 0, i32 1
26
26
; CHECK-NEXT: invoke void @foo()
27
27
; CHECK-NEXT: to label [[BB3:%.*]] unwind label [[BB4:%.*]]
28
28
; CHECK: bb2:
29
- ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_BLAM]], %struct.blam* [[TMP0]], i32 0, i32 0
29
+ ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_BLAM]], ptr [[TMP0]], i32 0, i32 1
30
30
; CHECK-NEXT: invoke void @foo()
31
31
; CHECK-NEXT: to label [[BB3]] unwind label [[BB4]]
32
32
; CHECK: bb3:
33
33
; CHECK-NEXT: unreachable
34
34
; CHECK: bb4:
35
- ; CHECK-NEXT: [[TMP3:%.*]] = phi %struct.quux* [ [[TMP1]], [[BB1]] ], [ [[TMP2]], [[BB2]] ]
35
+ ; CHECK-NEXT: [[TMP3:%.*]] = phi ptr [ [[TMP1]], [[BB1]] ], [ [[TMP2]], [[BB2]] ]
36
36
; CHECK-NEXT: [[TMP4:%.*]] = catchswitch within none [label %bb5] unwind label [[BB7:%.*]]
37
37
; CHECK: bb5:
38
- ; CHECK-NEXT: [[TMP5:%.*]] = catchpad within [[TMP4]] [i8* null]
38
+ ; CHECK-NEXT: [[TMP5:%.*]] = catchpad within [[TMP4]] [ptr null]
39
39
; CHECK-NEXT: invoke void @foo() [ "funclet"(token [[TMP5]]) ]
40
40
; CHECK-NEXT: to label [[BB6:%.*]] unwind label [[BB7]]
41
41
; CHECK: bb6:
42
42
; CHECK-NEXT: unreachable
43
43
; CHECK: bb7:
44
44
; CHECK-NEXT: [[TMP6:%.*]] = cleanuppad within none []
45
- ; CHECK-NEXT: call void @bar(%struct.quux* [[TMP3]]) [ "funclet"(token [[TMP6]]) ]
45
+ ; CHECK-NEXT: call void @bar(ptr nonnull [[TMP3]]) [ "funclet"(token [[TMP6]]) ]
46
46
; CHECK-NEXT: unreachable
47
47
;
48
48
bb:
49
49
%tmp0 = alloca %struct.blam , align 4
50
50
br i1 %c1 , label %bb1 , label %bb2
51
51
52
52
bb1: ; preds = %bb
53
- %tmp1 = getelementptr inbounds %struct.blam , %struct.blam* %tmp0 , i32 0 , i32 0
53
+ %tmp1 = getelementptr inbounds %struct.blam , ptr %tmp0 , i32 0 , i32 1
54
54
invoke void @foo ()
55
55
to label %bb3 unwind label %bb4
56
56
57
57
bb2: ; preds = %bb
58
- %tmp2 = getelementptr inbounds %struct.blam , %struct.blam* %tmp0 , i32 0 , i32 0
58
+ %tmp2 = getelementptr inbounds %struct.blam , ptr %tmp0 , i32 0 , i32 1
59
59
invoke void @foo ()
60
60
to label %bb3 unwind label %bb4
61
61
@@ -66,11 +66,11 @@ bb4: ; preds = %bb2, %bb1
66
66
; This PHI should not be combined into a non-PHI instruction, because
67
67
; catchswitch BB cannot have any non-PHI instruction other than catchswitch
68
68
; itself.
69
- %tmp3 = phi %struct.quux* [ %tmp1 , %bb1 ], [ %tmp2 , %bb2 ]
69
+ %tmp3 = phi ptr [ %tmp1 , %bb1 ], [ %tmp2 , %bb2 ]
70
70
%tmp4 = catchswitch within none [label %bb5 ] unwind label %bb7
71
71
72
72
bb5: ; preds = %bb4
73
- %tmp5 = catchpad within %tmp4 [i8* null ]
73
+ %tmp5 = catchpad within %tmp4 [ptr null ]
74
74
invoke void @foo () [ "funclet" (token %tmp5 ) ]
75
75
to label %bb6 unwind label %bb7
76
76
@@ -79,13 +79,13 @@ bb6: ; preds = %bb5
79
79
80
80
bb7: ; preds = %bb5, %bb4
81
81
%tmp6 = cleanuppad within none []
82
- call void @bar (%struct.quux* %tmp3 ) [ "funclet" (token %tmp6 ) ]
82
+ call void @bar (ptr %tmp3 ) [ "funclet" (token %tmp6 ) ]
83
83
unreachable
84
84
}
85
85
86
86
; Test that slicing-up of illegal integer type PHI does not happen in catchswitch
87
87
; BBs, which can't have any non-PHI instruction before the catchswitch.
88
- define void @test1 () personality i8* bitcast ( i32 (...)* @__gxx_wasm_personality_v0 to i8* ) {
88
+ define void @test1 () personality ptr @__gxx_wasm_personality_v0 {
89
89
; CHECK-LABEL: @test1(
90
90
; CHECK-NEXT: entry:
91
91
; CHECK-NEXT: invoke void @foo()
@@ -108,7 +108,7 @@ define void @test1() personality i8* bitcast (i32 (...)* @__gxx_wasm_personality
108
108
; CHECK-NEXT: [[AP_1:%.*]] = phi i8 [ [[AP_0]], [[IF_END]] ], [ 0, [[INVOKE_CONT]] ]
109
109
; CHECK-NEXT: [[TMP0:%.*]] = catchswitch within none [label %catch.start] unwind label [[CATCH_DISPATCH1]]
110
110
; CHECK: catch.start:
111
- ; CHECK-NEXT: [[TMP1:%.*]] = catchpad within [[TMP0]] [i8* null]
111
+ ; CHECK-NEXT: [[TMP1:%.*]] = catchpad within [[TMP0]] [ptr null]
112
112
; CHECK-NEXT: br i1 false, label [[CATCH:%.*]], label [[RETHROW:%.*]]
113
113
; CHECK: catch:
114
114
; CHECK-NEXT: catchret from [[TMP1]] to label [[TRY_CONT]]
@@ -119,7 +119,7 @@ define void @test1() personality i8* bitcast (i32 (...)* @__gxx_wasm_personality
119
119
; CHECK-NEXT: [[AP_2:%.*]] = phi i8 [ [[AP_1]], [[CATCH_DISPATCH]] ], [ [[AP_1]], [[RETHROW]] ], [ 0, [[ENTRY:%.*]] ]
120
120
; CHECK-NEXT: [[TMP2:%.*]] = catchswitch within none [label %catch.start1] unwind to caller
121
121
; CHECK: catch.start1:
122
- ; CHECK-NEXT: [[TMP3:%.*]] = catchpad within [[TMP2]] [i8* null]
122
+ ; CHECK-NEXT: [[TMP3:%.*]] = catchpad within [[TMP2]] [ptr null]
123
123
; CHECK-NEXT: [[TMP0:%.*]] = and i8 [[AP_2]], 1
124
124
; CHECK-NEXT: [[TOBOOL1_NOT:%.*]] = icmp eq i8 [[TMP0]], 0
125
125
; CHECK-NEXT: br i1 [[TOBOOL1_NOT]], label [[IF_END1:%.*]], label [[IF_THEN1:%.*]]
@@ -168,7 +168,7 @@ catch.dispatch: ; preds = %if.end, %invoke.con
168
168
%tmp0 = catchswitch within none [label %catch.start ] unwind label %catch.dispatch1
169
169
170
170
catch.start: ; preds = %catch.dispatch
171
- %tmp1 = catchpad within %tmp0 [i8* null ]
171
+ %tmp1 = catchpad within %tmp0 [ptr null ]
172
172
br i1 0 , label %catch , label %rethrow
173
173
174
174
catch: ; preds = %catch.start
@@ -183,7 +183,7 @@ catch.dispatch1: ; preds = %rethrow, %catch.dis
183
183
%tmp2 = catchswitch within none [label %catch.start1 ] unwind to caller
184
184
185
185
catch.start1: ; preds = %catch.dispatch1
186
- %tmp3 = catchpad within %tmp2 [i8* null ]
186
+ %tmp3 = catchpad within %tmp2 [ptr null ]
187
187
%tobool1 = trunc i8 %ap.2 to i1
188
188
br i1 %tobool1 , label %if.then1 , label %if.end1
189
189
0 commit comments