Skip to content

Adjust MSVC version range for ARM64 build performance regression #90731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

lxbndr
Copy link
Contributor

@lxbndr lxbndr commented May 1, 2024

This is follow up for #65215

Mentioned regression was fixed in MSVC 19.39 (VS 17.9.0), so it makes sense to not apply fix for that (and newer) compiler versions.

Same as original change, this patch is narrowly scoped to not affect any other compiler.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:codegen IR generation bugs: mangling, exceptions, etc. labels May 1, 2024
@llvmbot
Copy link
Member

llvmbot commented May 1, 2024

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-codegen

Author: Alexander Smarus (lxbndr)

Changes

This is follow up for #65215

Mentioned regression was fixed in MSVC 19.39 (VS 17.9.0), so it makes sense to not apply fix for that (and newer) compiler versions.

Same as original change, this patch is narrowly scoped to not affect any other compiler.


Full diff: https://github.com/llvm/llvm-project/pull/90731.diff

2 Files Affected:

  • (modified) clang/lib/CodeGen/CMakeLists.txt (+1)
  • (modified) clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt (+1)
diff --git a/clang/lib/CodeGen/CMakeLists.txt b/clang/lib/CodeGen/CMakeLists.txt
index 52216d93a302bb..760fc540f7fa8e 100644
--- a/clang/lib/CodeGen/CMakeLists.txt
+++ b/clang/lib/CodeGen/CMakeLists.txt
@@ -39,6 +39,7 @@ set(LLVM_LINK_COMPONENTS
 # our goal is to disable the /Og flag while retaining the other optimizations from the /O1|/O2 set
 if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES Clang
     AND MSVC_VERSION VERSION_GREATER_EQUAL 1932
+    AND MSVC_VERSION VERSION_LESS 1939
     AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64")
 
   string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
diff --git a/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt b/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt
index ed323ab3528b10..4d01a0850a074b 100644
--- a/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt
+++ b/clang/lib/Tooling/Inclusions/Stdlib/CMakeLists.txt
@@ -4,6 +4,7 @@
 # our goal is to disable the /Og flag while retaining the other optimizations from the /O1|/O2 set
 if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES Clang
     AND MSVC_VERSION VERSION_GREATER_EQUAL 1932
+    AND MSVC_VERSION VERSION_LESS 1939
     AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64")
 
   string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)

@MaxEW707 MaxEW707 requested a review from tru June 22, 2024 03:46
Copy link
Contributor

@MaxEW707 MaxEW707 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Looks CI failed due to MSVC "fatal error C1060: compiler is out of heap space" inside a flang source file.

I would try syncing upto main since I know flang has had quite of changes that overall reduce MSVC's memory usage at least anecdotally from my personal PRs that failed in similar files around the time this PR was made.

@lxbndr lxbndr force-pushed the readdle/msvc-not-slow-arm64 branch from ff8c635 to 52fe3d3 Compare June 22, 2024 12:35
@lxbndr
Copy link
Contributor Author

lxbndr commented Jun 22, 2024

Rebased on latest main. Let's see what CI say.

@MaxEW707
Copy link
Contributor

Rebased on latest main. Let's see what CI say.

Looks like CI is happy. Do you need someone to commit the change on your behalf or do you have commit access?

@MaxEW707 MaxEW707 merged commit 437366b into llvm:main Jun 25, 2024
7 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 25, 2024

LLVM Buildbot has detected a new failure on builder clang-aarch64-lld-2stage running on linaro-clang-aarch64-lld-2stage while building clang at step 6 "build stage 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/121/builds/120

Here is the relevant piece of the build log for the reference:

Step 6 (build stage 1) failure: 'ninja' (failure)
...
[5266/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Feature.cpp.o
[5267/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/FileDistance.cpp.o
[5268/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Compiler.cpp.o
[5269/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/FS.cpp.o
[5270/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/CompileCommands.cpp.o
[5271/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/FuzzyMatch.cpp.o
[5272/5880] Linking CXX executable bin/tool-template
[5273/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/ASTSignals.cpp.o
[5274/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/HeuristicResolver.cpp.o
[5275/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Format.cpp.o
FAILED: tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Format.cpp.o 
/usr/local/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/clang-aarch64-lld-2stage/stage1/tools/clang/tools/extra/clangd -I/home/tcwg-buildbot/worker/clang-aarch64-lld-2stage/llvm/clang-tools-extra/clangd -I/home/tcwg-buildbot/worker/clang-aarch64-lld-2stage/llvm/clang-tools-extra/clangd/../include-cleaner/include -I/home/tcwg-buildbot/worker/clang-aarch64-lld-2stage/stage1/tools/clang/tools/extra/clangd/../clang-tidy -I/home/tcwg-buildbot/worker/clang-aarch64-lld-2stage/llvm/clang/include -I/home/tcwg-buildbot/worker/clang-aarch64-lld-2stage/stage1/tools/clang/include -I/home/tcwg-buildbot/worker/clang-aarch64-lld-2stage/stage1/include -I/home/tcwg-buildbot/worker/clang-aarch64-lld-2stage/llvm/llvm/include -I/home/tcwg-buildbot/worker/clang-aarch64-lld-2stage/llvm/clang-tools-extra/pseudo/lib/../include -mcpu=cortex-a57 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Format.cpp.o -MF tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Format.cpp.o.d -o tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Format.cpp.o -c /home/tcwg-buildbot/worker/clang-aarch64-lld-2stage/llvm/clang-tools-extra/clangd/Format.cpp
../llvm/clang-tools-extra/clangd/Format.cpp:284:11: error: no member named 'KeepEmptyLinesAtTheStartOfBlocks' in 'clang::format::FormatStyle'
  284 |     Style.KeepEmptyLinesAtTheStartOfBlocks = true;
      |     ~~~~~ ^
1 error generated.
[5276/5880] Building CXX object tools/clang/tools/extra/clang-move/CMakeFiles/obj.clangMove.dir/Move.cpp.o
[5277/5880] Building CXX object tools/clang/tools/extra/include-cleaner/lib/CMakeFiles/obj.clangIncludeCleaner.dir/WalkAST.cpp.o
[5278/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/CollectMacros.cpp.o
[5279/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/GlobalCompilationDatabase.cpp.o
[5280/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/FindSymbols.cpp.o
[5281/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Headers.cpp.o
[5282/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/HeaderSourceSwitch.cpp.o
[5283/5880] Building CXX object tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/AddUsing.cpp.o
[5284/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/ClangdServer.cpp.o
[5285/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Diagnostics.cpp.o
[5286/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/CodeComplete.cpp.o
[5287/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Hover.cpp.o
[5288/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/ClangdLSPServer.cpp.o
[5289/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/DumpAST.cpp.o
[5290/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/AST.cpp.o
[5291/5880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/FindTarget.cpp.o
ninja: build stopped: subcommand failed.

@lxbndr lxbndr deleted the readdle/msvc-not-slow-arm64 branch June 25, 2024 19:54
AlexisPerry pushed a commit to llvm-project-tlp/llvm-project that referenced this pull request Jul 9, 2024
…m#90731)

This is follow up for llvm#65215

Mentioned regression was fixed in MSVC 19.39 (VS 17.9.0), so it makes
sense to not apply fix for that (and newer) compiler versions.

Same as original change, this patch is narrowly scoped to not affect any
other compiler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc. clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants