[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
Mon Aug 10 01:18:16 PDT 2020


okura added a comment.

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

> However, I think `AACallSiteReturnedFromReturned` and `AAReturnedFromReturnedValues` could save us here.
>
> What happens if you have
>
>   static int foo(int c) {
>     int x;
>     if (c == -2)
>      return -2;
>     if (c == 2)
>      return 2;
>     return x;
>   }
>   int bar(int c) {
>     return foo(c) != 0;
>   }
>
> With the patch I'd expect bar to just return 1. Is this the case?

Thank you for giving an example. We can calculate that the returned potential values are {2,-2} without another patch.
But I think we need to implement `AAPotentialValuesFloating` to calculate that the result of comparison in bar is 1.
Foremost, AAPotentialValues are not identified unless we connect `AAPotentialValues` with `AAValueSimplify`.
Therefore, I will upload another patch to do that soon.


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

https://reviews.llvm.org/D85592



More information about the llvm-commits mailing list