[PATCH] D34797: [profile] Move __llvm_profile_filename into a separate object
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 29 10:33:43 PDT 2017
You should remove O3 in clang_pgogen command or add O3 in clang_profuse
step. IR PGO requires matching pipelines.
David
On Thu, Jun 29, 2017 at 10:31 AM, Vedant Kumar via Phabricator <
reviews at reviews.llvm.org> wrote:
> vsk updated this revision to Diff 104678.
> vsk added a comment.
>
> Address David's review comment. I could not use the exact same test
> structure for IR PGO due to what seems like a spurious hash mismatch (see
> the FIXME).
>
>
> https://reviews.llvm.org/D34797
>
> Files:
> lib/profile/CMakeLists.txt
> lib/profile/InstrProfiling.c
> lib/profile/InstrProfilingNameVar.c
> test/profile/instrprof-override-filename.c
>
>
> Index: test/profile/instrprof-override-filename.c
> ===================================================================
> --- test/profile/instrprof-override-filename.c
> +++ test/profile/instrprof-override-filename.c
> @@ -1,14 +1,24 @@
> -// RUN: %clang_profgen=%t.profraw -o %t -O3 %s
> -// RUN: %run %t %t.profraw
> -// RUN: llvm-profdata merge -o %t.profdata %t.profraw
> -// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
> +// RUN: rm -rf %t.dir && mkdir -p %t.dir
> +// RUN: cd %t.dir
> +//
> +// RUN: %clang_profgen=P_RAW -o %t -O3 %s
> +// RUN: %run %t P_RAW
> +// RUN: llvm-profdata merge -o %t.profdata P_RAW
> +// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
> --check-prefix=FE
> +//
> +// RUN: %clang_pgogen=I_RAW -o %t.2 -O3 %s
> +// RUN: %run %t.2 I_RAW
> +// RUN: llvm-profdata merge -o %t2.profdata I_RAW
> +//
> +// FIXME: IRPGO states that there is a hash mismatch in main, and does
> not produce
> +// branch weight metadata: %clang_profuse=%t2.profdata -o - -S -emit-llvm
> %s
>
> void bar() {}
> int main(int argc, const char *argv[]) {
> - // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof
> ![[PD1:[0-9]+]]
> + // FE: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof
> ![[PD1:[0-9]+]]
> if (argc < 2)
> return 1;
> bar();
> return 0;
> }
> -// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
> +// FE: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
> Index: lib/profile/InstrProfilingNameVar.c
> ===================================================================
> --- /dev/null
> +++ lib/profile/InstrProfilingNameVar.c
> @@ -0,0 +1,18 @@
> +//===- InstrProfilingNameVar.c - profile name variable setup
> --------------===//
> +//
> +// The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
> +//===------------------------------------------------------
> ----------------===//
> +
> +#include "InstrProfiling.h"
> +
> +/* char __llvm_profile_filename[1]
> + *
> + * The runtime should only provide its own definition of this symbol when
> the
> + * user has not specified one. Set this up by moving the runtime's copy
> of this
> + * symbol to an object file within the archive.
> + */
> +COMPILER_RT_WEAK char INSTR_PROF_PROFILE_NAME_VAR[1] = {0};
> Index: lib/profile/InstrProfiling.c
> ===================================================================
> --- lib/profile/InstrProfiling.c
> +++ lib/profile/InstrProfiling.c
> @@ -19,8 +19,6 @@
>
> COMPILER_RT_WEAK uint64_t INSTR_PROF_RAW_VERSION_VAR =
> INSTR_PROF_RAW_VERSION;
>
> -COMPILER_RT_WEAK char INSTR_PROF_PROFILE_NAME_VAR[1] = {0};
> -
> COMPILER_RT_VISIBILITY uint64_t __llvm_profile_get_magic(void) {
> return sizeof(void *) == sizeof(uint64_t) ? (INSTR_PROF_RAW_MAGIC_64)
> : (INSTR_PROF_RAW_MAGIC_32);
> Index: lib/profile/CMakeLists.txt
> ===================================================================
> --- lib/profile/CMakeLists.txt
> +++ lib/profile/CMakeLists.txt
> @@ -48,6 +48,7 @@
> InstrProfilingFile.c
> InstrProfilingMerge.c
> InstrProfilingMergeFile.c
> + InstrProfilingNameVar.c
> InstrProfilingWriter.c
> InstrProfilingPlatformDarwin.c
> InstrProfilingPlatformLinux.c
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170629/43d76968/attachment.html>
More information about the llvm-commits
mailing list