This is an archive of the discontinued LLVM Phabricator instance.

[SCEV][NFC] Verify intergity of SCEVUsers
ClosedPublic

Authored by mkazantsev on Oct 24 2021, 11:28 PM.

Details

Summary

Make sure that, for every living SCEV, we have all its direct
operand tracking it as their user.

Diff Detail

Event Timeline

mkazantsev created this revision.Oct 24 2021, 11:28 PM
mkazantsev requested review of this revision.Oct 24 2021, 11:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2021, 11:28 PM

Not 100% sure it should be UniqueSCEVs to iterate on; besides, we don't verify obsolete dangling users so far (at least not before we start dropping them). Ideas for further improvement welcome.

Not 100% sure it should be UniqueSCEVs to iterate on.

I think it's the right one. This is a property which should hold for all SCEVs. We'll miss stale unknowns (since they're removed from that set), but that's okay because they have no operands.

besides, we don't verify obsolete dangling users so far (at least not before we start dropping them)

I have no idea what you mean by this. Expand?

I'd LGTM this except for open question above. I'm concerned I'm missing something.

llvm/lib/Analysis/ScalarEvolution.cpp
12900

This code exists in at least one other place (getDefiningScopeBound). I'm fine with this landing as is, but we should probably start thinking about how to abstract user and operand walks.

12913

Minor: Can you make the normal case an early continue to reduce nesting?

I have no idea what you mean by this. Expand?

Never mind, I confused myself thinking that we'd remove dependencies of SCEVs on forget, but we never do it actually. So it should never be the case.

mkazantsev added inline comments.Oct 25 2021, 9:56 PM
llvm/lib/Analysis/ScalarEvolution.cpp
12900

Will see if I can follow-up with factoring out this common part.

mkazantsev marked an inline comment as done.

Reduced nest.

reames accepted this revision.Oct 26 2021, 11:23 AM

LGTM

This revision is now accepted and ready to land.Oct 26 2021, 11:23 AM
This revision was automatically updated to reflect the committed changes.