Commit aa2865de authored by Adenilson Cavalcanti's avatar Adenilson Cavalcanti Committed by Commit Bot

[zlib] Enable compiler optimized flags on whole zlib

This change enables building zlib using -O3 for the remaining code [1]
including the portable files (e.g. deflate.c, etc).

[1] We were already using optimize_speed for the majority of SIMD code
and this CL extends that to build the same code we ship to users.

Bug: 1084371
Change-Id: I02b0da7d0849478714bb7e3388c0d218fd13ecda
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2197140Reviewed-by: default avatarAdenilson Cavalcanti <cavalcantii@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771209}
parent ae1987df
...@@ -18,6 +18,11 @@ config("zlib_config") { ...@@ -18,6 +18,11 @@ config("zlib_config") {
config("zlib_internal_config") { config("zlib_internal_config") {
defines = [ "ZLIB_IMPLEMENTATION" ] defines = [ "ZLIB_IMPLEMENTATION" ]
if (!is_debug) {
# Build code using -O3, see: crbug.com/1084371.
configs = [ "//build/config/compiler:optimize_speed" ]
}
} }
use_arm_neon_optimizations = false use_arm_neon_optimizations = false
...@@ -67,12 +72,6 @@ source_set("zlib_adler32_simd") { ...@@ -67,12 +72,6 @@ source_set("zlib_adler32_simd") {
"adler32_simd.c", "adler32_simd.c",
"adler32_simd.h", "adler32_simd.h",
] ]
if (!is_debug) {
# Use optimize_speed (-O3) to output the _smallest_ code.
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_speed" ]
}
} }
configs += [ ":zlib_internal_config" ] configs += [ ":zlib_internal_config" ]
...@@ -117,11 +116,6 @@ if (use_arm_neon_optimizations) { ...@@ -117,11 +116,6 @@ if (use_arm_neon_optimizations) {
"crc32_simd.c", "crc32_simd.c",
"crc32_simd.h", "crc32_simd.h",
] ]
if (!is_debug) {
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_speed" ]
}
} }
configs += [ ":zlib_internal_config" ] configs += [ ":zlib_internal_config" ]
...@@ -160,13 +154,6 @@ source_set("zlib_inflate_chunk_simd") { ...@@ -160,13 +154,6 @@ source_set("zlib_inflate_chunk_simd") {
"contrib/optimizations/inffast_chunk.h", "contrib/optimizations/inffast_chunk.h",
"contrib/optimizations/inflate.c", "contrib/optimizations/inflate.c",
] ]
if (use_arm_neon_optimizations && !is_debug) {
# Here we trade better performance on newer/bigger ARMv8 cores
# for less perf on ARMv7, per crbug.com/772870#c40
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_speed" ]
}
} }
configs += [ ":zlib_internal_config" ] configs += [ ":zlib_internal_config" ]
...@@ -392,7 +379,6 @@ executable("zlib_bench") { ...@@ -392,7 +379,6 @@ executable("zlib_bench") {
include_dirs = [ "." ] include_dirs = [ "." ]
sources = [ "contrib/bench/zlib_bench.cc" ] sources = [ "contrib/bench/zlib_bench.cc" ]
if (!is_debug) { if (!is_debug) {
configs -= [ "//build/config/compiler:default_optimization" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_speed" ] configs += [ "//build/config/compiler:optimize_speed" ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment