Skip to content

Commit 1e69bb1

Browse files
Addressed comments + rebase
1 parent 4033f83 commit 1e69bb1

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
@@ -1476,7 +1476,8 @@ class VPWidenEVLRecipe : public VPWidenRecipe {
14761476
VPValue *getEVL() { return getOperand(getNumOperands() - 1); }
14771477
const VPValue *getEVL() const { return getOperand(getNumOperands() - 1); }
14781478

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

14821483
/// 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
@@ -1229,7 +1229,6 @@ void VPWidenEVLRecipe::execute(VPTransformState &State) {
12291229
"explicit vector length.");
12301230
VPValue *Op0 = getOperand(0);
12311231

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

@@ -1256,9 +1255,8 @@ void VPWidenEVLRecipe::execute(VPTransformState &State) {
12561255
VPInst = Builder.createVectorInstruction(Opcode, Ops[0]->getType(), Ops,
12571256
"vp.op");
12581257

1259-
if (I)
1260-
if (auto *VecOp = dyn_cast<Instruction>(VPInst))
1261-
VecOp->copyIRFlags(I);
1258+
if (auto *VecOp = dyn_cast_or_null<Instruction>(VPInst))
1259+
VecOp->copyIRFlags(I);
12621260
} else {
12631261
llvm_unreachable("Unsupported opcode in VPWidenEVLRecipe::execute");
12641262
}

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)