xref: /llvm-project/llvm/test/Transforms/PGOProfile/lto_cspgo_gen.ll (revision 443e2a10f69caeedb9fa621366b16fe0d4358279)
1; REQUIRES: x86-registered-target
2
3; RUN: opt -passes='thinlto-pre-link<O2>' --cs-profilegen-file=alloc -cspgo-kind=cspgo-instr-gen-pipeline -module-summary %s -o %t.bc
4; RUN: llvm-dis %t.bc -o - | FileCheck %s --check-prefix=IRPGOPRE
5
6;; Symbol __llvm_profile_filename and __llvm_profile_raw_version are non-prevailing here.
7; RUN: llvm-lto2 run -lto-cspgo-profile-file=alloc -lto-cspgo-gen -save-temps -o %t %t.bc \
8; RUN:   -r=%t.bc,f,px \
9; RUN:   -r=%t.bc,__llvm_profile_filename,x \
10; RUN:   -r=%t.bc,__llvm_profile_raw_version,x
11; RUN: llvm-dis %t.0.0.preopt.bc -o - | FileCheck %s --check-prefix=IRPGOBE
12
13;; Before LTO, we should have the __llvm_profile_raw_version definition.
14; IRPGOPRE: @__llvm_profile_raw_version = hidden constant i64
15
16;; Non-prevailing __llvm_profile_raw_version is discarded by LTO. Ensure the
17;; declaration is retained.
18; IRPGOBE: @__llvm_profile_raw_version = external hidden constant i64
19
20target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
21target triple = "x86_64-unknown-linux-gnu"
22
23$f = comdat any
24
25; Function Attrs: nofree norecurse nosync nounwind readnone uwtable willreturn mustprogress
26define i32 @f() {
27entry:
28  ret i32 1
29}
30
31!llvm.module.flags = !{!0}
32!0 = !{i32 1, !"ThinLTO", i32 0}
33