Skip to content

Commit d6ac649

Browse files
committed
[SLP]Fix coding style, NFC.
1 parent 7656dd3 commit d6ac649

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ static bool allSameBlock(ArrayRef<Value *> VL) {
200200
if (!I0)
201201
return false;
202202
BasicBlock *BB = I0->getParent();
203-
for (int i = 1, e = VL.size(); i < e; i++) {
204-
Instruction *I = dyn_cast<Instruction>(VL[i]);
205-
if (!I)
203+
for (int I = 1, E = VL.size(); I < E; I++) {
204+
auto *II = dyn_cast<Instruction>(VL[I]);
205+
if (!II)
206206
return false;
207207

208-
if (BB != I->getParent())
208+
if (BB != II->getParent())
209209
return false;
210210
}
211211
return true;
@@ -2692,10 +2692,10 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
26922692

26932693
// Check for terminator values (e.g. invoke).
26942694
for (Value *V : VL)
2695-
for (unsigned i = 0, e = PH->getNumIncomingValues(); i < e; ++i) {
2695+
for (unsigned I = 0, E = PH->getNumIncomingValues(); I < E; ++I) {
26962696
Instruction *Term = dyn_cast<Instruction>(
26972697
cast<PHINode>(V)->getIncomingValueForBlock(
2698-
PH->getIncomingBlock(i)));
2698+
PH->getIncomingBlock(I)));
26992699
if (Term && Term->isTerminator()) {
27002700
LLVM_DEBUG(dbgs()
27012701
<< "SLP: Need to swizzle PHINodes (terminator use).\n");
@@ -2712,13 +2712,13 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
27122712

27132713
// Keeps the reordered operands to avoid code duplication.
27142714
SmallVector<ValueList, 2> OperandsVec;
2715-
for (unsigned i = 0, e = PH->getNumIncomingValues(); i < e; ++i) {
2715+
for (unsigned I = 0, E = PH->getNumIncomingValues(); I < E; ++I) {
27162716
ValueList Operands;
27172717
// Prepare the operand vector.
27182718
for (Value *V : VL)
27192719
Operands.push_back(cast<PHINode>(V)->getIncomingValueForBlock(
2720-
PH->getIncomingBlock(i)));
2721-
TE->setOperand(i, Operands);
2720+
PH->getIncomingBlock(I)));
2721+
TE->setOperand(I, Operands);
27222722
OperandsVec.push_back(Operands);
27232723
}
27242724
for (unsigned OpIdx = 0, OpE = OperandsVec.size(); OpIdx != OpE; ++OpIdx)
@@ -3472,31 +3472,31 @@ int BoUpSLP::getEntryCost(TreeEntry *E) {
34723472
DeadCost += TTI->getShuffleCost(
34733473
TargetTransformInfo::SK_PermuteSingleSrc, VecTy);
34743474
}
3475-
for (unsigned i = 0, e = VL.size(); i < e; ++i) {
3476-
Instruction *E = cast<Instruction>(VL[i]);
3475+
for (unsigned I = 0, E = VL.size(); I < E; ++I) {
3476+
Instruction *EI = cast<Instruction>(VL[I]);
34773477
// If all users are going to be vectorized, instruction can be
34783478
// considered as dead.
34793479
// The same, if have only one user, it will be vectorized for sure.
3480-
if (areAllUsersVectorized(E)) {
3480+
if (areAllUsersVectorized(EI)) {
34813481
// Take credit for instruction that will become dead.
3482-
if (E->hasOneUse()) {
3483-
Instruction *Ext = E->user_back();
3482+
if (EI->hasOneUse()) {
3483+
Instruction *Ext = EI->user_back();
34843484
if ((isa<SExtInst>(Ext) || isa<ZExtInst>(Ext)) &&
34853485
all_of(Ext->users(),
34863486
[](User *U) { return isa<GetElementPtrInst>(U); })) {
34873487
// Use getExtractWithExtendCost() to calculate the cost of
34883488
// extractelement/ext pair.
34893489
DeadCost -= TTI->getExtractWithExtendCost(
3490-
Ext->getOpcode(), Ext->getType(), VecTy, i);
3490+
Ext->getOpcode(), Ext->getType(), VecTy, I);
34913491
// Add back the cost of s|zext which is subtracted separately.
34923492
DeadCost += TTI->getCastInstrCost(
3493-
Ext->getOpcode(), Ext->getType(), E->getType(),
3493+
Ext->getOpcode(), Ext->getType(), EI->getType(),
34943494
TTI::getCastContextHint(Ext), CostKind, Ext);
34953495
continue;
34963496
}
34973497
}
34983498
DeadCost -=
3499-
TTI->getVectorInstrCost(Instruction::ExtractElement, VecTy, i);
3499+
TTI->getVectorInstrCost(Instruction::ExtractElement, VecTy, I);
35003500
}
35013501
}
35023502
return DeadCost;
@@ -4024,9 +4024,9 @@ int BoUpSLP::getGatherCost(FixedVectorType *Ty,
40244024
const DenseSet<unsigned> &ShuffledIndices) const {
40254025
unsigned NumElts = Ty->getNumElements();
40264026
APInt DemandedElts = APInt::getNullValue(NumElts);
4027-
for (unsigned i = 0; i < NumElts; ++i)
4028-
if (!ShuffledIndices.count(i))
4029-
DemandedElts.setBit(i);
4027+
for (unsigned I = 0; I < NumElts; ++I)
4028+
if (!ShuffledIndices.count(I))
4029+
DemandedElts.setBit(I);
40304030
int Cost = TTI->getScalarizationOverhead(Ty, DemandedElts, /*Insert*/ true,
40314031
/*Extract*/ false);
40324032
if (!ShuffledIndices.empty())
@@ -4304,10 +4304,9 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
43044304
return V;
43054305
}
43064306
case Instruction::ExtractValue: {
4307-
LoadInst *LI = cast<LoadInst>(E->getSingleOperand(0));
4307+
auto *LI = cast<LoadInst>(E->getSingleOperand(0));
43084308
Builder.SetInsertPoint(LI);
4309-
PointerType *PtrTy =
4310-
PointerType::get(VecTy, LI->getPointerAddressSpace());
4309+
auto *PtrTy = PointerType::get(VecTy, LI->getPointerAddressSpace());
43114310
Value *Ptr = Builder.CreateBitCast(LI->getOperand(0), PtrTy);
43124311
LoadInst *V = Builder.CreateAlignedLoad(VecTy, Ptr, LI->getAlign());
43134312
Value *NewV = propagateMetadata(V, E->Scalars);

0 commit comments

Comments
 (0)