[all-commits] [llvm/llvm-project] 839b91: [clang] Move `-fprofile-instrument-use-path=` chec...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Mon Oct 6 10:42:08 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 839b91c2294b4aeb5598309f90afa241ace5acef
      https://github.com/llvm/llvm-project/commit/839b91c2294b4aeb5598309f90afa241ace5acef
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2025-10-06 (Mon, 06 Oct 2025)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/test/CodeGen/cspgo-instrumentation.c
    M clang/test/CodeGen/cspgo-instrumentation_lto.c
    M clang/test/CodeGen/cspgo-instrumentation_thinlto.c
    M clang/test/CodeGen/opt-record.c
    M clang/test/CodeGen/pgo-instrumentation.c
    M clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
    M clang/test/CodeGenCXX/profile-remap.cpp
    M clang/test/DebugInfo/CXX/fdebug-info-for-profiling.cpp
    A clang/test/Driver/Inputs/a.proftext
    M clang/test/Driver/cl-options.c
    M clang/test/Driver/clang_f_opts.c
    M clang/test/Driver/fcs-profile-generate.c
    M clang/test/Driver/fsplit-machine-functions.c
    M clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
    M clang/test/Profile/c-captured.c
    M clang/test/Profile/c-counter-overflows.c
    M clang/test/Profile/c-general.c
    M clang/test/Profile/c-outdated-data.c
    M clang/test/Profile/c-unprofiled-blocks.c
    M clang/test/Profile/c-unprofiled.c
    M clang/test/Profile/cxx-class.cpp
    M clang/test/Profile/cxx-hash-v2.cpp
    M clang/test/Profile/cxx-lambda.cpp
    M clang/test/Profile/cxx-missing-bodies.cpp
    M clang/test/Profile/cxx-never-executed-branch.cpp
    M clang/test/Profile/cxx-rangefor.cpp
    M clang/test/Profile/cxx-templates.cpp
    M clang/test/Profile/cxx-throws.cpp
    M clang/test/Profile/func-entry.c
    M clang/test/Profile/misexpect-branch-cold.c
    M clang/test/Profile/misexpect-branch-nonconst-expected-val.c
    M clang/test/Profile/misexpect-branch-unpredictable.c
    M clang/test/Profile/misexpect-branch.c
    M clang/test/Profile/misexpect-switch-default.c
    M clang/test/Profile/misexpect-switch-nonconst.c
    M clang/test/Profile/misexpect-switch-only-default-case.c
    M clang/test/Profile/misexpect-switch.c
    M clang/test/Profile/objc-general.m
    M clang/test/Profile/profile-does-not-exist-ir.c
    M clang/test/Profile/profile-does-not-exist.c
    M clang/test/Profile/profile-summary.c

  Log Message:
  -----------
  [clang] Move `-fprofile-instrument-use-path=` check to driver (#159667)

The frontend currently opens the path provided via
`-fprofile-instrument-use-path=` to learn the kind of the
instrumentation data and set the `CodeGenOptions::ProfileUse` value.
This happens during command-line parsing, where we don't have a
correctly configured VFS yet, so the behavior is quite different from
all other frontend inputs. We need to move this logic out of the
frontend command line parsing logic somewhere where we do have the
configured VFS.

The complication is that the `ProfileUse` flag is being used to set
preprocessor macros, and there isn't a great place between command line
parsing and preprocessor initialization to perform this logic.

This PR solves the issue by deducing the kind of instrumentation data
right in the driver and then passing it via a new flag to the frontend.
This shouldn't change observable behavior of Clang on the driver level,
and only affects the frontend command line interface, which is an
implementation detail anyway.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list