1; RUN: opt < %s -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 7 8; CHECK: remark: libcalls-opt-remarks.c:10:10: folded strlen(select) to select of constants{{$}} 9; CHECK-NOT: remark: 10 11; YAML: --- !Passed 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 16; YAML-NEXT: Args: 17; YAML-NEXT: - String: 'folded strlen(select) to select of constants' 18; YAML-NEXT: ... 19 20target 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" 21 22declare i32 @strlen(i8*) 23 24@hello = constant [6 x i8] c"hello\00" 25@longer = constant [7 x i8] c"longer\00" 26 27define i32 @f1(i1) !dbg !7 { 28 %hello = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0, !dbg !10 29 %longer = getelementptr [7 x i8], [7 x i8]* @longer, i32 0, i32 0, !dbg !12 30 %2 = select i1 %0, i8* %hello, i8* %longer, !dbg !9 31 %3 = call i32 @strlen(i8* %2), !dbg !14 32 ret i32 %3, !dbg !16 33} 34 35 36 37!llvm.dbg.cu = !{!0} 38!llvm.module.flags = !{!3, !4, !5} 39!llvm.ident = !{!6} 40 41!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) 42!1 = !DIFile(filename: "libcalls-opt-remarks.c", directory: "/tmp") 43!2 = !{} 44!3 = !{i32 2, !"Dwarf Version", i32 4} 45!4 = !{i32 2, !"Debug Info Version", i32 3} 46!5 = !{i32 1, !"PIC Level", i32 2} 47!6 = !{!"Apple LLVM version 8.1.0 (clang-802.0.42)"} 48!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) 49!8 = !DISubroutineType(types: !2) 50!9 = !DILocation(line: 10, column: 17, scope: !7) 51!10 = !DILocation(line: 10, column: 24, scope: !11) 52!11 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 1) 53!12 = !DILocation(line: 10, column: 32, scope: !13) 54!13 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 2) 55!14 = !DILocation(line: 10, column: 10, scope: !15) 56!15 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 3) 57!16 = !DILocation(line: 10, column: 3, scope: !15) 58