107 lines · plain
1; RUN: opt -module-summary %s -o %t1.bc2; RUN: opt -module-summary %p/Inputs/diagnostic-handler-remarks.ll -o %t2.bc3 4; Optimization records are collected regardless of the diagnostic handler5; RUN: rm -f %t.yaml.thin.0.yaml %t.yaml.thin.1.yaml6; RUN: llvm-lto -thinlto-action=run \7; RUN: -lto-pass-remarks-output=%t.yaml \8; RUN: -lto-pass-remarks-filter=inline \9; RUN: -lto-pass-remarks-format=yaml \10; RUN: -exported-symbol _func2 \11; RUN: -exported-symbol _main %t1.bc %t2.bc 2>&1 | \12; RUN: FileCheck %s -allow-empty13; CHECK-NOT: remark:14; CHECK-NOT: llvm-lto:15 16 17; Verify that bar is imported 'and' inlined into 'foo'18; RUN: cat %t.yaml.thin.0.yaml | FileCheck %s -check-prefixes=YAML1,YAML1-NO-ANNOTATE19 20; Verify that bar is imported 'and' inlined into 'foo'21; RUN: cat %t.yaml.thin.1.yaml | FileCheck %s -check-prefixes=YAML2,YAML2-NO-ANNOTATE22 23; Try again with -annotate-inline-phase24; RUN: rm -f %t.yaml.thin.0.yaml %t.yaml.thin.1.yaml25; RUN: llvm-lto -thinlto-action=run \26; RUN: -annotate-inline-phase \27; RUN: -lto-pass-remarks-output=%t.yaml \28; RUN: -lto-pass-remarks-filter=inline \29; RUN: -lto-pass-remarks-format=yaml \30; RUN: -exported-symbol _func2 \31; RUN: -exported-symbol _main %t1.bc %t2.bc 2>&1 | \32; RUN: FileCheck %s -allow-empty33; CHECK-NOT: remark:34; CHECK-NOT: llvm-lto:35 36; Verify thati inline happens the same way and pass name are annotated with LTO phase information.37; RUN: cat %t.yaml.thin.0.yaml | FileCheck %s -check-prefixes=YAML1,YAML1-ANNOTATE38 39; Verify that bar is imported 'and' inlined into 'foo'40; RUN: cat %t.yaml.thin.1.yaml | FileCheck %s -check-prefixes=YAML2,YAML2-ANNOTATE41 42; YAML1: --- !Passed43; YAML1: --- !Passed44; YAML1-NO-ANNOTATE: Pass: inline45; YAML1-ANNOTATE-NEXT: Pass: postlink-cgscc-inline46; YAML1-NEXT: Name: Inlined47; YAML1-NEXT: Function: main48; YAML1-NEXT: Args:49; YAML1-NEXT: - String: ''''50; YAML1-NEXT: - Callee: foo51; YAML1-NEXT: - String: ''' inlined into '52; YAML1-NEXT: - Caller: main53; YAML1-NEXT: - String: ''''54; YAML1-NEXT: - String: ' with '55; YAML1-NEXT: - String: '(cost='56; YAML1-NEXT: - Cost: '-30'57; YAML1-NEXT: - String: ', threshold='58; YAML1-NEXT: - Threshold: '375'59; YAML1-NEXT: - String: ')'60; YAML1-NEXT: ...61 62; YAML2: --- !Passed63; YAML2-NO-ANNOTATE: Pass: inline64; YAML2-ANNOTATE-NEXT: Pass: postlink-cgscc-inline65; YAML2-NEXT: Name: Inlined66; YAML2-NEXT: Function: foo67; YAML2-NEXT: Args:68; YAML2-NEXT: - String: ''''69; YAML2-NEXT: - Callee: bar70; YAML2-NEXT: - String: ''' inlined into '71; YAML2-NEXT: - Caller: foo72; YAML2-NEXT: - String: ''''73; YAML2-NEXT: - String: ' with '74; YAML2-NEXT: - String: '(cost='75; YAML2-NEXT: - Cost: '-30'76; YAML2-NEXT: - String: ', threshold='77; YAML2-NEXT: - Threshold: '375'78; YAML2-NEXT: - String: ')'79; YAML2-NEXT: ...80 81; The file extension depends on the format of the remarks82; RUN: rm -f %t.bitstream.thin.0.bitstream %t.bitstream.thin.1.bitstream83; RUN: llvm-lto -thinlto-action=run \84; RUN: -lto-pass-remarks-output=%t.bitstream \85; RUN: -lto-pass-remarks-filter=inline \86; RUN: -lto-pass-remarks-format=bitstream \87; RUN: -exported-symbol _func2 \88; RUN: -exported-symbol _main %t1.bc %t2.bc 2>&1 | \89; RUN: FileCheck %s -allow-empty90; RUN: llvm-bcanalyzer %t.bitstream.thin.0.bitstream91; RUN: llvm-bcanalyzer %t.bitstream.thin.1.bitstream92; CHECK-NOT: remark:93; CHECK-NOT: llvm-lto:94 95target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"96target triple = "x86_64-apple-macosx10.11.0"97 98define i32 @bar() {99 ret i32 42100}101declare i32 @foo()102define i32 @main() {103 %i = call i32 @foo()104 ret i32 %i105}106 107