mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
7dcd99ba17
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
78 lines
3.5 KiB
LLVM
78 lines
3.5 KiB
LLVM
; RUN: opt < %s -inline -pass-remarks=inline -pass-remarks-missed=inline \
|
|
; RUN: -pass-remarks-analysis=inline -S 2>&1 | \
|
|
; RUN: FileCheck -check-prefix=CHECK -check-prefix=NO_HOTNESS %s
|
|
; RUN: opt < %s -inline -pass-remarks=inline -pass-remarks-missed=inline \
|
|
; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
|
|
; RUN: FileCheck -check-prefix=CHECK -check-prefix=HOTNESS %s
|
|
|
|
; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
|
|
; RUN: -pass-remarks-analysis=inline -S 2>&1 | \
|
|
; RUN: FileCheck -check-prefix=CHECK -check-prefix=NO_HOTNESS %s
|
|
; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
|
|
; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
|
|
; RUN: FileCheck -check-prefix=CHECK -check-prefix=HOTNESS %s
|
|
|
|
; HOTNESS: fox will not be inlined into bar because its definition is unavailable
|
|
; NO_HOTNESS-NOT: fox will not be inlined into bar because its definition is unavailable
|
|
; CHECK: foo inlined into bar with (cost=always): always inline attribute
|
|
; CHECK: foz not inlined into bar because it should never be inlined (cost=never): noinline function attribute
|
|
|
|
; Function Attrs: alwaysinline nounwind uwtable
|
|
define i32 @foo(i32 %x, i32 %y) #0 !prof !1 {
|
|
entry:
|
|
%x.addr = alloca i32, align 4
|
|
%y.addr = alloca i32, align 4
|
|
store i32 %x, i32* %x.addr, align 4
|
|
store i32 %y, i32* %y.addr, align 4
|
|
%0 = load i32, i32* %x.addr, align 4
|
|
%1 = load i32, i32* %y.addr, align 4
|
|
%add = add nsw i32 %0, %1
|
|
ret i32 %add
|
|
}
|
|
|
|
; Function Attrs: noinline nounwind uwtable
|
|
define float @foz(i32 %x, i32 %y) #1 !prof !1 {
|
|
entry:
|
|
%x.addr = alloca i32, align 4
|
|
%y.addr = alloca i32, align 4
|
|
store i32 %x, i32* %x.addr, align 4
|
|
store i32 %y, i32* %y.addr, align 4
|
|
%0 = load i32, i32* %x.addr, align 4
|
|
%1 = load i32, i32* %y.addr, align 4
|
|
%mul = mul nsw i32 %0, %1
|
|
%conv = sitofp i32 %mul to float
|
|
ret float %conv
|
|
}
|
|
|
|
declare i32 @fox()
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
define i32 @bar(i32 %j) #2 !prof !1 {
|
|
entry:
|
|
%j.addr = alloca i32, align 4
|
|
store i32 %j, i32* %j.addr, align 4
|
|
%0 = load i32, i32* %j.addr, align 4
|
|
%1 = load i32, i32* %j.addr, align 4
|
|
%sub = sub nsw i32 %1, 2
|
|
%call = call i32 @foo(i32 %0, i32 %sub)
|
|
%conv = sitofp i32 %call to float
|
|
%2 = load i32, i32* %j.addr, align 4
|
|
%sub1 = sub nsw i32 %2, 2
|
|
%3 = load i32, i32* %j.addr, align 4
|
|
%call2 = call float @foz(i32 %sub1, i32 %3)
|
|
%mul = fmul float %conv, %call2
|
|
%conv3 = fptosi float %mul to i32
|
|
%call3 = call i32 @fox()
|
|
%add = add i32 %conv3, %call
|
|
ret i32 %add
|
|
}
|
|
|
|
attributes #0 = { alwaysinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
attributes #1 = { noinline nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
attributes #2 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
!llvm.ident = !{!0}
|
|
|
|
!0 = !{!"clang version 3.5.0 "}
|
|
!1 = !{!"function_entry_count", i64 10}
|