platform/upstream/llvm.git
20 months ago[gn build] Port dcb834843ed4
LLVM GN Syncbot [Thu, 23 Feb 2023 16:39:43 +0000 (16:39 +0000)]
[gn build] Port dcb834843ed4

20 months ago[AMDGPU] Split SIModeRegisterDefaults out of AMDGPUBaseInfo. NFC.
Jay Foad [Thu, 23 Feb 2023 16:07:57 +0000 (16:07 +0000)]
[AMDGPU] Split SIModeRegisterDefaults out of AMDGPUBaseInfo. NFC.

This is only used by CodeGen. Moving it out of AMDGPUBaseInfo simplifies
future changes to make some of it depend on the subtarget.

Differential Revision: https://reviews.llvm.org/D144650

20 months agoRevert "[clang] Add the check of membership for the issue #58674 and improve the...
Alexander Kornienko [Thu, 23 Feb 2023 16:08:47 +0000 (17:08 +0100)]
Revert "[clang] Add the check of membership for the issue #58674 and improve the lookup process"

The commit causes clang to crash. See https://reviews.llvm.org/D143840#4147234

This reverts commit 8498ba6c2860c838183f9951b63df26ab5f02265.

20 months ago[flang] Relax the check for polymorphic pointer in storage_size intrinsic
Valentin Clement [Thu, 23 Feb 2023 16:28:54 +0000 (17:28 +0100)]
[flang] Relax the check for polymorphic pointer in storage_size intrinsic

The runtime check was a too strong as the standard says.
> If it is polymorphic it shall not be an undefined pointer.
The check was checking if the pointer was associated.
Remove the check as other compilers do.

Depends on D144643

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D144644

20 months ago[flang] Accept polymorphic component element in storage_size
Valentin Clement [Thu, 23 Feb 2023 16:28:07 +0000 (17:28 +0100)]
[flang] Accept polymorphic component element in storage_size

When an element is extracted from a polymorphic array, it is
represented as a PolymorphicValue. The PolymorphicValue is
not a boxed value but holds the original polyrmophic array
and the element itself. This was raising an error in storage_size
lowering since we expect a boxed value to take advantage of
fir.box_elesize.
This patch handles PolymorphicValue correctly.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D144643

20 months ago[flang] Fix element indexing in Destroy component deallocation
Valentin Clement [Thu, 23 Feb 2023 16:26:52 +0000 (17:26 +0100)]
[flang] Fix element indexing in Destroy component deallocation

Derived type `Destroy` function does not take step into consideration
when indexing the component element for deallocation. This leads to
incorrect deallocation in case like:

```
module mod1
  type :: t
    real, allocatable :: r(:)
  end type
contains
  subroutine do_smth(c)
    class(t), intent(out) :: c(:)
    do i = 1, size(c)
      if (allocated(c(i)%r)) then
        print*, i, 'not deallocated'
      end if
    end do
  end subroutine
end module

program test
  use mod1
  type(t) :: z(6)
  integer :: i
  do i = 1, 6
    Allocate(z(i)%r(i))
  end do
  call do_smth(z(::2))
end
```

Similar change was done in D142527

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D144553

20 months ago[RISCV][NFC] Reuse getDeinterleaveViaVNSRL to lower deinterleave intrinsics
Luke Lau [Wed, 22 Feb 2023 19:28:36 +0000 (19:28 +0000)]
[RISCV][NFC] Reuse getDeinterleaveViaVNSRL to lower deinterleave intrinsics

This modifies it to work on both scalable and fixed vectors

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D144584

20 months ago[RISCV] Lower interleave and deinterleave intrinsics
Luke Lau [Mon, 20 Feb 2023 13:32:13 +0000 (13:32 +0000)]
[RISCV] Lower interleave and deinterleave intrinsics

Lower the two intrinsics introduced in D141924.

These intrinsics can be combined with loads and stores into the much more efficient segmented load and store instructions in a following patch.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D144092

20 months ago[Clang][NFC] Remove pointless defines from test command lines
John Brawn [Tue, 21 Feb 2023 15:43:32 +0000 (15:43 +0000)]
[Clang][NFC] Remove pointless defines from test command lines

A few tests use -D on the command line to define macros that are
already predefined. Remove these pointless defines, as an upcoming
patch will cause this to be a warning.

20 months ago[Assignment Tracking][NFC] Avoid doing some work when maps have same keys
OCHyams [Thu, 23 Feb 2023 15:50:51 +0000 (15:50 +0000)]
[Assignment Tracking][NFC] Avoid doing some work when maps have same keys

Where the new checks have been added, `SymmetricDifference` - still being built
- contains entries for variables present in `A` and not in `B`.  If
`SymmetricDifference` is empty at this point it means the variables (map keys)
in `A` are a subset of those in `B`, so if `A` and `B` are the same size then
we know they're identical.

This reduces the number of instructions retired building some of the CTMark
projects in a ReleaseLTO-g configuration (geomean change -0.05% with the best
improvement being -0.24% for tramp3d-v4)

Reviewed By: StephenTozer

Differential Revision: https://reviews.llvm.org/D144621

20 months ago[InstCombine] NFC: Add implied condition to block in foldSelectInstWithICmp
Sander de Smalen [Thu, 23 Feb 2023 15:29:51 +0000 (15:29 +0000)]
[InstCombine] NFC: Add implied condition to block in foldSelectInstWithICmp

Added the condition 'TrueVal->getType()->isIntOrIntVectorTy' to a block of code
in foldSelectInstWithICmp which is only valid if the TrueVal is integer type.

This change was split off from D136861.

20 months ago[lldb] Skip test_stop_reply_contains_thread_pcs on Windows
David Spickett [Thu, 23 Feb 2023 16:08:44 +0000 (16:08 +0000)]
[lldb] Skip test_stop_reply_contains_thread_pcs on Windows

I marked this as expected to fail, but it doesn't always fail,
and an unexpected success is a failure.

Skip it instead.

20 months ago[LV] NFC: Move logic to query maximum vscale to its own function.
Sander de Smalen [Thu, 23 Feb 2023 12:20:36 +0000 (12:20 +0000)]
[LV] NFC: Move logic to query maximum vscale to its own function.

To query the maximum value for vscale, the LV queries the vscale_range
attribute or a TTI hook. To avoid having to reimplement the same behaviour
for multiple uses (such as in D142894), it makes sense to move this code
to a separate function.

