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

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 07:52:40 PDT 2024


================
@@ -1764,11 +1764,8 @@ void DAGCombiner::Run(CombineLevel AtLevel) {
 
     if (N->getNumValues() == RV->getNumValues())
       DAG.ReplaceAllUsesWith(N, RV.getNode());
-    else {
-      assert(N->getValueType(0) == RV.getValueType() &&
-             N->getNumValues() == 1 && "Type mismatch");
----------------
KanRobert wrote:

I removed this b/c I found the possible combine:
```
  // sub(and(setcc(cc0, flag0), setcc(cc1, sub (X, Y))), 1)
  // brcond ne

  //  ->
  //
  //  ccmp(X, Y, cflags, cc0, flag0)
  //  brcond cc1
  //
  //  if only flag has users
```

`SUB` has two values while `CCMP` has one value and 1st value of SUB is **not** the eflags.

But it's quite strange I can't find the case any more.


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


More information about the llvm-commits mailing list