CFI does name-based matching. ThinLTO uses a hash over the function name (the "GUID"). As a result of this [RFC](https://discourse.llvm.org/t/rfc-keep-globalvalue-guids-stable/84801) - see also PR #184065 - GUID calculation should be treated as an implementation detail, i.e. passes shouldn't need to re-do / reverse engineer GUIDs. The main reasons CFI is aware of GUIDs is because (1) the CFI functions need to be communicated to ThinLink, as they need to be treated as exports, in `LTO::runThinLTO`; and (2) because CFI needs to check the liveliness of functions referenced in `cfi.functions` metadata, and this check happens via the thinlto export summary (`LowerTypeTestsModule::lower`). To a lesser extent, the optimization in PR #130382 benefits from CFI knowing about GUIDs; however, if this were the only reason, we could make `ValueInfo`s available at that point, which carry names, and perform name-based matching for CFI's needs. This PR lets GUIDs be passed to CFI. The bulk of the change is moving them around as metadata fields. The GUID calculation is hoisted out, but kept the same as before this patch, following that once PR #184065 is relanded it will be switched to the stable mechanism it (PR #184065) introduces. The compile time effects are [here](https://llvm-compile-time-tracker.com/compare.php?from=b29bf9fa25bdb906a61ec361fba68796020cc6b9&to=7bb1c07144e8ccb8a3332e91fc193303acd9439e&stat=instructions:u).
13 lines
255 B
LLVM
13 lines
255 B
LLVM
; Check summary versioning
|
|
; RUN: opt -module-summary %s -o - | llvm-bcanalyzer -dump | FileCheck %s
|
|
|
|
; CHECK: <GLOBALVAL_SUMMARY_BLOCK
|
|
; CHECK: <VERSION op0=14/>
|
|
|
|
|
|
|
|
; Need a function for the summary to be populated.
|
|
define void @foo() {
|
|
ret void
|
|
}
|