aboutsummaryrefslogtreecommitdiff
path: root/test/Instrumentation/ThreadSanitizer/atomic.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Instrumentation/ThreadSanitizer/atomic.ll')
-rw-r--r--test/Instrumentation/ThreadSanitizer/atomic.ll43
1 files changed, 42 insertions, 1 deletions
diff --git a/test/Instrumentation/ThreadSanitizer/atomic.ll b/test/Instrumentation/ThreadSanitizer/atomic.ll
index a10ca6c91a89..30c58fea4cb7 100644
--- a/test/Instrumentation/ThreadSanitizer/atomic.ll
+++ b/test/Instrumentation/ThreadSanitizer/atomic.ll
@@ -1186,6 +1186,16 @@ entry:
; CHECK-LABEL: atomic64_load_seq_cst
; CHECK: call i64 @__tsan_atomic64_load(i64* %a, i32 5), !dbg
+define i8* @atomic64_load_seq_cst_ptr_ty(i8** %a) nounwind uwtable {
+entry:
+ %0 = load atomic i8*, i8** %a seq_cst, align 8, !dbg !7
+ ret i8* %0, !dbg !7
+}
+; CHECK-LABEL: atomic64_load_seq_cst
+; CHECK: bitcast i8** %{{.+}} to i64*
+; CHECK-NEXT: call i64 @__tsan_atomic64_load(i64* %{{.+}}, i32 5), !dbg
+; CHECK-NEXT: inttoptr i64 %{{.+}} to i8*
+
define void @atomic64_store_unordered(i64* %a) nounwind uwtable {
entry:
store atomic i64 0, i64* %a unordered, align 8, !dbg !7
@@ -1218,6 +1228,16 @@ entry:
; CHECK-LABEL: atomic64_store_seq_cst
; CHECK: call void @__tsan_atomic64_store(i64* %a, i64 0, i32 5), !dbg
+define void @atomic64_store_seq_cst_ptr_ty(i8** %a, i8* %v) nounwind uwtable {
+entry:
+ store atomic i8* %v, i8** %a seq_cst, align 8, !dbg !7
+ ret void, !dbg !7
+}
+; CHECK-LABEL: atomic64_store_seq_cst
+; CHECK: %{{.*}} = bitcast i8** %{{.*}} to i64*
+; CHECK-NEXT: %{{.*}} = ptrtoint i8* %{{.*}} to i64
+; CHECK-NEXT: call void @__tsan_atomic64_store(i64* %{{.*}}, i64 %{{.*}}, i32 5), !dbg
+
define void @atomic64_xchg_monotonic(i64* %a) nounwind uwtable {
entry:
atomicrmw xchg i64* %a, i64 0 monotonic, !dbg !7
@@ -1538,6 +1558,21 @@ entry:
; CHECK-LABEL: atomic64_cas_seq_cst
; CHECK: call i64 @__tsan_atomic64_compare_exchange_val(i64* %a, i64 0, i64 1, i32 5, i32 5), !dbg
+define void @atomic64_cas_seq_cst_ptr_ty(i8** %a, i8* %v1, i8* %v2) nounwind uwtable {
+entry:
+ cmpxchg i8** %a, i8* %v1, i8* %v2 seq_cst seq_cst, !dbg !7
+ ret void
+}
+; CHECK-LABEL: atomic64_cas_seq_cst
+; CHECK: {{.*}} = ptrtoint i8* %v1 to i64
+; CHECK-NEXT: {{.*}} = ptrtoint i8* %v2 to i64
+; CHECK-NEXT: {{.*}} = bitcast i8** %a to i64*
+; CHECK-NEXT: {{.*}} = call i64 @__tsan_atomic64_compare_exchange_val(i64* {{.*}}, i64 {{.*}}, i64 {{.*}}, i32 5, i32 5), !dbg
+; CHECK-NEXT: {{.*}} = icmp eq i64
+; CHECK-NEXT: {{.*}} = inttoptr i64 {{.*}} to i8*
+; CHECK-NEXT: {{.*}} = insertvalue { i8*, i1 } undef, i8* {{.*}}, 0
+; CHECK-NEXT: {{.*}} = insertvalue { i8*, i1 } {{.*}}, i1 {{.*}}, 1
+
define i128 @atomic128_load_unordered(i128* %a) nounwind uwtable {
entry:
%0 = load atomic i128, i128* %a unordered, align 16, !dbg !7
@@ -1987,6 +2022,7 @@ entry:
; CHECK: call void @__tsan_atomic_thread_fence(i32 5), !dbg
!llvm.module.flags = !{!0, !1, !2}
+!llvm.dbg.cu = !{!8}
!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = !{i32 1, !"PIC Level", i32 2}
@@ -1994,5 +2030,10 @@ entry:
!3 = !{}
!4 = !DISubroutineType(types: !3)
!5 = !DIFile(filename: "atomic.cpp", directory: "/tmp")
-!6 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 99, type: !4, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !3)
+!6 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 99, type: !4, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, unit: !8, variables: !3)
!7 = !DILocation(line: 100, column: 1, scope: !6)
+
+!8 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
+ file: !5,
+ isOptimized: true, flags: "-O2",
+ splitDebugFilename: "abc.debug", emissionKind: 2)