1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/Transforms/HotColdSplit/apply-penalty-for-inputs.ll
Aditya Kumar 6265a116de [HotColdSplit] Reflect full cost of parameters in split penalty
Make the penalty for splitting a region more accurately reflect the cost
of materializing all of the inputs/outputs to/from the region.

This almost entirely eliminates code growth within functions which
undergo splitting in key internal frameworks, and reduces the size of
those frameworks between 2.6% to 3%.

rdar://49167240

Patch by: Vedant Kumar(@vsk)
Reviewers: hiraditya,rjf,t.p.northover
Reviewed By: hiraditya,rjf

Differential Revision: https://reviews.llvm.org/D59715
2020-12-18 17:06:17 -08:00

37 lines
910 B
LLVM

; REQUIRES: asserts
; RUN: opt -hotcoldsplit -debug-only=hotcoldsplit -hotcoldsplit-threshold=2 -hotcoldsplit-max-params=2 -S < %s -o /dev/null 2>&1 | FileCheck %s
declare void @sink(i32*, i32, i32) cold
@g = global i32 0
define void @foo(i32 %arg) {
%local = load i32, i32* @g
br i1 undef, label %cold, label %exit
cold:
; CHECK: Applying penalty for splitting: 2
; CHECK-NEXT: Applying penalty for: 2 params
; CHECK-NEXT: Applying penalty for: 0 outputs/split phis
; CHECK-NEXT: penalty = 6
call void @sink(i32* @g, i32 %arg, i32 %local)
ret void
exit:
ret void
}
define void @bar(i32* %p1, i32 %p2, i32 %p3) {
br i1 undef, label %cold, label %exit
cold:
; CHECK: Applying penalty for splitting: 2
; CHECK-NEXT: 3 inputs and 0 outputs exceeds parameter limit (2)
; CHECK-NEXT: penalty = 2147483647
call void @sink(i32* %p1, i32 %p2, i32 %p3)
ret void
exit:
ret void
}