Skip to content

Commit 3e69545

Browse files
committed
[VPlan] Fix subtle issue with first-lane-used check
1 parent b6a897a commit 3e69545

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,8 @@ static void narrowToSingleScalarRecipes(VPlan &Plan) {
12181218
// Skip recipes that aren't single scalars, that don't have users, and
12191219
// that don't have only their scalar results used (this would introduce
12201220
// extra broadcasts).
1221-
if (!vputils::isSingleScalar(RepOrWidenR) ||
1221+
if ((!vputils::isSingleScalar(RepOrWidenR) &&
1222+
!vputils::onlyFirstLaneUsed(RepOrWidenR)) ||
12221223
RepOrWidenR->getNumUsers() == 0 ||
12231224
any_of(RepOrWidenR->users(), [RepOrWidenR](VPUser *U) {
12241225
return !U->usesScalars(RepOrWidenR);

llvm/lib/Transforms/Vectorize/VPlanUtils.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ const SCEV *getSCEVExprForVPValue(VPValue *V, ScalarEvolution &SE);
4040
/// Returns true if \p VPV is a single scalar, either because it produces the
4141
/// same value for all lanes or only has its first lane used.
4242
inline bool isSingleScalar(const VPValue *VPV) {
43-
if (onlyFirstLaneUsed(VPV))
44-
return true;
45-
4643
auto PreservesUniformity = [](unsigned Opcode) -> bool {
4744
if (Instruction::isBinaryOp(Opcode) || Instruction::isCast(Opcode))
4845
return true;

0 commit comments

Comments
 (0)