platform/upstream/llvm.git
22 months ago[TTI] Migrate getOperandInfo to OperandVaueInfo [nfc]
Philip Reames [Mon, 22 Aug 2022 16:59:59 +0000 (09:59 -0700)]
[TTI] Migrate getOperandInfo to OperandVaueInfo [nfc]

This is part of merging OperandValueKind and OperandValueProperties.

22 months ago[bazel][docs] Mention how to provide path to compiler
Arthur Eubanks [Mon, 22 Aug 2022 17:02:30 +0000 (10:02 -0700)]
[bazel][docs] Mention how to provide path to compiler

And some other cleanups/clarifications.

Reviewed By: saugustine

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

22 months ago[bazel] Move some CI flags into .bazelrc
Arthur Eubanks [Mon, 22 Aug 2022 17:12:10 +0000 (10:12 -0700)]
[bazel] Move some CI flags into .bazelrc

22 months ago[DebugInfo][NFC] Represent DbgValues with multiple ops in IRefLDV
Stephen Tozer [Fri, 17 Jun 2022 15:20:06 +0000 (16:20 +0100)]
[DebugInfo][NFC] Represent DbgValues with multiple ops in IRefLDV

In preparation for allowing InstrRefBasedLDV to handle DBG_VALUE_LIST,
this patch updates the internal representation that it uses to represent
debug values to store a list of values. This is one of the more
significant changes in terms of line count, but is fairly simple and
should not affect the output of this pass.

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

22 months ago[mlir:Bytecode] Fix asan failure
River Riddle [Mon, 22 Aug 2022 17:02:18 +0000 (10:02 -0700)]
[mlir:Bytecode] Fix asan failure

We were accessing the region state after it got popped from the stack.

22 months ago[AMDGPU][MC][GFX10][NFC] Consolidate tests by encoding
Dmitry Preobrazhensky [Mon, 22 Aug 2022 16:51:31 +0000 (19:51 +0300)]
[AMDGPU][MC][GFX10][NFC] Consolidate tests by encoding

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

22 months ago[TTI] Start process of merging OperandValueKind and OperandValueProperties [nfc]
Philip Reames [Mon, 22 Aug 2022 15:58:15 +0000 (08:58 -0700)]
[TTI] Start process of merging OperandValueKind and OperandValueProperties [nfc]

OperandValueKind and OperandValueProperties both provide facts about the operands of an instruction for purposes of cost modeling.  We've discussed merging them several times; before I plumb through more flags, let's go ahead and do so.

This change only adds the client side interface for getArithmeticInstrCost and makes a couple of minor changes in client code to prove that it works.  Target TTI implementations still use the split flags.  I'm deliberately splitting what could be one big change into a series of smaller ones so that I can lean on the compiler to catch errors along the way.

22 months ago[bazel] Add note about using -c opt for CI
Arthur Eubanks [Mon, 22 Aug 2022 16:36:23 +0000 (09:36 -0700)]
[bazel] Add note about using -c opt for CI

22 months agoRegisterClassInfo: Fix CSR cache invalidation
Matthias Braun [Wed, 17 Aug 2022 17:54:12 +0000 (10:54 -0700)]
RegisterClassInfo: Fix CSR cache invalidation

`RegisterClassInfo` caches information like allocation orders and reuses
it for multiple machine functions where possible. However the `MCPhysReg
*CalleeSavedRegs` field used to test whether the set of callee saved
registers changed did not work: After D28566
`MachineRegisterInfo::getCalleeSavedRegs()` can return dynamically
computed CSR sets that are only valid while the `MachineRegisterInfo`
object of the current function exists.

This changes the code to make a copy of the CSR list instead of keeping
a possibly invalid pointer around.

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

22 months agoclang/apple: Infer simulator env from -mios-simulator-version-min= flag
Nico Weber [Fri, 19 Aug 2022 18:45:32 +0000 (14:45 -0400)]
clang/apple: Infer simulator env from -mios-simulator-version-min= flag

Before this patch, open-source clang would consider
`-target x86_64-apple-darwin -mios-simulator-version-min=11.0` as
targeting the iOS simulator, due to the mios flag informing it
that we want to target iOS, and logic in the driver then realizing
that x86 iOS builds must be the simulator.

However, for `-target arm64-apple-darwin -mios-simulator-version-min=11.0`
that didn't work and clang thought that it's building for actual iOS,
and not for the simulator.

Due to this, building compiler-rt for arm64 iossim would lead to
all .o files in RTSanitizerCommonSymbolizer.iossim.dir being built
for iOS instead of for iOS simulator, and clang would ask ld64 to
link for iOS, but using the iPhoneSimulator sysroot. This would then
lead to many warnings from ld64 looking like:

    ld: warning: building for iOS, but linking in .tbd file
        (.../iPhoneSimulator.sdk/usr/lib/libc++abi.tbd) built for iOS Simulator

Worse, with ld64.lld, this diagnostic is currently an error instead
of a warning.

This patch makes it so that the presence of -mios-simulator-version-min=
now informs clang that we're building for simulator. That way, all the
.o files are built for simulator, the linker is informed that we're
building for simulator, and everything Just Works.

(Xcode's clang already behaves like this, so this makes open-source clang
match Xcode clang.)

