Page MenuHomePhabricator

[SCEV] Support modelling of same base pointer `select`s in more complex than most trivial cases (when there is a base variable offset)

Authored by lebedev.ri on Apr 28 2022, 4:49 PM.



umin_seq select modelling requires that one of the hands of the select must be a constant.
After we remove pointer base, in all but most trivial cases,
there will likely be some other offset between the base and the selected-between pointers,
and if both of them happen to have some variable offset, we fail,
even if they have *the same* variable offset.

Instead, we should try to factor it out, perhaps that leaves us with a constant in one hand.

Diff Detail

Event Timeline

lebedev.ri created this revision.Apr 28 2022, 4:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2022, 4:49 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
mkazantsev accepted this revision.May 10 2022, 2:01 AM

Looks nice, but I'd suggest some restructuring.


Should it be a method of ScalarEvolution? I looks like it can be reused somewhere.

Should we make it bool and return false if there are no common expressions?


I'd rather bail here if we detected that no common ops were found just to save CT on SCEV simplification.


Thinking more of it, as a follow-up maybe: if both old LHS and RHS had no-wrap flags, then all new expressions and Common expr should also preserve them. Need to think more, but maybe it's worth doing.

This revision is now accepted and ready to land.May 10 2022, 2:01 AM