Skip to content

Conversation

@DaKnig
Copy link

@DaKnig DaKnig commented Dec 19, 2025

https://godbolt.org/z/T89oa3nWb <- this is what happens when DAGCombiner/TLI produces zext going into setcc. In general case, these zext end up producing many instructions.

regarding transformation of (setslt (zext) (zext)) -> (setult ...) that could be done as a separate pattern/patch

@github-actions
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added backend:AArch64 llvm:SelectionDAG SelectionDAGISel as well labels Dec 19, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 19, 2025

@llvm/pr-subscribers-llvm-selectiondag

@llvm/pr-subscribers-backend-aarch64

Author: None (DaKnig)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/173110.diff

2 Files Affected:

  • (modified) llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (+28)
  • (modified) llvm/test/CodeGen/AArch64/arm64-vcmp.ll (+26)
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 5384713d04b33..f9954f3ee5866 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -13924,6 +13924,34 @@ SDValue DAGCombiner::visitSETCC(SDNode *N) {
       }
     }
   }
+
+  // (setcc (zext a), (zext b), setu??) -> (setcc a, b, setu??)
+  // (setcc (sext a), (sext b), sets??) -> (setcc a, b, sets??)
+  if ((ISD::isUnsignedIntSetCC(Cond) && N0.getOpcode() == ISD::ZERO_EXTEND &&
+       N1.getOpcode() == ISD::ZERO_EXTEND) ||
+      (ISD::isSignedIntSetCC(Cond) && N0.getOpcode() == ISD::SIGN_EXTEND &&
+       N1.getOpcode() == ISD::SIGN_EXTEND)) {
+    SDValue LHS = N0.getOperand(0), RHS = N1.getOperand(0);
+    EVT SmallVT =
+        LHS.getScalarValueSizeInBits() > RHS.getScalarValueSizeInBits()
+            ? LHS.getValueType()
+            : RHS.getValueType();
+    if (!LegalOperations ||
+        (SmallVT.isSimple() &&
+         TLI.isCondCodeLegal(Cond, SmallVT.getSimpleVT()))) {
+      LHS = DAG.getExtOrTrunc(ISD::isSignedIntSetCC(Cond), LHS, SDLoc(LHS),
+                              SmallVT);
+      RHS = DAG.getExtOrTrunc(ISD::isSignedIntSetCC(Cond), RHS, SDLoc(RHS),
+                              SmallVT);
+      SDValue NewSetCC =
+          DAG.getSetCC(DL, getSetCCResultType(SmallVT), LHS, RHS, Cond);
+      // Promote to a legal type for setcc, then adjust back to VT (if before
+      // LegalOperations)
+      return DAG.getZExtOrTrunc(
+          TLI.promoteTargetBoolean(DAG, NewSetCC, N0.getValueType()), DL, VT);
+	}
+  }
+
   return SDValue();
 }
 
diff --git a/llvm/test/CodeGen/AArch64/arm64-vcmp.ll b/llvm/test/CodeGen/AArch64/arm64-vcmp.ll
index 1e05b452de300..304bf3cf8c674 100644
--- a/llvm/test/CodeGen/AArch64/arm64-vcmp.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-vcmp.ll
@@ -234,3 +234,29 @@ define <1 x i64> @cmnez_d(<1 x i64> %A) nounwind {
   %mask = sext <1 x i1> %tst to <1 x i64>
   ret <1 x i64> %mask
 }
+
+; Check for the elimination of spurious type extensions
+define <16 x i1> @abdu_cmp(<16 x i8> %a, <16 x i8> %b, <16 x i8> %g) {
+; CHECK-LABEL: abdu_cmp:
+; CHECK:         uabd.16b v0, v0, v1
+; CHECK-NEXT:    cmhi.16b v0, v2, v0
+; CHECK-NEXT:    ret
+  %za = zext <16 x i8> %a to <16 x i32>
+  %zb = zext <16 x i8> %b to <16 x i32>
+  %zg = zext <16 x i8> %g to <16 x i32>
+  %mx = call <16 x i32> @llvm.umax.v16i32(<16 x i32> %za, <16 x i32> %zb)
+  %mn = call <16 x i32> @llvm.umin.v16i32(<16 x i32> %za, <16 x i32> %zb)
+  %abdu = sub <16 x i32> %mx, %mn
+  %cond = icmp ult <16 x i32> %abdu, %zg
+  ret <16 x i1> %cond
+}
+
+define <16 x i1> @sext_cmp(<16 x i8> %a, <16 x i8> %b) {
+; CHECK-LABEL: sext_cmp:
+; CHECK:         cmgt.16b v0, v0, v1
+; CHECK-NEXT:    ret
+  %za = sext <16 x i8> %a to <16 x i32>
+  %zb = sext <16 x i8> %b to <16 x i32>
+  %cond = icmp slt <16 x i32> %za, %zb
+  ret <16 x i1> %cond
+}

