1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/test/Transforms/HotColdSplit/apply-penalty-for-outputs.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

25 lines
581 B
LLVM

; REQUIRES: asserts
; RUN: opt -hotcoldsplit -debug-only=hotcoldsplit -hotcoldsplit-threshold=2 -S < %s -o /dev/null 2>&1 | FileCheck %s
declare void @sink() cold
@g = global i32 0
define i32 @foo(i32 %arg) {
entry:
br i1 undef, label %cold, label %exit
cold:
; CHECK: Applying penalty for splitting: 2
; CHECK-NEXT: Applying penalty for: 1 params
; CHECK-NEXT: Applying penalty for: 1 outputs/split phis
; CHECK-NEXT: penalty = 7
%local = load i32, i32* @g
call void @sink()
br label %exit
exit:
%p = phi i32 [ %local, %cold ], [ 0, %entry ]
ret i32 %p
}