[LLVMdev] Case in Case optimisation: worthwhile?

Chris Lattner sabre at nondot.org
Thu Oct 4 10:49:15 PDT 2007


On Thu, 4 Oct 2007, John van Schie wrote:
> So basicly I want to know the following:
>
> 1) Do you think this optimisation is nice to implement in LLVM, then  I
> am not the only one benefitting from it, or should I apply it on the
> intermediate language in the back end.

Yes, this should go into LLVM.

> 2) If I want to implement this in LLVM, can somebody give me pointers to
> the source files to start with?

This sort of optimization is the thing that predsimplify was supposed to 
fix.  The basic issue is that you need to know that in "switch (x) { case 
14:" in the region dominated by the 'case 14' that x is equal to 14. 
Knowing and tracking this information allows simplifications, for example 
another switch on x can be reduced to switch on 14.. which turns into an 
unconditional branch.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list