summaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/sanitize-type-outlined.cpp
blob: 67e2f49e53d3489f49c86d744c8e70cbb85c9ed1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// REQUIRES: target=x86_64-linux-gnu

// RUN: %clang -S -fsanitize=type -emit-llvm -o - -fsanitize=type %s \
// RUN:     -fno-sanitize-type-outline-instrumentation \
// RUN:     | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE
// RUN: %clang -S -fsanitize=type -emit-llvm -o - -fsanitize=type %s \
// RUN:     -fsanitize-type-outline-instrumentation \
// RUN:     | FileCheck %s --check-prefixes=CHECK-OUTLINE

// CHECK-LABEL: @alias
// CHECK: __tysan_app_memory_mask
// CHECK: __tysan_shadow_memory_address
// CHECK-NO-OUTLINE-NOT: call{{.*}}@__tysan_instrument_mem_inst
// CHECK-NO-OUTLINE-NOT: call{{.*}}@__tysan_instrument_with_shadow_update
// CHECK-OUTLINE: call{{.*}}@__tysan_instrument_mem_inst
// CHECK-OUTLINE: call{{.*}}@__tysan_instrument_with_shadow_update

float alias(int *ptr){
    float *aliasedPtr = (float *)ptr;
    *aliasedPtr *= 2.0f;
    return *aliasedPtr;
}