[PATCH] D134557: [BranchRelaxation] Fall through only if block has no unconditional branches

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 11:30:15 PDT 2022


efriedma added a comment.

The logic here has gotten more confusing, not less.  Please just don't call getFallThrough; you can directly reason about the result of analyzeBranch.

>From TargetInstrInfo.h:

  /// 1. If this block ends with no branches (it just falls through to its succ)
  ///    just return false, leaving TBB/FBB null.
  /// 2. If this block ends with only an unconditional branch, it sets TBB to be
  ///    the destination block.
  /// 3. If this block ends with a conditional branch and it falls through to a
  ///    successor block, it sets TBB to be the branch destination block and a
  ///    list of operands that evaluate the condition. These operands can be
  ///    passed to other TargetInstrInfo methods to create new branches.
  /// 4. If this block ends with a conditional branch followed by an
  ///    unconditional branch, it returns the 'true' destination in TBB, the
  ///    'false' destination in FBB, and a list of operands that evaluate the
  ///    condition.  These operands can be passed to other TargetInstrInfo
  ///    methods to create new branches.

1 is fallthrough.  2 is not fallthrough.  3 is fallthrough.  4 is not fallthrough.

--------

Not sure I understand the logic here when analyzeBranch fails; you just assume the block doesn't fall through?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134557



More information about the llvm-commits mailing list