[PATCH] D100412: [Aarch64] handle "o" inline asm memory constraints

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 13 14:10:05 PDT 2021


nickdesaulniers created this revision.
nickdesaulniers added reviewers: arsenm, t.p.northover.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
nickdesaulniers requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

This Linux kernel is making use of this inline asm constraint which is
causing an ICE.

PR49956

Link: https://github.com/ClangBuiltLinux/linux/issues/1348


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100412

Files:
  llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.h
  llvm/test/CodeGen/AArch64/arm64-inline-asm.ll


Index: llvm/test/CodeGen/AArch64/arm64-inline-asm.ll
===================================================================
--- llvm/test/CodeGen/AArch64/arm64-inline-asm.ll
+++ llvm/test/CodeGen/AArch64/arm64-inline-asm.ll
@@ -297,3 +297,10 @@
   call void asm sideeffect "", "=*r|m,0,~{memory}"(<9 x float>* nonnull %m.addr, <9 x float> %m)
   ret void
 }
+
+; PR49956
+define void @test_o_output_constraint() {
+  %b = alloca i8, align 1
+  call void asm "", "=*o"(i8* %b)
+  ret void
+}
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.h
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.h
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.h
@@ -1027,6 +1027,8 @@
   unsigned getInlineAsmMemConstraint(StringRef ConstraintCode) const override {
     if (ConstraintCode == "Q")
       return InlineAsm::Constraint_Q;
+    if (ConstraintCode == "o")
+      return InlineAsm::Constraint_o;
     // FIXME: clang has code for 'Ump', 'Utf', 'Usa', and 'Ush' but these are
     //        followed by llvm_unreachable so we'll leave them unimplemented in
     //        the backend for now.
Index: llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
@@ -369,6 +369,7 @@
   default:
     llvm_unreachable("Unexpected asm memory constraint");
   case InlineAsm::Constraint_m:
+  case InlineAsm::Constraint_o:
   case InlineAsm::Constraint_Q:
     // We need to make sure that this one operand does not end up in XZR, thus
     // require the address to be in a PointerRegClass register.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100412.337257.patch
Type: text/x-patch
Size: 1712 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210413/4b7fe884/attachment.bin>


More information about the llvm-commits mailing list