================
@@ -10567,9 +10568,15 @@ computeConstraintToUse(ConstraintDecisionInfo &Info, 
const CallBase &Call,
     // need to provide an address for the memory input.
     if (OpInfo.ConstraintType == TargetLowering::C_Memory &&
         !OpInfo.isIndirect) {
-      assert((OpInfo.isMultipleAlternative ||
-              (OpInfo.Type == InlineAsm::isInput)) &&
-             "Can only indirectify direct input operands!");
+      // Only an input has a value to store to memory. A direct output, which
+      // Clang never emits with a memory constraint but other IR can, would
+      // need a stack slot to be reloaded after the asm. That includes an
+      // output whose chosen alternative is memory, e.g. "=m|r".
+      if (OpInfo.Type != InlineAsm::isInput) {
----------------
isanbard wrote:

1. Good catch. A label isn't an input, so `"!m"` fell into the output branch 
and reported `cannot handle direct memory outputs for constraint 'm'`. It now 
gets its own error, `cannot handle memory constraint 'm' for a label`, and your 
example is `@label_mem` in `X86/inline-asm-direct-mem-output-error.ll`. It's 
only in the X86 test, since GlobalISel doesn't lower callbr inline asm yet and 
the AArch64 test also runs GlobalISel.

2. Yes, it was stale. I folded it and the comment inside the block into one 
comment above the check, covering inputs, direct outputs, and labels.

Fixed in f89617d6cd1d.


https://github.com/llvm/llvm-project/pull/229628
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to