Home | History | Annotate | Download | only in InstCombine

Lines Matching refs:SVI

58 static std::vector<int> getShuffleMask(const ShuffleVectorInst *SVI) {
59 unsigned NElts = SVI->getType()->getNumElements();
60 if (isa<ConstantAggregateZero>(SVI->getOperand(2)))
62 if (isa<UndefValue>(SVI->getOperand(2)))
66 const ConstantVector *CP = cast<ConstantVector>(SVI->getOperand(2));
108 if (ShuffleVectorInst *SVI = dyn_cast<ShuffleVectorInst>(V)) {
110 cast<VectorType>(SVI->getOperand(0)->getType())->getNumElements();
111 int InEl = getShuffleMask(SVI)[EltNo];
115 return FindScalarElement(SVI->getOperand(0), InEl);
116 return FindScalarElement(SVI->getOperand(1), InEl - LHSWidth);
211 } else if (ShuffleVectorInst *SVI = dyn_cast<ShuffleVectorInst>(I)) {
215 int SrcIdx = getShuffleMask(SVI)[Elt->getZExtValue()];
218 cast<VectorType>(SVI->getOperand(0)->getType())->getNumElements();
223 Src = SVI->getOperand(0);
226 Src = SVI->getOperand(1);
447 Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
448 Value *LHS = SVI.getOperand(0);
449 Value *RHS = SVI.getOperand(1);
450 std::vector<int> Mask = getShuffleMask(&SVI);
455 if (isa<UndefValue>(SVI.getOperand(2)))
456 return ReplaceInstUsesWith(SVI, UndefValue::get(SVI.getType()));
458 unsigned VWidth = cast<VectorType>(SVI.getType())->getNumElements();
465 if (Value *V = SimplifyDemandedVectorElts(&SVI, AllOnesEltMask, UndefElts)) {
466 if (V != &SVI)
467 return ReplaceInstUsesWith(SVI, V);
468 LHS = SVI.getOperand(0);
469 RHS = SVI.getOperand(1);
478 return ReplaceInstUsesWith(SVI, LHS);
485 Elts.push_back(UndefValue::get(Type::getInt32Ty(SVI.getContext())));
490 Elts.push_back(UndefValue::get(Type::getInt32Ty(SVI.getContext())));
493 Elts.push_back(ConstantInt::get(Type::getInt32Ty(SVI.getContext()),
498 SVI.setOperand(0, SVI.getOperand(1));
499 SVI.setOperand(1, UndefValue::get(RHS->getType()));
500 SVI.setOperand(2, ConstantVector::get(Elts));
501 LHS = SVI.getOperand(0);
502 RHS = SVI.getOperand(1);
519 if (isLHSID) return ReplaceInstUsesWith(SVI, LHS);
520 if (isRHSID) return ReplaceInstUsesWith(SVI, RHS);
558 Type *Int32Ty = Type::getInt32Ty(SVI.getContext());
574 return MadeChange ? &SVI : 0;