Skip to content

Conversation

@openroad-ci
Copy link
Collaborator

CMake

  • There were two LINK_TIME_OPTIMIZATION settings in CMakeLists.txt, which disables LTO by default.
  • Fixed it to make LTO on-by-default for CMake.

Bazel

  • LTO is off-by-default for Bazel. To enable LTO for Bazel, we should provide --config=opt. (e.g., bazel build //:openroad --config=opt).
  • The Bazel configuration to enable LTO only for -c opt and disable LTO for all other compile modes (e.g., -c fastbuild, -c dbg, etc) requires modification of all BUILD files.
  • Thus, rather than modifying the all BUILD files, implemented the LTO-on under --config=opt option.
  • Added the following notification message when --config=opt is not given.
image

Issue

Fixes #9050

Previous PRs

#9254
#9069

Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Note that the default build `bazel build //:openroad` does not use LTO.

Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the build configurations for both CMake and Bazel to control Link-Time Optimization (LTO). For CMake, LTO is now enabled by default, which should improve performance for release builds. For Bazel, LTO is now explicitly controlled by a --config=opt flag, and a helpful notification is added to inform users when it's not being used. The changes for Bazel are well-implemented. However, I have a concern regarding the CMake change. The removed code contained a comment about LTO interfering with Qt. Enabling LTO by default might break GUI builds. I've added a specific comment with a suggestion on how to address this potential issue.

I am having trouble creating individual review comments. Click here to see my feedback.

CMakeLists.txt (24-29)

high

The removed code block included a comment stating that LTO interferes with Qt (# Interfers with Qt so off by default.). By enabling LTO by default, this could potentially break GUI builds which use Qt.

Has this interference been resolved? If not, it would be safer to conditionally disable LTO when BUILD_GUI is enabled to avoid breaking existing functionality. For example, you could add logic to disable LINK_TIME_OPTIMIZATION if BUILD_GUI is true.

@jhkim-pii jhkim-pii requested a review from maliberty January 23, 2026 11:59
@jhkim-pii
Copy link
Contributor

By enabling LTO by default, this could potentially break GUI builds which use Qt. Has this interference been resolved?

Yes. LTO is disabled for GUI module.

@maliberty maliberty merged commit 963a66d into The-OpenROAD-Project:master Jan 23, 2026
13 checks passed
@maliberty maliberty deleted the secure-cmake-enable-lto branch January 23, 2026 15:29
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.

LTO-off blocks inlining of dbNetwork::dbToSta() and dbNetwork::staToDb()

3 participants