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

Jim Laskey jlaskey at apple.com
Wed Aug 17 12:27:34 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.166 -> 1.167
---
Log message:

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




---
Diffs of the changes:  (+6 -12)

 LegalizeDAG.cpp |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.166 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.167
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.166	Wed Aug 17 12:42:52 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Wed Aug 17 14:27:23 2005
@@ -975,23 +975,17 @@
     // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr'
     if (ConstantFPSDNode *CFP =dyn_cast<ConstantFPSDNode>(Node->getOperand(1))){
       if (CFP->getValueType(0) == MVT::f32) {
-        union {
-          unsigned I;
-          float    F;
-        } V;
-        V.F = CFP->getValue();
         Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1,
-                             DAG.getConstant(V.I, MVT::i32), Tmp2,
+                             DAG.getConstant(FloatToBits(CFP->getValue()),
+                                             MVT::i32),
+                             Tmp2,
                              Node->getOperand(3));
       } else {
         assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!");
-        union {
-          uint64_t I;
-          double   F;
-        } V;
-        V.F = CFP->getValue();
         Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1,
-                             DAG.getConstant(V.I, MVT::i64), Tmp2,
+                             DAG.getConstant(DoubleToBits(CFP->getValue()),
+                                             MVT::i64),
+                             Tmp2,
                              Node->getOperand(3));
       }
       Node = Result.Val;






More information about the llvm-commits mailing list