[all-commits] [llvm/llvm-project] 40a407: [BasicBlockUtils] Allow splitting predecessors wit...

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Jul 7 00:18:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 40a4078e14c2c6c5e2d0a1776285aa7491e791b3
      https://github.com/llvm/llvm-project/commit/40a4078e14c2c6c5e2d0a1776285aa7491e791b3
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-07-07 (Thu, 07 Jul 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/JumpThreading.cpp
    M llvm/lib/Transforms/Scalar/LICM.cpp
    M llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
    M llvm/lib/Transforms/Utils/LoopUtils.cpp
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/JumpThreading/callbr-edge-split.ll
    M llvm/test/Transforms/JumpThreading/pr46857-callbr.ll
    M llvm/test/Transforms/LICM/callbr-crash.ll
    M llvm/test/Transforms/SimplifyCFG/jump-threading.ll

  Log Message:
  -----------
  [BasicBlockUtils] Allow splitting predecessors with callbr terminators

SplitBlockPredecessors currently asserts if one of the predecessor
terminators is a callbr. This limitation was originally necessary,
because just like with indirectbr, it was not possible to replace
successors of a callbr. However, this is no longer the case since
D67252. As the requirement nowadays is that callbr must reference
all blockaddrs directly in the call arguments, and these get
automatically updated when setSuccessor() is called, we no longer
need this limitation.

The only thing we need to do here is use replaceSuccessorWith()
instead of replaceUsesOfWith(), because only the former does the
necessary blockaddr updating magic.

I believe there's other similar limitations that can be removed,
e.g. related to critical edge splitting.

Differential Revision: https://reviews.llvm.org/D129205




More information about the All-commits mailing list