[clang] Migrate away from PointerUnion::dyn_cast (NFC) (#226653)
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast on
UnsatisfiedConstraintRecord because it is always nonnull.
Specifically, ConstraintSatisfaction::Details only receives nonnull
pointers in the following places:
- ASTNodeImporter::ImportConstraintSatisfaction
- ConstraintSatisfactionChecker::consumeSFINAEFailure
- ConstraintSatisfactionChecker::EvaluateSlow
- ConstraintSatisfactionChecker::Evaluate
- readConstraintSatisfaction
Assisted-by: Antigravity
[llubi] Add support for llvm.speculative.load. (#226839)
Implement the direct form of llvm.speculative.load, where the number of
accessible bytes N is passed as an i64. Only the N accessible bytes are
read from memory and they must be in bounds of the underlying object;
all other bytes are poison. With from_end, the accessible bytes are the
last N bytes of the loaded value. It is UB if N is poison or exceeds the
size of the loaded type.
Support for the oracle form will be added as follow-up.
PR: https://github.com/llvm/llvm-project/pull/226839
[clang][test] Pass -resource-dir in riscv*-toolchain-extra.c tests (#226952)
Fixes issue reported in
https://github.com/llvm/llvm-project/pull/216996#issuecomment-5846218483
These tests check that, with no GCC installation, the driver finds the
linker, crt0 and sysroot relative to its own bin/ directory. The
compiler-rt paths come from the resource directory, which the tests did
not specify, so they relied on the build's CLANG_RESOURCE_DIR placing it
within the fake toolchain tree.
With a relative CLANG_RESOURCE_DIR containing several "..", e.g.
../../../../lib/clang/24 as used by Gentoo, the resource directory
resolves outside of the test tree. This previously passed only because
the unnormalized path still contained "riscv64-nogcc/". Since
99988429d395 removed the dots from the path, the checks fail.
Pass an explicit -resource-dir within the test tree so the tests don't
depend on the build configuration.
Claude Code helped with this.
[clang][CIR] Add missing return stmt in tests (#226534)
This PR makes sure that tests in:
* clang/test/CodeGen/AArch64/sve/
follow the format previously establised in:
* clang/test/CodeGen/AArch64/sve-intrinsics/
[GVN] Preserve vectorization opportunities when PREing loop loads
Loop load PRE can replace an invariant-address load with a loop-carried
PHI and conditional reload after a may-alias store. That scalar recurrence
can prevent vectorization even when runtime alias checks could disambiguate
the original accesses. Subsequent full unrolling then expands scalar code.
Conservatively preserve the header load in innermost loops whose clobber
is a conditional may-alias store through a varying pointer. Keep existing
PRE behavior for invariant-address clobbers, known aliasing, calls, ordered
memory operations, and loops with vectorization disabled or completed.
This is an opportunity heuristic, not a vectorization legality proof.
CodeGen: Mark inline asm clobber defs dead (#227026)
A clobber operand has no value associated with it, so the def is always
dead. Set the flag where the INLINEASM is built instead of relying on
later inference.
Co-authored-by: Claude Opus 5 <noreply at anthropic.com>
[Hexagon][Driver] Tell llvm-mc about PIC under -fno-integrated-as (#213821)
Hexagon picks the .eh_frame FDE pointer encoding from whether the code
is position independent: DW_EH_PE_pcrel if so, DW_EH_PE_absptr otherwise
(MCObjectFileInfo::initELFMCObjectFileInfo). Unlike most targets,
Hexagon uses llvm-mc rather than GNU as for -fno-integrated-as, and the
driver was not passing the PIC setting along. llvm-mc defaults to
non-PIC, so the same source assembled the two ways produced different
unwind tables: the integrated assembler emitted R_HEX_32_PCREL, while
-fno-integrated-as emitted R_HEX_32 with an absptr CIE augmentation.
hexagon-unknown-linux-musl defaults to PIC, so it was the default config
that diverged.
Pass -position-independent to llvm-mc when the relocation model is PIC.
Non-PIC keeps DW_EH_PE_absptr, unchanged.
rpm: Generate initial rpm configure cache file from existing cache
The rpmbuild can not use the existing configure cache generated by the
initial configure run because the build/host/target is likely different.
More generally configure's "precious" variables have different values
or states. However, the rest of the initial cache file can be reused.
This is the bulk of the processing in configure anyway. Also, for the
same reason, caches can not be shared between rpmbuilds either.
Generate the initial rpm configure cache file by taking the initial
configure cache and excluding the precious variables. If the rpm
configure already exists, reuse it but remove the undesired variables.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Glenn Washburn <development at efficientek.com>
Closes #19168
rpm: Rename CONFCACHE_FILE to RPM_CONFCACHE
This configure cache file is specific to rpm builds and should be
labeled appropriately.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Glenn Washburn <development at efficientek.com>
Closes #19168
[X86][NVPTX] Use `m_Value(N, Pattern)` overload to simplify matching. (#226621)
Replace the `m_AllOf(Pattern, m_Value(N))` idiom (match-and-bind) with
the `m_Value(N, Pattern)` overload.
rpm: Enable configure caching for redhat kmod and zfs user packages
These were missed in 0eff7a30b82e (rpm: Add configure caching if used
in main configure run).
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Glenn Washburn <development at efficientek.com>
Closes #19168
hwpmc: fix IBS fetch and op NMI handling
Service each IBS unit with a valid bit set when fetch and op share an
NMI. Otherwise, op samples can be lost. Treat the extra NMI that follows
as expected (skip it).
Reviewed by: mhorne
Fixes: e51ef8ae490f ("hwpmc: Initial support for AMD IBS")
Differential Revision: https://reviews.freebsd.org/D60004
hwpmc: fix IBS fetch and op NMI handling
Service each IBS unit with a valid bit set when fetch and op share an
NMI. Otherwise, op samples can be lost. Treat the extra NMI that follows
as expected (skip it).
Reviewed by: mhorne
Fixes: e51ef8ae490f ("hwpmc: Initial support for AMD IBS")
Differential Revision: https://reviews.freebsd.org/D60004
AMDGPU: Mark the return address def of SI_CALL dead
The call writes the return address but nothing in the local function reads
the new value. Avoid needing to recover the dead flag later.
Co-authored-by: Claude Opus 5 <noreply at anthropic.com>
[mlir] `remove-dead-values`: properly handle symbol users outside of a pass root. (#225355)
Follow up to the
https://github.com/llvm/llvm-project/pull/224831#pullrequestreview-5262450200
comment.
Add `areAllUsesVisible` query to the `SymbolUserMap` to check is all
users are visible and use it in `remove-dead-values`.
[clang-tidy][docs] Rename readability check docs to Markdown [4/5] (#221640)
Tracking issue: #201242
See the [migration guide] for more information.
[migration guide]:
https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines
This is the fourth part of the mechanical rename of the check
documentations in readability module.
The rewrite is provided by the next PR in this stack.