From ec8f4fd68cd401a0ba41bb160d6acce670486fab Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 26 Jul 2022 12:50:56 -0700 Subject: [PATCH] [Support] Workaround compiler bug in MSVC https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317 This was causing unittest failures on Windows for the GitHub actions based CI we use in the release branches. Failed Tests (2): LLVM-Unit :: Support/./SupportTests.exe/FormatVariadicTest.BigTest LLVM-Unit :: Support/./SupportTests.exe/NativeFormatTest.BoundaryTests Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D129822 --- llvm/lib/Support/NativeFormatting.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/lib/Support/NativeFormatting.cpp b/llvm/lib/Support/NativeFormatting.cpp index 8a69f75..e9854d0 100644 --- a/llvm/lib/Support/NativeFormatting.cpp +++ b/llvm/lib/Support/NativeFormatting.cpp @@ -262,5 +262,11 @@ size_t llvm::getDefaultPrecision(FloatStyle Style) { case FloatStyle::Percent: return 2; // Number of decimal places. } + // Workaround for MSVC bug in VS2022: + // https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317 + // llvm_unreachable expands to __assume(false) with MSVC which triggers the + // bug. +#ifndef _MSC_VER llvm_unreachable("Unknown FloatStyle enum"); +#endif } -- 2.7.4