1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt < %s -S -passes=ipsccp | FileCheck %s
3 ; RUN: opt < %s -S -passes=ipsccp --try-experimental-debuginfo-iterators | FileCheck %s
4 ;; Check that @patatino is optimised to "unreachable" given that it branches on
5 ;; undef. Check too that debug intrinsics have no effect on this.
8 ; CHECK-LABEL: define {{[^@]+}}@main() {
9 ; CHECK-NEXT: [[CALL:%.*]] = call i1 @patatino(i1 undef)
10 ; CHECK-NEXT: ret void
12 %call = call i1 @patatino(i1 undef)
16 define internal i1 @patatino(i1 %a) {
17 ; CHECK-LABEL: define {{[^@]+}}@patatino
18 ; CHECK-SAME: (i1 [[A:%.*]]) {
19 ; CHECK-NEXT: unreachable
21 br i1 %a, label %ontrue, label %onfalse
23 call void @llvm.dbg.value(metadata i32 0, metadata !6, metadata !DIExpression()), !dbg !11
24 call void @llvm.dbg.value(metadata i32 1, metadata !9, metadata !DIExpression()), !dbg !11
27 call void @llvm.dbg.value(metadata i32 0, metadata !6, metadata !DIExpression()), !dbg !11
28 call void @llvm.dbg.value(metadata i32 1, metadata !9, metadata !DIExpression()), !dbg !11
32 declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone
34 !llvm.module.flags = !{!21}
37 !0 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !2, file: !20, scope: !1, type: !3)
38 !1 = !DIFile(filename: "b.c", directory: "/private/tmp")
39 !2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: true, emissionKind: FullDebug, file: !20)
40 !3 = !DISubroutineType(types: !4)
42 !5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
43 !6 = !DILocalVariable(name: "i", line: 2, arg: 1, scope: !0, file: !1, type: !5)
44 !7 = !DILocation(line: 2, column: 13, scope: !0)
45 !9 = !DILocalVariable(name: "k", line: 3, scope: !10, file: !1, type: !5)
46 !10 = distinct !DILexicalBlock(line: 2, column: 16, file: !20, scope: !0)
47 !11 = !DILocation(line: 3, column: 12, scope: !10)
48 !12 = !DILocation(line: 4, column: 3, scope: !10)
49 !13 = !DILocation(line: 5, column: 5, scope: !14)
50 !14 = distinct !DILexicalBlock(line: 4, column: 10, file: !20, scope: !10)
51 !15 = !DILocation(line: 6, column: 3, scope: !14)
52 !16 = !DILocation(line: 7, column: 5, scope: !17)
53 !17 = distinct !DILexicalBlock(line: 6, column: 10, file: !20, scope: !10)
54 !18 = !DILocation(line: 8, column: 3, scope: !17)
55 !19 = !DILocation(line: 9, column: 3, scope: !10)
56 !20 = !DIFile(filename: "b.c", directory: "/private/tmp")
57 !21 = !{i32 1, !"Debug Info Version", i32 3}