vcpkg/ports/llvm/0006-workaround-msvc-bug.patch
yurybura e95a7a8dc0
[llvm] update to 11.0.0 (#13998)
* [vcpkg] allow to use semicolons in COMMAND argument

* [llvm] update to 11.0.0

* [vcpkg] use latest version

* [vcpkg] allow to use semicolons in OPTIONS

* fix vcpkg_fixup_cmake_targets

* [llvm] fix more install paths, add /bigobj option, fix up CMake targets

* Apply suggestions from code review

* [llvm] fix clang, flang, lld, mlir and polly CMake targets

* [llvm] remove empty include directory /include/flang/Config

* [llvm] Flang requires C++17

* [llvm] add /Zc:__cplusplus

* [llvm] remove empty include directory include/clang-tidy/plugin

* [llvm] try to fix ClangConfig.cmake, LLVMConfig.cmake, LLDConfig.cmake etc. with patch

* [llvm] set tools install dir to tools/llvm

* [aws-sdk-cpp] fix build after changes in vcpkg_configure_cmake.cmake

* [llvm] disable Flang and OpenMP on Windows

Co-authored-by: Nicole Mazzuca <mazzucan@outlook.com>
2020-11-30 09:56:22 -08:00

40 lines
1.7 KiB
Diff

diff --git a/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp b/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
--- a/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
@@ -10,6 +10,17 @@
//
//===----------------------------------------------------------------------===//
+// Disable optimizations to work around MSVC debug mode bug in 32-bit:
+// https://developercommunity.visualstudio.com/content/problem/1179643/msvc-copies-overaligned-non-trivially-copyable-par.html
+// FIXME: Remove this when the issue is closed.
+#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_IX86)
+// We have to disable runtime checks in order to enable optimizations. This is
+// done for the entire file because the problem is actually observed in STL
+// template functions.
+#pragma runtime_checks("", off)
+#pragma optimize("gs", on)
+#endif
+
#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
using namespace llvm;
diff --git a/llvm/unittests/CodeGen/GlobalISel/LegalizerInfoTest.cpp b/llvm/unittests/CodeGen/GlobalISel/LegalizerInfoTest.cpp
--- a/llvm/unittests/CodeGen/GlobalISel/LegalizerInfoTest.cpp
+++ b/llvm/unittests/CodeGen/GlobalISel/LegalizerInfoTest.cpp
@@ -406,3 +406,13 @@
32, 8, AtomicOrdering::NotAtomic }));
}
}
+
+// This code sequence doesn't do anything, but it covers a previously uncovered
+// codepath that used to crash in MSVC x86_32 debug mode.
+TEST(LegalizerInfoTest, MSVCDebugMiscompile) {
+ const LLT S1 = LLT::scalar(1);
+ const LLT P0 = LLT::pointer(0, 32);
+ LegalizerInfo LI;
+ auto Builder = LI.getActionDefinitionsBuilder(TargetOpcode::G_PTRTOINT);
+ (void)Builder.legalForCartesianProduct({S1}, {P0});
+}