121
|
1 ; RUN: opt -instcombine -S %s | FileCheck %s
|
|
2
|
|
3 ; Make sure we collapse the fences in this case
|
|
4
|
|
5 ; CHECK-LABEL: define void @tinkywinky
|
|
6 ; CHECK-NEXT: fence seq_cst
|
|
7 ; CHECK-NEXT: fence syncscope("singlethread") acquire
|
|
8 ; CHECK-NEXT: ret void
|
|
9 ; CHECK-NEXT: }
|
|
10
|
|
11 define void @tinkywinky() {
|
|
12 fence seq_cst
|
|
13 fence seq_cst
|
|
14 fence seq_cst
|
|
15 fence syncscope("singlethread") acquire
|
|
16 fence syncscope("singlethread") acquire
|
|
17 fence syncscope("singlethread") acquire
|
|
18 ret void
|
|
19 }
|
|
20
|
|
21 ; CHECK-LABEL: define void @dipsy
|
|
22 ; CHECK-NEXT: fence seq_cst
|
|
23 ; CHECK-NEXT: fence syncscope("singlethread") seq_cst
|
|
24 ; CHECK-NEXT: ret void
|
|
25 ; CHECK-NEXT: }
|
|
26
|
|
27 define void @dipsy() {
|
|
28 fence seq_cst
|
|
29 fence syncscope("singlethread") seq_cst
|
|
30 ret void
|
|
31 }
|
|
32
|
|
33 ; CHECK-LABEL: define void @patatino
|
|
34 ; CHECK-NEXT: fence acquire
|
|
35 ; CHECK-NEXT: fence seq_cst
|
|
36 ; CHECK-NEXT: fence acquire
|
|
37 ; CHECK-NEXT: fence seq_cst
|
|
38 ; CHECK-NEXT: ret void
|
|
39 ; CHECK-NEXT: }
|
|
40
|
|
41 define void @patatino() {
|
|
42 fence acquire
|
|
43 fence seq_cst
|
|
44 fence acquire
|
|
45 fence seq_cst
|
|
46 ret void
|
|
47 }
|
147
|
48
|
|
49 ; CHECK-LABEL: define void @debug
|
|
50 ; CHECK-NOT: fence
|
|
51 ; CHECK: call void @llvm.dbg.value
|
|
52 ; CHECK: fence seq_cst
|
|
53 define void @debug() {
|
|
54 fence seq_cst
|
|
55 tail call void @llvm.dbg.value(metadata i32 5, metadata !1, metadata !DIExpression()), !dbg !9
|
|
56 fence seq_cst
|
|
57 ret void
|
|
58 }
|
|
59
|
|
60 declare void @llvm.dbg.value(metadata, metadata, metadata)
|
|
61
|
|
62 !llvm.dbg.cu = !{!0}
|
|
63 !llvm.module.flags = !{!5, !6, !7, !8}
|
|
64
|
|
65 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "Me", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: null, retainedTypes: null, imports: null)
|
|
66 !1 = !DILocalVariable(name: "", arg: 1, scope: !2, file: null, line: 1, type: null)
|
|
67 !2 = distinct !DISubprogram(name: "debug", linkageName: "debug", scope: null, file: null, line: 0, type: null, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0)
|
|
68 !3 = !DIFile(filename: "consecutive-fences.ll", directory: "")
|
|
69 !5 = !{i32 2, !"Dwarf Version", i32 4}
|
|
70 !6 = !{i32 2, !"Debug Info Version", i32 3}
|
|
71 !7 = !{i32 1, !"wchar_size", i32 4}
|
|
72 !8 = !{i32 7, !"PIC Level", i32 2}
|
|
73 !9 = !DILocation(line: 0, column: 0, scope: !2)
|