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

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 10:01:45 PST 2019


baziotis updated this revision to Diff 235160.
baziotis added a comment.

- Use only known sets: One for known UB instructions and one for known _not_ UB instructions. The analysis correctness depends on the NoUB one. The 2 sets are used so that no same instruction is re-processed. The knownUB is also used for stats and also to change blocks to unreachable in `manifest` (we make unreachable the blocks that contain the instructions in this set). Note: These 2 sets are disjoint.
- We use `AAValueSimplify` but only if the value is known. There are 2 caveats:
  1. If the value is known but `getAssumedSimplifiedValue()` gives us `None` (no value), then we can assume it has reached a fixpoint and the value is `undef`.
  2. For some reason, for branches where `undef` is actually written (i.e. `br i1 undef, ...`), the `AAValueSimplify` doesn't tell us it is known. Thus, before we even start querying `AAValueSimplify`, we check the standard LLVM `Value` if it is `undef`.

Ongoing:

1. Because of the point 2) above, I don't know whether we ever need the case (`isKnown && hasValue && the value is undef`), since that was supposed to handled the simple cases, but it doesn't because we don't get the `isKnown` part.
2. I think it needs more tests.


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

https://reviews.llvm.org/D71799

Files:
  llvm/include/llvm/Transforms/IPO/Attributor.h
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/test/Transforms/Attributor/undefined_behavior.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71799.235160.patch
Type: text/x-patch
Size: 10104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191223/8fb3cdd8/attachment.bin>


More information about the llvm-commits mailing list