brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 4490c45 Raw
33 lines · plain
1! Tests for -fprofile-generate and -fprofile-use flag compatibility. These two2! flags behave similarly to their GCC counterparts:3!4! -fprofile-generate         Generates the profile file ./default.profraw5! -fprofile-use=<dir>/file   Uses the profile file <dir>/file6 7! On AIX, -flto used to be required with -fprofile-generate. gcc-flag-compatibility-aix.c is used to do the testing on AIX with -flto8! RUN: %flang %s -c -S -o - -emit-llvm -fprofile-generate | FileCheck -check-prefix=PROFILE-GEN %s9! PROFILE-GEN: @__profc_{{_?}}main = {{(private|internal)}} global [1 x i64] zeroinitializer, section10! PROFILE-GEN: @__profd_{{_?}}main =11 12! Check that -fprofile-use=some/path/file.prof reads some/path/file.prof13! This uses LLVM IR format profile.14! RUN: rm -rf %t.dir15! RUN: mkdir -p %t.dir/some/path16! RUN: llvm-profdata merge %S/Inputs/gcc-flag-compatibility_IR.proftext -o %t.dir/some/path/file.prof17! RUN: %flang %s -o - -emit-llvm -S -fprofile-use=%t.dir/some/path/file.prof | FileCheck -check-prefix=PROFILE-USE-IR1 %s18! RUN: llvm-profdata merge %S/Inputs/gcc-flag-compatibility_IR_entry.proftext -o %t.dir/some/path/file.prof19! RUN: %flang %s -o - -emit-llvm -S -fprofile-use=%t.dir/some/path/file.prof | FileCheck -check-prefix=PROFILE-USE-IR2 %s20! PROFILE-USE-IR1: = !{!"branch_weights", i32 100, i32 1}21! PROFILE-USE-IR2: = !{!"branch_weights", i32 1, i32 100}22 23program main24  implicit none25  integer :: i26  integer :: X = 027 28  do i = 0, 9929     X = X + i30  end do31 32end program main33