This patch enhances SLSR to handle another candidate form &B[i * S]. If
we found two candidates
S1: X = &B[i * S]
S2: Y = &B[i' * S]
and S1 dominates S2, we can replace S2 with
Y = &X[(i' - i) * S]
Differential D7459
[SLSR] handle candidate form &B[i * S] jingyue on Feb 5 2015, 10:57 PM. Authored by
Details This patch enhances SLSR to handle another candidate form &B[i * S]. If S1: X = &B[i * S] and S1 dominates S2, we can replace S2 with Y = &X[(i' - i) * S]
Diff Detail
Event Timeline
Comment Actions Good observation, Hal. SCEV is there for you to use, so you might as well. I agree that we don't want to reinvent the abstraction over arithmetic expressions in each pass. I will mention two issues: (1) SCEV may end up recursively evaluating more of the expression than you need, which could be expensive. In the first patch, you had a very simple pattern match, so SCEV didn't seem worthwhile. As you try to cover more patterns, SCEV makes more sense. (2) SCEVExpander is fraught with peril. If you can use SCEV to help discover candidates, but leave your rewriteCandidateWithBases() code as-is, then you have nothing to worry about. If you want to use SCEVExpander then you need to be very careful about the expressions you generate. Comment Actions Take 2 towards handling GEPs in SLSR
Comment Actions Hi Andrew and Hal, Sorry about the long delay in reworking this patch. I hope it is not too cache-cold :) Two major changes against the previous patch are:
I wish I could use SCEV more extensively in this patch, e.g., to discover candidates and compute bumps. However, I didn't do that for two reasons:
Comment Actions Few drop-by comments inline.
Comment Actions Thanks Hal and Sanjoy for the review. I will fix all other comments.
Comment Actions some more minor changes
Comment Actions No further comments from me. I don't see any issues and will defer to the other reviewers. |