diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2006-04-27 08:29:42 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2006-04-27 08:29:42 +0000 |
| commit | 3784f3c57cf1bb0228fec534c087f172ccbeebd7 (patch) | |
| tree | f18955f31ff5b4a7d27e6c68f41160a80fa53fe1 /llvm/lib/CodeGen | |
| parent | bb0be98fed8e820ce0a8382a375b6b0e29540da7 (diff) | |
| download | bcm5719-llvm-3784f3c57cf1bb0228fec534c087f172ccbeebd7.tar.gz bcm5719-llvm-3784f3c57cf1bb0228fec534c087f172ccbeebd7.zip | |
Insert a VBIT_CONVERT between a FORMAL_ARGUMENT node and its vector uses
(VAND, VADD, etc.). Legalizer will assert otherwise.
llvm-svn: 27991
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index a128ae081c4..5a97aa6b399 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2372,7 +2372,7 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) { // 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 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) { // 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 @@ LowerArguments(BasicBlock *BB, SelectionDAGLowering &SDL, 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)) { |