We can now likely remove the hack to treat non-mac darwin x86 as
simulator, but doing that feels slightly risky, so I'm leaving that
for a follow-up patch.

(This patch is made necessary by the existence of arm64 macs.)

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

22 months ago[mlir] Fix compile errors with bytecode support
Goran Flegar [Mon, 22 Aug 2022 15:59:51 +0000 (17:59 +0200)]
[mlir] Fix compile errors with bytecode support

22 months ago[NFC][libc] clarify CPP folder documentation
Guillaume Chatelet [Mon, 22 Aug 2022 15:40:57 +0000 (15:40 +0000)]
[NFC][libc] clarify CPP folder documentation

22 months ago[DebugInfo][NFC] Update LDV to use generic DBG_VALUE* MI interface
Stephen Tozer [Thu, 16 Jun 2022 14:08:13 +0000 (15:08 +0100)]
[DebugInfo][NFC] Update LDV to use generic DBG_VALUE* MI interface

Currently, InstrRefLDV only handles DBG_VALUE instructions, not
DBG_VALUE_LIST, and as a result of this it handles these instructions
using functions that only work for that type of debug value, i.e. using
getOperand(0) to get the debug operand. This patch changes this to use
the generic debug value functions, such as getDebugOperand and
isDebugOffsetImm, as well as adding an IsVariadic field to the
DbgValueProperties class and a few other minor changes to acknowledge
DBG_VALUE_LISTs. Note that this patch does not add support for
DBG_VALUE_LIST here, but is a precursor to other patches that do add
that support.

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

22 months ago[libc][NFC] Use STL case for string_view
Guillaume Chatelet [Mon, 22 Aug 2022 15:25:14 +0000 (15:25 +0000)]
[libc][NFC] Use STL case for string_view

22 months ago[mlir][tensor][bufferize] Bufferize tensor.pad
Matthias Springer [Mon, 22 Aug 2022 14:59:36 +0000 (16:59 +0200)]
[mlir][tensor][bufferize] Bufferize tensor.pad

tensor.pad is lowered to tensor.generate + tensor.insert_slice during bufferization. For best performance with constant padding values, users should vectorize the IR before bufferizing it.

This change also relaxes tje restriction that no new ops that bufferize to a memory write should be added during bufferization. Since bufferization has been split into two steps a while ago (tensor copy insertion + bufferization), it is reasonable to allow this now.

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

22 months ago[mlir][linalg][transform] Support dynamic tile sizes in TileToForeachThreadOp
Matthias Springer [Mon, 22 Aug 2022 14:48:17 +0000 (16:48 +0200)]
[mlir][linalg][transform] Support dynamic tile sizes in TileToForeachThreadOp

TileToForeachThreadOp now accepts mixed SSA value operands / index attributes for tile_sizes and num_threads. (Reusing OperandsOrIntegersSizesList.) In case of an operand, a PDL_Operation must be specified that is mapped to a payload op that returns the tile size or number of threads.

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

22 months agoReapply "[NFC] Precommit test for D132255".
Denis Antrushin [Mon, 22 Aug 2022 14:00:51 +0000 (21:00 +0700)]
Reapply "[NFC] Precommit test for D132255".

Changed check line to accomodate assertion text difference on
mac and windows; added 'REQUIRES: asserts' line.

This reverts commit 89aaae57eacf77a6902ef8d4af5c92a3d6c642c2.

22 months ago[docs] Adjust the example command line in DebuggingCoroutines.rst
Chuanqi Xu [Mon, 22 Aug 2022 14:15:24 +0000 (22:15 +0800)]
[docs] Adjust the example command line in DebuggingCoroutines.rst

The original commandline example was not correct in some environments.
Adjust the example to avoid any misunderstanding.

22 months ago[X86][AVX512FP16] Add the missing const modifiers. NFCI
Phoebe Wang [Mon, 22 Aug 2022 01:59:42 +0000 (09:59 +0800)]
[X86][AVX512FP16] Add the missing const modifiers. NFCI

This patch fixes lit fails after D132342.

Reviewed By: RKSimon

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

22 months ago[DebugInfo] Handle joins PHI+Def values in InstrRef LiveDebugValues
Stephen Tozer [Tue, 17 May 2022 14:35:27 +0000 (15:35 +0100)]
[DebugInfo] Handle joins PHI+Def values in InstrRef LiveDebugValues

In the InstrRefBasedImpl for LiveDebugValues, we attempt to propagate
debug values through basic blocks in part by checking to see whether all
a variable's incoming debug values to a BB "agree", i.e. whether their
properties match and they refer to the same underlying value.

Prior to this patch, the check for agreement between incoming values
relied on exact equality, which meant that a VPHI and a Def DbgValue
that referred to the same underlying value would be seen as disagreeing.
This patch changes this behaviour to treat them as referring to the same
value, allowing the shared value to propagate into the BB.

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

22 months agoAdd N2562 to the C status page
Aaron Ballman [Mon, 22 Aug 2022 13:46:12 +0000 (09:46 -0400)]
Add N2562 to the C status page

It was originally left off thinking the paper only impacts the C
standard library, but Clang supports diagnostics for incorrect use of
a format specifier, so this paper has some frontend impacts as well.

