[CIR] Fix speculative vtable emission check for inline virtual functions (#245845)
hasAnyUnusedVirtualInlineFunction looked up each inline virtual function
as a cir::GlobalOp, which never matches a function, so every class
appeared to have an unemitted inline virtual and
canSpeculativelyEmitVTable always returned false. As a result CIR never
emitted available_externally vtables at -O1 and above, preventing LLVM
from devirtualizing calls whose target is known after inlining a
constructor. Look the entry up as a cir::FuncOp, matching classic
codegen.
[Sparc] Reject V9-only register names and fcmp forms on V8 (#247419)
When targeting V8, the assembler accepted the V9 names of %asr2-%asr6
(%ccr, %asi, %tick, %pc and %fprs), the JPS1 names of the other ASRs,
and the forms of the floating-point compares that name an %fcc
register. fcmps %fcc1, ... was encoded with the cc bits in a field that
is reserved on V8, and the disassembler decoded that encoding back as
the V9 form.
Reject all of these on V8 as GNU as does, and don't decode %fcc1-%fcc3
on V8.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[X86] isGuaranteedNotToBeUndefOrPoisonForTargetNode - add X86ISD::HADD/HSUB handling (#247764)
Use getHorizDemandedElts to determine the correct DemandedElts masks
Pulled out of #245048
[flang][OpenMP] Keep vectorizable innermost loop out of collapse (#236152)
On the host, collapsing all loops of a multi-index `do concurrent`
recomputes every index on each iteration and blocks vectorization of the
innermost loop. Leave the innermost loop out of the collapse when it is
likely to vectorize, unless the outer loops have constant bounds with
fewer than 64 iterations in total. Device mapping is unchanged.
[Sparc] Fix inline asm operands bound to %f32-%f62 (#247420)
An inline asm double operand bound to one of %f32-%f62 (D16-D31), as
in "{f32}" or "{d16}", hit an assertion in getCopyToParts. The generic
lookup returned the register in CanonicalFPRegs, which exists only for
the assembler and comes first in the register class list, and whose
first value type is f32. Use the allocatable class of the register
instead.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[Bazel][Libc] Add info about char16_t.h to bazel build files. (#247770)
char16_t.h was added to character converter by PR 230434, but the Bazel
build files were not updated then.
[SCEV] Add GEP offsets successively. (#247648)
nusw on a GEP only guarantees that adding the offsets in the
original order of the indices does not wrap.
SCEV requires flags to apply for any operand order. Add the offsets one
by one instead, like createSCEV does for chains of adds. getAddExpr
handles flags correctly when inlining operands.
PR: https://github.com/llvm/llvm-project/pull/247648
[Modules][ObjC] Objective-C categories aren't visible in local submodule visibility (#246933)
Objective-C categories are never visible under local submodule
visibility because ObjCInterfaceDecl::isVisible{Category|Extension}
doesn't check Sema::isVisible. In fact they can't check Sema because
that's at a higher level. Instead add an isDeclVisible to ASTContext,
and have Sema set a callback on ASTContext to let it call through to
Sema::isVisible.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
rdar://82149585
[AMDGPU] Re-enable AAInstanceInfo in AMDGPUAttributor (#247043)
This was enabled and then disabled because of its compile time impact.
With recent changes #246890 and #247042, the compile time issue should
have been resolved.
[Clang][OpenMP] Skip offload metadata emission during function finalization (#245735)
With -fopenmp-enable-irbuilder, Clang calls finalize(CurFn) after
generating each function. Emitting module-wide offload entries there,
and again at module completion, duplicates host offload metadata. Device
compilation then fails with "All ordered entries must exist!" because
duplicate records inflate the entry count.
Only emit offload entries from finalize() when no function is supplied.
Follow-up to commit 48c3ae5 @agozillon.
Fixes #242591.
Assisted by gpt-6.
resolve lazy inputs with one persistent owner map
Adopt the design proposed in review. Loading state now lives in two
places: an owner map that has one entry per name and persists across
groups of inputs, and the lazy flag of each file.
Every input is queued when it is created, which gives it a position, and
loadInputs() scans the new files in parallel (each claims the names it
defines and keeps pointers to the entries of the names it references),
visits the references of the files that are part of the link in
parallel, and parses the files that became part of it in input order.
References that do not come from a file (-u, the entry symbol, exported
symbols, ObjC class stubs, dyld_stub_binder) are passed to the same walk
by SymbolTable::addUndefined().
Nothing loads a file on contact any more, so extract(), pendingExtracts,
the per-batch owner map and the LazyArchive and LazyObject symbols are
gone, and the symbol table only sees files that are part of the link.
[4 lines not shown]
[lld][MachO] Implement -bind_at_load (#224788)
Implements ld64's `-bind_at_load`: bind every symbol eagerly at load
time rather than lazily on first use. lld previously parsed the flag,
warned "not yet implemented", and ignored it.
With chained fixups the flag stays a no-op (chained fixups have no
laziness), same as ld64.
[llvm-ifs][CMake] Register llvm-ifs as a host tool for bootstrap builds (#241130)
Register `llvm-ifs` via `setup_host_tool` and forward `LLVM_IFS` across
Clang bootstrap stages so CMake build rules can invoke `llvm-ifs` across
standalone, `llvm-driver` multicall, cross-compiled, and multi-stage
configurations.
Assisted-by: Gemini
[SPARC] Sign-extend the immediates of movr and movcc in the disassembler (#247427)
The simm10 field of movr and the simm11 field of movcc had no decoder
method, so the disassembler printed a negative value as unsigned, e.g.
movrz %o0, 0x3fc, %o1 for -4. Decode them with a sign-extending
decoder, as is already done for simm5 and simm13, using one template
for all four.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[mlir][memref] Elide reinterpret_cast windows feeding memref.load (#243489)
Loads through a static offset window, such as the last row of a
`memref<1x513x40xf32>`, kept their reinterpret_cast, but MemRefToEmitC
cannot lower that cast
Shift the load indices by the window offset and load from the source
```mlir
%rc = memref.reinterpret_cast %src to offset: [20480], sizes: [1, 1, 40],
strides: [20520, 40, 1] : memref<1x513x40xf32> to memref<1x1x40xf32, ...>
%v = memref.load %rc[%c0, %c0, %k]
// becomes
%v = memref.load %src[%c0, %c512, %k] : memref<1x513x40xf32>
```
<sub>AI-assisted, pro forma</sub>
[llvm-profgen] Keep the CS head estimate for indirect call targets
A flow-sensitive profile can split entry probe samples across multiple discriminators. Looking up (1, 0) alone can reject a target even though the sample loader combines its entry samples at the base discriminator. Restore getHeadSamplesEstimate() in the pre-inliner ICP checks and keep the nested-output option local to the generator.
Exercise both sides of the promotion threshold with a 260-sample head split across two entry records. Verify that the nested output read with base discriminators gives the eligible target all 260 samples.
[CIR] Give the #cir.fenv parameters default values
The parameters of `#cir.fenv` were optional, and accessors substituted
a default for an absent one. The default floating-point environment
therefore had several spellings, such as `fenv<>`,
`fenv<except_mode = masked>` and the form CIRGen emits with all three
parameters, each a distinct attribute.
This makes the parameters default-valued: `tonearest`, `masked` and
`false`, the default floating-point environment. A parameter with its
default value is not printed, so each environment has one printed form
and `fenv<>` is the default one. A parameter spelled with its default
value still parses and gives the same attribute. An operation with
`fenv<>` is still constrained. Only an operation without the attribute
is not.
The default of `dynamic_rounding_mode` changes from `unknown` to
`tonearest`, in the documentation and in what the accessor returns for
an absent mode. Lowering already emitted `round.tonearest` for an
[9 lines not shown]
[X86] combineSelect - only create VMTRUNC from a legal source type (#247663)
The select(c, trunc(x), y) -> VMTRUNC fold for targets without BWI
(#201339) runs before type legalization. With AVX512VL and a 256-bit
preferred vector width, v16i32 and v8i64 are illegal, and the type
legalizer can't split the operand of the target node: "Should not
custom lower this!". Reachable from C with -mavx512f -mavx512vl
-mprefer-vector-width=256; real code such as libwebp's sharpyuv hits
it. The same fold also crashed with "use-soft-float", where no vector
type is legal.
Assisted-by: Claude Code (Claude Opus 5.5)