From 28bd631d52743281bef990bbeb917fb45f78d129 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Fri, 26 Jun 2026 16:01:19 +0100 Subject: [PATCH] Accept test result for improved GVN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This occurs as a direct consequence of the CFG migration. IR::EvalInstruction now deliberately creates a value-producing instruction for a NotExpr (or LogicalBinaryExpr) from its after-node, but only when the expression is not in a boolean conditional contex. !d here sits in a const initializer, not an if/for/switch condition, so isInBooleanCondContext is false and the after-node becomes an EvalInstruction — surfacing as the After !... data-flow node. That node reports getBoolValue() = true and isPlatformIndependentConstant(), so GVN can match it to the true literal. On main, a NotExpr in this position produced no such value node (the old hand-written CFG split the ! evaluation across branch outcomes rather than exposing a single combined value node), so there was no DataFlow::Node for !d to be numbered, and hence no row. The new design intentionally re-introduces a single combined value node in non-conditional contexts, which is exactly what makes this (correct) GVN equivalence visible. So: the line is right, and it's expected fallout from the migration's handling of !/&&/|| value nodes. --- .../go/dataflow/GlobalValueNumbering/GlobalValueNumber.expected | 1 + 1 file changed, 1 insertion(+) diff --git a/go/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/GlobalValueNumber.expected b/go/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/GlobalValueNumber.expected index 22336637125..5a6037588aa 100644 --- a/go/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/GlobalValueNumber.expected +++ b/go/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/GlobalValueNumber.expected @@ -34,6 +34,7 @@ | regressions.go:5:11:5:31 | call to Sizeof | regressions.go:5:11:5:31 | call to Sizeof | | regressions.go:5:25:5:30 | call to test | regressions.go:5:25:5:30 | call to test | | regressions.go:7:11:7:15 | false | regressions.go:7:11:7:15 | false | +| regressions.go:9:11:9:12 | After !... | regressions.go:11:11:11:14 | true | | regressions.go:9:12:9:12 | d | regressions.go:7:11:7:15 | false | | regressions.go:11:11:11:14 | true | regressions.go:11:11:11:14 | true | | regressions.go:30:9:30:22 | call to getPayload | regressions.go:30:9:30:22 | call to getPayload |