@topperc
Copy link
Collaborator

topperc commented Dec 20, 2025

This PR should contain two commits. One adding just the tests with the current codegen. And a second commit that shows that changes DAGCombiner and shows how the tests change.

@github-actions
Copy link

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Developer Policy and LLVM Discourse for more information.

@github-actions
Copy link

github-actions bot commented Dec 20, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@github-actions
Copy link

🪟 Windows x64 Test Results

  • 128816 tests passed
  • 2836 tests skipped
  • 10 tests failed

Failed Tests

(click on a test name to see its output)

LLVM

LLVM.CodeGen/AArch64/arm64-vcmp.ll
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AArch64\arm64-vcmp.ll -mtriple=arm64-eabi -aarch64-neon-syntax=apple | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AArch64\arm64-vcmp.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=arm64-eabi -aarch64-neon-syntax=apple
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AArch64\arm64-vcmp.ll'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AArch64\arm64-vcmp.ll:256:10: error: CHECK: expected string not found in input
# | ; CHECK: cmgt.16b v0, v0, v1
# |          ^
# | <stdin>:292:10: note: scanning from here
# | sext_cmp: // @sext_cmp
# |          ^
# | <stdin>:295:2: note: possible intended match here
# |  cmgt.16b v0, v1, v0
# |  ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AArch64\arm64-vcmp.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |            287:  .cfi_endproc 
# |            288:  // -- End function 
# |            289:  .globl sext_cmp // -- Begin function sext_cmp 
# |            290:  .p2align 2 
# |            291:  .type sext_cmp,@function 
# |            292: sext_cmp: // @sext_cmp 
# | check:256'0              X~~~~~~~~~~~~~ error: no match found
# |            293:  .cfi_startproc 
# | check:256'0     ~~~~~~~~~~~~~~~~
# |            294: // %bb.0: 
# | check:256'0     ~~~~~~~~~~
# |            295:  cmgt.16b v0, v1, v0 
# | check:256'0     ~~~~~~~~~~~~~~~~~~~~~
# | check:256'1      ?                    possible intended match
# |            296:  ret 
# | check:256'0     ~~~~~
# |            297: .Lfunc_end25: 
# | check:256'0     ~~~~~~~~~~~~~~
# |            298:  .size sext_cmp, .Lfunc_end25-sext_cmp 
# | check:256'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            299:  .cfi_endproc 
# | check:256'0     ~~~~~~~~~~~~~~
# |            300:  // -- End function 
# | check:256'0     ~~~~~~~~~~~~~~~~~~~~
# |            301:  .section ".note.GNU-stack","",@progbits 
# | check:256'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

LLVM.CodeGen/AMDGPU/min.ll
Exit Code: 15
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=r600-- -mcpu=cypress < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\min.ll | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe --check-prefix=EG C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\min.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=r600-- -mcpu=cypress
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' --check-prefix=EG 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\min.ll'
# note: command had no output on stdout or stderr
# RUN: at line 3
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=amdgcn-amd-amdhsa -mcpu=kaveri < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\min.ll | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe --check-prefix=CI C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\min.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=amdgcn-amd-amdhsa -mcpu=kaveri
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' --check-prefix=CI 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\min.ll'
# note: command had no output on stdout or stderr
# RUN: at line 4
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=amdgcn-amd-amdhsa -mcpu=tonga < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\min.ll | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe --check-prefix=VI C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\min.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=amdgcn-amd-amdhsa -mcpu=tonga
# note: command had no output on stdout or stderr
# error: command failed with exit status: 15
# error: command reached timeout: True
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' --check-prefix=VI 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\min.ll'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\min.ll:2995:13: error: VI-LABEL: expected string not found in input
# | ; VI-LABEL: v_test_umin_ult_i32_multi_use:
# |             ^
# | <stdin>:2029:21: note: scanning from here
# | s_test_umin_ult_i32: ; @s_test_umin_ult_i32
# |                     ^
# `-----------------------------
# error: command failed with exit status: 15
# error: command reached timeout: True

