Skip to content

Commit ea01c5d

Browse files
Addressed comments + rebase
1 parent cd812eb commit ea01c5d

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,8 @@ class VPWidenEVLRecipe : public VPWidenRecipe {
14681468
VPValue *getEVL() { return getOperand(getNumOperands() - 1); }
14691469
const VPValue *getEVL() const { return getOperand(getNumOperands() - 1); }
14701470

1471-
/// Produce widened copies of all Ingredients.
1471+
/// Produce a vp-intrinsic using the opcode and operands of the recipe,
1472+
/// processing EVL elements.
14721473
void execute(VPTransformState &State) override final;
14731474

14741475
/// Returns true if the recipe only uses the first lane of operand \p Op.

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,6 @@ void VPWidenEVLRecipe::execute(VPTransformState &State) {
11491149
"explicit vector length.");
11501150
VPValue *Op0 = getOperand(0);
11511151

1152-
// If it's scalar operation, hand translation over to VPWidenRecipe
11531152
assert(State.get(Op0, 0)->getType()->isVectorTy() &&
11541153
"VPWidenEVLRecipe should not be used for scalars");
11551154

@@ -1176,9 +1175,8 @@ void VPWidenEVLRecipe::execute(VPTransformState &State) {
11761175
VPInst = Builder.createVectorInstruction(Opcode, Ops[0]->getType(), Ops,
11771176
"vp.op");
11781177

1179-
if (I)
1180-
if (auto *VecOp = dyn_cast<Instruction>(VPInst))
1181-
VecOp->copyIRFlags(I);
1178+
if (auto *VecOp = dyn_cast_or_null<Instruction>(VPInst))
1179+
VecOp->copyIRFlags(I);
11821180
} else {
11831181
llvm_unreachable("Unsupported opcode in VPWidenEVLRecipe::execute");
11841182
}

llvm/test/Transforms/LoopVectorize/RISCV/vplan-vp-intrinsics.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ define void @foo(ptr noalias %a, ptr noalias %b, ptr noalias %c, i64 %N) {
3131
; IF-EVL-NEXT: CLONE ir<[[GEP2:%.+]]> = getelementptr inbounds ir<%c>, vp<[[ST]]>
3232
; IF-EVL-NEXT: vp<[[PTR2:%[0-9]+]]> = vector-pointer ir<[[GEP2]]>
3333
; IF-EVL-NEXT: WIDEN ir<[[LD2:%.+]]> = vp.load vp<[[PTR2]]>, vp<[[EVL]]>
34-
; IF-EVL-NEXT: WIDEN-VP ir<[[ADD:%.+]]> = add nsw ir<[[LD2]]>, ir<[[LD1]]>
34+
; IF-EVL-NEXT: WIDEN-VP ir<[[ADD:%.+]]> = add nsw ir<[[LD2]]>, ir<[[LD1]]>, vp<[[EVL]]>
3535
; IF-EVL-NEXT: CLONE ir<[[GEP3:%.+]]> = getelementptr inbounds ir<%a>, vp<[[ST]]>
3636
; IF-EVL-NEXT: vp<[[PTR3:%[0-9]+]]> = vector-pointer ir<[[GEP3]]>
3737
; IF-EVL-NEXT: WIDEN vp.store vp<[[PTR3]]>, ir<[[ADD]]>, vp<[[EVL]]>

0 commit comments

Comments
 (0)