Skip to content

Commit 1334f88

Browse files
committed
[build-script] Only hard code the C/CXX flags for RelWithDebInfo builds.
This patch resolves some post-commit feedback from @llvmbeanz. Specifically, the only time that we need to hard code these flags are when compiling with RelWithDebInfo since we need extra control in that case to ensure that CMake does not sneak in a -g flag on the command line. This is important to ensure that we are compiling with -gline-tables-only instead of -g. Given that it is a performance fix specific to compiling with LTO with debug info, we should no perform such a change when compiling with: 1. MINRELSIZE since we do not ever perform that build. 2. RELEASE since it does not have debug info. 3. DEBUG since why would one perform an LTO build in DEBUG mode. In terms of 3, I can potentially imagine someone trying to compile Swift in Debug with LTO to try to debug an LTO bug, but I imagine such a test case to be such a rare need that there is no point in trying to make it faster.
1 parent b675ce9 commit 1334f88

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

utils/build-script-impl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,14 +1934,8 @@ for host in "${ALL_HOSTS[@]}"; do
19341934
"${cmake_options[@]}"
19351935
-DCMAKE_C_FLAGS="$(llvm_c_flags ${host})"
19361936
-DCMAKE_CXX_FLAGS="$(llvm_c_flags ${host})"
1937-
-DCMAKE_C_FLAGS_DEBUG=""
1938-
-DCMAKE_CXX_FLAGS_DEBUG=""
1939-
-DCMAKE_C_FLAGS_RELEASE="-O3"
1940-
-DCMAKE_CXX_FLAGS_RELEASE="-O3"
19411937
-DCMAKE_C_FLAGS_RELWITHDEBINFO="-O2"
19421938
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2"
1943-
-DCMAKE_C_FLAGS_MINSIZEREL="-Os"
1944-
-DCMAKE_CXX_FLAGS_MINSIZEREL="-Os"
19451939
-DCMAKE_BUILD_TYPE:STRING="${LLVM_BUILD_TYPE}"
19461940
-DLLVM_TOOL_SWIFT_BUILD:BOOL=NO
19471941
-DLLVM_INCLUDE_DOCS:BOOL=TRUE
@@ -2055,14 +2049,8 @@ for host in "${ALL_HOSTS[@]}"; do
20552049
"${cmake_options[@]}"
20562050
-DCMAKE_C_FLAGS="$(swift_c_flags ${host})"
20572051
-DCMAKE_CXX_FLAGS="$(swift_c_flags ${host})"
2058-
-DCMAKE_C_FLAGS_DEBUG=""
2059-
-DCMAKE_CXX_FLAGS_DEBUG=""
2060-
-DCMAKE_C_FLAGS_RELEASE="-O3"
2061-
-DCMAKE_CXX_FLAGS_RELEASE="-O3"
20622052
-DCMAKE_C_FLAGS_RELWITHDEBINFO="-O2"
20632053
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2"
2064-
-DCMAKE_C_FLAGS_MINSIZEREL="-Os"
2065-
-DCMAKE_CXX_FLAGS_MINSIZEREL="-Os"
20662054
-DCMAKE_BUILD_TYPE:STRING="${SWIFT_BUILD_TYPE}"
20672055
-DLLVM_ENABLE_ASSERTIONS:BOOL=$(true_false "${SWIFT_ENABLE_ASSERTIONS}")
20682056
-DSWIFT_ANALYZE_CODE_COVERAGE:STRING=$(toupper "${SWIFT_ANALYZE_CODE_COVERAGE}")

0 commit comments

Comments
 (0)