[all-commits] [llvm/llvm-project] 883789: [DAGCombine] Count leading ones: refine post DAG/T...

Robert Dazi via All-commits all-commits at lists.llvm.org
Sun Sep 15 04:48:59 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8837898b8dc34cfa21ba877832a5865af06f52c9
      https://github.com/llvm/llvm-project/commit/8837898b8dc34cfa21ba877832a5865af06f52c9
  Author: Robert Dazi <14996868+v01dXYZ at users.noreply.github.com>
  Date:   2024-09-15 (Sun, 15 Sep 2024)

  Changed paths:
    M llvm/include/llvm/CodeGen/SDPatternMatch.h
    M llvm/include/llvm/IR/VPIntrinsics.def
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    A llvm/test/CodeGen/AArch64/ctlo.ll
    M llvm/test/CodeGen/LoongArch/ctlz-cttz-ctpop.ll
    M llvm/test/CodeGen/RISCV/rvv/ctlz-vp.ll
    M llvm/test/CodeGen/X86/ctlo.ll
    M llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp

  Log Message:
  -----------
  [DAGCombine] Count leading ones: refine post DAG/Type Legalisation if promotion (#102877)

This PR is related to #99591. In this PR, instead of modifying how the
legalisation occurs depending on surrounding instructions, we refine
after legalisation.

This PR has two parts:

* `SDPatternMatch/MatchContext`: Modify a little bit the code to match
Operands (used by `m_Node(...)`) and Unary/Binary/Ternary Patterns to
make it compatible with `VPMatchContext`, instead of only `m_Opc`
supported. Some tests were added to ensure no regressions.
* `DAGCombiner`: Add a `foldSubCtlzNot` which detect and rewrite the
patterns using matching context.

Remaining Tasks:

- [ ] GlobalISel
- [ ] Currently the pattern matching will occur even before
legalisation. Should I restrict it to specific stages instead ?
- [ ] Style: Add a visitVP_SUB ?? Move `foldSubCtlzNot` in another
location for style consistency purpose ?

@topperc

---------

Co-authored-by: v01dxyz <v01dxyz at v01d.xyz>



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