[llvm] [VPlan] Remove VPInstruction::Not. NFC (PR #222228)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 00:12:29 PDT 2026


================
@@ -1466,17 +1467,6 @@ InstructionCost VPInstruction::computeCost(ElementCount VF,
     return Ctx.TTI.getIndexedVectorInstrCostFromEnd(Instruction::ExtractElement,
                                                     VecTy, Ctx.CostKind, 0);
   }
-  case VPInstruction::Not: {
-    Type *ValTy = this->getScalarType();
-    // 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);
-    return Ctx.TTI.getArithmeticInstrCost(Instruction::Xor, ValTy,
-                                          Ctx.CostKind);
-  }
----------------
artagnon wrote:

I think we replaced this with:

```cpp
  case Instruction::Xor: {
    // Certain instructions can be cheaper if they have a constant second
    // operand. One example of this are shifts on x86.
    VPValue *RHS = getOperand(1);
    TargetTransformInfo::OperandValueInfo RHSInfo = Ctx.getOperandInfo(RHS);

    if (RHSInfo.Kind == TargetTransformInfo::OK_AnyValue &&
        getOperand(1)->isDefinedOutsideLoopRegions())
      RHSInfo.Kind = TargetTransformInfo::OK_UniformValue;

    Instruction *CtxI = dyn_cast_or_null<Instruction>(getUnderlyingValue());
    SmallVector<const Value *, 4> Operands;
    if (CtxI)
      Operands.append(CtxI->value_op_begin(), CtxI->value_op_end());
    return Ctx.TTI.getArithmeticInstrCost(
        Opcode, ResultTy, Ctx.CostKind,
        {TargetTransformInfo::OK_AnyValue, TargetTransformInfo::OP_None},
        RHSInfo, Operands, CtxI, &Ctx.TLI);
  }
```

I wonder if it's non-functional?

https://github.com/llvm/llvm-project/pull/222228


More information about the llvm-commits mailing list