1 ; RUN: opt < %s -passes=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(ptr %a) sanitize_thread {
7 %tmp1 = load i16, ptr %a, align 1
11 ; CHECK-LABEL: define i16 @test_unaligned_read2(ptr %a)
12 ; CHECK: call void @__tsan_func_entry(ptr %0)
13 ; CHECK-NEXT: call void @__tsan_unaligned_read2(ptr %a)
14 ; CHECK-NEXT: %tmp1 = load i16, ptr %a, align 1
15 ; CHECK-NEXT: call void @__tsan_func_exit()
18 define i32 @test_unaligned_read4(ptr %a) sanitize_thread {
20 %tmp1 = load i32, ptr %a, align 2
24 ; CHECK-LABEL: define i32 @test_unaligned_read4(ptr %a)
25 ; CHECK: call void @__tsan_func_entry(ptr %0)
26 ; CHECK-NEXT: call void @__tsan_unaligned_read4(ptr %a)
27 ; CHECK-NEXT: %tmp1 = load i32, ptr %a, align 2
28 ; CHECK-NEXT: call void @__tsan_func_exit()
31 define i64 @test_unaligned_read8(ptr %a) sanitize_thread {
33 %tmp1 = load i64, ptr %a, align 4
37 ; CHECK-LABEL: define i64 @test_unaligned_read8(ptr %a)
38 ; CHECK: call void @__tsan_func_entry(ptr %0)
39 ; CHECK-NEXT: call void @__tsan_unaligned_read8(ptr %a)
40 ; CHECK-NEXT: %tmp1 = load i64, ptr %a, align 4
41 ; CHECK-NEXT: call void @__tsan_func_exit()
44 define i128 @test_unaligned_read16(ptr %a) sanitize_thread {
46 %tmp1 = load i128, ptr %a, align 1
50 ; CHECK-LABEL: define i128 @test_unaligned_read16(ptr %a)
51 ; CHECK: call void @__tsan_func_entry(ptr %0)
52 ; CHECK-NEXT: call void @__tsan_unaligned_read16(ptr %a)
53 ; CHECK-NEXT: %tmp1 = load i128, ptr %a, align 1
54 ; CHECK-NEXT: call void @__tsan_func_exit()
57 define i128 @test_aligned_read16(ptr %a) sanitize_thread {
59 %tmp1 = load i128, ptr %a, align 8
63 ; CHECK-LABEL: define i128 @test_aligned_read16(ptr %a)
64 ; CHECK: call void @__tsan_func_entry(ptr %0)
65 ; CHECK-NEXT: call void @__tsan_read16(ptr %a)
66 ; CHECK-NEXT: %tmp1 = load i128, ptr %a, align 8
67 ; CHECK-NEXT: call void @__tsan_func_exit()
70 define void @test_unaligned_write2(ptr %a) sanitize_thread {
72 store i16 1, ptr %a, align 1
76 ; CHECK-LABEL: define void @test_unaligned_write2(ptr %a)
77 ; CHECK: call void @__tsan_func_entry(ptr %0)
78 ; CHECK-NEXT: call void @__tsan_unaligned_write2(ptr %a)
79 ; CHECK-NEXT: store i16 1, ptr %a, align 1
80 ; CHECK-NEXT: call void @__tsan_func_exit()
83 define void @test_unaligned_write4(ptr %a) sanitize_thread {
85 store i32 1, ptr %a, align 1
89 ; CHECK-LABEL: define void @test_unaligned_write4(ptr %a)
90 ; CHECK: call void @__tsan_func_entry(ptr %0)
91 ; CHECK-NEXT: call void @__tsan_unaligned_write4(ptr %a)
92 ; CHECK-NEXT: store i32 1, ptr %a, align 1
93 ; CHECK-NEXT: call void @__tsan_func_exit()
96 define void @test_unaligned_write8(ptr %a) sanitize_thread {
98 store i64 1, ptr %a, align 1
102 ; CHECK-LABEL: define void @test_unaligned_write8(ptr %a)
103 ; CHECK: call void @__tsan_func_entry(ptr %0)
104 ; CHECK-NEXT: call void @__tsan_unaligned_write8(ptr %a)
105 ; CHECK-NEXT: store i64 1, ptr %a, align 1
106 ; CHECK-NEXT: call void @__tsan_func_exit()
109 define void @test_unaligned_write16(ptr %a) sanitize_thread {
111 store i128 1, ptr %a, align 1
115 ; CHECK-LABEL: define void @test_unaligned_write16(ptr %a)
116 ; CHECK: call void @__tsan_func_entry(ptr %0)
117 ; CHECK-NEXT: call void @__tsan_unaligned_write16(ptr %a)
118 ; CHECK-NEXT: store i128 1, ptr %a, align 1
119 ; CHECK-NEXT: call void @__tsan_func_exit()
122 define void @test_aligned_write16(ptr %a) sanitize_thread {
124 store i128 1, ptr %a, align 8
128 ; CHECK-LABEL: define void @test_aligned_write16(ptr %a)
129 ; CHECK: call void @__tsan_func_entry(ptr %0)
130 ; CHECK-NEXT: call void @__tsan_write16(ptr %a)
131 ; CHECK-NEXT: store i128 1, ptr %a, align 8
132 ; CHECK-NEXT: call void @__tsan_func_exit()