[llvm] [DAGCombiner] Use APInt::isSubsetOf. NFC (PR #142029)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu May 29 13:18:44 PDT 2025


https://github.com/topperc created https://github.com/llvm/llvm-project/pull/142029

None

>From 6e51a364c8cce58726688800e1b2934f4ec4cda9 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 29 May 2025 13:16:03 -0700
Subject: [PATCH] [DAGCombiner] Use APInt::isSubsetOf. NFC

---
 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index e05f85ea3bd8e..00be9891b0ccb 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -6813,7 +6813,7 @@ bool DAGCombiner::SearchForAndLoads(SDNode *N,
     // Some constants may need fixing up later if they are too large.
     if (auto *C = dyn_cast<ConstantSDNode>(Op)) {
       if ((N->getOpcode() == ISD::OR || N->getOpcode() == ISD::XOR) &&
-          (Mask->getAPIntValue() & C->getAPIntValue()) != C->getAPIntValue())
+          !C->getAPIntValue().isSubsetOf(Mask->getAPIntValue()))
         NodesWithConsts.insert(N);
       continue;
     }



More information about the llvm-commits mailing list