[PATCH] D129653: isInductionPHI - Add some safety checks

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 18 10:33:04 PDT 2022


MaskRay requested changes to this revision.
MaskRay added inline comments.
Herald added a subscriber: StephenFan.


================
Comment at: llvm/lib/Analysis/IVDescriptors.cpp:1509
+
+  if (!Phi)
+    return false;
----------------
syzaara wrote:
> nickdesaulniers wrote:
> > fhahn wrote:
> > > This should never be called with `Phi` being null.
> > Sounds like a good case for Phi being a `&` (and additional `const`) rather than a non-const ptr.
> This would require many changes to all the places we call isInductionPHI from. Can we add the null check for now, and create a separate PR for this change? @fhahn 
No. Many APIs don't support null pointer arguments. The existing implementation of `isInductionPHI` requires this invariance and this patch should not regress it.


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

https://reviews.llvm.org/D129653



More information about the llvm-commits mailing list