[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Jim Laskey jlaskey at apple.com
Wed Aug 17 12:28:38 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.145 -> 1.146
---
Log message:

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


 


---
Diffs of the changes:  (+3 -14)

 SelectionDAG.cpp |   17 +++--------------
 1 files changed, 3 insertions(+), 14 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.145 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.146
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.145	Wed Aug 17 14:00:20 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Wed Aug 17 14:28:27 2005
@@ -224,12 +224,8 @@
                                          N->getValueType(0)));
     break;
   case ISD::ConstantFP: {
-    union {
-      double DV;
-      uint64_t IV;
-    };
-    DV = cast<ConstantFPSDNode>(N)->getValue();
-    ConstantFPs.erase(std::make_pair(IV, N->getValueType(0)));
+    uint64_t V = DoubleToBits(cast<ConstantFPSDNode>(N)->getValue());
+    ConstantFPs.erase(std::make_pair(V, N->getValueType(0)));
     break;
   }
   case ISD::CONDCODE:
@@ -385,14 +381,7 @@
   // Do the map lookup using the actual bit pattern for the floating point
   // value, so that we don't have problems with 0.0 comparing equal to -0.0, and
   // we don't have issues with SNANs.
-  union {
-    double DV;
-    uint64_t IV;
-  };
-
-  DV = Val;
-
-  SDNode *&N = ConstantFPs[std::make_pair(IV, VT)];
+  SDNode *&N = ConstantFPs[std::make_pair(DoubleToBits(Val), VT)];
   if (N) return SDOperand(N, 0);
   N = new ConstantFPSDNode(Val, VT);
   AllNodes.push_back(N);






More information about the llvm-commits mailing list