[LLVMdev] Alternate instruction sequences

Carlo Alberto Ferraris cafxx at strayorange.com
Thu Nov 10 03:59:11 PST 2011


On Thu, 10 Nov 2011 10:46:27 +0100, Duncan Sands wrote:
> Hi Carlo, the general policy is to canonicalize IR to some particular
> choice.  For example, if I1, I2, etc are all equivalent to each 
> other,
> then usually one of them will have been chosen as the canonical form
> (say I1) and all the others will be turned into I1.  If this is not
> the best choice for some target, then the code generators for that
> target need to transform it into something better for the target, but
> this is not at the IR level.

This might work for single instructions or simple instruction sequences 
but doesn't apply to, let's say, regions. As an example, take a loop 
that could be rewritten (unrolled, tiled, etc.) so that different 
versions of the same loop have wildly different memory access patterns. 
In this case, in order to choose the "best" version, the IR-level 
transform would have to know the details of the cache/memory subsytems 
of the current arch.



More information about the llvm-dev mailing list