[all-commits] [llvm/llvm-project] d27a21: Add IR Profile-Guided Optimization (IR PGO) suppor...

FYK via All-commits all-commits at lists.llvm.org
Fri May 30 07:14:14 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d27a210a77af63568db9f829702b4b2c98473a46
      https://github.com/llvm/llvm-project/commit/d27a210a77af63568db9f829702b4b2c98473a46
  Author: FYK <fanyikang at bosc.ac.cn>
  Date:   2025-05-30 (Fri, 30 May 2025)

  Changed paths:
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Basic/CodeGenOptions.h
    M clang/include/clang/Basic/ProfileList.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/Basic/ProfileList.cpp
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/CodeGen/CodeGenAction.cpp
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/ToolChains/Flang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M flang/include/flang/Frontend/CodeGenOptions.def
    M flang/include/flang/Frontend/CodeGenOptions.h
    M flang/lib/Frontend/CompilerInvocation.cpp
    M flang/lib/Frontend/FrontendActions.cpp
    M flang/test/Driver/flang-f-opts.f90
    A flang/test/Profile/Inputs/gcc-flag-compatibility_IR.proftext
    A flang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext
    A flang/test/Profile/gcc-flag-compatibility.f90
    M llvm/include/llvm/Frontend/Driver/CodeGenOptions.h
    M llvm/lib/Frontend/Driver/CodeGenOptions.cpp

  Log Message:
  -----------
  Add IR Profile-Guided Optimization (IR PGO) support to the Flang compiler (#136098)

This patch implements IR-based Profile-Guided Optimization support in
Flang through the following flags:

- `-fprofile-generate` for instrumentation-based profile generation

- `-fprofile-use=<dir>/file` for profile-guided optimization

Resolves #74216 (implements IR PGO support phase)

**Key changes:**

- Frontend flag handling aligned with Clang/GCC semantics

- Instrumentation hooks into LLVM PGO infrastructure

- LIT tests verifying:

    - Instrumentation metadata generation

    - Profile loading from specified path

    - Branch weight attribution (IR checks)

**Tests:**

- Added gcc-flag-compatibility.f90 test module verifying:

    -  Flag parsing boundary conditions

    -  IR-level profile annotation consistency

    -  Profile input path normalization rules

- SPEC2006 benchmark results will be shared in comments

For details on LLVM's PGO framework, refer to [Clang PGO
Documentation](https://clang.llvm.org/docs/UsersManual.html#profile-guided-optimization).

This implementation was developed by [XSCC Compiler
Team](https://github.com/orgs/OpenXiangShan/teams/xscc).

---------

Co-authored-by: ict-ql <168183727+ict-ql at users.noreply.github.com>
Co-authored-by: Tom Eccles <t at freedommail.info>



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