[PATCH] D83283: [Attributor] AAPotentialValues Interface

Shinji Okumura via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 22:26:50 PDT 2020


okura marked an inline comment as done.
okura added inline comments.


================
Comment at: llvm/include/llvm/Transforms/IPO/Attributor.h:3056
+  static inline APInt getEmptyKey() {
+    APInt V(nullptr, 0);
+    V.U.VAL = 0;
----------------
baziotis wrote:
> okura wrote:
> > baziotis wrote:
> > > Is there an `APInt` constructor that takes a pointer and an `int` ? I think the only such constructor is a private one.
> > Sorry for the delayed response. This struct is a friend struct of `APInt`. So Member functions can access the private functions of `APInt`. (c.f. https://llvm.org/doxygen/APInt_8h_source.html#l00099)
> > On the other hand, the same struct is defined in "/lib/IR/LLVMContextImpl.h" and I want to include it but I failed to do that.
> Yes, my bad, thank you. If you want to include that, I guess that the problem is that an `#include` "looks" in `llvm/include`. You want to go one dir back and to `lib`. So, `../lib/IR/...`. Have you tried that?
Yes, I tried to do it in that way, but I got many warnings like "DEBUG_TYPE is redefined" when I built.  So I gave up and redefine the struct here.


================
Comment at: llvm/test/Transforms/Attributor/potential.ll:59
+; IS__TUNIT____-SAME: (i32 [[C:%.*]])
+; IS__TUNIT____-NEXT:    [[CSRET1:%.*]] = call i32 @iszero2(i32 [[C]]) #0, !range !0
+; IS__TUNIT____-NEXT:    [[MINUSC:%.*]] = sub i32 0, [[C]]
----------------
baziotis wrote:
> I may be missing something here but how do you see the potential values in the output IR ? (Only) through ranges ?
> I mean except for e.g. simplifying (e.g. that due to potential values, we deduce that the return value is in fact a constant, like in another test case).
> 
> Btw, we have different results that the test in the other diff right (this one: https://reviews.llvm.org/differential/changeset/?ref=2038557) ?
> Why is that?
> 
> (I'll have to check the tests again).
We cannot see the potential values in IR. Potential values are collected just for stronger value simplification for now.
Unlike the original patch, `updateImpl` has not implemented yet in this patch. So expected value simplification was not achieved and we have different results.


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

https://reviews.llvm.org/D83283





More information about the llvm-commits mailing list