[PATCH] D140790: [BranchRelaxation] Prevent analyzing indirectBr during uncondBr fixup
Anshil Gandhi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 31 13:19:11 PST 2022
gandhi21299 added inline comments.
================
Comment at: llvm/lib/CodeGen/BranchRelaxation.cpp:514-515
// terminators.
- if (TII->analyzeBranch(*PrevBB, TBB, FBB, Cond))
- report_fatal_error("Could not analyze terminators.");
- if (!FBB) {
- if (!Cond.empty() && TBB && TBB == DestBB)
- RemoveBranch(PrevBB);
- if (!TBB || (TBB && !Cond.empty()))
- InsertUncondBranch(PrevBB, DestBB);
+ auto PrevBBTerm = PrevBB->getFirstTerminator();
+ if (PrevBBTerm == PrevBB->end()|| (PrevBBTerm != PrevBB->end() && !PrevBBTerm->isIndirectBranch())) {
+ if (TII->analyzeBranch(*PrevBB, TBB, FBB, Cond))
----------------
arsenm wrote:
> Can you factor this into something that looks like MachineBasicBlock::isReturnBlock, except for indirect branches?
Doesn't look like `MachineBasicBlock` has any method for indirect branches.
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