[PATCH] SimplifyCFG: turn recursive GatherConstantCompares into iterative

Mehdi Amini mehdi.amini at apple.com
Mon Nov 17 11:25:25 PST 2014


Hi all,

A long sequence of || or && of integer comparison against the same value is turned into a switch in SimplifyCFG.

The implementation was recursive and could lead to a stack explosion. I turned it into an iterative implementation in this patch.

As a side question, the existing code assumes that the “icmp" are always taking the constant as the second operand (it never tries to match the first operand). Is it something that is canonicalized in the IR and can be assumed here?

Thanks,

Mehdi


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SimplifyCFG-turn-recursive-GatherConstantCompares-in.patch
Type: application/octet-stream
Size: 10919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141117/60b83533/attachment.obj>


More information about the llvm-commits mailing list