[all-commits] [llvm/llvm-project] ba9dc5: [ADT] Add is_splat overload accepting initializer_...
Jakub Kuderski via All-commits
all-commits at lists.llvm.org
Mon Aug 8 07:24:21 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ba9dc5f577389db2cc706c0c66615f430a55d153
https://github.com/llvm/llvm-project/commit/ba9dc5f577389db2cc706c0c66615f430a55d153
Author: Jakub Kuderski <kubak at google.com>
Date: 2022-08-08 (Mon, 08 Aug 2022)
Changed paths:
M llvm/include/llvm/ADT/STLExtras.h
M llvm/unittests/ADT/STLExtrasTest.cpp
Log Message:
-----------
[ADT] Add is_splat overload accepting initializer_list
Allow for `is_splat` to be used inline, similar to `is_contained`, e.g.,
```
if (is_splat({type1, type2, type3, type4}))
...
```
which is much more concise and less typo-prone than an equivalent chain of equality comparisons.
My immediate motivation is to clean up some code in the SPIR-V dialect that currently needs to either construct a temporary container or use `makeArrayRef` before calling `is_splat`.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D131289
More information about the All-commits
mailing list