Skip to content

Commit 969366d

Browse files
committed
fix the comments
1 parent b9d842e commit 969366d

File tree

5 files changed

+883
-22
lines changed

5 files changed

+883
-22
lines changed

llvm/lib/IR/VectorBuilder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ Value *VectorBuilder::createVectorInstruction(unsigned Opcode, Type *ReturnTy,
6060
return createVectorInstructionImpl(VPID, ReturnTy, InstOpArray, Name);
6161
}
6262

63-
Value *VectorBuilder::createSimpleReduction(Intrinsic::ID RdxID, Type *ValTy,
63+
Value *VectorBuilder::createSimpleReduction(Intrinsic::ID RdxID,
64+
Type *ValTy,
6465
ArrayRef<Value *> InstOpArray,
6566
const Twine &Name) {
6667
auto VPID = VPIntrinsic::getForIntrinsic(RdxID);

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,18 +1034,23 @@ InstructionCost VPWidenIntrinsicRecipe::computeCost(ElementCount VF,
10341034
// TODO: Rework TTI interface to be independent of concrete IR values.
10351035
SmallVector<const Value *> Arguments;
10361036

1037+
// VP Intrinsics should have the same cost as their non-vp counterpart.
10371038
Intrinsic::ID FID = VectorIntrinsicID;
10381039
unsigned NumOperands = getNumOperands();
1040+
const_operand_range arg_operands =
1041+
make_range(op_begin(), op_begin() + getNumOperands());
10391042
if (VPIntrinsic::isVPIntrinsic(VectorIntrinsicID)) {
10401043
std::optional<Intrinsic::ID> ID =
10411044
VPIntrinsic::getFunctionalIntrinsicIDForVP(VectorIntrinsicID);
10421045
if (ID) {
10431046
FID = ID.value();
10441047
NumOperands = getNumOperands() - 1;
1048+
// Remove the EVL
1049+
arg_operands = make_range(op_begin(), op_begin() + getNumOperands() - 1);
10451050
}
10461051
}
10471052

1048-
for (const auto &[Idx, Op] : enumerate(operands())) {
1053+
for (const auto &[Idx, Op] : enumerate(arg_operands)) {
10491054
auto *V = Op->getUnderlyingValue();
10501055
if (!V) {
10511056
if (auto *UI = dyn_cast_or_null<CallBase>(getUnderlyingValue())) {

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,13 +1489,13 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
14891489
auto *CI = cast<CallInst>(CInst->getUnderlyingInstr());
14901490
SmallVector<VPValue *> Ops(CInst->operands());
14911491
Ops.push_back(&EVL);
1492+
14921493
Intrinsic::ID VPID = VPIntrinsic::getForIntrinsic(
14931494
CI->getCalledFunction()->getIntrinsicID());
14941495
if (VPID == Intrinsic::not_intrinsic)
14951496
return nullptr;
14961497
return new VPWidenIntrinsicRecipe(
1497-
VPID, Ops, TypeInfo.inferScalarType(CInst), false,
1498-
false, false);
1498+
*CI, VPID, Ops, CI->getType(), CI->getDebugLoc());
14991499
})
15001500
.Case<VPWidenSelectRecipe>([&](VPWidenSelectRecipe *Sel) {
15011501
SmallVector<VPValue *> Ops(Sel->operands());

0 commit comments

Comments
 (0)