[AMDGPU] Add `isConvergent=1` to `DS_ATOMIC_*_BARRIER` instructions (#214166)
The intrinsic already has it. The instructions may issue a wake-up
signal on barrier completion so the set of waves that execute the
instruction
may not change.
The test case shows taildup duplicating the MachineInstrs when
`isConvergent=0`.
Assisted-By: Claude Opus 4.8
Claude found the reproducer for me after I found the lack of
`isConvergent=1` on those
instructions.
[lldb][test] Improve error for C++ compiler detection and improve docs (#214199)
I did not realise that LLDB_TEST_COMPILER should be the C compiler, so I
got:
cxx = cc_dir / (cc_prefix + cxx_type + cc_ext)
TypeError: can only concatenate str (not "NoneType") to str
Config=aarch64-/usr/bin/g++
I have simplified the logic and added a more informative error:
RuntimeError: Could not infer C++ compiler name from compiler type "g++"
Added a note to the documentation.
The CMake description does say "C compiler", but it's easy to gloss over
that so I extended that to say how we get the C++ compiler.
[libc] (Re)skip tests failing after #213860 (#214425)
(At least) two tests enabled by #213860 are failing on the amdgpu bot
(which only runs hermetic tests). This patch skips them, but it a
different way, so that they keep running in hermetic mode on supported
targets.
For the sched_test, I add a dependency on the sched_getscheduler target
(used in the test) to trigger the auto-skipping logic.
The memory utils test fails due to a missing cmp_is_expensive
specialization, so I enable the test only on targets which have them
(listing targets explicitly).
[compiler-rt][pgo] Add profile instrumentation test for coroutines (#213801)
This PR adds a compiler-rt test (`instrprof-coroutine-profile.cpp`) to
verify PGO profile counter generation and ingestion for C++20
coroutines.
During investigating the iFDO profile ingested for coroutine pass, we
found that the profile data contains entry counts for the original
coroutine function (`foo`), but lacks the entry counters for the split
`foo.resume` function.
After inspecting
[PassBuilderPipelines.cpp](https://github.com/llvm/llvm-project/blob/f7b7ec8d5542dcede1ae607aa74dfe36d7a3c530/llvm/lib/Passes/PassBuilderPipelines.cpp#L1273)
confirms that `PGOInstrumentationGen` runs before `CoroSplitPass`.
Therefore,
- 1) the iFDO profile correctly ingests and associates profile counters
with coroutine function `foo`.
- 2) Separate function entry counters for `foo.resume` are not expected
in the iFDO profile.
[16 lines not shown]
[AArch64][GlobalISel] Add legalisation to G_EXRACT_SUBVECTOR (#207956)
Prevent legalisation of this opcode falling back to SDAG.
In situations where a G_EXTRACT_SUBVECTOR is being performed on two
vectors which aren't double/half the size of each other, represent the
extract as build_vector(extract_vector_element, extract_vector_element,
...).
[libc] Implement sleep and usleep for Linux (#213912)
Implemented the sleep and usleep entrypoints for Linux. Refactored the
syscall implementation out of the public nanosleep entrypoint into a
standard internal syscall wrapper.
Fixes #214293.
Co-authored-by: Jeff Bailey <jbailey at raspberryginger.com>
[Clang][AIX] Preserve -mloadtime-comment-vars variables across serialization
Named internal-linkage variables were silently dropped when their
definition crossed a PCH or C++20 named-module (BMI-to-object) boundary:
DeclMustBeEmitted did not know the implicit attribute, so the PCH writer
never marked the unreferenced variable as required, and for named modules
only non-discardable variables are recorded in the module-initializer
lists that EmitModuleInitializers walks. Teach DeclMustBeEmitted about
the attribute (the CodeGen-side check becomes redundant and is removed)
and record validated internal-linkage module-purview variables in the
module-initializer list.
Since DeclMustBeEmitted now sees the attribute, a preserved variable no
longer triggers -Wunused-const-variable: it is materially used.
Add tests for C++20 module preservation, importer behavior, and
instantiation diagnostics; PCH preservation; unused-warning suppression;
the non-AIX cc1 no-op; and char8_t element-type exclusion. Document the
modules/PCH rules.
[libc] Enable UNIT_TEST_ONLY tests in hermetic mode (#213860)
This mainly consists of removing the UNIT_TEST_ONLY lines as previous
patches made sure the tests work. The only slightly nontrivial part is
adding support for C_TEST to the hermetic test macro.
After this, the only UNIT_TEST_ONLY tests are those that require the
MPFR library.
[TailRecElim] Introduce support for shift accumulator optimization (#181331)
This PR enables Tail Recursion Elimination (TRE) for functions where the
accumulator operation is a shift (`shl`, `lshr`, `ashr`) by a constant
amount -- i.e., pseudo-associative relation.
As pointed out in #178805, `InstCombine` often strength-reduces
multiplications (or `f(x-1) + f(x-1)`) into `shl`.
Currently, TRE strictly requires operations to be associative and
commutative:
https://github.com/llvm/llvm-project/blob/05e908609227e1e8d993659e604a63668dfd2825/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp#L377-L379
This prevents TRE from transforming recursive shifts into loops,
creating a phase-ordering problem where canonicalization blocks a
structural optimization.
This PR does **not** perform shift accumulator optimization when there
are multiple base cases: it is reserved for future work.
Fixes #178805.
[AMDGPU] Insert exec-forced V_NOP after V_PERM_PK16 (gfx1250 hazard)
On gfx1250 the V_PERM_PK16 family (V_PERM_PK16_B4/B6/B8_U4) has a hazard:
the instruction must be immediately followed by a "safe" instruction that
issues on the pipe which clears the hazard. Insert V_NOP with forced
non-zero EXEC as needed.
Assisted-by: Opus 4.8 Medium
[AMDGPU] Insert exec-forced V_NOP after V_PERM_PK16 (gfx1250 hazard)
On gfx1250 the V_PERM_PK16 family (V_PERM_PK16_B4/B6/B8_U4) has a hazard:
the instruction must be immediately followed by a "safe" instruction that
issues on the pipe which clears the hazard. Insert V_NOP with forced
non-zero EXEC as needed.
Assisted-by: Opus 4.8 Medium
[flang][MIF] Fix team_type usage in all MIF operations #205953 (#214207)
This PR resolves the issue #205953. Its purpose is to correct the use of
`team_type` by lowering it to Addr rather than to Box.
[ORC] Start decoupling MangleAndInterner from DataLayout. (#214398)
Previously MangleAndInterner held a DataLayout reference and mangled
names via Mangler::getNameWithPrefix. Replace the stored DataLayout with
an internal ManglingMode enum and mangle from that directly, so the
class no longer needs to hold a DataLayout.
Add two DataLayout-free constructors: one taking an ExecutionSession and
an optional ABI name (deriving the mode from the session's target
triple), and one taking an explicit ManglingMode. The existing
DataLayout constructor is retained, now deriving the mode from the
DataLayout.
This lets MangleAndInterner be used where no DataLayout is available
(e.g. from a bare ExecutionSession).
Adds MangleAndInternerTest covering the triple- and mode-based
construction paths.
[VPlan][NFC] Speed up getVectorLoopRegion() with a last-successor walk (#199437)
Resolves the TODO in VPlan::getVectorLoopRegion() with a mutable cache
on VPlan, shared by both overloads.
Measured on an O3 build of the LLVM test suite (~12k TUs): 3,556,267
hits / 126,196 misses (96.57% hit rate).
[NVVM][NVPTX] Change TMA Tensor reduction ops to use flag for reduction ops (#213638)
Currently, TMA S2G reduction intrinsics use reduction operation in the
name. Now that we have pretty-printing and a range-based verifier (for
ImmArgs) available, this PR migrates the reduction operation to an
immediate flag argument. This simplifies adding Rubin architecture
extensions to this family, while also reducing the number of intrinsics
from 64 to 8.
[Modules] Don't merge attributes for namespace redeclarations. (#214361)
Follow-up to #208348 which aimed to handle decl attributes on
deserialization the same way as during parsing. Turned out during
parsing we don't merge attributes for namespace redeclarations.
[DWARF] Update comment for useSplitDwarf (#214241)
The comment was introduced originally in
55c51815250a25b78ed8ac3dee0a0a843ac636ed. Since that time, split DWARF
is no longer a proposal and is officially a part of the standard, so
update the comment.