Skip to content

[X86] combineINSERT_SUBVECTOR - pull out common variables. NFC. #133705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025

Conversation

RKSimon
Copy link
Collaborator

@RKSimon RKSimon commented Mar 31, 2025

Reduces diff for an updated version of #133083

@llvmbot
Copy link
Member

llvmbot commented Mar 31, 2025

@llvm/pr-subscribers-backend-x86

Author: Simon Pilgrim (RKSimon)

Changes

Reduces diff for an updated version of #133083


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

1 Files Affected:

  • (modified) llvm/lib/Target/X86/X86ISelLowering.cpp (+5-5)
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 72977923bac2b..76de7e888d985 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -58823,6 +58823,8 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
 
   uint64_t IdxVal = N->getConstantOperandVal(2);
   MVT SubVecVT = SubVec.getSimpleValueType();
+  int VecNumElts = OpVT.getVectorNumElements();
+  int SubVecNumElts = SubVecVT.getVectorNumElements();
 
   if (Vec.isUndef() && SubVec.isUndef())
     return DAG.getUNDEF(OpVT);
@@ -58882,10 +58884,9 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
       SubVec.getOperand(0).getSimpleValueType() == OpVT &&
       (IdxVal != 0 ||
        !(Vec.isUndef() || ISD::isBuildVectorAllZeros(Vec.getNode())))) {
+    SDValue ExtSrc = SubVec.getOperand(0);
     int ExtIdxVal = SubVec.getConstantOperandVal(1);
     if (ExtIdxVal != 0) {
-      int VecNumElts = OpVT.getVectorNumElements();
-      int SubVecNumElts = SubVecVT.getVectorNumElements();
       SmallVector<int, 64> Mask(VecNumElts);
       // First create an identity shuffle mask.
       for (int i = 0; i != VecNumElts; ++i)
@@ -58893,8 +58894,7 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
       // Now insert the extracted portion.
       for (int i = 0; i != SubVecNumElts; ++i)
         Mask[i + IdxVal] = i + ExtIdxVal + VecNumElts;
-
-      return DAG.getVectorShuffle(OpVT, dl, Vec, SubVec.getOperand(0), Mask);
+      return DAG.getVectorShuffle(OpVT, dl, Vec, ExtSrc, Mask);
     }
   }
 
@@ -58942,7 +58942,7 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
   // If we're splatting the lower half subvector of a full vector load into the
   // upper half, attempt to create a subvector broadcast.
   // TODO: Drop hasOneUse checks.
