[llvm] 6973125 - Fix FastISel dropping srcloc metadata from InlineAsm
Amanieu d'Antras via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 13 08:52:43 PDT 2020
Author: Amanieu d'Antras
Date: 2020-06-13T16:52:37+01:00
New Revision: 6973125cb746e185fc5e7823ec6422fc0670e15d
URL: https://github.com/llvm/llvm-project/commit/6973125cb746e185fc5e7823ec6422fc0670e15d
DIFF: https://github.com/llvm/llvm-project/commit/6973125cb746e185fc5e7823ec6422fc0670e15d.diff
LOG: Fix FastISel dropping srcloc metadata from InlineAsm
Summary:
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=46060
I've also added the Extra_IsConvergent flag which was missing from FastISel.
Reviewers: echristo
Reviewed By: echristo
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80759
Added:
llvm/test/CodeGen/AArch64/asm-srcloc.ll
Modified:
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index d1f2f4fce08e..fc6c3a145f13 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -1324,12 +1324,19 @@ bool FastISel::selectCall(const User *I) {
ExtraInfo |= InlineAsm::Extra_HasSideEffects;
if (IA->isAlignStack())
ExtraInfo |= InlineAsm::Extra_IsAlignStack;
+ if (Call->isConvergent())
+ ExtraInfo |= InlineAsm::Extra_IsConvergent;
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;
}
diff --git a/llvm/test/CodeGen/AArch64/asm-srcloc.ll b/llvm/test/CodeGen/AArch64/asm-srcloc.ll
new file mode 100644
index 000000000000..8c7b3dcede85
--- /dev/null
+++ b/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}
More information about the llvm-commits
mailing list