[llvm] [LV] Add cost for VPInstruction::Not. (PR #198445)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri May 22 02:27:08 PDT 2026
================
@@ -1285,6 +1285,17 @@ InstructionCost VPInstruction::computeCost(ElementCount VF,
return Ctx.TTI.getIndexedVectorInstrCostFromEnd(Instruction::ExtractElement,
VecTy, Ctx.CostKind, 0);
}
+ case VPInstruction::Not: {
+ Type *ValTy = Ctx.Types.inferScalarType(this);
+ // InstCombine will fold `xor` to the conditional branch.
+ if (auto *U = const_cast<VPUser *>(getSingleUser()))
+ if (match(U, m_BranchOnCond(m_VPValue())))
+ return 0;
+ if (!vputils::onlyFirstLaneUsed(this))
+ ValTy = toVectorTy(ValTy, VF);
----------------
fhahn wrote:
It looks like we are missing test coverage for the recent changes, would it be possible to cover via a cost-printing test? I guess it would need a case where the vector type does not fit into a single register, so there's a difference between scalar and vector cost?
https://github.com/llvm/llvm-project/pull/198445
More information about the llvm-commits
mailing list