Commit Graph

436098 Commits

Author SHA1 Message Date
Sourabh Singh Tomar 396ed327bb [flang][OpenMP] Lower OpenMP `taskgroup` construct
Lower Fortran OpenMP `taskgroup` to FIR + OpenMP Dialect.

Reviewed By: kiranchandramohan, peixin

Differential Revision: https://reviews.llvm.org/D133918
2022-09-16 21:07:47 +05:30
Dave Lee 6e450d1347 [lldb] Use SWIG_fail in python-typemaps.swig (NFC)
When attempting to use SWIG's `-builtin` flag, there were a few compile
failures caused by a mismatch between return type and return value. In those
cases, the return type was `int` but many of the type maps assume returning
`NULL`/`nullptr` (only the latter caused compile failures).

This fix abstracts failure paths to use the `SWIG_fail` macro, which performs
`goto fail;`. Each of the generated functions contain a `fail` label, which
performs any resource cleanup and returns the appropriate failure value.

This change isn't strictly necessary at this point, but seems like the right
thing to do, and for anyone who tries `-builtin` later, it resolves those
issues.

Differential Revision: https://reviews.llvm.org/D133961
2022-09-16 08:25:01 -07:00
Dmitry Preobrazhensky ef8feb6359 [AMDGPU][MC][NFC] Correct error message
Differential Revision: https://reviews.llvm.org/D134028
2022-09-16 18:22:08 +03:00
Matheus Izvekov 591452eb23
NFC: [clang] add template AST test for make_integer_seq and type_pack_element
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D133261
2022-09-16 17:12:49 +02:00
Zahira Ammarguellat 1b69ce1208 Currently the options ‘ffast-math’ and ‘ffp-contract’ are connected.
When ‘ffast-math’ is set, ffp-contract is altered this way:
-ffast-math/ Ofast -> ffp-contract=fast
-fno-fast-math -> if ffp-contract= fast then ffp-contract=on else
ffp-contract unchanged

This differs from gcc which doesn’t connect the two options.

Connecting these two options in clang, resulted in spurious warnings
when the user combines these two options -ffast-math -fno-fast-math; see
issue https://github.com/llvm/llvm-project/issues/54625.

