diff options
author | Noah Goldstein <goldstein.w.n@gmail.com> | 2024-03-18 13:00:14 -0500 |
---|---|---|
committer | Noah Goldstein <goldstein.w.n@gmail.com> | 2024-05-03 14:10:24 -0500 |
commit | d8428dfeb8d9a0bbb5345f96f29a4a66eb950769 (patch) | |
tree | 6e1819e7107eb519b3825fc622a3394ae8898d43 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 285dbed147e243f416b003e150d67ffb0922ff16 (diff) | |
download | llvm-d8428dfeb8d9a0bbb5345f96f29a4a66eb950769.zip llvm-d8428dfeb8d9a0bbb5345f96f29a4a66eb950769.tar.gz llvm-d8428dfeb8d9a0bbb5345f96f29a4a66eb950769.tar.bz2 |
[PatternMatching] Add generic API for matching constants using custom conditions
The new API is:
`m_CheckedInt(Lambda)`/`m_CheckedFp(Lambda)`
- Matches non-undef constants s.t `Lambda(ele)` is true for all
elements.
`m_CheckedIntAllowUndef(Lambda)`/`m_CheckedFpAllowUndef(Lambda)`
- Matches constants/undef s.t `Lambda(ele)` is true for all
elements.
The goal with these is to be able to replace the common usage of:
```
match(X, m_APInt(C)) && CustomCheck(C)
```
with
```
match(X, m_CheckedInt(C, CustomChecks);
```
The rationale if we often ignore non-splat vectors because there are
no good APIs to handle them with and its not worth increasing code
complexity for such cases.
The hope is the API creates a common method handling
scalars/splat-vecs/non-splat-vecs to essentially make this a
non-issue.
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
0 files changed, 0 insertions, 0 deletions