[BOLT][DebugInfo] Add DWARF64 support for BOLT (#206437)
BOLT currently assumes the DWARF32 format when it rewrites debug
sections. As a result, rewriting a binary that was compiled with
`-gdwarf64` either produces a corrupted output or fails `llvm-dwarfdump
--verify`. This patch adds DWARF64 support to the BOLT DWARF rewriter,
honoring each unit's DwarfFormat and emitting correct encodings DWARF64
for binaries, including mix DWARF32 and DWARF64.
[UniformityAnalysis] Make BlockLabels transient and switch to SmallVector. NFC (#211734)
Drop the field from the descriptor and keep the labels in a
propagator-local SmallVector indexed by block number.
[SPIR-V] Fix SPIRVTools download step failing on rerun (#211561)
Customized DOWNLOAD_COMMAND ran a raw `git clone`, which fails with
"destination path already exists" whenever ninja reruns the download
step against an already cloned checkout. Use the native
GIT_REPOSITORY/GIT_TAG (with default DOWNLOAD_COMMAND) step instead,
which handles this case correctly
[TableGen] Add register-info statistics (#211528)
Add statistics for the numbers of explicit and synthesized register
classes, along with the number of register pressure sets. This makes
growth in the generated register model easier to spot since it can be
surprising.
Assisted-by: codex
[libunwind][test][AIX] Add C API test for unwinding from AIX VAPI (as signal handler) (#209662)
Further to https://github.com/llvm/llvm-project/pull/209306, test a case
where a signal handler is a Virtual API function triggered synchronously
while the VAPI is not active. Resuming an ancestor context of the signal
frame should call the VAPI return glue.
---------
Assisted-by: IBM Bob
(cherry picked from commit dbaabbc920fcd60aeed5109c3c6353830e7605c5)
[AggressiveInstCombine] Avoid converting first table element when folding table-based cttz (#211202)
Do not attempt to zext (or truncate) the table's first element into the
cttz input type, as the element type may be wider than the input type.
Instead, convert the cttz result and emit the select directly in the
table's access type, which is the final expected type as well. Minor
opportunity to favor using APInt when the first element has more than 64
active bits to avoid crashing.
Fixes: https://github.com/llvm/llvm-project/issues/210890.
[libunwind][test][AIX] Add C API test for unwinding from AIX VAPI (non-signal-handler case) (#209306)
Test detection, during stepping, of the backchain mutation introduced by
a VAPI call (see https://github.com/llvm/llvm-project/pull/209280).
Further, test resumption of contexts using cursors obtained while a VAPI
is active on the thread.
Testing is done via FileCheck inspection of trace output enabled by
`LIBUNWIND_PRINT_UNWINDING=1`. When Live Library Update is not enabled,
synthetic trace output is generated by the test program itself.
---------
Assisted-by: IBM Bob
(cherry picked from commit 861efe03d96d93cd7e475d15bbc676f6d521f4fd)
[DWARFLinker] Treat DW_AT_LLVM_alloc_type as a type reference (#211655)
The parallel linker's getODRAttributes() did not list
`DW_AT_LLVM_alloc_type`, so the dependency tracker treated it as a live
reference rather than a type reference. A type reachable only through
DW_AT_LLVM_alloc_type was therefore never kept: the enclosing subprogram
is marked live, and its type-table-candidate children are skipped during
live marking on the assumption they are retained through the type path.
The attribute then resolved to offset 0, landing on the compile unit
header, which got correctly caught by the DWARF verifier.
The classic linker already lists `DW_AT_LLVM_alloc_type` in
isODRAttribute(), so this PR restores parity between the two.
Assisted-by: Claude
rdar://182715403
(cherry picked from commit bb17e718bc419b46bb2596c2f25c9cc0f76a2d5a)
[LoopInfo] Fix makeLoopInvariant to strip UB-implying attributes. (#211413)
isSafeToSpeculativelyExecute gained an argument to check for UB-implying
attributes in 830cf36bd4c49, but the default is to ignore them. Update
this code to account for that.
Fixes #210137
(cherry picked from commit fcff12829ecee44d715d9f901c0195fb1f30a881)
[AArch64] Reuse NeoverseN1 and N2 scheduling models for A76/A77/A78. (#211209)
We do not have native scheduling models for some of the Cortex-A
generations of CPUs, so they were still using the old Cortex-A57 model.
Whilst not perfectly accurate, the NeoverseN1 and NoeverseN2 scheduling
models should be a better fit for these CPUs. I mostly just tried to
make sure the number of pipelines matches between the neoverse core and
the cortex core. If we need something more accurate then we can start
adding new models for the CPUs.
(cherry picked from commit 54a0f730d9f8df4e7f5e4bfd4c03acbc182eb3cf)
[lldb][Windows] ignore loader breakpoints in system modules (#208233)
Currently, when debugging a program with `lldb-dap` on Windows and using
the `integratedTerminal` option, lldb-dap immediatly stops with an
`0x80000003` Exception. This is because `ntdll` executes an `int3`
breakpoint during process initialization when a debugger is attached.
This patch makes `lldb` and `lldb-server` skip the first `int3` after
launch when it originates from a system module (the loader's debugger
notification). Only that first loader breakpoint is skipped. Any later
int3, including `__debugbreak()`, `__builtin_debugtrap()` in the
debuggee's own code, still stops the debugger.
Fixes https://github.com/llvm/llvm-project/issues/198763
(cherry picked from commit 83530ce356dd55fdc981b5325ca1f5117b4a58f8)
[X86][CCMP] Fix invalid CCMP emission (#211161)
This patch ports AArch64's negation-aware conjunction algorithm to fix
invalid CCMP emission when OR nested inside an AND.
Example: https://godbolt.org/z/ave7f61hK
Before the change, the above case returns 5 rather the 9 when CCMP
enabled.
Assisted-by: Claude Opus 4.8
(cherry picked from commit 45b30651cf94ddb32676550cca7ddd3f6a5e66e0)
[DebugInfo] Don't assert on missing template parameter names (#211412)
The DWARF verifier reconstructs simplified template names through
DWARFTypePrinter to compare them against the original DW_AT_name. On
malformed input, a template parameter can have no recoverable name,
which tripped assert(RawName) and aborted instead of letting the
verifier report the problem.
Assisted-by: Claude
rdar://182715403
(cherry picked from commit bdddd134c1af6b0c5196ea944edf4c5c76019306)
[VPlan] Use VPlan::hasTailFolded in materializeConstantVectorTC. (#209502)
The current checks in materializeConstantVectorTripCount miss
tail-folded cases when vectorizing loops with fmax without fast-math
flags. Use recently added hasTailFolded helper to ensure we always bail
out on tail-folded loops.
Fixes https://github.com/llvm/llvm-project/issues/209159.
[mlir] Fix alignment assertion for empty DenseArrayAttr (#211730)
After #207274, libc++ fails __assume_aligned assertion in
__assume_valid_range.
https://lab.llvm.org/buildbot/#/builders/25/builds/18994
`DenseArrayAttrImpl<T>::operator ArrayRef<T>()` is just a cast of
`raw.data()`. `raw` is aligned copy of range from
from BytecodeReader done by
Builtin_DenseArrayRawDataParameter allocator.
However, if range is empty, aligned copying was
omitted, leaving unaligned `ArrayRef<char>`.
The fix is to replace unaligned `ArrayRef<>` with
aligned default constructed.
[clang][sema] Call expressions are constructed for undeduced deleted functions (#208488)
The deleted function path of overload resolution always constructed a CallExpr node
for the called function even if the function could not be deduced.
This case is handled in other paths by DiagnoseUseOfDecl which does perform that
test. The delete path cannot use that path though, as DiagnoseUseOfDecl rejects
deleted functions, and the entire point of this code is to permit the continued
evaluation of code even if the resolved function was deleted.
To fix this we now manually check for a complete type before continuing to construct
a potentially bogus CallExpr.
[AMDGPU] Fix gfx1250 WMMA latencies (#202522)
- 16x16x64 FP8/BF8 WMMA run in 4 cycles, not 8. Add a 4-cycle
WriteXDL1PassWMMA write and split the FP8/BF8 InstRW by shape so that
16x16x128 FP8/BF8 (and F16/BF16) keep the 8-cycle latency.
- f8f6f4 WMMA run in 4 cycles when both matrix inputs are f4 and 8
cycles when any input is f6 or f8, instead of the previous 8/16. Update
the scheduling predicate accordingly.
[libc][cpp::string] Allocate fewer temp strings in operator= and +=
This PR generally updates `cpp::string` to avoid incidental allocations. Specifically, it:
- Updates `opreator=(string_view)` to avoid allocating a temporary string: https://github.com/llvm/llvm-project/blob/67ebc4b221c3e94028b33004cd5cd08deee95048/libc/src/__support/CPP/string.h#L106-L108
- Changes `operator+=(const string&)` to accept a `string_view` so that strings may be appended without allocation.
- Makes the `string(string_view)` constructor explicit. Before, there were non-obvious allocations because of the implicit conversion.
This PR assumes that self-assignment and self-appends are not supported with `cpp::string`, and adds debug asserts preventing them. Currently, assignment doesn't work. `cpp::string s = "abc"; s = s;` will just zero out the string. This PR is a slight regression in that `operator+=(const cpp::string&)` previously worked, but now it errors in debug mode, and would result in a use-after-free without the assert statement. I don't think self-append/self-assignment is something `cpp::string` needs to support, so I omitted it, but if a reviewer thinks this behavior is important happy to amend this PR.