diff options
author | Nikita Popov <npopov@redhat.com> | 2025-07-23 10:05:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-23 10:05:09 +0200 |
commit | 7e878aaf23dd559fa491a0bf6168f15f939c5965 (patch) | |
tree | ab9260f9418df91d574d892ee9ddc48f513c6fc7 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | b7889a65a8e54f2d9c7f578a515a7bf970044bfe (diff) | |
download | llvm-7e878aaf23dd559fa491a0bf6168f15f939c5965.zip llvm-7e878aaf23dd559fa491a0bf6168f15f939c5965.tar.gz llvm-7e878aaf23dd559fa491a0bf6168f15f939c5965.tar.bz2 |
[PatternMatch] Add support for capture-and-match (NFC) (#149825)
When using PatternMatch, there is a common problem where we want to both
match something against a pattern, but also capture the
value/instruction for various reasons (e.g. to access flags).
Currently the two ways to do that is to either capture using
m_Value/m_Instruction and do a separate match on the result, or to use
the somewhat awkward `m_CombineAnd(m_XYZ, m_Value(V))` pattern.
This PR introduces to add a variant of `m_Value`/`m_Instruction` which
does both a capture and a match. `m_Value(V, m_XYZ)` is basically
equivalent to `m_CombineAnd(m_XYZ, m_Value(V))`.
I've ported two InstCombine files to this pattern as a sample.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions