tint/uniforimty: Remove short-circuit special-case
Now that expressions can only ever have the `Next` behavior, short-circuiting operators will always reconverge. Change-Id: Ib9fe4c774191b8a304fa7f7a6eafdfa6c6e6f18a Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108202 Kokoro: Kokoro <noreply+kokoro@google.com> Auto-Submit: James Price <jrprice@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
parent
c81f9dce07
commit
fd9c3fe4bc
|
@ -1121,11 +1121,7 @@ class UniformityGraph {
|
|||
v1_cf->AddEdge(v1);
|
||||
|
||||
auto [cf2, v2] = ProcessExpression(v1_cf, b->rhs);
|
||||
|
||||
if (sem_.Get(b)->Behaviors() == sem::Behaviors{sem::Behavior::kNext}) {
|
||||
return std::pair<Node*, Node*>(cf, v2);
|
||||
}
|
||||
return std::pair<Node*, Node*>(cf2, v2);
|
||||
} else {
|
||||
auto [cf1, v1] = ProcessExpression(cf, b->lhs);
|
||||
auto [cf2, v2] = ProcessExpression(cf1, b->rhs);
|
||||
|
|
|
@ -6939,6 +6939,43 @@ test:5:11 note: reading from read_write storage buffer 'rw' may result in a non-
|
|||
)");
|
||||
}
|
||||
|
||||
TEST_F(UniformityAnalysisTest, ShortCircuiting_UniformLHS) {
|
||||
std::string src = R"(
|
||||
@group(0) @binding(0) var<storage, read> uniform_global : i32;
|
||||
|
||||
fn main() {
|
||||
let b = (uniform_global == 0) && (dpdx(1.0) == 0.0);
|
||||
}
|
||||
)";
|
||||
|
||||
RunTest(src, true);
|
||||
}
|
||||
|
||||
TEST_F(UniformityAnalysisTest, ShortCircuiting_NonUniformLHS) {
|
||||
std::string src = R"(
|
||||
@group(0) @binding(0) var<storage, read_write> non_uniform_global : i32;
|
||||
|
||||
fn main() {
|
||||
let b = (non_uniform_global == 0) && (dpdx(1.0) == 0.0);
|
||||
}
|
||||
)";
|
||||
|
||||
RunTest(src, false);
|
||||
EXPECT_EQ(error_,
|
||||
R"(test:5:41 warning: 'dpdx' must only be called from uniform control flow
|
||||
let b = (non_uniform_global == 0) && (dpdx(1.0) == 0.0);
|
||||
^^^^
|
||||
|
||||
test:5:37 note: control flow depends on non-uniform value
|
||||
let b = (non_uniform_global == 0) && (dpdx(1.0) == 0.0);
|
||||
^^
|
||||
|
||||
test:5:12 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value
|
||||
let b = (non_uniform_global == 0) && (dpdx(1.0) == 0.0);
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(UniformityAnalysisTest, ShortCircuiting_ReconvergeLHS) {
|
||||
std::string src = R"(
|
||||
@group(0) @binding(0) var<storage, read_write> non_uniform_global : i32;
|
||||
|
|
Loading…
Reference in New Issue