[llvm] [LoopFusion] Validate loop structure before creating LoopCandidates (PR #192280)

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 13:49:09 PDT 2026


================
@@ -363,7 +363,9 @@ struct FusionCandidate {
 
   bool reportInvalidCandidate(Statistic &Stat) const {
     using namespace ore;
-    assert(L && Preheader && "Fusion candidate not initialized properly!");
+    assert(L && "Fusion candidate has null loop!");
+    if (!Preheader)
+      return false;
----------------
amehsan wrote:

alternatively you can modify this function so that it doesn't need the preheader. Header should always exist, so you can probably use the header for reporting. 

https://github.com/llvm/llvm-project/pull/192280


More information about the llvm-commits mailing list