[llvm] 887dfee - [GlobalISel][InlineAsm] Add early return for memory inputs that need to be indirectified

Konstantin Schwarz via llvm-commits llvm-commits at lists.llvm.org
Thu May 14 14:42:40 PDT 2020


Author: Konstantin Schwarz
Date: 2020-05-14T23:42:31+02:00
New Revision: 887dfeec53ad5e564e9990c433e5b53f2e651dbf

URL: https://github.com/llvm/llvm-project/commit/887dfeec53ad5e564e9990c433e5b53f2e651dbf
DIFF: https://github.com/llvm/llvm-project/commit/887dfeec53ad5e564e9990c433e5b53f2e651dbf.diff

LOG: [GlobalISel][InlineAsm] Add early return for memory inputs that need to be indirectified

Summary:
D78319 introduced basic support for inline asm input operands in GlobalISel.
However, that patch did not handle the case where a memory input operand still needs to
be indirectified. Later code asserts that the memory operand is already indirect.

This patch adds an early return false to trigger the SelectionDAG fallback for now.

Reviewers: arsenm, paquette

Reviewed By: arsenm

Subscribers: wdng, rovka, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79955

Added: 
    

Modified: 
    llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp
    llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp b/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp
index e9ceaee83c39..36d0aa3ad43f 100644
--- a/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp
@@ -306,6 +306,12 @@ bool InlineAsmLowering::lowerInlineAsm(
     // Compute the constraint code and ConstraintType to use.
     computeConstraintToUse(TLI, OpInfo);
 
+    if (OpInfo.ConstraintType == TargetLowering::C_Memory &&
+        !OpInfo.isIndirect) {
+      LLVM_DEBUG(dbgs() << "Cannot indirectify memory input operands yet\n");
+      return false;
+    }
+
     // The selected constraint type might expose new sideeffects
     ExtraInfo.update(OpInfo);
   }

diff  --git a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
index 7e701db3494f..17e3a5ac8987 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
@@ -210,3 +210,12 @@ define i64 @strict_align_feature(i64* %p) #0 {
 }
 
 attributes #0 = { "target-features"="+strict-align" }
+
+; FALLBACK-WITH-REPORT-ERR: remark: <unknown>: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
+}


        


More information about the llvm-commits mailing list