This is the first PR to enable the prefetch optimization via Propeller based on our [RFC](https://discourse.llvm.org/t/rfc-code-prefetch-insertion/88668/22). It enables emitting special symbols prefixed with `__llvm_prefetch_target` to point to the prefetch targets as specified via directives in the profile. A prefetch target is uniquely identified by its function name, basic block ID, and the subblock index (used when the target is after a call instruction). A new pass is added which sets a field in basic blocks which have prefetch targets. The next PR will add the prefetch insertion logic into the same pass.
30 lines
792 B
LLVM
30 lines
792 B
LLVM
;; Check prefetch directives properly handle a block terminating with a call.
|
|
;;
|
|
;; Specify the bb sections profile:
|
|
; RUN: echo 'v1' > %t
|
|
; RUN: echo 'f fred' >> %t
|
|
; RUN: echo 't 0,1' >> %t
|
|
;;
|
|
; RUN: llc < %s -mtriple=x86_64-pc-linux -asm-verbose=false -function-sections -basic-block-sections=%t -O1 | FileCheck %s
|
|
|
|
define i32 @fred() personality ptr @__gxx_personality_v0 {
|
|
entry:
|
|
invoke void @explode()
|
|
to label %continue unwind label %cleanup
|
|
; CHECK: fred:
|
|
; CHECK: callq explode@PLT
|
|
; CHECK-NEXT: .globl __llvm_prefetch_target_fred_0_1
|
|
; CHECK-NEXT: __llvm_prefetch_target_fred_0_1:
|
|
|
|
continue:
|
|
ret i32 0
|
|
|
|
cleanup:
|
|
%res = landingpad { i8*, i32 }
|
|
cleanup
|
|
resume { i8*, i32 } %res
|
|
}
|
|
|
|
declare void @__gxx_personality_v0()
|
|
declare void @explode()
|