This is an archive of the discontinued LLVM Phabricator instance.

[IVDescriptors] Add assert to isInductionPhi to check for invalid Phis
ClosedPublic

Authored by vedant-amd on Apr 23 2023, 11:40 PM.

Details

Summary

Phis that are present inside loop headers can only be Induction Phis
legally. This patch adds an assertion to isInductionPhi which checks for
the said legality and it also updates the docs of the said function to
reflect the given legality.

Diff Detail

Event Timeline

vedant-amd created this revision.Apr 23 2023, 11:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2023, 11:40 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
vedant-amd requested review of this revision.Apr 23 2023, 11:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2023, 11:40 PM
vedant-amd edited the summary of this revision. (Show Details)

minor fix to commit message

vedant-amd edited the summary of this revision. (Show Details)

run clang-format

Removed whitespaces

jdoerfert added inline comments.Apr 25 2023, 11:54 AM
llvm/lib/Analysis/IVDescriptors.cpp
1491

Just return false?

fhahn accepted this revision.Apr 25 2023, 12:07 PM

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

llvm/lib/Analysis/IVDescriptors.cpp
1491

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.

This revision is now accepted and ready to land.Apr 25 2023, 12:07 PM
vedant-amd added a comment.EditedApr 25 2023, 8:22 PM

Hey @fhahn I don't have rights to commit this myself, can you commit it on my behalf ? (or give me commit access? edit: I have mailed chris, as per the docs) Thanks !

Name: Vedant Paranjape
email: vedant.paranjape@amd.com
github: vedantparanjape-amd

This revision was landed with ongoing or failed builds.Apr 27 2023, 10:29 PM
This revision was automatically updated to reflect the committed changes.