[RISCV] Use a switch in RISCVInstrInfo::verifyInstruction. NFC (#170961)
The immediate only operands handled with a range check and a switch
nested under the default case.
[InstCombine] Fix bail-out in `PHIsEqualValue()` (#170650)
We encountered a such case: `PHIsEqualValue()` is called with a PHI node
`PN` whose incoming values are all PHI nodes, and `NonPhiInVal` is
nullptr. When the size of `ValueEqualPHIs` reaches 16, `NonPhiInVal` is
still nullptr, then we keep scanning PHI node operands, this time the
recursion won't bail out even if we have visited too many PHI nodes.
In our case, the recursion ends with ~1700 PHI nodes visited, causes
InstCombine time-consuming.
[libcxx] Removal of narrowing conversions in `flat_[multi]{set, map}` tests for compatibility with MSVC (#170909)
Impacts files in `test/std/containers/container.adaptors/flat.xxx`. No
meaning is changed; only appropriate types are spelled out to prevent
compiler warnings.
- Replace `char`s and `short`s used in tests of `flat_[multi]{set, map}`
with `long`s to prevent warnings about narrowing conversions when
running tests. Allow increased test coverage for MSVC STL.
- Make test code robust against evil overloads of operator comma .(2
files)
- Add `[[maybe_unused]]` to some local `typedef`s that are sometimes
unused due to usage of `LIBCPP_STATIC_ASSERT`.
For discussion and suggested changes, see the LLVM Discord
https://discord.com/channels/636084430946959380/636732894974312448/1445901676400742533
TrimmedMlirOptLib: Remove IRDLDialect dependency
Add conditional compilation guards to MlirOptLib to allow building
without the IRDLDialect dependency.
- Add #ifndef MLIR_MLIROPTLIB_NO_IRDL guards around IRDL includes
- Guard --irdl-file command line option
- Guard loadIRDLDialects() function
- Guard calls to loadIRDLDialects() in doVerifyRoundTrip and processBuffer
- Add TrimmedMlirOptLib bazel target with local_defines
Dependency path removed:
aster-tools → aster-opt → MlirOptLib → IRDLDialect
[clang-tidy] Don't cache classes by name in `fuchsia-multiple-inheritance` (#171016)
Context: for every class, this check needs to compute whether that class
is an interface (i.e. only has pure virtual methods). This is expensive,
so the check caches the computation. But it caches by class name, which
is problematic, because the same name can refer to different classes at
different scopes. Here's for example a false negative it causes:
https://godbolt.org/z/bMGc5sYqh. This PR changes it to cache by
`CXXRecordDecl *` instead.
[SPIRV] Add support for pointers to functions with aggregate args/returns as global variables / constant initialisers (#169595)
This patch does two things:
1. it extends the aggregate arg / ret replacement transform to work on
indirect calls / pointers to function. It is somewhat spread out as
retrieving the original function type is needed in a few places. In
general, we should rethink / rework the entire infrastructure around
aggregate arg/ret handling, using an opaque target specific type rather
than i32;
2. it enables global variables of pointer to function type, and, more
specifically, global variables of a aggregate type (arrays / structures)
with pointer to function elements.
This also exposes some issues in how we handle pointers to function and
lowering indirect function calls, primarily around not using the program
address space. These will be handled in a subsequent patch as they'll
require somewhat more intrusive surgery, possibly involving modifying
the data layout.
[mlir][arith] `arith-to-apfloat`: Add vector support (#171024)
Add support for vectorized operations such as `arith.addf ... :
vector<4xf4E2M1FN>`. The computation is scalarized: scalar operands are
extracted with `vector.to_elements`, multiple scalar computations are
performed and the result is inserted back into a vector with
`vector.from_elements`.
[SPIRV] Use AMDGPU ABI for AMDGCN flavoured SPIRV (#169865)
At the moment AMDGCN flavoured SPIRV uses the SPIRV ABI with some tweaks
revolving around passing aggregates as direct. This is problematic in
multiple ways:
- it leads to divergence from code compiled for a concrete target, which
makes it difficult to debug;
- it incurs a run time cost, when dealing with larger aggregates;
- it incurs a compile time cost, when dealing with larger aggregates.
This patch switches over AMDGCN flavoured SPIRV to implement the AMDGPU
ABI (except for dealing with variadic functions, which will be added in
the future). One additional complication (and the primary motivation
behind the current less than ideal state of affairs) stems from `byref`,
which AMDGPU uses, not being expressible in SPIR-V. We deal with this by
CodeGen-ing for `byref`, lowering it to the `FuncParamAttr ByVal` in
SPIR-V, and restoring it when doing reverse translation from AMDGCN
flavoured SPIR-V.