mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
92b9137fcb
Clang FE currently has hot/cold function attribute. But we only have cold function attribute in LLVM IR. This patch adds support of hot function attribute to LLVM IR. This attribute will be used in setting function section prefix/suffix. Currently .hot and .unlikely suffix only are added in PGO (Sample PGO) compilation (through isFunctionHotInCallGraph and isFunctionColdInCallGraph). This patch changes the behavior. The new behavior is: (1) If the user annotates a function as hot or isFunctionHotInCallGraph is true, this function will be marked as hot. Otherwise, (2) If the user annotates a function as cold or isFunctionColdInCallGraph is true, this function will be marked as cold. The changes are: (1) user annotated function attribute will used in setting function section prefix/suffix. (2) hot attribute overwrites profile count based hotness. (3) profile count based hotness overwrite user annotated cold attribute. The intention for these changes is to provide the user a way to mark certain function as hot in cases where training input is hard to cover all the hot functions. Differential Revision: https://reviews.llvm.org/D92493
14 lines
370 B
LLVM
14 lines
370 B
LLVM
; Test hot function attribute
|
|
; RUN: llc < %s | FileCheck %s
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
; Function Attrs: hot noinline norecurse nounwind readnone uwtable
|
|
define dso_local i32 @hot4() #0 {
|
|
entry:
|
|
ret i32 1
|
|
}
|
|
; CHECK: .section .text.hot.,"ax",@progbits
|
|
; CHECK: .globl hot4
|
|
|
|
attributes #0 = { hot noinline norecurse nounwind readnone uwtable }
|