Hi, On Wed, Nov 28 2018, Richard Sandiford wrote: >>> The pass gives a 7.6% improvement on Cortex-A72 for 554.roms_r at -O3 >>> and a 2.4% improvement for 465.tonto. I haven't found any SPEC tests >>> that regress. >>> >>> Sizewise, there's a 10% increase in .text for both 554.roms_r and >>> 465.tonto. That's obviously a lot, but in tonto's case it's because >>> the whole program is written using assumed-shape arrays and pointers, >>> so a large number of functions really do benefit from versioning. >>> roms likewise makes heavy use of assumed-shape arrays, and that >>> improvement in performance IMO justifies the code growth. >> >> Ouch. I know that at least with LTO IPA-CP can do "quite" some >> propagation of constant strides. Not sure if we're aggressive >> enough in actually doing the cloning for all cases we figure out >> strides though. But my question is how we can avoid doing the >> versioning for loops in the copy that did not have the IPA-CPed >> stride of one? Ideally we'd be able to mark individual references >> as {definitely,likely,unlikely,not}-unit-stride? > > This is a more elaborate version of what I was trying to do with > the IFN I'd mentioned on IRC a few weeks back. It would be a bit > like a long-living ASSERT_EXPR that provides hints about the value > of the SSA name. Another alternative would be to annotate the > SSA name itself, but then we'd easily lose the information during > optimisation. > > But will IPA-CP conditionally use a clone for a stride of 1 for > calls that pass a variable stride that might or might not be 1? > E.g. if it clones foo as foo.1 for calls in which a stride parameter > is 1 at compile time, does it also make foo call foo.1 when the stride > parameter is 1 at runtime? If not, that sounds like a missed optimisation. > If so, prune_conditions should stop us from versioning.
IPA-CP only creates clones for compile-time constants, it does not add any run-time check to the callers. It is an interesting idea that it could add these for some cases when it decides to do the cloning anyway. Martin