535564 Commits

Author SHA1 Message Date
Karthika Devi C
5f704f929d
[RemoveDI][Polly] Migrate to adapt to the new DebugRecord format in more areas (#135935)
Some of the changes in the patch include:

1. Using iterators instead of instruction pointers when applicable.
2. Modifying Polly functions to accept iterators instead of inst
pointers.
3. Updating API usages such as use begin instead of front.
2025-04-28 13:51:10 +05:30
Piotr Fusik
2319a1eb81
[RISCV] Select (add x, C) -> (sub x, -C) if -C cheaper to materialize (#137309)
RV64 only. For 32-bit constants, a negated constant is never cheaper.

This change is similar to how #120221 selects inverted bitwise instructions.
2025-04-28 10:14:12 +02:00
Peng Sun
af329725d4
[mlir][tosa] Enhance verify checks for PAD Op (#137177)
* add padding shape verification
 * add and update LIT test

Signed-off-by: Peng Sun <peng.sun@arm.com>
2025-04-28 08:38:47 +01:00
lorenzo chelini
b55fa20d83
[MLIR][NFC] Retire let constructor for Async (#137461)
let constructor is legacy (do not use in tree!) since the tableGen
backend emits most of the glue logic to build a pass.

Note: The following constructor has been retired:

```cpp
std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch,
                                                 int32_t numWorkerThreads,
                                                 int32_t minTaskSize);
```

To update your codebase, replace it with the new options-based API:

```cpp
AsyncParallelForPassOptions options{/*asyncDispatch=*/, /*numWorkerThreads=*/, /*minTaskSize=*/};
createAsyncParallelForPass(options);
```
2025-04-28 09:31:31 +02:00
Michael Buch
e665d95426
[lldb] Highlight basenames in backtraces (#137301)
Also changes the PC value color so it doesn't visually clash with the
function names

Before:
<img width="1510" alt="Screenshot 2025-04-25 at 10 38 58 AM"
src="https://github.com/user-attachments/assets/1ec35ba3-a3d9-4e5b-bac9-fc738bfe6d25"
/>

After:
![Screenshot 2025-04-25 at 4 34
27 PM](https://github.com/user-attachments/assets/3de6e778-ff97-4f47-b361-360e4bbfaede)
2025-04-28 08:29:31 +01:00
Michael Buch
fcb1a481ce
[lldb][docs] Document new frame-format variables (#137522)
Documents https://github.com/llvm/llvm-project/pull/131836
2025-04-28 08:28:54 +01:00
Timm Baeder
60b3a5b7e7
[clang][bytecode] Fix two small builtin_constant_p cases (#137587)
Only accept string literals if we're pointing to the first index and do
accept complex literals.
2025-04-28 09:21:49 +02:00
David Green
59fbb9e775
[AArch64] Add tablegen patterns for i8 and i16 vector insert/extract pairs (#136091)
An i8 and i16 vector extract/insert has to go via a i32 to make sure the
types are legal. This patch adds patterns for extract from a i8/i16
vector, inserted into a i16/i32 vector. This avoids the round trip via a
GPR which can limit performance.
2025-04-28 08:17:45 +01:00
Nikita Popov
50aacb9e1b
[InstCombine] Support ptrtoint of gep folds for chain of geps (#137323)
Support the ptrtoint(gep null, x) -> x and ptrtoint(gep inttoptr(x), y)
-> x+y folds for the case where there is a chain of geps that ends in
null or inttoptr. This avoids some regressions from #137297.
    
While here, also be a bit more careful about edge cases like pointer to
vector splats and mismatched pointer and index size.
2025-04-28 09:02:29 +02:00
Andrew Savonichev
dae63e2c0f Reland [clang] Handle instantiated members to determine visibility (#136128) (#136689)
As reported in issue #103477, visibility of instantiated member
functions used to be ignored when calculating visibility of a
specialization.

This patch modifies `getLVForClassMember` to look up for a source
template for an instantiated member, and changes `mergeTemplateLV` to
apply it.

A similar issue was reported in #31462, but it seems that `extern`
declaration with visibility prevents the function from being emitted
as hidden. This behavior seems correct, even though GCC emits it as
with default visibility instead.

Both tests from #103477 and #31462 are added as LIT tests `test72` and
`test73` respectively.
2025-04-28 15:49:54 +09:00
Andrew Savonichev
f5ba3d0c6d [clang] Fix computeTypeLinkageInfo for dependent member pointers (#136689)
MemberPointerType may refer to a dependent class (qualifier), for
which getMostRecentCXXRecordDecl returns NULL. It seems that the
compiler never executed this code path before patch #136128 where the
issue was reported.

LIT tests 74 and 75 are reduced from Chromium and LLVM libc test
harness as reported in #136128.

Function member (test74):

    MemberPointerType 'type-parameter-0-0 (type-parameter-0-1::*)(void)' dependent
    |-TemplateTypeParmType 'type-parameter-0-1' dependent depth 0 index 1
    `-FunctionProtoType 'type-parameter-0-0 (void)' dependent cdecl
      `-TemplateTypeParmType 'type-parameter-0-0' dependent depth 0 index 0

Template parameter (test75):

    MemberPointerType 'type-parameter-0-1 type-parameter-0-0::*' dependent
    |-TemplateTypeParmType 'type-parameter-0-0' dependent depth 0 index 0
    `-TemplateTypeParmType 'type-parameter-0-1' dependent depth 0 index 1
2025-04-28 15:49:54 +09:00
Piotr Fusik
0cd3fd4c5c [RISCV][test] Add (add x, C) -> (sub x, -C) tests 2025-04-28 08:34:56 +02:00
Vlad Serebrennikov
c2d47a912f [clang][NFC] Convert Sema::PragmaOptionsAlignKind to scoped enum 2025-04-28 09:30:19 +03:00
tangaac
34845ac35a
[LoongArch] Try to widen shuffle mask (#136081) 2025-04-28 14:25:52 +08:00
Vlad Serebrennikov
ab680c55c7 Revert "[clang][NFC] Convert Sema::PragmaMsStackAction to scoped enum"
This reverts commit bd2a3f8d90368288a73dd2ef1926f714acd9eff3.
2025-04-28 09:24:25 +03:00
Vlad Serebrennikov
21444e37ab [clang][NFC] Convert Sema::PragmaMsStackAction to scoped enum 2025-04-28 09:21:17 +03:00
i-ky
6f6af49938
Clarify lit's definition of failure and conditions when it exits with exit code 1 (#136190)
Documentation of when `lit` exits with code 1 is out of date.

It is no longer just "FAIL or XPASS", there are more failure types:

b30100b87f/llvm/utils/lit/lit/Test.py (L51-L55)

Exit code can also be affected by `--ignore-fail` option:

b30100b87f/llvm/utils/lit/lit/main.py (L154-L162)

This PR extracts a clear definition of "failure" from the description of
`--report-failures-only` option:

b30100b87f/llvm/docs/CommandGuide/lit.rst (L194-L196)
...puts it into "Test Status Results" section and references it when
describing exit codes and `--ignore-fail` option.
2025-04-28 07:06:42 +01:00
Vlad Serebrennikov
4f96ce414b [clang][NFC] Convert Sema::PragmaClangSectionAction to scoped enum 2025-04-28 09:06:32 +03:00
Vlad Serebrennikov
b10296eff0 [clang][NFC] Convert Sema::PragmaClangSectionKind to scoped enum 2025-04-28 08:57:10 +03:00
Kazu Hirata
936e528465 [mlir] Fix a warning
This patch fixes:

  mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp:1304:3: error: default
  label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]
2025-04-27 22:51:38 -07:00
Vlad Serebrennikov
41112db5a5 [clang][NFC] Remove old commented out code
`CheckedConversionKind` was converted to a scoped enum quite a while ago.
2025-04-28 08:50:14 +03:00
Vlad Serebrennikov
ee29afe1e5 [clang][NFC] Convert LookupResultKind to scoped enum 2025-04-28 08:42:02 +03:00
Haohai Wen
3579fc003d
[COFF] Preserve UniqueID used to create MCSectionCOFF (#123869)
This UniqueID can be used later to create associative section.
e.g. A .pseudo_probe associated to the section of the corresponding
function.
2025-04-28 13:39:40 +08:00
Craig Topper
e17f07c4de
[SelectionDAG] Reduce code duplication between getStore, getTruncStore, and getIndexedStore. (#137435)
Create an extra overload of getStore that can handle of the 3 types of
stores. This is similar to how getLoad/getExtLoad/getIndexLoad is
structure.
2025-04-27 22:32:53 -07:00
Vlad Serebrennikov
f3a61f61ee [clang][NFC] Convert LookupResult::AmbiguityKind to scoped enum 2025-04-28 08:22:57 +03:00
Vlad Serebrennikov
98eeedd4a1 [clang][NFC] Convert NumLVComputationKindBits to a constant 2025-04-28 08:09:41 +03:00
Vlad Serebrennikov
a764358a9d [clang][NFC] Convert DeclUpdateKind to scoped enum 2025-04-28 08:05:46 +03:00
Sushant Gokhale
576be7b19f
[AArch64][SVE] Generate asrd instruction for positive pow-2 divisors … (#137151)
…when SVE is available

Currently,
```
sdiv(x, y)  --> cmlt + usra + sshr                , where y is positive pow-2 integer
sdiv(x, y)  --> cmlt + usra + sshr + neg     , where y is negative pow-2 integer
```

Patch aims to transform this into
```
sdiv(x, y)  --> ptrue + asrd                 , where y is positive pow-2 integer
sdiv(x, y)  --> ptrue + asrd + subr     ,  where y is negative pow-2 integer
```
2025-04-27 22:04:05 -07:00
Srinivasa Ravi
a28f65752d
[MLIR][NVVM] Add support for f6x2 conversion (#136537)
This patch adds the `cvt.to.fp6x2` NVVM dialect Op for conversions into
the f6x2 types, `e2m3x2` and `e3m2x2`.

For more information, see PTX ISA:
https://docs.nvidia.com/cuda/parallel-thread-execution/#data-movement-and-conversion-instructions-cvt
2025-04-28 10:31:46 +05:30
Kazu Hirata
268f0d4ebe
[ASTMatchers] Simplify isDefaultedHelper (NFC) (#137571)
We can use "constexpt if" to combine the two variants of functions.

---------

Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com>
2025-04-27 21:50:45 -07:00
Kazu Hirata
55651e743b
[clang] Use range constructors of *Set (NFC) (#137574) 2025-04-27 21:17:14 -07:00
Vlad Serebrennikov
096c20c0b1 [clang][NFC] Convert enums in TypeLocBuilder into constants 2025-04-28 06:57:16 +03:00
Vlad Serebrennikov
ed95624e20 [clang][NFC] Convert StmtDiscardKind to a scoped enum 2025-04-28 06:54:00 +03:00
halbi2
c21531895a
[clang] Fix and test triviality of __ptrauth types (#137474)
Address-discriminated __ptrauth types do not have unique object
representations so they are not trivially comparable. Test all other
trivialities too even though they are not incorrect.

Fixes #137473
2025-04-27 20:07:49 -07:00
Kazu Hirata
a129ca7f17
[Analysis] Remove has_arg_iterator_range (NFC) (#137568)
The last use was removed by:

  commit f8afb8fdedae04ad2670857c97925c439d47d862
  Author: Aaron Puchert <aaron.puchert@sap.com>
  Date:   Fri Apr 29 22:12:21 2022 +0200
2025-04-27 19:09:30 -07:00
Luke Lau
92c3af7c3e
[VPlan] Use correct constructor when cloning VPWidenIntrinsicRecipe without underlying CallInst (#137493)
I noticed this when working on a patch downstream, and I don't think
this is an issue upstream yet.

But if a VPWidenIntrinsicRecipe is created without an underlying
CallInst, e.g. in createEVLRecipe, it will crash if you try to clone it
because it assumes the CallInst always exists.

This fixes it by using the CallInst-less constructor in this case.
2025-04-28 10:08:45 +08:00
Luke Lau
185ba025da
[RISCV] Widen i1 AnyOf reductions (#134898)
With EVL tail folding an AnyOf reduction will end up emitting an i1
vp.merge.

Unfortunately due to RVV not containing any tail undisturbed mask
instructions, an i1 vp.merge will get expanded to a lengthy sequence:

```asm
  vsetvli a1, zero, e64, m1, ta, ma
  vid.v v10                        
  vmsltu.vx v10, v10, a0           
  vmand.mm v9, v9, v10             
  vmandn.mm v8, v8, v9             
  vmand.mm v9, v0, v9              
  vmor.mm v0, v9, v8               
```

This addresses this by matching this specific AnyOf pattern in
RISCVCodegenPrepare and widening it from i1 to i8, which will end up
producing a single masked i8 vor.vi inside the loop:

```llvm
loop:                                                                      
  %phi = phi <vscale x 4 x i1> [ zeroinitializer, %entry ], [ %rec, %loop ]
  %cmp = icmp ...                                                                                          
  %rec = call <vscale x 4 x i1> @llvm.vp.merge(%cmp, true, %phi, %evl)     
```

```llvm
loop:                                                                      
  %phi = phi <vscale x 4 x i8> [ zeroinitializer, %entry ], [ %rec, %loop ]
  %cmp = icmp ...                             
  %rec = call <vscale x 4 x i8> @llvm.vp.merge(%cmp, true, %phi, %evl)     
  %trunc = trunc <vscale x 4 x i8> %rec to <vscale x 4 x i1>               
```

I ended up adding this in RISCVCodegenPrepare instead of the
LoopVectorizer itself since it would have required adding a target hook.

It may also be possible to generalize this to other i1 vp.merges in
future.

Normally the trunc will be sunk outside of the loop. But it also doesn't
check to see if all the non-phi users of the vp.merge are outside of the
loop: If there are in-loop users this still seems to be profitable, see
the test diff in `@widen_anyof_rdx_use_in_loop`

Fixes #132180
2025-04-28 10:07:51 +08:00
Nico Weber
c785ef82ab [gn] port 7afbffb5c2e4 2025-04-27 21:59:57 -04:00
Kazu Hirata
c6cec7bd9c
[CodeGen] Make hash_value a non-friend function (NFC) (#137564)
We can implement hash_value with publicly available methods of Vector.
2025-04-27 18:17:15 -07:00
Owen Rodley
d3d856ad84
Clean up external users of GlobalValue::getGUID(StringRef) (#129644)
See https://discourse.llvm.org/t/rfc-keep-globalvalue-guids-stable/84801
for context.

This is a non-functional change which just changes the interface of
GlobalValue, in preparation for future functional changes. This part
touches a fair few users, so is split out for ease of review. Future
changes to the GlobalValue implementation can then be focused purely on
that class.

This does the following:

* Rename GlobalValue::getGUID(StringRef) to
  getGUIDAssumingExternalLinkage. This is simply making explicit at the
  callsite what is currently implicit.
* Where possible, migrate users to directly calling getGUID on a
  GlobalValue instance.
* Otherwise, where possible, have them call the newly renamed
  getGUIDAssumingExternalLinkage, to make the assumption explicit.


There are a few cases where neither of the above are possible, as the
caller saves and reconstructs the necessary information to compute the
GUID themselves. We want to migrate these callers eventually, but for
this first step we leave them be.
2025-04-28 11:09:43 +10:00
Kazu Hirata
ed3c8702a2
[ASTMatchers] Use llvm::is_detected (NFC) (#137560) 2025-04-27 17:56:26 -07:00
Kazu Hirata
d1e85a0ea0
[mlir] Use range constructors of *Set (NFC) (#137563) 2025-04-27 17:52:41 -07:00
Kazu Hirata
e13b79cc14
[IR] Use llvm::is_detected (NFC) (#137562) 2025-04-27 17:52:23 -07:00
Kazu Hirata
3eab094c45
[CodeGen] Use llvm::is_detected (NFC) (#137561) 2025-04-27 17:51:54 -07:00
Jonas Devlieghere
89f3dc9074
[debugserver] Migrate MachProcess away from PThreadMutex (NFC) (#137553)
The debugserver code predates modern C++, but with C++11 and later
there's no need to have something like PThreadMutex. This migrates
MachProcess away from PThreadMutex in preparation for removing it.
2025-04-27 17:50:35 -07:00
Kazu Hirata
5cfd81b0cc
[llvm] Use range constructors of *Set (NFC) (#137552) 2025-04-27 15:59:57 -07:00
Kazu Hirata
25b05e0b23
[mlir] Simplify functions with "constexpr if" (NFC) (#137551)
We can use "constexpr if" to combine the two variants of functions.
2025-04-27 15:59:44 -07:00
Ryosuke Niwa
992e928641
[alpha.webkit.RetainPtrCtorAdoptChecker] Check nullity before calling IgnoreParenCasts. (#137556) 2025-04-27 15:45:03 -07:00
Jonas Devlieghere
e886ba1d59
[debugserver] Migrate RNBRemote away from PThreadMutex (NFC) (#137547)
The debugserver code predates modern C++, but with C++11 and later
there's no need to have something like PThreadMutex. This migrates
RNBRemote away from PThreadMutex in preparation for removing it.
2025-04-27 15:16:42 -07:00
Mehdi Amini
c3858e55f4 [MLIR] Fix test run line: use env to set environment variable 2025-04-27 14:48:13 -07:00