[llvm] 670c252 - [DAG] Use DAGCombiner::SimplifyDemandedBits wrappers with default (all) DemandedElts. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 03:12:42 PST 2024


Author: Simon Pilgrim
Date: 2024-02-07T11:12:29Z
New Revision: 670c2529bb97f53a5b73e1eedb736ac6e070e1d9

URL: https://github.com/llvm/llvm-project/commit/670c2529bb97f53a5b73e1eedb736ac6e070e1d9
DIFF: https://github.com/llvm/llvm-project/commit/670c2529bb97f53a5b73e1eedb736ac6e070e1d9.diff

LOG: [DAG] Use DAGCombiner::SimplifyDemandedBits wrappers with default (all) DemandedElts. NFC.

Don't call TLI.SimplifyDemandedVectorElts directly from every SimplifyDemandedBits call, use the more expressive wrappers instead first.

This reduces the number of places we call TLI.SimplifyDemandedVectorElts and CommitTargetLoweringOpt to make it easier to track.

Part of the work to process DAG nodes in topological order.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 291a085b485f9..4adea020011b8 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -334,16 +334,11 @@ namespace {
     }
 
     bool SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits) {
-      TargetLowering::TargetLoweringOpt TLO(DAG, LegalTypes, LegalOperations);
-      KnownBits Known;
-      if (!TLI.SimplifyDemandedBits(Op, DemandedBits, Known, TLO, 0, false))
-        return false;
-
-      // Revisit the node.
-      AddToWorklist(Op.getNode());
-
-      CommitTargetLoweringOpt(TLO);
-      return true;
+      EVT VT = Op.getValueType();
+      APInt DemandedElts = VT.isFixedLengthVector()
+                               ? APInt::getAllOnes(VT.getVectorNumElements())
+                               : APInt(1, 1);
+      return SimplifyDemandedBits(Op, DemandedBits, DemandedElts, false);
     }
 
     /// Check the specified vector node value to see if it can be simplified or


        


More information about the llvm-commits mailing list