[llvm] [X86][CodeGen] Support lowering for CCMP/CTEST (PR #91747)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Mon May 27 07:48:17 PDT 2024


================
@@ -54759,6 +54923,10 @@ static SDValue combineX86AddSub(SDNode *N, SelectionDAG &DAG,
   bool IsSub = X86ISD::SUB == N->getOpcode();
   unsigned GenericOpc = IsSub ? ISD::SUB : ISD::ADD;
 
+  if (IsSub && isOneConstant(N->getOperand(1)) && !N->hasAnyUseOfValue(0))
+    if (SDValue CMP = combineX86SubCmpForFlags(N, SDValue(N, 1), DAG, DCI, ST))
+      return CMP;
----------------
s-barannikov wrote:

SUB has two results, CMP has one result, which corresponds to the second result of the SUB.
Something like `return DCI.CombineTo(N, SDValue(N, 0), CMP)` would make the removed assert not trigger.
But I see you've found another way of silencing it.


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


More information about the llvm-commits mailing list