[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) {
----------------
s-perron wrote:

Is it possible that the constraints are empty? If it is empty, what is `Tmp.size()`? If it is 0, then the loop upper bound will wrap around, and be very large.

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


More information about the llvm-commits mailing list