1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt < %s -passes='module(sanmd-module)' -sanitizer-metadata-atomics -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-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 @__profc_test_gep = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
8 @__profc_test_bitcast = private global [2 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
9 @__profc_test_bitcast_foo = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
11 @__llvm_gcov_ctr = internal global [1 x i64] zeroinitializer
12 @__llvm_gcov_ctr.1 = internal global [1 x i64] zeroinitializer
13 @__llvm_gcov_global_state_pred = internal global i32 0
14 @__llvm_gcda_foo = internal global i32 0
16 define i32 @test_gep() {
17 ; CHECK-LABEL: define {{[^@]+}}@test_gep() !pcsections !0 {
19 ; CHECK-NEXT: [[PGOCOUNT:%.*]] = load i64, ptr @__profc_test_gep, align 8, !pcsections !2
20 ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[PGOCOUNT]], 1
21 ; CHECK-NEXT: store i64 [[TMP0]], ptr @__profc_test_gep, align 8, !pcsections !2
22 ; CHECK-NEXT: [[GCOVCOUNT:%.*]] = load i64, ptr @__llvm_gcov_ctr, align 8, !pcsections !2
23 ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[GCOVCOUNT]], 1
24 ; CHECK-NEXT: store i64 [[TMP1]], ptr @__llvm_gcov_ctr, align 8, !pcsections !2
25 ; CHECK-NEXT: [[GCOVCOUNT_1:%.*]] = load i64, ptr @__llvm_gcov_ctr.1, align 8, !pcsections !2
26 ; CHECK-NEXT: [[TMP2:%.*]] = add i64 [[GCOVCOUNT_1]], 1
27 ; CHECK-NEXT: store i64 [[TMP2]], ptr @__llvm_gcov_ctr.1, align 8, !pcsections !2
28 ; CHECK-NEXT: ret i32 1
31 %pgocount = load i64, ptr @__profc_test_gep
32 %0 = add i64 %pgocount, 1
33 store i64 %0, ptr @__profc_test_gep
35 %gcovcount = load i64, ptr @__llvm_gcov_ctr
36 %1 = add i64 %gcovcount, 1
37 store i64 %1, ptr @__llvm_gcov_ctr
39 %gcovcount.1 = load i64, ptr @__llvm_gcov_ctr.1
40 %2 = add i64 %gcovcount.1, 1
41 store i64 %2, ptr @__llvm_gcov_ctr.1
46 define i32 @test_bitcast() {
47 ; CHECK-LABEL: define {{[^@]+}}@test_bitcast() !pcsections !0 {
49 ; CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr @__profc_test_bitcast, align 8, !pcsections !2
50 ; CHECK-NEXT: [[DOTPROMOTED5:%.*]] = load i64, ptr @__profc_test_bitcast_foo, align 8, !pcsections !2
51 ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[DOTPROMOTED5]], 10
52 ; CHECK-NEXT: [[TMP2:%.*]] = add <2 x i64> [[TMP0]], <i64 1, i64 10>
53 ; CHECK-NEXT: store <2 x i64> [[TMP2]], ptr @__profc_test_bitcast, align 8, !pcsections !2
54 ; CHECK-NEXT: store i64 [[TMP1]], ptr @__profc_test_bitcast_foo, align 8, !pcsections !2
55 ; CHECK-NEXT: ret i32 undef
58 %0 = load <2 x i64>, ptr @__profc_test_bitcast, align 8
59 %.promoted5 = load i64, ptr @__profc_test_bitcast_foo, align 8
60 %1 = add i64 %.promoted5, 10
61 %2 = add <2 x i64> %0, <i64 1, i64 10>
62 store <2 x i64> %2, ptr @__profc_test_bitcast, align 8
63 store i64 %1, ptr @__profc_test_bitcast_foo, align 8
67 define void @test_load() {
68 ; CHECK-LABEL: define {{[^@]+}}@test_load() !pcsections !0 {
70 ; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @__llvm_gcov_global_state_pred, align 4, !pcsections !2
71 ; CHECK-NEXT: store i32 1, ptr @__llvm_gcov_global_state_pred, align 4, !pcsections !2
72 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr @__llvm_gcda_foo, align 4, !pcsections !2
73 ; CHECK-NEXT: store i32 1, ptr @__llvm_gcda_foo, align 4, !pcsections !2
74 ; CHECK-NEXT: ret void
77 %0 = load i32, ptr @__llvm_gcov_global_state_pred
78 store i32 1, ptr @__llvm_gcov_global_state_pred
80 %1 = load i32, ptr @__llvm_gcda_foo
81 store i32 1, ptr @__llvm_gcda_foo