[CodeGen] Use unique_ptr for FunctionInfo to prevent memory leaks (#196603)
Raw pointer return from `FunctionInfo::create` caused leaks in callers
like `computeABIInfoUsingLib`, breaking BPF tests on ASan bots.
Using `std::unique_ptr` enforces automatic cleanup.
Fixes leak from #194460.
Buildbot: https://lab.llvm.org/buildbot/#/builders/52/builds/17090
Assisted-by: Gemini
[mlir][tensor] Enhance pattern to fold extract_slice(insert_slice) (#195045)
Extend the DropRedundantRankExpansionOnExtractSliceOfInsertSlice pattern
to support cases where the expanded dimensions are a subset of the
dropped dimensions, rather than requiring them to be exactly equal.
For example:
```
%inserted_slice = tensor.insert_slice %src into %dest[0, 0, 0, 0] [1, 1, 128, 480] [1, 1, 1, 1] :
tensor<128x480xf32> into tensor<1x1x128x480xf32>
%extracted_slice = tensor.extract_slice %inserted_slice[0, 0, 0, 0] [1, 1, 123, 1] [1, 1, 1, 1] :
tensor<1x1x128x480xf32> to tensor<123xf32>
```
can be folded into:
```
%extracted_slice = tensor.extract_slice %src[0, 0] [123, 1] [1, 1] :
tensor<128x480xf32> to tensor<123xf32>
```
Revert "[BOLT] Fix EH data encoding checks in relocateEHFrameSection (#195691)" (#196672)
This reverts commit 7ab26d7c3a160e1dc166f2673644baa396703ee5.
There is test failure in bolt-tests::exceptions-split-strip.test.
[RISCV] Use the nhs.lea.h/w/d instead of nhs.lea.h/w/d.ze with Sh1AddPat. (#196660)
The srliw already took care of zeroing the upper bits. Using the non-.ze
form is consistent with the Zba version of this pattern.
[clang][deps] Move `ScanningOutputFormat` out of the library (#196631)
Basing behavior of the dependency scanner on the final output format is
a leaky abstraction. Instead, we should aim to introduce proper feature
flags.
[BOLT][NFCI] Consolidate DataReader::setEntryCounts (#196411)
FuncBranchData/BinaryFunction exec/external entry counts are set
in multiple places in `DataReader`:
- FBD: in `parse` and `appendFrom`,
- BF: in `preprocessProfile` and `matchProfileData`.
Consolidate to `setEntryCounts` called from `readProfile`.
Drop explicit counters, compute them from `FBD::EntryData`.
Test Plan: NFCI
[lldb] Handle SIGINT via the MainLoop signal thread (on POSIX) (#195959)
The driver's async SIGINT handler called
SBDebugger::DispatchInputInterrupt directly. That is not
async-signal-safe and can lead to a crash.
Register SIGINT with the existing signal-thread MainLoop instead so
DispatchInputInterrupt runs in normal thread context. The Windows path
is unchanged and keeps the legacy async handler.
While DispatchInputInterrupt runs, the callback temporarily installs
SIG_DFL so a second Ctrl-C still hard-terminates the process, preserving
the escape hatch users rely on when the debugger is unresponsive.
Moving SIGINT off the main thread means a Ctrl-C no longer interrupts
blocking syscalls there (e.g. a Python REPL waiting on input or
sleeping), so Python never observes the queued interrupt and
KeyboardInterrupt is not raised. To restore that behavior, after
dispatching the interrupt the callback re-raises SIGINT on the main
[6 lines not shown]
[mlir][AMDGPU] Add, unify verification of memref index counts (#196657)
This PR verifies that, on operations that have
`%memref[%idx0, %idx1, ...]` arguments, the number of indices matches
the rank of the memref being passed in.
While we're here, fixes capitalization for certain verification error
messages.
Assisted-by: Codex 5.5 (handled much of the implementation)
[flang][cuda] Widen stream argument to i64 in stream intrinsic lowering (#196650)
`genCUDASetDefaultStream` and `genCUDAStreamDestroy` build their runtime
call with an `i64` stream parameter but pass the actual argument
straight through, so a smaller-kind actual (e.g. the literal `0` in
`cudaforSetDefaultStream(0)`) produces an ill-typed `fir.call`:
```
error: 'llvm.call' op operand type mismatch for operand 0: 'i32' != 'i64'
```
Insert a `fir.convert` to `i64` before the call, matching what
`genCUDASetDefaultStreamArray` already does.
[lld][WebAssembly] Remove the experimental warning for PIC/dynamic linking (#196566)
The current dynamic linking support has been used for several years not
both in emscripten and in wasi-sdk and is documented
https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.md.
We did/do have have plans to develop another version of the dynamic
linking ABI that doesn't use a global symbol namespace, and that can
still happen, but the current API is clearly production worthy
regardless of future plans.
This change removes the linker warning and the corresponding
`--experimental-pic` flag.
If we do want to still make breaking changes to the dylink format we can
rename the `dylink.1` section (which already contains a version number).
This change is leads the way for enabling shared libraries by default in
emscripten.
[lldb] Add lldb.summary and lldb.synthetic decorators (#195351)
Adds two new decorators, `@lldb.summary` and `@lldb.synthetic`,
analogous to the existing `@lldb.command` decorator.
```python
@lldb.summary("MyType")
def MyType_summary(valobj, _):
return "summary string"
@lldb.synthetic("MyContainer")
class MyContainerSynthetic:
def __init__(self, valobj, _): ...
```
These decorators result in `type summary add` and `type synthetic add`
commands being run.
An additional motivation: these decorators will make it straightforward
[8 lines not shown]
[libc++] Require the exact assignment expression to be trivial in __uninitialized_allocator_copy_impl
__uninitialized_allocator_copy_impl has an optimization that replaces allocator_traits::construct with std::copy for raw pointer ranges when the element type is trivially copy constructible and trivially copy assignable.
The copy-assignment trait only checks whether assignment from const T& is trivial. That is weaker than the expression used by std::copy, which evaluates *out = *in. If overload resolution selects a different non-trivial assignment operator for that expression, std::copy can call that operator on uninitialized storage.
Check is_trivially_assignable<_Out&, _In&> instead. This matches the assignment expression used by std::copy, preserves the optimized path when that assignment is actually trivial, and falls back to placement construction otherwise.
Add a regression test with a type whose defaulted copy assignment is trivial but whose templated assignment operator is selected for non-const lvalue sources.
Tested with:
~/llvm-project/build-libcxx-fresh/bin/llvm-lit ~/llvm-project/libcxx/test/libcxx/memory/uninitialized_allocator_copy_template_op_assign.pass.cpp ~/llvm-project/libcxx/test/libcxx/memory/uninitialized_allocator_copy.pass.cpp -q
[libc] Disable -march=native in CI to fix sccache poisoning (#196560)
-march=native is incompatible with shared build caches because sccache
treats it as a literal string. Object files compiled on one CPU model
get silently served to runners with a different CPU, causing SIGILL
crashes in the opt_host memory tests.
Made LIBC_COMPILE_OPTIONS_NATIVE a CMake cache variable so CI can
override it. Both overlay and fullbuild workflows now pass
-DLIBC_COMPILE_OPTIONS_NATIVE="" to disable -march=native. Local
developer builds are unaffected and still default to -march=native.
Reverted the per-CPU cache key approach from #196477 in favour of this
fix, which addresses the root cause.
Bumped sccache key versions (v2) in both workflows to invalidate the
poisoned caches.
Assisted-by: Automated tooling, human reviewed.