This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Factor out common visiting patterns for SCEV rewriters. NFC.
ClosedPublic

Authored by sbaranga on Sep 29 2015, 7:11 AM.

Details

Summary

Add a SCEVRewriteVisitor class which contains the common
visiting patterns used when rewriting SCEVs.

SCEVParameterRewriter and SCEVApplyRewriter now inherit
from SCEVRewriteVisitor (and are therefore much simpler).

Diff Detail

Event Timeline

sbaranga updated this revision to Diff 35967.Sep 29 2015, 7:11 AM
sbaranga retitled this revision from to [SCEV] Factor out common visiting patterns for SCEV rewriters. NFC..
sbaranga updated this object.
sbaranga added reviewers: anemet, mzolotukhin.
sbaranga added a subscriber: llvm-commits.
sbaranga updated this revision to Diff 35984.Sep 29 2015, 9:03 AM

Add casts to work around the lack of virtual methods.
Maybe a better idea would be to have virtual methods?

Makes sense to me too, but I'm also not confident enough to approve this one.

sanjoy accepted this revision.Oct 23 2015, 11:05 AM
sanjoy added a reviewer: sanjoy.

lgtm with comments addressed (addressing them in a separate change is fine).

include/llvm/Analysis/ScalarEvolutionExpressions.h
556–560

We're moving away from Entity Name - description style comments.

669

I see you didn't add this code; but a name more descriptive than SCEVApplyRewriter may be better (unless "apply" has some special meaning I'm not aware of).

691

Looks like this code was pre-existing; but can you please change this to do a cast<> (in this change or a later change).

This revision is now accepted and ready to land.Oct 23 2015, 11:05 AM
sbaranga updated this revision to Diff 38390.Oct 26 2015, 4:18 AM
sbaranga edited edge metadata.

Update the header comment for the SCEVRewriteVisitor class to match current style.

sbaranga closed this revision.Oct 26 2015, 4:20 AM

Thanks! Committed in r251283. I'll fix the other issues with a follow-up patch.

-Silviu