[HotColdSplit] Mark entire function cold when entry block is cold

rdar://58855712
This commit is contained in:
Vedant Kumar 2020-02-17 15:56:12 -08:00
parent e58b532e8c
commit c09998b436
2 changed files with 16 additions and 0 deletions

View File

@ -458,6 +458,10 @@ public:
// first have predecessors within the extraction region.
if (mayExtractBlock(SinkBB)) {
addBlockToRegion(&SinkBB, SinkScore);
if (pred_empty(&SinkBB)) {
ColdRegion->EntireFunctionCold = true;
return Regions;
}
} else {
Regions.emplace_back();
ColdRegion = &Regions.back();

View File

@ -50,6 +50,16 @@ if.end: ; preds = %entry
ret void
}
; Make sure we don't try to outline the entire function, especially when the
; entry block is cold.
; CHECK: define void @cold_entry_block() [[COLD_ATTR:#[0-9]+]]
; CHECK-NOT: cold_entry_block.cold.1
define void @cold_entry_block() {
entry:
call void @sink()
ret void
}
; Do not split `noinline` functions.
; CHECK-LABEL: @noinline_func
; CHECK-NOT: noinline_func.cold.1
@ -182,6 +192,8 @@ if.end: ; preds = %entry
ret void
}
; CHECK: attributes [[COLD_ATTR]] = { {{.*}}cold
declare void @llvm.dbg.value(metadata, metadata, metadata)
declare void @sink() cold