[PATCH] D115985: [JumpThreading] Remove unreachable blocks after jumpthreading

Duanyang Jing via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 18 00:35:17 PST 2021


duanyangjing added a comment.

In D115985#3201213 <https://reviews.llvm.org/D115985#3201213>, @nikic wrote:

> Please submit patches with full context (`-U99999`).
>
> Why is it necessary for jump threading to remove unreachable blocks?

Because right now we have the following code snippet which seems to try to handle unreachable blocks:

  if (pred_empty(&BB)) {
    // When processBlock makes BB unreachable it doesn't bother to fix up
    // the instructions in it. We must remove BB to prevent invalid IR.
    LLVM_DEBUG(dbgs() << "  JT: Deleting dead block '" << BB.getName()
                      << "' with terminator: " << *BB.getTerminator()
                      << '\n');
    LoopHeaders.erase(&BB);
    LVI->eraseBlock(&BB);
    DeleteDeadBlock(&BB, DTU);
    Changed = true;
    continue;
  }


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115985/new/

https://reviews.llvm.org/D115985



More information about the llvm-commits mailing list