20 months ago[clangd] Set diag data before emitting
Kadir Cetinkaya [Thu, 23 Feb 2023 13:47:55 +0000 (14:47 +0100)]
[clangd] Set diag data before emitting

Also fixes a benign use-after-free.

Differential Revision: https://reviews.llvm.org/D144641

20 months ago[PS4/PS5] Specify no <complex.h> or <threads.h>
Paul Robinson [Wed, 22 Feb 2023 19:55:34 +0000 (11:55 -0800)]
[PS4/PS5] Specify no <complex.h> or <threads.h>

We've never provided these headers so set the preprocessor
toggles to reflect that.

Differential Revision: https://reviews.llvm.org/D144586

20 months agoRevert "[Clang] Implement fix for DR2628"
Tobias Hieta [Tue, 21 Feb 2023 15:47:54 +0000 (16:47 +0100)]
Revert "[Clang] Implement fix for DR2628"

This reverts commit 368b6832de33b366d4eb155f940e7476daace6a8.

See https://github.com/llvm/llvm-project/issues/60777 for details

20 months ago[Flang] Don't crash when BOZ literals are on the rhs of an assignment
Peter Steinfeld [Wed, 22 Feb 2023 18:51:54 +0000 (10:51 -0800)]
[Flang] Don't crash when BOZ literals are on the rhs of an assignment

For BOZ literals, the rhsType will be empty.  Check for that before
trying to access its value.

Differential Revision: https://reviews.llvm.org/D144576

20 months ago[SME2][AArch64] Add multi-vector rounding shift left intrinsics
Kerry McLaughlin [Thu, 23 Feb 2023 13:47:45 +0000 (13:47 +0000)]
[SME2][AArch64] Add multi-vector rounding shift left intrinsics

Adds intrinsics for the following SME2 instructions:
 - srshl (single, 2 & 4 vector)
 - srshl (multi, 2 & 4 vector)
 - urshl (single, 2 & 4 vector)
 - urshl (multi, 2 & 4 vector)

NOTE: These intrinsics are still in development and are subject to future changes.

Reviewed By: david-arm

Differential Revision: https://reviews.llvm.org/D144118

20 months ago[SLP] Check with target before vectorizing GEP Indices.
Jonas Paulsson [Wed, 15 Feb 2023 18:46:38 +0000 (19:46 +0100)]
[SLP] Check with target before vectorizing GEP Indices.

The target hook prefersVectorizedAddressing() already exists to check with
target if address computations should be vectorized, so it seems like this
should be used in SLPVectorizer as well.

Reviewed By: ABataev, RKSimon

Differential Revision: https://reviews.llvm.org/D144128

20 months ago[PatternMatch] Don't require DataLayout for m_VScale()
Nikita Popov [Wed, 22 Feb 2023 16:13:00 +0000 (17:13 +0100)]
[PatternMatch] Don't require DataLayout for m_VScale()

The m_VScale() matcher is unusual in that it requires a DataLayout.
It is currently used to determine the size of the GEP type. However,
I believe it is sufficient to check for the canonical
<vscale x 1 x i8> form here -- I don't think there's a need to
recognize exotic variations like <vscale x 1 x i4> as a vscale
constant representation as well.

Differential Revision: https://reviews.llvm.org/D144566

20 months ago[Clang] Fix a crash when taking the address of a consteval lambda
Corentin Jabot [Thu, 23 Feb 2023 10:04:23 +0000 (11:04 +0100)]
[Clang] Fix a crash when taking the address of a consteval lambda

The `_invoke` function of lambdas was not respecting
the constexpr/consteval specifier of the call operator, so it was possible
to take its address in a non-immmediately invoked context,
even if the call operator was itself consteval.

In addition, we improve the diagnostic emmited in the lambda case
not to show that `invoke` method.

Fixes #57682

Reviewed By: aaron.ballman, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D144627

20 months ago(NFC)[ConstantFold][InstSimplify] add tests for folding load for patterned arrays...
khei4 [Thu, 23 Feb 2023 08:05:43 +0000 (17:05 +0900)]
(NFC)[ConstantFold][InstSimplify] add tests for folding load for patterned arrays and structs

20 months ago[LLDB] Mark test_stop_reply_contains_thread_pcs as an expected failure on Windows
David Spickett [Thu, 23 Feb 2023 14:08:01 +0000 (14:08 +0000)]
[LLDB] Mark test_stop_reply_contains_thread_pcs as an expected failure on Windows

This has been flaky on the Windows on Arm LLDB bot.

https://lab.llvm.org/buildbot/#/builders/219/builds/826

Given that test_stop_reply_reports_multiple_threads is already expected
to fail on Windows, this is not suprising.

20 months ago[AMDGPU] Add more tests for buffer intrinsics
Piotr Sobczak [Thu, 23 Feb 2023 13:39:10 +0000 (14:39 +0100)]
[AMDGPU] Add more tests for buffer intrinsics

Add more tests for buffer intrinsics with large voffsets.

20 months agoFix comment in `Vectorization.cpp` (NFC)
Lorenzo Chelini [Thu, 23 Feb 2023 12:46:38 +0000 (13:46 +0100)]
Fix comment in `Vectorization.cpp` (NFC)

kDynamicSize is now kDynamic, see: https://reviews.llvm.org/D138282

20 months agoRevert "[SCEV] Preserve divisibility and min/max information in applyLoopGuards"
komalon1 [Thu, 23 Feb 2023 12:40:50 +0000 (14:40 +0200)]
Revert "[SCEV] Preserve divisibility and min/max information in applyLoopGuards"

This reverts commit 219ba2fb7b0ae89101f3c81a47fe4fc4aa80dea4.

20 months ago[C++20] Stop claiming full support for consteval (for the moment!)
Aaron Ballman [Thu, 23 Feb 2023 12:40:17 +0000 (07:40 -0500)]
[C++20] Stop claiming full support for consteval (for the moment!)

During Clang 15, 3d2629dd3aab17098813c68b5b76bb864bc5e285 claimed we
achieved full support for consteval in C++20. However, further testing
shows that Clang doesn't correctly handle all of the examples from
https://wg21.link/P1073R3 and has several other known issues that are
preventing us from defining the `__cpp_consteval` macro.

I think we should only claim Partial support for the moment. Once we
correct the major outstanding issues, then I think we should change the
status back to full support and define __cpp_consteval at the same time
(even if it's only to the 201811L value instead of the latest value
from C++2b). This helps users understand the support situation more
clearly.

Differential Revision: https://reviews.llvm.org/D144572

