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

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 2 03:26:42 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);
----------------
RKSimon wrote:

Losing helpers like this is going to get annoying very quickly :( 

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


More information about the llvm-commits mailing list