[PATCH] D80759: Fix FastISel dropping srcloc metadata from InlineAsm
Amanieu d'Antras via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 28 14:18:16 PDT 2020
Amanieu created this revision.
Amanieu added a reviewer: echristo.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=46060
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80759
Files:
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/test/CodeGen/AArch64/asm-srcloc.ll
Index: llvm/test/CodeGen/AArch64/asm-srcloc.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/asm-srcloc.ll
@@ -0,0 +1,21 @@
+; RUN: llc -O0 -stop-after=finalize-isel -o - %s | FileCheck %s
+
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64"
+
+; CHECK-LABEL: name: foo
+; CHECK: INLINEASM {{.*}}, !0
+define void @foo() {
+ call void asm sideeffect "nowayisthisavalidinstruction", "r"(i32 0), !srcloc !0
+ ret void
+}
+
+; CHECK-LABEL: name: bar
+; CHECK: INLINEASM {{.*}}, !1
+define void @bar() {
+ call void asm sideeffect "nowayisthisavalidinstruction", ""(), !srcloc !1
+ ret void
+}
+
+!0 = !{i32 23}
+!1 = !{i32 91}
Index: llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -1326,10 +1326,15 @@
ExtraInfo |= InlineAsm::Extra_IsAlignStack;
ExtraInfo |= IA->getDialect() * InlineAsm::Extra_AsmDialect;
- BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
- TII.get(TargetOpcode::INLINEASM))
- .addExternalSymbol(IA->getAsmString().c_str())
- .addImm(ExtraInfo);
+ MachineInstrBuilder MIB = BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
+ TII.get(TargetOpcode::INLINEASM));
+ MIB.addExternalSymbol(IA->getAsmString().c_str());
+ MIB.addImm(ExtraInfo);
+
+ const MDNode *SrcLoc = Call->getMetadata("srcloc");
+ if (SrcLoc)
+ MIB.addMetadata(SrcLoc);
+
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80759.267032.patch
Type: text/x-patch
Size: 1661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200528/d4f592b9/attachment.bin>
More information about the llvm-commits
mailing list