[PATCH] D81929: [Attributor] Introduce CallBaseContext to the IRPosition

Kuter Dinel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 17:21:47 PDT 2020


kuter updated this revision to Diff 280302.
kuter added a comment.

fix styling.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81929

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


Index: llvm/include/llvm/Transforms/IPO/Attributor.h
===================================================================
--- llvm/include/llvm/Transforms/IPO/Attributor.h
+++ llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -172,7 +172,7 @@
   /// Default constructor available to create invalid positions implicitly. All
   /// other positions need to be created explicitly through the appropriate
   /// static member function.
-  IRPosition() : Enc(nullptr, ENC_VALUE) { verify(); }
+  IRPosition() : Enc(nullptr, ENC_VALUE), CBContext(nullptr) { verify(); }
 
   /// Create a position describing the value of \p V.
   static const IRPosition value(const Value &V,
@@ -453,9 +453,9 @@
 
   /// Return the same position without the call base context.
   IRPosition stripCallBaseContext() const {
-    IRPosition result = *this;
-    result.CBContext = nullptr;
-    return result;
+    IRPosition Result = *this;
+    Result.CBContext = nullptr;
+    return Result;
   }
 
   /// Get the call base context from the position.
@@ -518,7 +518,7 @@
   /// IRPosition for the use \p U. The position kind \p PK needs to be
   /// IRP_CALL_SITE_ARGUMENT, the anchor value is the user, the associated value
   /// the used value.
-  explicit IRPosition(Use &U, Kind PK) {
+  explicit IRPosition(Use &U, Kind PK) : CBContext(nullptr) {
     assert(PK == IRP_CALL_SITE_ARGUMENT &&
            "Use constructor is for call site arguments only!");
     Enc = {&U, ENC_CALL_SITE_ARGUMENT_USE};
@@ -912,7 +912,7 @@
     return getOrCreateAAFor<AAType>(IRP, &QueryingAA, TrackDependence, DepClass,
                                     /* ForceUpdate */ true);
   }
-
+#define DEBUG_TYPE "attributor"
   /// The version of getAAFor that allows to omit a querying abstract
   /// attribute. Using this after Attributor started running is restricted to
   /// only the Attributor itself. Initial seeding of AAs can be done via this
@@ -934,8 +934,8 @@
           "across functions");
     }
 #endif
-    IRP =
-        shouldPropagateCallBaseContext(IRP) ? IRP : IRP.stripCallBaseContext();
+    if (shouldPropagateCallBaseContext(IRP))
+      IRP = IRP.stripCallBaseContext();
 
     if (AAType *AAPtr = lookupAAFor<AAType>(IRP, QueryingAA, TrackDependence)) {
       if (ForceUpdate)
@@ -994,7 +994,7 @@
                        DepClass);
     return AA;
   }
-
+#undef DEBUG_TYPE
   /// Return the attribute of \p AAType for \p IRP if existing. This also allows
   /// non-AA users lookup.
   template <typename AAType>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81929.280302.patch
Type: text/x-patch
Size: 2507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200724/0e6aa223/attachment.bin>


More information about the llvm-commits mailing list