xref: /llvm-project/llvm/test/Transforms/PGOProfile/preinline.ll (revision 41d5033eb162cb92b684855166cabfa3983b74c6)
1cee313d2SEric Christopher; RUN: opt < %s -O2 -pgo-kind=pgo-instr-gen-pipeline -S | FileCheck %s --check-prefix=GEN
2cee313d2SEric Christopher; RUN: opt < %s -O2 -pgo-kind=pgo-instr-gen-pipeline -profile-file=default.profraw -S | FileCheck %s --check-prefix=GEN
37b1d7937SAmy Huangtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
4cee313d2SEric Christophertarget triple = "x86_64-unknown-linux-gnu"
5cee313d2SEric Christopher
6cee313d2SEric Christopherdefine i32 @foo(i32 %i) {
7cee313d2SEric Christopherentry:
8*41d5033eSNikita Popov; GEN: %pgocount = load i64, ptr @__profc_foo
9*41d5033eSNikita Popov; GEN-NOT: %pgocount.i = load i64, ptr @__profc__stdin__bar
10cee313d2SEric Christopher  %call = call i32 @bar()
11cee313d2SEric Christopher  %add = add nsw i32 %i, %call
12cee313d2SEric Christopher  ret i32 %add
13cee313d2SEric Christopher}
14cee313d2SEric Christopher
15cee313d2SEric Christopherdefine internal i32 @bar() {
16cee313d2SEric Christopher; check that bar is inlined into foo and eliminiated from IR.
17cee313d2SEric Christopher; GEN-NOT: define internal i32 @bar
18cee313d2SEric Christopherentry:
19cee313d2SEric Christopher  %call = call i32 (...) @bar1()
20cee313d2SEric Christopher  ret i32 %call
21cee313d2SEric Christopher}
22cee313d2SEric Christopher
23cee313d2SEric Christopherdeclare i32 @bar1(...)
24