Home | History | Annotate | Download | only in AddressSanitizer
      1 ; Test optimization experiments.
      2 ; -asan-force-experiment flag turns all memory accesses into experiments.
      3 ; RUN: opt < %s -asan -asan-module -asan-force-experiment=42 -asan-instrumentation-with-call-threshold=0 -S | FileCheck %s
      4 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"
      5 target triple = "x86_64-unknown-linux-gnu"
      6 
      7 define void @load1(i8* %p) sanitize_address {
      8 entry:
      9   %t = load i8, i8* %p, align 1
     10   ret void
     11 ; CHECK-LABEL: define void @load1
     12 ; CHECK: __asan_exp_load1{{.*}} i32 42
     13 ; CHECK: ret void
     14 }
     15 
     16 define void @load2(i16* %p) sanitize_address {
     17 entry:
     18   %t = load i16, i16* %p, align 2
     19   ret void
     20 ; CHECK-LABEL: define void @load2
     21 ; CHECK: __asan_exp_load2{{.*}} i32 42
     22 ; CHECK: ret void
     23 }
     24 
     25 define void @load4(i32* %p) sanitize_address {
     26 entry:
     27   %t = load i32, i32* %p, align 4
     28   ret void
     29 ; CHECK-LABEL: define void @load4
     30 ; CHECK: __asan_exp_load4{{.*}} i32 42
     31 ; CHECK: ret void
     32 }
     33 
     34 define void @load8(i64* %p) sanitize_address {
     35 entry:
     36   %t = load i64, i64* %p, align 8
     37   ret void
     38 ; CHECK-LABEL: define void @load8
     39 ; CHECK: __asan_exp_load8{{.*}} i32 42
     40 ; CHECK: ret void
     41 }
     42 
     43 define void @load16(i128* %p) sanitize_address {
     44 entry:
     45   %t = load i128, i128* %p, align 16
     46   ret void
     47 ; CHECK-LABEL: define void @load16
     48 ; CHECK: __asan_exp_load16{{.*}} i32 42
     49 ; CHECK: ret void
     50 }
     51 
     52 define void @loadN(i48* %p) sanitize_address {
     53 entry:
     54   %t = load i48, i48* %p, align 1
     55   ret void
     56 ; CHECK-LABEL: define void @loadN
     57 ; CHECK: __asan_exp_loadN{{.*}} i32 42
     58 ; CHECK: ret void
     59 }
     60 
     61 define void @store1(i8* %p) sanitize_address {
     62 entry:
     63   store i8 1, i8* %p, align 1
     64   ret void
     65 ; CHECK-LABEL: define void @store1
     66 ; CHECK: __asan_exp_store1{{.*}} i32 42
     67 ; CHECK: ret void
     68 }
     69 
     70 define void @store2(i16* %p) sanitize_address {
     71 entry:
     72   store i16 1, i16* %p, align 2
     73   ret void
     74 ; CHECK-LABEL: define void @store2
     75 ; CHECK: __asan_exp_store2{{.*}} i32 42
     76 ; CHECK: ret void
     77 }
     78 
     79 define void @store4(i32* %p) sanitize_address {
     80 entry:
     81   store i32 1, i32* %p, align 4
     82   ret void
     83 ; CHECK-LABEL: define void @store4
     84 ; CHECK: __asan_exp_store4{{.*}} i32 42
     85 ; CHECK: ret void
     86 }
     87 
     88 define void @store8(i64* %p) sanitize_address {
     89 entry:
     90   store i64 1, i64* %p, align 8
     91   ret void
     92 ; CHECK-LABEL: define void @store8
     93 ; CHECK: __asan_exp_store8{{.*}} i32 42
     94 ; CHECK: ret void
     95 }
     96 
     97 define void @store16(i128* %p) sanitize_address {
     98 entry:
     99   store i128 1, i128* %p, align 16
    100   ret void
    101 ; CHECK-LABEL: define void @store16
    102 ; CHECK: __asan_exp_store16{{.*}} i32 42
    103 ; CHECK: ret void
    104 }
    105 
    106 define void @storeN(i48* %p) sanitize_address {
    107 entry:
    108   store i48 1, i48* %p, align 1
    109   ret void
    110 ; CHECK-LABEL: define void @storeN
    111 ; CHECK: __asan_exp_storeN{{.*}} i32 42
    112 ; CHECK: ret void
    113 }
    114