Skip to content

Commit

Permalink
SCons: Remove redundant -fomit-frame-pointer and -ftree-vectorize
Browse files Browse the repository at this point in the history
- `-fomit-frame-pointer` is included automatically by both GCC and
  Clang in `-O1` and above.
- `-ftree-vectorize` is included automatically by GCC in `-O2` and
  beyond, and seems always enabled by Clang.

Closes godotengine#66296. See that issue for a detailed investigation.

(cherry picked from commit c5c3d13)
  • Loading branch information
akien-mga authored and timothyqiu committed Dec 4, 2022
1 parent 2ef0052 commit b18ef4d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions platform/android/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,10 @@ def configure(env):
# `-O2` is more friendly to debuggers than `-O3`, leading to better crash backtraces
# when using `target=release_debug`.
opt = "-O3" if env["target"] == "release" else "-O2"
env.Append(CCFLAGS=[opt, "-fomit-frame-pointer"])
env.Append(CCFLAGS=[opt])
elif env["optimize"] == "size": # optimize for size
env.Append(CCFLAGS=["-Oz"])
env.Append(CPPDEFINES=["NDEBUG"])
env.Append(CCFLAGS=["-ftree-vectorize"])
elif env["target"] == "debug":
env.Append(LINKFLAGS=["-O0"])
env.Append(CCFLAGS=["-O0", "-g", "-fno-limit-debug-info"])
Expand Down
4 changes: 2 additions & 2 deletions platform/iphone/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def configure(env):
# `-O2` is more friendly to debuggers than `-O3`, leading to better crash backtraces
# when using `target=release_debug`.
opt = "-O3" if env["target"] == "release" else "-O2"
env.Append(CCFLAGS=[opt, "-ftree-vectorize", "-fomit-frame-pointer"])
env.Append(CCFLAGS=[opt])
env.Append(LINKFLAGS=[opt])
elif env["optimize"] == "size": # optimize for size
env.Append(CCFLAGS=["-Os", "-ftree-vectorize"])
env.Append(CCFLAGS=["-Os"])
env.Append(LINKFLAGS=["-Os"])

elif env["target"] == "debug":
Expand Down
4 changes: 2 additions & 2 deletions platform/osx/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def configure(env):

if env["target"] == "release":
if env["optimize"] == "speed": # optimize for speed (default)
env.Prepend(CCFLAGS=["-O3", "-fomit-frame-pointer", "-ftree-vectorize"])
env.Prepend(CCFLAGS=["-O3"])
elif env["optimize"] == "size": # optimize for size
env.Prepend(CCFLAGS=["-Os", "-ftree-vectorize"])
env.Prepend(CCFLAGS=["-Os"])
if env["arch"] != "arm64":
env.Prepend(CCFLAGS=["-msse2"])

Expand Down

0 comments on commit b18ef4d

Please sign in to comment.