[llvm] [DAGCombiner][VP] Add DAGCombine for VP_MUL (PR #80105)

Shao-Ce SUN via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 3 19:06:53 PST 2024


================
@@ -4404,20 +4408,21 @@ SDValue DAGCombiner::visitMUL(SDNode *N) {
   if (N1IsConst && ConstValue1.isOne())
     return N0;
 
-  if (SDValue NewSel = foldBinOpIntoSelect(N))
-    return NewSel;
+  if (!IsVP)
+    if (SDValue NewSel = foldBinOpIntoSelect(N))
+      return NewSel;
 
   // fold (mul x, -1) -> 0-x
   if (N1IsConst && ConstValue1.isAllOnes())
-    return DAG.getNegative(N0, DL, VT);
+    return Matcher.getNode(ISD::SUB, DL, VT, DAG.getConstant(0, DL, VT), N0);
----------------
sunshaoce wrote:

Do we need to add a parameter `bool IsVP = false` to `getNegative`?

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


More information about the llvm-commits mailing list