mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-02 02:38:04 +00:00
DebugIR tests -- lit tests for the line number transform
- simple one-function case - function-calling case - external function calling case - exception throwing case - vector case Note: these tests are somewhat coupled to the current format of debug metadata. llvm-svn: 181469
This commit is contained in:
parent
d142ce7068
commit
0233db70f0
6
llvm/test/Transforms/DebugIR/README.txt
Normal file
6
llvm/test/Transforms/DebugIR/README.txt
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
This directory contains tests for the DebugIR pass which modifies source-level
|
||||
debug metadata so as to allow debugging LLVM IR in a debugger. Becaue of a
|
||||
limitation in the current implementation, existing debug metadata is required
|
||||
for the pass to work, and as such, these tests (and the pass) are highly
|
||||
coupled with the current format of debug information.
|
63
llvm/test/Transforms/DebugIR/crash.ll
Normal file
63
llvm/test/Transforms/DebugIR/crash.ll
Normal file
@ -0,0 +1,63 @@
|
||||
; ModuleID = 'crash.c'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
@.str = private unnamed_addr constant [18 x i8] c"Hello, segfault!\0A\00", align 1
|
||||
@.str1 = private unnamed_addr constant [14 x i8] c"Now crash %d\0A\00", align 1
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @main(i32 %argc, i8** %argv) #0 {
|
||||
entry:
|
||||
%retval = alloca i32, align 4
|
||||
%argc.addr = alloca i32, align 4
|
||||
%argv.addr = alloca i8**, align 8
|
||||
%null_ptr = alloca i32*, align 8
|
||||
store i32 0, i32* %retval
|
||||
store i32 %argc, i32* %argc.addr, align 4
|
||||
call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !13), !dbg !14
|
||||
store i8** %argv, i8*** %argv.addr, align 8
|
||||
call void @llvm.dbg.declare(metadata !{i8*** %argv.addr}, metadata !15), !dbg !14
|
||||
call void @llvm.dbg.declare(metadata !{i32** %null_ptr}, metadata !16), !dbg !18
|
||||
store i32* null, i32** %null_ptr, align 8, !dbg !18
|
||||
%call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0)), !dbg !19
|
||||
%0 = load i32** %null_ptr, align 8, !dbg !20
|
||||
%1 = load i32* %0, align 4, !dbg !20
|
||||
%call1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x i8]* @.str1, i32 0, i32 0), i32 %1), !dbg !20
|
||||
%2 = load i32* %argc.addr, align 4, !dbg !21
|
||||
ret i32 %2, !dbg !21
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind readnone
|
||||
declare void @llvm.dbg.declare(metadata, metadata) #1
|
||||
|
||||
declare i32 @printf(i8*, ...) #2
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { nounwind readnone }
|
||||
attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
|
||||
!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.4 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/crash.c] [DW_LANG_C99]
|
||||
!1 = metadata !{metadata !"crash.c", metadata !""}
|
||||
!2 = metadata !{i32 0}
|
||||
!3 = metadata !{metadata !4}
|
||||
!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 12, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32, i8**)* @main, null, null, metadata !2, i32 13} ; [ DW_TAG_subprogram ] [line 12] [def] [scope 13] [main]
|
||||
!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/crash.c]
|
||||
!6 = metadata !{i32 786453, i32 0, i32 0, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!7 = metadata !{metadata !8, metadata !8, metadata !9}
|
||||
!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
|
||||
!9 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !10} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
|
||||
!10 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !11} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
|
||||
!11 = metadata !{i32 786470, null, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, metadata !12} ; [ DW_TAG_const_type ] [line 0, size 0, align 0, offset 0] [from char]
|
||||
!12 = metadata !{i32 786468, null, null, metadata !"char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] [char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char]
|
||||
!13 = metadata !{i32 786689, metadata !4, metadata !"argc", metadata !5, i32 16777228, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [argc] [line 12]
|
||||
!14 = metadata !{i32 12, i32 0, metadata !4, null}
|
||||
!15 = metadata !{i32 786689, metadata !4, metadata !"argv", metadata !5, i32 33554444, metadata !9, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [argv] [line 12]
|
||||
!16 = metadata !{i32 786688, metadata !4, metadata !"null_ptr", metadata !5, i32 14, metadata !17, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [null_ptr] [line 14]
|
||||
!17 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !8} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int]
|
||||
!18 = metadata !{i32 14, i32 0, metadata !4, null}
|
||||
!19 = metadata !{i32 15, i32 0, metadata !4, null}
|
||||
!20 = metadata !{i32 16, i32 0, metadata !4, null}
|
||||
!21 = metadata !{i32 17, i32 0, metadata !4, null}
|
||||
; RUN: opt < %s -debug-ir -S | FileCheck %s.check
|
23
llvm/test/Transforms/DebugIR/crash.ll.check
Normal file
23
llvm/test/Transforms/DebugIR/crash.ll.check
Normal file
@ -0,0 +1,23 @@
|
||||
; CHECK: store i32 0, i32* %retval, !dbg !
|
||||
; CHECK: store i32 %argc, i32* %argc.addr, align 4, !dbg !
|
||||
; CHECK: store i8** %argv, i8*** %argv.addr, align 8, !dbg !
|
||||
; CHECK: store i32* null, i32** %null_ptr, align 8, !dbg !
|
||||
; CHECK: %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0)), !dbg !
|
||||
; CHECK: %0 = load i32** %null_ptr, align 8, !dbg !
|
||||
; CHECK: %1 = load i32* %0, align 4, !dbg !
|
||||
; CHECK: %call1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x i8]* @.str1, i32 0, i32 0), i32 %1), !dbg !
|
||||
; CHECK: %2 = load i32* %argc.addr, align 4, !dbg !
|
||||
; CHECK: ret i32 %2, !dbg !
|
||||
|
||||
; CHECK: !1 = metadata !{metadata !"crash-debug.ll", metadata !""}
|
||||
|
||||
; CHECK: = metadata !{i32 14, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 15, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 16, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 17, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 18, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 19, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 20, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 21, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 22, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 23, i32 0, metadata !4, null}
|
120
llvm/test/Transforms/DebugIR/exception.ll
Normal file
120
llvm/test/Transforms/DebugIR/exception.ll
Normal file
@ -0,0 +1,120 @@
|
||||
; ModuleID = 'exception.cpp'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
@_ZTIi = external constant i8*
|
||||
|
||||
; Function Attrs: uwtable
|
||||
define i32 @main(i32 %argc, i8** %argv) #0 {
|
||||
entry:
|
||||
%retval = alloca i32, align 4
|
||||
%argc.addr = alloca i32, align 4
|
||||
%argv.addr = alloca i8**, align 8
|
||||
%exn.slot = alloca i8*
|
||||
%ehselector.slot = alloca i32
|
||||
%e = alloca i32, align 4
|
||||
%cleanup.dest.slot = alloca i32
|
||||
store i32 0, i32* %retval
|
||||
store i32 %argc, i32* %argc.addr, align 4
|
||||
call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !13), !dbg !14
|
||||
store i8** %argv, i8*** %argv.addr, align 8
|
||||
call void @llvm.dbg.declare(metadata !{i8*** %argv.addr}, metadata !15), !dbg !14
|
||||
%exception = call i8* @__cxa_allocate_exception(i64 4) #2, !dbg !16
|
||||
%0 = bitcast i8* %exception to i32*, !dbg !16
|
||||
%1 = load i32* %argc.addr, align 4, !dbg !16
|
||||
store i32 %1, i32* %0, !dbg !16
|
||||
invoke void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #3
|
||||
to label %unreachable unwind label %lpad, !dbg !16
|
||||
|
||||
lpad: ; preds = %entry
|
||||
%2 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
|
||||
catch i8* bitcast (i8** @_ZTIi to i8*), !dbg !16
|
||||
%3 = extractvalue { i8*, i32 } %2, 0, !dbg !16
|
||||
store i8* %3, i8** %exn.slot, !dbg !16
|
||||
%4 = extractvalue { i8*, i32 } %2, 1, !dbg !16
|
||||
store i32 %4, i32* %ehselector.slot, !dbg !16
|
||||
br label %catch.dispatch, !dbg !16
|
||||
|
||||
catch.dispatch: ; preds = %lpad
|
||||
%sel = load i32* %ehselector.slot, !dbg !18
|
||||
%5 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) #2, !dbg !18
|
||||
%matches = icmp eq i32 %sel, %5, !dbg !18
|
||||
br i1 %matches, label %catch, label %eh.resume, !dbg !18
|
||||
|
||||
catch: ; preds = %catch.dispatch
|
||||
call void @llvm.dbg.declare(metadata !{i32* %e}, metadata !19), !dbg !20
|
||||
%exn = load i8** %exn.slot, !dbg !18
|
||||
%6 = call i8* @__cxa_begin_catch(i8* %exn) #2, !dbg !18
|
||||
%7 = bitcast i8* %6 to i32*, !dbg !18
|
||||
%8 = load i32* %7, align 4, !dbg !18
|
||||
store i32 %8, i32* %e, align 4, !dbg !18
|
||||
%9 = load i32* %e, align 4, !dbg !21
|
||||
store i32 %9, i32* %retval, !dbg !21
|
||||
store i32 1, i32* %cleanup.dest.slot
|
||||
call void @__cxa_end_catch() #2, !dbg !23
|
||||
br label %try.cont
|
||||
|
||||
try.cont: ; preds = %catch
|
||||
%10 = load i32* %retval, !dbg !24
|
||||
ret i32 %10, !dbg !24
|
||||
|
||||
eh.resume: ; preds = %catch.dispatch
|
||||
%exn1 = load i8** %exn.slot, !dbg !18
|
||||
%sel2 = load i32* %ehselector.slot, !dbg !18
|
||||
%lpad.val = insertvalue { i8*, i32 } undef, i8* %exn1, 0, !dbg !18
|
||||
%lpad.val3 = insertvalue { i8*, i32 } %lpad.val, i32 %sel2, 1, !dbg !18
|
||||
resume { i8*, i32 } %lpad.val3, !dbg !18
|
||||
|
||||
unreachable: ; preds = %entry
|
||||
unreachable
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind readnone
|
||||
declare void @llvm.dbg.declare(metadata, metadata) #1
|
||||
|
||||
declare i8* @__cxa_allocate_exception(i64)
|
||||
|
||||
declare void @__cxa_throw(i8*, i8*, i8*)
|
||||
|
||||
declare i32 @__gxx_personality_v0(...)
|
||||
|
||||
; Function Attrs: nounwind readnone
|
||||
declare i32 @llvm.eh.typeid.for(i8*) #1
|
||||
|
||||
declare i8* @__cxa_begin_catch(i8*)
|
||||
|
||||
declare void @__cxa_end_catch()
|
||||
|
||||
attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { nounwind readnone }
|
||||
attributes #2 = { nounwind }
|
||||
attributes #3 = { noreturn }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
|
||||
!0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/exception.cpp] [DW_LANG_C_plus_plus]
|
||||
!1 = metadata !{metadata !"exception.cpp", metadata !""}
|
||||
!2 = metadata !{i32 0}
|
||||
!3 = metadata !{metadata !4}
|
||||
!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 10, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32, i8**)* @main, null, null, metadata !2, i32 11} ; [ DW_TAG_subprogram ] [line 10] [def] [scope 11] [main]
|
||||
!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/exception.cpp]
|
||||
!6 = metadata !{i32 786453, i32 0, i32 0, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!7 = metadata !{metadata !8, metadata !8, metadata !9}
|
||||
!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
|
||||
!9 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !10} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
|
||||
!10 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !11} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
|
||||
!11 = metadata !{i32 786470, null, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, metadata !12} ; [ DW_TAG_const_type ] [line 0, size 0, align 0, offset 0] [from char]
|
||||
!12 = metadata !{i32 786468, null, null, metadata !"char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] [char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char]
|
||||
!13 = metadata !{i32 786689, metadata !4, metadata !"argc", metadata !5, i32 16777226, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [argc] [line 10]
|
||||
!14 = metadata !{i32 10, i32 0, metadata !4, null}
|
||||
!15 = metadata !{i32 786689, metadata !4, metadata !"argv", metadata !5, i32 33554442, metadata !9, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [argv] [line 10]
|
||||
!16 = metadata !{i32 13, i32 0, metadata !17, null}
|
||||
!17 = metadata !{i32 786443, metadata !1, metadata !4, i32 12, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [/exception.cpp]
|
||||
!18 = metadata !{i32 14, i32 0, metadata !17, null}
|
||||
!19 = metadata !{i32 786688, metadata !4, metadata !"e", metadata !5, i32 14, metadata !8, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [e] [line 14]
|
||||
!20 = metadata !{i32 14, i32 0, metadata !4, null}
|
||||
!21 = metadata !{i32 15, i32 0, metadata !22, null}
|
||||
!22 = metadata !{i32 786443, metadata !1, metadata !4, i32 14, i32 0, i32 1} ; [ DW_TAG_lexical_block ] [/exception.cpp]
|
||||
!23 = metadata !{i32 16, i32 0, metadata !22, null}
|
||||
!24 = metadata !{i32 17, i32 0, metadata !4, null}
|
||||
; RUN: opt < %s -debug-ir -S | FileCheck %s.check
|
95
llvm/test/Transforms/DebugIR/exception.ll.check
Normal file
95
llvm/test/Transforms/DebugIR/exception.ll.check
Normal file
@ -0,0 +1,95 @@
|
||||
; CHECK: store i32 0, i32* %retval, !dbg !
|
||||
; CHECK: store i32 %argc, i32* %argc.addr, align 4, !dbg !
|
||||
; CHECK: store i8** %argv, i8*** %argv.addr, align 8, !dbg !
|
||||
; CHECK: %exception = call i8* @__cxa_allocate_exception(i64 4) #2, !dbg !
|
||||
; CHECK: %0 = bitcast i8* %exception to i32*, !dbg !
|
||||
; CHECK: %1 = load i32* %argc.addr, align 4, !dbg !
|
||||
; CHECK: store i32 %1, i32* %0, !dbg !
|
||||
; CHECK: invoke void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #3
|
||||
; CHECK: to label %unreachable unwind label %lpad, !dbg !
|
||||
|
||||
lpad: ; preds = %entry
|
||||
; CHECK: %2 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
|
||||
; CHECK: catch i8* bitcast (i8** @_ZTIi to i8*), !dbg !
|
||||
; CHECK: %3 = extractvalue { i8*, i32 } %2, 0, !dbg !
|
||||
; CHECK: store i8* %3, i8** %exn.slot, !dbg !
|
||||
; CHECK: %4 = extractvalue { i8*, i32 } %2, 1, !dbg !
|
||||
; CHECK: store i32 %4, i32* %ehselector.slot, !dbg !
|
||||
; CHECK: br label %catch.dispatch, !dbg !
|
||||
|
||||
catch.dispatch: ; preds = %lpad
|
||||
; CHECK: %sel = load i32* %ehselector.slot, !dbg !
|
||||
; CHECK: %5 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) #2, !dbg !
|
||||
; CHECK: %matches = icmp eq i32 %sel, %5, !dbg !
|
||||
; CHECK: br i1 %matches, label %catch, label %eh.resume, !dbg !
|
||||
|
||||
catch: ; preds = %catch.dispatch
|
||||
; CHECK: %exn = load i8** %exn.slot, !dbg !
|
||||
; CHECK: %6 = call i8* @__cxa_begin_catch(i8* %exn) #2, !dbg !
|
||||
; CHECK: %7 = bitcast i8* %6 to i32*, !dbg !
|
||||
; CHECK: %8 = load i32* %7, align 4, !dbg !
|
||||
; CHECK: store i32 %8, i32* %e, align 4, !dbg !
|
||||
; CHECK: %9 = load i32* %e, align 4, !dbg !
|
||||
; CHECK: store i32 %9, i32* %retval, !dbg !
|
||||
; CHECK: store i32 1, i32* %cleanup.dest.slot
|
||||
; CHECK: call void @__cxa_end_catch() #2, !dbg !
|
||||
; CHECK: br label %try.cont, !dbg !
|
||||
|
||||
try.cont: ; preds = %catch
|
||||
; CHECK: %10 = load i32* %retval, !dbg !
|
||||
; CHECK: ret i32 %10, !dbg !
|
||||
|
||||
eh.resume: ; preds = %catch.dispatch
|
||||
; CHECK: %exn1 = load i8** %exn.slot, !dbg !
|
||||
; CHECK: %sel2 = load i32* %ehselector.slot, !dbg !
|
||||
; CHECK: %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn1, 0, !dbg !
|
||||
; CHECK: %lpad.val3 = insertvalue { i8*, i32 } %lpad.val, i32 %sel2, 1, !dbg !
|
||||
; CHECK: resume { i8*, i32 } %lpad.val3, !dbg !
|
||||
|
||||
; CHECK: = metadata !{metadata !"exception-debug.ll", metadata !""}
|
||||
|
||||
; CHECK: = metadata !{i32 16, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 17, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 18, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 19, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 20, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 21, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 22, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 25, i32 0, metadata !
|
||||
|
||||
lpad
|
||||
; CHECK: = metadata !{i32 29, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 30, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 31, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 32, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 33, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 34, i32 0, metadata !
|
||||
|
||||
catch.dispatch
|
||||
; CHECK: = metadata !{i32 37, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 38, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 39, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 40, i32 0, metadata !
|
||||
|
||||
catch
|
||||
; CHECK: = metadata !{i32 43, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 44, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 45, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 46, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 47, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 48, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 49, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 50, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 51, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 52, i32 0, metadata !
|
||||
|
||||
try.cont
|
||||
; CHECK: = metadata !{i32 55, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 56, i32 0, metadata !
|
||||
|
||||
eh.resume
|
||||
; CHECK: = metadata !{i32 59, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 60, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 61, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 62, i32 0, metadata !
|
||||
; CHECK: = metadata !{i32 63, i32 0, metadata !
|
73
llvm/test/Transforms/DebugIR/function.ll
Normal file
73
llvm/test/Transforms/DebugIR/function.ll
Normal file
@ -0,0 +1,73 @@
|
||||
; ModuleID = 'function.c'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define void @blah(i32* %i) #0 {
|
||||
entry:
|
||||
%i.addr = alloca i32*, align 8
|
||||
store i32* %i, i32** %i.addr, align 8
|
||||
call void @llvm.dbg.declare(metadata !{i32** %i.addr}, metadata !17), !dbg !18
|
||||
%0 = load i32** %i.addr, align 8, !dbg !19
|
||||
%1 = load i32* %0, align 4, !dbg !19
|
||||
%add = add nsw i32 %1, 1, !dbg !19
|
||||
store i32 %add, i32* %0, align 4, !dbg !19
|
||||
ret void, !dbg !20
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind readnone
|
||||
declare void @llvm.dbg.declare(metadata, metadata) #1
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @main(i32 %argc, i8** %argv) #0 {
|
||||
entry:
|
||||
%retval = alloca i32, align 4
|
||||
%argc.addr = alloca i32, align 4
|
||||
%argv.addr = alloca i8**, align 8
|
||||
%i = alloca i32, align 4
|
||||
store i32 0, i32* %retval
|
||||
store i32 %argc, i32* %argc.addr, align 4
|
||||
call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !21), !dbg !22
|
||||
store i8** %argv, i8*** %argv.addr, align 8
|
||||
call void @llvm.dbg.declare(metadata !{i8*** %argv.addr}, metadata !23), !dbg !22
|
||||
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !24), !dbg !25
|
||||
store i32 7, i32* %i, align 4, !dbg !25
|
||||
call void @blah(i32* %i), !dbg !26
|
||||
%0 = load i32* %i, align 4, !dbg !27
|
||||
ret i32 %0, !dbg !27
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { nounwind readnone }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
|
||||
!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.4 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/function.c] [DW_LANG_C99]
|
||||
!1 = metadata !{metadata !"function.c", metadata !""}
|
||||
!2 = metadata !{i32 0}
|
||||
!3 = metadata !{metadata !4, metadata !10}
|
||||
!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"blah", metadata !"blah", metadata !"", i32 10, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i32*)* @blah, null, null, metadata !2, i32 10} ; [ DW_TAG_subprogram ] [line 10] [def] [blah]
|
||||
!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/function.c]
|
||||
!6 = metadata !{i32 786453, i32 0, i32 0, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!7 = metadata !{null, metadata !8}
|
||||
!8 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !9} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int]
|
||||
!9 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
|
||||
!10 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 14, metadata !11, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32, i8**)* @main, null, null, metadata !2, i32 15} ; [ DW_TAG_subprogram ] [line 14] [def] [scope 15] [main]
|
||||
!11 = metadata !{i32 786453, i32 0, i32 0, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !12, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!12 = metadata !{metadata !9, metadata !9, metadata !13}
|
||||
!13 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !14} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
|
||||
!14 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !15} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
|
||||
!15 = metadata !{i32 786470, null, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, metadata !16} ; [ DW_TAG_const_type ] [line 0, size 0, align 0, offset 0] [from char]
|
||||
!16 = metadata !{i32 786468, null, null, metadata !"char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] [char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char]
|
||||
!17 = metadata !{i32 786689, metadata !4, metadata !"i", metadata !5, i32 16777226, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [i] [line 10]
|
||||
!18 = metadata !{i32 10, i32 0, metadata !4, null}
|
||||
!19 = metadata !{i32 11, i32 0, metadata !4, null}
|
||||
!20 = metadata !{i32 12, i32 0, metadata !4, null}
|
||||
!21 = metadata !{i32 786689, metadata !10, metadata !"argc", metadata !5, i32 16777230, metadata !9, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [argc] [line 14]
|
||||
!22 = metadata !{i32 14, i32 0, metadata !10, null}
|
||||
!23 = metadata !{i32 786689, metadata !10, metadata !"argv", metadata !5, i32 33554446, metadata !13, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [argv] [line 14]
|
||||
!24 = metadata !{i32 786688, metadata !10, metadata !"i", metadata !5, i32 16, metadata !9, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [i] [line 16]
|
||||
!25 = metadata !{i32 16, i32 0, metadata !10, null}
|
||||
!26 = metadata !{i32 17, i32 0, metadata !10, null}
|
||||
!27 = metadata !{i32 18, i32 0, metadata !10, null}
|
||||
; RUN: opt < %s -debug-ir -S | FileCheck %s.check
|
36
llvm/test/Transforms/DebugIR/function.ll.check
Normal file
36
llvm/test/Transforms/DebugIR/function.ll.check
Normal file
@ -0,0 +1,36 @@
|
||||
; CHECK: %i.addr = alloca i32*, align 8, !dbg !
|
||||
; CHECK: store i32* %i, i32** %i.addr, align 8, !dbg !
|
||||
; CHECK: %0 = load i32** %i.addr, align 8, !dbg !
|
||||
; CHECK: %1 = load i32* %0, align 4, !dbg !
|
||||
; CHECK: %add = add nsw i32 %1, 1, !dbg !
|
||||
; CHECK: store i32 %add, i32* %0, align 4, !dbg !
|
||||
; CHECK: ret void, !dbg !
|
||||
|
||||
; CHECK: %retval = alloca i32, align 4, !dbg !
|
||||
; CHECK: %argc.addr = alloca i32, align 4, !dbg !
|
||||
; CHECK: %argv.addr = alloca i8**, align 8, !dbg !
|
||||
; CHECK: %i = alloca i32, align 4, !dbg !
|
||||
; CHECK: store i32 0, i32* %retval, !dbg !
|
||||
; CHECK: store i32 %argc, i32* %argc.addr, align 4, !dbg !
|
||||
; CHECK: store i8** %argv, i8*** %argv.addr, align 8, !dbg !
|
||||
; CHECK: store i32 7, i32* %i, align 4, !dbg !
|
||||
; CHECK: call void @blah(i32* %i), !dbg !
|
||||
; CHECK: %0 = load i32* %i, align 4, !dbg !
|
||||
; CHECK: ret i32 %0, !dbg !
|
||||
|
||||
; CHECK: !1 = metadata !{metadata !"function-debug.ll", metadata !""}
|
||||
|
||||
; CHECK: = metadata !{i32 8, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 9, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 10, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 11, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 12, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 13, i32 0, metadata !4, null}
|
||||
|
||||
; CHECK: = metadata !{i32 24, i32 0, metadata !10, null}
|
||||
; CHECK: = metadata !{i32 25, i32 0, metadata !10, null}
|
||||
; CHECK: = metadata !{i32 26, i32 0, metadata !10, null}
|
||||
; CHECK: = metadata !{i32 27, i32 0, metadata !10, null}
|
||||
; CHECK: = metadata !{i32 28, i32 0, metadata !10, null}
|
||||
; CHECK: = metadata !{i32 29, i32 0, metadata !10, null}
|
||||
; CHECK: = metadata !{i32 30, i32 0, metadata !10, null}
|
1
llvm/test/Transforms/DebugIR/lit.local.cfg
Normal file
1
llvm/test/Transforms/DebugIR/lit.local.cfg
Normal file
@ -0,0 +1 @@
|
||||
config.suffixes = ['.ll']
|
45
llvm/test/Transforms/DebugIR/simple.ll
Normal file
45
llvm/test/Transforms/DebugIR/simple.ll
Normal file
@ -0,0 +1,45 @@
|
||||
; ModuleID = 'simple.c'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @main(i32 %argc, i8** %argv) #0 {
|
||||
entry:
|
||||
%retval = alloca i32, align 4
|
||||
%argc.addr = alloca i32, align 4
|
||||
%argv.addr = alloca i8**, align 8
|
||||
store i32 0, i32* %retval
|
||||
store i32 %argc, i32* %argc.addr, align 4
|
||||
call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !13), !dbg !14
|
||||
store i8** %argv, i8*** %argv.addr, align 8
|
||||
call void @llvm.dbg.declare(metadata !{i8*** %argv.addr}, metadata !15), !dbg !14
|
||||
%0 = load i32* %argc.addr, align 4, !dbg !16
|
||||
ret i32 %0, !dbg !16
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind readnone
|
||||
declare void @llvm.dbg.declare(metadata, metadata) #1
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { nounwind readnone }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
|
||||
!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.4 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/simple.c] [DW_LANG_C99]
|
||||
!1 = metadata !{metadata !"simple.c", metadata !""}
|
||||
!2 = metadata !{i32 0}
|
||||
!3 = metadata !{metadata !4}
|
||||
!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 10, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32, i8**)* @main, null, null, metadata !2, i32 11} ; [ DW_TAG_subprogram ] [line 10] [def] [scope 11] [main]
|
||||
!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/simple.c]
|
||||
!6 = metadata !{i32 786453, i32 0, i32 0, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!7 = metadata !{metadata !8, metadata !8, metadata !9}
|
||||
!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
|
||||
!9 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !10} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
|
||||
!10 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !11} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
|
||||
!11 = metadata !{i32 786470, null, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, metadata !12} ; [ DW_TAG_const_type ] [line 0, size 0, align 0, offset 0] [from char]
|
||||
!12 = metadata !{i32 786468, null, null, metadata !"char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] [char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char]
|
||||
!13 = metadata !{i32 786689, metadata !4, metadata !"argc", metadata !5, i32 16777226, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [argc] [line 10]
|
||||
!14 = metadata !{i32 10, i32 0, metadata !4, null}
|
||||
!15 = metadata !{i32 786689, metadata !4, metadata !"argv", metadata !5, i32 33554442, metadata !9, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [argv] [line 10]
|
||||
!16 = metadata !{i32 12, i32 0, metadata !4, null}
|
||||
; RUN: opt < %s -debug-ir -S | FileCheck %s.check
|
13
llvm/test/Transforms/DebugIR/simple.ll.check
Normal file
13
llvm/test/Transforms/DebugIR/simple.ll.check
Normal file
@ -0,0 +1,13 @@
|
||||
; CHECK: store i32 0, i32* %retval, !dbg !
|
||||
; CHECK: store i32 %argc, i32* %argc.addr, align 4, !dbg !
|
||||
; CHECK: store i8** %argv, i8*** %argv.addr, align 8, !dbg !
|
||||
; CHECK: %0 = load i32* %argc.addr, align 4, !dbg !
|
||||
; CHECK: ret i32 %0, !dbg !
|
||||
|
||||
; CHECK: !1 = metadata !{metadata !"simple-debug.ll", metadata !""}
|
||||
|
||||
; CHECK: = metadata !{i32 10, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 11, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 12, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 13, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 14, i32 0, metadata !4, null}
|
51
llvm/test/Transforms/DebugIR/struct.ll
Normal file
51
llvm/test/Transforms/DebugIR/struct.ll
Normal file
@ -0,0 +1,51 @@
|
||||
; ModuleID = 'struct.cpp'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
%struct.blah = type { i32, float, i8 }
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%retval = alloca i32, align 4
|
||||
%b = alloca %struct.blah, align 4
|
||||
store i32 0, i32* %retval
|
||||
call void @llvm.dbg.declare(metadata !{%struct.blah* %b}, metadata !9), !dbg !22
|
||||
%a = getelementptr inbounds %struct.blah* %b, i32 0, i32 0, !dbg !23
|
||||
%0 = load i32* %a, align 4, !dbg !23
|
||||
ret i32 %0, !dbg !23
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind readnone
|
||||
declare void @llvm.dbg.declare(metadata, metadata) #1
|
||||
|
||||
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { nounwind readnone }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
|
||||
!0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/struct.cpp] [DW_LANG_C_plus_plus]
|
||||
!1 = metadata !{metadata !"struct.cpp", metadata !""}
|
||||
!2 = metadata !{i32 0}
|
||||
!3 = metadata !{metadata !4}
|
||||
!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 8, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @main, null, null, metadata !2, i32 8} ; [ DW_TAG_subprogram ] [line 8] [def] [main]
|
||||
!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/struct.cpp]
|
||||
!6 = metadata !{i32 786453, i32 0, i32 0, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!7 = metadata !{metadata !8}
|
||||
!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
|
||||
!9 = metadata !{i32 786688, metadata !4, metadata !"b", metadata !5, i32 9, metadata !10, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [b] [line 9]
|
||||
!10 = metadata !{i32 786451, metadata !1, null, metadata !"blah", i32 2, i64 96, i64 32, i32 0, i32 0, null, metadata !11, i32 0, null, null} ; [ DW_TAG_structure_type ] [blah] [line 2, size 96, align 32, offset 0] [from ]
|
||||
!11 = metadata !{metadata !12, metadata !13, metadata !15, metadata !17}
|
||||
!12 = metadata !{i32 786445, metadata !1, metadata !10, metadata !"a", i32 3, i64 32, i64 32, i64 0, i32 0, metadata !8} ; [ DW_TAG_member ] [a] [line 3, size 32, align 32, offset 0] [from int]
|
||||
!13 = metadata !{i32 786445, metadata !1, metadata !10, metadata !"b", i32 4, i64 32, i64 32, i64 32, i32 0, metadata !14} ; [ DW_TAG_member ] [b] [line 4, size 32, align 32, offset 32] [from float]
|
||||
!14 = metadata !{i32 786468, null, null, metadata !"float", i32 0, i64 32, i64 32, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ] [float] [line 0, size 32, align 32, offset 0, enc DW_ATE_float]
|
||||
!15 = metadata !{i32 786445, metadata !1, metadata !10, metadata !"c", i32 5, i64 8, i64 8, i64 64, i32 0, metadata !16} ; [ DW_TAG_member ] [c] [line 5, size 8, align 8, offset 64] [from char]
|
||||
!16 = metadata !{i32 786468, null, null, metadata !"char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] [char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char]
|
||||
!17 = metadata !{i32 786478, metadata !1, metadata !10, metadata !"blah", metadata !"blah", metadata !"", i32 2, metadata !18, i1 false, i1 false, i32 0, i32 0, null, i32 320, i1 false, null, null, i32 0, metadata !21, i32 2} ; [ DW_TAG_subprogram ] [line 2] [blah]
|
||||
!18 = metadata !{i32 786453, i32 0, i32 0, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !19, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!19 = metadata !{null, metadata !20}
|
||||
!20 = metadata !{i32 786447, i32 0, i32 0, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 1088, metadata !10} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from blah]
|
||||
!21 = metadata !{i32 786468}
|
||||
!22 = metadata !{i32 9, i32 0, metadata !4, null}
|
||||
!23 = metadata !{i32 10, i32 0, metadata !4, null}
|
||||
; RUN: opt < %s -debug-ir -S | FileCheck %s.check
|
12
llvm/test/Transforms/DebugIR/struct.ll.check
Normal file
12
llvm/test/Transforms/DebugIR/struct.ll.check
Normal file
@ -0,0 +1,12 @@
|
||||
; CHECK: %retval = alloca i32, align 4, !dbg !
|
||||
; CHECK: %b = alloca %struct.blah, align 4, !dbg !
|
||||
; CHECK: store i32 0, i32* %retval, !dbg !
|
||||
; CHECK: %a = getelementptr inbounds %struct.blah* %b, i32 0, i32 0, !dbg !
|
||||
; CHECK: %0 = load i32* %a, align 4, !dbg !
|
||||
; CHECK: ret i32 %0, !dbg !
|
||||
|
||||
; CHECK: = metadata !{metadata !"struct-debug.ll", metadata !""}
|
||||
; CHECK: = metadata !{i32 11, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 12, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 13, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 14, i32 0, metadata !4, null}
|
123
llvm/test/Transforms/DebugIR/vector.ll
Normal file
123
llvm/test/Transforms/DebugIR/vector.ll
Normal file
@ -0,0 +1,123 @@
|
||||
; ModuleID = 'vector.cpp'
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; Function Attrs: noinline nounwind uwtable
|
||||
define <4 x float> @_Z3fooDv2_fS_(double %a.coerce, double %b.coerce) #0 {
|
||||
entry:
|
||||
%a = alloca <2 x float>, align 8
|
||||
%a.addr = alloca <2 x float>, align 8
|
||||
%b = alloca <2 x float>, align 8
|
||||
%b.addr = alloca <2 x float>, align 8
|
||||
%c = alloca <4 x float>, align 16
|
||||
%0 = bitcast <2 x float>* %a to double*
|
||||
store double %a.coerce, double* %0, align 1
|
||||
%a1 = load <2 x float>* %a, align 8
|
||||
store <2 x float> %a1, <2 x float>* %a.addr, align 8
|
||||
call void @llvm.dbg.declare(metadata !{<2 x float>* %a.addr}, metadata !21), !dbg !22
|
||||
%1 = bitcast <2 x float>* %b to double*
|
||||
store double %b.coerce, double* %1, align 1
|
||||
%b2 = load <2 x float>* %b, align 8
|
||||
store <2 x float> %b2, <2 x float>* %b.addr, align 8
|
||||
call void @llvm.dbg.declare(metadata !{<2 x float>* %b.addr}, metadata !23), !dbg !22
|
||||
call void @llvm.dbg.declare(metadata !{<4 x float>* %c}, metadata !24), !dbg !25
|
||||
%2 = load <2 x float>* %a.addr, align 8, !dbg !26
|
||||
%3 = load <4 x float>* %c, align 16, !dbg !26
|
||||
%4 = shufflevector <2 x float> %2, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>, !dbg !26
|
||||
%5 = shufflevector <4 x float> %3, <4 x float> %4, <4 x i32> <i32 4, i32 1, i32 5, i32 3>, !dbg !26
|
||||
store <4 x float> %5, <4 x float>* %c, align 16, !dbg !26
|
||||
%6 = load <2 x float>* %b.addr, align 8, !dbg !27
|
||||
%7 = load <4 x float>* %c, align 16, !dbg !27
|
||||
%8 = shufflevector <2 x float> %6, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>, !dbg !27
|
||||
%9 = shufflevector <4 x float> %7, <4 x float> %8, <4 x i32> <i32 0, i32 4, i32 2, i32 5>, !dbg !27
|
||||
store <4 x float> %9, <4 x float>* %c, align 16, !dbg !27
|
||||
%10 = load <4 x float>* %c, align 16, !dbg !28
|
||||
ret <4 x float> %10, !dbg !28
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind readnone
|
||||
declare void @llvm.dbg.declare(metadata, metadata) #1
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define i32 @main() #2 {
|
||||
entry:
|
||||
%retval = alloca i32, align 4
|
||||
%a = alloca <2 x float>, align 8
|
||||
%b = alloca <2 x float>, align 8
|
||||
%x = alloca <4 x float>, align 16
|
||||
%coerce = alloca <2 x float>, align 8
|
||||
%coerce1 = alloca <2 x float>, align 8
|
||||
store i32 0, i32* %retval
|
||||
call void @llvm.dbg.declare(metadata !{<2 x float>* %a}, metadata !29), !dbg !30
|
||||
store <2 x float> <float 1.000000e+00, float 2.000000e+00>, <2 x float>* %a, align 8, !dbg !30
|
||||
call void @llvm.dbg.declare(metadata !{<2 x float>* %b}, metadata !31), !dbg !32
|
||||
store <2 x float> <float 1.000000e+00, float 2.000000e+00>, <2 x float>* %b, align 8, !dbg !32
|
||||
call void @llvm.dbg.declare(metadata !{<4 x float>* %x}, metadata !33), !dbg !34
|
||||
%0 = load <2 x float>* %a, align 8, !dbg !34
|
||||
%1 = load <2 x float>* %b, align 8, !dbg !34
|
||||
store <2 x float> %0, <2 x float>* %coerce, align 8, !dbg !34
|
||||
%2 = bitcast <2 x float>* %coerce to double*, !dbg !34
|
||||
%3 = load double* %2, align 1, !dbg !34
|
||||
store <2 x float> %1, <2 x float>* %coerce1, align 8, !dbg !34
|
||||
%4 = bitcast <2 x float>* %coerce1 to double*, !dbg !34
|
||||
%5 = load double* %4, align 1, !dbg !34
|
||||
%call = call <4 x float> @_Z3fooDv2_fS_(double %3, double %5), !dbg !34
|
||||
store <4 x float> %call, <4 x float>* %x, align 16, !dbg !34
|
||||
%6 = load <4 x float>* %x, align 16, !dbg !35
|
||||
%7 = extractelement <4 x float> %6, i32 0, !dbg !35
|
||||
%8 = load <4 x float>* %x, align 16, !dbg !35
|
||||
%9 = extractelement <4 x float> %8, i32 1, !dbg !35
|
||||
%add = fadd float %7, %9, !dbg !35
|
||||
%10 = load <4 x float>* %x, align 16, !dbg !35
|
||||
%11 = extractelement <4 x float> %10, i32 2, !dbg !35
|
||||
%add2 = fadd float %add, %11, !dbg !35
|
||||
%12 = load <4 x float>* %x, align 16, !dbg !35
|
||||
%13 = extractelement <4 x float> %12, i32 3, !dbg !35
|
||||
%add3 = fadd float %add2, %13, !dbg !35
|
||||
%conv = fptosi float %add3 to i32, !dbg !35
|
||||
ret i32 %conv, !dbg !35
|
||||
}
|
||||
|
||||
attributes #0 = { noinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { nounwind readnone }
|
||||
attributes #2 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
|
||||
!0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/vector.cpp] [DW_LANG_C_plus_plus]
|
||||
!1 = metadata !{metadata !"vector.cpp", metadata !""}
|
||||
!2 = metadata !{i32 0}
|
||||
!3 = metadata !{metadata !4, metadata !17}
|
||||
!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"foo", metadata !"foo", metadata !"_Z3fooDv2_fS_", i32 6, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, <4 x float> (double, double)* @_Z3fooDv2_fS_, null, null, metadata !2, i32 6} ; [ DW_TAG_subprogram ] [line 6] [def] [foo]
|
||||
!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/vector.cpp]
|
||||
!6 = metadata !{i32 786453, i32 0, i32 0, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!7 = metadata !{metadata !8, metadata !13, metadata !13}
|
||||
!8 = metadata !{i32 786454, metadata !1, null, metadata !"float4", i32 2, i64 0, i64 0, i64 0, i32 0, metadata !9} ; [ DW_TAG_typedef ] [float4] [line 2, size 0, align 0, offset 0] [from ]
|
||||
!9 = metadata !{i32 786433, null, null, metadata !"", i32 0, i64 128, i64 128, i32 0, i32 2048, metadata !10, metadata !11, i32 0, i32 0} ; [ DW_TAG_array_type ] [line 0, size 128, align 128, offset 0] [vector] [from float]
|
||||
!10 = metadata !{i32 786468, null, null, metadata !"float", i32 0, i64 32, i64 32, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ] [float] [line 0, size 32, align 32, offset 0, enc DW_ATE_float]
|
||||
!11 = metadata !{metadata !12}
|
||||
!12 = metadata !{i32 786465, i64 0, i64 4} ; [ DW_TAG_subrange_type ] [0, 3]
|
||||
!13 = metadata !{i32 786454, metadata !1, null, metadata !"float2", i32 3, i64 0, i64 0, i64 0, i32 0, metadata !14} ; [ DW_TAG_typedef ] [float2] [line 3, size 0, align 0, offset 0] [from ]
|
||||
!14 = metadata !{i32 786433, null, null, metadata !"", i32 0, i64 64, i64 64, i32 0, i32 2048, metadata !10, metadata !15, i32 0, i32 0} ; [ DW_TAG_array_type ] [line 0, size 64, align 64, offset 0] [vector] [from float]
|
||||
!15 = metadata !{metadata !16}
|
||||
!16 = metadata !{i32 786465, i64 0, i64 2} ; [ DW_TAG_subrange_type ] [0, 1]
|
||||
!17 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 13, metadata !18, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @main, null, null, metadata !2, i32 13} ; [ DW_TAG_subprogram ] [line 13] [def] [main]
|
||||
!18 = metadata !{i32 786453, i32 0, i32 0, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !19, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
||||
!19 = metadata !{metadata !20}
|
||||
!20 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
|
||||
!21 = metadata !{i32 786689, metadata !4, metadata !"a", metadata !5, i32 16777222, metadata !13, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [a] [line 6]
|
||||
!22 = metadata !{i32 6, i32 0, metadata !4, null}
|
||||
!23 = metadata !{i32 786689, metadata !4, metadata !"b", metadata !5, i32 33554438, metadata !13, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [b] [line 6]
|
||||
!24 = metadata !{i32 786688, metadata !4, metadata !"c", metadata !5, i32 7, metadata !8, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [c] [line 7]
|
||||
!25 = metadata !{i32 7, i32 0, metadata !4, null}
|
||||
!26 = metadata !{i32 8, i32 0, metadata !4, null} ; [ DW_TAG_imported_declaration ]
|
||||
!27 = metadata !{i32 9, i32 0, metadata !4, null}
|
||||
!28 = metadata !{i32 10, i32 0, metadata !4, null}
|
||||
!29 = metadata !{i32 786688, metadata !17, metadata !"a", metadata !5, i32 14, metadata !13, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [a] [line 14]
|
||||
!30 = metadata !{i32 14, i32 0, metadata !17, null}
|
||||
!31 = metadata !{i32 786688, metadata !17, metadata !"b", metadata !5, i32 15, metadata !13, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [b] [line 15]
|
||||
!32 = metadata !{i32 15, i32 0, metadata !17, null}
|
||||
!33 = metadata !{i32 786688, metadata !17, metadata !"x", metadata !5, i32 16, metadata !8, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [x] [line 16]
|
||||
!34 = metadata !{i32 16, i32 0, metadata !17, null}
|
||||
!35 = metadata !{i32 18, i32 0, metadata !17, null}
|
||||
; RUN: opt < %s -debug-ir -S | FileCheck %s.check
|
39
llvm/test/Transforms/DebugIR/vector.ll.check
Normal file
39
llvm/test/Transforms/DebugIR/vector.ll.check
Normal file
@ -0,0 +1,39 @@
|
||||
; CHECK: store double %a.coerce, double* %0, align 1, !dbg !
|
||||
; CHECK: %a1 = load <2 x float>* %a, align 8, !dbg !
|
||||
; CHECK: store <2 x float> %a1, <2 x float>* %a.addr, align 8, !dbg !
|
||||
; CHECK: store double %b.coerce, double* %1, align 1, !dbg !
|
||||
; CHECK: %b2 = load <2 x float>* %b, align 8, !dbg !
|
||||
; CHECK: store <2 x float> %b2, <2 x float>* %b.addr, align 8, !dbg !
|
||||
; CHECK: %2 = load <2 x float>* %a.addr, align 8, !dbg !
|
||||
; CHECK: %3 = load <4 x float>* %c, align 16, !dbg !
|
||||
; CHECK: %4 = shufflevector <2 x float> %2, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>, !dbg !
|
||||
; CHECK: %5 = shufflevector <4 x float> %3, <4 x float> %4, <4 x i32> <i32 4, i32 1, i32 5, i32 3>, !dbg !
|
||||
; CHECK: store <4 x float> %5, <4 x float>* %c, align 16, !dbg !
|
||||
; CHECK: %6 = load <2 x float>* %b.addr, align 8, !dbg !
|
||||
; CHECK: %7 = load <4 x float>* %c, align 16, !dbg !
|
||||
; CHECK: %8 = shufflevector <2 x float> %6, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>, !dbg !
|
||||
; CHECK: %9 = shufflevector <4 x float> %7, <4 x float> %8, <4 x i32> <i32 0, i32 4, i32 2, i32 5>, !dbg !
|
||||
; CHECK: store <4 x float> %9, <4 x float>* %c, align 16, !dbg !
|
||||
; CHECK: %10 = load <4 x float>* %c, align 16, !dbg !
|
||||
; CHECK: ret <4 x float> %10, !dbg !
|
||||
|
||||
; CHECK: = metadata !{metadata !"vector-debug.ll", metadata !""}
|
||||
; CHECK: = metadata !{i32 13, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 14, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 15, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 16, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 17, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 18, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 19, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 20, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 21, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 22, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 23, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 24, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 25, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 26, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 27, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 28, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 29, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 30, i32 0, metadata !4, null}
|
||||
; CHECK: = metadata !{i32 31, i32 0, metadata !4, null}
|
Loading…
Reference in New Issue
Block a user