[PATCH] D149041: [IVDescriptors] Add assert to isInductionPhi to check for invalid Phis

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 12:08:01 PDT 2023


fhahn accepted this revision.
fhahn added a comment.
This revision is now accepted and ready to land.

LGTM, thanks! IMO all callers in-tree ensure this invariant so the assert seems good to me.



================
Comment at: llvm/lib/Analysis/IVDescriptors.cpp:1491
+  assert(Phi->getParent() == AR->getLoop()->getHeader()
+    && "Invalid Phi node, not present in loop header");
+
----------------
jdoerfert wrote:
> Just return false?
AFAICT all callers in-tree ensure this invariant, so an assert seems good to me. Not sure if the verbose comment is needed in combination with the assert message.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149041



More information about the llvm-commits mailing list