[llvm] 53e83af - [DAG] getTruncatedUSUBSAT - always truncate operands. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 13:29:13 PST 2021


Author: Simon Pilgrim
Date: 2021-02-18T21:28:55Z
New Revision: 53e83afcaf5ce00073348af847603b2fd6442c81

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

LOG: [DAG] getTruncatedUSUBSAT - always truncate operands. NFCI.

As noticed on D96703, we're always truncating the operands so should use getNode(ISD::TRUNCATE) instead of getZExtOrTrunc.

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 7f3aeeb0353f..38efa536bb3f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3153,8 +3153,8 @@ static SDValue getTruncatedUSUBSAT(EVT DstVT, EVT SrcVT, SDValue LHS,
                                            DstVT.getScalarSizeInBits()),
                       DL, SrcVT);
   RHS = DAG.getNode(ISD::UMIN, DL, SrcVT, RHS, SatLimit);
-  RHS = DAG.getZExtOrTrunc(RHS, DL, DstVT);
-  LHS = DAG.getZExtOrTrunc(LHS, DL, DstVT);
+  RHS = DAG.getNode(ISD::TRUNCATE, DL, DstVT, RHS);
+  LHS = DAG.getNode(ISD::TRUNCATE, DL, DstVT, LHS);
   return DAG.getNode(ISD::USUBSAT, DL, DstVT, LHS, RHS);
 }
 


        


More information about the llvm-commits mailing list