diff options
Diffstat (limited to 'test/Instrumentation/SanitizerCoverage')
4 files changed, 76 insertions, 65 deletions
diff --git a/test/Instrumentation/SanitizerCoverage/coverage-dbg.ll b/test/Instrumentation/SanitizerCoverage/coverage-dbg.ll index eea93b8..a1b23f1 100644 --- a/test/Instrumentation/SanitizerCoverage/coverage-dbg.ll +++ b/test/Instrumentation/SanitizerCoverage/coverage-dbg.ll @@ -15,8 +15,8 @@ ; and add sanitize_address to @_ZN1A1fEv ; Test that __sanitizer_cov call has !dbg pointing to the opening { of A::f(). -; CHECK: call void @__sanitizer_cov(), !dbg [[A:!.*]] -; CHECK: [[A]] = metadata !{i32 6, i32 0, metadata !{{.*}}, null} +; CHECK: call void @__sanitizer_cov(i32*{{.*}}), !dbg [[A:!.*]] +; CHECK: [[A]] = !MDLocation(line: 6, scope: !{{.*}}) target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" @@ -27,7 +27,7 @@ target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: nounwind readonly uwtable define i32 @_ZN1A1fEv(%struct.A* nocapture readonly %this) #0 align 2 { entry: - tail call void @llvm.dbg.value(metadata !{%struct.A* %this}, i64 0, metadata !15, metadata !{metadata !"0x102"}), !dbg !20 + tail call void @llvm.dbg.value(metadata %struct.A* %this, i64 0, metadata !15, metadata !{!"0x102"}), !dbg !20 %x = getelementptr inbounds %struct.A* %this, i64 0, i32 0, !dbg !21 %0 = load i32* %x, align 4, !dbg !21 ret i32 %0, !dbg !21 @@ -43,25 +43,25 @@ attributes #1 = { nounwind readnone } !llvm.module.flags = !{!17, !18} !llvm.ident = !{!19} -!0 = metadata !{metadata !"0x11\004\00clang version 3.5.0 (210251)\001\00\000\00\001", metadata !1, metadata !2, metadata !3, metadata !12, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [/code/llvm/build0/../1.cc] [DW_LANG_C_plus_plus] -!1 = metadata !{metadata !"../1.cc", metadata !"/code/llvm/build0"} -!2 = metadata !{} -!3 = metadata !{metadata !4} -!4 = metadata !{metadata !"0x13\00A\001\0032\0032\000\000\000", metadata !1, null, null, metadata !5, null, null, metadata !"_ZTS1A"} ; [ DW_TAG_structure_type ] [A] [line 1, size 32, align 32, offset 0] [def] [from ] -!5 = metadata !{metadata !6, metadata !8} -!6 = metadata !{metadata !"0xd\00x\003\0032\0032\000\000", metadata !1, metadata !"_ZTS1A", metadata !7} ; [ DW_TAG_member ] [x] [line 3, size 32, align 32, offset 0] [from int] -!7 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] -!8 = metadata !{metadata !"0x2e\00f\00f\00_ZN1A1fEv\002\000\000\000\006\00256\001\002", metadata !1, metadata !"_ZTS1A", metadata !9, null, null, null, i32 0, null} ; [ DW_TAG_subprogram ] [line 2] [f] -!9 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !10, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] -!10 = metadata !{metadata !7, metadata !11} -!11 = metadata !{metadata !"0xf\00\000\0064\0064\000\001088", null, null, metadata !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1A] -!12 = metadata !{metadata !13} -!13 = metadata !{metadata !"0x2e\00f\00f\00_ZN1A1fEv\006\000\001\000\006\00256\001\006", metadata !1, metadata !"_ZTS1A", metadata !9, null, i32 (%struct.A*)* @_ZN1A1fEv, null, metadata !8, metadata !14} ; [ DW_TAG_subprogram ] [line 6] [def] [f] -!14 = metadata !{metadata !15} -!15 = metadata !{metadata !"0x101\00this\0016777216\001088", metadata !13, null, metadata !16} ; [ DW_TAG_arg_variable ] [this] [line 0] -!16 = metadata !{metadata !"0xf\00\000\0064\0064\000\000", null, null, metadata !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS1A] -!17 = metadata !{i32 2, metadata !"Dwarf Version", i32 4} -!18 = metadata !{i32 2, metadata !"Debug Info Version", i32 2} -!19 = metadata !{metadata !"clang version 3.5.0 (210251)"} -!20 = metadata !{i32 0, i32 0, metadata !13, null} -!21 = metadata !{i32 7, i32 0, metadata !13, null} +!0 = !{!"0x11\004\00clang version 3.5.0 (210251)\001\00\000\00\001", !1, !2, !3, !12, !2, !2} ; [ DW_TAG_compile_unit ] [/code/llvm/build0/../1.cc] [DW_LANG_C_plus_plus] +!1 = !{!"../1.cc", !"/code/llvm/build0"} +!2 = !{} +!3 = !{!4} +!4 = !{!"0x13\00A\001\0032\0032\000\000\000", !1, null, null, !5, null, null, !"_ZTS1A"} ; [ DW_TAG_structure_type ] [A] [line 1, size 32, align 32, offset 0] [def] [from ] +!5 = !{!6, !8} +!6 = !{!"0xd\00x\003\0032\0032\000\000", !1, !"_ZTS1A", !7} ; [ DW_TAG_member ] [x] [line 3, size 32, align 32, offset 0] [from int] +!7 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] +!8 = !{!"0x2e\00f\00f\00_ZN1A1fEv\002\000\000\000\006\00256\001\002", !1, !"_ZTS1A", !9, null, null, null, i32 0, null} ; [ DW_TAG_subprogram ] [line 2] [f] +!9 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !10, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] +!10 = !{!7, !11} +!11 = !{!"0xf\00\000\0064\0064\000\001088", null, null, !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1A] +!12 = !{!13} +!13 = !{!"0x2e\00f\00f\00_ZN1A1fEv\006\000\001\000\006\00256\001\006", !1, !"_ZTS1A", !9, null, i32 (%struct.A*)* @_ZN1A1fEv, null, !8, !14} ; [ DW_TAG_subprogram ] [line 6] [def] [f] +!14 = !{!15} +!15 = !{!"0x101\00this\0016777216\001088", !13, null, !16} ; [ DW_TAG_arg_variable ] [this] [line 0] +!16 = !{!"0xf\00\000\0064\0064\000\000", null, null, !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS1A] +!17 = !{i32 2, !"Dwarf Version", i32 4} +!18 = !{i32 2, !"Debug Info Version", i32 2} +!19 = !{!"clang version 3.5.0 (210251)"} +!20 = !MDLocation(line: 0, scope: !13) +!21 = !MDLocation(line: 7, scope: !13) diff --git a/test/Instrumentation/SanitizerCoverage/coverage.ll b/test/Instrumentation/SanitizerCoverage/coverage.ll index da0498d..1595727 100644 --- a/test/Instrumentation/SanitizerCoverage/coverage.ll +++ b/test/Instrumentation/SanitizerCoverage/coverage.ll @@ -2,7 +2,7 @@ ; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -S | FileCheck %s --check-prefix=CHECK1 ; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -S | FileCheck %s --check-prefix=CHECK2 ; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-block-threshold=10 -S | FileCheck %s --check-prefix=CHECK2 -; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-block-threshold=1 -S | FileCheck %s --check-prefix=CHECK1 +; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-block-threshold=1 -S | FileCheck %s --check-prefix=CHECK_WITH_CHECK ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-block-threshold=10 -S | FileCheck %s --check-prefix=CHECK3 ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -S | FileCheck %s --check-prefix=CHECK4 @@ -12,7 +12,7 @@ ; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-block-threshold=10 \ ; RUN: -S | FileCheck %s --check-prefix=CHECK2 ; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-block-threshold=1 \ -; RUN: -S | FileCheck %s --check-prefix=CHECK1 +; RUN: -S | FileCheck %s --check-prefix=CHECK_WITH_CHECK 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" target triple = "x86_64-unknown-linux-gnu" @@ -29,33 +29,44 @@ entry: ret void } +; CHECK0-NOT: @llvm.global_ctors = {{.*}}{ i32 2, void ()* @sancov.module_ctor } +; CHECK1: @llvm.global_ctors = {{.*}}{ i32 2, void ()* @sancov.module_ctor } +; CHECK2: @llvm.global_ctors = {{.*}}{ i32 2, void ()* @sancov.module_ctor } + ; CHECK0-NOT: call void @__sanitizer_cov( ; CHECK0-NOT: call void @__sanitizer_cov_module_init( ; CHECK1-LABEL: define void @foo -; CHECK1: %0 = load atomic i8* @__sancov_gen_cov_foo monotonic, align 1 -; CHECK1: %1 = icmp eq i8 0, %0 +; CHECK1: %0 = load atomic i32* {{.*}} monotonic, align 4, !nosanitize +; CHECK1: %1 = icmp sge i32 0, %0 ; CHECK1: br i1 %1, label %2, label %3 -; CHECK1: call void @__sanitizer_cov +; CHECK1: call void @__sanitizer_cov(i32*{{.*}}) +; CHECK1: call void asm sideeffect "", ""() ; CHECK1-NOT: call void @__sanitizer_cov -; CHECK1: store atomic i8 1, i8* @__sancov_gen_cov_foo monotonic, align 1 +; CHECK1: ret void ; CHECK1-LABEL: define internal void @sancov.module_ctor ; CHECK1-NOT: ret -; CHECK1: call void @__sanitizer_cov_module_init(i64 2) +; CHECK1: call void @__sanitizer_cov_module_init({{.*}}, i64 2, ; CHECK1: ret +; CHECK_WITH_CHECK-LABEL: define void @foo +; CHECK_WITH_CHECK: __sanitizer_cov_with_check +; CHECK_WITH_CHECK: ret void ; CHECK2-LABEL: define void @foo ; CHECK2: call void @__sanitizer_cov +; CHECK2: call void asm sideeffect "", ""() ; CHECK2: call void @__sanitizer_cov +; CHECK2: call void asm sideeffect "", ""() ; CHECK2: call void @__sanitizer_cov +; CHECK2: call void asm sideeffect "", ""() ; CHECK2-NOT: call void @__sanitizer_cov ; CHECK2: ret void ; CHECK2-LABEL: define internal void @sancov.module_ctor ; CHECK2-NOT: ret -; CHECK2: call void @__sanitizer_cov_module_init(i64 4) +; CHECK2: call void @__sanitizer_cov_module_init({{.*}}, i64 4, ; CHECK2: ret ; CHECK3-LABEL: define void @foo diff --git a/test/Instrumentation/SanitizerCoverage/coverage2-dbg.ll b/test/Instrumentation/SanitizerCoverage/coverage2-dbg.ll index 9b26329..cb436a8 100644 --- a/test/Instrumentation/SanitizerCoverage/coverage2-dbg.ll +++ b/test/Instrumentation/SanitizerCoverage/coverage2-dbg.ll @@ -17,17 +17,17 @@ target triple = "x86_64-unknown-linux-gnu" ; Check that __sanitizer_cov call has !dgb pointing to the beginning ; of appropriate basic blocks. ; CHECK-LABEL:_Z3fooPi -; CHECK: call void @__sanitizer_cov(), !dbg [[A:!.*]] -; CHECK: call void @__sanitizer_cov(), !dbg [[B:!.*]] -; CHECK: call void @__sanitizer_cov(), !dbg [[C:!.*]] +; CHECK: call void @__sanitizer_cov(i32*{{.*}}), !dbg [[A:!.*]] +; CHECK: call void @__sanitizer_cov(i32*{{.*}}), !dbg [[B:!.*]] +; CHECK: call void @__sanitizer_cov(i32*{{.*}}), !dbg [[C:!.*]] ; CHECK: ret void -; CHECK: [[A]] = metadata !{i32 1, i32 0, metadata !{{.*}}, null} -; CHECK: [[B]] = metadata !{i32 3, i32 5, metadata !{{.*}}, null} -; CHECK: [[C]] = metadata !{i32 4, i32 1, metadata !{{.*}}, null} +; CHECK: [[A]] = !MDLocation(line: 1, scope: !{{.*}}) +; CHECK: [[B]] = !MDLocation(line: 3, column: 5, scope: !{{.*}}) +; CHECK: [[C]] = !MDLocation(line: 4, column: 1, scope: !{{.*}}) define void @_Z3fooPi(i32* %a) #0 { entry: - tail call void @llvm.dbg.value(metadata !{i32* %a}, i64 0, metadata !11, metadata !{metadata !"0x102"}), !dbg !15 + tail call void @llvm.dbg.value(metadata i32* %a, i64 0, metadata !11, metadata !{!"0x102"}), !dbg !15 %tobool = icmp eq i32* %a, null, !dbg !16 br i1 %tobool, label %if.end, label %if.then, !dbg !16 @@ -49,27 +49,27 @@ attributes #1 = { nounwind readnone } !llvm.module.flags = !{!12, !13} !llvm.ident = !{!14} -!0 = metadata !{metadata !"0x11\004\00clang version 3.6.0 (217079)\001\00\000\00\001", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [FOO/if.cc] [DW_LANG_C_plus_plus] -!1 = metadata !{metadata !"if.cc", metadata !"FOO"} -!2 = metadata !{} -!3 = metadata !{metadata !4} -!4 = metadata !{metadata !"0x2e\00foo\00foo\00_Z3fooPi\001\000\001\000\006\00256\001\001", metadata !1, metadata !5, metadata !6, null, void (i32*)* @_Z3fooPi, null, null, metadata !10} ; [ DW_TAG_subprogram ] [line 1] [def] [foo] -!5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] [FOO/if.cc] -!6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] -!7 = metadata !{null, metadata !8} -!8 = metadata !{metadata !"0xf\00\000\0064\0064\000\000", null, null, metadata !9} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int] -!9 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] -!10 = metadata !{metadata !11} -!11 = metadata !{metadata !"0x101\00a\0016777217\000", metadata !4, metadata !5, metadata !8} ; [ DW_TAG_arg_variable ] [a] [line 1] -!12 = metadata !{i32 2, metadata !"Dwarf Version", i32 4} -!13 = metadata !{i32 2, metadata !"Debug Info Version", i32 2} -!14 = metadata !{metadata !"clang version 3.6.0 (217079)"} -!15 = metadata !{i32 1, i32 15, metadata !4, null} -!16 = metadata !{i32 2, i32 7, metadata !17, null} -!17 = metadata !{metadata !"0xb\002\007\000", metadata !1, metadata !4} ; [ DW_TAG_lexical_block ] [FOO/if.cc] -!18 = metadata !{i32 3, i32 5, metadata !17, null} -!19 = metadata !{metadata !20, metadata !20, i64 0} -!20 = metadata !{metadata !"int", metadata !21, i64 0} -!21 = metadata !{metadata !"omnipotent char", metadata !22, i64 0} -!22 = metadata !{metadata !"Simple C/C++ TBAA"} -!23 = metadata !{i32 4, i32 1, metadata !4, null} +!0 = !{!"0x11\004\00clang version 3.6.0 (217079)\001\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [FOO/if.cc] [DW_LANG_C_plus_plus] +!1 = !{!"if.cc", !"FOO"} +!2 = !{} +!3 = !{!4} +!4 = !{!"0x2e\00foo\00foo\00_Z3fooPi\001\000\001\000\006\00256\001\001", !1, !5, !6, null, void (i32*)* @_Z3fooPi, null, null, !10} ; [ DW_TAG_subprogram ] [line 1] [def] [foo] +!5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [FOO/if.cc] +!6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] +!7 = !{null, !8} +!8 = !{!"0xf\00\000\0064\0064\000\000", null, null, !9} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int] +!9 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] +!10 = !{!11} +!11 = !{!"0x101\00a\0016777217\000", !4, !5, !8} ; [ DW_TAG_arg_variable ] [a] [line 1] +!12 = !{i32 2, !"Dwarf Version", i32 4} +!13 = !{i32 2, !"Debug Info Version", i32 2} +!14 = !{!"clang version 3.6.0 (217079)"} +!15 = !MDLocation(line: 1, column: 15, scope: !4) +!16 = !MDLocation(line: 2, column: 7, scope: !17) +!17 = !{!"0xb\002\007\000", !1, !4} ; [ DW_TAG_lexical_block ] [FOO/if.cc] +!18 = !MDLocation(line: 3, column: 5, scope: !17) +!19 = !{!20, !20, i64 0} +!20 = !{!"int", !21, i64 0} +!21 = !{!"omnipotent char", !22, i64 0} +!22 = !{!"Simple C/C++ TBAA"} +!23 = !MDLocation(line: 4, column: 1, scope: !4) diff --git a/test/Instrumentation/SanitizerCoverage/tracing.ll b/test/Instrumentation/SanitizerCoverage/tracing.ll index c39cb1c..8c3a6df 100644 --- a/test/Instrumentation/SanitizerCoverage/tracing.ll +++ b/test/Instrumentation/SanitizerCoverage/tracing.ll @@ -1,5 +1,5 @@ ; Test -sanitizer-coverage-experimental-tracing -; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-experimental-tracing -S | FileCheck %s --check-prefix=CHECK1 +; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-experimental-tracing -S | FileCheck %s --check-prefix=CHECK1 ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-experimental-tracing -S | FileCheck %s --check-prefix=CHECK3 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" |