summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2017-03-07 20:34:23 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2017-03-07 20:34:23 +0000
commitc373262d52638cd73763d3ea1e3e1ef41d4e01d6 (patch)
tree8eb6e693cb0131b9cbeaab3503303439e5badc3c
parent4826bae8b493a38c98b29ef833bb4e7244019ebd (diff)
downloadbcm5719-llvm-c373262d52638cd73763d3ea1e3e1ef41d4e01d6.tar.gz
bcm5719-llvm-c373262d52638cd73763d3ea1e3e1ef41d4e01d6.zip
[GlobalISel] Ignore %noreg when applying default regbank mapping.
When computing the mapping for non-generic instructions, we skipped %noreg operands, because we can't always reason about their banks. Also skip them when applying the mapping. Otherwise, we could end up with mappings that we can't apply. While there, duplicate an assert to distinguish between the two error conditions. llvm-svn: 297201
-rw-r--r--llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp7
-rw-r--r--llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-dbg-value.mir45
2 files changed, 52 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
index 74161e3c6bd..2901761c1cd 100644
--- a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
@@ -352,6 +352,13 @@ void RegisterBankInfo::applyDefaultMapping(const OperandsMapper &OpdMapper) {
DEBUG(dbgs() << " is not a register, nothing to be done\n");
continue;
}
+ if (!MO.getReg()) {
+ DEBUG(dbgs() << " is %%noreg, nothing to be done\n");
+ continue;
+ }
+ assert(OpdMapper.getInstrMapping().getOperandMapping(OpIdx).NumBreakDowns !=
+ 0 &&
+ "Invalid mapping");
assert(OpdMapper.getInstrMapping().getOperandMapping(OpIdx).NumBreakDowns ==
1 &&
"This mapping is too complex for this function");
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-dbg-value.mir b/llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-dbg-value.mir
new file mode 100644
index 00000000000..73d4d205472
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-dbg-value.mir
@@ -0,0 +1,45 @@
+# RUN: llc -O0 -mtriple arm64-- -run-pass=regbankselect -global-isel %s -o - | FileCheck %s
+
+--- |
+ target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+
+ define void @test_dbg_value() !dbg !5 {
+ ; Keep the dbg metadata live by referencing it in the IR.
+ call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !7, metadata !9), !dbg !10
+ ret void
+ }
+
+ declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
+
+ !llvm.dbg.cu = !{!0}
+ !llvm.module.flags = !{!3, !4}
+
+ !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "llvm", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
+ !1 = !DIFile(filename: "test.ll", directory: "/tmp")
+ !2 = !{}
+ !3 = !{i32 2, !"Dwarf Version", i32 4}
+ !4 = !{i32 2, !"Debug Info Version", i32 3}
+ !5 = distinct !DISubprogram(name: "test_dbg_value", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
+ !6 = !DISubroutineType(types: !2)
+ !7 = !DILocalVariable(name: "in", arg: 1, scope: !5, file: !1, line: 1, type: !8)
+ !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+ !9 = !DIExpression()
+ !10 = !DILocation(line: 1, column: 1, scope: !5)
+...
+
+---
+# CHECK-LABEL: name: test_dbg_value
+name: test_dbg_value
+legalized: true
+# CHECK: registers:
+# CHECK-NEXT: - { id: 0, class: gpr }
+body: |
+ bb.0:
+ liveins: %w0
+ %0:_(s32) = COPY %w0
+ ; CHECK: DBG_VALUE debug-use %0(s32), debug-use _, !7, !9, debug-location !10
+ DBG_VALUE debug-use %0(s32), debug-use _, !7, !9, debug-location !10
+
+ ; CHECK: DBG_VALUE _, 0, !7, !9, debug-location !10
+ DBG_VALUE _, 0, !7, !9, debug-location !10
+...
OpenPOWER on IntegriCloud