[PATCH] D140790: [BranchRelaxation] Prevent analyzing indirectBr during uncondBr fixup
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 10:05:39 PST 2023
efriedma added inline comments.
================
Comment at: llvm/lib/CodeGen/BranchRelaxation.cpp:516
+ if (PrevBBTerm == PrevBB->end() ||
+ (PrevBBTerm != PrevBB->end() && !PrevBBTerm->isIndirectBranch())) {
+ if (TII->analyzeBranch(*PrevBB, TBB, FBB, Cond))
----------------
This condition doesn't seem right.
The point of the existing code is to handle fallthrough from PrevBB to DestBB: we're inserting a block between those two blocks, so any fallthrough must be rewritten to a direct branch. We can only skip this if we can prove there isn't any fallthrough.
isIndirectBranch() doesn't prove there isn't any fallthrough; whether a branch is indirect isn't related to whether it's conditional. MachineBasicBlock::canFallThrough() is probably appropriate.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140790/new/
https://reviews.llvm.org/D140790
More information about the llvm-commits
mailing list