[all-commits] [llvm/llvm-project] df58c3: [RISCV][DAGCombiner] Fix potential missed combine ...

Kai Lin via All-commits all-commits at lists.llvm.org
Wed Nov 19 12:20:43 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: df58c38b5a831da1cd96317297c9482402c60216
      https://github.com/llvm/llvm-project/commit/df58c38b5a831da1cd96317297c9482402c60216
  Author: Kai Lin <50469469+OMG-link at users.noreply.github.com>
  Date:   2025-11-19 (Wed, 19 Nov 2025)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    A llvm/test/CodeGen/RISCV/rvv/combine-vl-vw-macc.ll

  Log Message:
  -----------
  [RISCV][DAGCombiner] Fix potential missed combine in VL->VW extension (#168026)

The previous implementation of `combineOp_VLToVWOp_VL` manually replaced
old
nodes with newly created widened nodes, but only added the new node
itself to
the `DAGCombiner` worklist. Since the users of the new node were not
added,
some combine opportunities could be missed when external `DAGCombiner`
passes
expected those users to be reconsidered.

This patch replaces the custom replacement logic with a call to
`DCI.CombineTo()`, which performs node replacement in a way consistent
with
`DAGCombiner::Run`:
- Replace all uses of the old node.
- Add the new node and its users to the worklist.
- Clean up unused nodes when appropriate.

Using `CombineTo` ensures that `combineOp_VLToVWOp_VL` behaves
consistently with
the standard `DAGCombiner` update model, avoiding discrepancies between
the
private worklist inside this routine and the global worklist managed by
the
combiner.

This resolves missed combine cases involving VL -> VW operator widening.

---------

Co-authored-by: Kai Lin <omg_link at qq.com>



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