[llvm] [LoopFusion] Validate loop structure before creating LoopCandidates (PR #192280)
Madhur Amilkanthwar via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 16 01:28:29 PDT 2026
================
@@ -573,6 +575,14 @@ struct LoopFuser {
/// Flow Equivalent sets, sorted by dominance.
void collectFusionCandidates(const LoopVector &LV) {
for (Loop *L : LV) {
+ // Skip loops that do not have the structure required for fusion (e.g.
+ // loops with indirectbr may lack a preheader). Creating a FusionCandidate
+ // for such loops can lead to reportInvalidCandidate being called with
+ // a null Preheader.
+ if (!L->getLoopPreheader() || !L->getHeader() || !L->getExitingBlock() ||
+ !L->getExitBlock() || !L->getLoopLatch())
+ continue;
----------------
madhur13490 wrote:
Doesn't seems so. Please see https://github.com/llvm/llvm-project/pull/192280#issuecomment-4258503045
https://github.com/llvm/llvm-project/pull/192280
More information about the llvm-commits
mailing list