platform/upstream/llvm.git
22 months ago[Serialization] Correctly handle special files when deserializing
John Brawn [Mon, 24 Apr 2023 14:35:37 +0000 (15:35 +0100)]
[Serialization] Correctly handle special files when deserializing

This was supposed to be part of my previous commit, but I accidentally
pushed an old version of the patch.

22 months ago[clang][dataflow] Use existing accessors to check for copy and move assignment ops.
Martin Braenne [Mon, 24 Apr 2023 13:11:02 +0000 (13:11 +0000)]
[clang][dataflow] Use existing accessors to check for copy and move assignment ops.

Reviewed By: gribozavr2

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

22 months ago[VP] IR expansion for fabs/fsqrt/fma/fmadd
Simon Pilgrim [Mon, 24 Apr 2023 14:14:06 +0000 (15:14 +0100)]
[VP] IR expansion for fabs/fsqrt/fma/fmadd

Add basic handling for VP ops that can expand to FP intrinsics

Fixes #60464

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

22 months ago[Clang] Accept and forward `-fconvergent-functions` in the driver
Joseph Huber [Mon, 24 Apr 2023 14:10:31 +0000 (09:10 -0500)]
[Clang] Accept and forward `-fconvergent-functions` in the driver

Currently the `-fconvergent-functions` option is primarily used by GPU
toolchains to enforce convergent operations in line with the semantics.
This option previously was only supported via `-Xclang` and would show
up as unused if passed to the driver. This patch allows the driver to
forward it. This is mostly useful for users wishing to target GPU
toolchains directly via `--target=` without an offloading runtime.

Reviewed By: JonChesterfield, MaskRay

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

22 months ago[LLD][COFF] Add /inferasanlibs to lld-link as ignored flag
Alvin Wong [Sun, 23 Apr 2023 15:58:24 +0000 (23:58 +0800)]
[LLD][COFF] Add /inferasanlibs to lld-link as ignored flag

MSVC link.exe added this flag and MS STL started using this flag in
.drectve [1] when compiling with Clang with asan enabled, as reported
on https://github.com/llvm/llvm-project/issues/56300. This causes issues
with lld-link because it rejects any unknown flags in .drective sections.

As dc07867dc9991c982bd3441da19d6fcc16ea54d6 noted that, when using Clang
as the driver it explicitly passes the proper asan libraries. Therefore
it should be acceptable to ignore this flag in lld-link to at least
unbreak building with clang-cl and linking with lld-link.

[1]: https://github.com/microsoft/STL/blob/faaf094ee16bcbfb2c8d612fdb9334bcdef2fd0a/stl/inc/__msvc_sanitizer_annotate_container.hpp#L35

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

22 months ago[LLD][COFF] Print object file name for unsupported directives
Alvin Wong [Sun, 23 Apr 2023 15:52:55 +0000 (23:52 +0800)]
[LLD][COFF] Print object file name for unsupported directives

This is a small QoL improvement suggested by FrancescElies in
https://github.com/llvm/llvm-project/issues/56300#issuecomment-1172104966.

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

22 months ago[dataflow] HTMLLogger: fix off-by-one in the BB listing
Sam McCall [Fri, 21 Apr 2023 19:22:35 +0000 (21:22 +0200)]
[dataflow] HTMLLogger: fix off-by-one in the BB listing

The indexes of analysis state within a BB element is a bit odd:
  BB.0 is the initial state
  BB.1 is the state after the first element
etc

This means we have N+1 states and we need N+1 elements in the BB list.
We add a dummy element at the beginning rather than the end, because we want
selecting a CFG element to show the state *afterwards*.
For example, if we click on an expr, we want to be able to see its value model!

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

22 months ago[NFC][PowerPC] Added a test case to show extra clear instructions.
Stefan Pintilie [Fri, 21 Apr 2023 20:12:07 +0000 (16:12 -0400)]
[NFC][PowerPC] Added a test case to show extra clear instructions.

Added a number of functions that have a clear instruction that is not
actually required. This test is added first and then a patch will be
added later in order to remove the unnecessary instructions.

22 months ago[DAG] Add ISD::isExtVecInRegOpcode helper.
Simon Pilgrim [Mon, 24 Apr 2023 13:47:05 +0000 (14:47 +0100)]
[DAG] Add ISD::isExtVecInRegOpcode helper.

Match ISD::ANY_EXTEND_VECTOR_INREG\ZERO_EXTEND_VECTOR_INREG\SIGN_EXTEND_VECTOR_INREG opcodes

22 months ago[X86] Support EVT types in supportedVectorShift* helpers. NFCI.
Simon Pilgrim [Mon, 24 Apr 2023 13:15:14 +0000 (14:15 +0100)]
[X86] Support EVT types in supportedVectorShift* helpers. NFCI.

Move the isSimple() check inside the helpers to avoid a lot of extra checking in a future patch.

22 months ago[InstSimplify] Support all instructions in simplifyWithOpReplaced()
Nikita Popov [Mon, 24 Apr 2023 13:22:20 +0000 (15:22 +0200)]
[InstSimplify] Support all instructions in simplifyWithOpReplaced()

Instead of hardcoding a few instruction kinds, use the generic
interface now that we have it.

The primary effect of this is that intrinsics are now supported.

It's worth noting that this is still limited in that it does not
support vectors, so we can't remove e.g. existing fshl special
cases.

22 months ago[InstSimplify] Add additional test for select icmp of umin (NFC)
Nikita Popov [Mon, 24 Apr 2023 13:08:41 +0000 (15:08 +0200)]
[InstSimplify] Add additional test for select icmp of umin (NFC)

This is a representative test for the simplifyWithOpReplaced()
fold on intrinsics.

22 months ago[Serialization] Place command line defines in the correct file
John Brawn [Mon, 24 Apr 2023 13:07:41 +0000 (14:07 +0100)]
[Serialization] Place command line defines in the correct file

Fix several problems related to serialization causing command line
defines to be reported as being built-in defines:
 * When serializing the <built-in> and <command line> files don't
   convert them into absolute paths.
 * When deserializing SM_SLOC_BUFFER_ENTRY we need to call
   setHasLineDirectives in the same way as we do for
   SM_SLOC_FILE_ENTRY.
 * When created suggested predefines based on the current command line
   options we need to add line markers in the same way that
   InitializePreprocessor does.
 * Adjust a place in clangd where it was implicitly relying on command
   line defines being treated as builtin.

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