20 months ago[mlir][arith] Fold on extension of FP constants using arith.extf
Victor Perez [Fri, 17 Feb 2023 10:16:42 +0000 (10:16 +0000)]
[mlir][arith] Fold on extension of FP constants using arith.extf

It is safe to fold when extending, as we will not lose precision.

Differential Revision: https://reviews.llvm.org/D144251

20 months ago[AMDGPU][GFX11] Legalize and select partial NSA MIMG instructions
Mirko Brkusanin [Thu, 23 Feb 2023 11:27:52 +0000 (12:27 +0100)]
[AMDGPU][GFX11] Legalize and select partial NSA MIMG instructions

If more registers are needed for VAddr then the NSA format allows then the
final register can act as a contigous set of remaining addresses. Update
legalizer to pack register for this new format and allow instruction
selection to use NSA encoding when number of addresses exceeds max size.
Also update SIShrinkInstructions to handle partial NSA.

Differential Revision: https://reviews.llvm.org/D144034

20 months ago[AMDGPU][MC][GFX11] Add Partial NSA format for image sample instructions
Mirko Brkusanin [Thu, 23 Feb 2023 10:34:27 +0000 (11:34 +0100)]
[AMDGPU][MC][GFX11] Add Partial NSA format for image sample instructions

Image sample instructions that need more than 5 VGPRs for VAddr can use
partial NSA for NSA encoding format. VGPRs that can not fit into the
encoding are sequential after the last one.
This patch adds assembly and disassembly parts.

Differential Revision: https://reviews.llvm.org/D144033

20 months ago[AMDGPU] Clean up MUBUF immediate offset
Piotr Sobczak [Thu, 23 Feb 2023 10:47:40 +0000 (11:47 +0100)]
[AMDGPU] Clean up MUBUF immediate offset

D143174 lifted the artificial type restriction by promoting
offset to i32. This patch handles more cases: those involving
immediate offset in MUBUF.

Differential Revision: https://reviews.llvm.org/D144628

20 months agoClear read_fd_set if EINTR received
Emre Kultursay [Thu, 23 Feb 2023 11:55:25 +0000 (12:55 +0100)]
Clear read_fd_set if EINTR received

Leaving bits uncleared set causes callbacks to be triggered even
though there are no events to process. Starting with D131160
we have a callback that makes blocking read calls over pipe which
was causing the lldb-server main loop to become unresponsive / blocked
on Android.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D144240

20 months ago[MLIR][Vector] Add a dependency on `:DataLayoutInterfaces`
Michal Terepeta [Thu, 23 Feb 2023 11:11:04 +0000 (12:11 +0100)]
[MLIR][Vector] Add a dependency on `:DataLayoutInterfaces`

Reviewed By: tpopp

Differential Revision: https://reviews.llvm.org/D144631

20 months agoRevert "(NFC)[ConstantFold][InstSimplify] add tests for folding load for patterned...
khei4 [Thu, 23 Feb 2023 10:36:11 +0000 (19:36 +0900)]
Revert "(NFC)[ConstantFold][InstSimplify] add tests for folding load for patterned arrays and structs"

This reverts commit 9636bcd3a0091b0bb77250182ac0c549112f9196.

20 months ago[AMDGPU][NFC] Add getMaxMUBUFImmOffset
Piotr Sobczak [Thu, 23 Feb 2023 07:46:18 +0000 (08:46 +0100)]
[AMDGPU][NFC] Add getMaxMUBUFImmOffset

Replace magic constant 4095 with the function getMaxMUBUFImmOffset().

Differential Revision: https://reviews.llvm.org/D144623

20 months ago[mlir] Fix folding for scf.for(tensor.cast).
Alexander Belyaev [Thu, 23 Feb 2023 10:12:14 +0000 (11:12 +0100)]
[mlir] Fix folding for scf.for(tensor.cast).

We should only fold tensor.casts that provide some new static information about
shapes, instead of looking for a symmetric pattern cast(for(cast)).

Differential Revision: https://reviews.llvm.org/D144577

20 months agoInstCombine: Fold and/or of fcmp into class
Matt Arsenault [Wed, 30 Nov 2022 05:29:39 +0000 (00:29 -0500)]
InstCombine: Fold and/or of fcmp into class

This is motivated by patterns like !isfinite || zero. The AMDGPU math
libraries have a lot of patterns like this, and I'm trying to fix the
code to be more portable and less dependent on directly calling class
intrinsics.

I believe this is the first place where new is.fpclass calls are
introduced. There are more class-like compares that could be
recognized; this is a set I currently care about plus a few extras.

Keep the == 0 cases disabled for now. It depends on the denormal
mode. If we just check IEEE mode now, it will break my use case
without another patch I'm working on.

20 months ago[Tooling/Inclusion] Handle std::get symbol.
Haojian Wu [Tue, 21 Feb 2023 14:48:11 +0000 (15:48 +0100)]
[Tooling/Inclusion] Handle std::get symbol.

Currently, we handle it as a symbol without a header. In general, for
the include-cleaner case, the std::get comes with the type header, it is
safe to ignore it.

Differential Revision: https://reviews.llvm.org/D144484

20 months ago[SCEV] Preserve divisibility and min/max information in applyLoopGuards
Alon Kom [Tue, 31 Jan 2023 08:21:53 +0000 (10:21 +0200)]
[SCEV] Preserve divisibility and min/max information in applyLoopGuards

applyLoopGuards doesn't always preserve information when there are multiple assumes.

This patch tries to deal with multiple assumes regarding a SCEV's divisibility and min/max values, and rewrite it into a SCEV that still preserves all of the information.
For example, let the trip count of the loop be TC. Consider the 3 following assumes:

1. __builtin_assume(TC % 8 == 0);
2. __builtin_assume(TC > 0);
3. __builtin_assume(TC < 100);

Before this patch, depending on the assume processing order applyLoopGuards could create the following SCEV:
max(min((8 * (TC / 8)) , 99), 1)

Looking at this SCEV, it doesn't preserve the divisibility by 8 information.

After this patch, depending on the assume processing order applyLoopGuards could create the following SCEV:
max(min((8 * (TC / 8)) , 96), 8)

By aligning up 1 to 8, and aligning down 99 to 96, the new SCEV still preserves all of the original assumes.

Differential Revision: https://reviews.llvm.org/D141850

