@@ -12582,7 +12582,6 @@ Value *BoUpSLP::vectorizeTree(
12582
12582
Ex = I;
12583
12583
}
12584
12584
}
12585
- Value *ExV = Ex;
12586
12585
if (!Ex) {
12587
12586
// "Reuse" the existing extract to improve final codegen.
12588
12587
if (auto *ES = dyn_cast<ExtractElementInst>(Scalar)) {
@@ -12593,13 +12592,7 @@ Value *BoUpSLP::vectorizeTree(
12593
12592
} else {
12594
12593
Ex = Builder.CreateExtractElement(Vec, Lane);
12595
12594
}
12596
- // If necessary, sign-extend or zero-extend ScalarRoot
12597
- // to the larger type.
12598
- ExV = Ex;
12599
- if (Scalar->getType() != Ex->getType())
12600
- ExV = Builder.CreateIntCast(Ex, Scalar->getType(),
12601
- MinBWs.find(E)->second.second);
12602
- if (auto *I = dyn_cast<Instruction>(ExV))
12595
+ if (auto *I = dyn_cast<Instruction>(Ex))
12603
12596
ScalarToEEs[Scalar].try_emplace(Builder.GetInsertBlock(), I);
12604
12597
}
12605
12598
// The then branch of the previous if may produce constants, since 0
@@ -12608,7 +12601,12 @@ Value *BoUpSLP::vectorizeTree(
12608
12601
GatherShuffleExtractSeq.insert(ExI);
12609
12602
CSEBlocks.insert(ExI->getParent());
12610
12603
}
12611
- return ExV;
12604
+ // If necessary, sign-extend or zero-extend ScalarRoot
12605
+ // to the larger type.
12606
+ if (Scalar->getType() != Ex->getType())
12607
+ return Builder.CreateIntCast(Ex, Scalar->getType(),
12608
+ MinBWs.find(E)->second.second);
12609
+ return Ex;
12612
12610
}
12613
12611
assert(isa<FixedVectorType>(Scalar->getType()) &&
12614
12612
isa<InsertElementInst>(Scalar) &&
0 commit comments