1 ; RUN: opt -instcombine -S %s | FileCheck %s
3 ; Make sure we collapse the fences in this case
5 ; CHECK-LABEL: define void @tinkywinky
6 ; CHECK-NEXT: fence seq_cst
7 ; CHECK-NEXT: fence syncscope("singlethread") acquire
11 define void @tinkywinky() {
15 fence syncscope("singlethread") acquire
16 fence syncscope("singlethread") acquire
17 fence syncscope("singlethread") acquire
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
27 define void @dipsy() {
29 fence syncscope("singlethread") seq_cst
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
41 define void @patatino() {
49 ; CHECK-LABEL: define void @debug
51 ; CHECK: call void @llvm.dbg.value
52 ; CHECK: fence seq_cst
53 define void @debug() {
55 tail call void @llvm.dbg.value(metadata i32 5, metadata !1, metadata !DIExpression()), !dbg !9
60 declare void @llvm.dbg.value(metadata, metadata, metadata)
63 !llvm.module.flags = !{!5, !6, !7, !8}
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)