[llvm] [CodeGen] Ignore requiresStructuredCFG check in canSplitCriticalEdge if successor is loop header (PR #154063)
Wenju He via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 23 22:47:16 PDT 2025
================
@@ -1403,7 +1403,15 @@ bool MachineBasicBlock::canSplitCriticalEdge(
const MachineFunction *MF = getParent();
// Performance might be harmed on HW that implements branching using exec mask
// where both sides of the branches are always executed.
- if (MF->getTarget().requiresStructuredCFG())
+ // However, if `Succ` is a loop header, splitting the critical edge will not
+ // break structured CFG.
+ auto SuccIsLoopHeader = [&]() {
+ if (MLI)
+ if (MachineLoop *L = MLI->getLoopFor(Succ); L && L->getHeader() == Succ)
+ return true;
+ return false;
----------------
wenju-he wrote:
> This also doesn't need to be a lambda
done, thanks
https://github.com/llvm/llvm-project/pull/154063
More information about the llvm-commits
mailing list