diff --git a/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp b/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp --- a/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp +++ b/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp @@ -424,6 +424,13 @@ } if (OpInfo.ConstraintType == TargetLowering::C_Memory) { + + if (!OpInfo.isIndirect) { + LLVM_DEBUG(dbgs() + << "Cannot indirectify memory input operands yet\n"); + return false; + } + assert(OpInfo.isIndirect && "Operand must be indirect to be a mem!"); unsigned ConstraintID = diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll --- a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll +++ b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll @@ -210,3 +210,12 @@ } attributes #0 = { "target-features"="+strict-align" } + +; FALLBACK-WITH-REPORT-ERR: remark: :0:0: unable to translate instruction: call +; FALLBACK-WITH-REPORT-ERR: warning: Instruction selection used fallback path for direct_mem +; FALLBACK-WITH-REPORT-OUT-LABEL: direct_mem +define void @direct_mem(i32 %x, i32 %y) { +entry: + tail call void asm sideeffect "", "imr,imr,~{memory}"(i32 %x, i32 %y) + ret void +}