Revert "[LLVMABI][NFC] Align base class handling with Clang's AST (#218545)" (#220353)
This reverts commit 0260138561bdadca6685e1873d578b892fddf736.
The extra tracking for direct virtual base classes appears not to be
needed.
[ELF] Don't emit dynamic relocations into .gcc_except_table with -z notext
The -z notext rule already treats .eh_frame as non-writable, so that a symbolic
relocation there is resolved at link time -- with a copy relocation where one is
needed -- rather than deferred to the loader. The in-tree rationale is that GNU
ld does not produce dynamic relocations in .eh_frame.
The same holds for .gcc_except_table, but it was not covered. Linking a non-PIE
executable whose LSDA type table uses DW_EH_PE_absptr entries naming typeinfos
from a shared library, with -z notext:
linker dyn relocs in .gcc_except_table R_X86_64_COPY
GNU ld 0 3
gold 0 3
lld 3 0
Extend the existing carve-out to .gcc_except_table, including the per-function
sections -ffunction-sections creates, so lld matches GNU ld and gold.
Revert "[Clang] Fix a number of issues involving expansion statements" (#220375)
Reverts llvm/llvm-project#217110
This caused a CI failure in one of the expansion statements tests; I’ll
revert this for now and investigate.
[KnownFPClass] Remove `propagateNonNan` `PreserveSign` parameter (#219841)
`void propagateNonNaN(const KnownFPClass &Src, bool PreserveSign =
false)`
Things work as you would expect if `PreserveSign` is `false`. But when
`PreserveSign` is `true`, it does not do what you would expect (I
thought it would copy the signbit of `NaN`). If `PreserveSign` is
`true`, it will copy `Src.SignBit` if and only if `Src` is never `NaN`,
which is counterintuitive. It also does not properly update
`KnownFPClasses`, and allows for potentially erroneous states to be
generated. Such as `fcNegZero` having a positive sign bit.
I have removed `void propagateNonNaN(const KnownFPClass &Src, bool
PreserveSign = false)` and replaced it with just `void
propagateNonNaN(const KnownFPClass &Src)`.
This fixes https://github.com/llvm/llvm-project/issues/217127
I discovered this while working on
https://github.com/llvm/llvm-project/pull/218514
[AMDGPU] Expose addressable LDS size features to the frontend
Add the FeatureAddressableLocalMemorySize* subtarget features to
AMDGPUFrontendVisibleFeatures so TargetParser carries them in its
per-GPU feature bitset and clang emits them as target features.
A "gfxN-generic" target carries the worst case of the GPUs it covers,
which for a numeric feature is the smallest value: gfx9-4-generic keeps
the 64k size while covering gfx950's 160k. The generic validation in the
-gen-amdgpu-target-def backend rejected that, since it required every
frontend-visible feature of a generic to appear verbatim on each covered
GPU. Numeric features are now compared by value instead, and only an
increase is an error.
Change-Id: Ic442a8ce123e12a14ba956ca5796bbef5b65a942
Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
[SelectionDAG][NVPTX] Support cache hints on masked loads and stores (#215307)
Masked loads/stores support all the same cache hints. When splitting
masked loads/stores during legalization, I duplicate the hints. I think
this makes sense for the eviction hints, but not for prefetching. For
prefetching, it probably makes sense to only preserve the hint on the
first load.
For now, I duplicate the hints no matter what. If we want to support
selectively dropping hints during splitting, we will probably need a
target hook.
AI assisted.
X86: Handle undef push operands in call frame optimization
Avoid unchecked getVRegDef call, which will fail for undef
operands. The register-push fallback also dropped the undef flag when
rebuilding the store as a PUSH.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude Opus 4.8)
[HLSL] Fix initialization of mips' copy of the resource handle (#220349)
This is a fixup to https://github.com/llvm/llvm-project/pull/219561
which left the `mips` member's copy of the resource handle uninitialized
due to reordering of `addCopyConstructor`, `addCopyAssignmentOperator`
and `addStaticInitializationFunctions` to before the optional methods.
This PR particularly fixes the following offload test failures:
```
OffloadTest-clang-d3d12 :: Feature/Textures/Array.mips.OperatorIndex.test
OffloadTest-clang-d3d12 :: Feature/Textures/mips.OperatorIndex.test
OffloadTest-clang-d3d12 :: Tools/Offloader/TextureMipLevelValidation.test
OffloadTest-clang-vk :: Feature/Textures/Array.mips.OperatorIndex.test
OffloadTest-clang-vk :: Feature/Textures/mips.OperatorIndex.test
```
Assisted by: Claude Opus 5
[compiler-rt] Fix undefined abort for ubsan_minimal GPU targets (#220314)
Summary:
When compiling with debug enabled this would call `abort()`. The minimal
UBSan for GPUs is intentionally written to just depend on `printf`
which most vendors support and aborting is done through hardware traps.
I neglected to update this part because I had not done it with debugging
enabled, just wrap this into a helper function.
[SDAG][NVPTX] Support cache hints on atomic operations (#214918)
Support cache hints on atomic loads/stores, these have the same support
as normal loads/stores.
Support cache hints on atomicrmw. These will drop everything except for
.level::cache_hint.
Cmpxchg doesn't support cache hints, should drop all.
AI assisted
AMDGPU: Move flat work group size constants to AMDGPUTargetParser (#220346)
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] Drop the trailing separator from the qWasmGlobal instance suffix (#220338)
The instance suffix was spelled ";instance:<id>;", which ends a packet
with a separator that separates nothing. Spell it ";instance:<id>" and
avoid the redundant semicolon.
[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>
[Clang] Fix a number of issues involving expansion statements (#217110)
This fixes a number of problems around expansion statements, most of
which arise from the fact that we check if `CurContext` is a
`FunctionDecl` (which it isn't inside of an expansion statement) and
then complain that we're not inside a function (even though we are).
I also updated `DeclContext::isFunctionOrMethod()` to return true for
`CXXExpansionStmtDecl`. That helper already does this for other
`DeclContext`s that aren’t functions or Objective-C methods, but which
to my understanding can only occur in one (e.g. `CapturedDecl` is an
example of this I believe).
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>