mirror of
https://github.com/github/codeql.git
synced 2025-12-19 10:23:15 +01:00
The existing unreachable IR removal code only retargeted an infeasible edge to an `Unreached` instruction if the successor of the edge was an unreachable block. This is too conservative, because it doesn't remove an infeasible edge that targets a block that is still reachable via other paths. The trivial example of this is `do { } while (false);`, where the back edge is infeasible, but the body block is still reachable from the loop entry.
This change retargets all infeasible edges to `Unreached` instructions, regardless of the reachability of the successor block.
7 lines
355 B
Plaintext
7 lines
355 B
Plaintext
| constant_func.cpp:1:5:1:18 | IR: ReturnConstant | 7 |
|
|
| constant_func.cpp:5:5:5:21 | IR: ReturnConstantPhi | 7 |
|
|
| constant_func.cpp:25:5:25:25 | IR: ReturnConstantPhiLoop | 7 |
|
|
| constant_func.cpp:34:5:34:22 | IR: UnreachableViaGoto | 0 |
|
|
| constant_func.cpp:41:5:41:17 | IR: UnreachableIf | 0 |
|
|
| constant_func.cpp:62:5:62:16 | IR: DoWhileFalse | 1 |
|