classification
Title: ./configure --enable-optimizations should enable LTO
Type: Stage:
Components: Build Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: corona10, ned.deily, pablogsal, vstinner
Priority: normal Keywords:

Created on 2021-10-05 09:32 by vstinner, last changed 2021-10-11 14:32 by corona10.

Messages (6)
msg403209 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-10-05 09:32
When Python is configured with:

   ./configure --enable-optimizations

PGO is enabled but not LTO.

I recall that a few years ago, GCC with LTO had bugs. But now, GCC with LTO is reliable. I suggest to enable it by default in Python 3.11.

Or did I miss a reason to not do that?
msg403210 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-10-05 09:34
IIRC activating lto is specially annoying on MacOS due to the need of some llvm components that are a bit hard to get. Let me dig a bit to see if I reproduce the problem
msg403211 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-10-05 09:38
Pablo:
> IIRC activating lto is specially annoying on MacOS due to the need of some llvm components that are a bit hard to get. Let me dig a bit to see if I reproduce the problem

Ah, I guess that you are referring to this requirement:
"The C compiler Clang requires llvm-ar for LTO (ar on macOS), as well as an LTO-aware linker (ld.gold or lld)."
https://docs.python.org/dev/using/configure.html#cmdoption-with-lto

Maybe configure can enable LTO on all platforms but macOS.
msg403244 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-10-05 15:49
> IIRC activating lto is specially annoying on MacOS due to the need of some llvm components that are a bit hard to get

Can you say more? We are currently using --with-lto with a vanilla Apple Command Line Tools (or Xcode) for macOS installer builds when building on macOS 10.15 High Sierra or higher.  Perhaps this was just an issue on older versions.
msg403248 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-10-05 16:12
Yeah, I had problems in the past to get llvm-ar or some other component. I still need time to reproduce and to see if this still happens on new versions.
msg403249 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-10-05 16:15
I don't think you need llvm-ar anymore with the Apple Tool Chain but let me look into it as I have all the relevant previous macOS releases as VMs to test with.
History
Date User Action Args
2021-10-11 14:32:35corona10setnosy: + corona10
2021-10-05 16:15:00ned.deilysetmessages: + msg403249
2021-10-05 16:12:11pablogsalsetmessages: + msg403248
2021-10-05 15:49:28ned.deilysetnosy: + ned.deily
messages: + msg403244
2021-10-05 09:38:32vstinnersetmessages: + msg403211
2021-10-05 09:34:55pablogsalsetnosy: + pablogsal
messages: + msg403210
2021-10-05 09:32:25vstinnercreate