diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-06-09 19:06:30 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-06-09 19:06:30 +0000 |
commit | 85d8b2bbe386bcfe669575d05b61482d7be07e5d (patch) | |
tree | 1dc5e75ab222a9ead44c699eceafab7a6ca7b310 /test/Instrumentation | |
parent | 5a5ac124e1efaf208671f01c46edb15f29ed2a0b (diff) |
Vendor import of llvm trunk r239412:vendor/llvm/llvm-trunk-r239412
Notes
Notes:
svn path=/vendor/llvm/dist/; revision=284184
svn path=/vendor/llvm/llvm-trunk-r239412/; revision=284185; tag=vendor/llvm/llvm-trunk-r239412
Diffstat (limited to 'test/Instrumentation')
4 files changed, 35 insertions, 29 deletions
diff --git a/test/Instrumentation/AddressSanitizer/do-not-instrument-llvm-metadata-darwin.ll b/test/Instrumentation/AddressSanitizer/do-not-instrument-llvm-metadata-darwin.ll new file mode 100644 index 000000000000..7617dbde0b7e --- /dev/null +++ b/test/Instrumentation/AddressSanitizer/do-not-instrument-llvm-metadata-darwin.ll @@ -0,0 +1,12 @@ +; This test checks that we are not instrumenting globals in llvm.metadata. +; RUN: opt < %s -asan -asan-module -S | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.10.0" + +@.str_noinst = private unnamed_addr constant [4 x i8] c"aaa\00", section "llvm.metadata" +@.str_inst = private unnamed_addr constant [4 x i8] c"aaa\00" + +; CHECK-NOT: {{asan_gen.*str_noinst}} +; CHECK: {{asan_gen.*str_inst}} +; CHECK: @asan.module_ctor diff --git a/test/Instrumentation/AddressSanitizer/instrument-dynamic-allocas.ll b/test/Instrumentation/AddressSanitizer/instrument-dynamic-allocas.ll index 18a86a9b88f7..ceaf0e6fcfb6 100644 --- a/test/Instrumentation/AddressSanitizer/instrument-dynamic-allocas.ll +++ b/test/Instrumentation/AddressSanitizer/instrument-dynamic-allocas.ll @@ -2,17 +2,13 @@ ; -asan-instrument-allocas=1 ; RUN: opt < %s -asan -asan-module -asan-instrument-allocas=1 -S | FileCheck %s --check-prefix=CHECK-ALLOCA -; RUN: opt < %s -asan -asan-module -asan-instrument-allocas=0 -S | FileCheck %s --check-prefix=CHECK-NOALLOCA -; RUN: opt < %s -asan -asan-module -S | FileCheck %s --check-prefix=CHECK-NOALLOCA 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" define void @foo(i32 %len) sanitize_address { entry: -; CHECK-ALLOCA: store i32 -892679478 -; CHECK-ALLOCA: store i32 -875836469 -; CHECK-NOALLOCA-NOT: store i32 -892679478 -; CHECK-NOALLOCA-NOT: store i32 -875836469 +; CHECK-ALLOCA: __asan_alloca_poison +; CHECK-ALLOCA: __asan_allocas_unpoison %0 = alloca i32, align 4 %1 = alloca i8* store volatile i32 %len, i32* %0, align 4 diff --git a/test/Instrumentation/AddressSanitizer/undecidable-dynamic-alloca-1.ll b/test/Instrumentation/AddressSanitizer/undecidable-dynamic-alloca-1.ll deleted file mode 100644 index c67fb5014630..000000000000 --- a/test/Instrumentation/AddressSanitizer/undecidable-dynamic-alloca-1.ll +++ /dev/null @@ -1,23 +0,0 @@ -; Test that undecidable dynamic allocas are skipped by ASan. - -; RUN: opt < %s -asan -asan-module -asan-instrument-allocas=1 -S | FileCheck %s -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" - -define void @g(i64 %n) sanitize_address { -entry: - %cmp = icmp sgt i64 %n, 100 - br i1 %cmp, label %do_alloca, label %done - -do_alloca: -; CHECK-NOT: store i32 -892679478 - %0 = alloca i8, i64 %n, align 1 - call void @f(i8* %0) - br label %done - -done: - ret void -} - -declare void @f(i8*) - diff --git a/test/Instrumentation/InstrProfiling/PR23499.ll b/test/Instrumentation/InstrProfiling/PR23499.ll new file mode 100644 index 000000000000..5aae735120be --- /dev/null +++ b/test/Instrumentation/InstrProfiling/PR23499.ll @@ -0,0 +1,21 @@ +;; Check that data associated with linkonce odr functions are placed in +;; the same comdat section as their associated function. + +; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -instrprof -S | FileCheck %s +; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck %s + +$_Z3barIvEvv = comdat any + +@__llvm_profile_name__Z3barIvEvv = linkonce_odr hidden constant [11 x i8] c"_Z3barIvEvv", align 1 + +; CHECK: @__llvm_profile_name__Z3barIvEvv = linkonce_odr hidden constant [11 x i8] c"_Z3barIvEvv", section "{{.*}}__llvm_prf_names", comdat($_Z3barIvEvv), align 1 +; CHECK: @__llvm_profile_counters__Z3barIvEvv = linkonce_odr hidden global [1 x i64] zeroinitializer, section "{{.*}}__llvm_prf_cnts", comdat($_Z3barIvEvv), align 8 +; CHECK: @__llvm_profile_data__Z3barIvEvv = linkonce_odr hidden constant { i32, i32, i64, i8*, i64* } { i32 11, i32 1, i64 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__llvm_profile_name__Z3barIvEvv, i32 0, i32 0), i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_profile_counters__Z3barIvEvv, i32 0, i32 0) }, section "{{.*}}__llvm_prf_data", comdat($_Z3barIvEvv), align 8 + +declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #1 + +define linkonce_odr void @_Z3barIvEvv() comdat { +entry: + call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__llvm_profile_name__Z3barIvEvv, i32 0, i32 0), i64 0, i32 1, i32 0) + ret void +} |