--

LLVM.CodeGen/AMDGPU/sminmax.v2i16.ll
Exit Code: 2
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=amdgcn -mcpu=gfx900 < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\sminmax.v2i16.ll | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe -check-prefix=GFX9 C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\sminmax.v2i16.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=amdgcn -mcpu=gfx900
# note: command had no output on stdout or stderr
# error: command failed with exit status: 15
# error: command reached timeout: True
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' -check-prefix=GFX9 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\sminmax.v2i16.ll'
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe -check-prefix=GFX9 C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\sminmax.v2i16.ll
# `-----------------------------
# error: command failed with exit status: 2
# error: command reached timeout: True

--

LLVM.CodeGen/AMDGPU/uaddo.ll
Exit Code: 2
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\uaddo.ll -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tahiti | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\uaddo.ll --check-prefix=SI
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tahiti
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\uaddo.ll' --check-prefix=SI
# note: command had no output on stdout or stderr
# RUN: at line 3
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\uaddo.ll -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tonga | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\uaddo.ll --check-prefix=VI
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tonga
# note: command had no output on stdout or stderr
# error: command failed with exit status: 15
# error: command reached timeout: True
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\uaddo.ll' --check-prefix=VI
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\uaddo.ll --check-prefix=VI
# `-----------------------------
# error: command failed with exit status: 2
# error: command reached timeout: True

--

LLVM.CodeGen/AMDGPU/usubo.ll
Exit Code: 2
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\usubo.ll -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tahiti | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\usubo.ll --check-prefix=SI
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tahiti
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\usubo.ll' --check-prefix=SI
# note: command had no output on stdout or stderr
# RUN: at line 3
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\usubo.ll -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tonga | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\usubo.ll --check-prefix=VI
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tonga
# note: command had no output on stdout or stderr
# error: command failed with exit status: 15
# error: command reached timeout: True
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\usubo.ll' --check-prefix=VI
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\usubo.ll --check-prefix=VI
# `-----------------------------
# error: command failed with exit status: 2
# error: command reached timeout: True

--

LLVM.CodeGen/Hexagon/isel-vselect-v4i8.ll
Exit Code: 2
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=hexagon < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\isel-vselect-v4i8.ll | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\isel-vselect-v4i8.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=hexagon
# note: command had no output on stdout or stderr
# error: command failed with exit status: 15
# error: command reached timeout: True
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\isel-vselect-v4i8.ll'
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\isel-vselect-v4i8.ll
# `-----------------------------
# error: command failed with exit status: 2
# error: command reached timeout: True

--

LLVM.CodeGen/Hexagon/isel-zext-vNi1.ll
Exit Code: 2
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=hexagon -disable-hsdr < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\isel-zext-vNi1.ll | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\isel-zext-vNi1.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=hexagon -disable-hsdr
# note: command had no output on stdout or stderr
# error: command failed with exit status: 15
# error: command reached timeout: True
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\isel-zext-vNi1.ll'
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\isel-zext-vNi1.ll
# `-----------------------------
# error: command failed with exit status: 2
# error: command reached timeout: True

--

LLVM.CodeGen/Hexagon/vect/setcc-v32.ll
Exit Code: 2
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=hexagon < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\vect\setcc-v32.ll | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\vect\setcc-v32.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=hexagon
# note: command had no output on stdout or stderr
# error: command failed with exit status: 15
# error: command reached timeout: True
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\vect\setcc-v32.ll'
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\vect\setcc-v32.ll
# `-----------------------------
# error: command failed with exit status: 2
# error: command reached timeout: True

--

