Lines Matching defs:ArrayIdx
234 // A helper function that factors ArrayIdx to a product of a stride and a
237 void factorArrayIndex(Value *ArrayIdx, const SCEV *Base, uint64_t ElementSize,
491 void StraightLineStrengthReduce::factorArrayIndex(Value *ArrayIdx,
495 // At least, ArrayIdx = ArrayIdx *nsw 1.
497 Base, ConstantInt::get(cast<IntegerType>(ArrayIdx->getType()), 1),
498 ArrayIdx, ElementSize, GEP);
501 // One alternative is matching the SCEV of ArrayIdx instead of ArrayIdx
512 if (match(ArrayIdx, m_NSWMul(m_Value(LHS), m_ConstantInt(RHS)))) {
516 } else if (match(ArrayIdx, m_NSWShl(m_Value(LHS), m_ConstantInt(RHS)))) {
547 Value *ArrayIdx = GEP->getOperand(I);
549 if (ArrayIdx->getType()->getIntegerBitWidth() <=
551 // Skip factoring if ArrayIdx is wider than the index size, because
552 // ArrayIdx is implicitly truncated to the index size.
553 factorArrayIndex(ArrayIdx, BaseExpr, ElementSize, GEP);
555 // When ArrayIdx is the sext of a value, we try to factor that value as
559 if (match(ArrayIdx, m_SExt(m_Value(TruncatedArrayIdx))) &&