diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp index cdf9e8b9dede0..76f57165322a8 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp @@ -622,7 +622,8 @@ unsigned VPInstruction::getNumOperandsForOpcode() const { } bool VPInstruction::doesGeneratePerAllLanes() const { - return Opcode == VPInstruction::PtrAdd && !vputils::onlyFirstLaneUsed(this); + return Opcode == VPInstruction::Unpack || + (Opcode == VPInstruction::PtrAdd && !vputils::onlyFirstLaneUsed(this)); } bool VPInstruction::canGenerateScalarForFirstLane() const { diff --git a/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp b/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp index 65ad0feaa71c9..5ee3de315697b 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp @@ -945,8 +945,7 @@ void VPlanTransforms::replicateByVF(VPlan &Plan, ElementCount VF) { (isa(&R) && cast(&R)->isSingleScalar()) || (isa(&R) && - !cast(&R)->doesGeneratePerAllLanes() && - cast(&R)->getOpcode() != VPInstruction::Unpack)) + !cast(&R)->doesGeneratePerAllLanes())) continue; auto *DefR = cast(&R);