[ASan] Add -asan-module to the ASan .ll tests.
authorAlexander Potapenko <glider@google.com>
Thu, 20 Mar 2014 11:16:34 +0000 (11:16 +0000)
committerAlexander Potapenko <glider@google.com>
Thu, 20 Mar 2014 11:16:34 +0000 (11:16 +0000)
After the -asan pass had been split into -asan (function-level) and -asan-module (module-level) some of the
tests have silently stopped working, because they didn't instrument the globals anymore.
We've decided to have every test using both passes, irrespective of the presence of globals in it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204335 91177308-0d34-0410-b5e6-96231b3b80d8

16 files changed:
test/Instrumentation/AddressSanitizer/X86/bug_11395.ll
test/Instrumentation/AddressSanitizer/asan-vs-gvn.ll
test/Instrumentation/AddressSanitizer/basic.ll
test/Instrumentation/AddressSanitizer/coverage.ll
test/Instrumentation/AddressSanitizer/do-not-instrument-internal-globals.ll
test/Instrumentation/AddressSanitizer/do-not-touch-odr-global.ll
test/Instrumentation/AddressSanitizer/do-not-touch-threadlocal.ll
test/Instrumentation/AddressSanitizer/freebsd.ll
test/Instrumentation/AddressSanitizer/instrument-no-return.ll
test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll
test/Instrumentation/AddressSanitizer/keep-instrumented_functions.ll
test/Instrumentation/AddressSanitizer/lifetime-uar.ll
test/Instrumentation/AddressSanitizer/lifetime.ll
test/Instrumentation/AddressSanitizer/stack-poisoning.ll
test/Instrumentation/AddressSanitizer/stack_layout.ll
test/Instrumentation/AddressSanitizer/test64.ll

index 2c4d82eb1ae788a712b23c16c7529bfc4ee52226..63477aacd8f85fe9cc1537f0af7c7c9574cc69c5 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -asan -S | llc -o /dev/null
+; RUN: opt < %s -asan -asan-module -S | llc -o /dev/null
 ; The bug manifests as a reg alloc failure:
 ; error: ran out of registers during register allocation
 ; ModuleID = 'z.o'
index 1087c9a58ff3df11207725bf1505f5f204d01322..75adf4061c0db2d27eb3c6bd09fe7cd8e13363d2 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -basicaa -gvn -asan -S | FileCheck %s
+; RUN: opt < %s -basicaa -gvn -asan -asan-module -S | FileCheck %s
 ; ASAN conflicts with load widening iff the widened load accesses data out of bounds
 ; (while the original unwidened loads do not).
 ; http://code.google.com/p/address-sanitizer/issues/detail?id=20#c1
index fb32e704af86cefa96309a2ded9c6c85ecc54aa1..4863a3dea96796541e638e4198a64ecbf2706ae6 100644 (file)
@@ -1,6 +1,6 @@
 ; Test basic address sanitizer instrumentation.
 ;
