[PATCH] D129822: [Support] Workaround compiler bug in MSVC

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 17:38:32 PDT 2022


tstellar created this revision.
tstellar added a reviewer: RKSimon.
Herald added a subscriber: hiraditya.
Herald added a project: All.
tstellar requested review of this revision.
Herald added a project: LLVM.

https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/159731

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129822

Files:
  llvm/lib/Support/NativeFormatting.cpp


Index: llvm/lib/Support/NativeFormatting.cpp
===================================================================
--- llvm/lib/Support/NativeFormatting.cpp
+++ llvm/lib/Support/NativeFormatting.cpp
@@ -262,5 +262,11 @@
   case FloatStyle::Percent:
     return 2; // Number of decimal places.
   }
+  // Workaround for MSVC bug:
+  // 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
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129822.444847.patch
Type: text/x-patch
Size: 588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220715/16a6c885/attachment.bin>


More information about the llvm-commits mailing list