[llvm-commits] [llvm] r148846 - in /llvm/trunk: lib/Transforms/Instrumentation/AddressSanitizer.cpp test/Instrumentation/AddressSanitizer/bug_11395.ll test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll test/Instrumentation/AddressSanitizer/test64.ll

Kostya Serebryany kcc at google.com
Tue Jan 24 11:34:43 PST 2012


Author: kcc
Date: Tue Jan 24 13:34:43 2012
New Revision: 148846

URL: http://llvm.org/viewvc/llvm-project?rev=148846&view=rev
Log:
[asan] enable asan only for the functions that have Attribute::AddressSafety

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
    llvm/trunk/test/Instrumentation/AddressSanitizer/bug_11395.ll
    llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll
    llvm/trunk/test/Instrumentation/AddressSanitizer/test64.ll

Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=148846&r1=148845&r2=148846&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Tue Jan 24 13:34:43 2012
@@ -608,6 +608,7 @@
 bool AddressSanitizer::handleFunction(Module &M, Function &F) {
   if (BL->isIn(F)) return false;
   if (&F == AsanCtorFunction) return false;
+  if (!F.hasFnAttr(Attribute::AddressSafety)) return false;
 
   if (!ClDebugFunc.empty() && ClDebugFunc != F.getName())
     return false;

Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/bug_11395.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/bug_11395.ll?rev=148846&r1=148845&r2=148846&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/bug_11395.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/bug_11395.ll Tue Jan 24 13:34:43 2012
@@ -36,14 +36,14 @@
 @ff_mlp_firorder_7 = external global i8
 @ff_mlp_firorder_8 = external global i8
 
-define void @ff_mlp_init_x86(%struct.DSPContext* nocapture %c, %struct.AVCodecContext* nocapture %avctx) nounwind {
+define void @ff_mlp_init_x86(%struct.DSPContext* nocapture %c, %struct.AVCodecContext* nocapture %avctx) nounwind address_safety {
 entry:
   %mlp_filter_channel = getelementptr inbounds %struct.DSPContext* %c, i32 0, i32 131
   store void (i32*, i32*, i32, i32, i32, i32, i32, i32*)* @mlp_filter_channel_x86, void (i32*, i32*, i32, i32, i32, i32, i32, i32*)** %mlp_filter_channel, align 4, !tbaa !0
   ret void
 }
 
-define internal void @mlp_filter_channel_x86(i32* %state, i32* %coeff, i32 %firorder, i32 %iirorder, i32 %filter_shift, i32 %mask, i32 %blocksize, i32* %sample_buffer) nounwind {
+define internal void @mlp_filter_channel_x86(i32* %state, i32* %coeff, i32 %firorder, i32 %iirorder, i32 %filter_shift, i32 %mask, i32 %blocksize, i32* %sample_buffer) nounwind address_safety {
 entry:
   %filter_shift.addr = alloca i32, align 4
   %mask.addr = alloca i32, align 4

Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll?rev=148846&r1=148845&r2=148846&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll Tue Jan 24 13:34:43 2012
@@ -4,7 +4,7 @@
 
 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 @IncrementMe(i32* %a) {
+define void @IncrementMe(i32* %a) address_safety {
 entry:
   %tmp1 = load i32* %a, align 4
   %tmp2 = add i32 %tmp1,  1

Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/test64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/test64.ll?rev=148846&r1=148845&r2=148846&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/test64.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/test64.ll Tue Jan 24 13:34:43 2012
@@ -1,7 +1,7 @@
 ; RUN: opt < %s -asan -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) {
+define i32 @read_4_bytes(i32* %a) address_safety {
 entry:
   %tmp1 = load i32* %a, align 4
   ret i32 %tmp1





More information about the llvm-commits mailing list