-  if (IdxVal == (OpVT.getVectorNumElements() / 2) &&
+  if ((int)IdxVal == (VecNumElts / 2) &&
       Vec.getValueSizeInBits() == (2 * SubVec.getValueSizeInBits()) &&
       (Vec.hasOneUse() || SubVec.hasOneUse())) {
     auto *VecLd = dyn_cast<LoadSDNode>(Vec);

@RKSimon RKSimon merged commit aad9630 into llvm:main Mar 31, 2025
9 of 13 checks passed
@RKSimon RKSimon deleted the x86-insert_subvector-repeated-variables branch March 31, 2025 12:39
@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 31, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-windows running on linaro-armv8-windows-msvc-05 while building llvm at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/141/builds/7485

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: tools/lldb-server/qSupported/TestGdbRemote_qSupported.py (1225 of 2102)
UNSUPPORTED: lldb-api :: tools/lldb-server/register-reading/TestGdbRemoteGPacket.py (1226 of 2102)
PASS: lldb-api :: tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py (1227 of 2102)
UNSUPPORTED: lldb-api :: tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py (1228 of 2102)
UNSUPPORTED: lldb-api :: tools/lldb-server/thread-name/TestGdbRemoteThreadName.py (1229 of 2102)
UNSUPPORTED: lldb-api :: tools/lldb-server/vCont-threads/TestPartialResume.py (1230 of 2102)
UNSUPPORTED: lldb-api :: tools/lldb-server/vCont-threads/TestSignal.py (1231 of 2102)
PASS: lldb-api :: types/TestCharType.py (1232 of 2102)
PASS: lldb-api :: types/TestCharTypeExpr.py (1233 of 2102)
PASS: lldb-api :: types/TestDoubleTypes.py (1234 of 2102)
FAIL: lldb-api :: tools/lldb-server/TestLldbGdbServer.py (1235 of 2102)
******************** TEST 'lldb-api :: tools/lldb-server/TestLldbGdbServer.py' FAILED ********************
Script:
--
C:/Users/tcwg/scoop/apps/python/current/python.exe C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --env LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include --env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --arch aarch64 --build-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex --lldb-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-lldb\lldb-api --clang-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-api --executable C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --compiler C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe --make C:/Users/tcwg/scoop/shims/make.exe --llvm-tools-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --lldb-obj-root C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb --lldb-libs-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --skip-category=watchpoint C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\tools\lldb-server -p TestLldbGdbServer.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision aad9630e42d70b4cbfd6bc544576bd96844e737d)
  clang revision aad9630e42d70b4cbfd6bc544576bd96844e737d
  llvm revision aad9630e42d70b4cbfd6bc544576bd96844e737d
Skipping the following test categories: ['watchpoint', 'libc++', 'libstdcxx', 'dwo', 'dsym', 'gmodules', 'debugserver', 'objc', 'fork', 'pexpect']


--
Command Output (stderr):
--
UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_Hc_then_Csignal_signals_correct_thread_launch_debugserver (TestLldbGdbServer.LldbGdbServerTestCase.test_Hc_then_Csignal_signals_correct_thread_launch_debugserver) (test case does not fall in any category of interest for this run) 

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_Hc_then_Csignal_signals_correct_thread_launch_llgs (TestLldbGdbServer.LldbGdbServerTestCase.test_Hc_then_Csignal_signals_correct_thread_launch_llgs) (skip on windows) 

PASS: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_Hg_fails_on_another_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase.test_Hg_fails_on_another_pid_llgs)

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_Hg_fails_on_minus_one_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase.test_Hg_fails_on_minus_one_pid_llgs) (skip on windows) 

PASS: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_Hg_fails_on_zero_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase.test_Hg_fails_on_zero_pid_llgs)

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_Hg_switches_to_3_threads_launch_debugserver (TestLldbGdbServer.LldbGdbServerTestCase.test_Hg_switches_to_3_threads_launch_debugserver) (test case does not fall in any category of interest for this run) 

PASS: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_Hg_switches_to_3_threads_launch_llgs (TestLldbGdbServer.LldbGdbServerTestCase.test_Hg_switches_to_3_threads_launch_llgs)

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_P_and_p_thread_suffix_work_debugserver (TestLldbGdbServer.LldbGdbServerTestCase.test_P_and_p_thread_suffix_work_debugserver) (test case does not fall in any category of interest for this run) 

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_P_and_p_thread_suffix_work_llgs (TestLldbGdbServer.LldbGdbServerTestCase.test_P_and_p_thread_suffix_work_llgs) (skip on windows) 

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_P_writes_all_gpr_registers_debugserver (TestLldbGdbServer.LldbGdbServerTestCase.test_P_writes_all_gpr_registers_debugserver) (test case does not fall in any category of interest for this run) 


SchrodingerZhu pushed a commit to SchrodingerZhu/llvm-project that referenced this pull request Mar 31, 2025
@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 31, 2025

LLVM Buildbot has detected a new failure on builder clang-aarch64-sve-vla-2stage running on linaro-g3-01 while building llvm at step 12 "ninja check 2".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/41/builds/5855

