[PATCH] D85592: [Attributor] Add flag for undef value to the state of AAPotentialValues

Shinji Okumura via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 13:15:56 PDT 2020


okura added a comment.

In D85592#2236740 <https://reviews.llvm.org/D85592#2236740>, @jdoerfert wrote:

> What happens if you have something like
>
>   int foo(int c0, int c1, int c2, int c3) {
>      int undef;
>      int x0 = c0 ? 0 : 1;
>      int x1 = c1 ? x0 : undef;
>      int y2 = c2 ? 0 : 7;
>      int z3 = c3 ? x1 : y2;
>      return z3 < 7;
>   }
>   
>   int bar(int c0, int c1 ) {
>      int undef;
>      int x0 = c0 ? 0 : 1;
>      int x1 = c1 ? x0 : undef;
>      return x1 == 7;
>   }
>   int bar(int c0, int c1 ) {
>      int undef;
>      int x0 = c0 ? 0 : undef;
>      int x1 = c1 ? x0 : 1;
>      return x1 == 7;
>   }

I'm sorry, I don't understand what you expect. The following is my understanding. Could you point out where I'm wrong?

1. I don't understand the essential difference between the two `bar` functions. I think the potential values of `x1` are `{0,1}`, and the returned value can be simplified to `false` in both cases.
2. As for `foo`, we cannot simplify the returned value because the potential value set of `z3` is `{0,1,7}`. I'm not sure how we can take advantage of undef in these examples.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85592/new/

https://reviews.llvm.org/D85592



More information about the llvm-commits mailing list