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 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 Ty; unsigned ArgNo = getIRPosition().getCallSiteArgNo(); @@ -6918,7 +6920,7 @@ auto &PrivArgAA = A.getAAFor( *this, IRPosition::argument(*Arg), DepClassTy::REQUIRED); if (PrivArgAA.isAssumedPrivatizablePtr()) - return Obj->getType()->getPointerElementType(); + return PrivArgAA.getPrivatizableType(); } LLVM_DEBUG(dbgs() << "[AAPrivatizablePtr] Underlying object neither valid "