[PATCH] D129653: isInductionPHI - Add some safety checks
Zaara Syeda via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 13 10:37:25 PDT 2022
syzaara added inline comments.
================
Comment at: llvm/lib/Analysis/IVDescriptors.cpp:1537
+ if (!(AR->getLoop()->getLoopPreheader()))
+ return false;
----------------
nickdesaulniers wrote:
> 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`?
Yes, the other option is it move this check into Phi::getIncomingValueForBlock. @fhahn would that be more preferable?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129653/new/
https://reviews.llvm.org/D129653
More information about the llvm-commits
mailing list