1 ; RUN: opt < %s -tsan -S | FileCheck %s
3 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 define i16 @test_unaligned_read2(i16* %a) sanitize_thread {
7 %tmp1 = load i16, i16* %a, align 1
11 ; CHECK-LABEL: define i16 @test_unaligned_read2(i16* %a)
12 ; CHECK: call void @__tsan_func_entry(i8* %0)
13 ; CHECK-NEXT: %1 = bitcast i16* %a to i8*
14 ; CHECK-NEXT: call void @__tsan_unaligned_read2(i8* %1)
15 ; CHECK-NEXT: %tmp1 = load i16, i16* %a, align 1
16 ; CHECK-NEXT: call void @__tsan_func_exit()
19 define i32 @test_unaligned_read4(i32* %a) sanitize_thread {
21 %tmp1 = load i32, i32* %a, align 2
25 ; CHECK-LABEL: define i32 @test_unaligned_read4(i32* %a)
26 ; CHECK: call void @__tsan_func_entry(i8* %0)
27 ; CHECK-NEXT: %1 = bitcast i32* %a to i8*
28 ; CHECK-NEXT: call void @__tsan_unaligned_read4(i8* %1)
29 ; CHECK-NEXT: %tmp1 = load i32, i32* %a, align 2
30 ; CHECK-NEXT: call void @__tsan_func_exit()
33 define i64 @test_unaligned_read8(i64* %a) sanitize_thread {
35 %tmp1 = load i64, i64* %a, align 4
39 ; CHECK-LABEL: define i64 @test_unaligned_read8(i64* %a)
40 ; CHECK: call void @__tsan_func_entry(i8* %0)
41 ; CHECK-NEXT: %1 = bitcast i64* %a to i8*
42 ; CHECK-NEXT: call void @__tsan_unaligned_read8(i8* %1)
43 ; CHECK-NEXT: %tmp1 = load i64, i64* %a, align 4
44 ; CHECK-NEXT: call void @__tsan_func_exit()
47 define i128 @test_unaligned_read16(i128* %a) sanitize_thread {
49 %tmp1 = load i128, i128* %a, align 1
53 ; CHECK-LABEL: define i128 @test_unaligned_read16(i128* %a)
54 ; CHECK: call void @__tsan_func_entry(i8* %0)
55 ; CHECK-NEXT: %1 = bitcast i128* %a to i8*
56 ; CHECK-NEXT: call void @__tsan_unaligned_read16(i8* %1)
57 ; CHECK-NEXT: %tmp1 = load i128, i128* %a, align 1
58 ; CHECK-NEXT: call void @__tsan_func_exit()
61 define i128 @test_aligned_read16(i128* %a) sanitize_thread {
63 %tmp1 = load i128, i128* %a, align 8
67 ; CHECK-LABEL: define i128 @test_aligned_read16(i128* %a)
68 ; CHECK: call void @__tsan_func_entry(i8* %0)
69 ; CHECK-NEXT: %1 = bitcast i128* %a to i8*
70 ; CHECK-NEXT: call void @__tsan_read16(i8* %1)
71 ; CHECK-NEXT: %tmp1 = load i128, i128* %a, align 8
72 ; CHECK-NEXT: call void @__tsan_func_exit()
75 define void @test_unaligned_write2(i16* %a) sanitize_thread {
77 store i16 1, i16* %a, align 1
81 ; CHECK-LABEL: define void @test_unaligned_write2(i16* %a)
82 ; CHECK: call void @__tsan_func_entry(i8* %0)
83 ; CHECK-NEXT: %1 = bitcast i16* %a to i8*
84 ; CHECK-NEXT: call void @__tsan_unaligned_write2(i8* %1)
85 ; CHECK-NEXT: store i16 1, i16* %a, align 1
86 ; CHECK-NEXT: call void @__tsan_func_exit()
89 define void @test_unaligned_write4(i32* %a) sanitize_thread {
91 store i32 1, i32* %a, align 1
95 ; CHECK-LABEL: define void @test_unaligned_write4(i32* %a)
96 ; CHECK: call void @__tsan_func_entry(i8* %0)
97 ; CHECK-NEXT: %1 = bitcast i32* %a to i8*
98 ; CHECK-NEXT: call void @__tsan_unaligned_write4(i8* %1)
99 ; CHECK-NEXT: store i32 1, i32* %a, align 1
100 ; CHECK-NEXT: call void @__tsan_func_exit()
103 define void @test_unaligned_write8(i64* %a) sanitize_thread {
105 store i64 1, i64* %a, align 1
109 ; CHECK-LABEL: define void @test_unaligned_write8(i64* %a)
110 ; CHECK: call void @__tsan_func_entry(i8* %0)
111 ; CHECK-NEXT: %1 = bitcast i64* %a to i8*
112 ; CHECK-NEXT: call void @__tsan_unaligned_write8(i8* %1)
113 ; CHECK-NEXT: store i64 1, i64* %a, align 1
114 ; CHECK-NEXT: call void @__tsan_func_exit()
117 define void @test_unaligned_write16(i128* %a) sanitize_thread {
119 store i128 1, i128* %a, align 1
123 ; CHECK-LABEL: define void @test_unaligned_write16(i128* %a)
124 ; CHECK: call void @__tsan_func_entry(i8* %0)
125 ; CHECK-NEXT: %1 = bitcast i128* %a to i8*
126 ; CHECK-NEXT: call void @__tsan_unaligned_write16(i8* %1)
127 ; CHECK-NEXT: store i128 1, i128* %a, align 1
128 ; CHECK-NEXT: call void @__tsan_func_exit()
131 define void @test_aligned_write16(i128* %a) sanitize_thread {
133 store i128 1, i128* %a, align 8
137 ; CHECK-LABEL: define void @test_aligned_write16(i128* %a)
138 ; CHECK: call void @__tsan_func_entry(i8* %0)
139 ; CHECK-NEXT: %1 = bitcast i128* %a to i8*
140 ; CHECK-NEXT: call void @__tsan_write16(i8* %1)
141 ; CHECK-NEXT: store i128 1, i128* %a, align 8
142 ; CHECK-NEXT: call void @__tsan_func_exit()