[llvm] [AArch64] Fold CSET + BR_CC into a conditional branch (PR #207398)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 05:27:22 PDT 2026


================
@@ -11725,6 +11725,24 @@ SDValue AArch64TargetLowering::LowerBR_CC(SDValue Op, SelectionDAG &DAG) const {
                        Overflow);
   }
 
+  // Fold CSET + BR_CC to a conditional branch (rather than keeping the CSET
+  // and emitting a TB[N]Z below).
+  {
+    using namespace llvm::SDPatternMatch;
+    SDValue Flags;
+    uint64_t InvCC;
+    auto m_CSET = m_Node(AArch64ISD::CSINC, m_Zero(), m_Zero(),
+                         m_ConstInt(InvCC), m_Value(Flags));
----------------
MacDue wrote:

We're matching `CSET`, which is a specfic alias of `CSINC`. 

https://github.com/llvm/llvm-project/pull/207398


More information about the llvm-commits mailing list