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

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 10:49:43 PDT 2026


================
@@ -592,9 +595,26 @@ SPIRVPrepareFunctions::removeAggregateTypesFromSignature(Function *F) {
   return NewF;
 }
 
-// Mutates indirect callsites iff if aggregate argument/return types are present
-// with the types replaced by i32 types. The change in types is noted in
-// 'spv.mutated_callsites' metadata for later restoration.
+static std::string fixMultiOutputConstraintString(StringRef Constraints) {
+  // We should only have one =r return for the made up ASM type.
+  SmallVector<StringRef> Tmp;
+  SplitString(Constraints, Tmp, ",");
+  std::string SafeConstraints("=r,");
+  for (unsigned I = 0u; I != Tmp.size() - 1; ++I) {
+    if (Tmp[I].starts_with('=') && isalnum(Tmp[I][1]))
+      continue;
+    SafeConstraints.append(Tmp[I]).append({','});
+  }
+  SafeConstraints.append(Tmp.back());
----------------
s-perron wrote:

Is it possible that `Tmp.back()` is an unsafe constraint?

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


More information about the llvm-commits mailing list