[HLSL][Matrix] Update indexed matrix elements individually (#176216)
Fixes #174629
This PR is similar to that of #169144 but for matrices.
When storing to a matrix element or matrix row, `insertelement`
instructions have been replaced by GEPs followed by stores to individual
matrix elements. There is no longer storing of the entire matrix to
memory all at once, thus avoiding data races when writing to independent
matrix elements from multiple threads.
Reland "[NFC][MI] Tidy Up RegState enum use (1/2)" (#176277)
This Change is to prepare to make RegState into an enum class. It:
- Updates documentation to match the order in the code.
- Brings the `get<>RegState` functions together and makes them
`constexpr`.
- Adopts the `get<>RegState` where RegStates were being chosen with
ternary operators in backend code.
- Introduces `hasRegState` to make querying RegState easier once it is
an enum class.
- Adopts `hasRegState` where equivalent was done with bitwise
arithmetic.
- Introduces `RegState::NoFlags`, which will be used for the lack of
flags.
- Documents that `0x1` is a reserved flag value used to detect if
someone is passing `true` instead of flags (due to implicit bool to
unsigned conversions).
- Updates two calls to `MachineInstrBuilder::addReg` which were passing
`false` to the flags operand, to no longer pass a value.
[6 lines not shown]
[LifetimeSafety] Track moved declarations to prevent false positives (#170007)
Prevent false positives in lifetime safety analysis when variables are
moved using `std::move`.
When a value is moved using `std::move`, ownership is transferred from
the original variable to another. The lifetime safety analysis was
previously generating false positives by warning about
use-after-lifetime when the original variable was destroyed after being
moved. This change prevents those false positives by tracking moved
declarations and exempting them from loan expiration checks.
- Added tracking for declarations that have been moved via `std::move`
in the `FactsGenerator` class
- Added a `MovedDecls` set to track moved declarations in a
flow-insensitive manner
- Implemented detection of `std::move` calls in `VisitCallExpr`
- Modified `handleLifetimeEnds` to skip loans for declarations that have
been moved
[17 lines not shown]
GlobalMerge: Do not merge globals with non-dbg metadata.
As noticed during the review of #149260, this transformation
is not necessarily correct for all metadata types.
Reviewers: efriedma-quic
Pull Request: https://github.com/llvm/llvm-project/pull/175875
[AggressiveInstCombine] Allow load folding for root inst with multiple uses. (#176101)
The load folding optimization was very conservative by requiring the
root OR instruction to have a single use. This prevented optimization
when to fold loads when only the root had multiple uses.
For example:
%val = or i32 ... ; Assembles 4 bytes to i32
%use1 = call @foo(%val)
%use2 = call @bar(%val)
Revert "[Serialization] Stop demote var definition as declaration" (#176441)
Reverts #172430 (c560f1cf03aa06c0bdd00c5a9b558c16d882af6f).
Causes some failures like `error: static assertion expression is not an
integral constant expression` and `error: substitution into constraint
expression resulted in a non-constant expression` in modules builds.
Repro TBD.
[OpenMP][Clang] Parsing/Sema support for `use_device_ptr(fb_preserve/fb_nullify)`. (2/4) (#170578)
Depends on #169603.
This is the `use_device_ptr` counterpart of #168905.
With OpenMP 6.1, a `fallback` modifier can be specified on the
`use_device_ptr` clause to control the behavior when a pointer lookup
fails, i.e. there is no device pointer to translate into.
The default is `fb_preserve` (i.e. retain the original pointer), while
`fb_nullify` means: use `nullptr` as the translated pointer.
Dependent PR: #173930.
[clangd] Support `=default` in DefineOutline to find insertion point (#175618)
Since #128164, the DefineOutline tweak is looking for a good insertion
point by looking at where neighboring functions are defined. That
heuristic didn't yet handle `= default`. This commit adds support for
it.
[flang][debuginfo] Use <stdin> for file name when reading from stdin
Currently, the DIFile debuginfo nodes use "standard input" as the file
name when compiling with -g and reading input from stdin. This has been
changed to "<stdin>" for consistency with clang and gfortran.
Fixes #60288
[Support][NFC] Use default move constr/assign for DomTree (#176423)
Added in 5e10e21d28496ba40ccd385740d7d1b4bb1368e4, hopefully MSVC can
generate the correct code 11 years later? (If not, we probably have
other problems, too? Unfortunately, I couldn't find information on what
the actual problem was.)
The explicit move constructor/assignment are error-prone to
modifications, because it is easy to forget updating them when modifying
members.
[ELF][Mips] Fix addend for preemptible static TLS
If the symbol is preemptible the addend should be 0, not our
definition's VA. Note that by using addAddendOnlyRelocIfNonPreemptible
the generic Elf_Rel code will ensure the VA is written out as the addend
if the symbol is non-preemptible, and so writeTo only needs to write out
the VA in the case that we don't call it (so long as we make sure to
call relocateAlloc to actually apply any such relocations).
Reviewers: MaskRay
Pull Request: https://github.com/llvm/llvm-project/pull/150729
[DAG] Allow MIN/MAX signedness flip when operands are known-negative (#174469)
Extend the existing DAGCombine logic in visitIMINMAX so that signed and
unsigned MIN/MAX can be flipped not only when both operands are known
non-negative but also when both operands are known negative. This
replaces the old SignBitIsZero checks with computeKnownBits and explicit
tests for non-negative or negative operands while keeping all existing
legality and saturation gating in place. Add regression tests to cover
both the known-negative case and the known-non-negative case.
Fixes #174325
InstCombine: Improve single-use fneg(fabs(x)) SimplifyDemandedFPClass handling
Match the multi-use case's logic for understanding no-nan/no-inf context.
Also only apply the nsz handling in the single use case. alive2 seems to treat
nsz as nondeterministic for each use.
[docs] Add human-in-the-loop policy for tool-assisted contributions (#154441)
Over the course of 2025, we observed an increase in the volume of
LLM-assisted nuisance contributions to the project. Nuisance
contributions have always been an issue for open-source projects, but
until LLMs, we made do without a formal policy banning such
contributions. However, LLMs are here, so we are adopting this policy,
abbreviated as "human in the loop", which requires that every
contribution has a human author attesting to the value of that
contribution, and that it is high enough quality that it is worth the
time it takes to review the contribution.
This policy evolved over time based on community input from the
following Discourse threads and a few area team and LLVM project council
meetings:
* [Our AI policy vs code of conduct and vs
reality](https://discourse.llvm.org/t/our-ai-policy-vs-code-of-conduct-and-vs-reality/88300)
* [[RFC] LLVM AI tool policy: start small, no slop](https://discourse.llvm.org/t/rfc-llvm-ai-tool-policy-start-small-no-slop/88476)
* [[RFC] LLVM AI tool policy: human in the
[5 lines not shown]