MachineBasicBlock::updateTerminator now requires an explicit layout successor.
authorJames Y Knight <jyknight@google.com>
Wed, 19 Feb 2020 15:41:28 +0000 (10:41 -0500)
committerJames Y Knight <jyknight@google.com>
Sun, 7 Jun 2020 02:30:51 +0000 (22:30 -0400)
commit1978309db1f9f7530269950d87b18d4c3abe1d05
treeebc35c136fc7ad6ba59333eebdbaa4b9cb8cdc03
parent4b6f0ea66cb12798bb7de035ac9b676f61534649
MachineBasicBlock::updateTerminator now requires an explicit layout successor.

Previously, it tried to infer the correct destination block from the
successor list, but this is a rather tricky propspect, given the
existence of successors that occur mid-block, such as invoke, and
potentially in the future, callbr/INLINEASM_BR. (INLINEASM_BR, in
particular would be problematic, because its successor blocks are not
distinct from "normal" successors, as EHPads are.)

Instead, require the caller to pass in the expected fallthrough
successor explicitly. In most callers, the correct block is
immediately clear. But, in MachineBlockPlacement, we do need to record
the original ordering, before starting to reorder blocks.

Unfortunately, the goal of decoupling the behavior of end-of-block
jumps from the successor list has not been fully accomplished in this
patch, as there is currently no other way to determine whether a block
is intended to fall-through, or end as unreachable. Further work is
needed there.

Differential Revision: https://reviews.llvm.org/D79605
llvm/include/llvm/CodeGen/MachineBasicBlock.h
llvm/lib/CodeGen/BBSectionsPrepare.cpp
llvm/lib/CodeGen/BranchRelaxation.cpp
llvm/lib/CodeGen/MachineBasicBlock.cpp
llvm/lib/CodeGen/MachineBlockPlacement.cpp
llvm/lib/CodeGen/TailDuplicator.cpp
llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp
llvm/lib/Target/AArch64/AArch64ConditionalCompares.cpp
llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
llvm/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp