66 lines · plain
1; RUN: opt < %s -passes=tsan -S | FileCheck %s2 3target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"4 5define void @Increment(ptr nocapture %0) local_unnamed_addr sanitize_thread !dbg !7 {6 call void @llvm.dbg.value(metadata ptr %0, metadata !14, metadata !DIExpression()), !dbg !167 %2 = load i32, ptr %0, align 4, !dbg !17, !tbaa !188 call void @llvm.dbg.value(metadata i32 %2, metadata !15, metadata !DIExpression()), !dbg !169 %3 = add nsw i32 %2, 1, !dbg !2210 store i32 %3, ptr %0, align 4, !dbg !23, !tbaa !1811 ret void, !dbg !2412}13; CHECK-LABEL: define void @Increment14; CHECK-NOT: __tsan_read415; CHECK: __tsan_write416; CHECK: ret void17 18define i32 @NoAccesses(i32 %0) local_unnamed_addr sanitize_thread !dbg !25 {19 call void @llvm.dbg.value(metadata i32 %0, metadata !29, metadata !DIExpression()), !dbg !3020 %2 = add nsw i32 %0, 1, !dbg !3121 ret i32 %2, !dbg !3222}23; CHECK-LABEL: define i32 @NoAccesses24; CHECK-NOT: __tsan_func_entry25; CHECK-NOT: __tsan_func_exit26; CHECK: ret i3227 28declare void @llvm.dbg.value(metadata, metadata, metadata)29 30!llvm.dbg.cu = !{!0}31!llvm.module.flags = !{!2, !3, !4, !5}32!llvm.ident = !{!6}33!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)34!1 = !DIFile(filename: "test.c", directory: "/")35!2 = !{i32 7, !"Dwarf Version", i32 4}36!3 = !{i32 2, !"Debug Info Version", i32 3}37!4 = !{i32 1, !"wchar_size", i32 4}38!5 = !{i32 7, !"uwtable", i32 1}39!6 = !{!"clang"}40!7 = distinct !DISubprogram(name: "Increment", scope: !8, file: !8, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13)41!8 = !DIFile(filename: "test.c", directory: "")42!9 = !DISubroutineType(types: !10)43!10 = !{null, !11}44!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)45!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)46!13 = !{!14, !15}47!14 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !8, line: 1, type: !11)48!15 = !DILocalVariable(name: "x", scope: !7, file: !8, line: 2, type: !12)49!16 = !DILocation(line: 0, scope: !7)50!17 = !DILocation(line: 2, column: 11, scope: !7)51!18 = !{!19, !19, i64 0}52!19 = !{!"int", !20, i64 0}53!20 = !{!"omnipotent char", !21, i64 0}54!21 = !{!"Simple C/C++ TBAA"}55!22 = !DILocation(line: 3, column: 10, scope: !7)56!23 = !DILocation(line: 3, column: 6, scope: !7)57!24 = !DILocation(line: 4, column: 1, scope: !7)58!25 = distinct !DISubprogram(name: "NoAccesses", scope: !8, file: !8, line: 6, type: !26, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !28)59!26 = !DISubroutineType(types: !27)60!27 = !{!12, !12}61!28 = !{!29}62!29 = !DILocalVariable(name: "a", arg: 1, scope: !25, file: !8, line: 6, type: !12)63!30 = !DILocation(line: 0, scope: !25)64!31 = !DILocation(line: 7, column: 12, scope: !25)65!32 = !DILocation(line: 7, column: 3, scope: !25)66