[llvm] [DAGCombiner] Set disjoint flag in add->or and xor->or combines (PR #86925)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 28 02:58:27 PDT 2024


================
@@ -2887,8 +2887,11 @@ SDValue DAGCombiner::visitADD(SDNode *N) {
 
   // fold (a+b) -> (a|b) iff a and b share no bits.
   if ((!LegalOperations || TLI.isOperationLegal(ISD::OR, VT)) &&
-      DAG.haveNoCommonBitsSet(N0, N1))
-    return DAG.getNode(ISD::OR, DL, VT, N0, N1);
+      DAG.haveNoCommonBitsSet(N0, N1)) {
+    SDNodeFlags Flags;
+    Flags.setDisjoint(true);
----------------
arsenm wrote:

Side note, we should fix the bad API of SDNodeFlags 

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


More information about the llvm-commits mailing list