22 months ago[lldb][ClangExpression] Remove storage-class check when creating AsmLabel
Michael Buch [Fri, 19 Aug 2022 14:11:26 +0000 (15:11 +0100)]
[lldb][ClangExpression] Remove storage-class check when creating AsmLabel

This check was put in place to prevent static functions
from translation units outside the one that the current
expression is evaluated from taking precedence over functions
in the global namespace. However, this is really a different
bug. LLDB lumps functions from all CUs into a single AST and
ends up picking the file-static even when C++ context rules
wouldn't allow that to happen.

This patch removes the check so we apply the AsmLabel to all
FunctionDecls we create from DWARF if we have a linkage name
available. This makes the code-path easier to reason about and
allows calling static functions in contexts where we previously
would've chosen the wrong function.

We also flip the XFAILs in the API test to reflect what effect
this change has.

**Testing**

* Fixed API tests and added XFAIL

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

22 months ago[lldb][Test] Replace expect() with expect_expr() in TestNamespaceLookup.py
Michael Buch [Sat, 20 Aug 2022 00:47:41 +0000 (01:47 +0100)]
[lldb][Test] Replace expect() with expect_expr() in TestNamespaceLookup.py

This will be useful in preparation for some reshuffling
of assertions in this file since we won't have to
adjust the persitent variable names during the process.

sed commands:
```
s/expect("expr -- /expect_expr("/g
s/startstr="(int) [$0-9]* = /result_type="int", result_value="/g
```

**Testing**

* API tests still pass

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

22 months ago[LAA] Add test cases where BTC can be used to rule out dependences.
Florian Hahn [Mon, 22 Aug 2022 12:11:26 +0000 (13:11 +0100)]
[LAA] Add test cases where BTC can be used to rule out dependences.

Test cases for using the backedge-taken-count to rule out dependencies between
an invariant and strided accesses.

22 months ago[analyzer] Handling non-POD multidimensional arrays in ArrayInitLoopExpr
isuckatcs [Sat, 13 Aug 2022 13:41:51 +0000 (15:41 +0200)]
[analyzer] Handling non-POD multidimensional arrays in ArrayInitLoopExpr

This patch makes it possible for lambdas, implicit copy/move ctors
and structured bindings to handle non-POD multidimensional arrays.

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

