<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [WebAssembly] "Non-terminator instruction after the first terminator" Verification failure after DebugFixup"
href="https://bugs.llvm.org/show_bug.cgi?id=50175">50175</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[WebAssembly] "Non-terminator instruction after the first terminator" Verification failure after DebugFixup
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: WebAssembly
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>aheejin@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>aardappel@gmail.com, dschuff@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>test.ll:
```
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-emscripten"
define void @test(i32 %a, i32 %b) {
entry:
%cmp = icmp ne i32 %a, %b
call void @llvm.dbg.value(metadata i1 %cmp, metadata !4, metadata
!DIExpression(DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 8,
DW_ATE_unsigned, DW_OP_stack_value)), !dbg !6
br i1 %cmp, label %bb.1, label %bb.0
bb.0: ; preds = %entry
unreachable
bb.1: ; preds = %entry
ret void
}
declare void @llvm.dbg.value(metadata, metadata, metadata)
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2, !3}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1,
isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
!1 = !DIFile(filename: "test.cpp", directory: "test")
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = !{i32 1, !"wchar_size", i32 4}
!4 = !DILocalVariable(name: "test3", scope: !5)
!5 = distinct !DISubprogram(name: "test", scope: null, spFlags:
DISPFlagDefinition, unit: !0)
!6 = !DILocation(line: 0, scope: !5)
```
How to reproduce:
$ llc -verify-machineinstrs test.ll
WebAssemblyDebugFixup adds a `DBG_VALUE` instruction to clear debug info on
wasm-operand-stack. So in this case a new `DBG_VALUE` instruction is created
after `BR_IF`, the terminator of the first 'entry' BB:
```
bb.0.entry:
successors: %bb.2(0x80000000), %bb.1(0x00000000); %bb.2(100.00%),
%bb.1(0.00%)
BLOCK 64, implicit-def $value_stack, implicit $value_stack
%6:i32 = LOCAL_GET_I32 0, implicit-def $arguments
%5:i32 = LOCAL_GET_I32 1, implicit-def $arguments
%4:i32 = NE_I32 %6:i32, %5:i32, implicit-def dead $arguments, implicit-def
$value_stack, implicit $value_stack
DBG_VALUE target-index(wasm-operand-stack), $noreg, !"test3",
!DIExpression(DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 8,
DW_ATE_unsigned, DW_OP_stack_value), debug-location !6; :0 line no:0
BR_IF 0, %4:i32, implicit-def $arguments, implicit-def $value_stack, implicit
$value_stack
DBG_VALUE $noreg, $noreg, !"test3", !DIExpression(DW_OP_LLVM_convert, 1,
DW_ATE_unsigned, DW_OP_LLVM_convert, 8, DW_ATE_unsigned, DW_OP_stack_value),
debug-location !6; :0 line no:0
```
And because the verifier does not allow any more instruction after a terminator
within a BB, the verification fails.
This may not be a problem without `-verify-machineinstrs`, but we want to fix
this because `-vefiry-machineinstrs` is used in many places within our LLVM
test framework.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>