[llvm] fd67e95 - [DAG] Remove non-canonical AVG case.

David Green via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 09:24:30 PST 2023


Author: David Green
Date: 2023-02-06T17:24:25Z
New Revision: fd67e9545da4cd2c1cc5ed54804afcab6ddc6258

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

LOG: [DAG] Remove non-canonical AVG case.

This removes a condition in the detection of AVG nodes, where we needn't be
checking the LHS of an add node as any const will be canonicalized to the RHS.

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 80682ae700be..a990aeb17434 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -947,13 +947,6 @@ static SDValue combineShiftToAVG(SDValue Op, SelectionDAG &DAG,
   SDValue Add2;
   auto MatchOperands = [&](SDValue Op1, SDValue Op2, SDValue Op3, SDValue A) {
     ConstantSDNode *ConstOp;
-    if ((ConstOp = isConstOrConstSplat(Op1, DemandedElts)) &&
-        ConstOp->isOne()) {
-      ExtOpA = Op2;
-      ExtOpB = Op3;
-      Add2 = A;
-      return true;
-    }
     if ((ConstOp = isConstOrConstSplat(Op2, DemandedElts)) &&
         ConstOp->isOne()) {
       ExtOpA = Op1;


        


More information about the llvm-commits mailing list