Here is the relevant piece of the build log for the reference
Step 12 (ninja check 2) failure: stage 2 checked (failure)
...
PASS: Clangd Unit Tests :: ./ClangdTests/80/81 (25172 of 97492)
PASS: Flang :: Driver/linker-flags.f90 (25173 of 97492)
PASS: Flang :: Driver/fveclib-codegen.f90 (25174 of 97492)
PASS: Flang :: Driver/macro-def-undef.F90 (25175 of 97492)
PASS: Flang :: Driver/predefined-macros-x86.f90 (25176 of 97492)
PASS: Flang :: Driver/print-effective-triple.f90 (25177 of 97492)
PASS: Flang :: Driver/color-diagnostics.f90 (25178 of 97492)
PASS: Flang :: Driver/parse-error.ll (25179 of 97492)
PASS: Flang :: Driver/predefined-macros-compiler-version.F90 (25180 of 97492)
UNRESOLVED: Flang :: Driver/slp-vectorize.ll (25181 of 97492)
******************** TEST 'Flang :: Driver/slp-vectorize.ll' FAILED ********************
Test has no 'RUN:' line
********************
PASS: Flang :: Driver/print-resource-dir.F90 (25182 of 97492)
PASS: Flang :: Driver/print-target-triple.f90 (25183 of 97492)
PASS: Flang :: Driver/scanning-error.f95 (25184 of 97492)
PASS: Flang :: Driver/pass-plugin-not-found.f90 (25185 of 97492)
PASS: Flang :: Driver/phases.f90 (25186 of 97492)
PASS: Flang :: Driver/include-header.f90 (25187 of 97492)
PASS: Flang :: Driver/pthread.f90 (25188 of 97492)
PASS: Flang :: Driver/override-triple.ll (25189 of 97492)
PASS: Flang :: Driver/print-pipeline-passes.f90 (25190 of 97492)
PASS: Flang :: Driver/mlir-pass-pipeline.f90 (25191 of 97492)
PASS: Flang :: Driver/parse-fir-error.ll (25192 of 97492)
PASS: Flang :: Driver/std2018-wrong.f90 (25193 of 97492)
PASS: Flang :: Driver/pp-fixed-form.f90 (25194 of 97492)
PASS: Flang :: Driver/fd-lines-as.f90 (25195 of 97492)
PASS: Flang :: Driver/supported-suffices/f08-suffix.f08 (25196 of 97492)
PASS: Flang :: Driver/supported-suffices/f03-suffix.f03 (25197 of 97492)
PASS: Flang :: Driver/missing-arg.f90 (25198 of 97492)
PASS: Flang :: Driver/bbc-openmp-version-macro.f90 (25199 of 97492)
PASS: Flang :: Driver/q-unused-arguments.f90 (25200 of 97492)
PASS: Flang :: Driver/target.f90 (25201 of 97492)
PASS: Flang :: Driver/mlink-builtin-bc.f90 (25202 of 97492)
PASS: Flang :: Driver/tco-code-gen-llvm.fir (25203 of 97492)
PASS: Flang :: Driver/config-file.f90 (25204 of 97492)
PASS: Flang :: Driver/target-gpu-features.f90 (25205 of 97492)
PASS: Flang :: Driver/fdefault.f90 (25206 of 97492)
PASS: Flang :: Driver/parse-ir-error.f95 (25207 of 97492)
PASS: Flang :: Driver/no-duplicate-main.f90 (25208 of 97492)
PASS: Flang :: Driver/unparse-with-modules.f90 (25209 of 97492)
PASS: Flang :: Driver/unsupported-vscale-max-min.f90 (25210 of 97492)
PASS: Flang :: Driver/lto-flags.f90 (25211 of 97492)
PASS: Clangd Unit Tests :: ./ClangdTests/8/81 (25212 of 97492)
PASS: Flang :: Driver/input-from-stdin/input-from-stdin.f90 (25213 of 97492)
PASS: Flang :: Driver/optimization-remark-backend.f90 (25214 of 97492)
PASS: Flang :: Driver/save-temps-use-module.f90 (25215 of 97492)
PASS: Flang :: Driver/multiple-input-files.f90 (25216 of 97492)
PASS: Flang :: Driver/w-arg-unsupported.f90 (25217 of 97492)

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

Successfully merging this pull request may close these issues.

3 participants