[llvm] [IVDesc] Check loop-preheader for loop-legality when pass-remarks enabled (PR #166310)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 3 02:41:28 PST 2026


================
@@ -649,6 +651,9 @@ bool RecurrenceDescriptor::AddReductionVar(
   collectCastInstrs(TheLoop, ExitInstruction, RecurrenceType, CastInsts,
                     MinWidthCastToRecurrenceType);
 
+  if (!RdxStart)
+    return false;
+
----------------
fhahn wrote:

If there's no loop preheader, you can exit early above, no need to dealy until here (also RdxStart would be left unitialized as is currently?)

```suggestion
```

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


More information about the llvm-commits mailing list