[clang] [MSVC] work-around for compile time issue 102513 (PR #110986)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 04:39:24 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: bd1976bris (bd1976bris)

<details>
<summary>Changes</summary>

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: https://github.com/llvm/llvm-project/issues/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
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

``````````

</details>


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


More information about the cfe-commits mailing list