[LLVMdev] About LLVM switch instruction

Mark Lacey mark.lacey at apple.com
Wed Jul 17 22:28:22 PDT 2013


On Jul 17, 2013, at 10:09 PM, Milind Chabbi <Milind.Chabbi at rice.edu> wrote:
> Hi Mark,
> 
> This will workaround the problem of "default" branch restriction on
> the switch instruction. The trouble with this technique is that it
> will trump later optimization phases such as constant propagation.
> When a block was part of a case, because of the knowledge of the case
> value, the block was a candidate for better optimization. However,
> when we move the body of the case into the default, the knowledge of
> the case value is lost and the body is less optimizable.

Yes, it is not ideal for a variety of reasons, and I am actually looking at improving how we deal with unreachable switch defaults now because of that.

Could you provide any additional detail about the transforms you are doing and what you are trying to accomplish?

Mark




More information about the llvm-dev mailing list