Skip to content

Conversation

bd1976bris
Copy link
Collaborator

@bd1976bris bd1976bris commented Oct 3, 2024

Disable optimizations when building clang/lib/AST/ByteCode/Interp.cpp with Microsoft's compiler as it has a bug that causes excessive build times. We do this only when NDEBUG is not defined on the assumption that building without asserts indicates that a user is strongly invested in runtime performance.

Partially addresses: #102513.

Once the bug is addressed in the Microsoft compiler this can be removed.

Disable optimizations when building with Microsoft's compiler as it has a bug that causes excessive build times. We do this only when NDEBUG is not defined on the assumption that building without asserts indicates that a user is strongly invested in runtime performance.

Partially addresses: llvm#102513.

Once the bug is addressed in the Microsoft compiler this can be removed.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Oct 3, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 3, 2024

@llvm/pr-subscribers-clang

Author: bd1976bris (bd1976bris)

Changes

Disable optimizations when building with Microsoft's compiler as it has a bug that causes excessive build times. We do this only when NDEBUG is not defined on the assumption that building without asserts indicates that a user is strongly invested in runtime performance.

Partially addresses: #102513.

Once the bug is addressed in the Microsoft compiler this can be removed.


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

1 Files Affected:

  • (modified) clang/lib/AST/ByteCode/Interp.cpp (+8)
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index fd9a256843a0ec..38d52e93181fbc 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -1406,6 +1406,10 @@ bool handleFixedPointOverflow(InterpState &S, CodePtr OpPC,
   return S.noteUndefinedBehavior();
 }
 
+// https://github.com/llvm/llvm-project/issues/102513
+#if defined(_WIN32) && !defined(__clang__) && !defined(NDEBUG)
+#pragma optimize("", off)
+#endif
 bool Interpret(InterpState &S, APValue &Result) {
   // The current stack frame when we started Interpret().
   // This is being used by the ops to determine wheter
@@ -1430,6 +1434,10 @@ bool Interpret(InterpState &S, APValue &Result) {
     }
   }
 }
+// https://github.com/llvm/llvm-project/issues/102513
+#if defined (_MSC_VER)
+#pragma optimize("", on)
+#endif
 
 } // namespace interp
 } // namespace clang

Copy link

github-actions bot commented Oct 3, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Collaborator

@rnk rnk left a comment

Choose a reason for hiding this comment

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

Thanks!

@tbaederr
Copy link
Contributor

tbaederr commented Oct 4, 2024

Generally LGTM.

@bd1976bris bd1976bris requested a review from dyung October 4, 2024 13:56
@bd1976bris bd1976bris merged commit d205191 into llvm:main Oct 4, 2024
9 checks passed
@bd1976bris bd1976bris deleted the bd1976bris/main/issue-102513 branch October 4, 2024 13:59
@bd1976bris bd1976bris added this to the LLVM 19.X Release milestone Oct 4, 2024
@bd1976bris
Copy link
Collaborator Author

/cherry-pick d205191

@llvmbot
Copy link
Member

llvmbot commented Oct 4, 2024

Failed to cherry-pick: d205191

https://github.com/llvm/llvm-project/actions/runs/11181614249

Please manually backport the fix and push it to your github fork. Once this is done, please create a pull request

@llvmbot
Copy link
Member

llvmbot commented Oct 4, 2024

Failed to cherry-pick: d205191

https://github.com/llvm/llvm-project/actions/runs/11181632525

Please manually backport the fix and push it to your github fork. Once this is done, please create a pull request

bd1976bris added a commit to bd1976bris/llvm-project that referenced this pull request Oct 6, 2024
Manual cherry-pick of llvm#110986 to the LLVM 19 release branch.
vitalybuka added a commit to llvm/llvm-zorg that referenced this pull request Oct 8, 2024
For #102513

It should not be needed after llvm/llvm-project#110986.

This reverts commit 73d07e0.
This reverts commit d0f4769.
vitalybuka added a commit to llvm/llvm-zorg that referenced this pull request Oct 8, 2024
For #102513

It should not be needed after
llvm/llvm-project#110986.

This reverts commit 73d07e0.
This reverts commit d0f4769.
RKSimon added a commit to RKSimon/llvm-project that referenced this pull request Nov 7, 2024
…builds

Similar to llvm#110986 - disabling inlining on MSVC release builds avoids an excessive build time issue affecting all recent versions of CL.EXE

Fixes llvm#114425
RKSimon added a commit to RKSimon/llvm-project that referenced this pull request Nov 7, 2024
…builds

Similar to llvm#110986 - disabling inlining on MSVC release builds avoids an excessive build time issue affecting all recent versions of CL.EXE

Fixes llvm#114425
RKSimon added a commit that referenced this pull request Nov 7, 2024
…builds (#115292)

Similar to #110986 - disabling inlining on MSVC release builds avoids an excessive build time issue affecting all recent versions of CL.EXE

Fixes #114425
Groverkss pushed a commit to iree-org/llvm-project that referenced this pull request Nov 15, 2024
…builds (llvm#115292)

Similar to llvm#110986 - disabling inlining on MSVC release builds avoids an excessive build time issue affecting all recent versions of CL.EXE

Fixes llvm#114425
tru pushed a commit that referenced this pull request Nov 18, 2024
Manual cherry-pick of #110986 to the LLVM 19 release branch.
RKSimon added a commit to RKSimon/llvm-project that referenced this pull request Nov 18, 2024
Alter the #ifdef values from llvm#110986 and llvm#115292 to use _MSC_VER instead of _WIN32 to stop the pragmas being used on gcc/mingw builds

Noticed by @mstorsjo
nikic pushed a commit to rust-lang/llvm-project that referenced this pull request Nov 20, 2024
Manual cherry-pick of llvm#110986 to the LLVM 19 release branch.
RKSimon added a commit to RKSimon/llvm-project that referenced this pull request Nov 21, 2024
Alter the #ifdef values from llvm#110986 and llvm#115292 to use _MSC_VER instead of _WIN32 to stop the pragmas being used on gcc/mingw builds

Noticed by @mstorsjo
RKSimon added a commit that referenced this pull request Nov 21, 2024
Alter the #ifdef values from #110986 and #115292 to use _MSC_VER instead of _WIN32 to stop the pragmas being used on gcc/mingw builds

Noticed by @mstorsjo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category release:cherry-pick-failed
Projects
Development

Successfully merging this pull request may close these issues.

4 participants