[PATCH] D86635: [Attributor] Guarantee getAAFor not to update AA in the manifestation stage

Shinji Okumura via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 11:05:45 PDT 2020


okura updated this revision to Diff 288392.
okura added a comment.

- delete debug print
- add a comment


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

https://reviews.llvm.org/D86635

Files:
  llvm/include/llvm/Transforms/IPO/Attributor.h
  llvm/lib/Transforms/IPO/Attributor.cpp


Index: llvm/lib/Transforms/IPO/Attributor.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Attributor.cpp
+++ llvm/lib/Transforms/IPO/Attributor.cpp
@@ -1347,6 +1347,8 @@
 
 ChangeStatus Attributor::updateAA(AbstractAttribute &AA) {
   TimeTraceScope TimeScope(AA.getName() + "::updateAA");
+  assert(Phase == AttributorPhase::UPDATE &&
+         "We can update AA only in the update stage!");
 
   // Use a new dependence vector for this update.
   DependenceVector DV;
Index: llvm/include/llvm/Transforms/IPO/Attributor.h
===================================================================
--- llvm/include/llvm/Transforms/IPO/Attributor.h
+++ llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -969,6 +969,7 @@
   /// attribute. Using this after Attributor started running is restricted to
   /// only the Attributor itself. Initial seeding of AAs can be done via this
   /// function.
+  /// NOTE: ForceUpdate is ignored in any stage other than the update stage.
   template <typename AAType>
   const AAType &getOrCreateAAFor(const IRPosition &IRP,
                                  const AbstractAttribute *QueryingAA = nullptr,
@@ -976,7 +977,7 @@
                                  DepClassTy DepClass = DepClassTy::OPTIONAL,
                                  bool ForceUpdate = false) {
     if (AAType *AAPtr = lookupAAFor<AAType>(IRP, QueryingAA, TrackDependence)) {
-      if (ForceUpdate)
+      if (ForceUpdate && Phase == AttributorPhase::UPDATE)
         updateAA(*AAPtr);
       return *AAPtr;
     }
@@ -1020,6 +1021,13 @@
       return AA;
     }
 
+    // If this is queried in the manifest stage, we force the AA to indicate
+    // pessimistic fixpoint immediately.
+    if (Phase == AttributorPhase::MANIFEST) {
+      AA.getState().indicatePessimisticFixpoint();
+      return AA;
+    }
+
     // Allow seeded attributes to declare dependencies.
     // Remember the seeding state.
     AttributorPhase OldPhase = Phase;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86635.288392.patch
Type: text/x-patch
Size: 1994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200827/fd9ad4c7/attachment.bin>


More information about the llvm-commits mailing list