[RuntimeLibcalls] Model wchar_t arguments in libcall signatures
RuntimeLibcalls could describe int, size_t and several other C types
but had no way to describe wchar_t, so a libcall taking one could not
be declared with the correct parameter type and extension attribute.
The width of wchar_t is not a property of the triple alone: it can be
overridden by the wchar_size module flag, as -fshort-wchar does.
Add a WChar FuncArgType that converts to an integer of
Module::getWCharSize() bits, and derive its extension attribute in
RuntimeLibcallsInfo::getExtAttrForWCharParam.
Declare wmemset using the new type. A wchar_t as wide as int is
sign-extended wherever int is, so targets such as RISC-V, MIPS, PowerPC
and SystemZ now get signext on it, while AIX, z/OS and VE, where it is
unsigned, get zeroext.
Assisted-by: Claude
[RuntimeLibcalls] Add WCharSize field to RuntimeLibcallsInfo (NFC) (#241679)
`convertToIRType()` will need to know `wchar_t` size.
Make it available via private field of RuntimeLibcallsInfo.
Assisted-by: Claude
IR: Check for overlap before copying in AttributeSet::removeAttributes (#242957)
removeAttributes copied the whole set into an AttrBuilder to check if
the mask overlaps it, which it usually doesn't. Check the attributes
of directly with the mask and only build the AttrBuilder if something
needs to be removed.
callgrind instructions, opt -O3: kimwitu++ k.bc -0.16%, SPASS cnf.bc
-0.08%. CTMark instructions:u: ThinLTO -0.02% (kimwitu++ -0.06%)
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[mlir][memref] Promote buffers accessed via memref.copy (#232078)
This PR is a follow-up of #217793, which taught Mem2Reg to promote
buffers accessed through dynamic subviews and masked transfers.
This PR adds a `PromotableMemOpInterface` model for `memref.copy`. A
copy into the slot becomes a `vector.transfer_read` of the source, a
copy out becomes a `vector.transfer_write` to the target, and a copy
between two slots is rewritten one slot at a time so both buffers
disappear.
The transfers are built with
createReadOrMaskedRead/createWriteOrMaskedWrite. A copy from or to a
dynamically shaped memref now produces vector.mask {
vector.transfer_read/write }, and Mem2Reg promotes it through the
vector.mask model (#233705, #234251).
This PR also reorganizes the Mem2Reg tests. Since this logic spans the
MemRef and Vector dialects, there is no obvious dialect sub-directory
[14 lines not shown]
Mk/Uses/electron.mk: Add 45 to valid electron versions
This was missing in the commit which added devel/electron45.
Fixes: e1d5a92cadde (devel/electron45: Add port: Build cross-platform desktop apps with JavaScript, HTML, and CSS)
[scudo] Relax aligned_alloc restrictions. (#237352)
The standard for aligned_alloc relaxed the restriction on the size
parameter. Update the code to only disallow non-power of two alignments.
[llvm-ir2vec] Add -mtriple and codegen flags for MIR input (#242993)
MIR without an IR section was parsed for the host triple and -mcpu was
rejected since codegen flags became library options
Update to Blender 4.5.16.
- Build atomic_ops without libatomic; drop atomic from WANTLIB.
- Use the system Eigen (math/eigen3).
- Garbage collect the ONLY_FOR_ARCHS comments; 32-bit archs
are not coming back.
from Brad, thanks
[AMDGPU][NFC] Reduce simplifyAMDGCNMemoryIntrinsicDemanded arguments (#242200)
Follow-up to #240750, suggested in its review.
`simplifyAMDGCNMemoryIntrinsicDemanded` now takes only `IC`, `II` and
`DemandedElts`:
- it is a `GCNTTIImpl` member, like
`simplifyAMDGCNLaneIntrinsicDemanded`, so it reads the subtarget from
the class;
- `IsLoad` and the dmask operand index are derived from the intrinsic
(stores return void; image stores have the dmask after the stored
value).
No functional change.
Assisted-by: Claude Opus 5.5
Revert "[AMDGPU] Add implicit EXEC use to convergent inline asm (#242981)" (#243343)
This reverts commit daba4935fe66785f5452a3280c65925223b1c888.
This is not how this should be implemented
[AMDGPU] Ignore call clobbers in `fixShift64HiggRegBug` hazard check
The check for `fixShift64HighRegBug` checks the reg mask to find if
the next higher register is in use. This can give false positives.
Update it to only check for the actual registers which are used,
which is more conservative in some cases, but should help avoid miscompiles.
This bug was found due to a wrong result being computed in device libs with ASAN enabled.
[KnownFPClass][NFC] Move KnownFPClass::square out-of-line (#243342)
Moves `KnownFPClass::square` out-of-line. The only change is that
`applyOutputDenormalMode` is applied after `propagateNonNaN` and
`knownNot(fcNegative)`, but this change is unobservable.
[LoongArch] Legalize BUILD_VECTOR into a broadcast when all non-undef elements are identical (#169755)
When a BUILD_VECTOR consists of the same element (ignoring undefs),
it is better emitting a broadcast instead of multiple insertions.
Some cases which suffer performance regressions or have no benefits are
excluded in this commit.
[RuntimeLibcalls] Model wchar_t arguments in libcall signatures
RuntimeLibcalls could describe int, size_t and several other C types
but had no way to describe wchar_t, so a libcall taking one could not
be declared with the correct parameter type and extension attribute.
The width of wchar_t is not a property of the triple alone: it can be
overridden by the wchar_size module flag, as -fshort-wchar does.
Add a WChar FuncArgType that converts to an integer of
Module::getWCharSize() bits, and derive its extension attribute in
RuntimeLibcallsInfo::getExtAttrForWCharParam.
Declare wmemset using the new type. A wchar_t as wide as int is
sign-extended wherever int is, so targets such as RISC-V, MIPS, PowerPC
and SystemZ now get signext on it, while AIX, z/OS and VE, where it is
unsigned, get zeroext.
Assisted-by: Claude
[lld-macho] Keep branch-range extension thunks out of the symbol table
Make every branch-range extension thunk a local symbol. Until now,
thunks to external functions were added to the global symbol table as
private externs, and thunks to local functions had no symbol in the
output at all. This matches ld64 and ld-prime, which both emit every
branch island as a local symbol.
This also means that address assignment no longer adds anything to the
global symbol table, so code that reads it can run concurrently with
address assignment without any synchronization. A follow-up uses this to
prepare the export trie and the symbol table section while addresses are
being assigned.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[lldb] Remove empty/corrupt DataFileCache symtab/dwarf-index (#242081)
The symtab and dwarf-index DataFileCache files have the full filepath
and arch of the file used in the filename, and then in the contents of
the file there is a CacheSignature. The CacheSignature is intended to
change when the file is rebuilt, so we can detect that a binary has been
rebuilt and remove the old cached results.
This CacheSignature is performed in ManualDWARFIndex::Decode and
Symtab::Decode,
```
bool Decode(const DataExtractor &data, lldb::offset_t *offset_ptr,
bool &uuid_mismatch);
```
This method sets `uuid_mismatch=true` when that has been detected. It
returns false when the file is empty or corrupt. The callers only
handled the first case,
[17 lines not shown]
[RuntimeLibcalls] Take the module in libcall signature converters (NFC)
The converters that turn declaration C type descriptions into IR types
and attributes take a context, a triple and a data layout. A libcall
declaration can also depend on properties recorded in the module itself
rather than in the triple, so pass the module instead and derive all
three from it.
Change getDefaultFunctionTy, getFunctionTy, getVariableType and the
static helpers they use to take a Module, and update the callers. No
functional change intended.
Assisted-by: Claude
[mlir][test] Lower SCF before arith in test-tensor-e2e.mlir (#243330)
Fixes a2ab97c563d8 (#241196).
Buffer deallocation now emits a @dealloc_helper with scf.for loops, and
lowering them in -convert-scf-to-cf creates arith ops after
-convert-arith-to-llvm has already run. Run -convert-scf-to-cf first, as
the sibling tests do.
Assisted-by: Gemini
[RISCV] Fix VL optimizer crash on frame-index slide amount (#243340)
Fixes #237044.
`RISCVVLOptimizer` runs before PrologEpilogInserter, so an
alloca-derived
`vslidedown` slide amount reaches `getMinimumVLForVSLIDEDOWN_VX` as
`ADDI %stack.N, -1`. The helper called `getReg()` on the ADDI's first
operand
without checking that it is a register, which asserts on the frame
index.
Bail out when the operand is not a register. `VSLIDEDOWN` reads past VL,
so
the caller conservatively demands VLMAX, as before.
Tests:
- `CodeGen/RISCV/rvv/vl-opt.mir`: new frame-index MIR case (fails with
the
[7 lines not shown]
[lldb] Share the nlist parser with the shared cache locals (#242604)
On embedded, ParseSymtab had a second copy of the nlist parser for the
local symbols that the shared cache keeps out of the mapped image. No
macOS build compiles that copy and it had drifted from the main one.
Hoist ParseSymbolLambda, add ParseNListsLambda for the two-pass walk,
and call it for both tables.
This changes behavior on embedded:
- The unmapped locals pick up the fixes the copy missed: the two-pass
merge, N_WEAK_REF, and the section check before recording a symbol
address.
- Symbol IDs are LC_SYMTAB indexes again. 4bddca306a45 restarted them at
zero after skipping the mapped locals, so they no longer matched the
indexes the stub lookup uses.
- The unmapped locals are parsed after LC_SYMTAB and numbered from
nsyms. They all had ID 0 before. Symtab::FindSymbolByID is a binary
[2 lines not shown]