[all-commits] [llvm/llvm-project] 197830: MachineBasicBlock::updateTerminator now requires a...

James Y Knight via All-commits all-commits at lists.llvm.org
Sat Jun 6 19:41:55 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1978309db1f9f7530269950d87b18d4c3abe1d05
      https://github.com/llvm/llvm-project/commit/1978309db1f9f7530269950d87b18d4c3abe1d05
  Author: James Y Knight <jyknight at google.com>
  Date:   2020-06-06 (Sat, 06 Jun 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/MachineBasicBlock.h
    M llvm/lib/CodeGen/BBSectionsPrepare.cpp
    M llvm/lib/CodeGen/BranchRelaxation.cpp
    M llvm/lib/CodeGen/MachineBasicBlock.cpp
    M llvm/lib/CodeGen/MachineBlockPlacement.cpp
    M llvm/lib/CodeGen/TailDuplicator.cpp
    M llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp
    M llvm/lib/Target/AArch64/AArch64ConditionalCompares.cpp
    M llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
    M llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp

  Log Message:
  -----------
  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


  Commit: 748d92b4d3142ad57266211351d3377ed976f3dc
      https://github.com/llvm/llvm-project/commit/748d92b4d3142ad57266211351d3377ed976f3dc
  Author: James Y Knight <jyknight at google.com>
  Date:   2020-06-06 (Sat, 06 Jun 2020)

  Changed paths:
    M llvm/lib/CodeGen/MachineVerifier.cpp
    M llvm/test/CodeGen/Hexagon/cext-opt-range-offset.mir
    M llvm/test/CodeGen/WebAssembly/eh-labels.mir
    M llvm/test/MachineVerifier/verifier-pseudo-terminators.mir

  Log Message:
  -----------
  Simplify MachineVerifier's block-successor verification.

There's two properties we want to verify:

1. That the successors returned by analyzeBranch are in the CFG
   successor list, and
2. That there are no extraneous successors are in the CFG successor
   list.

The previous implementation mostly accomplished this, but in a very
convoluted manner.

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


Compare: https://github.com/llvm/llvm-project/compare/4b6f0ea66cb1...748d92b4d314


More information about the All-commits mailing list