533833 Commits

Author SHA1 Message Date
Valentin Clement (バレンタイン クレメン)
fed0f58547
[flang][cuda] Avoid triggering host array error in host device proc (#134909)
we cannot enforce the detection of host arrays in device code when the
procedure is host, device. Relax the check for those.
2025-04-08 12:55:12 -07:00
Valentin Clement (バレンタイン クレメン)
c4b343aeeb
[flang][cuda] Implicitly load cudadevice in host,device and grid_global procedures (#134905) 2025-04-08 12:54:48 -07:00
Florian Hahn
6f92339d9e
[LV] Compute register usage for interleaving on VPlan. (#126437)
Add a version of calculateRegisterUsage that works estimates register
usage for a VPlan. This mostly just ports the existing code, with some
updates to figure out what recipes will generate vectors vs scalars.

There are number of changes in the computed register usages, but they
should be more accurate w.r.t. to the generated vector code.

There are the following changes:

 * Scalar usage increases in most cases by 1, as we always create a
   scalar canonical IV, which is alive across the loop and is not
   considered by the legacy implementation

 * Output is ordered by insertion, now scalar registers are added first
   due the canonical IV phi.

 * Using the VPlan, we now also more precisely know if an induction will
   be vectorized or scalarized.

Depends on https://github.com/llvm/llvm-project/pull/126415

PR: https://github.com/llvm/llvm-project/pull/126437
2025-04-08 20:52:50 +01:00
Michael Jones
556fb4c9af
[libc] Disable sin/cospif16 on aarch64 (#134918)
The tests are failing and it's unclear why. Disabling for now until a
fix can be implemented. See
https://github.com/llvm/llvm-project/issues/134917 for details.
2025-04-08 12:42:44 -07:00
Adrian Prantl
96f95c9d89 [dsymutil] Avoid copying binary swiftmodules built from textual
.swiftinterface files into the dSYM bundle. These typically come only
from the SDK (since textual interfaces require library evolution) and
thus are a waste of space to copy into the bundle.

The information about this is being parsed out of the control block,
which means duplicating 5 constants from the Swift frontend. If a file
cannot be parsed, dsymutil errs on the side of copying the file
anyway.

rdar://138186524

Relanding with additional linker dependency and moving the test into
the right target subdirectory.
2025-04-08 12:37:27 -07:00
Philip Reames
4cb320eb81 [RISCV] Add coverage for shuffles which if widened could be zipeven/zipodd 2025-04-08 12:33:45 -07:00
Alexandre Ganea
661f90ad08 [SandboxIR] Fix warning when building on Windows with clang-cl. NFC.
This fixes:
```
[2295/3381] Building CXX object lib\Passes\CMakeFiles\LLVMPasses.dir\PassBuilder.cpp.obj
In file included from C:\git\llvm-project\llvm\lib\Passes\PassBuilder.cpp:368:
In file included from C:\git\llvm-project\llvm\include\llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.h:16:
C:\git\llvm-project\llvm\include\llvm/SandboxIR/Context.h(73,16): warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
   73 |   friend class Region;            // For LLVMCtx.
      |                ^
      |                ::llvm::
1 warning generated.
```
2025-04-08 14:42:31 -04:00
Alexandre Ganea
446e793d77 [SandboxIR] Fix warning when building on Windows with clang-cl. NFC.
This fixes:
```
[1230/3381] Building CXX object lib\Transforms\Vectorize\CMakeFiles\LLVMVectorize.dir\SandboxVectorizer\VecUtils.cpp.obj
In file included from C:\git\llvm-project\llvm\lib\Transforms\Vectorize\SandboxVectorizer\VecUtils.cpp:9:
In file included from C:\git\llvm-project\llvm\include\llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h:17:
C:\git\llvm-project\llvm\include\llvm/SandboxIR/Type.h(55,16): warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
   55 |   friend class CallBase;           // For LLVMTy.
      |                ^
      |                ::llvm::
C:\git\llvm-project\llvm\include\llvm/SandboxIR/Type.h(60,16): warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
   60 |   friend class CmpInst;            // For LLVMTy. TODO: Cleanup after
      |                ^
      |                ::llvm::
2 warnings generated.
```
2025-04-08 14:42:24 -04:00
Alexandre Ganea
550d148561 [SandboxIR] Fix warning when building on Windows with clang-cl. NFC.
This fixes several of these:
```
[1151/3381] Building CXX object lib\SandboxIR\CMakeFiles\LLVMSandboxIR.dir\Constant.cpp.obj
C:\git\llvm-project\llvm\lib\SandboxIR\Constant.cpp(331,52): warning: duplicate explicit instantiation of 'operator()' ignored as a Microsoft extension [-Wmicrosoft-template]
  331 |                   llvm::GlobalObject>::LLVMGVToGV::operator()(llvm::GlobalIFunc
      |                                                    ^
C:\git\llvm-project\llvm\include\llvm/SandboxIR/Constant.h(816,52): note: previous explicit instantiation is here
  816 |                   llvm::GlobalObject>::LLVMGVToGV::operator()(llvm::GlobalIFunc
      |                                                    ^
```
2025-04-08 14:40:28 -04:00
cmtice
c4c0ff6865
[LLDB] Fix warnings in DIL. (#134778)
This fixes 3 warnings from compiling the DILParser:

DILParser.h:53:12: warning: returning address of local temporary object
[-Wreturn-stack-address]

DILParser.h:119:8: warning: private field 'm_fragile_ivar' is not used
[-Wunused-private-field]

DILParser.h:120:8: warning: private field 'm_check_ptr_vs_member' is not
used [-Wunused-private-field]
2025-04-08 11:37:54 -07:00
Yijia Gu
836476660e [mlir][bazel] add missing deps for LLVMOpsTdFiles 2025-04-08 11:36:18 -07:00
Matthias Springer
234d30e36b
[mlir][LLVM] Delete LLVMFixedVectorType and LLVMScalableVectorType (#133286)
Since #125690, the MLIR vector type supports `!llvm.ptr` as an element
type. The only remaining element type for `LLVMFixedVectorType` is now
`LLVMPPCFP128Type`.

This commit turns `LLVMPPCFP128Type` into a proper FP type (by
implementing `FloatTypeInterface`), so that the MLIR vector type accepts
it as an element type. This makes `LLVMFixedVectorType` obsolete.
`LLVMScalableVectorType` is also obsolete. This commit deletes
`LLVMFixedVectorType` and `LLVMScalableVectorType`.

Note for LLVM integration: Use `VectorType` instead of
`LLVMFixedVectorType` and `LLVMScalableVectorType`.
2025-04-08 20:28:24 +02:00
Aaron Ballman
9ba1a3fcb5
Reject invalid integer constants in unevaluated preprocessor operands (#134884)
Clang was previously accepting invalid code like:
```
  #if 1 ? 1 : 999999999999999999999
  #endif
```
because the integer constant (which is too large to fit into any
standard or extended integer type) was in an unevaluated branch of the
conditional operator. Similar invalid code involving || or && was also
accepted and is now rejected.

Fixes #134658
2025-04-08 14:25:59 -04:00
Dmitry Vasilyev
7e70d708a3
[LLDB][NFC] Remove Debugger dependency in SystemLifetimeManager (#134383)
It reduces the memory usage in lldb-server.
2025-04-08 22:24:59 +04:00
Yijia Gu
3b84b1e163 [clang][bazel] fix typo 2025-04-08 11:13:07 -07:00
Matheus Izvekov
11fdea984d
[clang] NFC: remove trailing whitespaces from clang/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp 2025-04-08 15:10:33 -03:00
Yijia Gu
a557550fa4 [clang][bazel] add missing target 2025-04-08 11:06:52 -07:00
Jonas Devlieghere
e84a804085
[lldb] Make sure the process is stopped when computing the symbol context (#134757)
Make sure the process is stopped when computing the symbol context. Both
Adrian and Felipe reported a handful of crashes in GetSymbolContext
called from Statusline::Redraw on the default event thread.

Given that we're handling a StackFrameSP, it's not clear to me how that
could have gotten invalidated, but Jim points out that it doesn't make
sense to compute the symbol context for the frame when the process isn't
stopped.
2025-04-08 11:06:05 -07:00
Stephen Tozer
19ee7ffdac
[AggrInstCombine][DebugInfo] Propagate DILocation for inlined memchr (#134808)
When AggressiveInstCombine replaces a memchr with a switch instruction,
it currently drops the DILocation for that memchr. This patch changes
this, propagating the memchr DILocation to all the generated
instructions that replace it.

Found using https://github.com/llvm/llvm-project/pull/107279.
2025-04-08 18:54:35 +01:00
Peter Collingbourne
6010d5ba2b gn build: Port 2f1416bbcde8 more 2025-04-08 10:51:55 -07:00
Louis Dionne
4ab86edb56
[libc++] Fix misplaced _LIBCPP_POP_MACROS (#134874)
Fixes #134681
2025-04-08 13:44:03 -04:00
Mark de Wever
658f848fed
[NFC][libc++][test] Refactor new ftm generator tests. (#134490)
This uses the python unit test framework instead of just asserts. This
improves the diagnostics when a test fails.
2025-04-08 19:38:26 +02:00
Andy Kaylor
4928093a21
[CIR] Upstream support for address of and dereference (#134317)
This adds support for handling the address of and dereference unary
operations in ClangIR code generation. This also adds handling for
nullptr and proper initialization via the NullToPointer cast.
2025-04-08 10:32:03 -07:00
Min-Yih Hsu
9bfb4b8fb1
[MachineScheduler] Add more debug prints w.r.t hazards and pending SUnits (#134328)
While we already have some detailed debug messages on the candidate
selection process -- which selects a SUnit from the Available queue, we
didn't say much about why a SUnit was _not_ moved from Pending queue to
Available queue in the first place, which is just as important as why we
scheduled a node IMHO. Therefore, I added some debug prints for this
very purpose.

I decide to print these extra messages by default (instead of being
guarded by command line like `-misched-detail-resource-booking`) because
we have been printing some of the hazard remarks, so I thought we might
as well print these new messages -- which are mostly about hazard -- by
default.
2025-04-08 10:31:05 -07:00
Matthias Springer
b7b3758e88
[mlir][IR] Add VectorTypeElementInterface with !llvm.ptr (#133455)
This commit extends the MLIR vector type to support pointer-like types
such as `!llvm.ptr` and `!ptr.ptr`, as indicated by the newly added
`VectorTypeElementInterface`. This makes the LLVM dialect closer to LLVM
IR. LLVM IR already supports pointers as vector element type.

Only integers, floats, pointers and index are valid vector element types
for now. Additional vector element types may be added in the future
after further discussions. The interface is still evolving and may
eventually turn into one of the alternatives that were discussed on the
RFC.

This commit also disallows `!llvm.ptr` as an element type of
`!llvm.vec`. This type exists due to limitations of the MLIR vector
type.

RFC:
https://discourse.llvm.org/t/rfc-allow-pointers-as-element-type-of-vector/85360
2025-04-08 19:21:45 +02:00
Valentin Clement (バレンタイン クレメン)
5ebe22a35d
[flang][cuda] Add async id to allocators (#134724)
Add async id to allocators in preparation for stream allocation.
2025-04-08 10:16:59 -07:00
Fangrui Song
7117dea043
AsmPrinter: Remove ELF's special lowerRelativeReference for unnamed_addr function; use lowerDSOLocalEquivalent in more cases
https://reviews.llvm.org/D17938 introduced lowerRelativeReference to
give ConstantExpr sub (A-B) special semantics in ELF: when `A` is an
`unnamed_addr` function, create a PLT-generating relocation. This was
intended for C++ relative vtables, but C++ relative vtable ended up
using DSOLocalEquivalent (lowerDSOLocalEquivalent).

This special treatment of `unnamed_addr` seems unusual.
Let's remove it. Only COFF needs an overload to generate a @IMGREL32
relocation specifier (llvm/test/MC/COFF/cross-section-relative.ll).

Pull Request: https://github.com/llvm/llvm-project/pull/134781
2025-04-08 10:11:20 -07:00
Mark de Wever
6d2b767678
[NFC][libc++] Removes Clang 16 work-arounds. (#91636)
This was noticed while reviewing the implementation status of
  P1614R2 The Mothership has Landed

Drive-by: Add some missing _LIBCPP_HIDE_FROM_ABIs.
2025-04-08 19:10:11 +02:00
Erich Keane
231aa3070d
[OpenACC][CIR] Basic infrastructure for OpenACC lowering (#134717)
This is the first of a few patches that will do infrastructure work to
enable the OpenACC lowering via the OpenACC dialect.

At the moment this just gets the various function calls that will end up
generating OpenACC, plus some tests to validate that we're doing the
diagnostics in OpenACC specific locations.

Additionally, this adds Stmt and Decl files for CIRGen.
2025-04-08 10:06:28 -07:00
Alexey Bataev
edcbd4a211
[SLP][NFC]Extract a check for strided loads into separate function, NFC
Reviewers: hiraditya, RKSimon

Reviewed By: RKSimon

Pull Request: https://github.com/llvm/llvm-project/pull/134876
2025-04-08 13:02:31 -04:00
Alexey Bataev
02a708b93b
[SLP][NFC]Extract TryToFindDuplicates lambda into a separate function, NFC
Reviewers: RKSimon, hiraditya

Reviewed By: hiraditya, RKSimon

Pull Request: https://github.com/llvm/llvm-project/pull/134873
2025-04-08 13:01:54 -04:00
Morris Hafner
441f87968d
[CIR] Upstream CmpOp (#133159)
This patch adds support for comparison operators with ClangIR, both
integral and floating point.

---------

Co-authored-by: Morris Hafner <mhafner@nvidia.com>
Co-authored-by: Henrich Lauko <xlauko@mail.muni.cz>
Co-authored-by: Andy Kaylor <akaylor@nvidia.com>
2025-04-08 09:53:54 -07:00
k-kashapov
271399831b
[MSan] Change overflow_size_tls type to IntPtrTy (#117689)
As discussed in
https://github.com/llvm/llvm-project/pull/109284#discussion_r1838819987:
Changed `__msan_va_arg_overflow_size_tls` type from `Int64Ty` to
`IntPtrTy`.
2025-04-08 09:51:13 -07:00
Adrian Prantl
2721d50d87 Revert "[dsymutil] Avoid copying binary swiftmodules built from textual"
This reverts commit 39ace8a63012af7d6ad7bf065c233fd3d5df44a3.

while investigating Linux bot failures.
2025-04-08 09:49:36 -07:00
Jacob Lalonde
f869d6efee
[LLDB][Minidump]Update MinidumpFileBuilder to read and write in chunks (#129307)
I recently received an internal error report that LLDB was OOM'ing when
creating a Minidump. In my 64b refactor we made a decision to acquire
buffers the size of the largest memory region so we could read all of
the contents in one call. This made error handling very simple (and
simpler coding for me!) but had the trade off of large allocations if
huge pages were enabled.

This patch is one I've had on the back burner for awhile, but we can
read and write the Minidump memory sections in discrete chunks which we
already do for writing to disk.

I had to refactor the error handling a bit, but it remains the same. We
make a best effort attempt to read as much of the memory region as
possible, but fail immediately if we receive an error writing to disk. I
did not add new tests for this because our existing test suite is quite
good, but I did manually verify a few Minidumps couldn't read beyond the
red_zone.

```
(lldb) reg read $sp
     rsp = 0x00007fffffffc3b0
(lldb) p/x 0x00007fffffffc3b0 - 128
(long) 0x00007fffffffc330
(lldb) memory read 0x00007fffffffc330
0x7fffffffc330: 60 c3 ff ff ff 7f 00 00 60 cd ff ff ff 7f 00 00  `.......`.......
0x7fffffffc340: 60 c3 ff ff ff 7f 00 00 65 e6 26 00 00 00 00 00  `.......e.&.....
(lldb) memory read 0x00007fffffffc329
error: could not parse memory info (Success!)
```

I'm not sure how to quantify the memory improvement other than we would
allocate the largest size regardless of the size. So a 2gb unreadable
region would cause a 2gb allocation even if we were reading 4096 kb. Now
we will take the range size or the max chunk size of 128 mb.
2025-04-08 09:47:52 -07:00
Stephen Tozer
e3d114ceb8
[DebugInfo][Reassociate] Propagate source loc when negating mul factor (#134679)
As part of RemoveFactorFromExpression, we attempt to remove a factor
from a mul/fmul expression; this may involve generating new
instructions, e.g. to negate the result if the factor was negative in
the original expression. When this happens, the new instructions should
have a DebugLoc set from the instruction that the factored expression is
being used to compute.

Found using https://github.com/llvm/llvm-project/pull/107279.
2025-04-08 17:45:54 +01:00
Simon Pilgrim
46d4c3b1f6
[X86] combineX86ShuffleChain - always prefer VPERMQ/PD for unary subvector shuffles on AVX2+ targets (#134849)
When combining 2 x 128-bit subvectors, don't assume that if the node is
already a X86ISD::VPERM2X128 node then there's nothing to do.

Fix issue where if we'd somehow combined to X86ISD::VPERM2X128
(typically if the 2 operands had then simplified to a common operand),
we can't canonicalise back to X86ISD::VPERMI on AVX2+ targets.

This matches the v4f64/v4i64 shuffle lowering preference for VPERMQ/PD
over VPERM2F128/I128.
2025-04-08 17:30:35 +01:00
Dmitry Chestnykh
d6c8e8908d
Rename F_no_mmap to F_mmap (#134787)
The `F_no_mmap` flag was introduced by
6814232429
2025-04-08 19:22:03 +03:00
Thurston Dang
df0ccf6df0 [asan] Disable TestCases/Linux/asan_rt_confict_test-2.cpp to fix build
TestCases/Linux/asan_rt_confict_test-2.cpp started failing in https://lab.llvm.org/buildbot/#/builders/66/builds/12265/steps/9/logs/stdio
The only change is "[LLD][ELF] Allow merging XO and RX sections, and add --[no-]xosegment flag (#132412)" (2c1bdd4a08). Based on the test case (which deliberately tries to mix static and dynamically linked ASan), I suspect it's actually the test case that needs to be fixed (probably with a different error message check).

This patch disables TestCases/Linux/asan_rt_confict_test-2.cpp to make the buildbots green while I investigate.
2025-04-08 16:16:22 +00:00
Nikolas Klauser
16d10546d2
[libc++] Remove _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS (#111964)
This macro isn't required if we define all the functions inline. In
fact, quite a few of the marked functions have already been inlined.

This patch basically only moves code around and adds
`_LIBCPP_HIDE_FROM_ABI` to the places where it's been missing so far.

This also removes inlining hints, since it dropps `inline` in some
places, but that shouldn't make much of a difference. The functions tend
to be either really small, so should be inlined anyways, or are big
enough that they shouldn't be inlined even with an inlinehint.
2025-04-08 18:16:18 +02:00
Matt Arsenault
3f38cd07d8 Revert "Inline: Propagate callsite nofpclass attribute"
This reverts commit b0cb672b9968eeee6eb022e98476957dbdf8e6e2.

Breaks bot
2025-04-08 23:15:00 +07:00
Fangrui Song
26475f5bdd
[AArch64] Refactor @plt, @gotpcrel, and @AUTH to use parseDataExpr
Following PR #132569 (RISC-V), which added `parseDataExpr` for parsing
expressions in data directives (e.g., `.word`), this PR migrates AArch64
`@plt`, `@gotpcrel`, and `@AUTH` from the `parsePrimaryExpr` workaround
to `parseDataExpr`. The goal is to align with the GNU assembler model,
where relocation specifiers apply to the entire operand rather than
individual terms, reducing complexity-especially evident in `@AUTH`
parsing.

Note: AArch64 ELF lacks an official syntax for data directives
(#132570). A prefix notation might be a preferable future direction.
I recommend `%specifier(expr)`.

AsmParser's `@specifier` parsing is suboptimal, necessitating lexer
workarounds. `@` might appear multiple times in an operand.
We should not use `@` beyond the existing AArch64 Mach-O instruction
operands.

In the test elf-reloc-ptrauth.s, many errors are now reported at parse
time.

Pull Request: https://github.com/llvm/llvm-project/pull/134202
2025-04-08 09:09:19 -07:00
Nico Weber
bb7ff134dc [gn] port 6c74fe9087 2025-04-08 12:03:45 -04:00
Stephen Tozer
84fde791a1
[Reassociate] Apply Debugloc to instrs produced when optimizing add (#134676)
Currently in Reassociate we may create a set of new instructions when
optimizing an `add`, but we do not set DebugLocs on the new
instructions; this patch propagates the add's DebugLoc to the new
instructions.

Found using #107279.
2025-04-08 17:02:16 +01:00
Krzysztof Drewniak
4a7b34d03c
Revert "[AMDGPU] Add buffer.fat.ptr.load.lds intrinsic wrapping raw rsrc version (#133015)" (#134871)
This reverts commit d1a05721172272f7aab685b56d99e86814a15bff.

There was further discussion on the PR about whether the intinsics
should exist in this form.
2025-04-08 11:00:41 -05:00
Nuno Lopes
b416e7f592 [CI] adjust the undef warning regex so it doesn't catch %undef in .ll files 2025-04-08 16:56:38 +01:00
Matt Arsenault
b0cb672b99
Inline: Propagate callsite nofpclass attribute
(#134800)

Fixes #134070
2025-04-08 22:53:17 +07:00
Congcong Cai
bd49d278c6
[clang-tidy][NFC] update test name and config for bugprone-unintended-char-ostream-output (#134868) 2025-04-08 23:46:13 +08:00
tdanyluk
76d2e0881e
[mlir] fix references of attributes which are not defined earlier (#134364)
If an attribute is not defined earlier in the same file, but just
referenced from its dialect directly, then currently not the correct
check is being emited.

What would it emit for #toy.shape<[1, 2, 3]>:
Earlier:
// CHECK: #[['?']]<[1, 2, 3]>
Now:
// CHECK: #toy.shape<[1, 2, 3]>
2025-04-08 17:34:20 +02:00
Christian Sigg
4e9cfcf6af [llvm][bazel] Fix BUILD after 561506144531cf0a760bb437fd74c683931c60ae. 2025-04-08 17:28:20 +02:00