================
@@ -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) {
----------------
nickdesaulniers wrote:

1. I think this might not be handling `InlineAsm::isLabel` correctly, as 
written.

Please add this as a test case (and fix up the code here so that it correctly 
warns):
```llvm
define void @label_mem() {
  callbr void asm "# $0", "!m"()
    to label %fallthrough [label %indirect]
fallthrough:
  ret void
indirect:
  ret void
}
```

2. I think it additionally makes the pre-existing comment on L10566 stale?

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