[PATCH] D71617: [WIP][NFC][Attributor] noalias attribute deduction fixme

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 08:46:50 PST 2020


jdoerfert added a comment.

Sorry for my delay. I hope these are the last problems.



================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2498
+            if (!ReachabilityAA.isAssumedReachable(UserI, getCtxI()))
+              return true;
+          }
----------------
Move this check before the `CallBase` conditional.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2518
+      // UsePred checks: getCtxI() i.e. callSite, is reachable from V's user.
+      if (!A.checkForAllUses(UsePred, *this, V, getCtxI())) {
+        LLVM_DEBUG(
----------------
I don't think you should restrict it to uses reachable from `getCtxI` here. All uses are interesting and reachability is checked from the uses.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:5768
+        AnyUnreachable = true;
+      }
+    }
----------------
There is a `continue` missing in the above conditional.


================
Comment at: llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll:40
+; CHECK-NEXT:    [[CALL3:%.*]] = call i32 @pthread_create(i64* noalias nonnull align 8 dereferenceable(8) [[THREAD]], %union.pthread_attr_t* noalias null, i8* (i8*)* nonnull @buz, i8* noalias nofree nonnull readnone align 8 dereferenceable(1) [[ALLOC2]])
 ; CHECK-NEXT:    ret i32 0
 ;
----------------
I think only the first `noalias` is correct. Hopefully with the changes I suggested above this should be fixed.


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

https://reviews.llvm.org/D71617





More information about the llvm-commits mailing list