[all-commits] [llvm/llvm-project] 467390: [InstCombine] Skip redundant demanded element quer...

Chengjun via All-commits all-commits at lists.llvm.org
Sun Jul 5 21:24:33 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 467390e7c08a5067355aa72d6262ff965d7fc9b4
      https://github.com/llvm/llvm-project/commit/467390e7c08a5067355aa72d6262ff965d7fc9b4
  Author: Chengjun <chengjunp at Nvidia.com>
  Date:   2026-07-05 (Sun, 05 Jul 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
    M llvm/test/Transforms/InstCombine/vec_demanded_elts.ll

  Log Message:
  -----------
  [InstCombine] Skip redundant demanded element queries in insert chains (#205948)

Avoid re-running `SimplifyDemandedVectorElts` on intermediate
`insertelement` chain nodes when a bounded scan proves the top-level
all-lanes query cannot change the IR.

The skip is implemented inside the `InsertElement` case of
`SimplifyDemandedVectorElts` and is limited to the top-level all-lanes
query (`Depth == 0 && DemandedElts.isAllOnes()`). The bounded scan
matches the existing SDVE depth window and only skips chains with
distinct in-range constant insert indices. This keeps the normal SDVE
path for duplicate indices, variable indices, out-of-range indices,
multi-use chains, and the final chain root.

This was motivated by a cutile matmul compile-time case where loop
unrolling produced 128-lane vector insert/extract chains. Before this
change, InstCombine repeatedly invoked SDVE on intermediate
`insertelement` nodes in those chains. On the representative IR, the
affected InstCombine pass time went from about `44.9 ms` to `29.8 ms`,
and total `opt` compile time was reduced by about 20%.

AI disclosure: This patch was developed with assistance from
@openai-codex using GPT-5.5 via [Codex](https://openai.com/codex/). I
reviewed and tested the final changes before submission.



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