[llvm] 7fdf356 - [Attributor][NFCI] Move MemIntrinsic handling into the initializer

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 20:38:43 PDT 2022


Author: Johannes Doerfert
Date: 2022-11-01T20:37:53-07:00
New Revision: 7fdf3564c04075d3e6be2d9540e5a6f1e084be9f

URL: https://github.com/llvm/llvm-project/commit/7fdf3564c04075d3e6be2d9540e5a6f1e084be9f
DIFF: https://github.com/llvm/llvm-project/commit/7fdf3564c04075d3e6be2d9540e5a6f1e084be9f.diff

LOG: [Attributor][NFCI] Move MemIntrinsic handling into the initializer

The handling for MemIntrinsic is not dependent on optimistic
information, no need to put it in update for now. Added a TODO though.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index cbc1f8b77c02..0b446a4f7407 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -1516,13 +1516,15 @@ struct AAPointerInfoCallSiteArgument final : AAPointerInfoFloating {
   AAPointerInfoCallSiteArgument(const IRPosition &IRP, Attributor &A)
       : AAPointerInfoFloating(IRP, A) {}
 
-  /// See AbstractAttribute::updateImpl(...).
-  ChangeStatus updateImpl(Attributor &A) override {
-    using namespace AA::PointerInfo;
+  /// See AbstractAttribute::initialize(...).
+  void initialize(Attributor &A) override {
+    AAPointerInfoFloating::initialize(A);
+
     // We handle memory intrinsics explicitly, at least the first (=
     // destination) and second (=source) arguments as we know how they are
     // accessed.
     if (auto *MI = dyn_cast_or_null<MemIntrinsic>(getCtxI())) {
+      // TODO: Simplify the length.
       ConstantInt *Length = dyn_cast<ConstantInt>(MI->getLength());
       int64_t LengthVal = AA::OffsetAndSize::Unknown;
       if (Length)
@@ -1539,16 +1541,22 @@ struct AAPointerInfoCallSiteArgument final : AAPointerInfoFloating {
       } else {
         LLVM_DEBUG(dbgs() << "[AAPointerInfo] Unhandled memory intrinsic "
                           << *MI << "\n");
-        return indicatePessimisticFixpoint();
+        indicatePessimisticFixpoint();
       }
 
+      indicateOptimisticFixpoint();
+
       LLVM_DEBUG({
-        dbgs() << "Accesses by bin after update:\n";
+        dbgs() << "Accesses by bin after initialization:\n";
         dumpState(dbgs());
       });
-
-      return Changed;
+      return;
     }
+  }
+
+  /// See AbstractAttribute::updateImpl(...).
+  ChangeStatus updateImpl(Attributor &A) override {
+    using namespace AA::PointerInfo;
 
     // TODO: Once we have call site specific value information we can provide
     //       call site specific liveness information and then it makes


        


More information about the llvm-commits mailing list