[ir] Dump before validating, when dumping
This is much more useful for debugging in practice.
Change-Id: I0018d016807a381e4aacc295f5656511b2c7fc53
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/152580
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/tint/lang/core/ir/validator.cc b/src/tint/lang/core/ir/validator.cc
index b40e9bc..e7cc0f2 100644
--- a/src/tint/lang/core/ir/validator.cc
+++ b/src/tint/lang/core/ir/validator.cc
@@ -872,6 +872,14 @@
Result<SuccessType, std::string> ValidateAndDumpIfNeeded([[maybe_unused]] Module& ir,
[[maybe_unused]] const char* msg) {
+#if TINT_DUMP_IR_WHEN_VALIDATING
+ Disassembler disasm(ir);
+ std::cout << "=========================================================" << std::endl;
+ std::cout << "== IR dump before " << msg << ":" << std::endl;
+ std::cout << "=========================================================" << std::endl;
+ std::cout << disasm.Disassemble();
+#endif
+
#ifndef NDEBUG
auto result = Validate(ir);
if (!result) {
@@ -882,14 +890,6 @@
}
#endif
-#if TINT_DUMP_IR_WHEN_VALIDATING
- Disassembler disasm(ir);
- std::cout << "=========================================================" << std::endl;
- std::cout << "== IR dump before " << msg << ":" << std::endl;
- std::cout << "=========================================================" << std::endl;
- std::cout << disasm.Disassemble();
-#endif
-
return Success;
}