LLVM.CodeGen/Hexagon/vect/vect-bad-bitcast.ll
Exit Code: 15
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=hexagon -mcpu=hexagonv5 < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\Hexagon\vect\vect-bad-bitcast.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=hexagon -mcpu=hexagonv5
# note: command had no output on stdout or stderr
# error: command failed with exit status: 15
# error: command reached timeout: True

--

LLVM.CodeGen/X86/sext-vsetcc.ll
Exit Code: 2
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\sext-vsetcc.ll -mtriple=x86_64-- -mattr=+sse2 | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\sext-vsetcc.ll --check-prefixes=SSE
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=x86_64-- -mattr=+sse2
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\sext-vsetcc.ll' --check-prefixes=SSE
# note: command had no output on stdout or stderr
# RUN: at line 3
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\sext-vsetcc.ll -mtriple=x86_64-- -mattr=+avx2 | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\sext-vsetcc.ll --check-prefixes=AVX,AVX2
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=x86_64-- -mattr=+avx2
# note: command had no output on stdout or stderr
# error: command failed with exit status: 15
# error: command reached timeout: True
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\sext-vsetcc.ll' --check-prefixes=AVX,AVX2
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\sext-vsetcc.ll --check-prefixes=AVX,AVX2
# `-----------------------------
# error: command failed with exit status: 2
# error: command reached timeout: True

--

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

@github-actions
Copy link

🐧 Linux x64 Test Results

  • 167336 tests passed
  • 2964 tests skipped
  • 10 tests failed

Failed Tests

(click on a test name to see its output)

LLVM

LLVM.CodeGen/AArch64/arm64-vcmp.ll
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/arm64-vcmp.ll -mtriple=arm64-eabi -aarch64-neon-syntax=apple | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/arm64-vcmp.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=arm64-eabi -aarch64-neon-syntax=apple
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/arm64-vcmp.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/arm64-vcmp.ll:256:10: error: CHECK: expected string not found in input
# | ; CHECK: cmgt.16b v0, v0, v1
# |          ^
# | <stdin>:292:10: note: scanning from here
# | sext_cmp: // @sext_cmp
# |          ^
# | <stdin>:295:2: note: possible intended match here
# |  cmgt.16b v0, v1, v0
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/arm64-vcmp.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |            287:  .cfi_endproc 
# |            288:  // -- End function 
# |            289:  .globl sext_cmp // -- Begin function sext_cmp 
# |            290:  .p2align 2 
# |            291:  .type sext_cmp,@function 
# |            292: sext_cmp: // @sext_cmp 
# | check:256'0              X~~~~~~~~~~~~~ error: no match found
# |            293:  .cfi_startproc 
# | check:256'0     ~~~~~~~~~~~~~~~~
# |            294: // %bb.0: 
# | check:256'0     ~~~~~~~~~~
# |            295:  cmgt.16b v0, v1, v0 
# | check:256'0     ~~~~~~~~~~~~~~~~~~~~~
# | check:256'1      ?                    possible intended match
# |            296:  ret 
# | check:256'0     ~~~~~
# |            297: .Lfunc_end25: 
# | check:256'0     ~~~~~~~~~~~~~~
# |            298:  .size sext_cmp, .Lfunc_end25-sext_cmp 
# | check:256'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            299:  .cfi_endproc 
# | check:256'0     ~~~~~~~~~~~~~~
# |            300:  // -- End function 
# | check:256'0     ~~~~~~~~~~~~~~~~~~~~
# |            301:  .section ".note.GNU-stack","",@progbits 
# | check:256'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

LLVM.CodeGen/AMDGPU/min.ll
Exit Code: -9
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=r600-- -mcpu=cypress < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/min.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=EG /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/min.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=r600-- -mcpu=cypress
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=EG /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/min.ll
# note: command had no output on stdout or stderr
# RUN: at line 3
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=kaveri < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/min.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=CI /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/min.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=kaveri
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=CI /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/min.ll
# note: command had no output on stdout or stderr
# RUN: at line 4
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=tonga < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/min.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=VI /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/min.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=tonga
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=VI /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/min.ll
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True

--

