[tint][ir][validator] 'source' -> 'instruction'
Change-Id: I1db3f0c850aa74a39c8f4af1bd636306355e94c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/164666
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/lang/core/ir/validator.cc b/src/tint/lang/core/ir/validator.cc
index a3a83df..9c24c34 100644
--- a/src/tint/lang/core/ir/validator.cc
+++ b/src/tint/lang/core/ir/validator.cc
@@ -484,15 +484,15 @@
for (size_t i = 0; i < results.Length(); ++i) {
auto* res = results[i];
if (!res) {
- AddResultError(inst, i, InstError(inst, "instruction result is undefined"));
+ AddResultError(inst, i, InstError(inst, "result is undefined"));
continue;
}
if (res->Instruction() == nullptr) {
- AddResultError(inst, i, InstError(inst, "instruction result source is undefined"));
+ AddResultError(inst, i, InstError(inst, "instruction of result is undefined"));
} else if (res->Instruction() != inst) {
AddResultError(inst, i,
- InstError(inst, "instruction result source has wrong instruction"));
+ InstError(inst, "instruction of result is a different instruction"));
}
}
@@ -506,14 +506,11 @@
// Note, a `nullptr` is a valid operand in some cases, like `var` so we can't just check
// for `nullptr` here.
if (!op->Alive()) {
- AddError(inst, i,
- InstError(inst, "instruction operand " + std::to_string(i) + " is not alive"));
+ AddError(inst, i, InstError(inst, "operand is not alive"));
}
if (!op->HasUsage(inst, i)) {
- AddError(
- inst, i,
- InstError(inst, "instruction operand " + std::to_string(i) + " missing usage"));
+ AddError(inst, i, InstError(inst, "operand missing usage"));
}
}
diff --git a/src/tint/lang/core/ir/validator_test.cc b/src/tint/lang/core/ir/validator_test.cc
index 37cbbcc..bb43fe3 100644
--- a/src/tint/lang/core/ir/validator_test.cc
+++ b/src/tint/lang/core/ir/validator_test.cc
@@ -833,7 +833,7 @@
auto res = ir::Validate(mod);
ASSERT_FALSE(res);
- EXPECT_EQ(res.Failure().reason.str(), R"(:3:5 error: if: instruction result is undefined
+ EXPECT_EQ(res.Failure().reason.str(), R"(:3:5 error: if: result is undefined
undef = if true [t: %b2, f: %b3] { # if_1
^^^^^
@@ -905,7 +905,7 @@
auto res = ir::Validate(mod);
ASSERT_FALSE(res);
- EXPECT_EQ(res.Failure().reason.str(), R"(:2:3 error: var: instruction result is undefined
+ EXPECT_EQ(res.Failure().reason.str(), R"(:2:3 error: var: result is undefined
undef = var
^^^^^
@@ -932,7 +932,7 @@
auto res = ir::Validate(mod);
ASSERT_FALSE(res);
- EXPECT_EQ(res.Failure().reason.str(), R"(:3:5 error: var: instruction result is undefined
+ EXPECT_EQ(res.Failure().reason.str(), R"(:3:5 error: var: result is undefined
undef = var
^^^^^
@@ -991,7 +991,7 @@
auto res = ir::Validate(mod);
ASSERT_FALSE(res);
- EXPECT_EQ(res.Failure().reason.str(), R"(:3:5 error: let: instruction result is undefined
+ EXPECT_EQ(res.Failure().reason.str(), R"(:3:5 error: let: result is undefined
undef = let 1i
^^^^^
@@ -1105,7 +1105,7 @@
EXPECT_EQ(res.Failure().reason.str(), expected);
}
-TEST_F(IR_ValidatorTest, Instruction_NullSource) {
+TEST_F(IR_ValidatorTest, Instruction_NullInstruction) {
auto* f = b.Function("my_func", ty.void_());
auto sb = b.Append(f->Block());
@@ -1116,7 +1116,8 @@
auto res = ir::Validate(mod);
ASSERT_FALSE(res);
- EXPECT_EQ(res.Failure().reason.str(), R"(:3:5 error: var: instruction result source is undefined
+ EXPECT_EQ(res.Failure().reason.str(),
+ R"(:3:5 error: var: instruction of result is undefined
%2:ptr<function, f32, read_write> = var
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1147,7 +1148,7 @@
auto res = ir::Validate(mod);
ASSERT_FALSE(res);
- EXPECT_EQ(res.Failure().reason.str(), R"(:3:46 error: var: instruction operand 0 is not alive
+ EXPECT_EQ(res.Failure().reason.str(), R"(:3:46 error: var: operand is not alive
%2:ptr<function, f32, read_write> = var, %3
^^
@@ -1178,7 +1179,7 @@
auto res = ir::Validate(mod);
ASSERT_FALSE(res);
- EXPECT_EQ(res.Failure().reason.str(), R"(:3:46 error: var: instruction operand 0 missing usage
+ EXPECT_EQ(res.Failure().reason.str(), R"(:3:46 error: var: operand missing usage
%2:ptr<function, f32, read_write> = var, %3
^^
@@ -1285,7 +1286,7 @@
auto res = ir::Validate(mod);
ASSERT_FALSE(res);
- EXPECT_EQ(res.Failure().reason.str(), R"(:3:5 error: binary: instruction result is undefined
+ EXPECT_EQ(res.Failure().reason.str(), R"(:3:5 error: binary: result is undefined
undef = add 3i, 2i
^^^^^
@@ -1342,7 +1343,7 @@
auto res = ir::Validate(mod);
ASSERT_FALSE(res);
- EXPECT_EQ(res.Failure().reason.str(), R"(:3:5 error: unary: instruction result is undefined
+ EXPECT_EQ(res.Failure().reason.str(), R"(:3:5 error: unary: result is undefined
undef = negation 2i
^^^^^
@@ -2985,7 +2986,7 @@
auto res = ir::Validate(mod);
ASSERT_FALSE(res);
EXPECT_EQ(res.Failure().reason.str(),
- R"(:4:5 error: load_vector_element: instruction result is undefined
+ R"(:4:5 error: load_vector_element: result is undefined
undef = load_vector_element %2, 1i
^^^^^