[PATCH] D29107: Fix a bug when unswitching on partial LIV for SwitchInst

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 11 12:45:28 PST 2017


sanjoy added a comment.

In https://reviews.llvm.org/D29107#664209, @trentxintong wrote:

> Yes, the ability to simplify f(x) (The chain of AND(s) and OR(s)) to a meaningful case value is important here. Our current way is to pick 1 of the case values and expecting f(x) simplifies to a meaningful case value, which probably does not happen in many cases. Since we are concerning with a chain of and/or operators working on one or multiple loop-variant values and a single loop invariant values,  I think this is what we could do, we record wether the chain contains AND and OR. Once we have that we can do the following:
>
> - If we have a case 0 in the switch and we only have AND, we can pick loop_invariant as 0, this way we can unswitch case 0 out of the loop.
> - if we have a case UNSIGNED_TYPE_MAX (signed -1) and we only have ORs, we can pick the loop_invariant as UNSIGNED_TYPE_MAX and unswitch UNSIGNED_TYPE_MAX out of the loop.
>
>   What do you think ?


Sounds good!


https://reviews.llvm.org/D29107





More information about the llvm-commits mailing list