531706 Commits

Author SHA1 Message Date
Joseph Huber
038cdd236f
[flang-rt] Add support for using LLVM in-tree libc/libc++ (#131695)
Summary:
This patch adds an interface that uses an in-tree build of LLVM's libc
and libc++.

This is done using the `-DFLANG_RT_LIBC_PROVIDER=llvm` and
`-DFLANG_RT_LIBCXX_PROVIDER=llvm` options. Using `libc` works in terms
of CMake, but the LLVM libc is not yet complete enough to compile all
the files.
2025-03-24 06:05:24 -05:00
Simon Pilgrim
df086650e1 [X86] combineX86ShufflesRecursively - pull out getTargetLoweringInfo call. NFC. 2025-03-24 10:52:52 +00:00
Zichen Lu
4398a222ad
[mlir][target] Adjust the start and end position of the moduleToObject timer (#132693)
We hope that the timer can be cleared normally when the target-format is
`offload`, so as to avoid output like this:
```
===-------------------------------------------------------------------------===
Miscellaneous Ungrouped Timers
===-------------------------------------------------------------------------===

---Wall Time--- --- Name ---
----- Timer for perf llvm-ir -> isa and isa -> binary.
...
```

Co-authored-by: Guray Ozen <guray.ozen@gmail.com>
2025-03-24 11:35:14 +01:00
Csanád Hajdú
e2e776c867
[AArch64] Always add PURECODE flag to empty .text if "+execute-only" is set (#132196)
Previously, the `SHF_AARCH64_PURECODE` section flag wasn't added to the
implicitly created `.text` section if the module didn't contain any
functions, because no other section had the flag set.

Now, the `SHF_AARCH64_PURECODE` is always added if the "+execute-only"
target feature is set for the module during compilation.
2025-03-24 11:19:26 +01:00
Fraser Cormack
7d048674a4
[libclc] Add license headers to files missing them (#132239)
This commit bulk updates all '.h', '.cl', '.inc', and '.cpp' files to
add any missing license headers.

The remaining files are generally CMake, SOURCES, scripts, markdown,
etc.

There are still some '.ll' files which may benefit from a license
header. I can't find an example of an LLVM IR file with a license header
in the rest of LLVM, but unlike most other (sub)projects, libclc has
examples of LLVM IR as source files, compiled and built into the
library.
2025-03-24 10:10:38 +00:00
Wenju He
735d7c1539
[libclc] link_bc target should depends on target builtins.link.clc-arch_suffix (#132338)
Currently link_bc command depends on the bitcode file that is associated
with custom target builtins.link.clc-arch_suffix.
On windows we randomly see following error:
`
  Generating builtins.link.clc-${ARCH}--.bc
  Generating builtins.link.libspirv-${ARCH}.bc
error : The requested operation cannot be performed on a file with a
user-mapped section open.
`
I suspect that builtins.link.clc-${ARCH}--.bc file is being generated
while it is being used in link_bc.
This PR adds target-level dependency to ensure
builtins.link.clc-${ARCH}--.bc is generated first.
2025-03-24 10:09:19 +00:00
Florian Ragwitz
cc5f8293b3
[clang][scan-build] Treat --use-cc and --use-c++ as shell commands (#131932)
So that things like --use-cc="ccache gcc" work.

Fixes #26594.

Also use the slightly simpler shellwords instead of quotewords.
2025-03-24 11:09:03 +01:00
bubblepipe
27d9a3a39e
[NFC][X86] Correct Zen4 Scheduling (Part 1/2: Rename "19h" to "Zen4") (#131615)
This PR is a non-functional extraction from the original PR
[#128030](https://github.com/llvm/llvm-project/pull/128030).

Renames all instances of "19h" to "Zen4" within Zen'4 scheduling file.

Part 2/2: [[X86] Correct Zen4 Scheduling (Part 2/2: Functional
Changes)](https://github.com/llvm/llvm-project/pull/131616)

---------

Co-authored-by: bubblepipe <nag1sakaw0ru@riseup.net>
2025-03-24 09:59:22 +00:00
Igor Wodiany
ef9c4f4f5c
[mlir][spirv] Update assembly format for Image operand types (#130758)
In the example below it is not clear that `(f32)` relates to `%arg2` and
not to `vector<2xf32>`:

```mlir
%0 = spirv.ImageSampleImplicitLod %arg0, %arg1 ["Lod"](%arg2) :
  !spirv.sampled_image<...>, vector<2xf32>(f32) -> vector<4xf32>
```

This change applies new format to image operations and image operands
that does not use parenthesis and is less ambiguous:

```mlir
%0 = spirv.ImageSampleImplicitLod %arg0, %arg1 ["Lod"], %arg2 :
  !spirv.sampled_image<...>, vector<2xf32>, f32 -> vector<4xf32>
```
2025-03-24 09:30:39 +00:00
Timm Baeder
849e5ea94f
[clang][bytecode] Add Descriptor::getDataType() (#132681)
This returns the type of data in the Block, which might be different
than the type of the expression or declaration we created the block for.
This lets us remove some special cases from CheckNewDeleteForms() and
CheckNewTypeMismatch().
2025-03-24 09:47:52 +01:00
Younan Zhang
38d71c9bdc
[Clang] Fix the assertion condition after b8d1f3d6 (#132669)
Thanks to the example provided by MagentaTreehouse, I realized the
assertion I added in b8d1f3d6 didn't cover all valid cases like, when
inheriting from a class template specialization, the source of a
synthesized template parameter might be an implicit specialization,
whose inner function template is thus living at depth 0, for which we
don’t want it to overflow too.

I've decided to remove that assertion because I don't think it's
particularly useful: we're checking whether Depth = 0 parameters come
from function templates whose parents contribute no template parameters
to the depth, which is redundant given what the template depth already
means.

This also incorporates a drive-by fix for
https://github.com/llvm/llvm-project/pull/132061#discussion_r2008756718,
which I somehow missed.
2025-03-24 16:46:48 +08:00
Georgiy Samoylov
ec9546d169
[lldb] Fix TestGdbRemoteForkNonStop.py test (#131293)
During lldb testing on remote targets TestGdbRemoteForkNonStop.py
freezes because in this test we try to create file on remote machine
using absolute file path from local machine. This patch fixes this error
2025-03-24 09:33:08 +01:00
Pierre van Houtryve
c457c88951
[GlobalISel] Combine (sext (trunc x)) to (sext_inreg x) (#131622)
Split from #131312
2025-03-24 09:32:04 +01:00
Pierre van Houtryve
6e3c24fc0a
[DAG] Combine (sext (sext_in_reg x)) to (sext_in_reg (any_extend x)) (#132386) 2025-03-24 09:31:02 +01:00
Antonio Frighetto
ade2276517 [RegAllocFast] Ensure live-in vregs get reloaded after INLINEASM_BR spills
We have already ensured in 9cec2b246e719533723562950e56c292fe5dd5ad
that `INLINEASM_BR` output operands get spilled onto the stack, both
in the fallthrough path and in the indirect targets. Since reloads of
live-ins values into physical registers contextually happen after all
MIR instructions (and ops) have been visited, make sure such loads are
placed at the start of the block, but after prologues or `INLINEASM_BR`
spills, as otherwise this may cause stale values to be read from the
stack.

Fixes: #74483, #110251.
2025-03-24 09:19:53 +01:00
Antonio Frighetto
376aa741b5 [RegAllocFast] Introduce test for PR131350 (NFC) 2025-03-24 09:19:53 +01:00
Javed Absar
41f9a00818
[NFC][mlir][bufferization] (#132637) 2025-03-24 07:50:27 +00:00
MingYan
b75dad090c
[RISCV] Support VP_SPLAT mask operations (#132345)
When val is a constant, it will:
(vp.splat val, mask, vl) -> (select val, (riscv_vmset_vl vl),
(riscv_vmclr_vl vl))
Otherwise:
(vp.splat val, mask, vl) -> (vmsne_vl (vmv_v_x_vl (zext val), vl),
splat(zero), mask, vl)

---------

Co-authored-by: yanming <ming.yan@terapines.com>
2025-03-24 15:26:58 +08:00
Kazu Hirata
76b999d70f
[clang-tidy] Avoid repeated map lookups (NFC) (#132656) 2025-03-24 00:13:21 -07:00
Kazu Hirata
432328e3f4 [LoongArch] Fix a warning
This patch fixes:

  llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp:561:7: error:
  unused variable 'ScalarSizeInBits' [-Werror,-Wunused-variable]
2025-03-24 00:10:55 -07:00
Thurston Dang
702c38ed7c [asan] Fix-forward #131975 by renaming 'TryReExecWithoutASLR'
Function definition added in #131975 was missing 'Try' (do or do not ...). My guess is buildbots
mostly didn't trip because usage was gated by 'if (sizeof(uptr) ==
32)', which is rare among buildbots.
2025-03-24 07:00:57 +00:00
Fangrui Song
7e6d008023 AsmPrinter: Remove unneeded lowerRelativeReference overrides
The function is only called by AsmPrinter, where there is a fallback
when lowerRelativeReference returns nullptr.

wasm and XCOFF could use the fallback code.

(lowerRelativeReference was introduced in 2016 (https://reviews.llvm.org/D17938)
for C++ relative vtables, but C++ relative vtables ended up using
dso_local_equivalent. llvm/test/MC/COFF/cross-section-relative.ll also
uses this.)
2025-03-23 23:58:41 -07:00
Nikolas Klauser
ddc62797c4
[libc++] Simplify the implementation of __is_referenceable (#130043)
The `__is_referenceable` builtin has been removed from Clang, since all
its uses have been replaced by builtins themselves. This trait only
exists for GCC compatibility and to word around some issues in the other
traits. The non-builtin implementation has been refactored to use
variable templates instead, making the implementation much simpler.
2025-03-24 07:32:01 +01:00
Nikolas Klauser
66531c998a
[libc++] Remove one of the std::signbit overloads (#130505)
We'e specialized `std::signbit` for signed and unsigned integral types
seperately, even though the optimizer can trivially figure out that
`unsigned_value < 0` always false is. This patch removes the
specialization, since there is really not much of a benefit to it.
2025-03-24 07:30:45 +01:00
tangaac
e3bd1f2b3f
[LoongArch] lower vector shuffle to zero or any extend (#129485) 2025-03-24 14:29:11 +08:00
Akshat Oke
174110bf3c
[CodeGen][NPM] Port LiveDebugValues to NPM (#131563) 2025-03-24 11:34:45 +05:30
Kazu Hirata
3c2731ce46
[AMDGPU] Avoid repeated hash lookups (NFC) (#132657) 2025-03-23 22:30:09 -07:00
Lang Hames
ef3e521a2b [ORC-RT] Add unique_function utility to the ORC runtime.
A bare-bones version of LLVM's unique_function: this behaves like a
std::unique_function, except that it supports move only callable types.

This will be used in upcoming improvements to the ORC runtime.
2025-03-24 15:46:43 +11:00
Kazu Hirata
1019457891
[CodeGen] Use *Set::insert_range (NFC) (#132651)
We can use *Set::insert_range to collapse:

  for (auto Elem : Range)
    Set.insert(E);

down to:

  Set.insert_range(Range);
2025-03-23 21:20:44 -07:00
Shoreshen
054e0b41a8
[AMDGPU] Add all type for bitcast on VReg_512 (#131775)
Add all types pattern for bitcast on VReg_512
2025-03-24 11:52:10 +08:00
Lang Hames
5d8e8e82e1 [ORC-RT] Rename extensible_rtti.{h,cpp} to rtti.{h,cpp}. NFCI.
The "extensible_" prefix on these files was inherited from LLVM, where it
distinguished the dynamic RTTI APIs from the LLVM's custom static RTTI APIs.

In the ORC runtime these files will be used to hold all of our RTTI APIs
(the current dynamic ones, and any static ones added in the future), so we
shouldn't use this prefix.
2025-03-24 13:49:23 +11:00
Lang Hames
36b1fb5c7a [ORC-RT] Fix typos in file comments. NFC. 2025-03-24 13:49:23 +11:00
A. Jiang
e409464e95
[libc++][test][NFC] Introduce TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED (#132593)
And use it for test cases that became constant-evaluation-suitable due
to P2562R1.

`TEST_STD_AT_LEAST_(20|23)_OR_RUNTIME_EVALUATED` are the precedents.
2025-03-24 10:43:19 +08:00
Kazu Hirata
73dc2afd2c
[Transforms] Use *Set::insert_range (NFC) (#132652)
We can use *Set::insert_range to collapse:

  for (auto Elem : Range)
    Set.insert(E);

down to:

  Set.insert_range(Range);

In some cases, we can further fold that into the set declaration.
2025-03-23 19:42:53 -07:00
tangaac
943a70717c
[LoongArch] Pre-commit test for vector sext, zext (#131742) 2025-03-24 10:35:18 +08:00
Kazu Hirata
0175dce138
[ADT] Add a range constructor to SmallSetVector (#132645)
DenseSet recently gained a range constructor:

  DenseSet<T> Dest(llvm::from_range, Src);

This patch adds the same signature to SmallSetVector for consistency.
2025-03-23 19:12:53 -07:00
Mingming Liu
3b20ac00f9
[NFC]Don't use else after a return (#132644)
A trivial code clean-up per
https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return
2025-03-23 18:34:52 -07:00
Austin
7a056895c5
[mlir] Fix typo of tests (NFC) (#132396) 2025-03-24 09:29:00 +08:00
Alan
b32cf75699
[LLVM-C][OCaml] Make LLVMMetadataKind consistent between C and OCaml (#132268)
- Move LLVMDISubrangeTypeMetadataKind to end of LLVMMetadataKind enum.
Inserting a new enum constant in the middle of the enum breaks the ABI for
that enum. Commit e298fc2 introduced this issue, which was revealed because
the OCaml binding tests failed.
- Bring OCaml bindings up to date with LLVMMetadataKind enum.
2025-03-23 21:20:56 -04:00
Craig Topper
9d92d4b01c
[RISCV] Add alias names for tdata1 and tdata3 CSRs. (#132525)
The RISC-V Debug Specification defines multiple names for these CSRs.
https://github.com/riscv/riscv-debug-spec/releases/tag/1.0
2025-03-23 16:59:28 -07:00
Kazu Hirata
41b76119ec
[llvm] Use range constructors for *Set (NFC) (#132636) 2025-03-23 15:50:34 -07:00
Fangrui Song
49ce038a1a
RISCVAsmParser: Replace "modifier" with "specifier" in diagnostics
Use the preferred "specifier" term for relocation specifier.

"Relocation modifier" suggests adjustments happen during the linker's
relocation step rather than the assembler's expression evaluation.
The term "relocation specifier" is preferred by Arm for :lower16: and
IBM AIX, and I am trying to standardize in MC.

Pull Request: https://github.com/llvm/llvm-project/pull/132565
2025-03-23 15:12:27 -07:00
Florian Hahn
06fd10f1da
[VPlan] Don't create ExtractElement recipes for scalar plans. (#131604)
ExtractElements are no-ops for scalar VPlans. Don't introduce them in 
handleUncountableEarlyExit if the plan has only a scalar VF.

This fixes a crash trying to compute the cost of ExtractElement after 26ecf978951b79.

PR: https://github.com/llvm/llvm-project/pull/131604
2025-03-23 22:00:02 +00:00
Kazu Hirata
549fc0c1f9
[ADT] Use SetVector::insert_range (NFC) (#132633) 2025-03-23 14:59:33 -07:00
Justin Fargnoli
ff25115ca0
[NVPTX] cleanup & canonicalize mov (#129344)
Use a `multiclass` to define `mov` and canonicalize the `mov`
instruction to always use the `b<bit-size>` suffix.
2025-03-23 14:53:00 -07:00
Martin Storsjö
ff3e2ba9eb Revert "[VPlan] Add transformation to narrow interleave groups. (#106441)"
This reverts commit dfa665f19c52d98b8d833a8e9073427ba5641b19.

This commit caused miscompilations in ffmpeg, see
https://github.com/llvm/llvm-project/pull/106441 for details.
2025-03-23 23:27:39 +02:00
David CARLIER
b2b3cb5f76
[compiler-rt][rtsan] memffd_create for linux interception. (#132571) 2025-03-23 20:37:48 +00:00
Nikolas Klauser
fb44f00641
[libc++] Add [[gnu::nodebug]] on type traits (#128502) 2025-03-23 21:01:25 +01:00
Fangrui Song
4781a8ebd0 MCValue: add setSpecifier to simplify code
This primarily simplifies backend evaluateAsRelocatableImpl.
2025-03-23 12:36:46 -07:00
Fangrui Song
dfae1f968e MCValue: Simplify code with getSubSym 2025-03-23 12:22:44 -07:00