[llvm-mc] Report more errors through the SourceMgr (#236281)
Avoid printing to errs() directly and use the SourceMgr instead like
all the other assembler and disassembler diagnostics.
This is needed for the upcoming `--verify` option: without this, these
options interfere with the exit code from --verify and can't be matched.
Mostly NFC, although the errors now print without a `llvm-mc:` prefix.
Assisted-by: AI tooling
Pull-Request: https://github.com/llvm/llvm-project/pull/236281
[llubi] Add support for llvm.masked.gather (#235986)
Re-use the logic for llvm.masked.load to also support
llvm.masked.gather.
Instead of computing consecutive addresses from a base pointer, enabled
lanes are loaded from the pointer of the lane. Masked-off lanes are
taken from the passthru operand and are not accessed.
PR: https://github.com/llvm/llvm-project/pull/235986
[Support][mlir] Clean up list of unmatched @unknown directives (#236282)
mlir-opt calls `verify()` twice (explicitly and in the handler's
destructor), and `verify()` clears the per-file directive lists, but
did not clear the list of `@unknown` ones.
This fixes reporting unmatched `@unknown` twice.
Assisted-by: AI tooling
Pull-Request: https://github.com/llvm/llvm-project/pull/236282
[clang][Sema] Fix crash caused by invalid implicit format attributes (#229010)
Clang implicitly adds `format_arg(1)` to `__CFStringMakeConstantString`,
including prototypeless declarations created during error recovery. A
zero-argument call can then cause format string checking to access a
nonexistent argument and crash.
Reproducer:
```c
void a(char *) __attribute__((format(__CFString__, 1, 2)));
void b() { a(__CFStringMakeConstantString()); }
```
Before this change, an assertions-enabled build crashes after reporting
the source errors (diagnostic excerpts):
```text
error: call to undeclared function '__CFStringMakeConstantString';
[10 lines not shown]
[VPlan] Remove redundant VPIRFlags::transferFlags (NFC) (#236641)
Its only user, VPReplicateRecipe::cloneWithOperands, already passes
*this as the flags to the new recipe/ Remove the unnecessary call.
[clang] Remove declarations without definitions (NFC) (#236620)
This patch removes function and method declarations that have no
definitions and no callers.
Assisted-by: Antigravity
[clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast_if_present (NFC) (#236619)
PointerUnion::dyn_cast has been soft-deprecated in favor of
llvm::dyn_cast and llvm::dyn_cast_if_present. This patch replaces
PointerUnion::dyn_cast with llvm::dyn_cast_if_present in
SARIFDiagnostic::emitDiagnosticMessage, and adds a test case to cover
the null operand case.
Note that DiagnosticRenderer::emitSingleMacroExpansion invokes
emitDiagnosticMessage with a null DiagOrStoredDiag when emitting a
macro expansion note.
This patch completes the migration away from PointerUnion::dyn_cast
under clang/.
Assisted-by: Antigravity
[SandboxVec][LoadStoreVec] Vectorize store chains whose loads have external uses
vectorizeStores() used to give up on a load-store chain if any of the
loads had a user other than its store. Now that loads of mixed types
can be unpacked from a vector load, vectorize such chains as well: the
loads become a single vector load, and the external users are fed from
the lanes each load occupies, cast back to the load's type if needed.
The unpacking loop of vectorizeLoads() is factored out into
unpackLoads() (along with the canUnpackLoads() check) and shared by
both paths. Chains with a non-integral pointer load that has external
users are still left alone.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SandboxVec][LoadStoreVec] Add Reinterpret helper for same-size type casts
Replace getEquivalentConstantWithType() with a Reinterpret utility that
reinterprets the bits of a value as another type of the same size. It
builds a chain of ptrtoint / bitcast / inttoptr casts, and applies it
either to a constant (folding) or to a runtime value (inserting casts).
The runtime form will be used to unpack mixed-type vector loads and to
pack mixed-type store operands.
Also add VecUtils::isNonIntegralPtr(). A non-integral pointer has no
stable integer representation, so it is no longer packed into an
integer lane. Previously only a non-integral destination type was
rejected (via an assert), while a non-integral source such as
'ptr addrspace(5) null' was silently converted with ptrtoint.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SandboxVec][LoadStoreVec] Add LLVM_ABI annotations to Reinterpret
Export the out-of-line static members of Reinterpret, as reported by
the LLVM_ABI annotation check. getCastChain() is private but is called
from the inline canReinterpret(), so it needs to be exported too.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SandboxVec][LoadStoreVec] Support mixed-type load vectorization
Remove the restriction that every load in a top-level load chain must
have the vector's element type. A chain of mixed types such as
{i32, float} or {double, i32, i32} is loaded as a vector of integers
(as chosen by VecUtils::getCombinedVectorTypeFor()), each original load
is unpacked from the lanes it occupies, and then reinterpreted back to
its own type with Reinterpret::reinterpretValue().
Chains involving a non-integral pointer are left alone, since such a
pointer cannot be recovered from an integer lane.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SandboxVec][LoadStoreVec] Move contiguity check into canVectorize() (NFC)
Both vectorizeStores() and vectorizeLoads() (via createVectorLoad())
checked that the bundle is consecutive right before calling
canVectorize(). Fold that check into canVectorize() so that every
caller gets it.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SandboxVec][LoadStoreVec] Reject bundles that cannot be scheduled
canVectorizeLSV() created a CantSchedule result when the scheduler
failed, but did not return it, so such bundles were still reported as
Widen. For a load chain like
%ld0 = load i32, ptr %p0
store i32 %ld0, ptr %p1
%ld1 = load i32, ptr %p1
the vector load was placed after %ld1 and the store was rewritten to
use a lane extracted from it, producing a use before its definition.
Return the CantSchedule result.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[mlir][Python] Generate type stubs for dialect extensions
Continue #175403 by generating extension stubs for each concrete Python
package. Keep imports and build dependencies local to that package, handle
optional extensions, and normalize native IR type references.
Co-authored-by: makslevental <maksim.levental at gmail.com>
[VPlan] Don't query IVDesc for pointer-induction step type (NFC) (#236640)
The step operand of VPWidenPointerInductionRecipe is created from the
descriptor's step SCEV in createWidenInductionRecipe, so its scalar type
matches ID.getStep()->getType(). Use it directly.
grafana: add some go modules manually to fix the build
show-go-modules doesn't pick these up consistently,
presumably due to our go.mod patch.
This is an annoying issue and needs to be revisited later.
[SandboxVec][LoadStoreVec] Support mixed-type store vectorization of arbitrary values
vectorizeStores() only handled chains whose stored values were all
consecutive loads or all constants. Any other chain, e.g., storing
function arguments or computed values, was left alone.
Pack such values into a vector with createPack(). For a chain of mixed
types the vector has integer lanes, so each value is first
reinterpreted (bitcast / ptrtoint) as the lanes it occupies with
Reinterpret::reinterpretValue(), and a value spanning several lanes is
inserted lane by lane. The pack is placed right before the vector
store, where every stored value is available. Whether this pays off is
left to the existing cost check in acceptOrRevert().
Chains storing a non-integral pointer are left alone.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[Github] Run generic-llvm-libc against libc changes (#234440)
libc changes have been breaking the libc++ tests reasonably often, so
run the generic-llvm-libc CI job on libc changes to ensure things do not
get broken premerge. This job typically runs in <20 minutes so shouldn't
be too interruptive.
[Analysis] Declare command line options in TableGen (#236489)
Port the file-local options of llvm/lib/Analysis to a per-LLVMContext
AnalysisOptions struct. These remain cl::opt: exported options, options
read by public APIs without IR context (getInlineParams, TTI getters,
InlineConstants::getInstrCost, generateParamAccessSummary), and options
read per query without an object to bind them (ValueTracking,
ConstantFolding, CFG reachability, ObjectSizeOffsetVisitor, TBAA,
ScopedNoAliasAA).
* Option-reading classes hold `const AnalysisOptions &`; the inline
constructors of BasicAAResult, MemoryDependenceResults,
DependenceInfo, MemoryDepChecker, RuntimePointerChecking,
InterleavedAccessInfo and ProfileSummaryInfo move out of line, and
InterleavedAccessInfo::isStrided becomes non-static.
* Rename -disable-gep-const-evaluation and
-da-disable-delinearization-checks to positive spellings; the old ones
remain aliases.
* The inline cost annotation printer no longer sets
[2 lines not shown]
[SandboxVec][LoadStoreVec] Vectorize store chains whose loads have external uses
vectorizeStores() used to give up on a load-store chain if any of the
loads had a user other than its store. Now that loads of mixed types
can be unpacked from a vector load, vectorize such chains as well: the
loads become a single vector load, and the external users are fed from
the lanes each load occupies, cast back to the load's type if needed.
The unpacking loop of vectorizeLoads() is factored out into
unpackLoads() (along with the canUnpackLoads() check) and shared by
both paths. Chains with a non-integral pointer load that has external
users are still left alone.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SandboxVec][LoadStoreVec] Support mixed-type load vectorization
Remove the restriction that every load in a top-level load chain must
have the vector's element type. A chain of mixed types such as
{i32, float} or {double, i32, i32} is loaded as a vector of integers
(as chosen by VecUtils::getCombinedVectorTypeFor()), each original load
is unpacked from the lanes it occupies, and then reinterpreted back to
its own type with Reinterpret::reinterpretValue().
Chains involving a non-integral pointer are left alone, since such a
pointer cannot be recovered from an integer lane.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SandboxVec][LoadStoreVec] Add Reinterpret helper for same-size type casts
Replace getEquivalentConstantWithType() with a Reinterpret utility that
reinterprets the bits of a value as another type of the same size. It
builds a chain of ptrtoint / bitcast / inttoptr casts, and applies it
either to a constant (folding) or to a runtime value (inserting casts).
The runtime form will be used to unpack mixed-type vector loads and to
pack mixed-type store operands.
Also add VecUtils::isNonIntegralPtr(). A non-integral pointer has no
stable integer representation, so it is no longer packed into an
integer lane. Previously only a non-integral destination type was
rejected (via an assert), while a non-integral source such as
'ptr addrspace(5) null' was silently converted with ptrtoint.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SLP]Fix APInt assertion for constant stride wider than index type
The stride, computed as a difference of offsets wrapped in the index
width, may not fit the index type (e.g. 2^31 in i32). Truncate it;
address arithmetic wraps at the index width, so the accessed lanes
stay the same.
Fixes #236180
Assisted-by: Cursor
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/236627
[Driver][SYCL] Skip the spirv64 builtins library when it is missing (#236556)
#218528 made a missing `libclang_rt.builtins.bc` an error for SYCL
spirv64 device compilations. That library is only built when compiler-rt
is built for spirv64, so every Clang built without it, including the one
on godbolt.org, now fails on plain `-fsycl` (reported in
https://github.com/llvm/llvm-project/pull/218528#issuecomment-6426376844).
Link the library when it is present and skip it otherwise, as the driver
already does for the OpenMP NVPTX and AMDGPU builtins (#109152).
[SandboxVec][LoadStoreVec] Move contiguity check into canVectorize() (NFC)
Both vectorizeStores() and vectorizeLoads() (via createVectorLoad())
checked that the bundle is consecutive right before calling
canVectorize(). Fold that check into canVectorize() so that every
caller gets it.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SandboxVec][LoadStoreVec] Reject bundles that cannot be scheduled
canVectorizeLSV() created a CantSchedule result when the scheduler
failed, but did not return it, so such bundles were still reported as
Widen. For a load chain like
%ld0 = load i32, ptr %p0
store i32 %ld0, ptr %p1
%ld1 = load i32, ptr %p1
the vector load was placed after %ld1 and the store was rewritten to
use a lane extracted from it, producing a use before its definition.
Return the CantSchedule result.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
ena: Reinit RSS components during queue count change flow
The io_queues_nb sysctl is writable while the interface is down, and
setting it destroys the RSS components. When the interface is not UP
nothing reinitialises them, so the indirection table is left referencing
queues that no longer exist until the next ifconfig up.
Call ena_rss_configure() after the queue count changes when the
interface is down. When it is up, this happens through ena_up().
This can configure RSS twice if the interface is brought up afterwards,
costing three redundant admin commands. That is preferred over changing
ena_up(), which the reset path also uses.
Reviewed by: cperciva
Fixes: 56d41ad5fe9c ("Add sysctl node for ENA IO queues number adjustment")
MFC after: 3 days
Sponsored by: Amazon, Inc.