[llvm] 3ad40d1 - [AArch64] Use getNegative instead of manually sub with 0 (NFC) (#158511)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 12:07:48 PDT 2025


Author: AZero13
Date: 2025-09-18T12:07:44-07:00
New Revision: 3ad40d1535809f354b39e410231da4eea0a6eea4

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

LOG: [AArch64] Use getNegative instead of manually sub with 0 (NFC) (#158511)

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index f9c244a3ccd9b..cd7f0e719ad0c 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -7371,8 +7371,8 @@ SDValue AArch64TargetLowering::LowerABS(SDValue Op, SelectionDAG &DAG) const {
     return LowerToPredicatedOp(Op, DAG, AArch64ISD::ABS_MERGE_PASSTHRU);
 
   SDLoc DL(Op);
-  SDValue Neg = DAG.getNode(ISD::SUB, DL, VT, DAG.getConstant(0, DL, VT),
-                            Op.getOperand(0));
+  SDValue Neg = DAG.getNegative(Op.getOperand(0), DL, VT);
+
   // Generate SUBS & CSEL.
   SDValue Cmp = DAG.getNode(AArch64ISD::SUBS, DL, DAG.getVTList(VT, FlagsVT),
                             Op.getOperand(0), DAG.getConstant(0, DL, VT));


        


More information about the llvm-commits mailing list