Skip to content

Commit 5679be1

Browse files
committed
AMDGPU: Migrate more tests away from undef
andorbitset.ll is interesting since it directly depends on the difference between poison and undef. Not sure it's useful to keep the version using poison, I assume none of this code makes it to codegen. si-spill-cf.ll was also a nasty case, which I doubt has been reproducing its original issue for a very long time. I had to reclaim an older version, replace some of the poison uses, and run simplify-cfg. There's a very slight change in the final CFG with this, but final the output is approximately the same as it used to be.
1 parent 3f62718 commit 5679be1

26 files changed

+597
-526
lines changed

llvm/test/CodeGen/AMDGPU/agpr-copy-no-free-registers.ll

Lines changed: 174 additions & 169 deletions
Large diffs are not rendered by default.

llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-fold-binop-select.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ define <2 x i32> @select_sdiv_lhs_const_v2i32(i1 %cond) {
5555
; GCN-NEXT: v_cndmask_b32_e32 v0, v1, v2, vcc
5656
; GCN-NEXT: v_mov_b32_e32 v1, 0x594
5757
; GCN-NEXT: s_setpc_b64 s[30:31]
58-
%select = select i1 %cond, <2 x i32> <i32 5, i32 undef>, <2 x i32> <i32 6, i32 7>
58+
%select = select i1 %cond, <2 x i32> <i32 5, i32 poison>, <2 x i32> <i32 6, i32 7>
5959
%op = sdiv <2 x i32> <i32 3333, i32 9999>, %select
6060
ret <2 x i32> %op
6161
}

llvm/test/CodeGen/AMDGPU/andorbitset.ll

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ define amdgpu_kernel void @s_set_midbit(ptr addrspace(1) %out, i32 %in) {
106106
@gv = external addrspace(1) global i32
107107

108108
; Make sure there's no verifier error with an undef source.
109-
define void @bitset_verifier_error() local_unnamed_addr #0 {
110-
; SI-LABEL: bitset_verifier_error:
109+
define void @bitset_verifier_error_freeze_poison() local_unnamed_addr #0 {
110+
; SI-LABEL: bitset_verifier_error_freeze_poison:
111111
; SI: ; %bb.0: ; %bb
112112
; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
113113
; SI-NEXT: s_getpc_b64 s[4:5]
@@ -128,13 +128,40 @@ define void @bitset_verifier_error() local_unnamed_addr #0 {
128128
; SI-NEXT: ; %bb.1: ; %bb5
129129
; SI-NEXT: .LBB6_2: ; %bb6
130130
bb:
131-
%i = call float @llvm.fabs.f32(float undef) #0
131+
%undef0 = freeze float poison
132+
%i = call float @llvm.fabs.f32(float %undef0) #0
132133
%i1 = bitcast float %i to i32
133134
store i32 %i1, ptr addrspace(1) @gv
134135
br label %bb2
135136

136137
bb2:
137-
%i3 = call float @llvm.fabs.f32(float undef) #0
138+
%undef1 = freeze float poison
139+
%i3 = call float @llvm.fabs.f32(float %undef1) #0
140+
%i4 = fcmp fast ult float %i3, 0x3FEFF7CEE0000000
141+
br i1 %i4, label %bb5, label %bb6
142+
143+
bb5:
144+
unreachable
145+
146+
bb6:
147+
unreachable
148+
}
149+
150+
define void @bitset_verifier_error_poison() local_unnamed_addr #0 {
151+
; SI-LABEL: bitset_verifier_error_poison:
152+
; SI: ; %bb.0: ; %bb
153+
; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
154+
; SI-NEXT: s_cbranch_scc1 .LBB7_2
155+
; SI-NEXT: ; %bb.1: ; %bb5
156+
; SI-NEXT: .LBB7_2: ; %bb6
157+
bb:
158+
%i = call float @llvm.fabs.f32(float poison) #0
159+
%i1 = bitcast float %i to i32
160+
store i32 %i1, ptr addrspace(1) @gv
161+
br label %bb2
162+
163+
bb2:
164+
%i3 = call float @llvm.fabs.f32(float poison) #0
138165
%i4 = fcmp fast ult float %i3, 0x3FEFF7CEE0000000
139166
br i1 %i4, label %bb5, label %bb6
140167

llvm/test/CodeGen/AMDGPU/cndmask-no-def-vcc.ll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ bb2:
3737
define amdgpu_kernel void @preserve_condition_undef_flag(float %arg, i32 %arg1, float %arg2) {
3838
bb0:
3939
%tmp = icmp sgt i32 %arg1, 4
40-
%undef = call i1 @llvm.amdgcn.class.f32(float poison, i32 undef)
41-
%tmp4 = select i1 %undef, float %arg, float 1.000000e+00
40+
%mask = freeze i32 poison
41+
%undef0 = call i1 @llvm.amdgcn.class.f32(float poison, i32 %mask)
42+
%tmp4 = select i1 %undef0, float %arg, float 1.000000e+00
4243
%tmp5 = fcmp ogt float %arg2, 0.000000e+00
4344
%tmp6 = fcmp olt float %arg2, 1.000000e+00
44-
%tmp7 = fcmp olt float %arg, undef
45+
%tmp7 = fcmp olt float %arg, poison
4546
%tmp8 = and i1 %tmp5, %tmp6
4647
%tmp9 = and i1 %tmp8, %tmp7
4748
br i1 %tmp9, label %bb1, label %bb2

0 commit comments

Comments
 (0)