mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 20:23:39 +08:00
[VectorCombine] scalarizeLoadExtract - consistently use LoadInst and ExtractElementInst specific operand getters. NFC
Noticed while investigating the hung builds reported after af83093933
This commit is contained in:
@@ -1360,8 +1360,8 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
|
||||
if (!match(&I, m_Load(m_Value(Ptr))))
|
||||
return false;
|
||||
|
||||
auto *VecTy = cast<VectorType>(I.getType());
|
||||
auto *LI = cast<LoadInst>(&I);
|
||||
auto *VecTy = cast<VectorType>(LI->getType());
|
||||
if (LI->isVolatile() || !DL->typeSizeEqualsStoreSize(VecTy->getScalarType()))
|
||||
return false;
|
||||
|
||||
@@ -1401,7 +1401,8 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
|
||||
LastCheckedInst = UI;
|
||||
}
|
||||
|
||||
auto ScalarIdx = canScalarizeAccess(VecTy, UI->getOperand(1), &I, AC, DT);
|
||||
auto ScalarIdx =
|
||||
canScalarizeAccess(VecTy, UI->getIndexOperand(), LI, AC, DT);
|
||||
if (ScalarIdx.isUnsafe())
|
||||
return false;
|
||||
if (ScalarIdx.isSafeWithFreeze()) {
|
||||
@@ -1409,7 +1410,7 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
|
||||
ScalarIdx.discard();
|
||||
}
|
||||
|
||||
auto *Index = dyn_cast<ConstantInt>(UI->getOperand(1));
|
||||
auto *Index = dyn_cast<ConstantInt>(UI->getIndexOperand());
|
||||
OriginalCost +=
|
||||
TTI.getVectorInstrCost(Instruction::ExtractElement, VecTy, CostKind,
|
||||
Index ? Index->getZExtValue() : -1);
|
||||
@@ -1425,7 +1426,7 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
|
||||
// Replace extracts with narrow scalar loads.
|
||||
for (User *U : LI->users()) {
|
||||
auto *EI = cast<ExtractElementInst>(U);
|
||||
Value *Idx = EI->getOperand(1);
|
||||
Value *Idx = EI->getIndexOperand();
|
||||
|
||||
// Insert 'freeze' for poison indexes.
|
||||
auto It = NeedFreeze.find(EI);
|
||||
|
||||
Reference in New Issue
Block a user