Add loop optimizations & instr_import_limit=100

This commit is contained in:
Alexander David Frick 2021-11-28 15:02:20 -06:00 committed by GitHub
parent 1141f632e1
commit 79ec95daa2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -579,30 +579,43 @@ config("compiler") {
}
cflags_c += [ "-std=${standard_prefix}11" ]
cflags_cc += [ "-std=${standard_prefix}++14" ]
} else if (!is_win && !is_nacl) {
# TODO(https://crbug.com/1273966): Use C++17 with is_cfi once
# https://chromium-review.googlesource.com/c/v8/v8/+/3304143/ is rolled in.
if ((is_nacl && !is_nacl_saigo) || is_cfi) {
# This is for the pnacl_newlib toolchain. It's only used to build
# a few independent ppapi test files that don't pull in any other
# dependencies.
cflags_cc += [
"-std=${standard_prefix}++14",
"-fno-trigraphs",
]
} else {
cflags_cc += [ "-std=${standard_prefix}++17" ]
}
} else if (is_win) {
cflags_cc += [ "/std:c++17" ]
} else if (!is_nacl) {
# TODO(mcgrathr) - the NaCl GCC toolchain doesn't support either gnu11/gnu++11
# or c11/c++11; we technically don't need this toolchain any more, but there
# are still a few buildbots using it, so until those are turned off
# we need the !is_nacl clause and the (is_nacl && is_clang) clause, above.
cflags_c += [ "-std=c11" ]
cflags_cc += [ "-std=c++14" ]
if (is_apple) {
# TODO(thakis): Use C++17 on macOS and iOS once it works.
cflags_cc += [
"-std=c++14",
"-fno-trigraphs",
]
} else {
cflags_cc += [ "-std=c++17" ]
}
}
# C++17 removes trigraph support, so preemptively disable trigraphs. This is
# especially useful given the collision with ecmascript's logical assignment
# operators: https://github.com/tc39/proposal-logical-assignment
if (is_clang && current_os != "zos") {
# clang-cl disables trigraphs by default
if (!is_win) {
# The gnu variants of C++11 and C++14 already disable trigraph support,
# but when building with clang, we use -std=c++11 / -std=c++14, which
# enables trigraph support: override that here.
cflags_cc += [ "-fno-trigraphs" ]
}
# Don't warn that trigraphs are ignored, since trigraphs are disabled
# anyway.
# C++17 removes trigraph support, but clang still warns that it ignores
# them when seeing them. Don't.
cflags_cc += [ "-Wno-trigraphs" ]
}
@ -675,9 +688,9 @@ config("compiler") {
# bloat of ThinLTO to <10%, but that's potentially no longer true.
# FIXME(inglorion): maybe tune these?
if (target_cpu == "arm" || target_cpu == "arm64") {
import_instr_limit = 30
import_instr_limit = 100
} else {
import_instr_limit = 30
import_instr_limit = 100
}
}
@ -890,6 +903,10 @@ config("compiler_cpu_abi") {
cflags += [ "--target=aarch64-linux-gnu" ]
ldflags += [ "--target=aarch64-linux-gnu" ]
}
if (is_android) {
# Outline atomics crash on Exynos 9810. http://crbug.com/1272795
cflags += [ "-mno-outline-atomics" ]
}
} else if (current_cpu == "mipsel" && !is_nacl) {
ldflags += [ "-Wl,--hash-style=sysv" ]
if (custom_toolchain == "") {
@ -1265,7 +1282,7 @@ config("compiler_deterministic") {
# Tells the compiler not to use absolute paths when passing the default
# paths to the tools it invokes. We don't want this because we don't
# really need it and it can mess up the goma cache entries.
if (is_clang && !is_nacl) {
if (is_clang && (!is_nacl || is_nacl_saigo)) {
cflags += [ "-no-canonical-prefixes" ]
# Same for links: Let the compiler driver invoke the linker
@ -1599,12 +1616,12 @@ config("chromium_code") {
# TODO(thakis): Enable this more often, https://crbug.com/346399
# use_libfuzzer: https://crbug.com/1063180
if (!is_nacl && !use_libfuzzer) {
if ((!is_nacl || is_nacl_saigo) && !use_libfuzzer) {
cflags += [ "-Wunreachable-code-aggressive" ]
}
# Thread safety analysis is broken under nacl: https://crbug.com/982423.
if (!is_nacl) {
if (!is_nacl || is_nacl_saigo) {
cflags += [
# Thread safety analysis. See base/thread_annotations.h and
# https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
@ -1689,7 +1706,7 @@ config("no_chromium_code") {
config("noshadowing") {
# This flag has to be disabled for nacl because the nacl compiler is too
# strict about shadowing.
if (is_clang && !is_nacl) {
if (is_clang && (!is_nacl || is_nacl_saigo)) {
cflags = [ "-Wshadow" ]
}
}
@ -1927,7 +1944,7 @@ if (is_win) {
"-fdata-sections",
"-ffunction-sections",
]
if (!is_nacl && is_clang) {
if ((!is_nacl || is_nacl_saigo) && is_clang) {
# We don't care about unique section names, this makes object files a bit
# smaller.
common_optimize_on_cflags += [ "-fno-unique-section-names" ]
@ -1983,8 +2000,6 @@ config("optimize") {
}
} else if (optimize_for_size) {
# Favor size over speed.
# TODO(crbug.com/718650): Fix -Os in PNaCl compiler and remove the is_nacl
# guard above.
if (is_clang) {
cflags = [ "-O3" ] + common_optimize_on_cflags
} else {
@ -2330,7 +2345,7 @@ config("symbols") {
}
}
if (is_clang && !is_nacl && current_os != "zos") {
if (is_clang && (!is_nacl || is_nacl_saigo) && current_os != "zos") {
if (is_apple) {
# TODO(https://crbug.com/1050118): Investigate missing debug info on mac.
# Make sure we don't use constructor homing on mac.
@ -2424,7 +2439,7 @@ config("minimal_symbols") {
# names in the final debug information.
config("no_symbols") {
if (is_win) {
ldflags = [ "/DEBUG:NONE" ]
ldflags = [ "/DEBUG" ]
# All configs using /DEBUG should include this:
configs = [ ":win_pdbaltpath" ]