[llvm] [IR] Do not inherit ABI attributes from the callee (PR #207173)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 06:01:57 PDT 2026


================
@@ -842,6 +842,28 @@ bool Attribute::canUseAsRetAttr(AttrKind Kind) {
   return hasAttributeProperty(Kind, AttributeProperty::RetAttr);
 }
 
+bool Attribute::isABIAttr(AttrKind Kind) {
+  switch (Kind) {
+  case Attribute::ByRef:
+  case Attribute::ByVal:
+  case Attribute::InAlloca:
+  case Attribute::InReg:
+  case Attribute::Nest:
+  case Attribute::NoExt:
+  case Attribute::Preallocated:
+  case Attribute::SExt:
+  case Attribute::StackAlignment:
+  case Attribute::StructRet:
+  case Attribute::SwiftAsync:
+  case Attribute::SwiftError:
+  case Attribute::SwiftSelf:
+  case Attribute::ZExt:
+    return true;
+  default:
+    return false;
----------------
nikic wrote:

We have one attribute list like this in CodeExtractor, and I hate it.

I changed the implementation to specify ABIAttr as an attribute property in TableGen instead. There's a possible variant of this where an explicit decision on ABI or not is required (like the Intersect property is handled). I've not done that for now, esp. as this PR does not try to make an ABI-or-not distinction for function attributes yet.

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


More information about the llvm-commits mailing list