1; RUN: llvm-as < %s >%t.bc 2; PR21108: Diagnostic handlers get pass remarks, even if they're not enabled. 3 4; Confirm that there are -pass-remarks. 5; RUN: llvm-lto \ 6; RUN: -pass-remarks=inline \ 7; RUN: -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \ 8; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \ 9; RUN: FileCheck %s -allow-empty -check-prefix=REMARKS 10; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM 11 12; RUN: llvm-lto \ 13; RUN: -pass-remarks=inline -use-diagnostic-handler \ 14; RUN: -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \ 15; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \ 16; RUN: FileCheck %s -allow-empty -check-prefix=REMARKS_DH 17; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM 18 19; Confirm that -pass-remarks are not printed by default. 20; RUN: llvm-lto \ 21; RUN: -exported-symbol _func2 \ 22; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \ 23; RUN: FileCheck %s -allow-empty 24; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM 25 26; RUN: llvm-lto \ 27; RUN: -use-diagnostic-handler \ 28; RUN: -exported-symbol _func2 \ 29; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \ 30; RUN: FileCheck %s -allow-empty 31; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM 32 33; Optimization records are collected regardless of the diagnostic handler 34; RUN: rm -f %t.yaml 35; RUN: llvm-lto \ 36; RUN: -lto-pass-remarks-output=%t.yaml \ 37; RUN: -exported-symbol _func2 \ 38; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \ 39; RUN: FileCheck %s -allow-empty 40; RUN: cat %t.yaml | FileCheck %s -check-prefixes=YAML,YAML-NO-ANNOTATE 41 42; Try again with `-annotate-inline-lto-phase`. 43; RUN: rm -f %t.yaml 44; RUN: llvm-lto \ 45; RUN: -annotate-inline-phase \ 46; RUN: -lto-pass-remarks-output=%t.yaml \ 47; RUN: -exported-symbol _func2 \ 48; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \ 49; RUN: FileCheck %s -allow-empty 50; RUN: cat %t.yaml | FileCheck %s -check-prefixes=YAML,YAML-ANNOTATE 51 52; REMARKS: remark: {{.*}} 'foo' inlined into 'main' 53; REMARKS: remark: {{.*}} the cost-model indicates that interleaving is not beneficial 54; REMARKS_DH: llvm-lto: remark: {{.*}} 'foo' inlined into 'main' 55; REMARKS_DH: llvm-lto: remark: {{.*}} the cost-model indicates that interleaving is not beneficial 56; CHECK-NOT: remark: 57; CHECK-NOT: llvm-lto: 58; NM-NOT: foo 59; NM: func2 60; NM: main 61 62; YAML: --- !Passed 63; YAML-NO-ANNOTATE-NEXT: Pass: inline 64; YAML-ANNOTATE-NEXT: Pass: postlink-cgscc-inline 65; YAML-NEXT: Name: Inlined 66; YAML-NEXT: Function: main 67; YAML-NEXT: Args: 68; YAML-NEXT: - String: '''' 69; YAML-NEXT: - Callee: foo 70; YAML-NEXT: - String: ''' inlined into ''' 71; YAML-NEXT: - Caller: main 72; YAML-NEXT: - String: '''' 73; YAML-NEXT: - String: ' with ' 74; YAML-NEXT: - String: '(cost=' 75; YAML-NEXT: - Cost: '-15000' 76; YAML-NEXT: - String: ', threshold=' 77; YAML-NEXT: - Threshold: '337' 78; YAML-NEXT: - String: ')' 79; YAML-NEXT: ... 80 81target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 82target triple = "x86_64-apple-darwin" 83 84declare i32 @bar() 85 86define i32 @foo() { 87 %a = call i32 @bar() 88 ret i32 %a 89} 90 91define i32 @main() { 92 %i = call i32 @foo() 93 ret i32 %i 94} 95 96define i32 @func2(ptr %out, ptr %out2, ptr %A, ptr %B, ptr %C, ptr %D, ptr %E, ptr %F) { 97entry: 98 br label %for.body 99 100for.body: ; preds = %for.body, %entry 101 %i.037 = phi i64 [ 0, %entry ], [ %inc, %for.body ] 102 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %i.037 103 %0 = load i32, ptr %arrayidx, align 4 104 %arrayidx1 = getelementptr inbounds i32, ptr %B, i64 %i.037 105 %1 = load i32, ptr %arrayidx1, align 4 106 %add = add nsw i32 %1, %0 107 %arrayidx2 = getelementptr inbounds i32, ptr %C, i64 %i.037 108 %2 = load i32, ptr %arrayidx2, align 4 109 %add3 = add nsw i32 %add, %2 110 %arrayidx4 = getelementptr inbounds i32, ptr %E, i64 %i.037 111 %3 = load i32, ptr %arrayidx4, align 4 112 %add5 = add nsw i32 %add3, %3 113 %arrayidx6 = getelementptr inbounds i32, ptr %F, i64 %i.037 114 %4 = load i32, ptr %arrayidx6, align 4 115 %add7 = add nsw i32 %add5, %4 116 %arrayidx8 = getelementptr inbounds i32, ptr %out, i64 %i.037 117 store i32 %add7, ptr %arrayidx8, align 4 118 %5 = load i32, ptr %arrayidx, align 4 119 %6 = load i32, ptr %arrayidx1, align 4 120 %add11 = add nsw i32 %6, %5 121 %7 = load i32, ptr %arrayidx2, align 4 122 %add13 = add nsw i32 %add11, %7 123 %8 = load i32, ptr %arrayidx4, align 4 124 %add15 = add nsw i32 %add13, %8 125 %9 = load i32, ptr %arrayidx6, align 4 126 %add17 = add nsw i32 %add15, %9 127 %arrayidx18 = getelementptr inbounds i32, ptr %out2, i64 %i.037 128 store i32 %add17, ptr %arrayidx18, align 4 129 %inc = add i64 %i.037, 1 130 %exitcond = icmp eq i64 %inc, 256 131 br i1 %exitcond, label %for.end, label %for.body 132 133for.end: ; preds = %for.body 134 ret i32 undef 135} 136