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

Evan Cheng evan.cheng at apple.com
Thu Apr 27 01:29:55 PDT 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.227 -> 1.228
---
Log message:

Insert a VBIT_CONVERT between a FORMAL_ARGUMENT node and its vector uses
(VAND, VADD, etc.). Legalizer will assert otherwise.


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

 SelectionDAGISel.cpp |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.227 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.228
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.227	Tue Apr 25 18:03:35 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Thu Apr 27 03:29:42 2006
@@ -2372,7 +2372,7 @@
         // right now.
         unsigned NumElems = cast<PackedType>(I->getType())->getNumElements();
         const Type *EltTy = cast<PackedType>(I->getType())->getElementType();
-        
+
         // Figure out if there is a Packed type corresponding to this Vector
         // type.  If so, convert to the packed type.
         MVT::ValueType TVT = MVT::getVectorType(getValueType(EltTy), NumElems);
@@ -2441,7 +2441,7 @@
         // right now.
         unsigned NumElems = cast<PackedType>(I->getType())->getNumElements();
         const Type *EltTy = cast<PackedType>(I->getType())->getElementType();
-        
+
         // Figure out if there is a Packed type corresponding to this Vector
         // type.  If so, convert to the packed type.
         MVT::ValueType TVT = MVT::getVectorType(getValueType(EltTy), NumElems);
@@ -2987,7 +2987,20 @@
        AI != E; ++AI, ++a)
     if (!AI->use_empty()) {
       SDL.setValue(AI, Args[a]);
-      
+
+      MVT::ValueType VT = TLI.getValueType(AI->getType());
+      if (VT == MVT::Vector) {
+        // Insert a VBIT_CONVERT between the FORMAL_ARGUMENT node and its uses.
+        // Or else legalizer will balk.
+        BasicBlock::iterator InsertPt = BB->begin();
+        Value *NewVal = new CastInst(AI, AI->getType(), AI->getName(), InsertPt);
+        for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end();
+             UI != E; ++UI) {
+          Instruction *User = cast<Instruction>(*UI);
+          if (User != NewVal)
+            User->replaceUsesOfWith(AI, NewVal);
+        }
+      }
       // If this argument is live outside of the entry block, insert a copy from
       // whereever we got it to the vreg that other BB's will reference it as.
       if (FuncInfo.ValueMap.count(AI)) {






More information about the llvm-commits mailing list