[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp

Jim Laskey jlaskey at apple.com
Wed Aug 17 12:33:42 PDT 2005



Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.180 -> 1.181
---
Log message:

Culling out use of unions for converting FP to bits and vice versa.


 


---
Diffs of the changes:  (+2 -10)

 AsmWriter.cpp |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.180 llvm/lib/VMCore/AsmWriter.cpp:1.181
--- llvm/lib/VMCore/AsmWriter.cpp:1.180	Sat Jun 18 13:34:52 2005
+++ llvm/lib/VMCore/AsmWriter.cpp	Wed Aug 17 14:33:31 2005
@@ -29,6 +29,7 @@
 #include "llvm/Support/CFG.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/MathExtras.h"
 #include <algorithm>
 using namespace llvm;
 
@@ -431,18 +432,9 @@
 
     // Otherwise we could not reparse it to exactly the same value, so we must
     // output the string in hexadecimal format!
-    //
-    // Behave nicely in the face of C TBAA rules... see:
-    // http://www.nullstone.com/htmls/category/aliastyp.htm
-    //
-    union {
-      double D;
-      uint64_t U;
-    } V;
-    V.D = CFP->getValue();
     assert(sizeof(double) == sizeof(uint64_t) &&
            "assuming that double is 64 bits!");
-    Out << "0x" << utohexstr(V.U);
+    Out << "0x" << utohexstr(DoubleToBits(CFP->getValue()));
 
   } else if (isa<ConstantAggregateZero>(CV)) {
     Out << "zeroinitializer";






More information about the llvm-commits mailing list