Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.463 -> 1.464 --- Log message: Implement vec_shuffle.ll:test3 --- Diffs of the changes: (+17 -2) InstructionCombining.cpp | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.463 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.464 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.463 Mon Apr 10 17:45:52 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 10 18:06:36 2006 @@ -6779,7 +6779,8 @@ static Value *FindScalarElement(Value *V, unsigned EltNo) { assert(isa<PackedType>(V->getType()) && "Not looking at a vector?"); const PackedType *PTy = cast<PackedType>(V->getType()); - if (EltNo >= PTy->getNumElements()) // Out of range access. + unsigned Width = PTy->getNumElements(); + if (EltNo >= Width) // Out of range access. return UndefValue::get(PTy->getElementType()); if (isa<UndefValue>(V)) @@ -6800,6 +6801,19 @@ // Otherwise, the insertelement doesn't modify the value, recurse on its // vector input. return FindScalarElement(III->getOperand(0), EltNo); + } else if (ShuffleVectorInst *SVI = dyn_cast<ShuffleVectorInst>(V)) { + if (isa<ConstantAggregateZero>(SVI->getOperand(2))) { + return FindScalarElement(SVI->getOperand(0), 0); + } else if (ConstantPacked *CP = + dyn_cast<ConstantPacked>(SVI->getOperand(2))) { + if (isa<UndefValue>(CP->getOperand(EltNo))) + return UndefValue::get(PTy->getElementType()); + unsigned InEl = cast<ConstantUInt>(CP->getOperand(EltNo))->getValue(); + if (InEl < Width) + return FindScalarElement(SVI->getOperand(0), InEl); + else + return FindScalarElement(SVI->getOperand(1), InEl - Width); + } } // Otherwise, we don't know. @@ -6831,9 +6845,10 @@ // If extracting a specified index from the vector, see if we can recursively // find a previously computed scalar that was inserted into the vector. - if (ConstantUInt *IdxC = dyn_cast<ConstantUInt>(EI.getOperand(1))) + if (ConstantUInt *IdxC = dyn_cast<ConstantUInt>(EI.getOperand(1))) { if (Value *Elt = FindScalarElement(EI.getOperand(0), IdxC->getValue())) return ReplaceInstUsesWith(EI, Elt); + } if (Instruction *I = dyn_cast<Instruction>(EI.getOperand(0))) if (I->hasOneUse()) { _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits