Hexagon: Fix early if-conversion crash on an undef PHI operand
Found by AI while working on something else.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
clang/AMDGPU: Use feature bitset for xnack/sramecc queries
Complete the conversion of clang from the manual ArchAttr field
to the generated feature bitset.
Co-authored-by: Claude (Claude-Opus-4.8)
[bazel] Update versions for mpfr and python (#217674)
Update mpfr and rules_python:
* mpfr: pick up
https://github.com/bazelbuild/bazel-central-registry/pull/9861 to fix
float128 support when using a local (external) build of mpfr (thx
@UebelAndre for merging)
* rules_python: update to resolve the warning `the root module requires
module version rules_python at 1.8.0, but got rules_python at 1.8.4 in the
resolved dependency graph`
[ADT] Remove default argument from FoldingSetBase constructor (NFC) (#217523)
FoldingSetBase is never default-constructed directly; its subclasses and
helpers always pass Log2InitSize explicitly.
Assisted-by: Antigravity
[ADT] Fix and clarify FoldingSet::reserve (#217522)
This patch fixes an off-by-one comparison in FoldingSetBase::reserve.
Without this patch, calling reserve(capacity()) allocates more buckets
even though the table can already hold capacity() nodes without
rebucketing. Changing '<' to '<=' correctly treats requests up to the
existing capacity as a no-op.
In addition, this patch clarifies the comments for reserve() by
replacing the awkward ordinal with a simple element count.
Assisted-by: Antigravity
[SystemZ][z/OS] Add split DWARF support for GOFF (#215337)
Adds split DWARF support to the GOFF object writer for z/OS.
When a .dwo file is requested, DWO sections go there and the rest stay
in the main object. Without one, everything stays in the single .o
as before.
[llvm-objcopy] Stream ELF output to regular files
Write ELF output directly to seekable regular files instead of first allocating a buffer for the entire output. Keep buffered output for stdout and other non-seekable streams, and materialize regenerated metadata one section at a time.
Track written ranges so unwritten gaps are zero-filled and the final file is resized exactly. Surface file stream failures as Error values so temporary outputs are discarded instead of producing destructor-time fatal errors.
On a synthetic stamping-style ELF containing a 1 GiB payload, three warm-cache no-op copies had median peak RSS of 2,102,916 KiB before and 1,053,844 KiB after (49.9% lower). Median wall time improved from 1.06 s to 0.77 s, and the outputs were byte-identical.
Co-authored-by: Jeremy Braun <jtbraun at meta.com>
Assisted-by: OpenAI Codex
[NVPTX] Honor !atomic.ignore.denormal.mode on atomicrmw fadd
PTX atom.add has a fixed denormal behavior that the program cannot
control: atom.add.f32 flushes denormals on global memory but not on
shared, and atom.add.f16 never flushes. When that disagrees with the
function's denormal mode, the backend expands the atomic into a CAS loop
so the denormal behavior is preserved.
!atomic.ignore.denormal.mode says the denormal behavior of this
particular atomic does not matter, so use the native instruction even
when it disagrees. This is the same thing -nvptx-allow-ftz-atomics does,
except per-instruction instead of per-compilation, which lets a frontend
opt in only the operations it knows about -- notably CUDA's atomicAdd(),
which is defined in terms of atom.add.
Note that -nvptx-allow-ftz-atomics defaults to true, so the new behavior
is only observable with -nvptx-allow-ftz-atomics=false.
Co-authored-by: Artem Belevich <tra at google.com>
[clang][NVPTX] Emit !atomic.ignore.denormal.mode for CUDA atomics
CUDA's atomicAdd() family is defined in terms of PTX atom.add, whose
denormal behavior is fixed by the hardware. Without any annotation the
backend has to assume the function's denormal mode must be honored and
expands these into CAS loops whenever the two disagree. Mark them with
!atomic.ignore.denormal.mode so the native instruction is used.
That covers the __nvvm_atom_*_add_gen_f builtins that atomicAdd(),
atomicAdd_block() and atomicAdd_system() are written in terms of, plus
C11/C++11 atomics under -fatomic-ignore-denormal-mode and the
[[clang::atomic(ignore_denormal_mode)]] attribute, which requires
teaching the NVPTX target about AtomicOptions.
The condition for when the metadata is meaningful is now shared with the
AMDGPU and SPIR-V targets in addAtomicIgnoreDenormalModeMetadata(). It
takes an AllowHalf flag because whether f16 denormals are observable is
target specific: PTX exposes no FTZ control for f16 operations, so
atom.add.f16 never flushes and the opt-in is meaningful there, whereas
[3 lines not shown]
[IR] Generalize !amdgpu.ignore.denormal.mode into !atomic.ignore.denormal.mode
The !amdgpu.ignore.denormal.mode metadata tells the backend that an
atomicrmw fadd need not honor the function's denormal mode, so a native
atomic instruction whose denormal behavior is fixed in hardware may be
used instead of a CAS loop. Nothing about that is AMDGPU specific: NVPTX
has exactly the same problem with atom.add, whose FTZ behavior depends on
the address space and cannot be controlled.
Promote it to a target independent fixed metadata kind,
!atomic.ignore.denormal.mode, and switch the AMDGPU, SPIR-V and OpenMP
producers and consumers over to it. Document it in LangRef, and point
AMDGPUUsage at that description rather than duplicating it.
Existing IR keeps working: AutoUpgrade renames the metadata on atomicrmw
instructions when parsing textual IR and when materializing bitcode. The
upgrade is deliberately scoped to atomicrmw rather than being applied to
every attachment of that name, since that is the only place the metadata
was ever meaningful. Because bitcode can be materialized one function at
[6 lines not shown]
[Bazel] Configure Windows targets by CPU and compiler (#217557)
## Summary
- add Windows AArch64 configuration settings for clang/MinGW, clang-cl,
and msvc-cl
- select AArch64 native initializer symbols and compiler-appropriate
host/default triples
- select the GNU triple for x86_64 MinGW while preserving the existing
generic Windows fallback
## Motivation
This came out while implementing full windows cross compilation from
Linux using Bazel and the hermetic-llvm project.
The Bazel overlay currently selects LLVM's native architecture and
triples using only the Windows OS constraint. As a result, every Windows
target receives X86 native initializer symbols and the `x86_64-pc-win32`
[7 lines not shown]
[MLIR][LLVM] Translate LLVMFuncOp function metadata (#203021)
Materialize LLVMFuncOp function_metadata through ModuleTranslation
metadata conversion. Attach function metadata after module-level symbols
are mapped so metadata references to functions, globals, aliases, and
ifuncs can be resolved.
clang: Emit "target-abi" module flag for ARM (#217601)
Previously only RISCV emitted the "target-abi" module flag.
We probably should just generally emit this for non-empty ABI names
but that's a broader behavior change. I'm also confused because the
clang side defines a non-empty value for many targets with no apparent
use in llvm.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[llvm-objcopy] Propagate section write errors
Return Error from SectionWriter::writeSectionContents and propagate failures through all visitor call sites. This lets a later streaming writer report seek and write failures without fatal destructor-time handling.
Co-authored-by: Jeremy Braun <jtbraun at meta.com>
Assisted-by: OpenAI Codex
[llvm-objcopy] Route section copies through writeSectionContents
Centralize section byte copies behind a virtual helper so ELF output can later target either a memory buffer or a seekable stream. Materialize SHT_SYMTAB_SHNDX entries using the target ELF word type to preserve output endianness.
Co-authored-by: Jeremy Braun <jtbraun at meta.com>
Assisted-by: OpenAI Codex