[llvm-bugs] [Bug 50175] New: [WebAssembly] "Non-terminator instruction after the first terminator" Verification failure after DebugFixup
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Apr 29 17:00:47 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50175
Bug ID: 50175
Summary: [WebAssembly] "Non-terminator instruction after the
first terminator" Verification failure after
DebugFixup
Product: libraries
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Backend: WebAssembly
Assignee: unassignedbugs at nondot.org
Reporter: aheejin at gmail.com
CC: aardappel at gmail.com, dschuff at google.com,
llvm-bugs at lists.llvm.org
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210430/6f301fef/attachment.html>
More information about the llvm-bugs
mailing list