[llvm] 5f48b86 - [SelectionDAG] Use isOneConstant (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 23 19:26:59 PDT 2023


Author: Kazu Hirata
Date: 2023-03-23T19:26:42-07:00
New Revision: 5f48b861f8ce2d2355347d3b3b8826f7bfd23dd6

URL: https://github.com/llvm/llvm-project/commit/5f48b861f8ce2d2355347d3b3b8826f7bfd23dd6
DIFF: https://github.com/llvm/llvm-project/commit/5f48b861f8ce2d2355347d3b3b8826f7bfd23dd6.diff

LOG: [SelectionDAG] Use isOneConstant (NFC)

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 3511e76ac1df..8199e5d5a9c1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3628,9 +3628,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
     } else {
       // We test only the i1 bit.  Skip the AND if UNDEF or another AND.
       if (Tmp2.isUndef() ||
-          (Tmp2.getOpcode() == ISD::AND &&
-           isa<ConstantSDNode>(Tmp2.getOperand(1)) &&
-           cast<ConstantSDNode>(Tmp2.getOperand(1))->getZExtValue() == 1))
+          (Tmp2.getOpcode() == ISD::AND && isOneConstant(Tmp2.getOperand(1))))
         Tmp3 = Tmp2;
       else
         Tmp3 = DAG.getNode(ISD::AND, dl, Tmp2.getValueType(), Tmp2,


        


More information about the llvm-commits mailing list