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

Alistair Lynn arplynn at gmail.com
Sun Jan 9 19:14:50 PST 2011


Hi-

So done.

Alistair

On 10 Jan 2011, at 02:46, Nick Lewycky wrote:

> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: simplifycfg-switch-patch.diff
Type: application/octet-stream
Size: 2686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110110/13ee9340/attachment.obj>


More information about the llvm-commits mailing list