[PATCH] D71799: [Attributor] AAUndefinedBehavior: Check for branches on undef value.

Hideto Ueno via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 22 08:48:38 PST 2019


uenoku added a comment.

In D71799#1794262 <https://reviews.llvm.org/D71799#1794262>, @baziotis wrote:

> Note that while this is what makes sense to me, Johannes told me that if `SimplifiedV` gives `None` (i.e. it doesn't have value), then we can assume
>  that it is `undef` but I don't know why this is true.


A state of `SimplifiedV` is `Optional<Value*>` representing its simplified associated value `V`. Initially, set to `None`. If a candidate `V1` is found, it is set to `Some(V1)`. If another candidate `V2` is found, trying to unify `V1` and `V2`. 
When the simplified value is `None`, we haven't found a candidate yet, or there is no candidate(like `int f(x) { return f(x);}`). So you can choose any arbitrary value(=undef) in that assumption.

> Edit: Just saw your comment, which you seem to not assume that.
>  In your code, why insert it in `UBInsts` and then remove it? Since we query `AAValueSimplify`, isn't that going to call us again and thus at some point get the value (which in turn means we don't insert it and just wait for when we'll be called again).

The simplified value may change (None -> concrete value) so we need to track.


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

https://reviews.llvm.org/D71799





More information about the llvm-commits mailing list