From 595e8ab22d72283ea2377abfbd6f3ff691391e97 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 22 Feb 2016 17:45:20 +0000 Subject: [PATCH] [WebAssembly] Properly ignore llvm.dbg.value instructions. llvm-svn: 261538 --- llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp | 6 +++++- llvm/test/CodeGen/WebAssembly/reg-stackify.ll | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp index 9108b42..d69b727 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp @@ -423,7 +423,11 @@ bool WebAssemblyRegStackify::runOnMachineFunction(MachineFunction &MF) { // Don't nest anything inside an inline asm, because we don't have // constraints for $push inputs. if (Insert->getOpcode() == TargetOpcode::INLINEASM) - break; + continue; + + // Ignore debugging intrinsics. + if (Insert->getOpcode() == TargetOpcode::DBG_VALUE) + continue; // Iterate through the inputs in reverse order, since we'll be pulling // operands off the stack in LIFO order. diff --git a/llvm/test/CodeGen/WebAssembly/reg-stackify.ll b/llvm/test/CodeGen/WebAssembly/reg-stackify.ll index 82e5d43..cfc2c57 100644 --- a/llvm/test/CodeGen/WebAssembly/reg-stackify.ll +++ b/llvm/test/CodeGen/WebAssembly/reg-stackify.ll @@ -347,4 +347,22 @@ define i32 @store_past_invar_load(i32 %a, i32* %p1, i32* dereferenceable(4) %p2) ret i32 %b } +; CHECK-LABEL: ignore_dbg_value: +; CHECK-NEXT: unreachable +declare void @llvm.dbg.value(metadata, i64, metadata, metadata) +define void @ignore_dbg_value() { + call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !1, metadata !7), !dbg !8 + unreachable +} + +!llvm.module.flags = !{!9} + !0 = !{} +!1 = !DILocalVariable(name: "nzcnt", scope: !2, file: !3, line: 15, type: !6) +!2 = distinct !DISubprogram(name: "test", scope: !3, file: !3, line: 10, type: !4, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: true, variables: !0) +!3 = !DIFile(filename: "test.c", directory: "/") +!4 = !DISubroutineType(types: !0) +!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!7 = !DIExpression() +!8 = !DILocation(line: 15, column: 6, scope: !2) +!9 = !{i32 2, !"Debug Info Version", i32 3} -- 2.7.4