[PATCH] D115985: [JumpThreading] Remove unreachable blocks after jumpthreading
Duanyang Jing via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 23 03:37:22 PST 2021
duanyangjing added a comment.
In D115985#3204266 <https://reviews.llvm.org/D115985#3204266>, @nikic wrote:
> @duanyangjing So you're saying that keeping the unreachable block is a correctness issue, not an optimization issue? Is the IR produced by JumpThreading invalid in some way? Your comment in the test indicates that this causes issues in a subsequent pass, but we generally expect passes to be able to deal with unreachable code and the peculiar IR constructs that can appear inside it.
OK thanks for the suggestions, will update soon.
Yes I'm saying it should be a correctness issue to keep the unreachable block. Because the existing code already tries to delete unreachable block, but only when `pred_empty(BB)` holds. This does not cover situations like this (Sorry I cann't think of a better way to illustrate the CFG):
----edge from entry ---> | bb1 in cycle | --> | bb2 in cycle| ---imagine this edge goes back to bb1-->
Is the above argument alone (regardless of how other passes should handle peculiar IR constructs) strong enough to warrant a fix to remove the unreachable blocks? The actual problem happenes later in loop deletion, because some value defined in the unreachable cycle is used in the main component of the CFG. I can give a more detailed description if you think it's necessary.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115985/new/
https://reviews.llvm.org/D115985
More information about the llvm-commits
mailing list