[CIR] Round-trip wide cir.int attributes (#206602)
printIntLiteral printed a cir.int value with APInt::getSExtValue() /
getZExtValue(), both of which assert once the value needs more than 64
bits, and parseIntLiteral parsed into int64_t/uint64_t. So a cir.int
attribute holding a value wider than 64 bits -- for example an __int128
constant like (__int128)1 << 70 -- aborted whenever the module was
printed (-emit-cir, cir-opt, round-trip verification) and could not be
parsed back. The trigger is the value magnitude, not the declared type
width: a 128-bit-typed attribute holding a small value printed fine,
which is why the existing 128-bit cir.int tests never caught it.
The fix prints through APInt::toString and parses through
AsmParser::parseOptionalInteger into an APInt fitted to the type width
(mirroring how the builtin IntegerAttr handles arbitrary widths), so a
cir.int of any width round-trips. The old int64_t/uint64_t parse path is
removed.
global.cir gains signed and unsigned 128-bit globals with values that
[2 lines not shown]
[CIR] Fix unsigned/wide switch case-range lowering (#206575)
A `switch` over an unsigned (or wider-than-32-bit) integer with a GNU
`case lo ... hi` range was miscompiled. SingleSource `pr34154.c` is the
witness: it switches on an `unsigned long long` with
`case 1000000000000000000ULL ... 9999999999999999999ULL`, and under `-fclangir`
every value took the default.
The flattening pass decided whether a range was empty with a signed compare,
`lowerBound.sgt(upperBound)` in `CIRSwitchOpFlattening`. The upper bound
`9999999999999999999` is larger than `INT64_MAX`, so as a signed value it is
negative and the range looked empty -- it was dropped and the case body left
unreachable, so control always reached the default. Behind that sat three more
width/signedness slips: the small-range size gate compared a 64-bit difference
against a 32-bit `APInt`, the expansion loop advanced a signed `APInt` cursor
that looped forever for a range ending at the type's maximum (the cursor wraps
past the top of the domain), and `condBrToRangeDestination` built the
lower-bound and range-length constants and the subtraction at a hardcoded
32-bit width, which truncates a 64-bit range.
[7 lines not shown]
[Clang] Try to fix data race on HasColors after #202441 (#206975)
Summary:
The clangd users call these functions in multi-thraeded contexts. The
raw_fd_stream has_colors query is cached, which was giving some data
races. Just use the process-level check for now.
[Bazel] Port e7290b1f1815626c4461d38671d93093590bf405 (#207014)
We also need to add a header or otherwise we end up with incomplete
types for template instanation in modules builds which are used for
header parsing.
[Flang][OpenMP][MLIR] Improve SPMD-No-Loop handling (#206953)
This patch modifies the handling of the
`-fopenmp-assume-teams-oversubscription` and
`-fopenmp-assume-threads-oversubscription` compiler options in Flang and
the corresponding `omp.flags` MLIR attribute to have this information
present on both host and target device MLIR modules. This is necessary
to ensure SPMD to SPMD-No-Loop kernel promotion happens uniformly and no
divergence between host and device representations of the same target
region is introduced.
The identification of the kernel type in Flang lowering is updated to
address some broken edge cases. In particular, no SPMD to SPMD-No-Loop
transformation is performed on `target parallel do [simd]` kernels. A
split `target + parallel loop` is now marked SPMD, which was a case
missed previously, and the trip count on `target teams ompx_bare`
kernels isn't host evaluated even if removing the `ompx_bare` clause
would result in a valid SPMD kernel.
[lldb][Windows] allow test_convenience_registers to PASS (#206956)
`RegisterCommandsTestCase.test_convenience_registers` passes when using
`LLDB_USE_LLDB_SERVER=1` since
https://github.com/llvm/llvm-project/pull/203498 was merged.
rdar://180307995
[LLVM] Fix signature for `gc.get.pointer.base` intrinsic (#206991)
`experimental.gc.get.pointer.base` intrinsic requires that the return
and argument type are the same pointer types. Currently this is checked
explicitly in Verifier.cpp. Instead, change the type signature of
`.gc.get.pointer.base` to use `LLVMMatchType` to enforce this
restriction.
[Flang-RT] Change alignment for allocatable and pointer arrays to 64 … (#206525)
…bytes
in https://github.com/llvm/llvm-project/pull/194969 the default array
alignment was changed to 64bytes for Fortran globals. In this PR the
malloc wrapper in the flang runtime is modified to accept an alignment
argument (0 default) and for cases above 16 byte (std::max_align_t) uses
`aligned_alloc` instead of malloc.
The issue of alignment was discussed in this RFC:
https://discourse.llvm.org/t/rfc-alignment-of-global-arrays/90397/13
Assisted-by: Opus 4.6
[clang-tidy] Add AllowVirtualAndOverride to modernize-use-override (#206111)
Add an `AllowVirtualAndOverride` option to `modernize-use-override` so
codebases can keep virtual on methods that are also marked override.
AI Usage: Test cases assisted by Codex.
Closes https://github.com/llvm/llvm-project/issues/202030
[lldb][Windows][CI] refine timeouts (#206942)
Add/refine timeouts on each step of the lldb on Windows CI script. This
should help avoid runaway builds which timeout after 24h.
[CIR][OpenMP] Prevent HoistAllocas pass from hoisting above OpenMP regions (#206168)
This patch modifies the HoistAllocas pass to prevent it from hoisting
allocas outside OpenMP regions, since this may break isolated from above
requirements and affect privatization semantics.
Assisted-by: Cursor / claude-4.8-opus-medium
[lldb] Recover mangled symbol names from DWARF on WebAssembly (#206832)
The Wasm "name" section stores only demangled names, so the symbols
ObjectFileWasm builds from it have no mangled name. Without one, the
symbol table indexes neither the mangled name nor the C++ base and
method name variants derived from it, so looking up a symbol by mangled
name fails and breakpoints set by a template or operator name find no
locations.
Override SymbolFileWasm::AddSymbols to copy each function's mangled name
from its DWARF DW_AT_linkage_name onto the matching symbol, matched by
file address. This is confined to the Wasm symbol file, so other targets
are unaffected.
[lldb-dap] Add a new lldb-dap test infrastructure (#203978)
Introduce a new test infrastructure under lldbsuite/test/tools/lldb_dap
that replaces the dict-based dap_server. Initially the new and legacy
version will live side by side.
Once all tests are ported, the legacy version will be removed. The new
infrastructure has four files:
- dap_types.py: DAP protocol messages as frozen dataclasses, plus
serializer/deserializer functions to and from JSON.
- utils.py: Helper classes for launching and managing lldb-dap process
and its connection.
- session.py: DAP session layer. Owns the per-session state.
- session_helpers.py: Higher-level helpers for writing tests.
Using dataclasses for protocol types lets us catch unexpected or missing
fields at deserialization time instead of at use-site.
Adds a new environment flag, LLDBDAP_RUN_AS_SERVER, that runs the test
suite against lldb-dap in server mode for test cases with
[10 lines not shown]
[SCEV] Cancel common addend/multiplier in SimplifyICmpOperands (#205014)
Simplify:
```
(K + A) pred (K + B) -> A pred B
(C * A) pred (C * B) -> A pred B
```
when no-wrap flags allow it: NSW for signed predicates, NUW for
unsigned. Also requires C > 0 for signed in the multiplication case.
For equality comparisons, `(K + A) eq/ne (K + B)` simplifies to `A eq/ne
B` without requiring any no-wrap flags.
Alive2 proofs: https://alive2.llvm.org/ce/z/KmyqsD
[libc++] Assume that <wchar.h> in llvm-libc has const-overloads. (#206805)
See discussion in https://github.com/llvm/llvm-project/pull/201236 -
we're close to enabling wide characters in libc++ when it's built on top
of llvm-libc.
llvm-libc headers use `const wchar_t*` return type for selected wchar
functions, so we need to configure libc++ to assume that const-overloads
for these functions are available in this case, and the implementations
in libc++ wrapper around `<wchar.h>` are not needed.
[X86] Fold FP UNORD/ORD compare against known-non-NaN to self-compare (#206943)
Replace a known-non-NaN operand of an UNORD/ORD FP compare with the
other operand, so we emit `cmpp a, a` instead of materializing the
constant with `vxorpd`. Matches GCC.
Added combine-fcmp-uno-self.ll which covers the folding and a negative
case.
Fixes #202756
[mlir][ABI] Fix scalable vector mapping in ABITypeMapper (#206617)
mapVectorType in ABITypeMapper incorrectly used ElementCount::getFixed
for all vector types, including scalable ones (e.g. vector<[4]xf32>).
This results in scalable vectors being mapped as fixed-size vectors,
which produces incorrect ABI lowering for SVE and RISC-V V targets.
[libc++] Fix behavior for `get_temporary_buffer` with non-positive size (#206871)
Per C++17 [depr.temporary.buffer]/4, `get_temporary_buffer` is required
to return `{nullptr, 0}` when the size argument is zero or negative.
libc++ used to correctly handle this, but the refactoring in
94e7c0b051c79fd56205f115771980f2e7812306 got this wrong.
GCC generally warns on negative size due to `-Walloc-size-larger-than=`,
which is false positive due to incomplete control flow analysis. The
warning is coupled with optimizations, and this patch make tests
suppress it instead.
Revert "[HIP][AMDGPU] Use non-LTO pipeline for non-RDC in the linker wrapper (#201135)" (#206961)
I believe I fixed the immediate issues that were causing regressions
with this, and now this is leading to its own regressions in building
Pytorch apparently. This was explicitly marked as a hack, and this
should resolve an ongoing issue so we should revert this for now.
Should fix LCOMPILER-2396
This reverts commit eaff67c9838f98d221aa563c9e5d4e714d636674.