1 ; RUN: opt < %s -passes=instcombine -o /dev/null -pass-remarks-output=%t -S \
2 ; RUN: -pass-remarks=instcombine 2>&1 | FileCheck %s
3 ; RUN: cat %t | FileCheck -check-prefix=YAML %s
4 ; RUN: opt < %s -passes='require<opt-remark-emit>,instcombine' -o /dev/null \
5 ; RUN: -pass-remarks-output=%t -S -pass-remarks=instcombine 2>&1 | FileCheck %s
6 ; RUN: cat %t | FileCheck -check-prefix=YAML %s
8 ; CHECK: remark: libcalls-opt-remarks.c:10:10: folded strlen(select) to select of constants{{$}}
12 ; YAML-NEXT: Pass: instcombine
13 ; YAML-NEXT: Name: simplify-libcalls
14 ; YAML-NEXT: DebugLoc: { File: libcalls-opt-remarks.c, Line: 10, Column: 10 }
15 ; YAML-NEXT: Function: f1
17 ; YAML-NEXT: - String: 'folded strlen(select) to select of constants'
20 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
22 declare i32 @strlen(ptr)
24 @hello = constant [6 x i8] c"hello\00"
25 @longer = constant [7 x i8] c"longer\00"
27 define i32 @f1(i1) !dbg !7 {
28 %2 = select i1 %0, ptr @hello, ptr @longer, !dbg !9
29 %3 = call i32 @strlen(ptr %2), !dbg !14
36 !llvm.module.flags = !{!3, !4, !5}
39 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Apple LLVM version 8.1.0 (clang-802.0.42)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)
40 !1 = !DIFile(filename: "libcalls-opt-remarks.c", directory: "/tmp")
42 !3 = !{i32 2, !"Dwarf Version", i32 4}
43 !4 = !{i32 2, !"Debug Info Version", i32 3}
44 !5 = !{i32 1, !"PIC Level", i32 2}
45 !6 = !{!"Apple LLVM version 8.1.0 (clang-802.0.42)"}
46 !7 = distinct !DISubprogram(name: "f1", scope: !1, file: !1, line: 9, type: !8, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
47 !8 = !DISubroutineType(types: !2)
48 !9 = !DILocation(line: 10, column: 17, scope: !7)
49 !10 = !DILocation(line: 10, column: 24, scope: !11)
50 !11 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 1)
51 !12 = !DILocation(line: 10, column: 32, scope: !13)
52 !13 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 2)
53 !14 = !DILocation(line: 10, column: 10, scope: !15)
54 !15 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 3)
55 !16 = !DILocation(line: 10, column: 3, scope: !15)