20 months ago[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity
Chuanqi Xu [Thu, 23 Feb 2023 09:04:42 +0000 (17:04 +0800)]
[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity

[temp.friend]p9 says

> Such a constrained friend function or function template declaration does
not declare the same function or function template as a declaration in
any other scope.

But the friend declaration in the same scope shouldn't fall into this
catagory. Although the logic is handled in 'FriendsDifferByConstraints',
the compiler may haven't merged the lexcial declcontext in time.
Also the code removed is not covered by test too.

Let's handle the logic in sema as we've done now.

20 months ago[include-cleaner] Dont pass llvm::StringRef to gtest APIs
Kadir Cetinkaya [Thu, 23 Feb 2023 09:03:59 +0000 (10:03 +0100)]
[include-cleaner] Dont pass llvm::StringRef to gtest APIs

Fixes https://github.com/llvm/llvm-project/issues/60884.

20 months ago[include-cleaner] Always treat constructor calls as implicit
Kadir Cetinkaya [Wed, 22 Feb 2023 19:15:40 +0000 (20:15 +0100)]
[include-cleaner] Always treat constructor calls as implicit

Treating constructor calls when the type name isn't explicitly spelled
can cause spurious results, so turn them into implicit references.
This doesn't change the behaviour for constructor calls that explicitly spell
the type name, as we should see a reference through the typeloc.

Fixes https://github.com/llvm/llvm-project/issues/60812

Differential Revision: https://reviews.llvm.org/D144582

20 months ago[NFC] test commit
Alon Kom [Thu, 23 Feb 2023 08:13:56 +0000 (10:13 +0200)]
[NFC] test commit

20 months ago[AMDGPU] Add GISel RUN lines to 2 existing tests. NFC
Diana Picus [Wed, 22 Feb 2023 12:24:36 +0000 (13:24 +0100)]
[AMDGPU] Add GISel RUN lines to 2 existing tests. NFC

This adds a bit of coverage for GlobalISel.

Differential Revision: https://reviews.llvm.org/D144555

20 months ago[include-cleaner] Check macros against stdlib database
Kadir Cetinkaya [Wed, 22 Feb 2023 19:09:02 +0000 (20:09 +0100)]
[include-cleaner] Check macros against stdlib database

Differential Revision: https://reviews.llvm.org/D144579

20 months ago[MLIR][Linalg] Change insertion point for `bubbleUpPackOpThroughElemGenericOp`
Lorenzo Chelini [Fri, 17 Feb 2023 10:00:07 +0000 (11:00 +0100)]
[MLIR][Linalg] Change insertion point for `bubbleUpPackOpThroughElemGenericOp`

Currently, the insertion point for `bubbleUpPackOpThroughElemGenericOp`
is after the tensor.pack this means that the new generic will be created
right after the tensor.pack. This is inconvenient because we are moving
the position of the generic; the idea is to move pack/unpack around, not
linalg.generics. This PR changes the insertion point to preserve the
position of the generic.

Additionally, it restricts the pattern to fire if the generic has a
single user (`tensor.pack`) to avoid introducing recomputation.

Reviewed By: hanchung

Differential Revision: https://reviews.llvm.org/D144246

20 months ago[flang][hlfir] Simplify hlfir.assign default codegen for arrays
Jean Perier [Thu, 23 Feb 2023 08:10:09 +0000 (09:10 +0100)]
[flang][hlfir] Simplify hlfir.assign default codegen for arrays

The previous code was always emitting two genAssign calls to create
a temporary copy of the RHS if it could overlap with the LHS.

This inline temporary creation is not needed anymore after:
https://github.com/llvm/llvm-project/commit/755535b5eb5f6d60e9cc347cecd9e057231b92bb
that updated the assignment runtime to detect overlap and make a
temporary copy in the runtime directly.

Note that optimized inlined assignment will still have to do the alias
analysis to skip the copy when added later.

Differential Revision: https://reviews.llvm.org/D144567

20 months ago(NFC)[ConstantFold][InstSimplify] add tests for folding load for patterned arrays...
khei4 [Thu, 23 Feb 2023 08:05:43 +0000 (17:05 +0900)]
(NFC)[ConstantFold][InstSimplify] add tests for folding load for patterned arrays and structs

20 months ago[mlir][IR] Use Listener for IR callbacks in OperationFolder
Matthias Springer [Thu, 23 Feb 2023 07:55:29 +0000 (08:55 +0100)]
[mlir][IR] Use Listener for IR callbacks in OperationFolder

Remove the IR modification callbacks from `OperationFolder`. Instead, an optional `RewriterBase::Listener` can be specified.
* `processGeneratedConstants` => `notifyOperationCreated`
* `preReplaceAction` => `notifyOperationReplaced`

This simplifies the GreedyPatternRewriterDriver because we no longer need special handling for IR modifications due to op folding.

A folded operation is now enqueued on the GreedyPatternRewriteDriver's worklist if it was modified in-place. (There may be new patterns that apply after folding.)

Also fixes a bug in `TestOpInPlaceFold::fold`. The folder could previously be applied over and over and did not return a "null" OpFoldResult if the IR was not modified. (This is similar to a pattern that returns `success` without modifying IR; it can trigger an infinite loop in the GreedyPatternRewriteDriver.)

Differential Revision: https://reviews.llvm.org/D144463

20 months ago[Assignment Tracking] Initialise maps with minimum required number of entries
OCHyams [Thu, 23 Feb 2023 07:40:31 +0000 (07:40 +0000)]
[Assignment Tracking] Initialise maps with minimum required number of entries

The size lower bound is known - the `Join` map in both cases gets an entry for
each variable from both input maps (union).

This reduces the number of times the map grows, improving ReleaseLTO-g compile
time for CTMark projects by an average of around 0.2%.

Reviewed By: scott.linder

Differential Revision: https://reviews.llvm.org/D144486

20 months ago[ELF] --icf: don't fold a section without relocation and a section with relocations...
Fangrui Song [Thu, 23 Feb 2023 07:34:49 +0000 (23:34 -0800)]
[ELF] --icf: don't fold a section without relocation and a section with relocations for SHT_REL

Fix https://github.com/llvm/llvm-project/issues/57693

20 months ago[AMDGPU][NFC] Convert llvm.amdgcn tests to autogen
Piotr Sobczak [Thu, 23 Feb 2023 07:15:07 +0000 (08:15 +0100)]
[AMDGPU][NFC] Convert llvm.amdgcn tests to autogen

20 months ago[libc] Introduce sys/socket.h
Jeff Bailey [Thu, 23 Feb 2023 06:44:46 +0000 (06:44 +0000)]
[libc] Introduce sys/socket.h

This adds sys/socket.h and some definitions on Linux.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D144415

20 months ago[Coroutines] Remove -fcoroutines-ts
Chuanqi Xu [Thu, 23 Feb 2023 06:31:41 +0000 (14:31 +0800)]
[Coroutines] Remove -fcoroutines-ts

Since we decided to remove the support for `-fcoroutines-ts` in
clang/llvm17 and the clang16/llvm16 is branched. So we're going to
remove the `-fcoroutines-ts` option.

20 months ago[llvm][TextAPI] add Default FileType value to InterfaceFile Objects
Cyndy Ishida [Thu, 23 Feb 2023 06:23:33 +0000 (22:23 -0800)]
[llvm][TextAPI] add Default FileType value to InterfaceFile Objects

* This silences msan errors

20 months ago[NFC] Remove the use of '-fcoroutines-ts' in a test of clang-tidy
Chuanqi Xu [Thu, 23 Feb 2023 06:14:31 +0000 (14:14 +0800)]
[NFC] Remove the use of '-fcoroutines-ts' in a test of clang-tidy

Close https://github.com/llvm/llvm-project/issues/60864.

We're going to remove the support for `-fcoroutines-ts` in clang. But we
found there are additional use of `-fcoroutines-ts` in clang-tidy. This
patch removes such uses.

20 months ago[VP] Reorder is_int_min_poison/is_zero_poison operand before mask for vp.abs/ctlz...
Yeting Kuo [Wed, 22 Feb 2023 06:50:11 +0000 (14:50 +0800)]
[VP] Reorder is_int_min_poison/is_zero_poison operand before mask for vp.abs/ctlz/cttz.

The patch ensures last two operands of vp.abs/ctlz/cttz are mask and evl.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D144536

20 months agoRevert "[NFC] Make FPClassTest a bitmask enumeration"
Serge Pavlov [Thu, 23 Feb 2023 05:53:27 +0000 (12:53 +0700)]
Revert "[NFC] Make FPClassTest a bitmask enumeration"

This reverts commit e7613c1d9b259bdf2b0b06b4169d9a10dd553406.

GCC issues an error:

In file included from /home/buildbot/as-builder-4/lld-x86_64-ubuntu-fast/llvm-project/llvm/unittests/ADT/BitmaskEnumTest.cpp:9:
/home/buildbot/as-builder-4/lld-x86_64-ubuntu-fast/llvm-project/llvm/include/llvm/ADT/BitmaskEnum.h:66:22: error: explicit specialization of template<class E, class Enable> struct llvm::is_bitmask_enum outside its namespace must use a nested-name-specifier [-fpermissive]
   66 |   template <> struct is_bitmask_enum<Enum> : std::true_type {};                \
      |                      ^~~~~~~~~~~~~~~~~~~~~
/home/buildbot/as-builder-4/lld-x86_64-ubuntu-fast/llvm-project/llvm/unittests/ADT/BitmaskEnumTest.cpp:30:1: note: in expansion of macro LLVM_DECLARE_ENUM_AS_BITMASK
   30 | LLVM_DECLARE_ENUM_AS_BITMASK(Flags2, V4);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

20 months ago[NFC] Make FPClassTest a bitmask enumeration
Serge Pavlov [Wed, 22 Feb 2023 07:20:04 +0000 (14:20 +0700)]
[NFC] Make FPClassTest a bitmask enumeration

This is recommit of 2e416cdd52, reverted in 8555ab2fcd, because GCC
complains on extra qualification. The macro LLVM_DECLARE_ENUM_AS_BITMASK
does not specify llvm:: anymore, so the macro must occur in the namespace
llvm. Documentation updated accordingly. The original commit message is below.

With this change bitwise operations are allowed for FPClassTest
enumeration, it must simplify using this type. Also some functions
changed to get argument of type FPClassTest instead of unsigned.

Differential Revision: https://reviews.llvm.org/D144241

20 months ago[OpenMP] Improve LIT tests on composite target constructs
Animesh Kumar [Mon, 20 Feb 2023 09:26:28 +0000 (14:56 +0530)]
[OpenMP] Improve LIT tests on composite target constructs

This commit improves the "target_teams_distribute_paralle
l_for_simd_codegen.cpp" and "target_teams_distribute_redu
ction_codegen.cpp" tests based upon some of the execution
tests present in the SOLLVE tests. Based on SOLLVE, a new
test "target_task_affinity_codegen.cpp" is also being
added. These tests are required to be added because the
existing tests do not test the combination of directives
these will be testing.

Link to SOLLVE page: https://github.com/SOLLVE/sollve_vv

Differential Revision: https://reviews.llvm.org/D144544

20 months ago[TextAPI] Add support for TBDv5 Files to nm & tapi-diff
Cyndy Ishida [Thu, 23 Feb 2023 01:13:14 +0000 (17:13 -0800)]
[TextAPI] Add support for TBDv5 Files to nm & tapi-diff

This includes handling of new attributes for symbols & rpath.
In the event that an older format file is compared to tbd_v5, ignore these new attributes.

Reviewed By: ributzka

Differential Revision: https://reviews.llvm.org/D144529

20 months ago[BOLT][X86][NFC] Simplify the code of X86MCPlusBuilder::getAliasSized
Shengchen Kan [Wed, 22 Feb 2023 11:39:29 +0000 (19:39 +0800)]
[BOLT][X86][NFC] Simplify the code of X86MCPlusBuilder::getAliasSized

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D144551

20 months ago[MC][CodeGen] Define R_RISCV_PLT32 and lower dso_local_equivalent to it
Leonard Chan [Thu, 23 Feb 2023 01:26:27 +0000 (01:26 +0000)]
[MC][CodeGen] Define R_RISCV_PLT32 and lower dso_local_equivalent to it

This introduces R_RISCV_PLT32, PC-relative data relocation that takes
the 32-bit relative offset to a function or its PLT entry from its
relocation location.

This is needed to support relative vtables on RISCV.

Github PR: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/363

The lld handling of this reloc is D143115.

Differential Revision: https://reviews.llvm.org/D143226

20 months ago[LogicCombine] Restore the logic-combine.ll to before optimzed; NFC
chenglin.bi [Thu, 23 Feb 2023 01:00:25 +0000 (09:00 +0800)]
[LogicCombine] Restore the logic-combine.ll to before optimzed; NFC

20 months ago[LogicCombine] Rename test file complex-logic.ll to logic-combine.ll; NFC
chenglin.bi [Thu, 23 Feb 2023 00:56:55 +0000 (08:56 +0800)]
[LogicCombine] Rename test file complex-logic.ll to logic-combine.ll; NFC

20 months ago[bazel] Remove unused dependency on libxml2
Aaron Siddhartha Mondal [Thu, 23 Feb 2023 00:52:02 +0000 (01:52 +0100)]
[bazel] Remove unused dependency on libxml2

The Bazel configs don't set `LLVM_ENABLE_LIBXML2`, so this was never usable to
begin with.

On systems without static `libxml2.a` this made `lld` runtime-dependent on an
unused, non-hermetic `libxml2.so`.

Reviewed By: MaskRay, GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D143351

20 months ago[libc] Prevent printf index mode crashes
Michael Jones [Fri, 10 Feb 2023 22:36:30 +0000 (14:36 -0800)]
[libc] Prevent printf index mode crashes

The posix standard defines an alternate mode for printf where the
conversions also have an index that describes which argument to select.
Due to how variadic arguments work in C, to reach the nth argument all
n-1 previous arguments must be read with their correct types. If the
format string does not specify the types for a continuous set of
arguments, then the arguments after the discontinuity cannot be safely
read. This patch causes all conversions requesting an argument that
comes after a gap be treated as raw (i.e. the conversion string is
printed literally).

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D143782

20 months ago[InstCombine] add one-use check to prevent creating an instruction in shuffle-of...
Sanjay Patel [Thu, 23 Feb 2023 00:10:12 +0000 (19:10 -0500)]
[InstCombine] add one-use check to prevent creating an instruction in shuffle-of-binop

This fold was added with https://reviews.llvm.org/D135876 ,
but we missed the one-use check.

This might be the root cause for issue #60632.

20 months ago[InstCombine] add test for splat-of-binop; NFC
Sanjay Patel [Wed, 22 Feb 2023 23:28:00 +0000 (18:28 -0500)]
[InstCombine] add test for splat-of-binop; NFC

This shows a missing extra use check.

20 months ago[mlir] Partially revert removal of old `fold` method
Markus Böck [Wed, 22 Feb 2023 23:06:21 +0000 (00:06 +0100)]
[mlir] Partially revert removal of old `fold` method

Mehdi noted in https://reviews.llvm.org/D144391 that given the low cost of keeping the old `fold` method signature working and the difficulty of writing a `FoldAdaptor` oneself, it'd be nice to keep the support for the sake of Ops written manually in C++.
This patch therefore partially reverts the removal of the old `fold` method by still allowing the old signature to be used. The active use of it is still discouraged and ODS will always generate the new method using `FoldAdaptor`s.

I'd also like to note that the previous ought to have broken some manually defined `fold` methods in-tree that are defined here: https://github.com/llvm/llvm-project/blob/23bcd6b86271f1c219a69183a5d90654faca64b8/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h#L245 It seems like these are not part of the regressions tests however...

Differential Revision: https://reviews.llvm.org/D144591

20 months ago[llvm][TextAPI] Clean up minor bugs in YAML TextStub
Cyndy Ishida [Wed, 22 Feb 2023 21:43:04 +0000 (13:43 -0800)]
[llvm][TextAPI] Clean up minor bugs in YAML TextStub

* Always print out maccatalyst in format
* Traverse symbols via InterfaceFile symbol APIs
* Properly track addition of flags.

Reviewed By: ributzka

Differential Revision: https://reviews.llvm.org/D144428

20 months ago[LSR] Fix incorrect check in 73cd3d4391ad47ae7
David Green [Wed, 22 Feb 2023 23:42:21 +0000 (23:42 +0000)]
[LSR] Fix incorrect check in 73cd3d4391ad47ae7

I missed that the test needed a icelake-server cpu to fail, and left a testing
"false &&" in the if condition. Hopefully this is now the correct fix.

20 months ago[lldb] Fix -Wformat in DWARFDebugAranges.cpp (NFC)
Jie Fu [Wed, 22 Feb 2023 23:28:38 +0000 (07:28 +0800)]
[lldb] Fix -Wformat in DWARFDebugAranges.cpp (NFC)

/data/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp:79:66: error: format specifies type 'unsigned int' but the argument has type 'lldb_private::RangeData<unsigned long, unsigned int, unsigned long>::DataType' (aka 'unsigned long') [-Werror,-Wformat]
      LLDB_LOGF(log, "0x%8.8x: [0x%" PRIx64 " - 0x%" PRIx64 ")", entry->data,
                        ~~~~~                                    ^~~~~~~~~~~
                        %8.8lx
/data/llvm-project/lldb/include/lldb/Utility/Log.h:348:27: note: expanded from macro 'LLDB_LOGF'
      log_private->Printf(__VA_ARGS__);                                        \
                          ^~~~~~~~~~~
1 error generated.

20 months ago[LSR] Prevent creating SCEVs of addrecs from mismatching loops
David Green [Wed, 22 Feb 2023 22:50:37 +0000 (22:50 +0000)]
[LSR] Prevent creating SCEVs of addrecs from mismatching loops

LSR can include Regs of AddRec SCEVs from different loops, which do not combine
well when added in Scalar Evolution. As they should never produce constant
differences so we can just guard against trying to create them.

Fixes #60927

20 months ago[scudo] Ensure all blocks are put in the correct group
Chia-hung Duan [Thu, 16 Feb 2023 19:46:11 +0000 (19:46 +0000)]
[scudo] Ensure all blocks are put in the correct group

While populating new blocks, we didn't always put them into their own
groups because that needs additional sort for an almost-sorted new
blocks array. However, ensuring all blocks are placed in the right group
enables the fast identifying of unused pages in a group by simply
accouting the number of free blocks are there. Therefore, this commit is
used to set up the invariant for future optimizations.

Differential Revision: https://reviews.llvm.org/D141957

20 months ago[scudo] Fix the logic of pushing blocks of BatchClass
Chia-hung Duan [Thu, 16 Feb 2023 19:44:34 +0000 (19:44 +0000)]
[scudo] Fix the logic of pushing blocks of BatchClass

BatchClass is used to manage the free blocks for each size class. It's a
little bit tricky when it has to manage the free blocks of BatchClass.
In general, BatchClass block records the addresses of free blocks. In
order not to waste additional block to record the blocks in BatchClass,
it's self contained, i.e., it'll record its own address. The safety is
maintained by 2 preconditions,

  1. If a block is used to record other BatchClass blocks, it'll also
     record the address itself
  2. While allocating free blocks, all the recorded blcoks will be
     allocated together, which means there's no partial allocation

This CL fixes the violation of 1. and then we can push the free blocks
without having to push them in batches.

Differential Revision: https://reviews.llvm.org/D141956

20 months ago[mlir] Fix typo causing build error
Jeff Niu [Wed, 22 Feb 2023 22:05:50 +0000 (14:05 -0800)]
[mlir] Fix typo causing build error

20 months ago[mlir] Add a SharedSymbolTableCollection class
Jeff Niu [Tue, 21 Feb 2023 17:55:52 +0000 (09:55 -0800)]
[mlir] Add a SharedSymbolTableCollection class

This class wraps a `SymbolTableCollection` to allow shared access to the
collection of symbol tables (but not the individual symbol tables). This
can be used, for example, in a pass that shards work among symbols that
requires symbol lookups.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D144507

20 months ago[MLIR,OpenMP,Flang] Add Conversion to LLVM for Section Op
Kiran Chandramohan [Wed, 22 Feb 2023 17:49:12 +0000 (17:49 +0000)]
[MLIR,OpenMP,Flang] Add Conversion to LLVM for Section Op

Fixes #60911

Reviewed By: psoni2628

Differential Revision: https://reviews.llvm.org/D144554

20 months ago[AST] Add 'break;' to the last case in two switches. NFC
Craig Topper [Wed, 22 Feb 2023 21:42:40 +0000 (13:42 -0800)]
[AST] Add 'break;' to the last case in two switches. NFC

Makes it easier for the switch to be extended in the future.

20 months ago[Clang] Adjust triviality computation in QualType::isTrivialType to C++20 cases.
Roy Jacobson [Wed, 22 Feb 2023 21:20:18 +0000 (23:20 +0200)]
[Clang] Adjust triviality computation in QualType::isTrivialType to C++20 cases.

Up to C++20, hasDefaultConstructor and !hasNonTrivialDefaultConstructor together implied
hasTrivialDefaultConstructor. In C++20, a constructor might be ineligible and can set
hasDefaultConstructor without setting hasNonTrivialDefaultConstructor.

Fix this by querying hasTrivialDefaultConstructor instead of hasDefaultConstructor.

I'd like to backport this to Clang 16.
I only change isTrivialType and in a way that should only affect code that uses
constrained constructors, so I think this is relatively safe to backport.

Fixes https://github.com/llvm/llvm-project/issues/60697

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D143891

20 months ago[lldb] Warn when Mach-O files have overlapping segments
Alex Langford [Wed, 22 Feb 2023 01:20:23 +0000 (17:20 -0800)]
[lldb] Warn when Mach-O files have overlapping segments

I recently came across a binary that for some reason had overlapping
sections. When debugging it, LLDB was able to get information about one
of the sections but not the other because SectionLoadList assumes that
each address maps to exactly one section. We have the capability to warn
about this, but it was not turned on.

rdar://105751700

Differential Revision: https://reviews.llvm.org/D144528

20 months ago[RISCV] Be more explicit string replacements in RISCVInstrInfoVPseudos.td. NFC
Craig Topper [Wed, 22 Feb 2023 20:53:57 +0000 (12:53 -0800)]
[RISCV] Be more explicit string replacements in RISCVInstrInfoVPseudos.td. NFC

Instead of replacing "F16", "F32", "F64" anywhere in the string.
Only replace them when proceeded by a "_", "_V", or "_W".

This allows F16/F32/F64 to appear in the instruction name.
This is needed for some vendor instructions in our downstream. We
may be upstreaming them in the future.

20 months ago[RISCV] Replaced !subst chain with !foldl
Nitin John Raj [Wed, 22 Feb 2023 20:18:05 +0000 (12:18 -0800)]
[RISCV] Replaced !subst chain with !foldl

Reviewed By: craig.topper, MaskRay

Differential Revision: https://reviews.llvm.org/D144531

20 months ago[mlir][sparse] unconditionally use IndexType for sparse_tensor.specifier
Peiming Liu [Wed, 22 Feb 2023 18:44:00 +0000 (18:44 +0000)]
[mlir][sparse] unconditionally use IndexType for sparse_tensor.specifier

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D144574

20 months ago[mlir] Complety remove old `fold` API
Markus Böck [Mon, 20 Feb 2023 13:42:17 +0000 (14:42 +0100)]
[mlir] Complety remove old `fold` API

Last part of https://discourse.llvm.org/t/rfc-a-better-fold-api-using-more-generic-adaptors/67374

All active users that I am aware of have already switched. Any remaining users will be forced to adopt their code after this patch has landed.

Differential Revision: https://reviews.llvm.org/D144391

20 months ago[BOLT][NFC] Return struct from evaluateX86MemoryOperand
Amir Ayupov [Wed, 22 Feb 2023 20:05:58 +0000 (12:05 -0800)]
[BOLT][NFC] Return struct from evaluateX86MemoryOperand

Simplify `MCPlusBuilder::evaluateX86MemoryOperand`: make it return a struct
with memory operand analysis struct `X86MemOperand`.

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D144310

20 months agoReland "[TextAPI] Implement TBDv5 Writer"
Cyndy Ishida [Wed, 22 Feb 2023 18:00:07 +0000 (10:00 -0800)]
Reland "[TextAPI] Implement TBDv5 Writer"

Create writer for new JSON format.
The new JSON format allows practically all attributes to be defined per
target in a universal library however the internal representation only
allows one for the time being. For now the write will always write those
attributes as default available for all targets (install name,
compatability & current version, swift abi, flags e.g. flatnamepace &
app exenstion safety)

rdar://102076911

Reviewed By: ributzka

Differential Revision: https://reviews.llvm.org/D144339

20 months ago[RISCV] Expand tab characters. NFC
Craig Topper [Wed, 22 Feb 2023 19:38:04 +0000 (11:38 -0800)]
[RISCV] Expand tab characters. NFC

20 months ago[mlir][tensor] Fix transpose permutation in tensor.pack generalization pattern
Quinn Dawkins [Mon, 20 Feb 2023 19:49:38 +0000 (14:49 -0500)]
[mlir][tensor] Fix transpose permutation in tensor.pack generalization pattern

The generalization pattern for tensor.pack was inverting the
innerDimsPos permutation when normalizing. Thus, the transpose op
produced by the generalization would be incorrect.

Differential Revision: https://reviews.llvm.org/D144425

20 months ago[LSAN] Make sure HWASAN tests are linked with lld
Kirill Stoimenov [Fri, 17 Feb 2023 19:33:20 +0000 (19:33 +0000)]
[LSAN] Make sure HWASAN tests are linked with lld

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D144289

20 months agoRevert "[TextAPI] Implement TBDv5 Writer"
Cyndy Ishida [Wed, 22 Feb 2023 19:39:23 +0000 (11:39 -0800)]
Revert "[TextAPI] Implement TBDv5 Writer"

This reverts commit 8217932aabcb271df7eb30e069fdace904299cba.

Breaks buildbots.

20 months ago[TextAPI] Implement TBDv5 Writer
Cyndy Ishida [Wed, 22 Feb 2023 18:00:07 +0000 (10:00 -0800)]
[TextAPI] Implement TBDv5 Writer

Create writer for new JSON format.
The new JSON format allows practically all attributes to be defined per
target in a universal library however the internal representation only
allows one for the time being. For now the write will always write those
attributes as default available for all targets (install name,
compatability & current version, swift abi, flags e.g. flatnamepace &
app exenstion safety)

rdar://102076911

Reviewed By: ributzka

Differential Revision: https://reviews.llvm.org/D144339

20 months ago[LLDB] Enable 64 bit debug/type offset
Alexander Yermolovich [Wed, 22 Feb 2023 19:30:52 +0000 (11:30 -0800)]
[LLDB] Enable 64 bit debug/type offset

This came out of from https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902
With big binaries we can have .dwp files where .debug_info.dwo section can grow
beyond 4GB. We would like to support this in LLVM and in LLDB.

The plan is to enable manual parsing of cu/tu index in DWARF library
(https://reviews.llvm.org/D137882), and then
switch internal index data structure to 64 bit.
For the second part is to enable 64bit offset support in LLDB with
this patch.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D138618

20 months ago[mlir][linalg] Vectorize tensor.extract using contiguous loads
Andrzej Warzynski [Thu, 29 Dec 2022 10:22:28 +0000 (10:22 +0000)]
[mlir][linalg] Vectorize tensor.extract using contiguous loads

This patch implements vectorization of tensor.extract for n-D tensor (n
>= 2) using contiguous load operations, i.e. `vector.transfer_read`. This
is a follow-up of https://reviews.llvm.org/D137660 in which gather loads
were used, i.e. `vector.gather`.

It is always safe to use gather load operations when the underlying
memory pattern is contiguous, but not vice-verse. At the moment, the
following conditions have to be met for contiguous loads to be
generated:
  1. The _output tensor_ must be a 1-D vector with the trailing dim > 1,
     e.g. `tensor<1x1x4xi32`,
  2. The trailing dim in the _input tensor_ must be > 1, e.g.
     `tensor<1x1x4i32>` would be fine, but not `tensor<1x4x1xi32>`.
If these conditions are not satisfied, gather loads are generated
instead.

Condition 1 guarantees that the iteration space of the corresponding
`linalg.generic` Op is relatively simple. That makes analysing the
indices for `tensor.extract` rather straightforward.

Condition 2 is mostly there to avoid weird vectorisation patterns
resulting in vectors like: `vector<1x1x1xi32>`. In practice, tensors
like `tensor<1x4x1xi32>` should be collapsed to `tensor<1x4xi32>` before
vectorisation, but that's beyond the scope of this patch.

If needed, both conditions can be relaxed. I've not been able to find a
good motivating example for these, hence skipping. For reference,
`tosa.resize` (lowered to Linalg) was the driving example used here.

As a bonus, the test from "vectorization-unsupported.mlir" is moved to
"vectorization.mlir" with proper CHECK lines added.

Differential Revision: https://reviews.llvm.org/D141998

Co-authored-by: Diego Caballero <diegocaballero@google.com>
20 months ago[libc] Partially implement 'quick_exit' for the GPU
Joseph Huber [Mon, 20 Feb 2023 19:42:08 +0000 (13:42 -0600)]
[libc] Partially implement 'quick_exit' for the GPU

This patch adds a partial implementation of `quick_exit` for the GPU
target. This is mainly done to test object libraries for the GPU and
will be expanded later. This will simply cause the threads to terminate
on the GPU without returning an error code. This functionality will be
added later to facilitate unit tests.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D144421

20 months ago[Serialization] Don't warn when a deserialized category is equivalent to an existing...
Volodymyr Sapsai [Thu, 16 Feb 2023 01:02:28 +0000 (17:02 -0800)]
[Serialization] Don't warn when a deserialized category is equivalent to an existing one.

A single class allows multiple categories to be defined for it. But if
two of such categories have the same name, we emit a warning. It's not a
hard error but a good indication of a potential mistake.

With modules, we can end up with the same category in different modules.
Diagnosing such a situation has little value as the categories in
different modules are equivalent and don't reflect the usage of the same
name for different purposes. When we deserialize a duplicate category,
compare it to an existing one and warn only when the new one is
different.

rdar://104582081

Differential Revision: https://reviews.llvm.org/D144149

20 months ago[DAGCombine] Fix an ICE in combineMinNumMaxNum(...)
Cameron McInally [Wed, 22 Feb 2023 18:36:11 +0000 (10:36 -0800)]
[DAGCombine] Fix an ICE in combineMinNumMaxNum(...)

65420c8041f4 introduced an ICE in combineMinNumMaxNum(...) when
combineMinNumMaxNumImpl(...) returns an SDValue(). Make sure to check that a
value is returned before trying to perform an FNEG on it.

GitHub Issue: #60924

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D144571

20 months ago[RISCV] XTHeadMemPair: Fix invalid mempair combine for types other than i32/i64
Manolis Tsamis [Wed, 22 Feb 2023 18:57:01 +0000 (19:57 +0100)]
[RISCV] XTHeadMemPair: Fix invalid mempair combine for types other than i32/i64

A mistake in the control flow of performMemPairCombine resulted in paired
loads/stores for types that were not supported by the instructions (i8/i16).
These loads/stores could not match the constraints of the patterns defined
in the THead td file and the compiler would throw a 'Cannot select' error.

This is now fixed and two new test functions have been added in xtheadmempair.ll
which would previously crash the compiler. The compiler was additionally tested
with a wide range of benchmarks and no issues were observed.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D144559

20 months ago[libc] Implement ntohl and ntohs
Raman Tenneti [Wed, 22 Feb 2023 18:32:09 +0000 (10:32 -0800)]
[libc] Implement ntohl and ntohs

Per spec:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohl.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohs.html

Co-authored-by: Jeff Bailey <jbailey@google.com>
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D144506