[clang] [llvm] [Clang][inlineasm] Add special support for "rm" output constraints (PR #92040)

Bill Wendling via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 2 04:40:25 PST 2026


================
@@ -2921,13 +2921,20 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
     if (!Constraints.empty())
       Constraints += ',';
 
-    // If this is a register output, then make the inline asm return it
-    // by-value.  If this is a memory result, return the value by-reference.
+    // - If this is a register output, then make the inline asm return it
+    //   by-value.
+    // - If this is an "rm" constraint on x86, then treat it like a register
+    //   output. (We'll correct this before ISel if using the FastRA.)
+    // - If this is a memory result, return the value by-reference.
     QualType QTy = OutExpr->getType();
     const bool IsScalarOrAggregate = hasScalarEvaluationKind(QTy) ||
                                      hasAggregateEvaluationKind(QTy);
-    if (!Info.allowsMemory() && IsScalarOrAggregate) {
+    const bool X86RegisterMemoryConstraints =
+        getTarget().getTriple().isX86() &&
+        (OutputConstraint == "rm" || OutputConstraint == "mr");
----------------
bwendling wrote:

I think it was just a mistake in my understanding of the scope of this change. the `"rm"` constraint isn't restricted to x86, and the changes are target-neutral. I removed them.

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


More information about the llvm-commits mailing list