[spirv] Do not add exit phi for loop initializer
When a loop with an empty initializer block has results, we were
treating the initializer as an implicit exit block and adding OpPhi
operands for it. The only implicit exit blocks we have are on `if`
instructions, so restrict the implicit exit block logic to those.
Change-Id: If0beaba4816f683fd58ec82d832a12c59f07e347
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/190462
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/spirv/writer/common/helper_test.h b/src/tint/lang/spirv/writer/common/helper_test.h
index 553b173..bedc457 100644
--- a/src/tint/lang/spirv/writer/common/helper_test.h
+++ b/src/tint/lang/spirv/writer/common/helper_test.h
@@ -36,6 +36,7 @@
#include "gtest/gtest.h"
#include "spirv-tools/libspirv.hpp"
#include "src/tint/lang/core/ir/builder.h"
+#include "src/tint/lang/core/ir/disassembly.h"
#include "src/tint/lang/core/ir/validator.h"
#include "src/tint/lang/core/type/array.h"
#include "src/tint/lang/core/type/depth_texture.h"
@@ -241,6 +242,10 @@
}
return nullptr;
}
+
+ /// Helper to dump the disassembly of the Tint IR module.
+ /// @returns the disassembly (with a leading newline)
+ std::string IR() { return "\n" + core::ir::Disassemble(mod).Plain(); }
};
using SpirvWriterTest = SpirvWriterTestHelperBase<testing::Test>;