[llvm] 06c7e8d - [SelectionDAG] Simplify computeKnownBits for EXTRACT_ELEMENT using KnownBits::extractBits. NFC (#225168)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 14:03:50 PDT 2026


Author: Craig Topper
Date: 2026-09-21T21:03:42Z
New Revision: 06c7e8db78adf3a5478362ba80d6bb7f25b936b0

URL: https://github.com/llvm/llvm-project/commit/06c7e8db78adf3a5478362ba80d6bb7f25b936b0
DIFF: https://github.com/llvm/llvm-project/commit/06c7e8db78adf3a5478362ba80d6bb7f25b936b0.diff

LOG: [SelectionDAG] Simplify computeKnownBits for EXTRACT_ELEMENT using KnownBits::extractBits. NFC (#225168)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 0a3eb65965826..7b1995f4fd7e3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -4286,12 +4286,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
     const unsigned Index = Op.getConstantOperandVal(1);
     const unsigned EltBitWidth = Op.getValueSizeInBits();
 
-    // Remove low part of known bits mask
-    Known.Zero = Known.Zero.getHiBits(Known.getBitWidth() - Index * EltBitWidth);
-    Known.One = Known.One.getHiBits(Known.getBitWidth() - Index * EltBitWidth);
-
-    // Remove high part of known bit mask
-    Known = Known.trunc(EltBitWidth);
+    Known = Known.extractBits(EltBitWidth, Index * EltBitWidth);
     break;
   }
   case ISD::EXTRACT_VECTOR_ELT: {


        


More information about the llvm-commits mailing list