The issue is that the ‘ffast-math’ option is an on/off flag, but the
‘ffp-contract’ is an on/off/fast flag. So when ‘fno-fast-math’ is used
there is no obvious value for ‘ffp-contract’. What should the value of
ffp-contract be for -ffp-contract=fast -fno-fast-math and -ffast-math
-ffp-contract=fast -fno-fast-math? The current logic sets ffp-contract
back to on in these cases. This doesn’t take into account that the value
of ffp-contract is modified by an explicit ffp-contract` option.
This patch is proposing a set of rules to apply when ffp-contract',
ffast-math and fno-fast-math are combined. These rules would give the
user the expected behavior and no diagnostic would be needed.

See RFC
https://discourse.llvm.org/t/rfc-making-ffast-math-option-unrelated-to-ffp-contract-option/61912
2022-09-16 11:08:41 -04:00
Matheus Izvekov 00ce271712
[clang] extend getCommonSugaredType to merge sugar nodes
This continues D111283 by extending the getCommonSugaredType
implementation to also merge non-canonical type nodes.

We merge these nodes by going up starting from the canonical
node, calculating their merged properties on the way.

If we reach a pair that is too different, or which we could not
otherwise unify, we bail out and don't try to keep going on to
the next pair, in effect striping out all the remaining top-level
sugar nodes. This avoids mismatching 'companion' nodes, such as
ElaboratedType, so that they don't end up elaborating some other
unrelated thing.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D130308
2022-09-16 17:04:10 +02:00
Nico Weber 6fe8c433ba [gn build] port 2d52c6bfae more (follow-up to 41c79d0b6d, __tuple split) 2022-09-16 10:49:18 -04:00
Sander de Smalen bd4935c175 [AArch64][SME] Implement ABI for calls from streaming-compatible functions.
When a function is streaming-compatible and calls a function with a normal or streaming
interface, it may need to enable/disable stremaing mode before the call, and
needs to restore PSTATE.SM after the call.

This patch implements this with a Pseudo node that gets expanded to a
conditional branch and smstart/smstop node.

More details about the SME attributes and design can be found
in D131562.

Reviewed By: aemerson

Differential Revision: https://reviews.llvm.org/D131578
2022-09-16 14:48:37 +00:00
Sander de Smalen 4fc2c922fe [AArch64][SME] Document SME ABI implementation in LLVM
Adds a design document for implementing the SME ABI in LLVM. This document
can be used as a reference for follow-up patches that attempt to implement
the ABI.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D131562
2022-09-16 14:48:37 +00:00
Sanjay Patel 6174da2299 [InstCombine] reduce code duplication in foldICmpMulConstant(); NFC 2022-09-16 10:39:54 -04:00
Matheus Izvekov 67e2298311
[clang] use getCommonSugar in an assortment of places
For this patch, a simple search was performed for patterns where there are
two types (usually an LHS and an RHS) which are structurally the same, and there
is some result type which is resolved as either one of them (typically LHS for
consistency).

We change those cases to resolve as the common sugared type between those two,
utilizing the new infrastructure created for this purpose.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D111509
2022-09-16 16:36:00 +02:00
Simon Pilgrim 89e4cb603d [X86] Add missing (unsupported) zmm vector move classes
Although unsupported on HSW, we reuse this model for KNL which does require them

Noticed when running the cost model fuzz script from D103695 with -mcpu=knl
2022-09-16 15:31:26 +01:00
Liqiang Tao 2e37557fde StackProtector: ensure stack checks are inserted before the tail call
The IR stack protector pass should insert stack checks before the tail
calls not only the musttail calls. So that the attributes `ssqreq` and
`tail call`, which are emited by llvm-opt, could be both enabled by
llvm-llc.

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D133860
2022-09-16 22:24:46 +08:00
Muiez Ahmed 1b445cada5 [SystemZ][z/OS] define REMOVE_ALL_USE_DIRECTORY_ITERATOR (libc++)
This patch fixes the z/OS build by using the first implementation of __remove_all since we don't have access to the openat() family of POSIX functions.

Differential Revision: https://reviews.llvm.org/D132948
2022-09-16 10:22:21 -04:00
Mark de Wever c632ee1c5d [libc++] Shows the detailed compiler version info.
The libc++ pre-commit CI uses Clang nightly builds. Currently it's not
possible to determine the exact version used since CMake doesn't show
this information by default. Instead use the --version flag to get this
information.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D133122
2022-09-16 16:15:36 +02:00
Sander de Smalen b00c36c295 [AArch64][SME] Implement ABI for calls to/from streaming functions.
This patch implements the ABI for calls from:

  Normal -> Streaming
  Normal -> Streaming-compatible
  Streaming -> Normal
  Streaming -> Streaming-compatible
  Streaming -> Streaming

The compiler inserts SMSTART/SMSTOP instructions before and after the call,
depending on the required transition.

More details about the SME attributes and design can be found
in D131562.

Reviewed By: aemerson

Differential Revision: https://reviews.llvm.org/D131576
2022-09-16 14:07:47 +00:00
Florian Hahn 6b86b481e3
[AArch64] Use tbl for truncating vector FPtoUI conversions.
On AArch64, doing the vector truncate separately after the fptoui
conversion can be lowered more efficiently using tbl.4, building on
D133495.

https://alive2.llvm.org/ce/z/T538CC

Depends on D133495

Reviewed By: t.p.northover

Differential Revision: https://reviews.llvm.org/D133496
2022-09-16 14:57:43 +01:00
sstwcw e5964223d9 [clang-format] Fix template arguments in macros
Fixes https://github.com/llvm/llvm-project/issues/57738

old
```
#define FOO(typeName, realClass)                               \
  {                                                            \
#typeName, foo < FooType>(new foo <realClass>(#typeName))  \
  }
