Skip to content

Commit f68f488

Browse files
committed
Add a few Compiler flags to optimize llvm-libc for binary size and math throughput performances
1 parent 1fc8b22 commit f68f488

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

tools/system_libs.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,22 @@ class llvmlibc(DebugLibrary, AsanInstrumentedLibrary, MTLibrary):
10081008
name = 'libllvmlibc'
10091009
never_force = True
10101010
includes = ['system/lib/llvm-libc']
1011-
cflags = ['-Os', '-DLIBC_NAMESPACE=__llvm_libc', '-DLLVM_LIBC', '-DLIBC_COPT_PUBLIC_PACKAGING']
1011+
cflags = [
1012+
"-Os",
1013+
"-DLIBC_NAMESPACE=__llvm_libc",
1014+
"-DLLVM_LIBC",
1015+
"-DLIBC_COPT_PUBLIC_PACKAGING",
1016+
# Disable accurate pass to speed up certain math operations
1017+
"-DLIBC_MATH=LIBC_MATH_FAST",
1018+
"-DLIBC_MATH_SKIP_ACCURATE_PASS",
1019+
"-D__LIBC_USE_BUILTIN_CEIL_FLOOR_RINT_TRUNC",
1020+
# Reduce size bloats from string conversions.
1021+
"-DLIBC_COPT_STRTOFLOAT_DISABLE_EISEL_LEMIRE",
1022+
# Enable FMA
1023+
"-Wno-unused-variable",
1024+
"-mrelaxed-simd",
1025+
"-ffast-math",
1026+
]
10121027

10131028
def get_files(self):
10141029
files = glob_in_path('system/lib/llvm-libc/src/assert', '*.cpp')

0 commit comments

Comments
 (0)