[SystemZ][z/OS] Fix error "relative immediate relocation section mismatch"
Constants should go inside the text section, but this is not explicitly coded.
In the test case, the EH table is generated into a PR section. Then the
constant pool of function `fn_with_const_pool()` is emitted, which goes into
the PR section of the EH table insted of the code section. When the constant
is later referenced in the code, the relative offset cannot be calculated
because different sections are involved.
The fix is to explicitly return the text section for constants.
CodeGen: Remove dead LiveVariables plumbing from MachineSink (#222563)
MachineSink threaded a LiveVariables pointer through to
SplitCriticalEdge so the analysis would be updated. It never used
LiveVariables for any decision, and MachineSinking runs before
LiveVariables in every pipeline.
Co-authored-by: Claude (Claude-Opus-4.8)
[SystemZ][z/OS] Relax check for additional symbols in PR section (#222435)
The current check in `emitLabel()` is too strict. Inside a PR, there
cannot be no other external visible label. However, temporary labels
which are used e.g. for calculating offsets can be emitted. A situation
in which this occurs is the emission of the DWARF EH tables, in which a
temporary symbol (with an empty name) is emitted at the begin of the
table, causing an error message. This change limits the error to
non-temporary labels.
AMDGPU: Query waves-per-EU and flat-wg range from subarch in attributor (#222596)
The maximum flat work group range is a pair of constants and the maximum
waves per execution unit is fully known from the subarch. Use TargetParser
information and continue working to remove the dependence on codegen.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[SCEV] Use the refined BE-count formula if the addition cannot overflow (#221227)
Generalize the logic added in
https://github.com/llvm/llvm-project/pull/218694
to consider AddingStrideMinusOneMayOverflow (was MayAddOverflow) instead
of just the !IVMayOverflow part.
This handles 2 additional cases when Start < RHS:
* Stride is known power-of-2:
* Start == Stride and Start == Stride -1.
The patch includes a mechanical change to move up the existing
MayAddOverflow with comments, and clarifies the name to
AddingStrideMinusOneMayOverflow.
This improves trip count computations in a number of real-world cases:
https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/1195.
End-to-end Alive2 Proofs for both cases in unsigned:
[2 lines not shown]
MAINTAINERS/CODEOWNERS: Add myself to scheduler files
I have been the de-facto maintainer for a few years now.
Also mention the #scheduler group for reviews on Phabricator.
Sponsored by: The FreeBSD Foundation
[AArch64] Reorder ZPR stack spills to maximize ld1b/st1b pairings (#218950)
Currently, the stack allocation algorithm can order spilled ZPR
callee-saves in a way that prevents pairing.
Reorder ZPR callee-saves before frame indices are assigned to maximize
pairing opportunities. Pairing requires consecutive even/odd registers
at even stack offsets.
The remaining legality requirements are already checked when the
register pairs are formed.
The reordering algorithm primarily works by determining the parity of
the lowest ZPR spill offset. If the offset is odd, it places one
unpaired ZPR spill first so that subsequent register pairs begin at even
offsets.
Windows is not supported by this reordering algorithm for now, to keep
this change minimal.
New tests have been added to sve-callee-save-restore-pairs.ll to test
the reordering algorithm.
[Clang][Sema] Add fortify warnings for strlcpy (#221325)
Add `-Wfortify-source` diagnostics for `strlcpy` and `__builtin_strlcpy`
when the size argument exceeds the destination buffer size.
This is directly analogous to the previous PR for `strlcat` (#220341).
Also update `clang/test/Sema/warn-strlcpycat-size.c` and
`clang/test/Sema/builtins.c` to expect the `-Wfortify-source` warnings
where test calls pass sizes larger than the destination buffer capacity.
Part of #142230
Assisted-by: Gemini
rpki-client: rework cms_parse_validate() further
This diff pulls the signed object handling into cms_parse_validate(),
thereby simplifying the signature quite a bit. signed_object_parse()
remains as a thin wrapper of cms_parse_validate() for now. Perhaps we
will need a signed_object_parse_filemode(), for example.
One benefit of doing this is that the CMS_ContentInfo object lives
during the entire signd object validation, so we no longer need to
create a copy of its eContent OCTET STRING for further processing.
ok claudio
x[SystemZ][z/OS] Correctly align the constant pool and the PPA1
Both should be half-word aligned. However, testing revealed that
both can end up on odd addresses, which leads to relocation errors.
Fix is to change the alignment.
[clang][CodeGen] Stop overriding GlobalVariable's default address space (#222367)
The `GlobalVariable` constructor used by `createGlobal` receives a
`std::optional<unsigned> AddressSpace` that, when unspecified, falls
back to `M.getDataLayout().getDefaultGlobalsAddressSpace()`. However,
`createGlobal`'s `AddressSpace` arg was a bare `unsigned` defaulting to
0. By doing that, it was effectively overriding the `GlobalVariable`'s
constructor fallback with 0. On targets whose default globals address
space is not 0 (AMDGPU, SPIR/SPIR-V), this emitted
`@llvm.global_ctors/dtors` in address space 0 causing some issues (see
https://github.com/ROCm/SPIRV-LLVM-Translator/issues/293).
rpki-client: fix handling of inherited resources in leaves
It's been publicly known at least since Frank Denis's "security audit"
dumps back in May that the RFC 3779 inheritance handling in libcrypto's
path validation is broken. Namely, if the certificate to be validated
inherits resources, X509v3_asid_validate_path(3) and friends can succeed
even if one of the certs on the path does not have the corresponding
resource delegation extension at all. RFC 3779's sections 2.3 and 3.3
clearly require that every cert on the entire validating path have the
relevant INR delegation extensions. Frank Denis flagged this for ASIDs,
but it is obvious that IP addresses have the same problem.
For rpki-client, one of the very few (if not the only) consumers of this
code in libcrypto, this doesn't matter all that much because it duplicates
much of the work on INR validation. Per the specification, EE certs with
inherit elements are only in MFTs, TAKs (of which there are none) and
the no longer supported GBRs (of which there is one - malformed). Correct
nesting and presence of RFC 3779 extensions is ensured by rpki-client
except for the leaf.
[33 lines not shown]
[MLIR][CIR][NFCI] Split TestAliasAnalysis into its own library (#222174)
This is a target for the CIR alias analysis, and bringing in all of the
MLIRTestAnalysis is too heavy: it results in a significant increase in
CIR test size. This patch, plus a few little things, gets us ~850 edges
removed from the Clang Build (after Medhi's patches).
This also has CIR use it.
[SLP] NFC: Remove redundant expression from getBuildVectorCost (#222547)
Gathers is initialized with the contents from VL and then not modified,
so `VL.equals(Gathers)` is always true.
[libc++] Simplify the implementation of std::declval (#222303)
The implementation of `std::declval` calling `__declval` was originally
introduced for improved compile times. However, we now have a builtin
for `add_rvalue_reference`, which makes the old implementation faster
again, since we avoid instantiating any class types _and_ avoid overload
resolution.
[orc-rt] Generalize testcases for different target archs (#222629)
Drop the hard-coded archs from the check-rt-process-info testcases.
Instead, check against an arch value derived from the build's target
triple.
[libc] Optimize the GPU printf implementation with size hints (#222474)
Summary:
The GPU printf interface is functionally a shim to pass a `va_list` and
format string to the CPU for formatting. The size of the argument list
isn't exposed by the C ABI, but we can use `__builtin_object_size` to
try to look it up. This will bind to the `alloca` holding our arguments
in the ABI and return a positive size if it is known.
We do this opportunistically, as the check is lossy. In cases where it
is known, this saves a stack spill to store the true size. Additionally,
we can use this to detect cases where `printf` is being used as a simple
`puts`.
This saves 10 VGPRs for the `printf("string")` case. It also saves 8
bytes of stack in most all cases.