Skip to content

Commit f67b018

Browse files
[mlir][SPIRV] Improve ub.unreachable lowering test case (llvm#170083)
Addresses a comment on the PR that introduces the ub.reachable -> spriv.Unreachable lowering (llvm#169872 (comment)).
1 parent 7ce7141 commit f67b018

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

mlir/test/Conversion/UBToSPIRV/ub-to-spirv.mlir

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt -split-input-file -convert-ub-to-spirv -verify-diagnostics %s | FileCheck %s
1+
// RUN: mlir-opt -split-input-file -convert-ub-to-spirv %s | FileCheck %s
22

33
module attributes {
44
spirv.target_env = #spirv.target_env<
@@ -22,15 +22,17 @@ func.func @check_poison() {
2222

2323
// -----
2424

25-
// No successful test because the dialect conversion framework does not convert
26-
// unreachable blocks.
27-
2825
module attributes {
2926
spirv.target_env = #spirv.target_env<
3027
#spirv.vce<v1.0, [Int8, Int16, Int64, Float16, Float64, Shader], []>, #spirv.resource_limits<>>
3128
} {
32-
func.func @check_unrechable() {
33-
// expected-error@+1{{cannot be used in reachable block}}
34-
spirv.Unreachable
29+
// CHECK-LABEL: @check_unrechable
30+
func.func @check_unrechable(%c: i1) {
31+
cf.cond_br %c, ^bb1, ^bb2
32+
^bb1:
33+
// CHECK: spirv.Unreachable
34+
ub.unreachable
35+
^bb2:
36+
return
3537
}
3638
}

0 commit comments

Comments
 (0)