Note: The LLVM compilers provide a wide array of compiler options, occasionally described in detail and readily available at https://clang.llvm.org/docs/ClangCommandLineReference.html and https://flang.llvm.org/docs/FlangCommandLineReference.html. This SPEC CPU flags file contains excerpts from and brief summaries of portions of that documentation.
SPEC's modifications are:
Copyright 2026 Standard Performance Evaluation Corporation
Permission is granted to copy, distribute and/or modify this document under the terms of the Apache v2.0 License with LLVM Exceptions.
Selecting one of the following will take you directly to that section:
Enables a range of optimizations that provide faster, though sometimes less precise, mathematical operations.
Omit the frame pointer from functions that don't need it. Some stack unwinding cases, such as profilers and sanitizers, may prefer specifying -fno-omit-frame-pointer. On many targets, -O1 and higher omit the frame pointer by default.
Enable Link Time Optimization.
Enable handling of OpenMP directives and generate parallel code.
When OpenMP is enabled, this flag selects the version of the OpenMP standard to support.
This flag enables mapping Fortran DO CONCURRENT loops to OpenMP. It has 3 possible values:
The -fdo-concurrent-to-openmp compiler switch is currently available only when OpenMP is also enabled.
Instruments code to collect information for profile-driven feedback. Information is collected regarding both code paths and data values.
Applies information from a profile run in order to improve optimization. Several optimizations are improved when profile data is available, including branch probabilities, loop peeling, and loop unrolling.
The language standards set aliasing requirements: programmers are expected to follow conventions so that the compiler can keep track of memory. If a program violates the requirements (for example, using pointer arithmetic), programs may crash, or (worse) wrong answers may be silently produced.
The -fno-strict-aliasing switch instructs the optimizer that it must not assume that the aliasing requirements from the standard are met by the current program.
Produce debugging information.
This flag instructs the compiler driver to use LLVM's lld linker instead of the default (usually ld) linker.
This selects the LLVM libc++ STL over the default GNU libstdc++.
This selects the LLVM libc++ STL static library over the dynamic library.
Link with libjemalloc, a fast, arena-based memory allocator.
Compiles for a 32-bit (LP32) data model.
Compiles for a 64-bit (LP64) data model.
On x86 systems, allows use of instructions that require the listed architecture.
Depending on target system type, may be a synonym for -mtune or -march.
Sets the target architecture and operating system when cross-compiling.
Tunes code based on the timing characteristics of the listed processor.
Specify the architecture which should be targeted. On some systems may be specified multiple times to make "fat" binaries.
Enable all optimizations of -O3 plus optimizations that are not valid for standard-compliant programs, such as re-ordering
operations without regard to parentheses.
Many more details are available.
Increases optimization levels: the higher the number, the more optimization is done. Higher levels of optimization may
require additional compilation time, in the hopes of reducing execution time. At -O, basic optimizations are performed,
such as constant merging and elimination of dead code. At -O2, additional optimizations are added, such as common
subexpression elimination and strict aliasing. At -O3, even more optimizations are performed, such as function inlining and
vectorization.
Many more details are available.
Same as -O1
Enable support for POSIX Threads. Note that C++ programs using std::thread may require this flag.
Sets the language standard to the specified version, for example c18, c++17, f2008.
Disables warnings about functions lacking prototypes.
Add the specified directory to the runtime library search path used when linking an ELF executable with shared objects.
Ensure that there are no surprises if the benchmarks are run in an environment where file system metadata uses 64 bits.
Use big-endian representation for unformatted files. This is important when reading data files that were originally generated in big-endian format.
Disables a range of optimizations that provide faster, though sometimes less precise, mathematical operations.
A SPEC CPU config file might use this flag in combination with -Ofast, to specify that all the optimizations of -Ofast are desired, with the exception of -ffast-math.
You may need to use this flag in order to get certain benchmarks to validate. If it is needed, the normal rules about portability flags apply.
Do not allow optimizations for floating-point arithmetic that assume that arguments and results are not NaNs or +-Infs.
A SPEC CPU config file might use this flag in combination with -Ofast, to specify that all the optimizations of -Ofast are desired, with the exception of -ffinite-math-only.
You may need to use this flag in order to get certain benchmarks to validate. If it is needed, the normal rules about portability flags apply.
Do not allow optimizations which require the reciprocal of a value to be used instead of dividing by the value.
A SPEC CPU config file might use this flag in combination with -Ofast, to specify that all the optimizations of -Ofast are desired, with the exception of -freciprocal-math.
Do not allow reassociation of floating point operations.
A SPEC CPU config file might use this flag in combination with -Ofast, to specify that all the optimizations of -Ofast are desired, with the exception of -fassociative-math.
On some systems, this flag is required to get support for std::filesystem.
Invokes the clang C compiler.
Invokes the flang Fortran compiler.
Invokes the clang++ C++ compiler.
Add the specified path to the list of paths that the linker will search for archive libraries and control scripts.
Add the specified path to the list of paths embedded in the binary that the linker will search by default when looking for library dependencies.
Setting this macro instructs the libc++ header files to minimize the number of header files that are included transitively (i.e. without being explicitly included by the source file being compiled). It's neither an optimization nor portability, as its only function is to identify cases where a function is used without its required header file being explicitly included. It should probably not be used for actual reportable runs. It's definitely not needed.
Enables warnings.
SPECrate runs might use one of these methods to bind processes to specific processors, depending on the config file.
Linux systems: the numactl command is commonly used. Here is a brief guide to understanding the specific command which will be found in the config file:
macOS systems: processes are not bound.
No special commands are needed for feedback-directed optimization, other than the compiler profile flags.
One or more of the following may have been used in the run. If so, it will be listed in the notes sections. Here is a brief guide to understanding them:
LD_LIBRARY_PATH=<directories> (set via config file preENV)
LD_LIBRARY_PATH controls the search order for libraries. Often, it can be defaulted. Sometimes, it is
explicitly set (as documented in the notes in the submission) in order to ensure that the correct versions of
libraries are picked up.
OMP_STACKSIZE=N (set via config file preENV)
Set the stack size for subordinate OpenMP threads.
ulimit -s N
ulimit -s unlimited
'ulimit' is a Unix command, entered prior to the run. It sets the stack size for the main process and its children,
either to N kbytes or to no limit.
MALLOC_CONF=thp:always,metadata_thp:always (set via config file preENV)
MALLOC_CONF controls jemalloc behavior.
The "thp" option controls whether heap allocations jemalloc does use transparent huge pages, if THP is supported by the operating system. The "always" setting enables transparent hugepage for all user memory mappings with MADV_HUGEPAGE; "never" ensures no transparent hugepage with MADV_NOHUGEPAGE; the default setting "default" makes no changes.
The "metadata_thp" option controls whether to allow jemalloc to use transparent huge pages (THP) for internal metadata. The "always" setting allows such usage. The "auto" setting uses no THP initially, but may begin to do so when metadata usage reaches certain level. The default is "disabled".