[PATCH] D85632: [Attributor] Implement AAPotentialValues

Shinji Okumura via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 03:43:35 PDT 2020


okura added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:7426
+        if (MaybeTrue & MaybeFalse)
+          break;
+      }
----------------
okura wrote:
> jdoerfert wrote:
> > You can indicate a pessimistic fixpoint here. It's an `i1` which can be true and false :)
> If I indicate a pessimistic fixpoint, the state becomes invalid. If not, the state becomes {0,1}. I think this difference makes the deduction weaker. For example, the expected value simplification is not achieved in the case `@potential_test3` in potential.ll.
> I think I should handle known (the worst) state for values that have a very small bit width.
> In the following example, the returned value's state becomes an invalid state with current implementation. But it should be {0,1}, I think. 
> ```
> define i32 @foo(i1 %c) {
>   %ret = zext i1 %c to i32
>   ret i32 %ret
> }
> ```
I thought about this again and I noticed that this kind of analysis can (should) be done by AAValueConstantRange.
However, value simplification does not work expectedly in the current implementation as we can see with `@potential_test3`.
I investigated the cause of this and I found out the cause is bugs in `AAConstantRange`.
I will make a new patch for it.


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

https://reviews.llvm.org/D85632



More information about the llvm-commits mailing list