Skip to content

Commit 1749b91

Browse files
committed
!fixup add VPInstruction::isCast.
1 parent 0635a32 commit 1749b91

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -10410,8 +10410,7 @@ preparePlanForEpilogueVectorLoop(VPlan &Plan, Loop *L,
1041010410
[](const VPUser *U) {
1041110411
return isa<VPScalarIVStepsRecipe>(U) ||
1041210412
isa<VPDerivedIVRecipe>(U) ||
10413-
Instruction::isCast(
10414-
cast<VPInstruction>(U)->getOpcode()) ||
10413+
VPInstruction::isCast(U) ||
1041510414
cast<VPInstruction>(U)->getOpcode() ==
1041610415
Instruction::Add;
1041710416
}) &&

llvm/lib/Transforms/Vectorize/VPlan.h

+7-4
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,12 @@ class VPInstruction : public VPRecipeWithIRFlags,
10211021

10221022
/// Returns the symbolic name assigned to the VPInstruction.
10231023
StringRef getName() const { return Name; }
1024+
1025+
/// Return true if \p U is a cast.
1026+
static bool isCast(const VPUser *U) {
1027+
auto *VPI = dyn_cast<VPInstruction>(U);
1028+
return VPI && Instruction::isCast(VPI->getOpcode());
1029+
}
10241030
};
10251031

10261032
/// A specialization of VPInstruction augmenting it with a dedicated result
@@ -1035,10 +1041,7 @@ class VPInstructionWithType : public VPInstruction {
10351041
Type *ResultTy, DebugLoc DL, const Twine &Name = "")
10361042
: VPInstruction(Opcode, Operands, DL, Name), ResultTy(ResultTy) {}
10371043

1038-
static inline bool classof(const VPRecipeBase *R) {
1039-
auto *VPI = dyn_cast<VPInstruction>(R);
1040-
return VPI && Instruction::isCast(VPI->getOpcode());
1041-
}
1044+
static inline bool classof(const VPRecipeBase *R) { return isCast(R); }
10421045

10431046
static inline bool classof(const VPUser *R) {
10441047
return isa<VPInstructionWithType>(cast<VPRecipeBase>(R));

0 commit comments

Comments
 (0)