[clang] [AArch64] Change the coercion type of structs with pointer members. (PR #135064)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue May 6 16:29:03 PDT 2025


================
@@ -486,6 +486,39 @@ ABIArgInfo AArch64ABIInfo::classifyArgumentType(QualType Ty, bool IsVariadicFn,
     }
     Size = llvm::alignTo(Size, Alignment);
 
+    // If the Aggregate is made up of pointers, use an array of pointers for the
+    // coerced type. This prevents having to convert ptr2int->int2ptr through
+    // the call, allowing alias analysis to produce better code.
+    std::function<bool(QualType Ty)> ContainsOnlyPointers = [&](QualType Ty) {
----------------
efriedma-quic wrote:

You can avoid std::function overhead with something like this:

```
struct QualType{};
void f(QualType t) {
  auto Recursive = [&](const auto& self, QualType t) {
    if (false)
      return false;
    return self(self, t);
  };
  Recursive(Recursive, t);
}
```

Not sure if it's worth worrying about.

https://github.com/llvm/llvm-project/pull/135064


More information about the cfe-commits mailing list