Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test.support patches
  • Loading branch information
arihant2math committed Apr 27, 2025
commit c03ff666826573dfbf7ff4defc90c5c2be704f1d
24 changes: 24 additions & 0 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,30 @@ def python_is_optimized():
final_opt = opt
return final_opt not in ('', '-O0', '-Og')

def check_cflags_pgo():
# Check if Python was built with ./configure --enable-optimizations:
# with Profile Guided Optimization (PGO).
cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST') or ''
pgo_options = [
# GCC
'-fprofile-use',
# clang: -fprofile-instr-use=code.profclangd
'-fprofile-instr-use',
# ICC
"-prof-use",
]
PGO_PROF_USE_FLAG = sysconfig.get_config_var('PGO_PROF_USE_FLAG')
if PGO_PROF_USE_FLAG:
pgo_options.append(PGO_PROF_USE_FLAG)
return any(option in cflags_nodist for option in pgo_options)

def check_bolt_optimized():
# Always return false, if the platform is WASI,
# because BOLT optimization does not support WASM binary.
if is_wasi:
return False
config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
return '--enable-bolt' in config_args

_header = 'nP'
_align = '0n'
Expand Down