| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature |
| ; RUN: opt < %s -passes='module(sanmd-module)' -sanitizer-metadata-atomics -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" |
| |
| @__profc_test_gep = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8 |
| @__profc_test_bitcast = private global [2 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8 |
| @__profc_test_bitcast_foo = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8 |
| |
| @__llvm_gcov_ctr = internal global [1 x i64] zeroinitializer |
| @__llvm_gcov_ctr.1 = internal global [1 x i64] zeroinitializer |
| @__llvm_gcov_global_state_pred = internal global i32 0 |
| @__llvm_gcda_foo = internal global i32 0 |
| |
| define i32 @test_gep() { |
| ; CHECK-LABEL: define {{[^@]+}}@test_gep() !pcsections !0 { |
| ; CHECK-NEXT: entry: |
| ; CHECK-NEXT: [[PGOCOUNT:%.*]] = load i64, ptr @__profc_test_gep, align 8, !pcsections !2 |
| ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[PGOCOUNT]], 1 |
| ; CHECK-NEXT: store i64 [[TMP0]], ptr @__profc_test_gep, align 8, !pcsections !2 |
| ; CHECK-NEXT: [[GCOVCOUNT:%.*]] = load i64, ptr @__llvm_gcov_ctr, align 8, !pcsections !2 |
| ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[GCOVCOUNT]], 1 |
| ; CHECK-NEXT: store i64 [[TMP1]], ptr @__llvm_gcov_ctr, align 8, !pcsections !2 |
| ; CHECK-NEXT: [[GCOVCOUNT_1:%.*]] = load i64, ptr @__llvm_gcov_ctr.1, align 8, !pcsections !2 |
| ; CHECK-NEXT: [[TMP2:%.*]] = add i64 [[GCOVCOUNT_1]], 1 |
| ; CHECK-NEXT: store i64 [[TMP2]], ptr @__llvm_gcov_ctr.1, align 8, !pcsections !2 |
| ; CHECK-NEXT: ret i32 1 |
| ; |
| entry: |
| %pgocount = load i64, ptr @__profc_test_gep |
| %0 = add i64 %pgocount, 1 |
| store i64 %0, ptr @__profc_test_gep |
| |
| %gcovcount = load i64, ptr @__llvm_gcov_ctr |
| %1 = add i64 %gcovcount, 1 |
| store i64 %1, ptr @__llvm_gcov_ctr |
| |
| %gcovcount.1 = load i64, ptr @__llvm_gcov_ctr.1 |
| %2 = add i64 %gcovcount.1, 1 |
| store i64 %2, ptr @__llvm_gcov_ctr.1 |
| |
| ret i32 1 |
| } |
| |
| define i32 @test_bitcast() { |
| ; CHECK-LABEL: define {{[^@]+}}@test_bitcast() !pcsections !0 { |
| ; CHECK-NEXT: entry: |
| ; CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr @__profc_test_bitcast, align 8, !pcsections !2 |
| ; CHECK-NEXT: [[DOTPROMOTED5:%.*]] = load i64, ptr @__profc_test_bitcast_foo, align 8, !pcsections !2 |
| ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[DOTPROMOTED5]], 10 |
| ; CHECK-NEXT: [[TMP2:%.*]] = add <2 x i64> [[TMP0]], <i64 1, i64 10> |
| ; CHECK-NEXT: store <2 x i64> [[TMP2]], ptr @__profc_test_bitcast, align 8, !pcsections !2 |
| ; CHECK-NEXT: store i64 [[TMP1]], ptr @__profc_test_bitcast_foo, align 8, !pcsections !2 |
| ; CHECK-NEXT: ret i32 undef |
| ; |
| entry: |
| %0 = load <2 x i64>, ptr @__profc_test_bitcast, align 8 |
| %.promoted5 = load i64, ptr @__profc_test_bitcast_foo, align 8 |
| %1 = add i64 %.promoted5, 10 |
| %2 = add <2 x i64> %0, <i64 1, i64 10> |
| store <2 x i64> %2, ptr @__profc_test_bitcast, align 8 |
| store i64 %1, ptr @__profc_test_bitcast_foo, align 8 |
| ret i32 undef |
| } |
| |
| define void @test_load() { |
| ; CHECK-LABEL: define {{[^@]+}}@test_load() !pcsections !0 { |
| ; CHECK-NEXT: entry: |
| ; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @__llvm_gcov_global_state_pred, align 4, !pcsections !2 |
| ; CHECK-NEXT: store i32 1, ptr @__llvm_gcov_global_state_pred, align 4, !pcsections !2 |
| ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr @__llvm_gcda_foo, align 4, !pcsections !2 |
| ; CHECK-NEXT: store i32 1, ptr @__llvm_gcda_foo, align 4, !pcsections !2 |
| ; CHECK-NEXT: ret void |
| ; |
| entry: |
| %0 = load i32, ptr @__llvm_gcov_global_state_pred |
| store i32 1, ptr @__llvm_gcov_global_state_pred |
| |
| %1 = load i32, ptr @__llvm_gcda_foo |
| store i32 1, ptr @__llvm_gcda_foo |
| |
| ret void |
| } |