[LV] Don't form a histogram if the bucket value or its update escapes (#215021)
The histogram intrinsic performs the load, update and store of a bucket
as a single operation, so neither the loaded value nor the updated value
is available to other users. Currently other users are served by a
separate gather, which is incorrect.
Reject cases where either the update or bucket value have multiple
users.
PR: https://github.com/llvm/llvm-project/pull/215021
[flang][OpenMP] Revert array element reduction lowering (#215617)
Revert #196094 and its follow-up #209701. The expression override
mechanism does not preserve reduction-object identity across all data
environments, leading to incorrect lowering for procedure-local and
nested private arrays.
Restore the pre-#196094 lowering while retaining semantic-context
plumbing needed by later user-defined reduction support. Keep coverage
showing that array-element constructs compile through the boxed-array
reduction path.
This was in response to this comment:
https://github.com/llvm/llvm-project/pull/196094#issuecomment-5248085956
Fixing exactly the bug in the comment wasn't hard but AI code review
found a large number of follow on bugs so I think the design needs a
rethink, and definitely shouldn't be included in the LLVM release.
Assisted-by: Codex
[InstCombine] Fold (X - X%C) u>= C to X u>= C (#214381)
(X - (X urem D)) is D*(X/D), a multiple of D. A multiple of D is u> C
exactly when X u>= D for any C u< D, and u< C exactly when X u< D for
any
0 u< C u<= D.
icmp ugt (sub X, (urem X, D)), C --> icmp ugt X, D-1 for C u< D
icmp ult (sub X, (urem X, D)), C --> icmp ult X, D for 0 u< C u<= D
The ugt case previously required C == D-1; it now folds for the whole
[0, D) range. The ult case is new.
alive2 (ugt): https://alive2.llvm.org/ce/z/_sUmC2
alive2 (ult): https://alive2.llvm.org/ce/z/x4vfAz
alive2 : https://alive2.llvm.org/ce/z/ktjUcP
[SandboxVectorizer] Make LoadStoreVec::vectorizeStores direction-agnostic
Remove classifyStoreOperands()/isFoldableLoadOperand(): vectorizeStores()
no longer gates on whether a store chain's value operands are all loads,
all constants, or neither. Instead it always builds the vector value via
a new packOperands(), which packs any mix of loads, constants, or
arbitrary SSA values via extractelement/insertelement -- direction-
agnostic in the sense that it doesn't care what kind of operand it's
given, unlike the load-specific and constant-specific paths it replaces.
packOperands() combines operands at the granularity of their narrowest
common scalar element type (the same rule getCombinedVectorTypeFor()
uses), splitting a wider operand into multiple lanes via a bitcast. A
plain bitcast can't convert between pointer and non-pointer types, and
inttoptr requires an integer source, so reinterpretSameWidth() picks
bitcast, ptrtoint, or inttoptr as needed, routing a non-integer,
non-pointer operand (e.g. double) through an intermediate same-width
integer when the target granularity is a pointer.
[38 lines not shown]
[HLSL] Move `degrees` implementation to header files (#215436)
Closes #213096.
This PR replaces the previous implementation of `degrees` with a new one
inside the header files.
The SPIRV intrinsic (`int_spv_degrees`) and its lowering are
intentionally kept, since a follow-up will pattern-match `Val *
(180/pi)` back to the extended instruction and needs the SPIRV intrinsic
to do so.
Assisted-by: Claude Opus 4.8
[mlir][bufferization] Make the dialect's bufferization customizable (#215590)
The bufferization dialect's ops declared `BufferizableOpInterface` in
their ODS trait lists, so the models were part of the op definitions.
The MLIR interface map keeps the first model attached to an op, and an
op-defined model is always first, so a downstream project could not
replace them. For `bufferization.alloc_tensor` the only remaining hook
was `BufferizationOptions::allocationFn`. That hook cannot change the
buffer type without a contract break: `getBufferType` keeps reporting a
static identity layout, the allocation function returns a different
layout, and every consumer that predicts the type before the buffer
exists then disagrees with the buffer that appears.
Move the models out of the op definitions into external models, the same
way `arith`, `tensor`, `scf`, and the other dialects do it.
`bufferization::registerBufferizableOpInterfaceExternalModels` attaches
the models for `alloc_tensor`, `dealloc_tensor`,
`materialize_in_destination`, `to_buffer` and `to_tensor`, and
`registerAllDialects` calls it. A project that must control how these
[8 lines not shown]
Fix lambda merging to apply to locally-parsed lambdas. (#215661)
Clang's lambda-merging logic was implemented in the ASTReader, meaning
that it only applied for lambdas that were imported from AST files. This
caused us to fail to merge lambdas in the case where both lambdas were
parsed as part of the current compilation, for example if they are
included into distinct submodules in the same header module.
Fix this by moving the merging logic out of ASTReader and into Sema, and
moving the tracking of lambdas that need to be merged out of ASTReader
and into ASTContext. This removes the AssignedLambdaNumbering callback
from ExternalSemaSource, which was only being used for this purpose.
Fixes #214560.
Assisted-by: Gemini for the mechanical reorganization. Rework of
handleLambdaNumbering done by hand.
[lldb] Remove ConstString from DumpValueObjectOptions (#215421)
There are 2 uses of ConstString in DumpValueObjectOptions:
DeclPrintingHelper and ChildPrintingDecider, both being std::functions.
The former takes 2 ConstString arguments and the latter takes just one.
These functions don't really need their arguments (type names, var
names, register names) to actually be in a ConstString. For the most
part, they are just printing the string out or otherwise analyzing it.
mfc-candidates: Fix remote repo detection
In my repos the remote "freebsd" is git at gitrepo.freebsd.org:src.git.
In particular, the last component is delimited by a colon, not a slash.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D48951