[Bug 276170] LLVM bug prevents from enabling PGO optimization for Python 3.11+

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 31 Dec 2024 00:44:54 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276170

--- Comment #31 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
(In reply to Guillaume Outters from comment #30)

I tried the following with the final WANRINGs at the end shown
below:

# tar -xpf Python-3.13.1.tar.xz -C ./
# cd Python-3.13.1
# ./configure --enable-optimizations
. . .
configure: WARNING: pkg-config is missing. Some dependencies may not be
detected correctly.
configure: WARNING:

Platform "aarch64-unknown-freebsd15.0" with compiler "clang" is not supported
by the
CPython core team, see https://peps.python.org/pep-0011/ for more information.

I then did the same in another directory tree, using
export CC=clang before the "./configure --enable-optimizations".

I also captured and diff'd the outputs of the 2 runs,
other than "cc" vs. "clang" text, they matched.

# diff -rq Python-3.13.1-noCC/ Python-3.13.1-CC_clang/ | more
Files Python-3.13.1-noCC/Makefile and Python-3.13.1-CC_clang/Makefile differ
Files Python-3.13.1-noCC/Makefile.pre and Python-3.13.1-CC_clang/Makefile.pre
differ
Files Python-3.13.1-noCC/config.log and Python-3.13.1-CC_clang/config.log
differ
Files Python-3.13.1-noCC/config.status and Python-3.13.1-CC_clang/config.status
differ

There are interesting Makefile differences and
Makefile.pre differences, both, in part, tied
to PGO_* and LLVM_PROF_* definition differences:

# diff -r Python-3.13.1-noCC/ Python-3.13.1-CC_clang/ | less
diff -r Python-3.13.1-noCC/Makefile Python-3.13.1-CC_clang/Makefile
38,39c38,39
< CC=           cc -pthread
< CXX=          c++ -pthread
---
> CC=           clang -pthread
> CXX=          clang++ -pthread
51,54c51,54
< PGO_PROF_GEN_FLAG=
< PGO_PROF_USE_FLAG=
< LLVM_PROF_MERGER=
< LLVM_PROF_FILE=
---
> PGO_PROF_GEN_FLAG=-fprofile-instr-generate
> PGO_PROF_USE_FLAG=-fprofile-instr-use="$(shell pwd)/code.profclangd"
> LLVM_PROF_MERGER= /usr/bin/llvm-profdata merge -output="$(shell pwd)/code.profclangd" "$(shell pwd)"/*.profclangr 
> LLVM_PROF_FILE=LLVM_PROFILE_FILE="$(shell pwd)/code-%p.profclangr"
377c377
< CONFIG_ARGS=   '--enable-optimizations'
---
> CONFIG_ARGS=   '--enable-optimizations' 'CC=clang'

diff -r Python-3.13.1-noCC/Makefile.pre Python-3.13.1-CC_clang/Makefile.pre
37,38c37,38
< CC=           cc -pthread
< CXX=          c++ -pthread
---
> CC=           clang -pthread
> CXX=          clang++ -pthread
50,53c50,53
< PGO_PROF_GEN_FLAG=
< PGO_PROF_USE_FLAG=
< LLVM_PROF_MERGER=
< LLVM_PROF_FILE=
---
> PGO_PROF_GEN_FLAG=-fprofile-instr-generate
> PGO_PROF_USE_FLAG=-fprofile-instr-use="$(shell pwd)/code.profclangd"
> LLVM_PROF_MERGER= /usr/bin/llvm-profdata merge -output="$(shell pwd)/code.profclangd" "$(shell pwd)"/*.profclangr 
> LLVM_PROF_FILE=LLVM_PROFILE_FILE="$(shell pwd)/code-%p.profclangr"
376c376
< CONFIG_ARGS=   '--enable-optimizations'
---
> CONFIG_ARGS=   '--enable-optimizations' 'CC=clang'

This much does not seem to be a FreeBSD issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.