Skip to content

Commit b0ddcb9

Browse files
committed
!fixup add VPInstruction::isCast.
1 parent d9fb162 commit b0ddcb9

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10457,8 +10457,7 @@ preparePlanForEpilogueVectorLoop(VPlan &Plan, Loop *L,
1045710457
[](const VPUser *U) {
1045810458
return isa<VPScalarIVStepsRecipe>(U) ||
1045910459
isa<VPDerivedIVRecipe>(U) ||
10460-
Instruction::isCast(
10461-
cast<VPInstruction>(U)->getOpcode()) ||
10460+
VPInstruction::isCast(U) ||
1046210461
cast<VPInstruction>(U)->getOpcode() ==
1046310462
Instruction::Add;
1046410463
}) &&

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,12 @@ class VPInstruction : public VPRecipeWithIRFlags,
10221022

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

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

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

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

0 commit comments

Comments
 (0)