[llvm] [Attributor] Pack out arguments into a struct (PR #119267)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 18:48:48 PST 2024
================
@@ -2963,6 +2963,132 @@ bool Attributor::shouldSeedAttribute(AbstractAttribute &AA) {
return Result;
}
+// For now: argument can be put in the struct if it's write only and
+// has no aliases.
+static bool canBeComapctedInAStruct(const Argument &Arg, Attributor &A,
+ const AbstractAttribute &QueryingAA) {
+ IRPosition ArgPosition = IRPosition::argument(Arg);
+ // Check if Arg has no alias.
+ auto *AAliasInfo =
+ A.getAAFor<AANoAlias>(QueryingAA, ArgPosition, DepClassTy::NONE);
+ if (!AAliasInfo || !AAliasInfo->isKnownNoAlias())
+ return false;
+
+ // Check if Arg is write-only.
+ const auto *MemBehaviorAA =
+ A.getAAFor<AAMemoryBehavior>(QueryingAA, ArgPosition, DepClassTy::NONE);
+ if (!MemBehaviorAA || !MemBehaviorAA->isKnownWriteOnly())
+ return false;
----------------
arsenm wrote:
Need negative tests for every condition
https://github.com/llvm/llvm-project/pull/119267
More information about the llvm-commits
mailing list