Sebastian Pop and I have been discussing the option of designing a new pass, based on vrp, to normalize integer types towards a canonical supertype typically a machine word, equivalent to signed long, or to truncate to a smaller-size word when it makes sense. This would be a very simple pass (on top of not-so-simple vrp), but arguably a quite regression-prone one as well (due to aliases/escape and common C standard violations).

The pass could be parameterized with three different objectives, depending on where it is scheduled in the pass manager.

(1) canonicalize to the supertype aggressively, to facilitate the application of further passes like autovect which require very precise understanding of the type conversions; (2) compress the types to increase vectorization factor and reduce register pressure (assuming the target supports sub-word register allocation with register aliases); (3) optimize the types to minimize the dynamic number of casts that result in actual ASM instructions.

Graphite and the vectorizer would clearly benefit from such a pass, at least if it implemented objective (1).

I wonder if some of this is already implemented somewhere, or if someone played with it in the past, or is interesting in contributing.

Nothing is planned yet on our side, and temporary fixes exist in the short term (as far as Graphite and the vectorizer are concerned), but it would potentially be of great help.

Feedback welcome,
Albert

Reply via email to