22 months agoRemove known-stale projects from the open projects page
Aaron Ballman [Mon, 24 Apr 2023 12:49:48 +0000 (08:49 -0400)]
Remove known-stale projects from the open projects page

This removes or modifies:

Undefined behavior checking -- we've got UBSan and it's well-known
enough that we don't need to call it out specifically as a need.

Improve target support -- this is largely already complete.

Use clang libraries to extend Ragel with a JIT -- this wasn't really
related to improving Clang.

C++1y feature work -- now talks about C++20, C++2b, and C2x instead.

Universal driver -- the bug report linked to by the UniversalDriver
web page has been closed since 2017.

XML representation of the AST -- we removed this functionality in 2013
and replaced it with a JSON representation a few years later. That is a
best-effort project.

22 months ago[LLD][ELF][AArch64] Add AArch64 short range thunk support
Peter Smith [Mon, 17 Apr 2023 17:37:05 +0000 (18:37 +0100)]
[LLD][ELF][AArch64] Add AArch64 short range thunk support

The AArch64 branch immediate instruction has a 128MiB range. This
makes it suitable for use a short range thunk in the same way as
short thunks are implemented in Arm and PPC. This patch adds
support for short range thunks to AArch64.

Adding short range thunk support should mean that OutputSections
can grow to nearly 256 MiB in size without needing long-range
indirect branches.

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

22 months ago[Clang][Sema] Fix invalid cast when validating SVE types within CheckVariableDeclarat...
Paul Walker [Thu, 20 Apr 2023 16:45:56 +0000 (16:45 +0000)]
[Clang][Sema] Fix invalid cast when validating SVE types within CheckVariableDeclarationType.

Fixes #62087

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

22 months ago[Vectorize] Fix vectorization, scalarization and folding of llvm.is.fpclass
Jay Foad [Fri, 21 Apr 2023 13:11:31 +0000 (14:11 +0100)]
[Vectorize] Fix vectorization, scalarization and folding of llvm.is.fpclass

llvm.is.fpclass is different from other vectorizable intrinsics in that
it is overloaded on an argument type, not on the return type.

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

22 months ago[Vectorize] Pre-commit tests for D148905
Jay Foad [Fri, 21 Apr 2023 14:43:02 +0000 (15:43 +0100)]
[Vectorize] Pre-commit tests for D148905

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

22 months ago[lldb][tests] TestPreferredName.py: add missing import
Michael Buch [Mon, 24 Apr 2023 12:40:23 +0000 (08:40 -0400)]
[lldb][tests] TestPreferredName.py: add missing import

22 months ago[InstSimplify] sdiv a (1 srem b) --> a
Siyuan Zhu [Mon, 24 Apr 2023 12:29:37 +0000 (14:29 +0200)]
[InstSimplify] sdiv a (1 srem b) --> a

Extend the existing fold for division by zero or one to use known
bits, so it catches additional patterns like division by
(1 srem b).

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

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

22 months agoFix file info comment; NFC
Aaron Ballman [Mon, 24 Apr 2023 12:35:43 +0000 (08:35 -0400)]
Fix file info comment; NFC

There is no TargetInfoImpl class any longer.

22 months ago[lldb][tests] TestPreferredName.py: Fix for older compilers
Michael Buch [Mon, 24 Apr 2023 12:29:48 +0000 (08:29 -0400)]
[lldb][tests] TestPreferredName.py: Fix for older compilers

This only works as of D145803, where we re-point the
`DW_AT_type` based on existence of `[[clang::preferred_name]]`

22 months ago[InstSimplify] Test case for D149001 (NFC)
Siyuan Zhu [Mon, 24 Apr 2023 12:28:12 +0000 (14:28 +0200)]
[InstSimplify] Test case for D149001 (NFC)

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

22 months agoMinor cleanup of the Open Projects page
Aaron Ballman [Mon, 24 Apr 2023 12:25:28 +0000 (08:25 -0400)]
Minor cleanup of the Open Projects page

Sets the charset to UTF-8, fixes the page title, replaces mention of
cfe-dev with Discourse, points out Discord and IRC.

22 months ago[InstSimplify] Move more folds into simplifyDivRem() (NFCI)
Nikita Popov [Mon, 24 Apr 2023 12:25:45 +0000 (14:25 +0200)]
[InstSimplify] Move more folds into simplifyDivRem() (NFCI)

The threading folds are the same for div/rem and the isDivZero()
fold only differes in the return value.

This should be NFC, but as this slightly shuffles around the
order of the folds it might not be exactly the same.

22 months ago[AArch64] Precommit test
Jingu Kang [Mon, 24 Apr 2023 12:23:57 +0000 (13:23 +0100)]
[AArch64] Precommit test

This patch precommits tests for:

https://reviews.llvm.org/D148347

22 months ago[FuncSpec] Track the return values of specializations.
Alexandros Lamprineas [Tue, 28 Mar 2023 17:16:19 +0000 (18:16 +0100)]
[FuncSpec] Track the return values of specializations.

To track the return values of specializations, we need to invalidate all
the lattice values across the use-def chain which originates from the
callsites, recompute and propagate.

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

22 months ago[InstSimplify] Drop redundant div fold (NFCI)
Nikita Popov [Mon, 24 Apr 2023 10:56:09 +0000 (12:56 +0200)]
[InstSimplify] Drop redundant div fold (NFCI)

This is nowadays handled generically via isDivZero() and icmp
simplification, specifically the computeConstantRange() based
logic.

22 months ago[bazel] test files for IRDL 8ac8c922fb3f15706f5cb1db2cc655d30b095766
Mikhail Goncharov [Mon, 24 Apr 2023 11:58:09 +0000 (13:58 +0200)]
[bazel] test files for IRDL 8ac8c922fb3f15706f5cb1db2cc655d30b095766

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

22 months ago[AArch64][DAGCombiner]: combine <2xi64> mul add/sub.
Hassnaa Hamdi [Thu, 20 Apr 2023 05:34:05 +0000 (05:34 +0000)]
[AArch64][DAGCombiner]: combine <2xi64> mul add/sub.

64-bit vector mul is not supported in NEON,
so we use the SVE's mul.
To improve the performance, we can go one step further,
and use SVE's add/sub, so that we can use SVE's mla/mls.
That works on these patterns:
add v1, (mul v2, v3)
sub v1, (mul v2, v3)

