[llvm] f682a83 - [Attributor] Use byval type instead of pointer element type

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 00:30:49 PST 2022


Author: Nikita Popov
Date: 2022-03-09T09:30:42+01:00
New Revision: f682a8386b5aa0fcc09754bf5a08cbe43d33065e

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

LOG: [Attributor] Use byval type instead of pointer element type

For compatibility with opaque pointers, use the byval type rather
than the pointer element type.

Differential Review: https://reviews.llvm.org/D120983

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 73f6d1cfeda51..982fcb3b32833 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -6543,10 +6543,12 @@ struct AAPrivatizablePtrArgument final : public AAPrivatizablePtrImpl {
     // If this is a byval argument and we know all the call sites (so we can
     // rewrite them), there is no need to check them explicitly.
     bool UsedAssumedInformation = false;
-    if (getIRPosition().hasAttr(Attribute::ByVal) &&
+    SmallVector<Attribute, 1> Attrs;
+    getAttrs({Attribute::ByVal}, Attrs, /* IgnoreSubsumingPositions */ true);
+    if (!Attrs.empty() &&
         A.checkForAllCallSites([](AbstractCallSite ACS) { return true; }, *this,
                                true, UsedAssumedInformation))
-      return getAssociatedValue().getType()->getPointerElementType();
+      return Attrs[0].getValueAsType();
 
     Optional<Type *> Ty;
     unsigned ArgNo = getIRPosition().getCallSiteArgNo();
@@ -6997,7 +6999,7 @@ struct AAPrivatizablePtrFloating : public AAPrivatizablePtrImpl {
       auto &PrivArgAA = A.getAAFor<AAPrivatizablePtr>(
           *this, IRPosition::argument(*Arg), DepClassTy::REQUIRED);
       if (PrivArgAA.isAssumedPrivatizablePtr())
-        return Obj->getType()->getPointerElementType();
+        return PrivArgAA.getPrivatizableType();
     }
 
     LLVM_DEBUG(dbgs() << "[AAPrivatizablePtr] Underlying object neither valid "


        


More information about the llvm-commits mailing list