-; RUN: opt < %s -asan -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -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"
index 6697f4b0f24aa93c7bfadbdc5897abf3704af068..06701325db825c468c081d0c3f1eda9ca138247a 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: opt < %s -asan -asan-coverage=1 -S | FileCheck %s --check-prefix=CHECK1
-; RUN: opt < %s -asan -asan-coverage=2 -S | FileCheck %s --check-prefix=CHECK2
+; RUN: opt < %s -asan -asan-module -asan-coverage=1 -S | FileCheck %s --check-prefix=CHECK1
+; RUN: opt < %s -asan -asan-module -asan-coverage=2 -S | FileCheck %s --check-prefix=CHECK2
 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* %a) sanitize_address {
index 0928c494154ef44918a03810546f2496487f4e75..cff83ab718bbba4933f4f4728a15090eedb4ba7a 100644 (file)
@@ -1,6 +1,6 @@
 ; This test checks that we are not instrumenting globals
 ; that we created ourselves.
-; RUN: opt < %s -asan -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -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-S128"
 target triple = "x86_64-unknown-linux-gnu"
index 1687877849c45b995da99b31c4015b605678403e..97752612297d94e65adcfaf8b6977f43931c7935 100644 (file)
@@ -1,6 +1,11 @@
-; RUN: opt < %s -asan -S | FileCheck %s
+; This test checks that we instrument regular globals, but do not touch
+; the linkonce_odr ones.
+; RUN: opt < %s -asan -asan-module -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"
 ; no action should be taken for these globals
-@v1 = linkonce_odr constant i8 1
-; CHECK-NOT: __asan_register_globals
+@global_noinst = linkonce_odr constant [2 x i8] [i8 1, i8 2]
+@global_inst = private constant [2 x i8] [i8 1, i8 2]
+; CHECK-NOT: {{asan_gen.*global_noinst}}
+; CHECK: {{asan_gen.*global_inst}}
+; CHECK: @asan.module_ctor
index 89644d4a943f948f7a9df039182b55a78d6b35b1..f863f44d512567b300ce6292611d2c12389c5bb0 100644 (file)
@@ -1,6 +1,6 @@
-; RUN: opt < %s -asan -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -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"
 ; no action should be taken for thread locals
 @xxx = thread_local global i32 0, align 4
-; CHECK-NOT: __asan_register_globals
+; CHECK-NOT: {{call.*__asan_register_globals}}
index 26fee787d9aed3d441f20e42bdd1cb69eee9b190..359529fc8fcd68c29b454337d7bd824411c14131 100644 (file)
@@ -1,9 +1,9 @@
-; RUN: opt < %s -asan -S \
+; RUN: opt < %s -asan -asan-module -S \
 ; RUN:     -mtriple=i386-unknown-freebsd \
 ; RUN:     -default-data-layout="e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128" | \
 ; RUN:     FileCheck --check-prefix=CHECK-32 %s
 
-; RUN: opt < %s -asan -S \
+; RUN: opt < %s -asan -asan-module -S \
 ; RUN:     -mtriple=x86_64-unknown-freebsd \
 ; RUN:     -default-data-layout="e-m:e-i64:64-f80:128-n8:16:32:64-S128" | \
 ; RUN:     FileCheck --check-prefix=CHECK-64 %s
index 2d835a34080a1959ab70bb5e6623036ea6e625a9..5d5c592c3f4d7cdfc5d2b126f25a6e2a8b65a0c5 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -asan -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -S | FileCheck %s
 ; AddressSanitizer must insert __asan_handle_no_return
 ; before every noreturn call or invoke.
 
index 23cf6d28ec6cd2409c6f0e038292f09fb17b6031..195785ff5e3b9b35fc296375b9e18d05a28e1e06 100644 (file)
@@ -1,6 +1,6 @@
 ; Test that AddressSanitizer instruments "(*a)++" only once.
-; RUN: opt < %s -asan -S -asan-opt=1 | FileCheck %s -check-prefix=OPT1
-; RUN: opt < %s -asan -S -asan-opt=0 | FileCheck %s -check-prefix=OPT0
+; RUN: opt < %s -asan -asan-module -S -asan-opt=1 | FileCheck %s -check-prefix=OPT1
+; RUN: opt < %s -asan -asan-module -S -asan-opt=0 | FileCheck %s -check-prefix=OPT0
 
 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"
index ff3bbb047fff54a1803c651cc278702869b4edab..8726b8e5f9c9c2ceb26a2fbde5d0a8703a10a191 100644 (file)
@@ -1,5 +1,5 @@
 ; Test the -asan-keep-uninstrumented-functions flag: FOO should get cloned
-; RUN: opt < %s -asan -asan-keep-uninstrumented-functions -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -asan-keep-uninstrumented-functions -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-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
index 21eaf7f15412995957233ed6dc3a618f5d5b8779..25577de445bef758cf89039f00b38dd25c028eda 100644 (file)
@@ -1,5 +1,5 @@
 ; Test handling of llvm.lifetime intrinsics in UAR mode.
-; RUN: opt < %s -asan -asan-use-after-return -asan-check-lifetime -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -asan-use-after-return -asan-check-lifetime -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-S128"
 
index d80331e38723ecc79a4c15b05b5099b2597ef4fd..1961997dc014c5477ed9caab96ecdb895729e637 100644 (file)
@@ -1,5 +1,5 @@
 ; Test hanlding of llvm.lifetime intrinsics.
-; RUN: opt < %s -asan -asan-check-lifetime -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -asan-check-lifetime -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-S128"
 target triple = "x86_64-unknown-linux-gnu"
index 2d69879925bbe47a30218d23dcb4987dbf970516..6919e5353f208aca87682bcc31d32ac8916cd04f 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: opt < %s -asan -asan-use-after-return -S | FileCheck --check-prefix=CHECK-UAR %s
-; RUN: opt < %s -asan  -S | FileCheck --check-prefix=CHECK-PLAIN %s
+; RUN: opt < %s -asan -asan-module -asan-use-after-return -S | FileCheck --check-prefix=CHECK-UAR %s
+; RUN: opt < %s -asan -asan-module -S | FileCheck --check-prefix=CHECK-PLAIN %s
 target datalayout = "e-i64:64-f80:128-s:64-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
index 6fa3cfc9df2b46b4619f0774c9a12cd04d55e8be..c027acf3e4fd6b598d219357f098a0726035a9c7 100644 (file)
@@ -1,6 +1,6 @@
 ; Test the ASan's stack layout.
 ; More tests in tests/Transforms/Utils/ASanStackFrameLayoutTest.cpp
-; RUN: opt < %s -asan -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -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-S128"
 target triple = "x86_64-unknown-linux-gnu"
index 6390644422ca486b5f1c893b64c14d39a59d1d63..4f3ed5b478c9cd92538bceacb3ae03a43259d724 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -asan -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -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 i32 @read_4_bytes(i32* %a) sanitize_address {