[llvm] 6aff1b7 - [DAG] SimplifyDemandedBits - pull out repeated getValueType() calls. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 23 04:02:06 PDT 2022


Author: Simon Pilgrim
Date: 2022-07-23T12:01:54+01:00
New Revision: 6aff1b7b3ca71e048375a85a11e611527da6a45c

URL: https://github.com/llvm/llvm-project/commit/6aff1b7b3ca71e048375a85a11e611527da6a45c
DIFF: https://github.com/llvm/llvm-project/commit/6aff1b7b3ca71e048375a85a11e611527da6a45c.diff

LOG: [DAG] SimplifyDemandedBits - pull out repeated getValueType() calls. NFC.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index c312fca616a5..31ea506d306b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -1056,13 +1056,13 @@ bool TargetLowering::SimplifyDemandedBits(
   // TODO: We can probably do more work on calculating the known bits and
   // simplifying the operations for scalable vectors, but for now we just
   // bail out.
-  if (Op.getValueType().isScalableVector())
+  EVT VT = Op.getValueType();
+  if (VT.isScalableVector())
     return false;
 
   bool IsLE = TLO.DAG.getDataLayout().isLittleEndian();
   unsigned NumElts = OriginalDemandedElts.getBitWidth();
-  assert((!Op.getValueType().isVector() ||
-          NumElts == Op.getValueType().getVectorNumElements()) &&
+  assert((!VT.isVector() || NumElts == VT.getVectorNumElements()) &&
          "Unexpected vector size");
 
   APInt DemandedBits = OriginalDemandedBits;
@@ -1088,7 +1088,6 @@ bool TargetLowering::SimplifyDemandedBits(
   }
 
   // Other users may use these bits.
-  EVT VT = Op.getValueType();
   if (!Op.getNode()->hasOneUse() && !AssumeSingleUse) {
     if (Depth != 0) {
       // If not at the root, Just compute the Known bits to


        


More information about the llvm-commits mailing list