[hlsl] Mark inlined and skipped block instructions.
This CL adds the entries into the block emission for the HLSL IR backend
which marks any instruction which is skipped or inlined.
Bug: 42251045
Change-Id: I612e7aceffe572096791ddcea6a03373e6e9ec38
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/193781
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/lang/hlsl/writer/printer/printer.cc b/src/tint/lang/hlsl/writer/printer/printer.cc
index 33df798..e718c19 100644
--- a/src/tint/lang/hlsl/writer/printer/printer.cc
+++ b/src/tint/lang/hlsl/writer/printer/printer.cc
@@ -39,15 +39,22 @@
#include "src/tint/lang/core/constant/splat.h"
#include "src/tint/lang/core/constant/value.h"
#include "src/tint/lang/core/fluent_types.h"
+#include "src/tint/lang/core/ir/access.h"
+#include "src/tint/lang/core/ir/bitcast.h"
#include "src/tint/lang/core/ir/block.h"
#include "src/tint/lang/core/ir/call.h"
#include "src/tint/lang/core/ir/constant.h"
+#include "src/tint/lang/core/ir/construct.h"
#include "src/tint/lang/core/ir/core_binary.h"
+#include "src/tint/lang/core/ir/core_unary.h"
#include "src/tint/lang/core/ir/instruction_result.h"
#include "src/tint/lang/core/ir/let.h"
#include "src/tint/lang/core/ir/load.h"
+#include "src/tint/lang/core/ir/load_vector_element.h"
#include "src/tint/lang/core/ir/module.h"
+#include "src/tint/lang/core/ir/next_iteration.h"
#include "src/tint/lang/core/ir/return.h"
+#include "src/tint/lang/core/ir/swizzle.h"
#include "src/tint/lang/core/ir/user_call.h"
#include "src/tint/lang/core/ir/validator.h"
#include "src/tint/lang/core/ir/value.h"
@@ -169,14 +176,22 @@
for (auto* inst : *block) {
Switch(
- inst, //
- [&](const core::ir::Call* i) { EmitCallStmt(i); }, //
- [&](const core::ir::Let* i) { EmitLet(i); }, //
- [&](const core::ir::Return* i) { EmitReturn(i); }, //
- [&](const core::ir::Var* v) { EmitVar(v); }, //
- //
- [&](const core::ir::CoreBinary*) { /* inlined */ }, //
- [&](const core::ir::Load*) { /* inlined */ }, //
+ inst, //
+ [&](const core::ir::Call* i) { EmitCallStmt(i); }, //
+ [&](const core::ir::Let* i) { EmitLet(i); }, //
+ [&](const core::ir::Return* i) { EmitReturn(i); }, //
+ [&](const core::ir::Var* v) { EmitVar(v); }, //
+ //
+ [&](const core::ir::NextIteration*) { /* do nothing */ }, //
+ //
+ [&](const core::ir::Access*) { /* inlined */ }, //
+ [&](const core::ir::Bitcast*) { /* inlined */ }, //
+ [&](const core::ir::Construct*) { /* inlined */ }, //
+ [&](const core::ir::CoreBinary*) { /* inlined */ }, //
+ [&](const core::ir::CoreUnary*) { /* inlined */ }, //
+ [&](const core::ir::Load*) { /* inlined */ }, //
+ [&](const core::ir::LoadVectorElement*) { /* inlined */ }, //
+ [&](const core::ir::Swizzle*) { /* inlined */ }, //
TINT_ICE_ON_NO_MATCH);
}
}
diff --git a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.ir.dxc.hlsl b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.ir.dxc.hlsl
index e60d991..91ea2dd 100644
--- a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.ir.dxc.hlsl
@@ -1,9 +1,4 @@
-SKIP: FAILED
+[numthreads(1, 1, 1)]
+void main() {
+}
-<dawn>/src/tint/lang/hlsl/writer/printer/printer.cc:180 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access
-********************************************************************
-* The tint shader compiler has encountered an unexpected error. *
-* *
-* Please help us fix this issue by submitting a bug report at *
-* crbug.com/tint with the source program that triggered the bug. *
-********************************************************************
diff --git a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.ir.dxc.hlsl b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.ir.dxc.hlsl
index e60d991..91ea2dd 100644
--- a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.ir.dxc.hlsl
@@ -1,9 +1,4 @@
-SKIP: FAILED
+[numthreads(1, 1, 1)]
+void main() {
+}
-<dawn>/src/tint/lang/hlsl/writer/printer/printer.cc:180 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access
-********************************************************************
-* The tint shader compiler has encountered an unexpected error. *
-* *
-* Please help us fix this issue by submitting a bug report at *
-* crbug.com/tint with the source program that triggered the bug. *
-********************************************************************
diff --git a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.ir.dxc.hlsl b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.ir.dxc.hlsl
index e60d991..91ea2dd 100644
--- a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.ir.dxc.hlsl
@@ -1,9 +1,4 @@
-SKIP: FAILED
+[numthreads(1, 1, 1)]
+void main() {
+}
-<dawn>/src/tint/lang/hlsl/writer/printer/printer.cc:180 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access
-********************************************************************
-* The tint shader compiler has encountered an unexpected error. *
-* *
-* Please help us fix this issue by submitting a bug report at *
-* crbug.com/tint with the source program that triggered the bug. *
-********************************************************************