136 lines · plain
1; RUN: llvm-as < %s >%t.bc2; 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=REMARKS10; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM11 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_DH17; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM18 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-empty24; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM25 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-empty31; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM32 33; Optimization records are collected regardless of the diagnostic handler34; RUN: rm -f %t.yaml35; 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-empty40; RUN: cat %t.yaml | FileCheck %s -check-prefixes=YAML,YAML-NO-ANNOTATE41 42; Try again with `-annotate-inline-lto-phase`.43; RUN: rm -f %t.yaml44; 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-empty50; RUN: cat %t.yaml | FileCheck %s -check-prefixes=YAML,YAML-ANNOTATE51 52; REMARKS: remark: {{.*}} 'foo' inlined into 'main'53; REMARKS: remark: {{.*}} the cost-model indicates that interleaving is not beneficial54; REMARKS_DH: llvm-lto: remark: {{.*}} 'foo' inlined into 'main'55; REMARKS_DH: llvm-lto: remark: {{.*}} the cost-model indicates that interleaving is not beneficial56; CHECK-NOT: remark:57; CHECK-NOT: llvm-lto:58; NM-NOT: foo59; NM: func260; NM: main61 62; YAML: --- !Passed63; YAML-NO-ANNOTATE-NEXT: Pass: inline64; YAML-ANNOTATE-NEXT: Pass: postlink-cgscc-inline65; YAML-NEXT: Name: Inlined66; YAML-NEXT: Function: main67; YAML-NEXT: Args:68; YAML-NEXT: - String: ''''69; YAML-NEXT: - Callee: foo70; YAML-NEXT: - String: ''' inlined into '''71; YAML-NEXT: - Caller: main72; 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 %a89}90 91define i32 @main() {92 %i = call i32 @foo()93 ret i32 %i94}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.body99 100for.body: ; preds = %for.body, %entry101 %i.037 = phi i64 [ 0, %entry ], [ %inc, %for.body ]102 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %i.037103 %0 = load i32, ptr %arrayidx, align 4104 %arrayidx1 = getelementptr inbounds i32, ptr %B, i64 %i.037105 %1 = load i32, ptr %arrayidx1, align 4106 %add = add nsw i32 %1, %0107 %arrayidx2 = getelementptr inbounds i32, ptr %C, i64 %i.037108 %2 = load i32, ptr %arrayidx2, align 4109 %add3 = add nsw i32 %add, %2110 %arrayidx4 = getelementptr inbounds i32, ptr %E, i64 %i.037111 %3 = load i32, ptr %arrayidx4, align 4112 %add5 = add nsw i32 %add3, %3113 %arrayidx6 = getelementptr inbounds i32, ptr %F, i64 %i.037114 %4 = load i32, ptr %arrayidx6, align 4115 %add7 = add nsw i32 %add5, %4116 %arrayidx8 = getelementptr inbounds i32, ptr %out, i64 %i.037117 store i32 %add7, ptr %arrayidx8, align 4118 %5 = load i32, ptr %arrayidx, align 4119 %6 = load i32, ptr %arrayidx1, align 4120 %add11 = add nsw i32 %6, %5121 %7 = load i32, ptr %arrayidx2, align 4122 %add13 = add nsw i32 %add11, %7123 %8 = load i32, ptr %arrayidx4, align 4124 %add15 = add nsw i32 %add13, %8125 %9 = load i32, ptr %arrayidx6, align 4126 %add17 = add nsw i32 %add15, %9127 %arrayidx18 = getelementptr inbounds i32, ptr %out2, i64 %i.037128 store i32 %add17, ptr %arrayidx18, align 4129 %inc = add i64 %i.037, 1130 %exitcond = icmp eq i64 %inc, 256131 br i1 %exitcond, label %for.end, label %for.body132 133for.end: ; preds = %for.body134 ret i32 undef135}136