[llvm] [SLP]Do not include the cost of and -1, <v> and emit just <v> after MinBitWidth. (PR #90739)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed May 1 08:46:57 PDT 2024
================
@@ -9484,6 +9484,16 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
Op1Info, Op2Info, Operands, VI);
};
auto GetVectorCost = [=](InstructionCost CommonCost) {
+ if (ShuffleOrOp == Instruction::And && It != MinBWs.end()) {
+ for (unsigned I : seq<unsigned>(0, E->getNumOperands())) {
+ ArrayRef<Value *> Ops = E->getOperand(I);
+ if (all_of(Ops, [&](Value *Op) {
+ auto *CI = dyn_cast<ConstantInt>(Op);
+ return CI && CI->getValue().countr_one() == It->second.first;
----------------
RKSimon wrote:
Why not CI->getValue().isAllOnes()? Ideally we'd have a isNeutralValue helper that would work for other binops as well.
https://github.com/llvm/llvm-project/pull/90739
More information about the llvm-commits
mailing list