[PATCH] D86635: [Attributor] Add getter of abstract attributes for the manifestation stage

Shinji Okumura via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 10:14:57 PDT 2020


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

- make use of the phase flag


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
@@ -975,11 +975,18 @@
                                  bool TrackDependence = false,
                                  DepClassTy DepClass = DepClassTy::OPTIONAL,
                                  bool ForceUpdate = false) {
+#define DEBUG_TYPE "attributor"
     if (AAType *AAPtr = lookupAAFor<AAType>(IRP, QueryingAA, TrackDependence)) {
-      if (ForceUpdate)
-        updateAA(*AAPtr);
+      if (ForceUpdate) {
+        if (Phase != AttributorPhase::UPDATE)
+          LLVM_DEBUG(dbgs() << "[Attributor] An update is forced outside of "
+                               "the update stage. Ignore this enforcement.\n");
+        else
+          updateAA(*AAPtr);
+      }
       return *AAPtr;
     }
+#undef DEBUG_TYPE
 
     // No matching attribute found, create one.
     // Use the static create method.
@@ -1020,6 +1027,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.288381.patch
Type: text/x-patch
Size: 1985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200827/ec00c740/attachment.bin>


More information about the llvm-commits mailing list