[DWARFLinker] Let a clang module unit outrank every object file (#218079)
A module holds the definitive description of what it defines, so when
several units contribute a copy of the same DIE to the type pool, the
one built from the .pcm has to win. Priorities are packed as (object
file index, unit index) and the type pool resolves a race in favour of
the lowest, but a module unit took the index of whichever object file
referenced the .pcm first. A module first referenced by a later object
file therefore lost to an earlier object file's copy, and consumers read
a DW_TAG_module carrying an importer's DW_AT_LLVM_include_path.
Reserve object file index zero for the module units of the whole link
and number the object files from one.
rdar://185156929
Assisted-by: Claude
[CFI] Create an external linkage alias instead of promoting internals (#203171)
The problem is described in PR #201849. This is a simple fix - thanks,
@teresajohnson for the idea. When CFI promotes an internal symbol, it
previously would have to create an alias to avoid breakages in the case
of references from inline asm. The alternative here is to leave the
symbol as-is and create an alias for CFI's purposes. This makes the
calculation of a GUID for this new symbol avoid the class of colisions
discussed in the earlier PR. Then, during `LowerTypeTests`, we give the
functon the alias' name and the rest of the CFI functionality remains
unaffected.
An alternative we discussed would be to use the same kind of hash as CFI
uses - based on module content. That would add some cost to compile time
for all modules (it could be paid only in PGO/ThinLTO cases, though). We
preferred this alternative here because it's simpler and has no
compile-time penalty.
Co-authored-by: Teresa Johnson
<[tejohnson at google.com](mailto:tejohnson at google.com)\>
[AMDGPU] Combine redundant ballot intrinsic calls
Suppose there is a loop where there is a call to @llvm.amdgcn.ballot,
which maps to an instruction involving the exec mask as an operand. This
instruction duplicates if the loop is unrolled. With a higher number of
unrolled iterations, the code bloats with such redundant instructions
with $exec as there is no middle-end/backend pass which could combine
such instructions in a uniform CFG.
This patch introduces a transform in AMDGPUUniformIntrinsicCombine to
combine redundant calls to @llvm.amdgcn.ballot, to mitigate this issue.
The approach is to walk over the dominator tree and collect all calls to
@llvm.amdgcn.ballot. Map the result type and condition to the calls, to
avoid combining calls of different kinds. Calls A and B can be combined
into A iff:
- A and B are identical
- A dominates B
- all paths from A to B are uniform and exec-invariant.
[2 lines not shown]
[CIR] Lower records carrying a vptr for x86_64
A record carrying a vtable pointer could not be passed or returned by
value. `isSupportedType` had no case for `!cir.vptr`, so the whole
signature was reported NYI. That covers any class with a virtual
function or a virtual base.
Accept the type and map it to an `llvm::abi::PointerType`.
A record CIRGen also marks packed stays NYI, which is where a
polymorphic class with tail padding lands.
Assisted-by: Cursor / claude-opus-5
[TLI] Make VecDesc statically initializable (#211307)
After commit 1cf9acdb ([TLI] Use AArch64 vector calling convention for
ArmPL routines (#135790)), `VecDesc` gained a
`std::optional<CallingConv::ID>` member. That made `VecDesc`
non-trivial, so the large `static const VecDesc[]` tables
(`VecFuncs_Accelerate`, `VecFuncs_SVML`, `VecFuncs_ArmPL`, and others)
in `TargetLibraryInfo.cpp` (built from `VecFuncs.def`) required dynamic
static initialization at DLL load time. In MSVC Debug builds with LLVM
embedded in a DLL, CRT init can run on threads with limited stack (e.g.
during `LoadLibrary` from a deep call stack), causing stack overflow and
load failure.
This patch restores compile-time initialization without changing the
public API or any `VecFuncs.def` / `TargetLibraryInfo.cpp` call sites.
There are the following fixes:
1. Replace `std::optional<CallingConv::ID>` from `VecDesc` layout.
`std::nullopt` is still in the constructor / `getCallingConv()` API.
This is safe because no entry in `VecFuncs.def` uses `CallingConv::C`
[19 lines not shown]
[OpenACC] do not report launch args for loops in acc routines (#218449)
ACC routines do not launch kernels, so it should not report the launch
args. The par dims should still be reported. E.g.
```
before:
!$acc loop gang(1), vector(1) ! blockidx.x threadidx.x
now:
!$acc loop gang, vector ! blockidx.x threadidx.x
```
[mlir][vector] Add missing lit CFG file (#218445)
This file was meant to be added in #216098 - it makes sure that tests
under mlir/test/Integration/Dialect/Vector/CPU/ArmNeon are only run when
`MLIR_RUN_ARM_NEON_TESTS` is set.
Merge tag 'i2c-7.3-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux
Pull more i2c updates from Andi Shyti:
"Fixes and cleanups around probe error handling, resource management
and a minor Rust cleanup.
Drivers:
- several drivers: drop duplicate IRQ error reporting
- imx-lpi2c: improve probe initialization and error cleanup
- mxs: fix DMA channel leak on probe failure
- ocores: fix clock cleanup on resume failure
- rcar: handle reset controllers without status support
Muxes:
- demux-pinctrl: fix OF node leak on allocation failure
Rust:
- mark trivial I2cAdapter reference-counting methods inline"
[9 lines not shown]
[LV] Fix crash when forced UserVF and EpilogueVF are ignored (#218282)
`computeBestVF()` assumes/asserts that there should be only 2 vplans as
long as there is a vplan for `UserVF` and when `EpilogueVF` is forced.
It doesn't consider the case when those VFs are ignored because of
invalid costs.
This patch removes the assert and add a check for the vplan size.
[flang][debug] Don't ask for a name table with -gline-directives-only (#218402)
On current main (since #217132), a unit built with
`-gline-directives-only` crashes the backend when DWARF 5 is requested:
```console
$ echo 'end program' > test.f90
$ flang -gdwarf-5 -gline-directives-only -S -o /dev/null test.f90
flang: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h:107:
llvm::MCSymbol *llvm::DwarfUnit::getLabelBegin() const:
Assertion `LabelBegin && "LabelBegin is not initialized"' failed.
```
The version has to be spelled out because flang does not yet default to
DWARF 5. Everything else about the command line is ordinary.
Such a unit emits line directives and no `.debug_info`, so the header of
its compile unit is never written and neither is the label that header
defines. Under DWARF 5 the accelerator table indexes every compile unit
[11 lines not shown]