```
new
```
#define FOO(typeName, realClass)                                \
  { #typeName, foo<FooType>(new foo<realClass>(#typeName)) }
```

Previously, when an UnwrappedLine began with a hash in a macro
definition, the program incorrectly assumed the line was a preprocessor
directive.  It should be stringification.

The rule in spaceRequiredBefore was added in 8b5297117b.  Its purpose is
to add a space in an include directive.  It also added a space to a
template opener when the line began with a stringification hash.  So we
changed it.

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D133954
2022-09-16 13:30:46 +00:00
sstwcw 2183fe2160 [clang-format] Parse the else part of `#if 0`
Fixes https://github.com/llvm/llvm-project/issues/57539

Previously things outside of `#if` blocks were parsed as if only the
first branch of the conditional compilation branch existed, unless the
first condition is 0.  In that case the outer parts would be parsed as
if nothing inside the conditional parts existed.  Now we use the second
conditional branch if the first condition is 0.

Reviewed By: owenpan

Differential Revision: https://reviews.llvm.org/D133647
2022-09-16 13:30:46 +00:00
Adrian Vogelsgesang c9cffdde39 [libunwind] Fix usage of `_dl_find_object` on 32-bit x86
On 32-bit x86, `_dl_find_object` also returns a `dlfo_eh_dbase` address.
So far, compiling against a version of `_dl_find_object` which returns a
`dlfo_eh_dbase` was blocked using a `#if` + `#error`. This commit now
removes this compile time assertion and simply ignores the returned
`dlfo_eh_dbase`. All test cases are passing on a 32-bit build now.

According to https://www.gnu.org/software/libc/manual/html_node/Dynamic-Linker-Introspection.html,
`dlfo_eh_dbase` should be the base address for all DW_EH_PE_datarel
relocations. However, glibc/elf/dl-find_object.h says that eh_dbase
is the relocated DT_PLTGOT value. I don't understand how those two
statements fit together, but to fix 32-bit x86, ignoring `dlfo_eh_dbase`
seems to be good enough.

Fixes #57733

Differential Revision: https://reviews.llvm.org/D133846
2022-09-16 06:29:49 -07:00
Mark de Wever c0ac3c1142 [NFC][libc++][test] Uses public functions.
Replaces std::__format_context_create with the public wrapper
test_format_context_create.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D133781
2022-09-16 14:57:21 +02:00
Simon Pilgrim f8fa04295f [CostModel][X86] Add CostKinds handling for vector integer comparisons
These were based off a mixture of vector integer add/sub costs and the numbers from the 'cost-tables vs llvm-mca' script from D103695 - the extra costs for different predicates are still proving tricky to implement, but I've gotten most costs to within +/1 now - the AVX512 are tricky as we still don't handle predicate results properly, so most of these were done by hand.
2022-09-16 13:03:41 +01:00
Joseph Huber 292cb114b0 [Libomptarget] Revert changes to AMDGPU plugin destructors
These patches exposed a lot of problems in the AMD toolchain. Rather
than keep it broken we should revert it to its old semi-functional
state. This will prevent us from using device destructors but should
remove some new bugs. In the future this interface should be changed
once these problems are addressed more correctly.

This reverts commit ed0f218115.

This reverts commit 2b7203a359.

Fixes #57536

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D133997
2022-09-16 06:55:51 -05:00
Florian Hahn 8491d01cc3
[AArch64] Lower vector trunc using tbl.
Similar to using tbl to lower vector ZExts, tbl4 can be used to lower
vector truncates.

The initial version support i32->i8 conversions.

Depends on D120571

Reviewed By: t.p.northover

Differential Revision: https://reviews.llvm.org/D133495
2022-09-16 12:42:49 +01:00
Aaron Ballman c7c0ce7d9e Fix the clang Sphinx bot
This addresses failures introduced by:
https://lab.llvm.org/buildbot/#/builders/92/builds/32809

It also fixes a secondary issue that crept in after the above build
started failing.
2022-09-16 07:19:30 -04:00
Kadir Cetinkaya 23ace26e0d
[clang(d)] Include/Exclude CLDXC options properly
This handles the new CLDXC options that was introduced in
https://reviews.llvm.org/D128462 inside clang-tooling to make sure cl driver
mode is not broken.

Fixes https://github.com/clangd/clangd/issues/1292.

Differential Revision: https://reviews.llvm.org/D133962
2022-09-16 12:20:22 +02:00
Matheus Izvekov 1d1a98e9a0
Revert "[clang] use getCommonSugar in an assortment of places"
This reverts commit aff1f6310e.
2022-09-16 12:03:34 +02:00
Matheus Izvekov aff1f6310e
[clang] use getCommonSugar in an assortment of places
For this patch, a simple search was performed for patterns where there are
two types (usually an LHS and an RHS) which are structurally the same, and there
is some result type which is resolved as either one of them (typically LHS for
consistency).

We change those cases to resolve as the common sugared type between those two,
utilizing the new infrastructure created for this purpose.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D111509
2022-09-16 11:55:40 +02:00
Nikita Popov b4309800e9 [CodeGen] Don't zero callee-save registers with zero-call-used-regs (PR57692)
Callee save registers must be preserved, so -fzero-call-used-regs
should not be zeroing them. The previous implementation only did
not zero callee save registers that were saved&restored inside the
function, but we need preserve all of them.

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

Differential Revision: https://reviews.llvm.org/D133946
2022-09-16 11:52:29 +02:00
Stanislav Mekhanoshin e540965915 [AMDGPU] Added __builtin_amdgcn_ds_bvh_stack_rtn
Differential Revision: https://reviews.llvm.org/D133966
2022-09-16 02:42:09 -07:00
Matheus Izvekov 55e6078d21
NFC: remove accidental inclusion of libcxx test changes
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
2022-09-16 11:39:49 +02:00
Johannes Reifferscheid 78f4a02aef Fixes for D133947. 2022-09-16 11:38:30 +02:00
Johannes Reifferscheid d7c606f5b7 Fix bufferization of collapse_shape of subviews with size 1 dims.
Currently, there's an optimization that claims dimensions of size 1 are always
contiguous. This is not necessarily the case for subviews.

```
Input:

[
  [
    [0, 1],
    [2, 3]
  ],
  [
    [4, 5]
    [6, 7]
  ]
]

Subview:

  [
    [
      [0, 1],
    ],
    [
      [4, 5]
    ]
  ]
```

The old logic treats this subview as contiguous, when it is not.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D134026
2022-09-16 11:32:30 +02:00
Florian Hahn 9f2c39418b
[AArch64] Add tests with 2 x tbl2 for v8i8 and nonconst masks.
Extra tests for D133491.
2022-09-16 10:25:27 +01:00
Matheus Izvekov 989f76ce90
[clang] template / auto deduction deduces common sugar
After upgrading the type deduction machinery to retain type sugar in
D110216, we were left with a situation where there is no general
well behaved mechanism in Clang to unify the type sugar of multiple
deductions of the same type parameter.

So we ended up making an arbitrary choice: keep the sugar of the first
deduction, ignore subsequent ones.

In general, we already had this problem, but in a smaller scale.
The result of the conditional operator and many other binary ops
could benefit from such a mechanism.

This patch implements such a type sugar unification mechanism.

The basics:

This patch introduces a `getCommonSugaredType(QualType X, QualType Y)`
method to ASTContext which implements this functionality, and uses it
for unifying the results of type deduction and return type deduction.
This will return the most derived type sugar which occurs in both X and
Y.

Example:

Suppose we have these types:
```
using Animal = int;
using Cat = Animal;
using Dog = Animal;

using Tom = Cat;
using Spike = Dog;
using Tyke = Dog;
```
For `X = Tom, Y = Spike`, this will result in `Animal`.
For `X = Spike, Y = Tyke`, this will result in `Dog`.

How it works:

We take two types, X and Y, which we wish to unify as input.
These types must have the same (qualified or unqualified) canonical
type.

We dive down fast through top-level type sugar nodes, to the
underlying canonical node. If these canonical nodes differ, we
build a common one out of the two, unifying any sugar they had.
Note that this might involve a recursive call to unify any children
of those. We then return that canonical node, handling any qualifiers.

If they don't differ, we walk up the list of sugar type nodes we dived
through, finding the last identical pair, and returning that as the
result, again handling qualifiers.

Note that this patch will not unify sugar nodes if they are not
identical already. We will simply strip off top-level sugar nodes that
differ between X and Y. This sugar node unification will instead be
implemented in a subsequent patch.

This patch also implements a few users of this mechanism:
* Template argument deduction.
* Auto deduction, for functions returning auto / decltype(auto), with
  special handling for initializer_list as well.

Further users will be implemented in a subsequent patch.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D111283
2022-09-16 11:20:10 +02:00
Florian Hahn 5871f18827
[AArch64] Lower extending uitofp using tbl.
On AArch64, doing the zero-extend separately first can be lowered more
efficiently using tbl, building on D120571.

https://alive2.llvm.org/ce/z/8Je595

Depends on D120571

Reviewed By: t.p.northover

Differential Revision: https://reviews.llvm.org/D133494
2022-09-16 10:20:25 +01:00
Alex Zinenko f096e72ce6 [mlir] switch bufferization to use strided layout attribute
Bufferization already makes the assumption that buffers pass function
boundaries in the strided form and uses the corresponding affine map layouts.
Switch it to use the recently introduced strided layout instead to avoid
unnecessary casts when bufferizing further operations to the memref dialect
counterparts that now largely rely on the strided layout attribute.

Depends On D133947

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D133951
2022-09-16 10:56:50 +02:00
Alex Zinenko 46b90a7b5d [mlir] make remaining memref dialect ops produce strided layouts
The three following ops in the memref dialect: transpose, expand_shape,
collapse_shape, have been originally designed to operate on memrefs with
strided layouts but had to go through the affine map representation as the type
did not support anything else. Make these ops produce memref values with
StridedLayoutAttr instead now that it is available.

Depends On D133938

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D133947
2022-09-16 10:56:48 +02:00
Alex Zinenko 2791162b01 [mlir] make memref.subview produce strided layout
Memref subview operation has been initially designed to work on memrefs with
strided layouts only and has never supported anything else. Port it to use the
recently added StridedLayoutAttr instead of extracting the strided from
implicitly from affine maps.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D133938
2022-09-16 10:56:46 +02:00
Nikita Popov 57c7bb3ec8 [libcxx] Use interface library for libcxx-abi-shared
The libc++.so linker script generation uses the IMPORTED_LIBNAME
target property on libcxx-abi-shared. However, libcxx-abi-shared
is not an interface library and as such cannot have an
IMPORTED_LIBNAME target property.

Convert libcxx-abi-shared into an imported interface library
and use IMPORTED_LIBNAME in place of IMPORTED_LOCATION. This makes
linker script generation work correctly with system-libcxxabi.

I believe this fixes the issue that D131037 was intended to fix.

Differential Revision: https://reviews.llvm.org/D133566
2022-09-16 10:13:39 +02:00
Dmitry Makogon 7acc1f1fb1 [Test] Add tests showing instcombine sinking opportunity (NFC)
InstCombine could sink instruction to NCD of its users.
2022-09-16 15:06:00 +07:00
jacquesguan 71e52a125c [mlir][Math] Add constant folder for SinOp.
This patch adds constant folder for SinOp by using sin/sinf of libm.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D133915
2022-09-16 14:30:05 +08:00
Zequan Wu 8704281c56 [LLDB][NativePDB] Global ctor and dtor should be global decls.
This fixes a crash that mistaken global ctor/dtor as funciton methods.

Differential Revision: https://reviews.llvm.org/D133446
2022-09-15 22:35:58 -07:00
Lang Hames 9cd28d3f11 [ORC-RT] Update COFF, ELF support after ExecutorAddrDiff change in 4c43483186. 2022-09-15 22:26:36 -07:00
Vitaly Buka f0c2ffa8f8 [msan] Add msan-insert-check DEBUG_COUNTER 2022-09-15 21:52:58 -07:00
Fangrui Song 45b85aebdb [Driver][test] Disable hip-link-bc-to-bc.hip
As it was disabled due to unsupported feature "clang-driver" before.
2022-09-15 21:41:18 -07:00
Dave Lee ab755e6562 [lldb] Improve formatting of skipped categories message (NFC) 2022-09-15 20:39:25 -07:00
jacquesguan cbd7bc66c4 [ORC-RT] Remove wrong getValue of ExecutorAddrDiff. 2022-09-16 11:18:27 +08:00
jacquesguan 461d49909c [RISCV][test] Add precommit test for D132923. 2022-09-16 11:06:04 +08:00
Fangrui Song 9e1c1ecb14 [HIP][test] Avoid %T
%T is a deprecated lit feature. It refers to the parent directory.
When two tests in test/Driver refer to the same `%T/foo`, they are racy with each other.
%t includes the test name and is safe for use.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D133998
2022-09-15 19:58:42 -07:00