On 07/25/2017 03:25 PM, Wilco Dijkstra wrote: > Jeff Law wrote: > >> My only concern here would be cases where we don't end up eliminating FP >> to SP. But I'd think it's unlikely that we'd have enough auto-inc >> opportunities on the frame pointer for it to matter much anyway. > > What kind of case are you thinking of? Whether it is SP or FP doesn't matter, > we cannot copy propagate the pointer: None in particular. My point was that we're unlikely to even see that many cases where an autoinc opportunity exists using the frame pointer to begin with. So I don't see that restricting auto-incs involving FP should ever cause significant problems.
> > add x1, fp, 32 > strb w0, [x1, -1]! > > Not even if the elimination offset is zero: > > mov x1, fp > strb w0, [x1, 31]! > > Basically an independent add is better than the above: > > strb w0, [fp, 31] > add x1, fp, 31 > > I think the phase is still overly aggressive and there are more cases where > it > doesn't make sense to use auto increment. For example you will extra moves > just like the 2nd case above when it's not the last use of the source. Certainly possible in the general sense, though we have some targets (SH IIRC) that try really hard to exploit autoinc addressing modes. On modern processors I would think the independent add is usually a better choice. Instructions with multiple outputs are problematic for out-of-order processors. You often end up holding resources within the CPU until the instruction can fully retire and often no dependent insns are allowed to move forward either, even if they just depended on the embedded arithmetic which may be ready to retire had it been issued as a separate instruction. Jeff