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

Chris Lattner sabre at nondot.org
Mon Dec 11 20:19:12 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.429 -> 1.430
---
Log message:

Revert Nate's patch to fix X86/store-fp-constant.ll.  With the dag combiner
and legalizer separated like they currently are, I don't see a way to handle
this xform.


---
Diffs of the changes:  (+18 -0)

 LegalizeDAG.cpp |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.429 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.430
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.429	Mon Dec 11 19:17:40 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Mon Dec 11 22:18:56 2006
@@ -1648,6 +1648,24 @@
     Tmp2 = LegalizeOp(ST->getBasePtr());  // Legalize the pointer.
 
     if (!ST->isTruncatingStore()) {
+      // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr'
+      // FIXME: We shouldn't do this for TargetConstantFP's.
+      // FIXME: move this to the DAG Combiner!  Note that we can't regress due
+      // to phase ordering between legalized code and the dag combiner.  This
+      // probably means that we need to integrate dag combiner and legalizer
+      // together.
+      if (ConstantFPSDNode *CFP = dyn_cast<ConstantFPSDNode>(ST->getValue())) {
+        if (CFP->getValueType(0) == MVT::f32) {
+          Tmp3 = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32);
+        } else {
+          assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!");
+          Tmp3 = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64);
+        }
+        Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(),
+                              ST->getSrcValueOffset());
+        break;
+      }
+      
       switch (getTypeAction(ST->getStoredVT())) {
       case Legal: {
         Tmp3 = LegalizeOp(ST->getValue());






More information about the llvm-commits mailing list