Fix `fp128` reaching `llvm_unreachable` on 32-bit PowerPC (#216613)
`fp128` is a legal type that is passed in vector registers when `vsx` is
enabled on 32-bit PowerPC: the switch statement didn't account for that,
causing an LLVM assertion.
Fixes #213355
cc @folkertdev
[AMDGPU][SIInsertWaitcnts] Fix soft wait removal with loop-carried deps
The code that checked if a soft waitcnt (such as the one insterted by
a release fence on LDS) was redundant didn't correctly account for the
fact that that, for example, the previous iteration of a loop could
have introduced memory traffic that needs to be waited on. This bug
appeared to be fairly rare in practice (probably due to the
instruction scheduler shuffling around code in t bad form) but it can
happen.
The fix is that, instad of immediately erasing "redundant" waits, we
add them to a set of waits to be erased, and then remove them from the
set if they prove to be truly redundant.
This has the side effect of fixing a correctness issue around the CAS
loops we emit on gfx1250 - the global_inv we emit after the
`s_loadcnt 0x0` is itself a `loadcnt`-able event, and so needs to be
forced to completion before the next iteration of the CAS loop.
[5 lines not shown]
[libc++] Add _LIBCPP_NO_SANITIZE for std::__assume_aligned (#220296)
std::assume_aligned takes void* from __builtin_assume_aligned and
converts it _Tp* that causes cfi-unrelated-cast to consider it a
downcast leading to CFI checks. Since std::find_if calls
std::assume_aligned on __last, it will lead to a CFI check that
dereferences __last causing a failure. Based on discussion, we can just
add _LIBCPP_NO_SANITIZE for cfi-unrelated-cast because the check rejects
well-defined behavior.
Fix: https://github.com/llvm/llvm-project/issues/219306
[AMDGPU] Pre-commit tests for loop-carried memory waits
SIInsertWaitcnts is currently dropping waits in a
(fence; read; write; branch) loop in some cases. Pre-commit tests to
show the problem.
AI disclosure: test generated by AI, but I poked them into not being terrible.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply at anthropic.com>
[lld-macho][NFC] Change _baz to _qux in test (#220337)
These assertions are very broad and when running these tests in bazel
there is a file path log that gets incorrectly matched with _baz.
[SandboxVectorizer] Hoist getInsertPointAfterInstrs into VecUtils
Move BottomUpVec.cpp's file-local getInsertPointAfterInstrs() into
VecUtils, next to the getLowest()/getLastPHIOrSelf() primitives it's
built from. It has no BottomUpVec-specific state; the next commit adds a
second caller in LoadStoreVec.
Not hoisting BottomUpVec::createPack() itself here: it asserts a single
common scalar type (VecUtils::getCommonScalarType), which doesn't fit
LoadStoreVec's mixed-type ("enable-diff-types") requirement. That needs
its own extended packer, kept local to LoadStoreVec.cpp rather than
force-fitting the shared version.
No functional change: check-llvm Transforms/SandboxVectorizer passes
(28/28).
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
[LFI][AArch64] Refactor LFI rewriter to use MCInstBuilder (#219890)
This refactors the LFI rewriter to use the `MCInstBuilder` API to
construct new `MCInst` objects.
AMDGPU: Move flat work group size constants to AMDGPUTargetParser
getMinFlatWorkGroupSize and getMaxFlatWorkGroupSize are constants that
do not depend on the subtarget. Move them from IsaInfo to
AMDGPUTargetParser so they can be queried without an MCSubtargetInfo.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[lldb] [unittests] [nfc] Assert the requests the memory cache tests make, not the read budget (#220171)
`TesetMemoryCacheRead`, `TestReadStopsAtAnInvalidRange` and
`TestReadMemoryRangesUsesL2Cache` showed which memory a read fetched by
checking `process->m_bytes_left`, a cumulative byte budget. Any request
of
at least the asserted size drains it, so the check held for a wrong
request
just as well: it cannot see the address asked for, and it cannot tell
one
request from two.
Log every `DoReadMemory` request in the mock process as (address, size)
and
assert that list instead. The straddling read at 0x4001 in
`TesetMemoryCacheRead` shows what this buys. It crosses a line boundary,
and
`MemoryCache::Read` serves it one line at a time, so the list is
`(0x4000, line)` then `(0x4000+line, line)`: two requests for two
[3 lines not shown]
AMDGPU: Add getSubArchFromGPUName utility (#220328)
Add a utility function to map a GPU name to the correct subarch.
This provides the minimum effort mapping for frontends to convert their
current target name system to produce a subarch triple.
Co-authored-by: Claude (Claude-Opus-4.8)
[GlobalISel][NFC] Use TyBits in computeNumSignBits (#220324)
Found some inefficiency while trying to make pr #220317.
DstTyBits are already computed as TyBits, so let's use that instead of
recomputing the value.
## AI disclosure
I made AI write it because this is not the first issue, but I understand
what I'm doing.
[Clang] Fix crash when expanding an expansion statement after a fatal error (#220042)
Fixes #214917
When the error limit is reached, clang emits `fatal error: too many
errors emitted` but keeps parsing with diagnostics suppressed. If it
then reaches a well-formed `template for`, `FinishCXXExpansionStmt`
tries to instantiate the body for each element. The
`InstantiatingTemplate` it constructs deliberately refuses to push a
`CodeSynthesisContext` after a fatal error and marks itself invalid —
but unlike every other instantiation site, this one never checked
`isInvalid()` and called `SubstStmt` anyway, hitting the "Cannot perform
an instantiation without some context on the instantiation stack"
assertion. The junk in the fuzzer reproducer only matters for pushing
the error count past the limit; the expansion statement itself is fine,
since `V` destructures through its public members.
The fix adds the standard `if (Inst.isInvalid()) return StmtError();`
guard before the substitution, so the expansion bails out cleanly like
[5 lines not shown]
Enhanced the check for enumerations in namelist objects at declaration time and remove the I/O time check. This captures the C8109 restrictions completely. Added test cases from reviewer to demonstrate the fix.
[libc] Add <unistd.h> functions for process group management. (#220044)
* Add POSIX functions `getpgid`, `getpgrp`, and `setpgid` that get/set
process group IDs. Define them in `<unistd.h>`
header and add entrypoints on Linux platforms;
* Implement these functions on Linux as `getpgid`/`setpgid` syscall
wrappers.
* Add unit test to sanity-check returned values and validate the
expected `errno` values for invalid arguments. Given the
simplicity of implementation, don't write fork-based tests to validate
that the process group management works as
expected on Linux machines.
Assisted by automated tooling, human-verified.