Skip to content

Commit f58eadd

Browse files
committed
!fixup address comments, thanks
1 parent cd2f291 commit f58eadd

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,9 +970,9 @@ class VPInstruction : public VPRecipeWithIRFlags,
970970

971971
#if !defined(NDEBUG)
972972
/// Return the number of operands determined by the opcode of the
973-
/// VPInstruction. Returns -1 if the number of operands cannot be determined
973+
/// VPInstruction. Returns -1u if the number of operands cannot be determined
974974
/// directly by the opcode.
975-
unsigned getNumOperandsForOpcode() const;
975+
static unsigned getNumOperandsForOpcode(unsigned Opcode);
976976
#endif
977977

978978
public:

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -413,20 +413,20 @@ VPInstruction::VPInstruction(unsigned Opcode, ArrayRef<VPValue *> Operands,
413413
Opcode(Opcode), Name(Name.str()) {
414414
assert(flagsValidForOpcode(getOpcode()) &&
415415
"Set flags not supported for the provided opcode");
416-
assert((getNumOperandsForOpcode() == -1u ||
417-
getNumOperandsForOpcode() == getNumOperands()) &&
416+
assert((getNumOperandsForOpcode(Opcode) == -1u ||
417+
getNumOperandsForOpcode(Opcode) == getNumOperands()) &&
418418
"number of operands does not match opcode");
419419
}
420420

421421
#ifndef NDEBUG
422-
unsigned VPInstruction::getNumOperandsForOpcode() const {
423-
if (Instruction::isUnaryOp(getOpcode()) || Instruction::isCast(getOpcode()))
422+
unsigned VPInstruction::getNumOperandsForOpcode(unsigned Opcode) {
423+
if (Instruction::isUnaryOp(Opcode) || Instruction::isCast(Opcode))
424424
return 1;
425425

426-
if (Instruction::isBinaryOp(getOpcode()))
426+
if (Instruction::isBinaryOp(Opcode))
427427
return 2;
428428

429-
switch (getOpcode()) {
429+
switch (Opcode) {
430430
case VPInstruction::StepVector:
431431
return 0;
432432
case Instruction::Alloca:
@@ -452,15 +452,16 @@ unsigned VPInstruction::getNumOperandsForOpcode() const {
452452
case VPInstruction::ComputeReductionResult:
453453
case VPInstruction::FirstOrderRecurrenceSplice:
454454
case VPInstruction::LogicalAnd:
455-
case VPInstruction::WideIVStep:
456455
case VPInstruction::PtrAdd:
456+
case VPInstruction::WideIVStep:
457457
return 2;
458458
case Instruction::Select:
459+
case VPInstruction::ComputeAnyOfResult:
459460
case VPInstruction::ComputeFindLastIVResult:
460461
return 3;
461462
case Instruction::Call:
462-
case Instruction::PHI:
463463
case Instruction::GetElementPtr:
464+
case Instruction::PHI:
464465
case Instruction::Switch:
465466
// Cannot determine the number of operands from the opcode.
466467
return -1u;
@@ -2772,10 +2773,7 @@ static void scalarizeInstruction(const Instruction *Instr,
27722773

27732774
// Replace the operands of the cloned instructions with their scalar
27742775
// equivalents in the new loop.
2775-
auto OpRange = RepRecipe->operands();
2776-
if (isa<CallBase>(Cloned))
2777-
OpRange = drop_end(OpRange);
2778-
for (const auto &I : enumerate(OpRange)) {
2776+
for (const auto &I : enumerate(RepRecipe->operands())) {
27792777
auto InputLane = Lane;
27802778
VPValue *Operand = I.value();
27812779
if (vputils::isSingleScalar(Operand))

0 commit comments

Comments
 (0)