[PATCH] D28112: [ADT] APFloatBase: Prevent collapsing semPPCDoubleDouble and semBogus

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 08:44:44 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL290896: [ADT] APFloatBase: Prevent collapsing semPPCDoubleDouble and semBogus (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D28112?vs=82483&id=82898#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28112

Files:
  llvm/trunk/lib/Support/APFloat.cpp


Index: llvm/trunk/lib/Support/APFloat.cpp
===================================================================
--- llvm/trunk/lib/Support/APFloat.cpp
+++ llvm/trunk/lib/Support/APFloat.cpp
@@ -76,8 +76,12 @@
      compile-time arithmetic on PPC double-double numbers, it is not able
      to represent all possible values held by a PPC double-double number,
      for example: (long double) 1.0 + (long double) 0x1p-106
-     Should this be replaced by a full emulation of PPC double-double?  */
-  static const fltSemantics semPPCDoubleDouble = {0, 0, 0, 0};
+     Should this be replaced by a full emulation of PPC double-double?
+
+     Note: we need to make the value different from semBogus as otherwise
+     an unsafe optimization may collapse both values to a single address,
+     and we heavily rely on them having distinct addresses.             */
+  static const fltSemantics semPPCDoubleDouble = {-1, 0, 0, 0};
 
   /* There are temporary semantics for the real PPCDoubleDouble implementation.
      Currently, APFloat of PPCDoubleDouble holds one PPCDoubleDoubleImpl as the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28112.82898.patch
Type: text/x-patch
Size: 1088 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170103/6029a94f/attachment.bin>


More information about the llvm-commits mailing list