Summary: This patch improves Inliner to provide causes/reasons for negative inline decisions. 1. It adds one new message field to InlineCost to report causes for Always and Never instances. All Never and Always instantiations must provide a simple message. 2. Several functions that used to return the inlining results as boolean are changed to return InlineResult which carries the cause for negative decision. 3. Changed remark priniting and debug output messages to provide the additional messages and related inline cost. 4. Adjusted tests for changed printing. Patch by: yrouban (Yevgeny Rouban) Reviewers: craig.topper, sammccall, sgraenitz, NutshellySima, shchenz, chandlerc, apilipenko, javed.absar, tejohnson, dblaikie, sanjoy, eraman, xbolva00 Reviewed By: tejohnson, xbolva00 Subscribers: xbolva00, llvm-commits, arsenm, mehdi_amini, eraman, haicheng, steven_wu, dexonsmith Differential Revision: https://reviews.llvm.org/D49412 llvm-svn: 338969
51 lines
1.5 KiB
LLVM
51 lines
1.5 KiB
LLVM
; Test of LTO with opt remarks YAML output.
|
|
|
|
; First try with Regular LTO
|
|
; RUN: llvm-as < %s >%t.bc
|
|
; RUN: rm -f %t.yaml
|
|
; RUN: llvm-lto2 run -pass-remarks-output=%t.yaml \
|
|
; RUN: -r %t.bc,tinkywinky,p \
|
|
; RUN: -r %t.bc,patatino,px \
|
|
; RUN: -r %t.bc,main,px -o %t.o %t.bc
|
|
; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML
|
|
|
|
; Try again with ThinLTO
|
|
; RUN: opt -module-summary %s -o %t.bc
|
|
; RUN: rm -f %t.thin.1.yaml
|
|
; RUN: llvm-lto2 run -pass-remarks-output=%t \
|
|
; RUN: -r %t.bc,tinkywinky,p \
|
|
; RUN: -r %t.bc,patatino,px \
|
|
; RUN: -r %t.bc,main,px -o %t.o %t.bc
|
|
; RUN: cat %t.thin.1.yaml | FileCheck %s -check-prefix=YAML
|
|
|
|
; YAML: --- !Passed
|
|
; YAML-NEXT: Pass: inline
|
|
; YAML-NEXT: Name: Inlined
|
|
; YAML-NEXT: Function: main
|
|
; YAML-NEXT: Args:
|
|
; YAML-NEXT: - Callee: tinkywinky
|
|
; YAML-NEXT: - String: ' inlined into '
|
|
; YAML-NEXT: - Caller: main
|
|
; YAML-NEXT: - String: ' with '
|
|
; YAML-NEXT: - String: '(cost='
|
|
; YAML-NEXT: - Cost: '-15000'
|
|
; YAML-NEXT: - String: ', threshold='
|
|
; YAML-NEXT: - Threshold: '337'
|
|
; YAML-NEXT: - String: ')'
|
|
; YAML-NEXT: ...
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-scei-ps4"
|
|
|
|
declare i32 @patatino()
|
|
|
|
define i32 @tinkywinky() {
|
|
%a = call i32 @patatino()
|
|
ret i32 %a
|
|
}
|
|
|
|
define i32 @main() {
|
|
%i = call i32 @tinkywinky()
|
|
ret i32 %i
|
|
}
|