[llvm] 2259a80 - [ARM] Simplify LowerCMP (NFC) (#156198)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 31 07:45:15 PDT 2025


Author: AZero13
Date: 2025-08-31T15:45:12+01:00
New Revision: 2259a80c7d6d27879f4ecac31bafaf2cff778430

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

LOG: [ARM] Simplify LowerCMP (NFC) (#156198)

Pass the opcode directly.

Added: 
    

Modified: 
    llvm/lib/Target/ARM/ARMISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index ea74d6a2071d9..b5c01eafcf108 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -10539,19 +10539,11 @@ SDValue ARMTargetLowering::LowerCMP(SDValue Op, SelectionDAG &DAG) const {
   }
 
   // Generate the operation with flags
-  SDValue OpWithFlags;
-  if (Opcode == ARMISD::ADDC) {
-    // Use ADDC: LHS + RHS (where RHS was 0 - X, now X)
-    OpWithFlags = DAG.getNode(ARMISD::ADDC, dl,
-                              DAG.getVTList(MVT::i32, FlagsVT), LHS, RHS);
-  } else {
-    // Use ARMISD::SUBC to generate SUBS instruction (subtract with flags)
-    OpWithFlags = DAG.getNode(ARMISD::SUBC, dl,
-                              DAG.getVTList(MVT::i32, FlagsVT), LHS, RHS);
-  }
+  SDValue OpWithFlags =
+      DAG.getNode(Opcode, dl, DAG.getVTList(MVT::i32, FlagsVT), LHS, RHS);
 
-  SDValue OpResult = OpWithFlags.getValue(0); // The operation result
-  SDValue Flags = OpWithFlags.getValue(1);    // The flags
+  SDValue OpResult = OpWithFlags.getValue(0);
+  SDValue Flags = OpWithFlags.getValue(1);
 
   // Constants for conditional moves
   SDValue One = DAG.getConstant(1, dl, MVT::i32);


        


More information about the llvm-commits mailing list