2018-01-24 00:55:44 +08:00
|
|
|
; RUN: llc < %s -O0 -verify-machineinstrs | FileCheck %s
|
2016-08-12 18:13:45 +08:00
|
|
|
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: %bb.0
|
2017-11-30 20:12:19 +08:00
|
|
|
; CHECK: #DEBUG_VALUE: usage:self <- %4
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: %bb.1
|
Improve virtual register handling when computing debug information
Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered.
Reviewers: dexonsmith, dschuff, aprantl
Subscribers: yurydelendik, llvm-commits, jfb, sunfish
Differential Revision: https://reviews.llvm.org/D22590
llvm-svn: 278371
2016-08-12 01:52:40 +08:00
|
|
|
; CHECK: DW_TAG_variable
|
2016-12-22 08:45:21 +08:00
|
|
|
source_filename = "test/CodeGen/WebAssembly/dbgvalue.ll"
|
Improve virtual register handling when computing debug information
Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered.
Reviewers: dexonsmith, dschuff, aprantl
Subscribers: yurydelendik, llvm-commits, jfb, sunfish
Differential Revision: https://reviews.llvm.org/D22590
llvm-svn: 278371
2016-08-12 01:52:40 +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"
|
Improve virtual register handling when computing debug information
Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered.
Reviewers: dexonsmith, dschuff, aprantl
Subscribers: yurydelendik, llvm-commits, jfb, sunfish
Differential Revision: https://reviews.llvm.org/D22590
llvm-svn: 278371
2016-08-12 01:52:40 +08:00
|
|
|
|
|
|
|
@key = external local_unnamed_addr global [15 x i8], align 1
|
|
|
|
@.str = external unnamed_addr constant [33 x i8], align 1
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
define internal i32 @0(i8*) local_unnamed_addr !dbg !15 !type !23 {
|
|
|
|
tail call void @llvm.dbg.value(metadata i8* %0, i64 0, metadata !22, metadata !24), !dbg !25
|
|
|
|
%2 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i32 0, i32 0), i8* %0), !dbg !26
|
|
|
|
br i1 true, label %a, label %b
|
|
|
|
|
|
|
|
a: ; preds = %1
|
Improve virtual register handling when computing debug information
Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered.
Reviewers: dexonsmith, dschuff, aprantl
Subscribers: yurydelendik, llvm-commits, jfb, sunfish
Differential Revision: https://reviews.llvm.org/D22590
llvm-svn: 278371
2016-08-12 01:52:40 +08:00
|
|
|
%3 = add i32 %2, %2
|
|
|
|
br label %c
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
b: ; preds = %1
|
Improve virtual register handling when computing debug information
Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered.
Reviewers: dexonsmith, dschuff, aprantl
Subscribers: yurydelendik, llvm-commits, jfb, sunfish
Differential Revision: https://reviews.llvm.org/D22590
llvm-svn: 278371
2016-08-12 01:52:40 +08:00
|
|
|
%4 = sub i32 %2, %2
|
|
|
|
br label %c
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
c: ; preds = %b, %a
|
Improve virtual register handling when computing debug information
Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered.
Reviewers: dexonsmith, dschuff, aprantl
Subscribers: yurydelendik, llvm-commits, jfb, sunfish
Differential Revision: https://reviews.llvm.org/D22590
llvm-svn: 278371
2016-08-12 01:52:40 +08:00
|
|
|
%5 = phi i32 [ %3, %a ], [ %4, %b ]
|
|
|
|
%6 = add i32 ptrtoint (i32 (i8*)* @0 to i32), %5
|
2016-12-22 08:45:21 +08:00
|
|
|
ret i32 %6, !dbg !27
|
Improve virtual register handling when computing debug information
Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered.
Reviewers: dexonsmith, dschuff, aprantl
Subscribers: yurydelendik, llvm-commits, jfb, sunfish
Differential Revision: https://reviews.llvm.org/D22590
llvm-svn: 278371
2016-08-12 01:52:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @printf(i8* nocapture readonly, ...) local_unnamed_addr
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
2016-12-22 08:45:21 +08:00
|
|
|
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0
|
|
|
|
|
|
|
|
attributes #0 = { nounwind readnone }
|
Improve virtual register handling when computing debug information
Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered.
Reviewers: dexonsmith, dschuff, aprantl
Subscribers: yurydelendik, llvm-commits, jfb, sunfish
Differential Revision: https://reviews.llvm.org/D22590
llvm-svn: 278371
2016-08-12 01:52:40 +08:00
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2016-12-22 08:45:21 +08:00
|
|
|
!llvm.module.flags = !{!12, !13}
|
|
|
|
!llvm.ident = !{!14}
|
Improve virtual register handling when computing debug information
Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered.
Reviewers: dexonsmith, dschuff, aprantl
Subscribers: yurydelendik, llvm-commits, jfb, sunfish
Differential Revision: https://reviews.llvm.org/D22590
llvm-svn: 278371
2016-08-12 01:52:40 +08:00
|
|
|
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (trunk 273884) (llvm/trunk 273897)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3)
|
|
|
|
!1 = !DIFile(filename: "crash.c", directory: "wasm/tests")
|
|
|
|
!2 = !{}
|
|
|
|
!3 = !{!4}
|
2017-08-31 02:06:51 +08:00
|
|
|
!4 = !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: "usage", scope: !1, file: !1, line: 15, type: !16, isLocal: false, isDefinition: true, scopeLine: 15, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !21)
|
2016-12-22 08:45:21 +08:00
|
|
|
!16 = !DISubroutineType(types: !17)
|
|
|
|
!17 = !{!18, !19}
|
|
|
|
!18 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
|
|
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 32, align: 32)
|
|
|
|
!20 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
|
|
|
|
!21 = !{!22}
|
|
|
|
!22 = !DILocalVariable(name: "self", arg: 1, scope: !15, file: !1, line: 15, type: !19)
|
|
|
|
!23 = !{i64 0, !"_ZTSFiPcE"}
|
|
|
|
!24 = !DIExpression()
|
|
|
|
!25 = !DILocation(line: 15, column: 17, scope: !15)
|
|
|
|
!26 = !DILocation(line: 16, column: 3, scope: !15)
|
|
|
|
!27 = !DILocation(line: 17, column: 3, scope: !15)
|
|
|
|
|