[llvm] [SPIR-V] Handle ASM with multiple outputs (PR #187128)

Alex Voicu via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 25 19:19:42 PDT 2026


================
@@ -79,6 +79,32 @@ static FunctionType *extractFunctionTypeFromMetadata(NamedMDNode *NMD,
   return FunctionType::get(RetTy, PTys, FTy->isVarArg());
 }
 
+static StringRef extractAsmConstraintsFromMetadata(NamedMDNode *NMD,
+                                                   StringRef Constraints,
+                                                   StringRef Name) {
+  // TODO: unify the extractors.
+  if (!NMD)
+    return Constraints;
+
+  auto It = find_if(NMD->operands(), [Name](MDNode *N) {
+    if (auto *MDS = dyn_cast_or_null<MDString>(N->getOperand(0)))
+      return MDS->getString() == Name;
+    return false;
+  });
+
+  if (It == NMD->op_end())
+    return Constraints;
+
+  // By convention, the constraints string is stored in the final MD operand.
----------------
AlexVlx wrote:

It is not possible. We only follow this path when we encounter a mutated callsite, which was mutated because it had an aggregate return, which in the case of ASM entails we had more than one (non-memory) output constraint.

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


More information about the llvm-commits mailing list