Reviewed By: david-arm, paulwalker-arm

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

22 months ago[InstSimplify] Move fold into isDivZero() (NFCI)
Nikita Popov [Mon, 24 Apr 2023 10:40:46 +0000 (12:40 +0200)]
[InstSimplify] Move fold into isDivZero() (NFCI)

This is a special case where we know the division result is zero.
For the unsigned case this is handled by generic icmp code, for
the signed case we do need to special case it.

22 months agoRevert "[Coverity] Fix explicit null dereferences"
Tom Weaver [Mon, 24 Apr 2023 10:14:10 +0000 (11:14 +0100)]
Revert "[Coverity] Fix explicit null dereferences"

This reverts commit 22b23a5213b57ce1834f5b50fbbf8a50297efc8a.

This commit caused the following two build bots to start failing:
https://lab.llvm.org/buildbot/#/builders/216/builds/20322
https://lab.llvm.org/buildbot/#/builders/123/builds/18511

22 months ago[RISCV] Add SiFive extension support
Kito Cheng [Fri, 17 Jun 2022 09:32:51 +0000 (17:32 +0800)]
[RISCV] Add SiFive extension support

Add SiFive extension support
Depends on D147934

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

22 months ago[RISCV] Support LLVM IR intrinsics for xsfvcp extension.
Nelson Chu [Wed, 18 May 2022 09:26:16 +0000 (02:26 -0700)]
[RISCV] Support LLVM IR intrinsics for xsfvcp extension.

The sf.vc.x and sf.vc.i intrinsics don't have any vector types in the output
and inputs, but the intrinsic spec said that we still need to add vetvli for
them. Therefore, we need to encode the VTYPE to these IR names.

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

22 months ago[llvm][docs] Update "Adding a Builder" docs
David Spickett [Fri, 21 Apr 2023 09:53:50 +0000 (10:53 +0100)]
[llvm][docs] Update "Adding a Builder" docs

* Move step 8 to later, after worker credentials have
  been added to the buildmaster.
* Added command for starting the worker, in addition
  to creating the worker. The latter only sets up the
  directories.
* Noted that in step 6, it is expected that you get a
  refused connection.
* Stated that the connection should be tried once,
  and the worker then stopped.

We could mention that repeated connections with invalid
credentials will result in an IP ban, but it's probably
detail people don't need here.

If it did happen, then you would not know until you tried
the later steps. At which point you are already in contact
with Galina, who is the person who would help you with that
issue in any case.

Reviewed By: gkistanova

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

22 months ago[CodeGenPrepare] Estimate liveness of loop invariants when checking for address foldi...
Momchil Velikov [Mon, 24 Apr 2023 08:50:28 +0000 (09:50 +0100)]
[CodeGenPrepare] Estimate liveness of loop invariants when checking for address folding profitability

When checking the profitability of folding an address computation
into a memory instruction, the compiler tries to determine the liveness
of the values, comprising the address, at the point of the memory instruction.
This patch improves on the live variable estimates by including
the loop invariants which are references in the loop body.

Reviewed By: dmgreen

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

22 months ago[clang] Return `std::string_view` from `TargetInfo::getClobbers()`
Stoorx [Fri, 21 Apr 2023 14:33:15 +0000 (17:33 +0300)]
[clang] Return `std::string_view` from `TargetInfo::getClobbers()`

Change the return type of `getClobbers` function from `const char*`
to `std::string_view`. Update the function usages in CodeGen module.

The reasoning of these changes is to remove unsafe `const char*`
strings and prevent unnecessary allocations for constructing the
`std::string` in usages of `getClobbers()` function.

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

22 months ago[clang] Remove unnecessary virtual inheritance in `TargetInfo`
Stoorx [Fri, 21 Apr 2023 21:06:58 +0000 (00:06 +0300)]
[clang] Remove unnecessary virtual inheritance in `TargetInfo`

Since the `TargetInfo` has no diamond-like inheritance diagram,
the `virtual` keyword is not necessary.

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

22 months ago[clang] Make access to submodules via `iterator_range`
Stoorx [Tue, 18 Apr 2023 20:49:00 +0000 (23:49 +0300)]
[clang] Make access to submodules via `iterator_range`

In file `clang/lib/Basic/Module.cpp` the `Module` class had `submodule_begin()` and `submodule_end()` functions to retrieve corresponding iterators for private vector of Modules. This commit removes mentioned functions, and replaces all of theirs usages with `submodules()` function and range-based for-loops.

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

22 months ago[clang] Mark CWG2009 as N/A
Vlad Serebrennikov [Mon, 24 Apr 2023 08:52:31 +0000 (11:52 +0300)]
[clang] Mark CWG2009 as N/A

