[mlir][emitc] Refactor the e2e test for TOSA -> EmitC lowering (#194686)
Update the TOSA -> EmitC test, mlir/test/Dialect/EmitC/tosa/ops.mlir, to also
compile the generated source with a C++ compiler. This adds an `mlir-translate`
step, making the overall flow:
mlir-opt tosa.mlir | mlir-translate | c++ -Wall -Werror -c
Although the test still does not execute the generated code, compiling it with
a host compiler increases coverage and makes the test closer to an integration
test. For this reason, move it to:
mlir/test/Integration/Dialect/EmitC/
The source generated by the translator uses `size_t`, which requires the
`stddef.h` header. This is currently provided explicitly in the compile step
with `-include stddef.h`; a follow-up should consider emitting the required
include from the translator instead.
[DAG] Replace llvm::isNeutralConstant with SelectionDAG::isIdentityElement (#195827)
Initial step towards generalising this - move to SelectionDAG like other
valuetracker helpers, add DemandedElts/Depth controls, etc.
We can add target node handling when it becomes necessary.
Renamed to "IdentityElement" to match llvm naming conventions.
[Coverage] Improve performance of propagating Counter of Expansions
This improves `-dump-coverage-mapping` (939,498 lines) for
`RISCVInstructionSelector.cpp` from 30m to 1m18s and also improves
`llvm-cov` for `check-llvm` from 33m to 24s.
The current implementation behaved O(N^2) order with hundreds
thousands of Expansions.
This assumes:
- Records are partitioned by FileID.
- ExpandedFileID doesn't point FileID==0, since it is the root.
- The Count in Expansion is propagated from 1st Record in
ExpandedFileID.
Therefore another fact below can be assumed.
- Propagation chain consists of Expansions at each 1st Record.
This scans the Record at most a few times. O(N) is expected.
[2 lines not shown]
[ADT] Bitset: add shift operators, word accessors, and etc (#193400)
This PR is split out from #191757 per reviewer request. It has the
following changes to `llvm::Bitset<N>`:
* Added `operator<<`/`<<=`/`>>`/`>>=`, `getNumWords()`, `getWord()`, and
`findLastSet()`.
* Moved the `std::array<>` constructor from protected to **public** and
**explicit**.
A follow-up PR will use these to re-implement `LaneBitmask` as a
`llvm::Bitset` wrapper.
---
The unit test in the PR is largely generated by LLMs. I have reviewed it
and manually applied changes to cover more edge cases.
[NFC][analyzer] Introduce specialized variants of makeNode (#194459)
This commit introduces new methods `makePostStmtNode` and
`makeNodeWithBinding` of `CoreEngine`, which will be used instead of the
5-parameter overloads of `NodeBuilder::generateNode` and
`NodeBuilder::generateSink` (which were originally methods of the class
`StmtNodeBuilder` that was deleted in commit
fb46677a858697afa116c4252e84050a07bc6a70).
This commit applies the newly introduced methods in a few places (as
examples), but there are 80+ call sites that use the 5-parameter
`NodeBuilder::generateNode` or `generateSink`, so this transition will
be completed in multiple follow-up commits.
I decided to introduce these methods because after the transition there
will be 20+ calls to `makePostStmtNode` and 30+ calls to
`makeNodeWithBinding` and it would be cumbersome to use plain `makeNode`
instead of these specialized variants.
[2 lines not shown]
[analyzer][NFC] Rename class `StackFrameContext` to `StackFrame` (#195802)
This patch continues the refactoring roadmap described in issue #190973
by renaming the `StackFrameContext` class to just `StackFrame`. Many
variables of type `const StackFrame *` also had their names updated to
reflect the new class name `StackFrame`.
[mlir][spirv] Support OpenCL.std clz in the SPIR-V dialect (#195317)
Add support for the OpenCL.std clz extended instruction in the MLIR
SPIR-V dialect. From Spriv Specs - Op Name: "clz", Op Code: "151"
[clang][bytecode] Don't evaluate bound member function expressions in new constant interpreter (#194851)
**Problem:**
A crash is triggered by clangd's hover feature when using C++23 and the
new bytecode interpreter, which calls `Expr::EvaluateAsRValue()` to
attempt constant folding on an expression under the cursor, even when it
is not a valid constant expression.
Tested versions: 22.1.3, Trunk (x86_64-pc-linux-gnu)
**How to reproduce:**
```cpp
struct S { void f(); };
void g() { S s; s.f(); }
```
Running `clangd --check=repro.cpp`
(with `compile_flags.txt` containing `-std=c++23
-fexperimental-new-constant-interpreter`)
[69 lines not shown]
[mlir][SPIR-V] Refine OpTypeImage capability inference (#195060)
Capability requirements for OpTypeImage are determined by Dim, Sampled,
MS, and Arrayed
related to LLVM SPIR-V backend PR
https://github.com/llvm/llvm-project/pull/192626
[AArch64] Add C1-Premium scheduling model (#185398)
This patch adds the C1-Premium scheduling model. Values are derived from
Arm's SWOG for this core which can be found at
https://developer.arm.com/documentation/111080/3-0
Assisted-by Codex
[LangRef] Patchable function attributes (#195764)
Langref should document the expected layout for patchable-function-entry
/ patchable-function-prefix attrs (prefix nops go before the function
label, entry nops go after the label, both are before the prologue).
Fixes #195693.
[MLIR][Shard] Fold all_gather/all_slice inverse pairs (#193906)
Add a simplify pattern that replaces all_gather(all_slice(x))/all_slice(all_gather(x))
with x when grid, grid axes, and gather/slice axis match.
Co-authored-by: Cursor <cursoragent at cursor.com>
[AArch64] Enable SVE MaxBW for Neoverse-N2, prefer fixed at same cost (#195108)
This should be using the same settings as other 128b SVE cores. Very
slight performance improvement from MaxBW, regressions alleviated
by preferring fixed VFs over scalable when they're the same cost.
[OpenMP] Add target to build OpenMP runtime (#189557)
This adds a top-level target to build the OpenMP runtime, similar to
what was done in https://github.com/llvm/llvm-project/pull/186099 for
the Offload runtime.
Having this top-level target enables us to execute the build in the
pre-commit CI as shown in
https://github.com/llvm/llvm-project/pull/174955 (I actually just
cherry-picked the commit from that branch)
[MLIR] Fix offload map metadata order (#195346)
This fixes one part of
https://github.com/llvm/llvm-project/issues/195333.
There are two different semicolon-field orders in
offload/include/Shared/SourceInfo.h:
1. Per-map strings (`map_var_info_t`): first field is the mapped name,
second
is the file path:
```
/// Type alias for source location information for variable mappings with
/// data layout ";name;filename;row;col;;\0" from clang.
using map_var_info_t = void *;
```
2. `ident_t` region strings: first field is the file path, second is the
function name:
[46 lines not shown]