This is a more limited change which we can iterate on later.
Also remove the isCopy test, which probably isn't useful anymore.
Differential D8451
[MachineLICM] Sink instructions only if they are unlikely to be executed djasper on Mar 19 2015, 10:37 AM. Authored by
Details
This is a more limited change which we can iterate on later. Also remove the isCopy test, which probably isn't useful anymore.
Diff Detail Event Timeline
Comment Actions Turns out the IsCopy check was actually important and papered over the fact that we cannot sink something that is used by a PHI (because we sink to before the first non-PHI instruction later). Sinking something that is used by a PHI probably also doesn't make much sense (or at least needs a separate investigation) as e.g. we might sink along the loop-entry edge. Also simplified the implementation.
Comment Actions Hi Daniel,
Ok I see where you are going now. That being said, I think that the overhead of stores + stack update (i.e., what we are talking about) is not that relevant. Anyway, I agree that it should be taken into account at some point.
The opposite :). We should *not* sink those instructions. Of course, we agree that this is useless to sink if register pressure is not a problem, which we do not check at all here.
Aside from register pressure, which now I understand you want to consider later, I am still not convinced that the suggested check represent a meaningful cost model. Cheers,
Comment Actions I think that largely depends on whether we think the instruction inside the loop is normally executed (more than once).
Yeah, sorry, I meant we should sink the instructions where spill reload is more expensive than the actual instruction (as long as there is register pressure). I think I should look first look at register pressure first. Will do.
|
Could you add a comment on the choice of the magic constant?
It’s the same used in the loop vectorizer IIRC, but having some hints why we choose that is a good thing.
Would it may send to make the denominator parametrizable so that it is easy to check different threshold?