[all-commits] [llvm/llvm-project] 825d7a: [SelectionDAG] Fold extracts of subvector inserts

Krzysztof Drewniak via All-commits all-commits at lists.llvm.org
Wed Jun 3 15:12:21 PDT 2026


  Branch: refs/heads/users/krzysz00/extract-insert-dagcombine
  Home:   https://github.com/llvm/llvm-project
  Commit: 825d7af2439b108cf48b8a136766285cae9a47fa
      https://github.com/llvm/llvm-project/commit/825d7af2439b108cf48b8a136766285cae9a47fa
  Author: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
  Date:   2026-06-03 (Wed, 03 Jun 2026)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    A llvm/test/CodeGen/AMDGPU/dagcombine-freeze-extract-subvector-loop.ll
    M llvm/test/CodeGen/X86/vector-interleaved-store-i16-stride-3.ll
    M llvm/test/CodeGen/X86/vector-interleaved-store-i16-stride-6.ll
    M llvm/test/CodeGen/X86/vector-interleaved-store-i64-stride-6.ll
    M llvm/test/CodeGen/X86/vector-interleaved-store-i8-stride-6.ll
    M llvm/test/CodeGen/X86/vector-replicaton-i1-mask.ll

  Log Message:
  -----------
  [SelectionDAG] Fold extracts of subvector inserts

Fold extract_subvector(insert_subvector(...)) when the extraction is
outside the inserted subvector or the inserted subvector only amends
the extracted

In particular,
1. vA extract_subvector (vB insert_subvector(vB X, vC Y, C1), C2) =>
vA extract_subvector(X, C2) when [C2, C2 + A) intersect [C1, C1 + C)
is the empty set
2. ... => extract_subvector(Y, C2 - C1) if [C2, C2 + Y) is a subset of
[C1, C1 + C) - an existing simplification
3. ... => vA insert_subvector(vA extract_subvector(vB X, C2), vC Y, C1 - C2)
if [C1, C1 + C) is a subset of [C2, C2 + A) - that is, if you're only
updating the extracted sub-part.

Adds a regresssion tests for an infinite SelectionDAG cycle that is
fixed by a stack of commits that ends with this one.

AI note: an LLM generated the code and the test, I've read them

Co-Authored-By: OpenAI Codex <codex at openai.com>


  Commit: 38774b1490ea4a4944cdaa6e17cf3f35ffba6a28
      https://github.com/llvm/llvm-project/commit/38774b1490ea4a4944cdaa6e17cf3f35ffba6a28
  Author: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
  Date:   2026-06-03 (Wed, 03 Jun 2026)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/AMDGPU/dagcombine-freeze-extract-subvector-loop.ll

  Log Message:
  -----------
  Style, named test vars


Compare: https://github.com/llvm/llvm-project/compare/e2de9c1107d9...38774b1490ea

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list