[PATCH] D129653: isInductionPHI - Add some safety checks

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 09:50:27 PDT 2022


nickdesaulniers added inline comments.


================
Comment at: llvm/lib/Analysis/IVDescriptors.cpp:1537
 
+  if (!(AR->getLoop()->getLoopPreheader()))
+      return false;
----------------
syzaara wrote:
> fhahn wrote:
> > This is overly restrictive, whether the loop has a pre-header or not shouldn't impact whether a phi is an induction or now.
> On the line below, we query for AR->getLoop()->getLoopPreheader(). If it turns out that this is null, we will see a crash. I thought adding this would be safer rather than restrictive.
maybe Phi::getIncomingValueForBlock should return `nullptr` if passed `nullptr`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129653/new/

https://reviews.llvm.org/D129653



More information about the llvm-commits mailing list