[llvm-readobj][docs] Update the --stack-sizes description
The description said that --stack-sizes is only implemented for GNU
style output, which hasn't been the case for a while. Describe the LLVM
and JSON output instead: each entry also identifies its function as
--call-graph-info does, by its address in a linked file, or by the
relocation that applies to it in a relocatable file.
Assisted-by: Gemini
[libc] Use a syscall wrapper for `sched_rr_get_interval` (#232310)
This PR move `sched_rr_get_interval` behind the centralized syscall
wrappers, following `libc/docs/dev/syscall_wrapper_refactor.md`.
[ValueTracking] Check noundef before applying square (fmul_self) (#232178)
`computeKnownFPClass` for `ValueTracking.cpp` will now test
`isGuaranteedNotToBeUndef` before determining that `fmul %x, %x` is
squaring.
I also added a test for maybe-undef squaring for `computeKnownFPClass`
for `GISelValueTracking.cpp`
Resolves
https://github.com/llvm/llvm-project/pull/227248#discussion_r4207466257
[SCEVExpander] Simplify expanding AddRecs from the canonical IV (NFC). (#232287)
In canonical mode, visitAddRecExpr expands AddRecs with more than 2
operands literally, so all AddRecs handled afterwards are affine. Remove
the trivially true isAffine() checks and the unreachable expansion of
chains of recurrences via evaluateAtIteration.
When {0,+,F} is expanded from the canonical IV, the IV has the type of
the AddRec, so the truncate and extend are no-ops, and {0,+,1} needs no
special case, as the multiply by 1 folds away.
Also handle pointer AddRecs before splitting off the start, as the start
of a pointer AddRec is never zero, and build {0,+,F} directly from its
step, as S is affine.
[SCEVExpander] Simplify expanding AddRecs from the canonical IV (NFC). (#232287)
In canonical mode, visitAddRecExpr expands AddRecs with more than 2
operands literally, so all AddRecs handled afterwards are affine. Remove
the trivially true isAffine() checks and the unreachable expansion of
chains of recurrences via evaluateAtIteration.
When {0,+,F} is expanded from the canonical IV, the IV has the type of
the AddRec, so the truncate and extend are no-ops, and {0,+,1} needs no
special case, as the multiply by 1 folds away.
Also handle pointer AddRecs before splitting off the start, as the start
of a pointer AddRec is never zero, and build {0,+,F} directly from its
step, as S is affine.
[flang] Check SIMPLE on every IEEE_ARITHMETIC elemental function family (#231952)
Follow-up to #223254, test only.
`simple-ieee-arithmetic-functions.f90` checks that one specific,
`ieee_is_finite_a4`, is SIMPLE. The prefix is applied by 29 independent
`#define` macros in `flang-rt/lib/runtime/ieee_arithmetic.f90`, one per
elemental function family, so removing it from any other family passes
the test.
This references one specific per family and checks each with
`-fdebug-dump-symbols`, the same style as
`simple-ieee-arithmetic-operators.f90`. The CHECK lines follow the
dump's alphabetical order.
Assisted-by: AI
[llvm-readobj][ELF] Print the relocation of each --stack-sizes entry
In a relocatable file, print the relocation that applies to each
.stack_sizes entry as a Relocation object in the LLVM and JSON output,
with the same fields as in --call-graph-info. The code that prints the
object is shared with --call-graph-info.
As in --call-graph-info, clear the Thumb bit from the address that the
relocation resolves to on ARM, so that Thumb functions are found.
Assisted-by: Gemini
[llvm-readobj][ELF] Print the address of each --stack-sizes entry
In a linked file, print the function address that each .stack_sizes
entry holds as Address in the LLVM and JSON output. The entries can then
be matched with --call-graph-info output by address, without looking up
function names.
As --call-graph-info does, clear the Thumb bit from the address on ARM.
This also lets Thumb functions be found: they were reported as unknown,
with a warning.
Assisted-by: Gemini
ARM, X86: Test code after noreturn calls against the exception model
Add ARM and X86 versions of the AArch64 windows-trap-unreachable test
from #229681
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[Offload][omp] Move is_accessible_ptr to liboffload (#231801)
Implement a new method in liboffload to access isAccessiblePtr method in
GenericDeviceTy and use it in libomptarget to substitute the direct call
to GenericPluginTy.
Assisted by Claude.
AMDGPU: Keep argument live in vgpr-large-tuple-alloc-error.ll (#232308)
The register pressure in this test comes from exporting the argument
to virtual registers. The export is only needed when the argument is
used outside the entry block, so use it in a second block. This avoids
breaking the test in a future patch which avoids emitting the
unnecessary copies.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[llvm-readobj][ELF] Print Names for call graph relocations (#230654)
In a relocatable object file, an entry identified by a relocation had no
Names. Compute the address that the relocation resolves to with
RelocationResolver, look up the functions at that address in the section
of the relocation's symbol, and print them as Names before the
Relocation object.
As with Names for an Address, the names follow --demangle. Nothing is
printed for an undefined symbol, or when no function is at the address.
A relocation type that RelocationResolver doesn't support, or a symbol
whose section can't be found, gets a warning.
Assisted-by: Gemini
[llvm-readobj][ELF] Fall back to Address when no single relocation applies (#230653)
In a relocatable object file, --call-graph-info identifies a function by
the relocation that applies to its address field. If a field had no
relocation, nothing in the output identified the function. If the
relocation section had an invalid sh_link, the dump stopped. If a field
had more than one relocation, the first one was used silently.
In all of these cases, print the value stored in the field as Address,
as for linked files. Warn once if a call graph section has no relocation
section, and warn about each field with no relocation or more than one.
If the relocations can't be read, only that is reported.
Assisted-by: Gemini
[llvm-readobj][ELF] Print implicit addends of call graph relocations (#230652)
A SHT_REL relocation, or a SHT_CREL relocation without explicit addends,
keeps its addend in the field that it applies to. Print the
sign-extended field value as the Addend of such a relocation instead of
dropping it. The ARM test now uses SHT_REL and covers the same cases as
the SHT_RELA tests: named symbols, a negative addend, and a section
symbol with an addend.
Assisted-by: Gemini
[llvm-readobj][ELF] Print a Relocation object instead of Name in --call-graph-info (#230651)
In a relocatable file, the address fields of a call graph section hold
placeholders, and the relocation that applies to each field identifies
the function. Name showed only the relocation's symbol name, made up
from the section name for an unnamed section symbol, and dropped the
addend. So entries that refer to a function through a section symbol
couldn't be told apart.
Print a Relocation object instead, with the symbol index, the symbol
name exactly as recorded in st_name, and the addend if it is non-zero.
With --demangle, the demangled symbol name is printed as DemangledName.
If the symbol can't be read, the existing warning is reported and only
the symbol index is printed.
Assisted-by: Gemini
DebugInfo: Fix contradictory dead flags in MIR tests
Remove the duplicate implicit-def dead $pc from Hexagon L4_return, and
drop the dead flag from sub-register defs that also have a live
super-register implicit-def. These will fail a future verifier rule.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[mlir][tosa] Remove unnecessary conv verifier checks (#231825)
The `verifyConvOpModes` function wasn't verifying anything. Likely this
was left behind when the verifier was relaxed to stop checking
accumulation type alignment with input/output types. This commit removes
the unnecessary function call.
[lld][docs] Corrected deprecated usage of `fuse-ld` (#231507)
Using full paths with `fuse-ld` has been deprecated in Clang 12. It
should use `ld-path` in combination with `fuse-ld`.
[libc] Implement fexecve in unistd (#231230)
Implement the POSIX function `fexecve` in `<unistd.h>`.
Fixes #231206
Assisted by Antigravity and reviewed by Aman Maurya.
[libc] Make struct ifreq compatible with linux/if.h (#225793)
When <linux/if.h> is included after <net/if.h>, compilation fails for
several reasons:
- <linux/libc-compat.h> expects libc to coordinate using the
__UAPI_DEF_IF_IFREQ and __UAPI_DEF_IF_IFMAP macros. Because we didn't
define them, the kernel headers fell back to defining them as 1, which
caused <linux/if.h> to redefine struct ifreq.
- <linux/if.h> defines field access macros (ifr_name, ifr_addr, etc.)
pointing to members of named ifr_ifrn and ifr_ifru unions. Our struct
ifreq used an anonymous union, so those defines broke member access.
- Our struct ifreq omitted the `struct ifmap ifru_map` member. Besides
breaking the ifr_map macro from <linux/if.h>, this also made
sizeof(struct ifreq) 32 bytes instead of 40 on 64-bit Linux (as
struct ifmap is 24 bytes while all other union members are at most 16
bytes), mismatching the kernel ioctl ABI.
To fix this:
- define `struct ifmap` and add it to `struct ifreq`
- define `__UAPI_DEF_IF_IFMAP 0` and `__UAPI_DEF_IF_IFREQ 0` to prevent
[16 lines not shown]
[AArch64] Use NVCAST instead of BITCAST in LowerZERO_EXTEND_VECTOR_INREG (#232160)
Under big endian BITCAST materializes as a REV, corrupting the lane
arrangement of zip1(x, 0).
Fix #232154
[libc++] Produce output when running benchmark jobs (#232306)
This makes the jobs more debuggable. In addition, add a keepalive
background process that keeps producing output even while a benchmark is
running, as a workaround for #226230, which causes jobs running on K8s
to be killed if they have not produced output for more than 5 minutes.
DAG: Don't export arguments for FastISel if it won't be used
LowerArguments decided whether to export arguments to virtual
registers based on TM.Options.EnableFastISel. That option is set at
-O0 even for targets that have no FastISel implementation. This is
unnecessary without fast isel, so stop doing that.
The unneeded CopyToReg was an extra use of every argument, which
blocked some combines. The dead copies also survived to register
allocation. These copies were an edge case that regallocfast would
introduce dead flags on.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
AMDGPU: Keep argument live in vgpr-large-tuple-alloc-error.ll
The register pressure in this test comes from exporting the argument
to virtual registers. The export is only needed when the argument is
used outside the entry block, so use it in a second block. This avoids
breaking the test in a future patch which avoids emitting the
unnecessary copies.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[AMDGPU] Preserve noclobber after acquire operations from a different addrspace
Follow-up to #219991 to address reviewer comments:
AMDGPUAnnotateUniformValues should annotate uniform global loads as
`!amdgpu.noclobber` if the memory they are reading is never clobbered (since
kernel launch) before the load is executed.
PR #219991 strengthened the logic to consider acquire operations before the
load as clobbering (because they cause stores from other threads to be observed
by the load without a data race).
This PR weakens this criterion to ignore acquire operations that don't affect
the global address space (because they don't affect what the load in question
may or may not see). This addresses the performance-relevant case of s_barriers
with LDS-only fences.
The logic is still overly pessimistic for one-as load acquires, they could also
be ignored when looking for clobbering operations.
Disclaimer: Claude gave review comments and suggestions that I addressed during
[5 lines not shown]
Put the toSIAtomicAddrSpace logic into a table and make it consistent with isExtendedGlobalAddrSpace
With that, the change is no longer NFC, since constant addrspaces and
addrspaces above `MAX_AMDGPU_ADDRESS` now map to `SIAtomicAddrSpace::GLOBAL`
instead of `OTHER`. This means that atomics on these addrspaces are no longer
rejected by SIMemoryLegalizer.
The tests only show differences in the generated ISA for volatile loads from
the constant addrspaces; so far we haven't waited directly after each such
volatile load, with this change we do. Arguably, these waits are unnecessary
since the accessed memory is not supposed to change, but, on the other hand,
one could argue that volatile accesses to memory that doesn't change are
pointless in the first place.