[[https://wg21.link/p1787 | P1787]]: CWG2331 is resolved by defining lookup from complete-class contexts and out-of-line member definitions. The rest of CWG2009 is resolved by making it ill-formed NDR for forward lookup outside a complete-class context to change the results (before overload resolution, to avoid differences in instantiation).
Wording: The result of the search is the declaration set of S(N, T). If it is an invalid set, the program is ill-formed. If it differs from the result of a search in T for N from immediately after the class-specifier of T, the program is ill-formed, no diagnostic required. ([class.member.lookup]/7)

Reviewed By: #clang-language-wg, shafik

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

22 months agoRevert "[SCEV] Precise trip multiples"
Joshua Cao [Mon, 24 Apr 2023 08:39:13 +0000 (01:39 -0700)]
Revert "[SCEV] Precise trip multiples"

This reverts commit 027a4c8b96c7f97df8e98b1dac069b956810ab94.

22 months ago[llvm][ADT] Fix Any linker error with multiple compilers
Sebastian Neubauer [Mon, 24 Apr 2023 08:34:59 +0000 (10:34 +0200)]
[llvm][ADT] Fix Any linker error with multiple compilers

Citing the comment in the source:

Define the type id and initialize with a non-zero value.
Initializing with a zero value means the variab can end up in either the
.data or the .bss section. This can lead to multiple definition linker
errors when some object files are compiled with a compiler that puts the
variable into .data but they are linked to object files from a different
compiler that put the variable into .bss. To prevent this issue from
happening, initialize the variable with a non-zero value, which forces
it to land in .data (because .bss is zero-initialized).

Fixes https://github.com/llvm/llvm-project/issues/62270
A regression of D139974.

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

22 months agoDrop MLIR Bazel dependency on LLVM Analysis
Alex Zinenko [Mon, 24 Apr 2023 07:33:51 +0000 (07:33 +0000)]
Drop MLIR Bazel dependency on LLVM Analysis

This is no longer necessary after f5425c128a30 and significatly
decreases the build time and the binary footprint.

Reviewed By: Dinistro

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

22 months ago[Pipelines] Don't run ForceFunctionAttrs post-link
Nikita Popov [Fri, 21 Apr 2023 08:17:03 +0000 (10:17 +0200)]
[Pipelines] Don't run ForceFunctionAttrs post-link

This is effectively a debugging pass to adjust function attributes.
I don't think it makes sense to run it in the post-link pipeline.

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

22 months ago[bazel] update for ba38640b9901d239e32e12c6569f7364d00af922
Mikhail Goncharov [Mon, 24 Apr 2023 07:35:06 +0000 (09:35 +0200)]
[bazel] update for ba38640b9901d239e32e12c6569f7364d00af922

22 months ago[SCEV] Precise trip multiples
Joshua Cao [Tue, 11 Apr 2023 06:52:06 +0000 (23:52 -0700)]
[SCEV] Precise trip multiples

We currently have getMinTrailingZeros(), from which we can get a SCEV's
multiple by computing 1 << MinTrailingZeroes. However, this only gets us
multiples that are a power of 2. This patch introduces a way to get max
constant multiples that are not just a power of 2. The logic is similar
to that of getMinTrailingZeros. getMinTrailingZeros is replaced by
computing the max constant multiple, and counting the number of trailing
bits.

This is applied in two places:

1) Computing unsigned constant ranges. For example, if we have i8
   {10,+,10}<nuw>, we know the max constant it can be is 250.

2) Computing trip multiples as shown in SCEV output. This is useful if
   for example, we are unrolling a loop by a factor of 5, and we know
   the trip multiple is 5, then we don't need a loop epilog.

If the code sees that a SCEV does not have <nuw>, it will fall back to
finding the max multiple that is a power of 2. Multiples that are a
power of 2 will still be a multiple even after the SCEV overflows.

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

22 months ago[SCEV] Add trip multiple tests
Joshua Cao [Fri, 14 Apr 2023 07:23:04 +0000 (00:23 -0700)]
[SCEV] Add trip multiple tests

22 months ago[SCEV] Add ranges tests
Joshua Cao [Fri, 14 Apr 2023 07:01:44 +0000 (00:01 -0700)]
[SCEV] Add ranges tests

22 months ago[Clang][Driver] Handle LoongArch multiarch tuples
WANG Xuerui [Mon, 24 Apr 2023 07:18:46 +0000 (15:18 +0800)]
[Clang][Driver] Handle LoongArch multiarch tuples

