Fix getInsertIndex to correctly cast to FixedVectorType. 
This is required because insertElement instructions can use scalable vectors aswell.
Details
Details
- Reviewers
 ABataev bcahoon - Commits
 - rG46d53f45d89b: [SLP][NFC] Restructure getInsertIndex
 
Diff Detail
Diff Detail
- Repository
 - rG LLVM Github Monorepo
 
Event Timeline
| llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
|---|---|---|
| 292–293 | Could you simplify it? const auto *VT = dyn_cast<FixedVectorType>(IE->getType());
if (!VT)
  return None;
        
const auto *CI = dyn_cast<ConstantInt>(IE->getOperand(2));
if (!CI)
  return None;
if (CI->getValue().uge(VT->getNumElements()))
  return None;
Index *= VT->getNumElements();
Index += CI->getZExtValue();
return Index; | |
Could you simplify it?
const auto *VT = dyn_cast<FixedVectorType>(IE->getType()); if (!VT) return None; const auto *CI = dyn_cast<ConstantInt>(IE->getOperand(2)); if (!CI) return None; if (CI->getValue().uge(VT->getNumElements())) return None; Index *= VT->getNumElements(); Index += CI->getZExtValue(); return Index;