This is an archive of the discontinued LLVM Phabricator instance.

[NFCI][SCEV] getPointerBase(): de-recursify
ClosedPublic

Authored by lebedev.ri on Jun 26 2020, 2:06 AM.

Details

Summary

This is boringly straight-forward, each iteration we see if
V is some expression that we can look into, and if it has
a single pointer operand, then set V to that operand
and repeat.

Diff Detail

Event Timeline

lebedev.ri created this revision.Jun 26 2020, 2:06 AM

Do you have some plan to start using the DepthLimit somewhere?

Do you have some plan to start using the DepthLimit somewhere?

No, i could drop it.
But it may be a good idea to consistently have such cut-offs available for use.

I'd prefer not to add the cutoff until we have a real use for it.

I'd prefer not to add the cutoff until we have a real use for it.

I see, droped it.

LG?

nikic accepted this revision.Jun 27 2020, 1:31 AM

LGTM

llvm/lib/Analysis/ScalarEvolution.cpp
3970

As this is a recurring pattern, I wonder if there's room for something like llvm::get_unique(R &&Range, Getter Fn) in STLExtras.

This revision is now accepted and ready to land.Jun 27 2020, 1:31 AM

LGTM

Thank you for the review.

This revision was automatically updated to reflect the committed changes.