[llvm-commits] PATCH: instcombine switch on select of constants to br

Nick Lewycky nicholas at mxc.ca
Sun Jan 9 18:46:39 PST 2011


Alistair Lynn wrote:
> Hi-
>
> The attached patch catches a previously missed optimisation on switches of the
> form switch (select cond, A, B) where A and B are constants - the switch can be
> folded to a conditional branch on cond.

This isn't safe to do here: InstCombine needs to preserve the CFG, which 
means that each block must have the same successors before and after 
instcombine runs. Instead, please add this optimization to SimplifyCFG 
if it isn't there already.

Nick



More information about the llvm-commits mailing list