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

Chris Lattner lattner at cs.uiuc.edu
Sat Mar 18 21:46:16 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.322 -> 1.323
---
Log message:

Don't bother storing undef elements of BUILD_VECTOR's


---
Diffs of the changes:  (+9 -1)

 LegalizeDAG.cpp |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.322 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.323
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.322	Sat Mar 18 22:18:56 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Sat Mar 18 23:46:04 2006
@@ -794,6 +794,9 @@
       unsigned VectorSize = MVT::getSizeInBits(VT)/8;
       // Store (in the right endianness) the elements to memory.
       for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {
+        // Ignore undef elements.
+        if (Node->getOperand(i).getOpcode() == ISD::UNDEF) continue;
+        
         unsigned Offset;
         if (isLittleEndian) 
           Offset = TypeByteSize*i;
@@ -807,7 +810,12 @@
                                      Node->getOperand(i), Idx, 
                                      DAG.getSrcValue(NULL)));
       }
-      SDOperand StoreChain = DAG.getNode(ISD::TokenFactor, MVT::Other, Stores);
+      
+      SDOperand StoreChain;
+      if (!Stores.empty())    // Not all undef elements?
+        StoreChain = DAG.getNode(ISD::TokenFactor, MVT::Other, Stores);
+      else
+        StoreChain = DAG.getEntryNode();
       
       // Result is a load from the stack slot.
       Result = DAG.getLoad(VT, StoreChain, FIPtr, DAG.getSrcValue(0));






More information about the llvm-commits mailing list