Skip to content

Conversation

@StephanDollberg
Copy link
Member

@StephanDollberg StephanDollberg commented Feb 4, 2026

PGO is the main release build so enable LTO only then. Saves some time
in the basic release build.

Also disable fat lto objects. There is no point in using them anymore as
the PGO build isn't shared with anything anyway.

This speeds up both the non-PGO and PGO build and also reduces object
sizes.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v25.3.x
  • v25.2.x
  • v25.1.x

Release Notes

  • none

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes Redpanda's build configuration by enabling Link Time Optimization (LTO) exclusively for Profile-Guided Optimization (PGO) builds, rather than for all release builds. This change improves build times for standard release builds while maintaining optimization for the primary PGO release builds.

Changes:

  • Moved LTO flags from general release configuration to PGO-specific configuration
  • Removed -ffat-lto-objects flag as it's no longer needed
  • Introduced new pgo-base configuration to consolidate PGO-specific LTO settings

PGO is the main release build so enable LTO only then. Saves some time
in the basic release build.

Also disable fat lto objects. There is no point in using them anymore as
the PGO build isn't shared with anything anyway.

This speeds up both the non-PGO and PGO build and also reduces object
sizes.
# bazel seems to pass -fprofile-correction unconditionally but that only exists
# in gcc so need to make clang ignore it
build:pgo-optimize --copt -Wno-ignored-optimization-argument
build:pgo-optimize --config=pgo-base --copt -Wno-ignored-optimization-argument
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

details on ignored-optimization-arg?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I didn't notice it wasn't added in this change

@StephanDollberg StephanDollberg merged commit 721069b into dev Feb 4, 2026
18 checks passed
@StephanDollberg StephanDollberg deleted the stephan/lto-pgo branch February 4, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants