[BOLT] Fix test for systems where dl/pthread are not part of libc (#206944)
The bolt/test/runtime/setup-race.cpp test (including the original one)
crashes with a segfault on Ubuntu 20.04 (glibc 2.31) because the dlsym
symbol is not found.
According to the glibc 2.34 release notes, libpthread, libdl, libutil,
and libanl have been integrated into libc. For older glibc versions, it
is still necessary to link against libdl (for dlsym) and libpthread (for
pthread_* symbols).
GlobalISel: Add m_PosZeroFP matcher and use it in AArch64 selector
Add an FP-constant predicate matcher m_PosZeroFP, mirroring the IR
PatternMatch helper, and use it in emitFPCompare instead of binding the
ConstantFP just to test for +0.0. NFC.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
Reland "[ORC] Track __emutls_t definitions in IRMaterializationUnit" (#207161) (#209717)
Relands #207161 (the `IRMaterializationUnit::discard` fix for duplicated
`__emutls_t.<var>` symbols). History: #207161 merged, reverted in
#207775,
relanded in #208413, reverted again in #209260 (a day before the 23.x
cut).
### Why #208413 was reverted
clang-repl's JIT lowers `thread_local` to emulated TLS on every target
(`JITTargetMachineBuilder` forces `EmulatedTLS`), so JIT'd code always
references `__emutls_get_address`. #208413 only made that symbol
resolvable on
Darwin (`#ifdef __APPLE__` + `isOSBinFormatMachO()`), where it lives in
the
compiler-rt builtins static archive. The same gap exists on any host
that
links compiler-rt builtins instead of libgcc_s: the arm-toolchain CI hit
[80 lines not shown]
[VectorCombine] Handle frees and synchronization in single element stores (#216562)
foldSingleElementStore only checked whether intervening instructions modified
the stored memory. Calls that may free or synchronize could therefore make
scalarization incorrect.
Fixes https://github.com/llvm/llvm-project/issues/216557
[libc] Drop .unit/.hermetic suffix from test support libraries (#216689)
This is not necessary now that we only build one kind of a test in a
given build configuration. This also makes it easier to convert to
something closer to how other libc libraries work.
[RISCV] Query sched_getaffinity before hwprobe for -mcpu=native (#216886)
Heterogenous CPUs like the SpacemiT K3 have a different marchid/mimpid
on different cores. The previous code asked for the common marchid/mimpid
amongst all CPUs. This will return -1 since they don't match across all
CPUs.
This patch uses sched_getaffinity to get the CPUs the compiler is
running on. If the process has been restricted to either the X100 or
A100 cores, this will allow us to get the marchid/mimpid for just those
cores.
[clang][SPIR-V] Remove CC_SpirFunction calling convention (#216252)
CC_SpirFunction is now redundant: CC_C already lowers to spir_func on
SPIR/SPIR-V targets, after
https://github.com/llvm/llvm-project/pull/210882
[clang][bytecode] Add `Pointer::getRootExpr()` (#216706)
Similarly to `getRootVarDecl()`, returns the expression of the base of
the pointer, if there is such an expression.
[LFI][X86] Enable bundling for the LFI target (#214111)
This enables 32-byte bundling for the LFI x86-64 target, and uses bundle
grouping for existing rewrites where appropriate.
[InstCombine] Use samesign constraints in unsigned known-bits folds (#209675)
Extracted from #209097 during review.
For a non-poison unsigned `icmp samesign`, both operands have the same
sign bit. Propagate a known sign bit between the temporary `KnownBits`
values in `foldICmpUsingKnownBits()` so the existing range folds can use
this constraint.
This enables endpoint folds in both signed halves of the integer range,
for example:
```
icmp samesign ugt i8 %x, 126 -> icmp eq i8 %x, 127
icmp samesign ult i8 %x, 127 -> icmp ne i8 %x, 127
icmp samesign ugt i8 %x, -2 -> icmp eq i8 %x, -1
```
-------------------------------
[34 lines not shown]
[Support] Remove duplicate comments in FoldingSet.cpp (NFC) (#216833)
This patch removes duplicate comments in FoldingSet.cpp.
Corresponding declarations are already documented in FoldingSet.h.
Note that LLVM Coding Standards state:
Don't duplicate the documentation comment in the header file and in
the implementation file. Put the documentation comments for public
APIs into the header file.
[ADT] Remove CRTP from FoldingSet and ContextualFoldingSet (NFC) (#216830)
This patch simplifies FoldingSet by removing CRTP from FoldingSet and
ContextualFoldingSet.
Without this patch, FoldingSetImpl uses CRTP to get FoldingSetInfo, a
custom "vtable", from FoldingSet and ContextualFoldingSet.
With this patch, we put ContextStorage as the base class of
FoldingSetImpl. FoldingSetImpl directly takes FoldingSetTrait as a
template parameter. This allows us to:
- populate FoldingSetInfo for both FoldingSet and
ContextualFoldingSet as a static constexpr variable.
- rely on the empty base optimization (EBO) on ContextStorage so that
FoldingSet incurs no memory overhead.
- turn FoldingSet and ContextualFoldingSet into simple type aliases of
[2 lines not shown]
[flang][cuda] Add option to emit different function name for alloc/free of descriptors (#216841)
This allow to call specialized functions instead of the upstream ones.
[BFI] Solve irreducible SCCs instead of splitting their headers (#215170)
c5a3139ebd0d (2014) approximates irreducible control flow by modelling
an SCC as a loop with multiple headers, and
http://reviews.llvm.org/D10348 re-distributes the loop mass across those
headers in proportion to the backedge mass each one received -- one step
of a power iteration, from an assumed split.
Package the SCC with a single representative and solve it instead.
`solveIrreducibleMass` iterates the SCC's internal chain towards its
dominant eigenvector and reads the member masses, the exits and the
circulating mass off that, so the entries' relative frequencies come out
of the solve. Power iteration rather than a relaxation of `f = e +
f*P`: the mass `e` entering the SCC is unknown here, so there is no
fixed point to relax towards, only a direction. NumHeaders, the
per-header BackedgeMass, getHeaderIndex, the isHeader binary search and
adjustLoopHeaderMass go away with the split.
Relative error against an exact rational solve has improved.
[29 lines not shown]
[lldb] Adopt ProcessAddress in the read memory APIs (NFC) (#214088)
Relevant RFC:
https://discourse.llvm.org/t/rfc-address-spaces-support-in-lldb/91222/
Previous PR #206370 adding the AddressSpace definitions.
- switches the read memory virtuals from lldb::addr_t to const
ProcessAddress & and updates every override. No behavior change
expected.
**Test Plan**
- Depending on the buildbots for all other platforms.