mirror of
https://github.com/github/codeql.git
synced 2026-08-05 01:43:23 +02:00
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.
This commit is contained in:
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user