[Mlir-commits] [mlir] [mlir][spirv] Split conditional basic blocks during deserialization (PR #127639)
Jakub Kuderski
llvmlistbot at llvm.org
Wed Feb 19 06:45:59 PST 2025
================
@@ -0,0 +1,56 @@
+; RUN: %if spirv-tools %{ spirv-as --target-env spv1.0 %s -o - | mlir-translate --deserialize-spirv - -o - | FileCheck %s %}
+; COM: The purpose of this test is to check that a variable (in this case %color) that
+; COM: is defined before a selection region and used both in the selection region and
+; COM: after it, is not sunk into that selection region by the deserializer. If the
+; COM: variable is sunk, then it cannot be accessed outside the region and causes
+; COM: control-flow structurization to fail.
+; CHECK: spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []>
+ OpCapability Shader
+ %2 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %colorOut
+ OpExecutionMode %main OriginUpperLeft
+ OpDecorate %colorOut Location 0
+ %void = OpTypeVoid
+ %4 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%fun_v4float = OpTypePointer Function %v4float
+ %float_1 = OpConstant %float 1
+ %float_0 = OpConstant %float 0
+ %13 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
+%out_v4float = OpTypePointer Output %v4float
+ %colorOut = OpVariable %out_v4float Output
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %out_float = OpTypePointer Output %float
+ %bool = OpTypeBool
+ %25 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1
+; CHECK: spirv.func @main() "None" {
----------------
kuhar wrote:
Could you put these checks in a separate block, either before or after the spirv module? I find it hard to leave when it's interleaved like this
https://github.com/llvm/llvm-project/pull/127639
More information about the Mlir-commits
mailing list