[PATCH] D103860: [Attributor] Use AAValueSimplify to simplify returned values

Kuter Dinel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 23 13:12:47 PDT 2021


kuter added a comment.

Some comments.



================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:1031
+        A, IRPosition::value(*Ret.getReturnValue()), *this, Ret, ReturnValueCB,
+        &I);
   };
----------------
`genericValueTraversal` does not look at callbase returned values.
So the `AAReturnedValues` no longer contains transitively returned values. Wouldn't this affect some attributes ?


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:4393-4407
+    if (Simplify) {
+      auto &ValueSimplifyAA = A.getAAFor<AAValueSimplify>(
         QueryingAA,
         IRPosition::value(QueryingValue, QueryingAA.getCallBaseContext()),
         DepClassTy::REQUIRED);
 
+      AccumulatedSimplifiedValue = AA::combineOptionalValuesInAAValueLatice(
----------------
I think the code can be made more readable here.


================
Comment at: llvm/test/Transforms/Attributor/nocapture-2.ll:222
 ; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i8* [[CALL]] to double*
-; CHECK-NEXT:    [[CALL1:%.*]] = call dereferenceable_or_null(8) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) #[[ATTR2]]
+; CHECK-NEXT:    [[CALL1:%.*]] = call dereferenceable_or_null(4) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) #[[ATTR2]]
 ; CHECK-NEXT:    [[TMP2:%.*]] = bitcast i64* [[CALL1]] to i32*
----------------
We are getting less dereferenceablity. Isn't this weird ? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103860



More information about the llvm-commits mailing list