Home | History | Annotate | Download | only in InstCombine

Lines Matching refs:EI

108 Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
109 // If vector val is constant with all elements the same, replace EI with
111 if (Constant *C = dyn_cast<Constant>(EI.getOperand(0)))
113 return ReplaceInstUsesWith(EI, C->getAggregateElement(0U));
117 if (ConstantInt *IdxC = dyn_cast<ConstantInt>(EI.getOperand(1))) {
119 unsigned VectorWidth = EI.getVectorOperandType()->getNumElements();
124 return ReplaceInstUsesWith(EI, UndefValue::get(EI.getType()));
129 if (EI.getOperand(0)->hasOneUse() && VectorWidth != 1) {
133 if (Value *V = SimplifyDemandedVectorElts(EI.getOperand(0),
135 EI.setOperand(0, V);
136 return &EI;
140 if (Value *Elt = FindScalarElement(EI.getOperand(0), IndexVal))
141 return ReplaceInstUsesWith(EI, Elt);
146 if (BitCastInst *BCI = dyn_cast<BitCastInst>(EI.getOperand(0))) {
150 return new BitCastInst(Elt, EI.getType());
154 if (Instruction *I = dyn_cast<Instruction>(EI.getOperand(0))) {
159 CheapToScalarize(BO, isa<ConstantInt>(EI.getOperand(1)))) {
161 Builder->CreateExtractElement(BO->getOperand(0), EI.getOperand(1),
162 EI.getName()+".lhs");
164 Builder->CreateExtractElement(BO->getOperand(1), EI.getOperand(1),
165 EI.getName()+".rhs");
170 if (IE->getOperand(2) == EI.getOperand(1))
171 return ReplaceInstUsesWith(EI, IE->getOperand(1));
174 if (isa<Constant>(IE->getOperand(2)) && isa<Constant>(EI.getOperand(1))) {
175 Worklist.AddValue(EI.getOperand(0));
176 EI.setOperand(0, IE->getOperand(0));
177 return &EI;
182 if (ConstantInt *Elt = dyn_cast<ConstantInt>(EI.getOperand(1))) {
189 return ReplaceInstUsesWith(EI, UndefValue::get(EI.getType()));
196 Type *Int32Ty = Type::getInt32Ty(EI.getContext());
204 if (CI->hasOneUse() && EI.hasOneUse() &&
207 EI.getIndexOperand());
208 return CastInst::Create(CI->getOpcode(), EE, EI.getType());
260 } else if (ExtractElementInst *EI = dyn_cast<ExtractElementInst>(ScalarOp)){
261 if (isa<ConstantInt>(EI->getOperand(1)) &&
262 EI->getOperand(0)->getType() == V->getType()) {
264 cast<ConstantInt>(EI->getOperand(1))->getZExtValue();
267 if (EI->getOperand(0) == LHS || EI->getOperand(0) == RHS) {
272 if (EI->getOperand(0) == LHS) {
277 assert(EI->getOperand(0) == RHS);
319 if (ExtractElementInst *EI = dyn_cast<ExtractElementInst>(ScalarOp)) {
320 if (isa<ConstantInt>(EI->getOperand(1)) && isa<ConstantInt>(IdxOp) &&
321 EI->getOperand(0)->getType() == V->getType()) {
323 cast<ConstantInt>(EI->getOperand(1))->getZExtValue();
328 if (EI->getOperand(0) == RHS || RHS == 0) {
329 RHS = EI->getOperand(0);
338 Value *V = CollectShuffleElements(EI->getOperand(0), Mask, RHS);
350 if (CollectSingleShuffleElements(IEI, EI->getOperand(0), RHS, Mask))
351 return EI->getOperand(0);
374 if (ExtractElementInst *EI = dyn_cast<ExtractElementInst>(ScalarOp)) {
375 if (isa<ConstantInt>(EI->getOperand(1)) && isa<ConstantInt>(IdxOp) &&
376 EI->getOperand(0)->getType() == IE.getType()) {
379 cast<ConstantInt>(EI->getOperand(1))->getZExtValue();
390 EI->getOperand(0) == VecOp && ExtractedIdx == InsertedIdx)