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

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

--- Comment #39 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
The stable/14 test context got:

[00:00:07] [01] [00:00:00] Building   lang/python310 | python310-3.10.16
[00:07:55] [01] [00:07:48] Finished   lang/python310 | python310-3.10.16:
Success

for:

# cat ~/mmjnk.txt
diff --git a/lang/python310/Makefile b/lang/python310/Makefile
index b352e8a2f9d7..f09113380dcc 100644
--- a/lang/python310/Makefile
+++ b/lang/python310/Makefile
@@ -27,8 +27,10 @@ SHEBANG_FILES+=      Lib/test/ziptestdata/exe_with_z64 \

 DISABLED_EXTENSIONS=   _sqlite3 _tkinter _gdbm
 CONFIGURE_ARGS+=       --enable-shared --without-ensurepip \
-                       --with-system-ffi
-CONFIGURE_ENV+=                OPT="" # Null out OPT to respect user CFLAGS
and remove optimizations
+                       --with-system-ffi --enable-optimizations
+CONFIGURE_ENV+=                CC=clang
+#CONFIGURE_ENV+=               OPT="" # Null out OPT to respect user CFLAGS
and remove optimizations
+CFLAGS+=               -O3

 INSTALL_TARGET=                altinstall                                     
        # Don't want cloberring of unprefixed files

@@ -45,7 +47,7 @@ PLIST_SUB=            ABI=${ABIFLAGS} \
                        OSMAJOR=${OSVERSION:C/([0-9]*)[0-9]{5}/\1/}            
# For plat-freebsd* in pkg-plist. https://bugs.python.org/issue19554

 OPTIONS_DEFINE=                DEBUG IPV6 LIBMPDEC LTO NLS PYMALLOC
-OPTIONS_DEFAULT=       LIBMPDEC PYMALLOC
+OPTIONS_DEFAULT=       LIBMPDEC PYMALLOC LTO
 OPTIONS_EXCLUDE_riscv64=       LTO
 OPTIONS_RADIO=         HASH
 OPTIONS_RADIO_HASH=    FNV SIPHASH

that had commands like:

clang -pthread -c -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG
-g -fwrapv -O3 -Wall -O2 -pipe  -O3 -fstack-protector-strong
-fno-strict-aliasing   -flto -g -std=c99 -Wextra -Wno-unused-result
-Wno-unused-parameter -Wno-missing-field-initializers
-Werror=implicit-function-declaration -fvisibility=hidden
-fprofile-instr-generate -I./Include/internal  -I. -I./Include
-I/usr/local/include -I/usr/local/include -fPIC -DPy_BUILD_CORE -o
Programs/python.o ./Programs/python.c

So, the order: -O3 -O2 -O3

It does not appear like -O3 leads to any crashes for LLVM19's clang.

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