[PATCH] D116033: [Attributor] Directly call areTypesABICompatible() hook
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 24 00:21:34 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG69ffc3cee900: [Attributor] Directly call areTypesABICompatible() hook (authored by nikic).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116033/new/
https://reviews.llvm.org/D116033
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
@@ -6414,31 +6414,36 @@
return indicatePessimisticFixpoint();
}
+ // Collect the types that will replace the privatizable type in the function
+ // signature.
+ SmallVector<Type *, 16> ReplacementTypes;
+ identifyReplacementTypes(PrivatizableType.getValue(), ReplacementTypes);
+
// Verify callee and caller agree on how the promoted argument would be
// passed.
- // TODO: The use of the ArgumentPromotion interface here is ugly, we need a
- // specialized form of TargetTransformInfo::areFunctionArgsABICompatible
- // which doesn't require the arguments ArgumentPromotion wanted to pass.
Function &Fn = *getIRPosition().getAnchorScope();
- SmallPtrSet<Argument *, 1> ArgsToPromote, Dummy;
- ArgsToPromote.insert(getAssociatedArgument());
const auto *TTI =
A.getInfoCache().getAnalysisResultForFunction<TargetIRAnalysis>(Fn);
- if (!TTI ||
- !ArgumentPromotionPass::areFunctionArgsABICompatible(
- Fn, *TTI, ArgsToPromote, Dummy) ||
- ArgsToPromote.empty()) {
+ if (!TTI) {
+ LLVM_DEBUG(dbgs() << "[AAPrivatizablePtr] Missing TTI for function "
+ << Fn.getName() << "\n");
+ return indicatePessimisticFixpoint();
+ }
+
+ auto CallSiteCheck = [&](AbstractCallSite ACS) {
+ CallBase *CB = ACS.getInstruction();
+ return TTI->areTypesABICompatible(
+ CB->getCaller(), CB->getCalledFunction(), ReplacementTypes);
+ };
+ bool AllCallSitesKnown;
+ if (!A.checkForAllCallSites(CallSiteCheck, *this, true,
+ AllCallSitesKnown)) {
LLVM_DEBUG(
dbgs() << "[AAPrivatizablePtr] ABI incompatibility detected for "
<< Fn.getName() << "\n");
return indicatePessimisticFixpoint();
}
- // Collect the types that will replace the privatizable type in the function
- // signature.
- SmallVector<Type *, 16> ReplacementTypes;
- identifyReplacementTypes(PrivatizableType.getValue(), ReplacementTypes);
-
// Register a rewrite of the argument.
Argument *Arg = getAssociatedArgument();
if (!A.isValidFunctionSignatureRewrite(*Arg, ReplacementTypes)) {
@@ -6558,7 +6563,6 @@
return false;
};
- bool AllCallSitesKnown;
if (!A.checkForAllCallSites(IsCompatiblePrivArgOfOtherCallSite, *this, true,
AllCallSitesKnown))
return indicatePessimisticFixpoint();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116033.396141.patch
Type: text/x-patch
Size: 2698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211224/a89876aa/attachment.bin>
More information about the llvm-commits
mailing list