Skip to content

Commit 83c7dd3

Browse files
committed
Accept test result for improved GVN
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.
1 parent 8c149c1 commit 83c7dd3

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

go/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/GlobalValueNumber.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
| regressions.go:5:11:5:31 | call to Sizeof | regressions.go:5:11:5:31 | call to Sizeof |
3535
| regressions.go:5:25:5:30 | call to test | regressions.go:5:25:5:30 | call to test |
3636
| regressions.go:7:11:7:15 | false | regressions.go:7:11:7:15 | false |
37+
| regressions.go:9:11:9:12 | After !... | regressions.go:11:11:11:14 | true |
3738
| regressions.go:9:12:9:12 | d | regressions.go:7:11:7:15 | false |
3839
| regressions.go:11:11:11:14 | true | regressions.go:11:11:11:14 | true |
3940
| regressions.go:30:9:30:22 | call to getPayload | regressions.go:30:9:30:22 | call to getPayload |

0 commit comments

Comments
 (0)