LLVM.CodeGen/AMDGPU/sminmax.v2i16.ll
Exit Code: -9
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=amdgcn -mcpu=gfx900 < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/sminmax.v2i16.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck -check-prefix=GFX9 /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/sminmax.v2i16.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=amdgcn -mcpu=gfx900
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck -check-prefix=GFX9 /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/sminmax.v2i16.ll
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True

--

LLVM.CodeGen/AMDGPU/uaddo.ll
Exit Code: -9
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/uaddo.ll -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tahiti | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/uaddo.ll --check-prefix=SI
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tahiti
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/uaddo.ll --check-prefix=SI
# note: command had no output on stdout or stderr
# RUN: at line 3
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/uaddo.ll -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tonga | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/uaddo.ll --check-prefix=VI
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tonga
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/uaddo.ll --check-prefix=VI
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True

--

LLVM.CodeGen/AMDGPU/usubo.ll
Exit Code: -9
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/usubo.ll -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tahiti | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/usubo.ll --check-prefix=SI
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tahiti
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/usubo.ll --check-prefix=SI
# note: command had no output on stdout or stderr
# RUN: at line 3
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/usubo.ll -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tonga | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/usubo.ll --check-prefix=VI
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -amdgpu-scalarize-global-loads=false -mtriple=amdgcn -mcpu=tonga
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/usubo.ll --check-prefix=VI
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True

--

LLVM.CodeGen/Hexagon/isel-vselect-v4i8.ll
Exit Code: -9
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=hexagon < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/Hexagon/isel-vselect-v4i8.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/Hexagon/isel-vselect-v4i8.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=hexagon
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/Hexagon/isel-vselect-v4i8.ll
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True

--

LLVM.CodeGen/Hexagon/isel-zext-vNi1.ll
Exit Code: -9
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=hexagon -disable-hsdr < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/Hexagon/isel-zext-vNi1.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/Hexagon/isel-zext-vNi1.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=hexagon -disable-hsdr
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/Hexagon/isel-zext-vNi1.ll
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True

--

LLVM.CodeGen/Hexagon/vect/setcc-v32.ll
Exit Code: -9
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=hexagon < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/Hexagon/vect/setcc-v32.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/Hexagon/vect/setcc-v32.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=hexagon
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/Hexagon/vect/setcc-v32.ll
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True

--

LLVM.CodeGen/Hexagon/vect/vect-bad-bitcast.ll
Exit Code: -9
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=hexagon -mcpu=hexagonv5 < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/Hexagon/vect/vect-bad-bitcast.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=hexagon -mcpu=hexagonv5
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True

--

LLVM.CodeGen/X86/sext-vsetcc.ll
Exit Code: -9
Timeout: Reached timeout of 1200 seconds

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/sext-vsetcc.ll -mtriple=x86_64-- -mattr=+sse2 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/sext-vsetcc.ll --check-prefixes=SSE
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=x86_64-- -mattr=+sse2
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/sext-vsetcc.ll --check-prefixes=SSE
# note: command had no output on stdout or stderr
# RUN: at line 3
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/sext-vsetcc.ll -mtriple=x86_64-- -mattr=+avx2 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/sext-vsetcc.ll --check-prefixes=AVX,AVX2
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=x86_64-- -mattr=+avx2
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/sext-vsetcc.ll --check-prefixes=AVX,AVX2
# note: command had no output on stdout or stderr
# error: command failed with exit status: -9
# error: command reached timeout: True

--

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

@DaKnig DaKnig force-pushed the dkg/setcc_trunc branch 2 times, most recently from 966a8bd to 8f677c1 Compare December 20, 2025 12:24
(setcc (zext a), (zext b), setu??) -> (setcc a, b, setu??)
@DaKnig
Copy link
Author

DaKnig commented Dec 20, 2025

topperc:

This PR should contain two commits. One adding just the tests with the current codegen. And a second commit that shows that changes DAGCombiner and shows how the tests change.

Done. I have 4 commits now, so it is easier to look at: one empty with the message (so I wont forget it when I do soft reset), one with the lit tests before the change, one with code, and one with lit tests after.

it seems like X86 does the exact opposite transformation. maybe I should change the condition to !LegalOperations only? (Didn't work) Or maybe "unless these zext come from a load and the target has zext load"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:AArch64 llvm:SelectionDAG SelectionDAGISel as well

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants