[VP][DAGCombiner] Introduce generalized pattern match for vp sdnodes.
authorYeting Kuo <yeting.kuo@sifive.com>
Tue, 17 Jan 2023 05:30:24 +0000 (13:30 +0800)
committerYeting Kuo <yeting.kuo@sifive.com>
Wed, 8 Feb 2023 05:45:35 +0000 (13:45 +0800)
commit7bc2cd614ec479d5ffacba6e80ce849cd922ffdf
tree60df4df91931bd910c3acff146b83244182df30d
parentd768b97424f9e1a0aae45440a18b99f21c4027ce
[VP][DAGCombiner] Introduce generalized pattern match for vp sdnodes.

The patch tries to solve duplicated combine work for vp sdnodes. The idea is to
introduce MatchConext that verifies specific patterns and generate specific node
infromation. There is two MatchConext in DAGCombiner. EmptyMatcher is for
normal nodes and VPMatcher is for vp nodes.

The idea of this patch is come form Simon Moll's proposal [0]. I only fixed some
minor issues and added few new features in this patch.

[0]: https://github.com/sx-aurora-dev/llvm-project/commit/c38a14484aa2945f3b05369560b65916dd832f76

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D141891
llvm/include/llvm/CodeGen/ISDOpcodes.h
llvm/include/llvm/IR/VPIntrinsics.def
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/RISCV/rvv/fold-vp-fadd-and-vp-fmul.ll [new file with mode: 0644]