[PATCH] D115832: [DFAJumpThreading] Determinator BB should precede switch-defining BB
Alexey Zhikhartsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 15 14:45:29 PST 2021
alexey.zhikhar added a comment.
I attach a picture of the CFG illustrating the problem in one of the llvm-test-suite tests that was failing on X86.
The DFA jump threader attempted to jump-thread the switch inside the `if.else` basic block. One of the threading paths is
< if.else sw.default.i if.end while.body sw.bb1 sw.epilog >
where basic block `sw.epilog` is marked as the determinator.
Determinator BB is the BB that that contains the phi-node that "determines" the value of the switch condition. Does `sw.epilog` determine the next state in the switch statement inside `if.else`? Not immediately: `%next.state` first is propagated through `%state.1` and `%state` and only then this new state is used.
To catch and discard this case, this patch verifies the sequence of types of basic blocks: determinator BB should be followed by the basic block that defines the switch condition, followed by the basic block that uses the switch condition (the BB with the candidate switch).
F21044382: image.png <https://reviews.llvm.org/F21044382>
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115832/new/
https://reviews.llvm.org/D115832
More information about the llvm-commits
mailing list