llvm-project/llvm/test/Transforms/ThinLTOBitcodeWriter/unique-source-file-names.ll
Peter Collingbourne a5aa0c46c3
Introduce -funique-source-file-names flag.
The purpose of this flag is to allow the compiler to assume that each
object file passed to the linker has been compiled using a unique
source file name. This is useful for reducing link times when doing
ThinLTO in combination with whole-program devirtualization or CFI,
as it allows modules without exported symbols to be built with ThinLTO.

Reviewers: vitalybuka, teresajohnson

Reviewed By: teresajohnson

Pull Request: https://github.com/llvm/llvm-project/pull/135728
2025-04-15 11:12:05 -07:00

23 lines
610 B
LLVM

; RUN: opt -thinlto-bc -thin-link-bitcode-file=%t2 -thinlto-split-lto-unit -o %t %s
; RUN: llvm-modextract -b -n 1 -o %t1 %t
; RUN: llvm-dis -o - %t1 | FileCheck %s
source_filename = "unique-source-file-names.c"
@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @f, ptr null }]
; CHECK: @g.45934e8a5251fb7adbecfff71a4e70ed =
@g = internal global i8 42, !type !0
declare void @sink(ptr)
define internal void @f() {
call void @sink(ptr @g)
ret void
}
!0 = !{i32 0, !"typeid"}
!llvm.module.flags = !{!1}
!1 = !{i32 1, !"Unique Source File Names", i32 1}