562109 Commits

Author SHA1 Message Date
Michael Kruse
d233e787f0 Revert "[Flang] Move builtin .mod generation into runtimes (Reapply #137828) (#169638)"
This reverts commit 7675fc79c802cf7f6a95660f6ee59bf6cb62102f.

Requested in PR:
https://github.com/llvm/llvm-project/pull/169638#issuecomment-3634227707
2025-12-09 22:39:41 +01:00
Ramkumar Ramachandra
3310c0be58
[VPlan] Strip TODO to consolidate (ActiveLaneMask|Widen)PHI (#171392)
They cannot be consolidated, as WidenPHI is not a header PHI, while
ActtiveLaneMaskPHI is.
2025-12-09 21:38:58 +00:00
Erick Velez
d86bc19ad7
[clang-doc] Do not serialize empty text comments (#169087) 2025-12-09 13:37:00 -08:00
Aiden Grossman
f29d06029f Revert "[LV] Mark checks as never succeeding for high cost cutoff."
This reverts commit 8a115b6934a90441d77ea54af73e7aaaa1394b38.

This broke premerge. https://lab.llvm.org/staging/#/builders/192/builds/13326

/home/gha/llvm-project/clang/test/Frontend/optimization-remark-options.c:10:11: remark: loop not vectorized: cannot prove it is safe to reorder floating-point operations; allow reordering by specifying '#pragma clang loop vectorize(enable)' before the loop or by providing the compiler option '-ffast-math'
2025-12-09 21:32:09 +00:00
Christopher Ferris
64ee4bf734
[scudo] Refactor initialization of TSDs. (#169738)
Instead of getting a lock and then checking/modifying the Initialization
variable, make it an atomic. Doing this, we can remove one of the
mutexes in shared TSDs and avoid any potential lock contention in both
shared TSDs and exclusive TSDs if multiple threads do allocation
operations at the same time.

Add two new tests that make sure no crashes occur if multiple threads
try and do allocations at the same time.
2025-12-09 13:30:46 -08:00
Andrew Haberlandt
926cbddc18
[sanitizer_common] child_stdin_fd_ should only be set on posix_spawn path (#171508)
#170809 added the child_stdin_fd_ field on SymbolizerProcess to allow
the parent process to hold on to the read in of the child's stdin pipe.
This was to avoid SIGPIPE.

However, the `StartSubprocess` path still closes the stdin fd in the
parent here:

7f5ed91684/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp (L525-L535)

This could cause a double-close of this fd (problematic in the case of
fd reuse).

This moves the `child_stdin_fd_` field to only be initialized on the
posix_spawn path. This should ensure #170809 only truly affects Darwin.
2025-12-09 21:22:54 +00:00
Aiden Grossman
8f3c8dabc6
[MLIR][Bytecode] Use consistent types for resolveEntry (#171502)
uint64_t and size_t are not the same across all platforms. This was
causing build failures when building this file for wasm:

llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1323:19: error:
out-of-line definition of 'resolveEntry' does not match any declaration
in '(anonymous namespace)::AttrTypeReader'
1323 | T AttrTypeReader::resolveEntry(SmallVectorImpl<Entry<T>>
&entries, size_t index,
      |                   ^~~~~~~~~~~~

third_party/llvm/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:851:7:
note: AttrTypeReader defined here
  851 | class AttrTypeReader {
      |       ^~~~~~~~~~~~~~
1 error generated.

Use uint64_t everywhere to ensure portability.
2025-12-09 22:09:19 +01:00
Andy Kaylor
87bf5ee238
[CIR] Add basic support for data member pointers (#170939)
This adds the minimum support for C++ data member pointer variables.
2025-12-09 12:55:47 -08:00
Medha Tiwari
019a294771
[CIR][X86] Implement xsave/xrstor builtins Fixes part of #167752 (#170877)
Handle xsave/xrstor family of X86 builtins in ClangIR

Part of #167752

---------

Signed-off-by: Medha Tiwari <medhatiwari@ibm.com>
2025-12-09 12:49:42 -08:00
Aiden Grossman
0895163097
[bazel] Port 24117f75ad9d7bbb439e8e1bd596fdcf0aa8d6e2 (#171497)
This patch removed some source files that were explicitly enumerated in
the bazel files. Remove them so that the build passes.
2025-12-09 12:43:01 -08:00
Philip Ginsbach-Chen
af3c3ecb18
[AArch64] recognise trn1/trn2 with flipped operands (#169858)
This PR is very similar to #167235, but applied to `trn` rather than
`zip`. There are two further differences:
- The `@combine_v8i16_8first` and `@combine_v8i16_8firstundef` test
  cases in `arm64-zip.ll` didn't have equivalents in `arm64-trn.ll`, so 
  this PR adds new test cases `@vtrni8_8first`, `@vtrni8_9first`, 
  `@vtrni8_89first_undef`.
- `AArch64TTIImpl::getShuffleCost` calls `isZIPMask`, but not
  `isTRNMask`. It relies on `Kind == TTI::SK_Transpose` instead (which 
  in turn is based on `ShuffleVectorInst::isTransposeMask` through
  `improveShuffleKindFromMask`).
Therefore, this PR does not itself influence the slp-vectorizer. In a 
follow-up PR, I intend to override 
`AArch64TTIImpl::improveShuffleKindFromMask` to ensure we get
`ShuffleKind::SK_Transpose` based on the new `isTRNMask`. In fact, that
follow-up change is the actual motivation for this PR, as it will result
in
  ```C++
  int8x16_t g(int8_t x)
  {
    return (int8x16_t) { 0, x, 1, x, 2, x, 3, x,
                         4, x, 5, x, 6, x, 7, x };
  }
  ```
  from #137447 being optimised by the slp-vectorizer.
2025-12-09 20:41:44 +00:00
Florian Hahn
8a115b6934
[LV] Mark checks as never succeeding for high cost cutoff.
When GeneratedRTChecks::create bails out due to exceeding the cost
threshold, no runtime checks are generated and we must not proceed
assuming checks have been generated.

Mark the checks as never succeeding, to make sure we don't try to
vectorize assuming the runtime checks hold. This fixes a case where we
previously incorrectly vectorized assuming runtime checks had been
generated when forcing vectorization via metadate.

Fixes the mis-compile mentioned in
https://github.com/llvm/llvm-project/pull/166247#issuecomment-3631471588
2025-12-09 20:37:21 +00:00
Ryosuke Niwa
06f0758282
[alpha.webkit.UnretainedCallArgsChecker] Recognize [allocObj() init] pattern (#161019)
Generalize the check for recognizing [[Obj alloc] init] to also
recognize [allocObj() init]. We do this by utilizing isAllocInit
function in RetainPtrCtorAdoptChecker.
2025-12-09 12:29:11 -08:00
Ryosuke Niwa
f9326ffb7e
[WebKit checkers] Treat a weak property / variable as safe (#163689)
Treat a weak Objective-C property, ivar, member variable, and local
variable as safe.
2025-12-09 12:28:22 -08:00
Ryosuke Niwa
0eb00eff47
[alpha.webkit.RetainPtrCtorAdoptChecker] Don't treat assignment to an +1 out argument as a leak (#161633)
Make RetainPtrCtorAdoptChecker recognize an assignment to an +1 out
argument so that it won't emit a memory leak warning.
2025-12-09 12:15:56 -08:00
Fateme Hosseini
b3d05e6807
[Hexagon] Add HVX V81 builtins (#170680)
Expose the HVXV81 abs, conversion, comparison, log2, negate and mixed
subtract intrinsics so Clang can emit the new instructions.
2025-12-09 12:07:52 -08:00
Florian Hahn
7a5e2c9358
[LV] Add test with threshold=0 and metadata forcing vectorization.
Test case for the mis-compile mentioned in
https://github.com/llvm/llvm-project/pull/166247#issuecomment-3631471588

The issue is that we don't generate a runtime check even though it is
required to vectorize.
2025-12-09 20:06:38 +00:00
Andrew Haberlandt
dc92bd03c9
[sanitizer_common] [Darwin] Replace pty with pipe on posix_spawn path for spawning symbolizer (#170809)
Due to a legacy incompatibility with `atos`, we were allocating a pty
whenever we spawned the symbolizer. This is no longer necessary and we
can use a regular ol' pipe.

This PR is split into two commits:
- The first removes the pty allocation and replaces it with a pipe. This
relocates the `CreateTwoHighNumberedPipes` call to be common to the
`posix_spawn` and `StartSubprocess` path.
- The second commit adds the `child_stdin_fd_` field to
`SymbolizerProcess`, storing the read end of the stdin pipe. By holding
on to this fd for the lifetime of the symbolizer, we are able to avoid
getting SIGPIPE (which would occur when we write to a pipe whose
read-end had been closed due to the death of the symbolizer). This will
be very close to solving #120915, but this PR is intentionally not
touching the non-posix_spawn path.

rdar://165894284
2025-12-09 12:05:43 -08:00
LLVM GN Syncbot
4bff9fdb90 [gn build] Port 24117f75ad9d 2025-12-09 19:50:45 +00:00
Erick Velez
24117f75ad
[clang-doc] Replace HTML generation with Mustache backend (#170199)
Removes the legacy HTML backend and replaces it with the Mustache
backend.
2025-12-09 11:50:20 -08:00
Anshil Gandhi
5052b6ce1d
[AMDGPU] Scavenge a VGPR to eliminate a frame index (#166979)
If the subtarget supports flat scratch SVS mode and there is no SGPR
available to replace a frame index, convert a scratch instruction in SS
form into SV form and replace the frame index with a scavenged VGPR.
Resolves #155902

Co-authored-by: Matt Arsenault <matthew.arsenault@amd.com>
2025-12-09 13:59:36 -05:00
Folkert de Vries
03160c186e
[X86] fix typo: MCVTTP2SIS -> MCVTTP2UIS (#171229)
This LLVM IR

https://godbolt.org/z/5bM1vrMY1

```llvm
define <4 x i32> @masked(<2 x double> %a, <4 x i32> %src, i8 noundef zeroext %mask) unnamed_addr #0 {
  %r = tail call <4 x i32> @llvm.x86.avx10.mask.vcvttpd2udqs.128(<2 x double> %a, <4 x i32> %src, i8 noundef %mask)
  ret <4 x i32> %r
}

define <4 x i32> @unmasked(<2 x double> %a) unnamed_addr #0 {
  %r = tail call <4 x i32> @llvm.x86.avx10.mask.vcvttpd2udqs.128(<2 x double> %a, <4 x i32> zeroinitializer, i8 noundef -1)
  ret <4 x i32> %r
}

declare <4 x i32> @llvm.x86.avx10.mask.vcvttpd2udqs.128(<2 x double>, <4 x i32>, i8) unnamed_addr

attributes #0 = { mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" "target-features"="+avx10.2-512" }
```

produces 

```asm
masked:                                 # @masked
        kmovd   k1, edi
        vcvttpd2dqs     xmm1 {k1}, xmm0
        vmovaps xmm0, xmm1
        ret
unmasked:                               # @unmasked
        vcvttpd2udqs    xmm0, xmm0
        ret
```

So, when a mask is used, somehow the signed version of this instruction
is selected. I suspect this is a typo.
2025-12-09 18:52:17 +00:00
nerix
719826d33d
[LLDB] Run MSVC STL optional test with PDB (#171486)
Similar to the other PRs, this runs the `std::optional` test with PDB.
Since we don't know that variables use typedefs, we check for the full
name when testing PDB.
2025-12-09 19:52:02 +01:00
Krzysztof Parzyszek
cc25ac424a
[flang][OpenMP] Use DirId() instead of DirName().v, NFC (#171484) 2025-12-09 12:45:45 -06:00
Jacques Pienaar
93d2ef1057
[mlir][bytecode] Add support for deferred attribute/type parsing. (#170993)
Add ability to defer parsing and re-enqueueing oneself. This enables
changing CallSiteLoc parsing to not recurse as deeply: previously this
could fail (especially on large inputs in debug mode the recursion could
overflow). Add a default depth cutoff, this could be a parameter later
if needed.
2025-12-09 18:20:54 +00:00
Simon Pilgrim
00bccfca7c
[X86] bitcnt-big-integer.ll - add additional test coverage where the source values are bitcast from vectors (#171481) 2025-12-09 18:16:03 +00:00
Mehdi Amini
d796d73631 [MLIR] Apply clang-tidy fixes for readability-identifier-naming in Inliner.cpp (NFC) 2025-12-09 10:15:02 -08:00
nerix
cd805a7373
[LLDB] Run MSVC STL (forward-)list test with PDB (#166953)
Since PDB doesn't have template information, we need to get the element
type from somewhere else. I'm using the type of `_Myval` in a list node,
which holds the element type.
2025-12-09 19:09:33 +01:00
Anatoly Trosinenko
c0eac77f3c
[ADT] BitVector: give subsetOf(RHS) name to !test(RHS) (NFC) (#170875)
Define `LHS.subsetOf(RHS)` as a more descriptive name for `!LHS.test(RHS)`
and update the existing callers to use that name.

Co-authored-by: Jakub Kuderski <jakub@nod-labs.com>
2025-12-09 21:00:27 +03:00
LLVM GN Syncbot
0a39d1ff9e [gn build] Port 1bada0af22d8 2025-12-09 17:31:58 +00:00
Tomohiro Kashiwada
1dacdbe666
[Clang] Export inline move constructors in dllexport-ed template instantiations on non-MSVC targets (#168170)
Previously, even when MSVC compatibility was not requested, inline move
constructors in dllexport-ed templates were not exported, which was
seemingly unintended.
On non-MSVC targets (MinGW, Cygwin, and PS), such move constructors
should be exported consistently with copy constructors and with the
behavior of modern MSVC.
2025-12-09 17:29:23 +00:00
David Spickett
0aa8b82923 [lldb][docs] Fix plaintext markers in command map
Single backticks RST tries to resolve to a reference.
Double means plaintext.

Fixes these warnings:
map.rst:803: WARNING: 'any' reference target not found: target.prefer-dynamic-value
map.rst:814: WARNING: 'any' reference target not found: expr
2025-12-09 17:28:29 +00:00
David Spickett
ab8208f4f1 [lldb][docs] Fix Visual Studio link in build doc
Fixes warning:
build.rst:107: WARNING: 'any' reference target not found: https://visualstudio.microsoft.com
2025-12-09 17:25:55 +00:00
cs25resch11005-bhuvan
fa607658a2
[CIR][CIRGen][Builtin][X86] Masked compress Intrinsics (#169582)
Added masked compress builtin in CIR.
Note: This is my first PR to llvm. Looking forward to corrections

---------

Co-authored-by: bhuvan1527 <balabhuvanvarma@gmail.com>
2025-12-09 17:17:17 +00:00
Rana Pratap Reddy
04a5ee6065
[AMDGPU] Modifies builtin def to take _Float16('x') for both HIP/C++ and for OpenCL (#167652)
For extended imges insts amdgcn_image_sample_*_/gather4_* builtins,
using 'x' in the builtin def so that it will take _Float16 for both
HIP/C++ and OpenCL.
2025-12-09 22:46:33 +05:30
Alex Voicu
ef47462ce9
[SPIRV] Start adding support for int128 (#170798)
LLVM has pretty thorough support for `int128`, and it has started seeing
some use. Even thouth we already have support for the
`SPV_ALTERA_arbitrary_precision_integers` extension, the BE was oddly
capping integer width to 64-bits. This patch adds partial support for
lowering 128-bit integers to `OpTypeInt 128`. Some work remains to be
done around legalisation support and validating constant uses (e.g.
cases that get lowered to `OpSpecConstantOp`).
2025-12-09 17:11:28 +00:00
BaiXilin
4f79552d25
[x86][AVX-VNNI] Fix VPDPWXXD Argument Types (#169456)
Fixed the argument types of the following intrinsics to match with the
ISA:
 - vpdpwssd_128, vpdpwssd_256, vpdpwssd_512,
 - vpdpwssds_128, vpdpwssds_256, vpdpwssds_512
 - vpdpwsud_128, vpdpwsud_256, vpdowsud_512
 - vpdpwsuds_128, vpdpwsuds_256, vpdpwsuds_512
 - vpdpwusd_128, vpdpwusd_256, vpdpwusd_512
 - vpdpwusds_128, vpdpwusds_256, vpdpwusds_512
 - vpdpwuud_128, vpdpwuud_256, vpdpwuud_512
 - vpdpwuuds_128, vpdpwuuds_256, vpdpwuuds_512

Fixes #97271. Note that this is the last PR for the issue.
2025-12-09 17:10:20 +00:00
Rajat Bajpai
1bada0af22
[NVPTX] Add IR pass for FMA transformation in the llc pipeline (#154735)
This change introduces a new IR pass in the llc pipeline for NVPTX that
transforms sequences of FMUL followed by FADD or FSUB into a single FMA
instruction.

Currently, all FMA folding for NVPTX occurs at the DAGCombine stage,
which is too late for any IR-level passes that might want to optimize or
analyze FMAs. By moving this transformation earlier into the IR phase,
we enable more opportunities for FMA folding, including across basic
blocks.

Additionally, this new pass relies on the contract instruction level
fast-math flag to perform these transformations, rather than depending
on the -fp-contract=fast or -enable-unsafe-fp-math options passed to
llc.
2025-12-09 22:39:11 +05:30
nerix
9b12f8fcae
[LLDB] Run MSVC STL smart pointer tests with PDB (#166946)
Runs the `std::shared/unique_ptr` tests with PDB with two changes:

- PDB uses the "full" name, so `std::string` is `std::basic_string<char,
std::char_traits<char>, std::allocator<char>>`
- The type of the pointer inside the shared/unique_ptr isn't the
`element_type` typedef
2025-12-09 18:06:26 +01:00
Andy Kaylor
e6145e8709
[CIR][NFC] Add stubs for missing visitors in ScalarExprEmitter (#171222)
This adds stubs that issue NYI errors for any visitor that is present in
the ClangIR incubator but missing in the upstream implementation. This
will make it easier to find to correct locations to implement missing
functionality.
2025-12-09 09:01:16 -08:00
Andy Kaylor
b3b033bf73
[CIR][NFC] Fix bad switch fallthroughs in emitStmt (#171224)
This moves a couple of statement emitters that were incorrectly
implemented in the middle of a switch statement where all cases in the
final group are intended to fall through to a handler that emits an NYI
error message. The placement of these implementations was causing some
statement types that should have emitted the NYI error to instead go to
a handler for a different statement type.
2025-12-09 09:00:57 -08:00
Craig Topper
632cbee244
[RISCV] Use VM and VMNoV0 for "vr" and "vd" inline asm constraints with mask type. (#171235)
The inline assembly handling in SelectionDAG uses the first type
for the register class as the type at the input/output of the
inlineassembly. If this isn't the type for the surrounding DAG,
it needs to be converted.

nxv8i8 is the first type for the VR and VRNoV0 register classes.
So we currently generate insert/extract_subvector and bitcasts to
convert to/from nxv8i8.

I believe some of the special casing we have for this in
splitValueIntoRegisterParts and joinRegisterPartsIntoValue is causing
us to also generate incorrect code for arguments with nxv16i4 types
that should be any extended to nxv16i8. Instead we widen them to nxv32i4
and bitcast to nxv16i8.
    
This patch uses VM and VMNoV0 for masks which has nxv64i1 as their
first type. This means we will only emit an insert/extract_subvector
without any bitcasts. This will allow me to fix
splitValueIntoRegisterParts and joinRegisterPartsIntoValue to fix the
nxv16i4 argument issue without breaking inline assembly.
    
I may need to add more register classes to cover fractional LMULs,
but I'm not sure yet.
2025-12-09 08:52:55 -08:00
Craig Topper
2e16f24957
[RISCV] Add VMNoV0 register class with only the VMaskVTs. (#171231)
I plan to use this for inline assembly "vd" contraints with mask types
in a follow up patch. Due to the test changes I wanted to post this
separately.
2025-12-09 08:51:43 -08:00
Jonas Devlieghere
0c0ed398ec
[lldb] Don't read firstSubclass and nextSiblingClass from class_rw_t (#171213)
We're considering modifying the ObjC runtime's class_rw_t structure to
remove the firstSubclass and nextSiblingClass fields in some cases. LLDB
is currently reading those but not actually using them. Stop doing that
to avoid issues if they are removed by the runtime.

rdar://166084122
2025-12-09 08:50:37 -08:00
Jianhui Li
5236af88e5
[MLIR][XeGPU] Extend propagation and sg_to_lane distribution pass support broadcast with low rank and scalar source input (#170409)
This PR extends XeGPU layout propagation and distribution for
vector.broadcast operation.
It relaxes the restriction of layout propagation to allow low-rank and
scalar source input, and adds a pattern in sg-to-wi distribution to
support the lowering.
2025-12-09 08:48:27 -08:00
Men-cotton
94ebcfd16d
[mlir][vector] Fix crash in ReorderCastOpsOnBroadcast with non-vector result (#170985)
Fixes a crash in `ReorderCastOpsOnBroadcast` by ensuring the cast result
is a `VectorType` before applying the pattern.
A regression test has been added to
mlir/test/Dialect/Vector/vector-sink.mlir.

Fixes: #126371
2025-12-09 16:38:02 +00:00
Aiden Grossman
a033183606
[compiler-rt] Try bumping soft_rss_limit again (#171469)
This is still failing on some of the bots. Try bumping the limit again
to see if this fixes things.
2025-12-09 16:37:48 +00:00
David Spickett
76cffd310a
[CI] Tweak wording for builds with passing tests and build errors (#171436)
"All tests passed" is too easily interpreted as every possible test was
run and was fine. A lot of the time it means all the tests that didn't
fail to build ran and were fine.

Maybe the wording is still too subtle but at least it hints to the idea
that the tests run might be fewer than if the build had no compilation
errors.
2025-12-09 16:33:29 +00:00
Florian Hahn
c61a481a23
[VPlan] Use SCEV to prove non-aliasing for stores at different offsets. (#170347)
Extend the logic add in https://github.com/llvm/llvm-project/pull/168771
to also allow sinking stores past stores in the same noalias set by
checking if we can prove no-alias via the distance between accesses,
checked via SCEV.

PR: https://github.com/llvm/llvm-project/pull/170347
2025-12-09 16:19:13 +00:00
Alexandros Lamprineas
1a66474ca0
[clang][FMV][AArch64] Remove O3 from failing test (#171457)
This fixes the buildbot failures from
https://github.com/llvm/llvm-project/pull/150267.

I could not reproduce them locally but my intuition suggests that the
-O3 option on the RUN line behaves incosistently on different hosts
judging from the error logs.

My intention was to run an integration test which will use llvm's
globalopt pass, but there's no need actually. We have unittests in place
for it.
2025-12-09 16:15:07 +00:00