2018-05-11 01:49:11 +08:00
|
|
|
; RUN: llc < %s -verify-machineinstrs -mtriple=wasm32-unknown-unknown | FileCheck %s
|
|
|
|
; RUN: llc < %s -verify-machineinstrs -mtriple=wasm32-unknown-unknown -fast-isel | FileCheck --check-prefix=CHECK-FAST %s
|
[DebugInfo] Don't turn dbg.declare into DBG_VALUE for static allocas
Summary:
We already have information about static alloca stack locations in our
side table. Emitting instructions for them is inefficient, and it only
happens when the address of the alloca has been materialized within the
current block, which isn't often.
Reviewers: aprantl, probinson, dblaikie
Subscribers: jfb, dschuff, sbc100, jgravelle-google, hiraditya, llvm-commits, aheejin
Differential Revision: https://reviews.llvm.org/D36117
llvm-svn: 309729
2017-08-02 03:45:09 +08:00
|
|
|
|
[WebAssembly] Handle debug information and virtual registers without crashing (reland r278967)
Summary: Currently, enabling debug information when compiling for WebAssembly crashes the backend. This commit fixes these by skipping debug values in backend passes.
Reviewers: jfb, aprantl, dschuff, echristo
Subscribers: llvm-commits, dschuff, jfb, MatzeB, dexonsmith, yurydelendik, mehdi_amini
Differential Revision: https://reviews.llvm.org/D23635
llvm-svn: 279011
2016-08-18 07:42:27 +08:00
|
|
|
; CHECK: DW_TAG_variable
|
|
|
|
; CHECK-FAST: DW_TAG_variable
|
|
|
|
|
|
|
|
; Test that llvm.dbg.declare() instrinsics do not crash the backend
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
source_filename = "test/DebugInfo/WebAssembly/dbg-declare.ll"
|
[WebAssembly] Handle debug information and virtual registers without crashing (reland r278967)
Summary: Currently, enabling debug information when compiling for WebAssembly crashes the backend. This commit fixes these by skipping debug values in backend passes.
Reviewers: jfb, aprantl, dschuff, echristo
Subscribers: llvm-commits, dschuff, jfb, MatzeB, dexonsmith, yurydelendik, mehdi_amini
Differential Revision: https://reviews.llvm.org/D23635
llvm-svn: 279011
2016-08-18 07:42:27 +08:00
|
|
|
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
|
2018-05-11 01:49:11 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
[WebAssembly] Handle debug information and virtual registers without crashing (reland r278967)
Summary: Currently, enabling debug information when compiling for WebAssembly crashes the backend. This commit fixes these by skipping debug values in backend passes.
Reviewers: jfb, aprantl, dschuff, echristo
Subscribers: llvm-commits, dschuff, jfb, MatzeB, dexonsmith, yurydelendik, mehdi_amini
Differential Revision: https://reviews.llvm.org/D23635
llvm-svn: 279011
2016-08-18 07:42:27 +08:00
|
|
|
|
|
|
|
@key = external global [15 x i8], align 1
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
define internal zeroext i8 @0(i32, i8 zeroext) !dbg !15 !type !20 {
|
[WebAssembly] Handle debug information and virtual registers without crashing (reland r278967)
Summary: Currently, enabling debug information when compiling for WebAssembly crashes the backend. This commit fixes these by skipping debug values in backend passes.
Reviewers: jfb, aprantl, dschuff, echristo
Subscribers: llvm-commits, dschuff, jfb, MatzeB, dexonsmith, yurydelendik, mehdi_amini
Differential Revision: https://reviews.llvm.org/D23635
llvm-svn: 279011
2016-08-18 07:42:27 +08:00
|
|
|
%3 = alloca i32, align 4
|
|
|
|
%4 = alloca i8, align 1
|
|
|
|
store i32 %0, i32* %3, align 4
|
2016-12-22 08:45:21 +08:00
|
|
|
call void @llvm.dbg.declare(metadata i32* %3, metadata !21, metadata !22), !dbg !23
|
[WebAssembly] Handle debug information and virtual registers without crashing (reland r278967)
Summary: Currently, enabling debug information when compiling for WebAssembly crashes the backend. This commit fixes these by skipping debug values in backend passes.
Reviewers: jfb, aprantl, dschuff, echristo
Subscribers: llvm-commits, dschuff, jfb, MatzeB, dexonsmith, yurydelendik, mehdi_amini
Differential Revision: https://reviews.llvm.org/D23635
llvm-svn: 279011
2016-08-18 07:42:27 +08:00
|
|
|
store i8 %1, i8* %4, align 1
|
2016-12-22 08:45:21 +08:00
|
|
|
call void @llvm.dbg.declare(metadata i8* %4, metadata !24, metadata !22), !dbg !25
|
|
|
|
%5 = load i8, i8* %4, align 1, !dbg !26
|
|
|
|
%6 = zext i8 %5 to i32, !dbg !26
|
|
|
|
%7 = load i32, i32* %3, align 4, !dbg !27
|
|
|
|
%8 = urem i32 %7, 15, !dbg !28
|
|
|
|
%9 = getelementptr inbounds [15 x i8], [15 x i8]* @key, i32 0, i32 %8, !dbg !29
|
|
|
|
%10 = load i8, i8* %9, align 1, !dbg !29
|
|
|
|
%11 = zext i8 %10 to i32, !dbg !29
|
|
|
|
%12 = xor i32 %6, %11, !dbg !30
|
|
|
|
%13 = trunc i32 %12 to i8, !dbg !31
|
|
|
|
ret i8 %13, !dbg !32
|
[WebAssembly] Handle debug information and virtual registers without crashing (reland r278967)
Summary: Currently, enabling debug information when compiling for WebAssembly crashes the backend. This commit fixes these by skipping debug values in backend passes.
Reviewers: jfb, aprantl, dschuff, echristo
Subscribers: llvm-commits, dschuff, jfb, MatzeB, dexonsmith, yurydelendik, mehdi_amini
Differential Revision: https://reviews.llvm.org/D23635
llvm-svn: 279011
2016-08-18 07:42:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
2016-12-22 08:45:21 +08:00
|
|
|
|
|
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
|
|
|
|
|
|
|
|
attributes #0 = { nounwind readnone }
|
[WebAssembly] Handle debug information and virtual registers without crashing (reland r278967)
Summary: Currently, enabling debug information when compiling for WebAssembly crashes the backend. This commit fixes these by skipping debug values in backend passes.
Reviewers: jfb, aprantl, dschuff, echristo
Subscribers: llvm-commits, dschuff, jfb, MatzeB, dexonsmith, yurydelendik, mehdi_amini
Differential Revision: https://reviews.llvm.org/D23635
llvm-svn: 279011
2016-08-18 07:42:27 +08:00
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2016-12-22 08:45:21 +08:00
|
|
|
!llvm.module.flags = !{!12, !13}
|
|
|
|
!llvm.ident = !{!14}
|
[WebAssembly] Handle debug information and virtual registers without crashing (reland r278967)
Summary: Currently, enabling debug information when compiling for WebAssembly crashes the backend. This commit fixes these by skipping debug values in backend passes.
Reviewers: jfb, aprantl, dschuff, echristo
Subscribers: llvm-commits, dschuff, jfb, MatzeB, dexonsmith, yurydelendik, mehdi_amini
Differential Revision: https://reviews.llvm.org/D23635
llvm-svn: 279011
2016-08-18 07:42:27 +08:00
|
|
|
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (trunk 273884) (llvm/trunk 273897)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3)
|
|
|
|
!1 = !DIFile(filename: "crash.c", directory: "wasm/tests")
|
|
|
|
!2 = !{}
|
|
|
|
!3 = !{!4}
|
2017-08-31 03:54:08 +08:00
|
|
|
!4 = distinct !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
|
2016-12-22 08:45:21 +08:00
|
|
|
!5 = !DIGlobalVariable(name: "key", scope: !0, file: !1, line: 7, type: !6, isLocal: false, isDefinition: true)
|
|
|
|
!6 = !DICompositeType(tag: DW_TAG_array_type, baseType: !7, size: 120, align: 8, elements: !10)
|
|
|
|
!7 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint8_t", file: !8, line: 185, baseType: !9)
|
|
|
|
!8 = !DIFile(filename: "wasm/emscripten/system/include/libc/bits/alltypes.h", directory: "wasm/tests")
|
|
|
|
!9 = !DIBasicType(name: "unsigned char", size: 8, align: 8, encoding: DW_ATE_unsigned_char)
|
|
|
|
!10 = !{!11}
|
|
|
|
!11 = !DISubrange(count: 15)
|
|
|
|
!12 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!13 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!14 = !{!"clang version 3.9.0 (trunk 273884) (llvm/trunk 273897)"}
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!15 = distinct !DISubprogram(name: "decode", scope: !1, file: !1, line: 11, type: !16, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
2016-12-22 08:45:21 +08:00
|
|
|
!16 = !DISubroutineType(types: !17)
|
|
|
|
!17 = !{!7, !18, !7}
|
|
|
|
!18 = !DIDerivedType(tag: DW_TAG_typedef, name: "size_t", file: !8, line: 124, baseType: !19)
|
|
|
|
!19 = !DIBasicType(name: "long unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
|
|
|
|
!20 = !{i64 0, !"_ZTSFhmhE"}
|
|
|
|
!21 = !DILocalVariable(name: "i", arg: 1, scope: !15, file: !1, line: 11, type: !18)
|
|
|
|
!22 = !DIExpression()
|
|
|
|
!23 = !DILocation(line: 11, column: 23, scope: !15)
|
|
|
|
!24 = !DILocalVariable(name: "v", arg: 2, scope: !15, file: !1, line: 11, type: !7)
|
|
|
|
!25 = !DILocation(line: 11, column: 34, scope: !15)
|
|
|
|
!26 = !DILocation(line: 12, column: 11, scope: !15)
|
|
|
|
!27 = !DILocation(line: 12, column: 19, scope: !15)
|
|
|
|
!28 = !DILocation(line: 12, column: 21, scope: !15)
|
|
|
|
!29 = !DILocation(line: 12, column: 15, scope: !15)
|
|
|
|
!30 = !DILocation(line: 12, column: 13, scope: !15)
|
|
|
|
!31 = !DILocation(line: 12, column: 10, scope: !15)
|
|
|
|
!32 = !DILocation(line: 12, column: 3, scope: !15)
|
|
|
|
|