Skip to content

Commit

Permalink
Add loop optimizations for windows builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex313031 authored Dec 10, 2021
1 parent 2b3a7da commit bd3da08
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1896,6 +1896,32 @@ if (is_win) {
]
}
common_optimize_on_ldflags = []

common_optimize_on_cflags += [
"-mllvm", "-extra-vectorizer-passes",
"-mllvm", "-enable-cond-stores-vec",
"-mllvm", "-slp-vectorize-hor-store",
"-mllvm", "-enable-loopinterchange",
"-mllvm", "-enable-loop-distribute",
"-mllvm", "-enable-unroll-and-jam",
"-mllvm", "-enable-loop-flatten",
"-mllvm", "-interleave-small-loop-scalar-reduction",
"-mllvm", "-unroll-runtime-multi-exit",
"-mllvm", "-aggressive-ext-opt",
]

common_optimize_on_ldflags += [
"-mllvm:-extra-vectorizer-passes",
"-mllvm:-enable-cond-stores-vec",
"-mllvm:-slp-vectorize-hor-store",
"-mllvm:-enable-loopinterchange",
"-mllvm:-enable-loop-distribute",
"-mllvm:-enable-unroll-and-jam",
"-mllvm:-enable-loop-flatten",
"-mllvm:-interleave-small-loop-scalar-reduction",
"-mllvm:-unroll-runtime-multi-exit",
"-mllvm:-aggressive-ext-opt",
]

# /OPT:ICF is not desirable in Debug builds, since code-folding can result in
# misleading symbols in stack traces.
Expand Down Expand Up @@ -2104,7 +2130,7 @@ config("optimize_max") {
if (is_win) {
# Favor speed over size, /O2 must be before the common flags.
# /O2 implies /Ot, /Oi, and /GF.
cflags = [ "/O2" ] + common_optimize_on_cflags
cflags = [ "-Xclang", "-O3" ] + common_optimize_on_cflags
} else if (optimize_for_fuzzing) {
cflags = [ "-O1" ] + common_optimize_on_cflags
} else {
Expand Down Expand Up @@ -2137,7 +2163,7 @@ config("optimize_speed") {
if (is_win) {
# Favor speed over size, /O2 must be before the common flags.
# /O2 implies /Ot, /Oi, and /GF.
cflags = [ "/O2" ] + common_optimize_on_cflags
cflags = [ "-Xclang", "-O3" ] + common_optimize_on_cflags
} else if (optimize_for_fuzzing) {
cflags = [ "-O1" ] + common_optimize_on_cflags
} else {
Expand Down

0 comments on commit bd3da08

Please sign in to comment.