[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
Mon Feb 2 02:46:25 PST 2026


================
@@ -222,7 +222,9 @@ bool RecurrenceDescriptor::AddReductionVar(
 
   // Obtain the reduction start value from the value that comes from the loop
   // preheader.
-  Value *RdxStart = Phi->getIncomingValueForBlock(TheLoop->getLoopPreheader());
+  Value *RdxStart;
+  if (TheLoop->getLoopPreheader())
+    RdxStart = Phi->getIncomingValueForBlock(TheLoop->getLoopPreheader());
----------------
fhahn wrote:

Yes, IIRC this should be enough; it looks like the other recent test failures you mentioned are unrelated to the change

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


More information about the llvm-commits mailing list