22 months ago[lldb] Silence a GCC warning about missing returns after a fully covered switch....
Martin Storsjö [Mon, 22 Aug 2022 11:53:29 +0000 (14:53 +0300)]
[lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC.

22 months ago[AArch64] Add SK_Splice fixed-width costs
David Green [Mon, 22 Aug 2022 11:44:57 +0000 (12:44 +0100)]
[AArch64] Add SK_Splice fixed-width costs

A fixed length SK_Splice shuffle vector is lowered to a Ext under
AArch64, which should have a cost of 1.

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

22 months ago[CostModel][X86] Fix a off-by-one typo in the v64i8 splice shuffle test
Simon Pilgrim [Mon, 22 Aug 2022 11:40:07 +0000 (12:40 +0100)]
[CostModel][X86] Fix a off-by-one typo in the v64i8 splice shuffle test

22 months ago[analyzer] Remove pattern matching of lambda capture initializers
isuckatcs [Tue, 16 Aug 2022 07:31:24 +0000 (09:31 +0200)]
[analyzer] Remove pattern matching of lambda capture initializers

Prior to this patch we handled lambda captures based on their
initializer expression, which resulted in pattern matching. With
C++17 copy elision the initializer expression can be anything,
and this approach proved to be fragile and a source of crashes.
This patch removes pattern matching and only checks whether the
object is under construction or not.

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

22 months ago[NFC][libc] Remove ArrayRef which is replaced with span
Guillaume Chatelet [Mon, 22 Aug 2022 10:52:14 +0000 (10:52 +0000)]
[NFC][libc] Remove ArrayRef which is replaced with span

22 months ago[CostModel][X86] Add some basic SK_Splice shuffle test coverage
Simon Pilgrim [Mon, 22 Aug 2022 10:26:30 +0000 (11:26 +0100)]
[CostModel][X86] Add some basic SK_Splice shuffle test coverage

These are currently recognised as SK_PermuteTwoSrc

22 months ago[NFC][libc] Switch File impl to span instead of ArrayRef
Guillaume Chatelet [Mon, 22 Aug 2022 10:26:48 +0000 (10:26 +0000)]
[NFC][libc] Switch File impl to span instead of ArrayRef

22 months ago[mlir][Bazel] Fix bazel build
Goran Flegar [Mon, 22 Aug 2022 10:06:47 +0000 (12:06 +0200)]
[mlir][Bazel] Fix bazel build

Add fixes for https://reviews.llvm.org/D131747

22 months ago[LLDB] Fix: make m_target_arch private
Emmmer [Mon, 22 Aug 2022 08:28:43 +0000 (16:28 +0800)]
[LLDB] Fix: make m_target_arch private

Using GetTargetArchitecture() instead of m_target_arch, and set m_target_arch to private.

Reviewed By: DavidSpickett

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

22 months ago[NFC][libc] Switch mem* tests from ArrayRef to span
Guillaume Chatelet [Mon, 22 Aug 2022 09:56:38 +0000 (09:56 +0000)]
[NFC][libc] Switch mem* tests from ArrayRef to span

22 months ago[ARM] Add a couple of MVE fixed-order-reduction tests. NFC
David Green [Mon, 22 Aug 2022 09:58:14 +0000 (10:58 +0100)]
[ARM] Add a couple of MVE fixed-order-reduction tests. NFC

22 months ago[CostModel][X86] getShuffleCost - treat SK_Splice as SK_PermuteTwoSrc
Simon Pilgrim [Mon, 22 Aug 2022 09:50:57 +0000 (10:50 +0100)]
[CostModel][X86] getShuffleCost - treat SK_Splice as SK_PermuteTwoSrc

SK_Splice should be equivalent to a PALIGNR instruction etc. - but as discussed on D132308, until full fixed vector support for SK_Splice is in place, just assume its a SK_PermuteTwoSrc.

22 months ago[libc] Allow span views over mutable data
Guillaume Chatelet [Mon, 22 Aug 2022 09:42:53 +0000 (09:42 +0000)]
[libc] Allow span views over mutable data

22 months ago[clangd] Disable IncludeCleaner for ObjC
Kadir Cetinkaya [Mon, 22 Aug 2022 08:56:57 +0000 (10:56 +0200)]
[clangd] Disable IncludeCleaner for ObjC

22 months ago[DSE] Add additional uses to tests to ensure stores be removed.
Florian Hahn [Mon, 22 Aug 2022 09:21:11 +0000 (10:21 +0100)]
[DSE] Add additional uses to tests to ensure stores be removed.

Make some tests a bit more robust with respect to future changes.

22 months ago[MLIR][GPU] Detect bounds with `arith.minsi ` in loops-to-gpu
Christian Sigg [Mon, 22 Aug 2022 08:39:49 +0000 (10:39 +0200)]
[MLIR][GPU] Detect bounds with `arith.minsi ` in loops-to-gpu

Previously, `arith.constant`, `arith.muli` and `affine.min` were supported when deriving upper loop bounds when converting parallel loops to GPU.

Reviewed By: akuegel

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

22 months ago[flang] Add bind(C) to buitlin C_PTR
Valentin Clement [Mon, 22 Aug 2022 09:12:20 +0000 (11:12 +0200)]
[flang] Add bind(C) to buitlin C_PTR

D131585 Adds couple of semantics check for the components of BIND(C)
derived-type. This would raise an error when a component is of C_PTR
type. Add `bind(c)` to the `__builtin_c_ptr` type so the wrong error
is not triggered.

Reviewed By: peixin, jeanPerier

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

22 months ago[libc] Allow construction of const span from mutable span
Guillaume Chatelet [Mon, 22 Aug 2022 08:54:13 +0000 (08:54 +0000)]
[libc] Allow construction of const span from mutable span

22 months ago[ARM] Fix bug in also_compatible_with attribute parser
Victor Campos [Fri, 19 Aug 2022 07:46:55 +0000 (08:46 +0100)]
[ARM] Fix bug in also_compatible_with attribute parser

Check ScopedPrinter pointer before attempting to print the attribute's
parsed information.

Patch by Michael Platings and Victor Campos

Reviewed By: pratlucas

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

22 months ago[mlir] Fix bots after bytecode support was added in D131747
River Riddle [Mon, 22 Aug 2022 08:31:31 +0000 (01:31 -0700)]
[mlir] Fix bots after bytecode support was added in D131747

* Fix ambiguous Twine constructor call
* Ensure shift is 64-bit (for MSVC)
* Disable bytecode tests on s390x (we don't support big endian right now)

22 months ago[reland][NFC][libc] Use span instead of ArrayRef
Guillaume Chatelet [Mon, 22 Aug 2022 08:09:23 +0000 (08:09 +0000)]
[reland][NFC][libc] Use span instead of ArrayRef

22 months agoRevert "[NFC][libc] Use span instead of ArrayRef"
Guillaume Chatelet [Mon, 22 Aug 2022 08:14:22 +0000 (08:14 +0000)]
Revert "[NFC][libc] Use span instead of ArrayRef"

This reverts commit e7b250b8a6e2bd7e2cb85e0a90d77b1a3326814b.

22 months ago[NFC][libc] Use span instead of ArrayRef
Guillaume Chatelet [Mon, 22 Aug 2022 08:09:23 +0000 (08:09 +0000)]
[NFC][libc] Use span instead of ArrayRef

22 months ago[mlir] Add initial support for a binary serialization format
River Riddle [Fri, 12 Aug 2022 03:06:33 +0000 (20:06 -0700)]
[mlir] Add initial support for a binary serialization format

This commit adds a new bytecode serialization format for MLIR.
The actual serialization of MLIR to binary is relatively straightforward,
given the very very general structure of MLIR. The underlying basis for
this format is a variable-length encoding for integers, which gets heavily
used for nearly all aspects of the encoding (given that most of the encoding
is just indexing into lists).

The format currently does not provide support for custom attribute/type
serialization, and thus always uses an assembly format fallback. It also
doesn't provide support for resources. These will be added in followups,
the intention for this patch is to provide something that supports the
basic cases, and can be built on top of.

https://discourse.llvm.org/t/rfc-a-binary-serialization-format-for-mlir/63518

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

22 months ago[SCEV] Prove condition invariance via context, try 2
Max Kazantsev [Mon, 22 Aug 2022 06:09:20 +0000 (13:09 +0700)]
[SCEV] Prove condition invariance via context, try 2

Initial implementation had too weak requirements to positive/negative
range crossings. Not crossing zero with nuw is not enough for two reasons:

- If ArLHS has negative step, it may turn from positive to negative
  without crossing 0 boundary from left to right (and crossing right to
  left doesn't count for unsigned);
- If ArLHS crosses SINT_MAX boundary, it still turns from positive to
  negative;

In fact we require that ArLHS always stays non-negative or negative,
which an be enforced by the following set of preconditions:

- both nuw and nsw;
- positive step (looks liftable);

Because of positive step, boundary crossing is only possible from left
part to the right part. And because of no-wrap flags, it is guaranteed
to never happen.

22 months ago[libc] Add a span facility
Guillaume Chatelet [Fri, 19 Aug 2022 17:52:36 +0000 (17:52 +0000)]
[libc] Add a span facility

This is intended to replace ArrayRef.

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

22 months agoRevert "[clang-format][NFC] Fix a bug in setting type FunctionLBrace"
owenca [Mon, 22 Aug 2022 04:32:50 +0000 (21:32 -0700)]
Revert "[clang-format][NFC] Fix a bug in setting type FunctionLBrace"

This reverts commit 35f7dd601d33219fafa2c0d308e187df3e36847a.

Fixes #57200.

22 months ago[Test] And one more test for PR57247
Max Kazantsev [Mon, 22 Aug 2022 06:01:35 +0000 (13:01 +0700)]
[Test] And one more test for PR57247

22 months ago[clang] Fix warning after D116203
Vitaly Buka [Mon, 22 Aug 2022 05:39:23 +0000 (22:39 -0700)]
[clang] Fix warning after D116203

The warning was:
SemaType.cpp:9469:3: error: default label in switch
which covers all enumeration values
[-Werror,-Wcovered-switch-default]

22 months ago[LoongArch][test] Regenerate loongarch_generated_funcs.test checks
wanglei [Mon, 22 Aug 2022 05:10:29 +0000 (13:10 +0800)]
[LoongArch][test] Regenerate loongarch_generated_funcs.test checks

This patch fix test failure due to D132006.

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

22 months ago[Test] One more test for PR57247
Max Kazantsev [Mon, 22 Aug 2022 05:22:49 +0000 (12:22 +0700)]
[Test] One more test for PR57247

Show that the issue also exists with positive steps.

22 months ago[RISCV] Add zihintntl instructions
Shao-Ce SUN [Mon, 22 Aug 2022 03:53:16 +0000 (11:53 +0800)]
[RISCV] Add zihintntl instructions

Reviewed By: kito-cheng

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

22 months ago[LoongArch] Support Load and Store with 14-bit signed immediate operands
gonglingqin [Mon, 22 Aug 2022 02:58:29 +0000 (10:58 +0800)]
[LoongArch] Support Load and Store with 14-bit signed immediate operands

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

22 months ago[libcxx][NFC] utilises compiler builtins for unary transform type-traits
Christopher Di Bella [Mon, 22 Aug 2022 01:07:08 +0000 (01:07 +0000)]
[libcxx][NFC] utilises compiler builtins for unary transform type-traits

Depends on D116203

Reviewed By: #libc, philnik

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

22 months ago[clang] adds unary type transformations as compiler built-ins
Christopher Di Bella [Mon, 22 Aug 2022 00:27:10 +0000 (00:27 +0000)]
[clang] adds unary type transformations as compiler built-ins

Adds

* `__add_lvalue_reference`
* `__add_pointer`
* `__add_rvalue_reference`
* `__decay`
* `__make_signed`
* `__make_unsigned`
* `__remove_all_extents`
* `__remove_extent`
* `__remove_const`
* `__remove_volatile`
* `__remove_cv`
* `__remove_pointer`
* `__remove_reference`
* `__remove_cvref`

These are all compiler built-in equivalents of the unary type traits
found in [[meta.trans]][1]. The compiler already has all of the
information it needs to answer these transformations, so we can skip
needing to make partial specialisations in standard library
implementations (we already do this for a lot of the query traits). This
will hopefully improve compile times, as we won't need use as much
memory in such a base part of the standard library.

[1]: http://wg21.link/meta.trans

Co-authored-by: zoecarver
Reviewed By: aaron.ballman, rsmith

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

22 months ago[PowerPC][Coroutines] Add tail-call check with call information for coroutines
Ting Wang [Mon, 22 Aug 2022 02:20:40 +0000 (22:20 -0400)]
[PowerPC][Coroutines] Add tail-call check with call information for coroutines

Fixes #56679.

Reviewed By: ChuanqiXu, shchenz

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

22 months ago[AArch64][NFC] Replace setOperationAction and AddPromotedToType
wanglian [Fri, 19 Aug 2022 08:37:53 +0000 (16:37 +0800)]
[AArch64][NFC] Replace setOperationAction and AddPromotedToType
with setOperationPromotedToType.

Reviewed By: dmgreen

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

22 months ago[sanitizer] use ../runtimes path to build libcxx
Vitaly Buka [Mon, 22 Aug 2022 01:41:55 +0000 (18:41 -0700)]
[sanitizer] use ../runtimes path to build libcxx

22 months ago[clang-format] Fix BeforeHash indent of comments above PPDirective
owenca [Thu, 18 Aug 2022 05:12:07 +0000 (22:12 -0700)]
[clang-format] Fix BeforeHash indent of comments above PPDirective

Fixes #56326.

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

22 months ago[ADT] Remove `is_invocable` from `STLExtras.h`
Joe Loser [Sun, 21 Aug 2022 00:48:05 +0000 (18:48 -0600)]
[ADT] Remove `is_invocable` from `STLExtras.h`

As a follow-up of https://reviews.llvm.org/D132318, now that the callers have
been adjusted to use `std::is_invocable`, remove `llvm::is_invocable` and its
tests.

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

22 months ago[ADT] Clarify llvm::bit_cast implementation comment
Joe Loser [Sun, 21 Aug 2022 16:41:13 +0000 (10:41 -0600)]
[ADT] Clarify llvm::bit_cast implementation comment

When reviewing https://reviews.llvm.org/D132330, I noticed a few pre-existing
comments regarding the implementation of `llvm::bit_cast`. One comment is a bit
misleading since `std::bit_cast` is a C++20 standard library thing, not a
C++17 one (otherwise we could use it directly). Clarify that in the comment.

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

22 months ago[RISCV] Remove impossible TODO in RISCVRedundantCopyElimination. NFC
Craig Topper [Sun, 21 Aug 2022 20:14:31 +0000 (13:14 -0700)]
[RISCV] Remove impossible TODO in RISCVRedundantCopyElimination. NFC

If there are multiple conditional branches we shouldn't do any
optimization.

22 months ago[RISCV] Optimize x <s -1 ? x : -1. Improve x >u 1 ? x : 1.
Craig Topper [Sun, 21 Aug 2022 18:46:05 +0000 (11:46 -0700)]
[RISCV] Optimize x <s -1 ? x : -1. Improve x >u 1 ? x : 1.

Similar to D132211, we can optimize x <s -1 ? x : -1 -> x <s 0 ? x : -1

Also improve the unsigned case from D132211 to use x != 0 which
will give a bnez instruction which might be compressible.

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

22 months ago[RISCV] Be more strict about LUI+ADDI macrofusion pre-RA.
Craig Topper [Sun, 21 Aug 2022 17:56:24 +0000 (10:56 -0700)]
[RISCV] Be more strict about LUI+ADDI macrofusion pre-RA.

Don't macrofuse if the LUI has more than 1 user. That will likely
require the LUI to have a different destination register post-RA.
LUI+ADDI can only be fused if they write the same register.

22 months ago[ADT] Simplify llvm::bit_cast (NFC)
Kazu Hirata [Sun, 21 Aug 2022 17:39:21 +0000 (10:39 -0700)]
[ADT] Simplify llvm::bit_cast (NFC)

This patch removes macro tricks to check GCC versions.

The commit message from 19262fc5966ab569f21f3d440f8b001bca666f17
states that "is_trivially_copyable is only in GCC 5.1 and later".
Note that we now require GCC 7.1 or higher.

Since both std::is_trivially_constructible and
std::is_trivially_copyable are C++11 features, and we now require
C++17, we probably don't need to worry about the availability of the
C++11 features.

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

22 months agoRemove llvm::is_trivially_copyable (NFC)
Kazu Hirata [Sun, 21 Aug 2022 17:39:19 +0000 (10:39 -0700)]
Remove llvm::is_trivially_copyable (NFC)

This patch removes llvm::is_trivially_copyable as it seems to be dead.
Once I remove it, HAVE_STD_IS_TRIVIALLY_COPYABLE has no users, so this
patch removes the macro also.

The comment on llvm::is_trivially_copyable mentions GCC 4.9, but note
that we now require GCC 7.1 or higher.

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

22 months ago[flang][OpenMP] Parser support for Target directive and Device clause
Sesha Kalyur [Sun, 21 Aug 2022 16:53:51 +0000 (22:23 +0530)]
[flang][OpenMP] Parser support for Target directive and Device clause

This patch adds support for the device clause on `Target` directive.
Device clause was added in OpenMP specification version 4.5 to
create a device data environment for the extent of a region. On
target construct, the device expression be either be `ancestor`
(taking after the parent) or assign a new `device_num`.

Reviewed By: kiranchandramohan

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

22 months ago[CostModel][X86] Add CodeSize handling for fadd/fsub/fmul/fsqrt ops
Simon Pilgrim [Sun, 21 Aug 2022 16:42:05 +0000 (17:42 +0100)]
[CostModel][X86] Add CodeSize handling for fadd/fsub/fmul/fsqrt ops

Eventually this will be part of the cost table lookup

22 months ago[ADT] Replace `void_t` equivalent with `std::void_t`
Joe Loser [Sat, 20 Aug 2022 23:53:58 +0000 (17:53 -0600)]
[ADT] Replace `void_t` equivalent with `std::void_t`

Use `std::void_t` instead of defining our own equivalent in `STLExtras.h` now
that C++17 is available for use.

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

22 months agoRevert rG15de7aaae52ef4be9f9ff3b130804e5b5ccd29f4 "[CostModel][X86] Add CodeSize...
Simon Pilgrim [Sun, 21 Aug 2022 15:51:45 +0000 (16:51 +0100)]
Revert rG15de7aaae52ef4be9f9ff3b130804e5b5ccd29f4 "[CostModel][X86] Add CodeSize/SizeLatency handling for fadd/fsub/fmul/fsqrt ops"

This is unintentionally affecting some backend tests

22 months ago[CostModel][X86] Add CodeSize/SizeLatency handling for fadd/fsub/fmul/fsqrt ops
Simon Pilgrim [Sun, 21 Aug 2022 15:39:47 +0000 (16:39 +0100)]
[CostModel][X86] Add CodeSize/SizeLatency handling for fadd/fsub/fmul/fsqrt ops

Eventually this will be part of the cost table lookup

22 months ago[NFC][libc++][doc] Improves rst formatting.
Mark de Wever [Sun, 21 Aug 2022 15:16:14 +0000 (17:16 +0200)]
[NFC][libc++][doc] Improves rst formatting.

22 months ago[NFC][mlir][affine] Typo in Affine Analysis test
Kai Sasaki [Sun, 21 Aug 2022 14:54:44 +0000 (20:24 +0530)]
[NFC][mlir][affine] Typo in Affine Analysis test

Reviewed By: Groverkss

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

22 months ago[libc++] Fix typos in deprecation messages for experimental searchers
Joe Loser [Sat, 20 Aug 2022 23:21:13 +0000 (17:21 -0600)]
[libc++] Fix typos in deprecation messages for experimental searchers

Fix the typo in the deprecated messages for these searchers:
`s/exprerimental/experimental`.

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

22 months ago[InstCombine] reassociate bitwise logic chains based on uses
Sanjay Patel [Sun, 21 Aug 2022 13:42:14 +0000 (09:42 -0400)]
[InstCombine] reassociate bitwise logic chains based on uses

(X op Y) op Z --> (Y op Z) op X

This isn't a complete solution (see TODO tests for possible refinements),
but it shows some nice wins and doesn't seem to cause any harm. I think
the most potential danger is from conflicting with other folds and causing
an infinite loop - that's the reason for avoiding patterns with constant
operands.

Alternatively, we could try this in the reassociate pass, but we would not
immediately see all of the logic folds that instcombine provides. I also
looked at improving ValueTracking's isImpliedCondition() (and we should
still add some enhancements there), but that would not work in general for
bitwise logic reduction.

The tests that reduce completely to 0/-1 are motivated by issue #56653.

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

22 months ago[CMake] Weaken 176db3b3ab25ff8a9b2405f50ef5a8bd9304a6d5
John Ericson [Sun, 21 Aug 2022 12:57:01 +0000 (08:57 -0400)]
[CMake] Weaken 176db3b3ab25ff8a9b2405f50ef5a8bd9304a6d5

That commit (D132324) made putting libc++ in LLVM_ENABLE_RUNTIMES a hard
error, but ther are some out-of-tree CI jobs (especially docs that need
fixing).

I am thus making it a "soft error" for now, until that is resolved.

22 months ago[PhaseOrdering][X86] Regenerate vdiv.ll
Simon Pilgrim [Sun, 21 Aug 2022 12:39:55 +0000 (13:39 +0100)]
[PhaseOrdering][X86] Regenerate vdiv.ll

Noticed while cleaning up x86 cost tables for upcoming cost kind support and it affected this test

22 months ago[RISCV] Optimize x > 1 ? x : 1 -> x > 0 ? x : 1
LiaoChunyu [Fri, 19 Aug 2022 08:14:19 +0000 (16:14 +0800)]
[RISCV] Optimize x > 1 ? x : 1 -> x > 0 ? x : 1

if x == 1,
  x > 1 ? x : 1  return x, which is also 1.
  x > 0 ? x : 1  return 1.

Reduce the number of load 1 instructions.

Reviewed By: craig.topper

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

22 months ago[libcxxabi][cmake] Allow building without libcxx again
John Ericson [Sat, 20 Aug 2022 15:04:41 +0000 (11:04 -0400)]
[libcxxabi][cmake] Allow building without libcxx again

This allows `-DLLVM_ENABLE_RUNTIMES=libcxxabi` to work.

This functionality was removed in D125561 (among other such removals) as
dead code, because it was only available as part of the standalone build
before.

The functionality as added back as it was, except `target_include_directories` is used instead of the cruder `target_compile_options` (with an MSVC vs not MSVC conditional split). That is just wholly better.

Reviewed By: phosek, #libc_abi

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

22 months ago[RFC] Remove support for building C++ with `LLVM_ENABLE_PROJECTS`
John Ericson [Sun, 21 Aug 2022 01:47:45 +0000 (21:47 -0400)]
[RFC] Remove support for building C++ with `LLVM_ENABLE_PROJECTS`

This has been officially deprecated since D112724, meaning the
deprecation warning is present in released 14 and 15.

This makes me think that now, shortly after the 15 release is branched,
is a good time to pull the trigger.

Reviewed By: phosek

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

22 months ago[CostModel][X86] Add trunc cost kinds tests
Simon Pilgrim [Sun, 21 Aug 2022 11:33:10 +0000 (12:33 +0100)]
[CostModel][X86] Add trunc cost kinds tests

22 months ago[CostModel][X86] Split integer div/rem cost kinds tests
Simon Pilgrim [Sun, 21 Aug 2022 11:03:01 +0000 (12:03 +0100)]
[CostModel][X86] Split integer div/rem cost kinds tests

It's going to be much easier to maintain these tests (and all the check prefix combinations) if we don't mix cost kinds in the same file.

22 months ago[Orc] Improve deintialize and shutdown logic
Anubhab Ghosh [Sat, 20 Aug 2022 20:19:34 +0000 (01:49 +0530)]
[Orc] Improve deintialize and shutdown logic

When deinitializing, the allocation needs to be removed from the
allocation list of its associated reservation so that remaining
allocations can be deinitialized when releasing the reservation.

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

22 months ago[Orc] Provide correct Reservation address for slab allocations
Anubhab Ghosh [Sat, 20 Aug 2022 20:13:20 +0000 (01:43 +0530)]
[Orc] Provide correct Reservation address for slab allocations

When slab allocator is used, the MappingBase is not necessarily
the same as the original reservation base as the allocation could
be a part of the whole reservation.

In this case the original reservation address needs to be passed to
ExecutorSharedMemoryMapperService to associate the new allocation
with the original reservation.

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

22 months ago[Orc] Only unmap shared memory in controller process destructor
Anubhab Ghosh [Sat, 20 Aug 2022 20:00:15 +0000 (01:30 +0530)]
[Orc] Only unmap shared memory in controller process destructor

By the time SharedMemoryMapper destructor is called, the RPC
connection is no longer available causing the release() call to
always fail. Instead at this point only shared memory regions
can be unmapped safely.

Deinitializers are called and mapped memory is released at the
executor side by ExecutorSharedMemoryMapperService::shutdown()
instead. Memory can also be released earlier by calling release()
earlier before RPC connection is closed.

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

22 months ago[Orc] Actually save the callback
Anubhab Ghosh [Sat, 20 Aug 2022 19:49:48 +0000 (01:19 +0530)]
[Orc] Actually save the callback

The callback function was captured by reference but it lived on the
stack and was in danger of being overwritten and could cause a crash.

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

22 months ago[CostModel][X86] Split int/fp arithmetic cost kinds tests
Simon Pilgrim [Sun, 21 Aug 2022 10:49:27 +0000 (11:49 +0100)]
[CostModel][X86] Split int/fp arithmetic cost kinds tests

It's going to be much easier to maintain these tests (and all the check prefix combinations) if we don't mix cost kinds in the same file.

22 months ago[mlir][normalize-memrefs] NFC Follow-up D125854
Tung D. Le [Sat, 20 Aug 2022 02:00:28 +0000 (07:30 +0530)]
[mlir][normalize-memrefs] NFC Follow-up D125854

NFC follow-up D125854 to reflect some remaining comments in D125854

Reviewed By: bondhugula

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

22 months ago[CostModel] Add CostKind argument to getShuffleCost
Simon Pilgrim [Sun, 21 Aug 2022 09:19:21 +0000 (10:19 +0100)]
[CostModel] Add CostKind argument to getShuffleCost

Defaults to TCK_RecipThroughput - as most explicit calls were assuming TCK_RecipThroughput (vectorizers) or was just doing a before-vs-after comparison (vectorcombiner). Calls via getInstructionCost were just dropping the CostKind, so again there should be no change at this time (as getShuffleCost and its expansions don't use CostKind yet) - but it will make it easier for us to better account for size/latency shuffle costs in inline/unroll passes in the future.

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

22 months ago[C++20][Modules] Improve handing of Private Module Fragment diagnostics.
Iain Sandoe [Wed, 22 Jun 2022 08:15:53 +0000 (09:15 +0100)]
[C++20][Modules] Improve handing of Private Module Fragment diagnostics.

This adds a check for exported inline functions, that there is a definition in
the definition domain (which, in practice, can only be the module purview but
before any PMF starts) since the PMF definition domain cannot contain exports.

This is:
[dcl.inline]/7
If an inline function or variable that is attached to a named module is declared in
a definition domain, it shall be defined in that domain.

The patch also amends diagnostic output by excluding the PMF sub-module from the
set considered as sources of missing decls.  There is no point in telling the user
that the import of a PMF object is missing - since such objects are never reachable
to an importer.  We still show the definition (as unreachable), to help point out
this.

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

22 months ago[mlir][Bazel] Fix Bazel build
Anlun Xu [Sun, 21 Aug 2022 08:01:04 +0000 (01:01 -0700)]
[mlir][Bazel] Fix Bazel build

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

22 months agoRevert "Use std::is_same_v instead of std::is_same (NFC)"
Kazu Hirata [Sun, 21 Aug 2022 06:00:39 +0000 (23:00 -0700)]
Revert "Use std::is_same_v instead of std::is_same (NFC)"

This reverts commit c5da37e42d388947a40654b7011f2a820ec51601.

This patch seems to break builds with some versions of MSVC.

22 months agoUse std::is_same_v instead of std::is_same (NFC)
Kazu Hirata [Sun, 21 Aug 2022 05:36:26 +0000 (22:36 -0700)]
Use std::is_same_v instead of std::is_same (NFC)

22 months agoUse range-based for loops (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:32 +0000 (21:18 -0700)]
Use range-based for loops (NFC)

22 months agoUse llvm::drop_begin (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:30 +0000 (21:18 -0700)]
Use llvm::drop_begin (NFC)