This follows v1.00 of the [[ https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html | LoongArch Toolchain Conventions ]],
but notably with [[ https://github.com/loongson/LoongArch-Documentation/pull/80 | this patch ]]
applied (a proper version bump to v2.00 was not done, so it is
indistinguishable from the "original" but now incompatible v1.00
otherwise).

Only `loongarch64` is implemented in `Linux::getMultiarchTriple`
because support for LA32 and ILP32* ABIs are incomplete right now.

The Debian sysroot layout is based on Han Gao's recent porting effort,
specifically the ghcr.io/rabenda/beige:loong64-v23-preview-20230330
container image.

Reviewed By: SixWeining

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

22 months ago[flang] Turn on use-desc-for-alloc by default
Jean Perier [Mon, 24 Apr 2023 07:04:57 +0000 (09:04 +0200)]
[flang] Turn on use-desc-for-alloc by default

Currently, local allocatables and contiguous/scalar pointers (and some
other conditions) are lowered to a set of independent variables in FIR
(one for the address, one for each bound and one for character length).
The intention was to help LLVM get rids of descriptors. But LLVM knows
how to do that anyway in those cases:

```
subroutine foo(x)
 real, target :: x(100)
 real, pointer, contiguous :: p(:)
 p => x
 call bar(p(50))
end subroutine
```

The output fir the option on or off is the same after llvm opt -O1,
there is no descriptor anymore, the indirection is removed.

```
define void @foo_(ptr %0) local_unnamed_addr {
  %2 = getelementptr [100 x float], ptr %0, i64 0, i64 49
  tail call void @bar_(ptr %2)
  ret void
}
```

So the benefit of not using a descriptor in lowering is questionable,
and although it is abstracted as much as possible in the so called
MutableBoxValue class that represent allocatable/pointer in lowering
it is still causing bugs from time to time, and will also be a bit
problematic when emitting debug info for the pointer/allocatable.

In HLFIR lowering, the simplification to always use a descriptor in
lowering was already made. This patch allows decorrelating the impact
from this change from the bigger impact HLFIR will have so that it
is easier to get feedback if this causes performance issues.

The lowering tests relying on the previous behavior are only updated
to set back this option to true. The reason is that I think we should
preserve coverage of the code dealing with the "non descriptor" approach
in lowering until we actually get rid of it. The other reason is that
the test will have to be or are already covered by equivalent HLFIR
tests, which use descriptors.

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

22 months ago[TableGen] Make getRegisterValueType stricter about HwModes.
Craig Topper [Mon, 24 Apr 2023 06:28:23 +0000 (23:28 -0700)]
[TableGen] Make getRegisterValueType stricter about HwModes.

I don't think this code would work correctly if the register class
used used HwModes. Add asserts to make sure it's not used with HwModes.

Also fix a long outdated comment on the function.

22 months ago[lsan][test] Obtaining page size using sysconf(_SC_PAGESIZE)
zhanglimin [Mon, 24 Apr 2023 06:27:37 +0000 (14:27 +0800)]
[lsan][test] Obtaining page size using sysconf(_SC_PAGESIZE)

The effectiveness of the mprotect function depends on whether
the first argument is aligned to a page boundary. If mprotect
doesn't work, the kernel will not generate a SIGSEGV signal for
the process when the calling process tries to access memory in
a manner that violates the protection. If so, this test fails.

The problem for this test is that it uses a fixed 4 kB page size
and is aligned. This fails when the page size is not 4 kB. For
example, this fails on LoongArch which uses a 16 kB pagesize.

Reviewed By: SixWeining, xen0n, MaskRay, vitalybuka

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

22 months ago[LoopInfo] SFINAE mechanism for hoist into check
Christian Ulmann [Mon, 24 Apr 2023 06:20:46 +0000 (06:20 +0000)]
[LoopInfo] SFINAE mechanism for hoist into check

This commit introduces an SFINAE mechanism to make the LLVM hoist into
check member function not leak into the users of LoopInfo.

Depends on D148235

Reviewed By: ftynse

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

22 months ago[LoopInfo] Move generic LoopInfo into own files
Christian Ulmann [Mon, 24 Apr 2023 06:06:45 +0000 (06:06 +0000)]
[LoopInfo] Move generic LoopInfo into own files

This commit splits the generic part of `LoopInfo` into separate files.
These new `GenericLoopInfo` files are located in `llvm/Support` to be inline
with `GenericDomTree`.

Furthermore, this change ensures that MLIR's Bazel build does not have
to link against `LLVMAnalysis` just to use these template headers.

Depends on D148219

Reviewed By: ftynse

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

22 months ago[X86][tablgen] Fix typo in comments, NFC
Shengchen Kan [Mon, 24 Apr 2023 05:24:25 +0000 (13:24 +0800)]
[X86][tablgen] Fix typo in comments, NFC

22 months agoRemove `-action` suffix from the tag defining an Action: it is redundant here
Mehdi Amini [Sun, 23 Apr 2023 22:07:51 +0000 (16:07 -0600)]
Remove `-action` suffix from the tag defining an Action: it is redundant here

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

22 months ago[TableGen] Remove unused ForceMode and CodeGen fields from TypeInfer. NFC
Craig Topper [Mon, 24 Apr 2023 03:32:14 +0000 (20:32 -0700)]
[TableGen] Remove unused ForceMode and CodeGen fields from TypeInfer. NFC

As well as the ForceMode field in PatternToMatch.

22 months agoClean come dead code
Wang, Xin10 [Mon, 24 Apr 2023 00:45:43 +0000 (20:45 -0400)]
Clean come dead code

These codes deleted are dead code, we never go into it.
1. In AggressiveAntiDepBreaker.cpp, have assert AntiDepReg != 0.
2. IfConversion.cpp, Kind can only be one unique value, so isFalse && isRev
    can never be true.
3. DAGCombiner.cpp, at line 3675, we have considered the condition like
```
  // fold (sub x, c) -> (add x, -c)
  if (N1C) {
    return DAG.getNode(ISD::ADD, DL, VT, N0,
                       DAG.getConstant(-N1C->getAPIntValue(), DL, VT));
  }
```
4. ScheduleDAGSDNodes.cpp, we have Latency > 1 at line 663
5. MasmParser.cpp, code exists in a switch-case block which decided by
    the value FirstTokenKind, at line 1621, FirstTokenKind could only be
    one of AsmToken::Dollar, AsmToken::At and AsmToken::Identifier.

Reviewed By: skan

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

22 months ago[NFC] Fix typos in APFloat.h
Fabian Tschopp [Sun, 23 Apr 2023 15:15:16 +0000 (17:15 +0200)]
[NFC] Fix typos in APFloat.h

represnted -> represented

Reviewed By: lattner

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

22 months ago[NFC][clang] Fix static analyzer concerns
Manna, Soumi [Sun, 23 Apr 2023 22:17:28 +0000 (18:17 -0400)]
[NFC][clang] Fix static analyzer concerns

Reported by Coverity:

AUTO_CAUSES_COPY
Unnecessary object copies can affect performance.

1. Inside "SemaDeclCXX.cpp" file, in <unnamed>::DiagnoseUninitializedFields(clang::Sema &, clang::CXXConstructorDecl const *): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.

2. Inside "ClangAttrEmitter.cpp" file, in clang::EmitClangAttrParsedAttrImpl(llvm::RecordKeeper &, llvm::raw_ostream &): Using the auto keyword without an & causes the copy of an object of type pair.

3. Inside "Marshallers.h" file, in clang::ast_matchers::dynamic::internal::MapAnyOfBuilderDescriptor::buildMatcherCtor(clang::ast_matchers::dynamic::SourceRange, llvm::ArrayRef<clang::ast_matchers::dynamic::ParserValue>, clang::ast_matchers::dynamic::Diagnostics *): Using the auto keyword without an & causes the copy of an object of type ParserValue.

4. Inside "CGVTables.cpp" file, in clang::CodeGen::CodeGenModule::GetVCallVisibilityLevel(clang::CXXRecordDecl const *, llvm::DenseSet<clang::CXXRecordDecl const *, llvm::DenseMapInfo<clang::CXXRecordDecl const *, void>> &): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.

5. Inside "ASTContext.cpp" file, in hasTemplateSpecializationInEncodedString(clang::Type const *, bool): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.

6. Inside "ComputeDependence.cpp" file, in clang::computeDependence(clang::DependentScopeDeclRefExpr *): Using the auto keyword without an & causes the copy of an object of type TemplateArgumentLoc.

Reviewed By: tahonermann, erichkeane

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

22 months ago[MemProf] Don't use constexpr via lambda capture due to MSVC issues (NFC)
Teresa Johnson [Sun, 23 Apr 2023 22:00:18 +0000 (15:00 -0700)]
[MemProf] Don't use constexpr via lambda capture due to MSVC issues (NFC)

Modifies a104e27030587507a711cef0e2b0ddb447fe68fe slightly to switch a
constexpr used via a lambda capture to a const, due to issues with MSVC.
See https://reviews.llvm.org/D140949#inline-1438809 for context.

22 months ago[test] Simplify libunwind REQUIRES
Fangrui Song [Sun, 23 Apr 2023 21:58:46 +0000 (14:58 -0700)]
[test] Simplify libunwind REQUIRES

22 months ago[bazel] Port for 8ac8c922fb3f15706f5cb1db2cc655d30b095766
Haojian Wu [Sun, 23 Apr 2023 21:54:29 +0000 (23:54 +0200)]
[bazel] Port for 8ac8c922fb3f15706f5cb1db2cc655d30b095766

22 months ago[lld][AArch64] Add BTI landing pad to PLT when it is accessed by a range extension...
Daniel Kiss [Sun, 23 Apr 2023 21:16:11 +0000 (23:16 +0200)]
[lld][AArch64] Add BTI landing pad to PLT when it is accessed by a range extension thunk.

Adding BTI to those PLT's which accessed with by a range extension thunk due to those preform an indirect call.
Fixes: #62140
Reviewed By: MaskRay

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

22 months ago[CostModel][X86] getMemoryOpCost - increase cost of sub-32-bit vector load/stores
Simon Pilgrim [Sun, 23 Apr 2023 20:48:25 +0000 (21:48 +0100)]
[CostModel][X86] getMemoryOpCost - increase cost of sub-32-bit vector load/stores

For 8-bit/16-bit vector loads/stores we scalarize and transfer to/from the vector unit, or use the (usually slow) PINSR/PEXTR instructions.

Fixes #59867

22 months ago[SLP][X86] Add test coverage for Issue #59867
Simon Pilgrim [Sun, 23 Apr 2023 20:20:44 +0000 (21:20 +0100)]
[SLP][X86] Add test coverage for Issue #59867

22 months agoRemove ExplicitEmulatedTLS and simplify -femulated-tls handling
Fangrui Song [Sun, 23 Apr 2023 18:55:12 +0000 (11:55 -0700)]
Remove ExplicitEmulatedTLS and simplify -femulated-tls handling

Currently clangDriver passes -femulated-tls and -fno-emulated-tls to cc1.
cc1 forwards the option to LLVMCodeGen and ExplicitEmulatedTLS is used
to decide the value. Simplify this by moving the Clang decision to
clangDriver and moving the LLVM decision to InitTargetOptionsFromCodeGenFlags.

22 months ago[mlir][Vector] Add 16x16 strategy to vector.transpose lowering.
Hanhan Wang [Thu, 20 Apr 2023 21:46:40 +0000 (14:46 -0700)]
[mlir][Vector] Add 16x16 strategy to vector.transpose lowering.

It adds a `shuffle_16x16` strategy LowerVectorTranspose and renames `shuffle` to `shuffle_1d`. The idea is similar to 8x8 cases in x86Vector::avx2. The general algorithm is:

```
interleave 32-bit lanes using
    8x _mm512_unpacklo_epi32
    8x _mm512_unpackhi_epi32
interleave 64-bit lanes using
    8x _mm512_unpacklo_epi64
    8x _mm512_unpackhi_epi64
permute 128-bit lanes using
   16x _mm512_shuffle_i32x4
permute 256-bit lanes using again
   16x _mm512_shuffle_i32x4
```

After the first stage, they got transposed to

```
 0  16   1  17   4  20   5  21   8  24   9  25  12  28  13  29
 2  18   3  19   6  22   7  23  10  26  11  27  14  30  15  31
32  48  33  49 ...
34  50  35  51 ...
64  80  65  81 ...
...
```

After the second stage, they got transposed to

```
 0  16  32  48 ...
 1  17  33  49 ...
 2  18  34  49 ...
 3  19  35  51 ...
64  80  96 112 ...
65  81  97 114 ...
66  82  98 113 ...
67  83  99 115 ...
...
```

After the thrid stage, they got transposed to

```
  0  16  32  48   8  24  40  56  64  80  96  112 ...
  1  17  33  49 ...
  2  18  34  50 ...
  3  19  35  51 ...
  4  20  36  52 ...
  5  21  37  53 ...
  6  22  38  54 ...
  7  23  39  55 ...
128 144 160 176 ...
129 145 161 177 ...
...
```

After the last stage, they got transposed to

```
0  16  32  48  64  80  96 112 ... 240
1  17  33  49  66  81  97 113 ... 241
2  18  34  50  67  82  98 114 ... 242
...
15  31  47  63  79  96 111 127 ... 255
```

Reviewed By: dcaballe

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

22 months ago[X86] Add DAG test coverage for Issue #59867 patterns
Simon Pilgrim [Sun, 23 Apr 2023 17:39:45 +0000 (18:39 +0100)]
[X86] Add DAG test coverage for Issue #59867 patterns

22 months ago[BOLT] Remove unsupported ELF type reloc handling
Nathan Sidwell [Fri, 21 Apr 2023 17:42:20 +0000 (13:42 -0400)]
[BOLT] Remove unsupported ELF type reloc handling

Drop unsupported ELF format reloc handling -- RewriteInstance lacks
this flexibility elsewhere.

Reviewed By: rafauler

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

22 months ago[ARM] Fix qsat for armv5te/armv6 + thumb-mode
David Green [Sun, 23 Apr 2023 16:20:28 +0000 (17:20 +0100)]
[ARM] Fix qsat for armv5te/armv6 + thumb-mode

This is a Thumb1 target, so will not have qsat instructions available. There
was a mismatch between hasBaseDSP and the instruction patterns when +dsp was
present, which is set by clang (but maybe shouldn't be). The target being
thumb1-only should override that, implying that it does not have any qadds.

Fixes #62273

22 months ago[clang-tidy] Modernize FileState (NFC)
Kazu Hirata [Sun, 23 Apr 2023 16:07:23 +0000 (09:07 -0700)]
[clang-tidy] Modernize FileState (NFC)

22 months ago[mlir][irdl] Add IRDL registration
Mathieu Fehr [Fri, 10 Mar 2023 21:53:06 +0000 (22:53 +0100)]
[mlir][irdl] Add IRDL registration

This patch add support for loading IRDL dialects at runtime
with `mlir-opt`.

Given the following `dialect.irdl` file:
```mlir
module {
  irdl.dialect @cmath {
    irdl.type @complex {
      %0 = irdl.is f32
      %1 = irdl.is f64
      %2 = irdl.any_of(%0, %1)
      irdl.parameters(%2)
    }

    irdl.operation @norm {
      %0 = irdl.any
      %1 = irdl.parametric @complex<%0>
      irdl.operands(%1)
      irdl.results(%0)
    }
}
```

the IRDL file can be loaded with the `mlir-opt --irdl-file=dialect.irdl`
command, and the following file can then be parsed:

```mlir
func.func @conorm(%p: !cmath.complex<f32>, %q: !cmath.complex<f32>) -> f32 {
  %norm_p = "cmath.norm"(%p) : (!cmath.complex<f32>) -> f32
  %norm_q = "cmath.norm"(%q) : (!cmath.complex<f32>) -> f32
  %pq = arith.mulf %norm_p, %norm_q : f32
  return %pq : f32
}
```

To minimize the size of this patch, the operation, attribute, and type verifier are all always returning `success()`.

Depends on D144692

Reviewed By: rriddle, Mogball, mehdi_amini

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

22 months ago[X86] X86FixupInstTunings - add VPERMILPDri -> VSHUFPDrri mapping
Simon Pilgrim [Sun, 23 Apr 2023 10:48:50 +0000 (11:48 +0100)]
[X86] X86FixupInstTunings - add VPERMILPDri -> VSHUFPDrri mapping

Similar to the original VPERMILPSri -> VSHUFPSrri mapping added in D143787, replacing VPERMILPDri -> VSHUFPDrri should never be any slower and saves an encoding byte.

The sibling VPERMILPDmi -> VPSHUFDmi mapping is trickier as we need the same shuffle mask in every lane (and it needs to be adjusted) - I haven't attempted that yet but we can investigate it in the future if there's interest.

Fixes #61060

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

22 months agoRe-apply "[ORC][LLJIT] Use JITLink by default on ELF/x86-64." with fixes.
Lang Hames [Fri, 21 Apr 2023 04:45:46 +0000 (04:45 +0000)]
Re-apply "[ORC][LLJIT] Use JITLink by default on ELF/x86-64." with fixes.

This reapplies 85c649bc02a, which was reverted in 35767e43d62 due to failures
with some example programs. The fix was to add export_executable_symbols to the
example programs.

22 months ago[X86] X86FixupInstTuning.cpp - fix comment in ProcessVPERMILPSri. NFC.
Simon Pilgrim [Sun, 23 Apr 2023 09:32:04 +0000 (10:32 +0100)]
[X86] X86FixupInstTuning.cpp - fix comment in ProcessVPERMILPSri. NFC.

PERMILPS is only available on AVX or later (VEX/EVEX encoding)

22 months ago[X86] Precommit test case for D148980.
Luo, Yuanke [Sun, 23 Apr 2023 04:49:29 +0000 (12:49 +0800)]
[X86] Precommit test case for D148980.

22 months ago[TableGen] Remove unused method form ScopeMatcher. NFC
Craig Topper [Sun, 23 Apr 2023 07:44:39 +0000 (00:44 -0700)]
[TableGen] Remove unused method form ScopeMatcher. NFC

22 months ago[Coverity] Fix uninitialized scalar members in MC
Akshay Khadse [Sun, 23 Apr 2023 07:28:59 +0000 (15:28 +0800)]
[Coverity] Fix uninitialized scalar members in MC

This change fixes static code analysis errors

Reviewed By: pengfei

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

22 months ago[X86] Transform `(cmp eq/ne trunc(X), C)` -> `(cmp eq/ne X, Zext(C))`
Noah Goldstein [Sun, 23 Apr 2023 06:57:55 +0000 (01:57 -0500)]
[X86] Transform `(cmp eq/ne trunc(X), C)` -> `(cmp eq/ne X, Zext(C))`

This previously existed for `C == 0`, but is mostly beneficial for any
`C`.

There is a slight codesize cost as we get more imm32 (as opposed to
imm8) constants in some cases. But the benefit is was get less imm16
constants (LCP stalls) and save instructions in some vec -> scalar
codegen.

Reviewed By: RKSimon

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

22 months ago[symbolizer] Change error message if module not found (recommit)
Serge Pavlov [Sun, 23 Apr 2023 06:35:35 +0000 (06:35 +0000)]
[symbolizer] Change error message if module not found (recommit)

This is a recommit of 75f1f158812d, reverted in 7a443b1c493d, because
it caused compilation error in
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp.
The error was fixed by Kasimir Georgiev in de4c038c7ba2, but this
commit was reverted in de088dd3a0aa, because the initial commit was
reverted.

This commit reverts both the reverting commits, 7a443b1c493d and
de088dd3a0aa.

Original commit message is below.

If llvm-symbolize did not find module, the error looked like:

    LLVMSymbolizer: error reading file: No such file or directory

This message does not follow common practice: LLVMSymbolizer is not an
utility name. Also the message did not not contain the name of missed file.

With this change the error message looks differently:

    llvm-symbolizer: error: 'abc': No such file or directory

This format is closer to messages produced by other utilities and allow
proper coloring.

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

22 months ago[TableGen] Intialize vector with constructor instead of assign. NFC
Craig Topper [Sun, 23 Apr 2023 05:37:57 +0000 (22:37 -0700)]
[TableGen] Intialize vector with constructor instead of assign. NFC

22 months ago[Coverity] Fix explicit null dereferences
Akshay Khadse [Sun, 23 Apr 2023 04:06:54 +0000 (12:06 +0800)]
[Coverity] Fix explicit null dereferences

This change fixes static code analysis errors

Reviewed By: skan

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

22 months ago[TableGen] Re-work FactorNodes to avoid an extra temporary vector.
Craig Topper [Sun, 23 Apr 2023 04:04:55 +0000 (21:04 -0700)]
[TableGen] Re-work FactorNodes to avoid an extra temporary vector.

Instead of copying elements to the NewOptionsToMatchVector, we
now shift down elements in OptionsToMatch as we create holes by
pulling out equal matchers. After we finish processing the vector,
we'll trim the size to just the elements that are still in use.

22 months ago[Driver][NFC] Simplify code.
Jianjian GUAN [Fri, 21 Apr 2023 02:27:17 +0000 (10:27 +0800)]
[Driver][NFC] Simplify code.

Reviewed By: benshi001, jhuber6

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

22 months ago[Bazel] Rename LLVMTableGenGlobalISel to TableGenGlobalISel
NAKAMURA Takumi [Wed, 19 Apr 2023 14:27:20 +0000 (23:27 +0900)]
[Bazel] Rename LLVMTableGenGlobalISel to TableGenGlobalISel

22 months ago[CMake] Target/DirectX: Update deps
NAKAMURA Takumi [Sun, 23 Apr 2023 01:26:26 +0000 (10:26 +0900)]
[CMake] Target/DirectX: Update deps

22 months ago[CMake] Reorder deps and reformat
NAKAMURA Takumi [Sun, 23 Apr 2023 02:07:22 +0000 (11:07 +0900)]
[CMake] Reorder deps and reformat

22 months agoRevert "[OpenMP] Introduce kernel environment"
Shilei Tian [Sun, 23 Apr 2023 00:56:35 +0000 (20:56 -0400)]
Revert "[OpenMP] Introduce kernel environment"

This reverts commit 35cfadfbe2decd9633560b3046fa6c17523b2fa9.

It makes a couple of buildbots unhappy because of the following test failures:
- `Transforms/OpenMP/add_attributes.ll'`
- `mapping/declare_mapper_target_data.cpp` on AMDGPU

22 months ago[OpenMP] Introduce kernel environment
Shilei Tian [Sun, 23 Apr 2023 00:45:00 +0000 (20:45 -0400)]
[OpenMP] Introduce kernel environment

This patch introduces per kernel environment. Previously, flags such as execution mode are set through global variables with name like `__kernel_name_exec_mode`. They are accessible on the host by reading the corresponding global variable, but not from the device. Besides, some assumptions, such as no nested parallelism, are not per kernel basis, preventing us applying per kernel optimization in the device runtime.

This is a combination and refinement of patch series D116908D116909, and D116910.

Reviewed By: jdoerfert

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

22 months ago[compiler-rt] [test] [asan] Skip the static asan testsuites on mingw targets
Martin Storsjö [Fri, 14 Apr 2023 09:26:14 +0000 (09:26 +0000)]
[compiler-rt] [test] [asan] Skip the static asan testsuites on mingw targets

Mingw only provides a dynamically linked CRT (contrary to
MSVC/clang-cl), so it is expected that the static asan test
configuration doesn't work.

Skip adding these test suites in mingw configurations.

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

22 months ago[libunwind] [SEH] Clear DISPATCHER_CONTEXT when initializing a cursor
Martin Storsjö [Tue, 18 Apr 2023 12:42:35 +0000 (15:42 +0300)]
[libunwind] [SEH] Clear DISPATCHER_CONTEXT when initializing a cursor

We only initialize a few fields in DISPATCHER_CONTEXT - don't leave
the rest in an uninitialized state; make sure the whole struct is
in a deterministic state.

This makes nondeterministic failures deterministic, for some cases
relating to forced unwinding on aarch64/arm (which requires filling
in parsing of the xdata for finding the exception handler and LSDA).

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

22 months ago[M68k] Override `CanLowerReturn` to fix assertion with large return
Ian Douglas Scott [Sat, 22 Apr 2023 19:01:28 +0000 (12:01 -0700)]
[M68k] Override `CanLowerReturn` to fix assertion with large return

If it couldn't fit the return value in two registers, this caused an
error during codegen. It seems this method is implemented in other
backends but not here, and allows it to pass return values in memory
when it isn't able to do so in registers.

Seems to fix compilation of Rust code with certain return types:
https://github.com/rust-lang/rust/issues/89498

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

22 months ago[X86] Fold PSHUF(VSHIFT(X,Y)) -> VSHIFT(PSHUF(X),Y)
Simon Pilgrim [Sat, 22 Apr 2023 19:02:27 +0000 (20:02 +0100)]
[X86] Fold PSHUF(VSHIFT(X,Y)) -> VSHIFT(PSHUF(X),Y)

PSHUFD/PSHUFLW/PSHUFHW can act as a vector move / folded load, notably helping simplify pre-AVX cases in particular.

This is a much milder alternative to refactoring canonicalizeShuffleWithBinOps to support SSE shifts nodes.

22 months ago[libc++] Remove the chrono include from algorithm
Ian Anderson [Sat, 15 Apr 2023 00:51:41 +0000 (17:51 -0700)]
[libc++] Remove the chrono include from algorithm

algorithm's include of chrono causes include cycles:

```
algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> algorithm

algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> array -> algorithm

algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> unordered_map -> algorithm

algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> vector -> algorithm
```

This is a problem for clang modules after the std mega module is broken up, because it becomes a module cycle which is a hard error.

All of the includes in the `__chrono` and `__format` headers are being used and so can't be removed. algorithm's include of chrono is already removed in C++20, whereas the array, string_view, unordered_map, vector includes of algorithm aren't removed until C++23 (and it's 4x the includes that would need removing). Unconditionally remove the chrono include from algorithm in all versions, so that the module breakup can happen (the module has to apply to all C++ versions).

Reviewed By: Mordante, #libc

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

22 months ago[X86] Add PERMILPD tuning test coverage for Issue #61060
Simon Pilgrim [Sat, 22 Apr 2023 16:49:51 +0000 (17:49 +0100)]
[X86] Add PERMILPD tuning test coverage for Issue #61060

22 months ago[X86] combineSetCCMOVMSK - fold allof movmskps/movmskpd -> testps/testpd
Simon Pilgrim [Sat, 22 Apr 2023 16:00:35 +0000 (17:00 +0100)]
[X86] combineSetCCMOVMSK - fold allof movmskps/movmskpd -> testps/testpd

Fixes #60007

22 months ago[X86] LowerBUILD_VECTOR - narrow 256/512-bit vector containing undef/freeze(undef...
Simon Pilgrim [Sat, 22 Apr 2023 14:27:40 +0000 (15:27 +0100)]
[X86] LowerBUILD_VECTOR - narrow 256/512-bit vector containing undef/freeze(undef)/zero in the upper half

Fixes #62286

22 months ago[X86] LowerBUILD_VECTOR - fold build_vector(undef,freeze(undef)) -> freeze(undef)
Simon Pilgrim [Sat, 22 Apr 2023 13:54:27 +0000 (14:54 +0100)]
[X86] LowerBUILD_VECTOR - fold build_vector(undef,freeze(undef)) -> freeze(undef)

Noticed while triaging #62286

22 months agoRevert "Revert "Fix handling of special and large vals in expand pattern for `round...
Ramiro Leal-Cavazos [Sat, 22 Apr 2023 14:15:26 +0000 (07:15 -0700)]
Revert "Revert "Fix handling of special and large vals in expand pattern for `round`" and "Add pattern that expands `math.roundeven` into `math.round` + arith""

This reverts commit 87cef78fa1c7bf6efc544e990894a6062d56abec.

The issue in the original revert is that a lit test expecting a `-nan`
as an output was failing on M2. Since the IEEE 754-2008 standard does
not require the sign to be printed when displaying a `nan`, this
commit changes the `CHECK` for `-nan` to one that checks the result
value bitcasted to an `i32` to ensure that input is being left
unchanged. This check should now be independent of platform being used
to run test.

Reviewed By: jpienaar, mehdi_amini

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