[mlir][LLVM] Add support for `ptrtoaddr`
The `ptrtoaddr` op is akin to `ptrtoint` with some important differences:
* It does not capture the provenance of the pointer, meaning a pointer does not escape and subsequent `inttoptr` don't make a legal pointer. LLVM can then assume the pointer never escaped, which helps alias analysis.
* It does not support arbitrary integer types, but only exactly the integer type that is equal in width to the pointer type as specified by the data layout.
This PR adds the op the MLIR dialect and adds the corresponding verification for the datalayout property.
[mlir][reducer] Add split-input-file to mlir-reduce (#184970)
The tests for mlir-reduce are currently scattered. To centralize the
tests for mlir-reduce, I added the split-input-file feature to
mlir-reduce.It is part of
https://github.com/llvm/llvm-project/pull/184974.
[MC][WebAssembly] Allow strings for import modules and names in asm (#182896)
Current tooling for the WebAssembly component model uses import modules
and names such as `$root` and `[thread-index]`. Importing these from
assembly files requires support for non-valid identifiers in
`.import_name` and `.import_module` directives. This PR adds support for
specifying those as strings, e.g.:
```asm
.import_module __wasm_component_model_builtin_thread_index, "$root"
.import_name __wasm_component_model_builtin_thread_index, "[thread-index]"
```
[clang-doc] Add button toggle for light/dark theme (#181587)
The user can now manually toggle the light or dark theme instead of
waiting for the system theme to change.
Also fixes a typo that caused some overflow issues even when there was
no content to cause an overflow.
[Clang] Fix EmitAggregateCopy assertion for non-trivially-copyable sr… (#185091)
…et types
Fix for buildbot crash on #183639
The UseTemp path in AggExprEmitter::withReturnValueSlot copies back via
EmitAggregateCopy, which asserts that the type has a trivial copy/move
constructor or assignment operator. Gate the DestASMismatch condition on
isTriviallyCopyableType so that non-trivially-copyable types (e.g.
std::exception_ptr) fall through to the addrspacecast path instead.
Fix buildbot crash:
https://lab.llvm.org/buildbot/#/builders/73/builds/19803
[RISCV][P-ext] Only support sshlsat for splat immediate shift amounts. (#184886)
Fixes cannot select errors for other types of shift amounts.
I've made a new RISCVISD node that only allows an immediate operand.
It's assumed that the lowering code will only allow valid immediates so
I'm not using a TImmLeaf in the match.
[flang,acc] Support -ffp-maxmin-behavior option in lowering. (#184730)
This patch adds `flang -fc1` option `-ffp-maxmin-behavior` and
propagates it throughout Flang, so that semantics context,
lowering and the pass pipeline builder can use it.
MAX/MIN intrinsic and OpenACC max/min reduction lowering
are now controlled by the option.
I kept the `Legacy` mode, which is the default and matches the current
behavior. I am going to test and merge a follow-up patch that
replaces `Legacy` with `Portable`.
RFC:
https://discourse.llvm.org/t/flang-canonical-and-optimizable-representation-for-min-max/90037
clang/AMDGPU: Fix workgroup size builtins for nonuniform work group sizes
These were assuming uniform work group sizes. Emit the v4 and v5 sequences
to take the remainder group for the nonuniform case.
Currently the device libs uses this builtin on the legacy ABI path with
the same sequence to calculate the remainder, and fully implements the v5
path. If you perform a franken-build of the library with the updated builtin,
the result is worse. The duplicate sequence does not fully fold out. However,
it does not appear to be wrong. The relevant conformance tests still pass.
[CIR] Fix a crash when source location is unknown (#185059)
When we call `getLoc()` with an invalid `SourceLocation` and
`currSrcLoc` is also invalid, we were crashing or asserting. I tracked
down one case where this was happening (generating an argument in a
vtable thunk) and fixed that to provide a location. I also am updating
the `getLoc()` implementation so that it will use an unknown location in
release builds rather than crashing because the location isn't critical
for correct compilation.
[CIR] Add MLIR ABI Lowering design document
Design document for MLIR dialect-agnostic calling convention
lowering that builds on the LLVM ABI Lowering Library
(llvm/lib/ABI/) as the single source of truth for ABI
classification. Dialects use the library via an adapter layer:
ABITypeMapper maps dialect types to abi::Type*, the library
classifies arguments and returns, and a dialect-specific
ABIRewriteContext applies the decisions back to IR operations.
Targets x86_64 and AArch64, with parity against Classic Clang
CodeGen validated through differential testing.
[clang-doc] Fix benchmark not compiling (#185065)
CI didn't flag that the benchmark was using the outdated Ctx call
when landing the Mustache MD patch since this benchmark isn't tested.
Also added missing libraries in CMake that prevented me from building
the benchmark locally.
[AMDGPU] fix asyncmark soft waitcnt bug (#184851)
Asyncmarks record the current wait state and so should not allow waitcnts that occur after them to be merged into waitcnts that occur before.
[clang][CodeGen] Fix size calculation in vbptr split memory region in EmitNullBaseClassInitialization (#184558)
When splitting memory stores around multiple virtual base pointers
(vbptrs)
in the Microsoft ABI, the calculation for the size of the memory region
after
each vbptr was incorrect.
The bug/old calculation: SplitAfterSize = LastStoreSize -
SplitAfterOffset
This subtracts an absolute offset from a relative size, causing
incorrect (too small) sizes after the second vbptr.
The correct size should be:
SplitAfterSize = (LastStoreOffset + LastStoreSize) - SplitAfterOffset
Since all store regions extend to the end of the non-virtual portion
(NVSize),
this patch uses the simplified form:
[3 lines not shown]
builtins: adjust FP80 source management (#183871)
We would previously include the FP80 sources into the Windows build if
we built with the GNU driver rather than the `cl` driver.
[AArch64][PAC] Emit `!dbg` locations in `*_vfpthunk_` functions (#179688)
The usage of pointers to member functions with Pointer Authentication
requires generation of `*_vfpthunk_` functions. These thunk functions
can be later inlined and optimized by replacing the indirect call
instruction with a direct one and then inlining that function call.
In absence of `!dbg` metadata attached to the original call instruction,
such inlining ultimately results in an assertion "!dbg attachment points
at wrong subprogram for function" in the assertions-enabled builds. By
manually executing `opt` with `-verify-each` option on the LLVM IR
produced by the frontend, an actual issue can be observed: "inlinable
function call in a function with debug info must have a !dbg location"
after the replacement of indirect call instruction with the direct one
takes place.
This commit fixes the issue by attaching artificial `!dbg` locations to
the original call instruction (as well as most other instructions in
`*_vfpthunk_` function) the same way it is done for other
[3 lines not shown]
[clang][diagnostics] Stable IDs for Clang diagnostics (#168153)
Part of the implementation of [[RFC] Emitting Auditable SARIF Logs from
Clang](https://discourse.llvm.org/t/rfc-emitting-auditable-sarif-logs-from-clang/88624)
SARIF diagnostics require that each rule have a stable `id` property to
identify that rule across runs, even when the compiler or analysis tool
has changed. We were previously setting the `id` property to the numeric
value of the enum value for that diagnostic within the Clang
implementation; this value changes whenever an unrelated diagnostic is
inserted or removed earlier in the list.
This change sets the `id` property to the _text_ of that same enum
value. This value would only change if someone renames the enum value
for that diagnostic, which should happen much less frequently than
renumbering.
For now, we will just assume that renaming happens infrequently enough
that existing consumers of SARIF will not notice. In the future, we
[32 lines not shown]
[clang-repl] Create virtual files for `input_line_N` buffers (#182044)
Instead of using memory buffers without file backing, this patch
`input_line_N` buffers as virtual files.
This patch enables us to use input line numbers when verifying tests
`clang-repl`.
Co-authored-by: Vassil Vassilev <v.g.vassilev at gmail.com>
(cherry picked from commit 9cc0df99de853a3cdf778c0c33e4fb5050c46c5b)