[LLVMdev] Alternate instruction sequences

cafxx cafxx at strayorange.com
Wed Nov 9 00:52:38 PST 2011

I was wondering, is there any way to express in the IR that an 
instruction/instruction sequence/basic 
block/region/function/module/whatever is an alternate version of 
another? e.g. let's keep things simple and say that I have an 
instruction I. An optimization pass reads it and could be able to 
produce one or more functionally-equivalent instructions I1, ..., In 
without being really able to ascertain which one is "best" w.r.t. the 
optimization goal. While this could be true even for a single, isolated, 
pass it's all the more true for chains of optimizations (i.e. 'which one 
of the alternate instructions will be the "best" after all other 
optimizations have run?'). In this case, wouldn't it be interesting to 
be able to insert into the IR all (or some of) the alternate versions, 
mark them as such and defer the decision about which one will be used 
after all optimizations have run?
Carlo Alberto

More information about the llvm-dev mailing list