[PATCH] D120983: [Attributor] Use byval type instead of pointer element type
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 4 03:04:10 PST 2022
nikic created this revision.
Herald added subscribers: ormris, okura, jdoerfert, kuter, uenoku, hiraditya.
Herald added a reviewer: uenoku.
Herald added a reviewer: homerdin.
Herald added a project: All.
nikic requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Use the byval type for compatibility with opaque pointers. Putting this up for review as I'm not sure whether I'm using the Attributor APIs correctly here.
https://reviews.llvm.org/D120983
Files:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Index: llvm/lib/Transforms/IPO/AttributorAttributes.cpp
===================================================================
--- llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -6464,10 +6464,12 @@
// 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();
@@ -6918,7 +6920,7 @@
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 "
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120983.412965.patch
Type: text/x-patch
Size: 1373 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220304/9f85f0e7/attachment.bin>
More information about the llvm-commits
mailing list