[llvm] [LV] Add cost for VPInstruction::Not. (PR #198445)

Elvis Wang via llvm-commits llvm-commits at lists.llvm.org
Fri May 22 01:31:35 PDT 2026


================
@@ -1285,6 +1285,14 @@ InstructionCost VPInstruction::computeCost(ElementCount VF,
     return Ctx.TTI.getIndexedVectorInstrCostFromEnd(Instruction::ExtractElement,
                                                     VecTy, Ctx.CostKind, 0);
   }
+  case VPInstruction::Not:
+    // InstCombine will fold `xor` to the conditional branch.
+    if (auto *U = const_cast<VPUser *>(getSingleUser()))
+      if (match(U, m_BranchOnCond(m_VPValue())))
+        return 0;
+    return Ctx.TTI.getArithmeticInstrCost(
+        Instruction::Xor, toVectorTy(Ctx.Types.inferScalarType(this), VF),
----------------
ElvisWang123 wrote:

Fixed, thanks!

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


More information about the llvm-commits mailing list