platform/upstream/llvm.git
2 years ago[ELF][PPC64] Fix assertion failure for branches to hidden undefined weak for -no-pie
Fangrui Song [Tue, 15 Feb 2022 20:57:27 +0000 (12:57 -0800)]
[ELF][PPC64] Fix assertion failure for branches to hidden undefined weak for -no-pie

Reported by Stefan Pintilie in D119773.

For a branch to a hidden undefined weak symbol, there is an
`assert(sym->getVA());` failure in PPC64LongBranchTargetSection::writeTo for a
-no-pie link. The root cause is that we unnecessarily create the thunk for the
-no-pie link.

Fix this by changing the condition to just `s.isUndefined()`. See the inline
comment.

Rename ppc64-weak-undef-call.s to ppc64-undefined-weak.s to be consistent with
other architectures.

Reviewed By: sfertile, stefanp

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

2 years ago[libc++] Temporarily silence failing debug mode test
Louis Dionne [Tue, 15 Feb 2022 20:47:45 +0000 (15:47 -0500)]
[libc++] Temporarily silence failing debug mode test

Also, fix the actual code so that the test would pass if we fixed the
issue that the method is instantiated in the dylib, and hence the debug
assertion will never fire except if the debug mode is enabled when the
dylib is being compiled.

2 years ago[mlir][scf] Add callback to annotate ops during pipelining
Thomas Raoux [Tue, 15 Feb 2022 20:23:57 +0000 (12:23 -0800)]
[mlir][scf] Add callback to annotate ops during pipelining

This allow user to register a callback that can annotate operations
during software pipelining. This allows user potential annotate op to
know what part of the pipeline they correspond to.

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

2 years ago[clang-format][NFC] Give State.Stack.back() a meaningful name
Björn Schäpers [Fri, 3 Dec 2021 08:19:11 +0000 (09:19 +0100)]
[clang-format][NFC] Give State.Stack.back() a meaningful name

Without that debugging was a hell for me.

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

2 years ago[clang-format] Extend SpaceBeforeParens for requires
Björn Schäpers [Sun, 7 Nov 2021 21:02:34 +0000 (22:02 +0100)]
[clang-format] Extend SpaceBeforeParens for requires

We can now configure the space between requires and the following paren,
seperate for clauses and expressions.

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

2 years ago[clang-format] Further improve support for requires expressions
Björn Schäpers [Mon, 7 Feb 2022 14:46:46 +0000 (15:46 +0100)]
[clang-format] Further improve support for requires expressions

Detect requires expressions in more unusable contexts. This is far from
perfect, but currently we have no good metric to decide between a
requires expression and a trailing requires clause.

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

2 years ago[SLP] Add assert that entities are scheduled as expected
Philip Reames [Tue, 15 Feb 2022 20:20:33 +0000 (12:20 -0800)]
[SLP] Add assert that entities are scheduled as expected

Requested in D118538

2 years ago[mlir][ods] Allow type attribute/operand for 0 result ops prefixed
Jacques Pienaar [Tue, 15 Feb 2022 20:20:07 +0000 (12:20 -0800)]
[mlir][ods] Allow type attribute/operand for 0 result ops prefixed

Without results, there is no getType injected and so generating one in prefixed form doesn't result in any failures during C++ compilation.

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

2 years ago[CUDA][HIP] Do not promote constexpr var with non-constant initializer
Yaxun (Sam) Liu [Sat, 12 Feb 2022 04:07:46 +0000 (23:07 -0500)]
[CUDA][HIP] Do not promote constexpr var with non-constant initializer

constexpr var may be initialized with address of non-const variable.
In this case the initializer is not constant in device compilation.
This has been handled for const vars but not for constexpr vars.

This patch makes handling of const var and constexpr var
consistent.

Reviewed by: Artem Belevich

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

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

2 years ago[libc++] Add missing UNSUPPORTED for the has-no-incomplete-ranges test
Louis Dionne [Tue, 15 Feb 2022 20:10:27 +0000 (15:10 -0500)]
[libc++] Add missing UNSUPPORTED for the has-no-incomplete-ranges test

This wasn't caught because we don't test the combination of no-filesystem
and no-experimental-features in the CI.

2 years ago[libc++][ci] Pin apple-system to arm64 to relieve pressure on x86_64 hosts
Louis Dionne [Tue, 15 Feb 2022 20:07:47 +0000 (15:07 -0500)]
[libc++][ci] Pin apple-system to arm64 to relieve pressure on x86_64 hosts

2 years ago[Libomptarget] Run CPU offloading tests using the new driver
Joseph Huber [Mon, 14 Feb 2022 18:03:36 +0000 (13:03 -0500)]
[Libomptarget] Run CPU offloading tests using the new driver

This patch adds a new target to the OpenMP CPU offloading tests. This
tests the usage of the new driver for CPU offloading. If this all works
then we can move to transition to the new driver as the default.

Depends on D119613

Reviewed By: jdoerfert

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

2 years ago[OpenMP] Add support for CPU offloading in new driver
Joseph Huber [Sat, 12 Feb 2022 02:58:15 +0000 (21:58 -0500)]
[OpenMP] Add support for CPU offloading in new driver

This patch adds support for linking CPU offloading applications in the
linker wrapper. We generate the necessary linking job using the host
linker's path and library arguments. This may not be true for more
complex offloading schemes, but this is sufficient for now.

Reviewed By: jdoerfert

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

2 years agoDebugInfo: Disable simplified template names for -gmlt and below
David Blaikie [Tue, 15 Feb 2022 19:26:15 +0000 (11:26 -0800)]
DebugInfo: Disable simplified template names for -gmlt and below

Since -gmlt doesn't carry any type information necessary to rebuild
template names.

2 years agoDebugInfo: Don't simplify template names using _BitInt(N)
David Blaikie [Fri, 11 Feb 2022 05:14:02 +0000 (21:14 -0800)]
DebugInfo: Don't simplify template names using _BitInt(N)

_BitInt(N) only encodes the byte size in DWARF, not the bit size, so
can't be reconstituted.

2 years ago[mlir][sparse] sparse transpose operation
Aart Bik [Tue, 15 Feb 2022 18:07:50 +0000 (10:07 -0800)]
[mlir][sparse] sparse transpose operation

This test shows that when access patterns do not match (e.g. transposing
a row-wise sparse matrix into another row-wise sparse matrix), a conversion
operation in between can enable codegen (i.e. avoid cycle in iteration graph).

Reviewed By: bixia

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

2 years ago[mlir][ods] NFC fix compilation error on clang-8
Mogball [Tue, 15 Feb 2022 19:41:01 +0000 (19:41 +0000)]
[mlir][ods] NFC fix compilation error on clang-8

2 years ago[HWASan] remove replacement of DbgVariableIntrinsics.
Florian Mayer [Tue, 15 Feb 2022 02:25:45 +0000 (18:25 -0800)]
[HWASan] remove replacement of DbgVariableIntrinsics.

This code was dead because we AI->replaceUsesWithIf above. I verified
this doesn't actually get run by applying
https://gist.github.com/fmayer/aea7cbb4700cfe2c9d932591ae1073c3 to the
Android toolchain and building AOSP, without any crash.

Reviewed By: eugenis

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

2 years ago[gn build] Port c62eefb8863e
LLVM GN Syncbot [Tue, 15 Feb 2022 19:28:46 +0000 (19:28 +0000)]
[gn build] Port c62eefb8863e

2 years ago[nfc][codegen] Move RegisterBank[Info].cpp under CodeGen
Mircea Trofin [Sat, 5 Feb 2022 04:29:53 +0000 (20:29 -0800)]
[nfc][codegen] Move RegisterBank[Info].cpp under CodeGen

Layering-wise, it seems RegisterBank stuff fits under CodeGen, like
other target abstraction.
In particular, TargetSubtargetInfo has a getRegBankInfo member, but
using that object requires making sure GlobalISel is linked, which is
not always the case (e.g. llvm-jitlink doesn't).

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

2 years ago[flang] Make source location more accurate for actual arguments
Peter Klausler [Sat, 12 Feb 2022 00:58:01 +0000 (16:58 -0800)]
[flang] Make source location more accurate for actual arguments

Track source location information when available for actual arguments
to procedure references, and use this information when checking constraints
on calls so that error messages refer to specific actual arguments
rather than to the entire call.

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

2 years ago[ELF] reportDuplicate: change Symbol * to const Symbol &. NFC
Fangrui Song [Tue, 15 Feb 2022 19:18:31 +0000 (11:18 -0800)]
[ELF] reportDuplicate: change Symbol * to const Symbol &. NFC

2 years ago[mlir][ods] Default-valued parameters in attribute or type defs
Mogball [Tue, 15 Feb 2022 19:00:12 +0000 (19:00 +0000)]
[mlir][ods] Default-valued parameters in attribute or type defs

Optional parameters with `defaultValue` set will be populated with that value if they aren't encountered during parsing. Moreover, parameters equal to their default values are elided when printing.

Depends on D118210

Reviewed By: rriddle

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

2 years ago[ProfData] Change type of options from int to uint64_t.
minglotus-6 [Tue, 15 Feb 2022 07:18:18 +0000 (23:18 -0800)]
[ProfData] Change type of options from int to uint64_t.

- Reader uses option values to override uint64_t values.

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

2 years ago[polly][NFC] removes using-directives to fix modules build
Christopher Di Bella [Tue, 15 Feb 2022 06:55:09 +0000 (06:55 +0000)]
[polly][NFC] removes using-directives to fix modules build

When compiling with Clang modules enabled, polly's use of using-directives
caused the global object `Target` in RegisterPasses.cpp to clash with
`llvm::Target`. By eliminating the using-directives, we're able to get
polly to play nicely with a modules build.

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

2 years ago[flang] Handle CALL C_F_POINTER(without SHAPE=)
Peter Klausler [Wed, 9 Feb 2022 18:33:20 +0000 (10:33 -0800)]
[flang] Handle CALL C_F_POINTER(without SHAPE=)

Calls to C_F_POINTER() without the optional SHAPE= third argument
were failing to be recognized as proper calls to the intrinsic,
but the failure was not generating any error message.  This led to
a crash in lowering, which rightfully expects a typed expression
to be associated with the call.

So (1) catch silent failures to convert CALL statements as internal
errors, as is done for expressions and assignment statements; and
(2) clean up C_F_POINTER intrinsic handling to cope with only two
arguments and to emit an error for a FPTR= argument with no type.

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

2 years ago[MLIR] Add support for alloca() of non-zero address spaces
Krzysztof Drewniak [Tue, 15 Feb 2022 16:55:22 +0000 (16:55 +0000)]
[MLIR] Add support for alloca() of non-zero address spaces

This change is needed when lowering alloca()-using code on targets
such as ROCDL that represent private scratch space as a separate
address space.

Reviewed By: ftynse

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

2 years ago[gn build] Port 987c7f407d14
LLVM GN Syncbot [Tue, 15 Feb 2022 18:33:42 +0000 (18:33 +0000)]
[gn build] Port 987c7f407d14

2 years ago[gn build] (manually) port 9c30bafd59bf1
Nico Weber [Tue, 15 Feb 2022 18:31:46 +0000 (13:31 -0500)]
[gn build] (manually) port 9c30bafd59bf1

This is needed after b432eb5c8412c to keep std::unexpected_handler
around (which libcxxabi uses from libcxx).

2 years ago[PowerPC] Fix __builtin_pdepd and __builtin_pextd to be 64-bit and P10 only.
Amy Kwan [Tue, 15 Feb 2022 16:47:55 +0000 (10:47 -0600)]
[PowerPC] Fix __builtin_pdepd and __builtin_pextd to be 64-bit and P10 only.

The `__builtin_pdepd` and `__builtin_pextd` are P10 builtins that are meant to
be used under 64-bit only. For instance, when the builtins are compiled under
32-bit mode:
```
$ cat t.c
unsigned long long foo(unsigned long long a, unsigned long long b) {
  return __builtin_pextd(a,b);
}

$ clang -c t.c -mcpu=pwr10 -m32
ExpandIntegerResult #0: t31: i64 = llvm.ppc.pextd TargetConstant:i32<6928>, t28, t29

fatal error: error in backend: Do not know how to expand the result of this operator!
```
This patch adds sema checking for these builtins to compile under 64-bit
mode only and on P10. The builtins will emit a diagnostic when they are compiled on
non-P10 compilations and on 32-bit mode.

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

2 years ago[flang] Allow extension cases of EQUIVALENCE with optional warnings
Peter Klausler [Thu, 10 Feb 2022 00:32:58 +0000 (16:32 -0800)]
[flang] Allow extension cases of EQUIVALENCE with optional warnings

EQUIVALENCE storage association of objects whose types are not
both default-kind numeric storage sequences, or not both default-kind
character storage sequences, are not standard conformant.
However, most Fortran compilers admit such usage, with warnings
in strict conformance mode.  This patch allos EQUIVALENCE of objects
that have sequence types that are either identical, both numeric
sequences (of default kind or not), or both character sequences.
Non-sequence types, and sequences types that are not homogeneously
numeric or character, remain errors.

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

2 years ago[libc++] Replace `#include ""` with `<>` in libcxx/src/. NFCI.
Arthur O'Dwyer [Fri, 11 Feb 2022 18:00:39 +0000 (13:00 -0500)]
[libc++] Replace `#include ""` with `<>` in libcxx/src/. NFCI.

Our best guess is that the two syntaxes should have exactly equivalent
effects, so, let's be consistent with what we do in libcxx/include/.

I've left `#include "include/x.h"` and `#include "../y.h"` alone
because I'm less sure that they're interchangeable, and they aren't
inconsistent with libcxx/include/ because libcxx/include/ never
does that kind of thing.

Also, use the `_LIBCPP_PUSH_MACROS/POP_MACROS` dance for `<__undef_macros>`,
even though it's technically unnecessary in a standalone .cpp file,
just so we have consistently one way to do it.

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

2 years ago[libc++] Revert <stdatomic.h> changes
Louis Dionne [Tue, 15 Feb 2022 17:57:12 +0000 (12:57 -0500)]
[libc++] Revert <stdatomic.h> changes

This reverts commits a30a7948d and 5d1c1a243, which broke the LLDB
data formatters tests because they build with modules in C++11 mode.

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

2 years ago[VE] Fix breakage after D118981
Simon Moll [Tue, 15 Feb 2022 17:55:08 +0000 (18:55 +0100)]
[VE] Fix breakage after D118981

VE backend code expected all VP SDNode to have a mask parameter.  This
is not the case with vp.select|merge after D118981.

2 years ago[mlir] Flipping vector dialect to both prefixed form.
Jacques Pienaar [Tue, 15 Feb 2022 17:48:51 +0000 (09:48 -0800)]
[mlir] Flipping vector dialect to both prefixed form.

Following
https://discourse.llvm.org/t/psa-ods-generated-accessors-will-change-to-have-a-get-prefix-update-you-apis/4476

Mostly mechanical, avoiding function name conflicts.

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

2 years ago[clangd][NFC] includes missing headers
Christopher Di Bella [Tue, 15 Feb 2022 04:44:51 +0000 (04:44 +0000)]
[clangd][NFC] includes missing headers

`Shutdown.h` was transitively depending on two headers, but this isn't
allowed under a modules build, so they're now explicitly included.

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

2 years ago[libc++][ranges][NFC] Small formatting fixes to the Ranges algorithms' status.
Konstantin Varlamov [Tue, 15 Feb 2022 17:42:48 +0000 (09:42 -0800)]
[libc++][ranges][NFC] Small formatting fixes to the Ranges algorithms' status.

2 years ago[lldb] Fix uninitialized variable in EvaluateExpressionOptions
Jonas Devlieghere [Tue, 15 Feb 2022 17:39:33 +0000 (09:39 -0800)]
[lldb] Fix uninitialized variable in EvaluateExpressionOptions

Initialize m_pound_line_line to 0.

2 years ago[flang] Accept pointer assignment w/ remapping to function result
Peter Klausler [Tue, 8 Feb 2022 21:49:40 +0000 (13:49 -0800)]
[flang] Accept pointer assignment w/ remapping to function result

When a pointer assignment with bounds remapping has a function
reference as its right-hand side, don't check for array conformance.

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

2 years ago[ELF] Parse archives as --start-lib object files
Fangrui Song [Tue, 15 Feb 2022 17:38:00 +0000 (09:38 -0800)]
[ELF] Parse archives as --start-lib object files

https://maskray.me/blog/2022-01-16-archives-and-start-lib

For every definition in an extracted archive member, we intern the symbol twice,
once for the archive index entry, once for the .o symbol table after extraction.
This is inefficient.

Symbols in a --start-lib ObjFile/BitcodeFile are only interned once because the
result is cached in symbols[i].

Just handle an archive using the --start-lib code path. We can therefore remove
ArchiveFile and LazyArchive. For many projects, archive member extraction ratio
is high and it is a net performance win. Linking a Release build of clang is
1.01x as fast.

Note: --start-lib scans symbols in the same order that llvm-ar adds them to the
index, so in the common case the semantics should be identical. If the archive
symbol table was created in a different order, or is incomplete, this strategy
may have different semantics. Such cases are considered user error.

The `is neither ET_REL nor LLVM bitcode` error is changed to a warning.
Previously an archive may have such members without a diagnostic. Using a
warning prevents breakage.

* For some tests, the diagnostics get improved where we did not consider
  the archive member name: `b.a:` => `b.a(b.o):`.
* `no-obj.s`: the link is now allowed, matching GNU ld
* `archive-no-index.s`: the `is neither ET_REL nor LLVM bitcode` diagnostic is
  demoted to a warning.
* `incompatible.s`: even when an archive is unextracted, we may report an
  "incompatible with" error.

---

I recently decreased sizeof(SymbolUnion) by 8 and decreased memory usage quite a
bit, so retaining `symbols` for un-extracted archive members should not cause a
memory usage problem.

Reviewed By: peter.smith

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

2 years ago[gn build] (manually) port 3b625060fc915 (-std=c++20) more
Nico Weber [Tue, 15 Feb 2022 17:34:39 +0000 (12:34 -0500)]
[gn build] (manually) port 3b625060fc915 (-std=c++20) more

8c54583b2e ported this only for libcxx, not libcxxabi.
As of 05337a756c6, it's needed for libcxxabi too.

2 years ago[mlir][Arith] Disallow casting between scalable and fixed-length vectors
Javier Setoain [Fri, 11 Feb 2022 19:00:16 +0000 (19:00 +0000)]
[mlir][Arith] Disallow casting between scalable and fixed-length vectors

Casting between scalable vectors and fixed-length vectors doesn't make
sense. If one of the operands is scalable, the other has to be scalable
to be able to guarantee they have the same shape at runtime.

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

2 years ago[flang][nfc] Update D119555 comments and use getVoidPtr
Jean Perier [Tue, 15 Feb 2022 17:23:15 +0000 (18:23 +0100)]
[flang][nfc] Update D119555 comments and use getVoidPtr

Minor comment updates and use getVoidPtr helper instead of
builiding `i8*` type manually in codegen.

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

2 years ago[VP] Condition in vp.select|merge not a VP mask
Simon Moll [Tue, 15 Feb 2022 17:17:54 +0000 (18:17 +0100)]
[VP] Condition in vp.select|merge not a VP mask

vp.select|merge both select lanes based on a condition mask.  Unlike
other VP intrinsics the lanes are defined where the condition mask is
false. Hence, the condition mask in vp.select|mask is not a mask in the
sense of VP intrinsics.  By doing not treating the condition mask
specially, vp.select becomes the canonical VP translation of the select
instruction.

Reviewed By: frasercrmck

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

2 years ago[VP] vp.fptosi cast intrinsic and docs
Simon Moll [Tue, 15 Feb 2022 16:04:47 +0000 (17:04 +0100)]
[VP] vp.fptosi cast intrinsic and docs

Reviewed By: craig.topper

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

2 years ago[MLIR][GPU] Add missing include to SerilazeToHsaco
Krzysztof Drewniak [Tue, 15 Feb 2022 16:43:31 +0000 (16:43 +0000)]
[MLIR][GPU] Add missing include to SerilazeToHsaco

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

2 years ago[clang-format] Honour PointerAlignment in statements with initializers.
Marek Kurdej [Tue, 15 Feb 2022 08:52:33 +0000 (09:52 +0100)]
[clang-format] Honour PointerAlignment in statements with initializers.

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

Reviewed By: HazardyKnusperkeks, owenpan

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

2 years ago[libc] Improve performance of generic hypot when the exponent difference is sufficien...
Tue Ly [Tue, 15 Feb 2022 15:04:47 +0000 (10:04 -0500)]
[libc] Improve performance of generic hypot when the exponent difference is sufficiently large.

Simplify the logic when the exponent difference is at least MantissaLength + 2, while still maintaining correct rounding for all rounding modes.

Reviewed By: sivachandra

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

2 years ago[libc++][nfc] Add TEST_HAS_NO_FGETPOS_FSETPOS.
Mark de Wever [Fri, 11 Feb 2022 18:33:16 +0000 (19:33 +0100)]
[libc++][nfc] Add TEST_HAS_NO_FGETPOS_FSETPOS.

This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, philnik, ldionne

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

2 years ago[RISCV] Match vwmulsu_vx with scalar splat input.
Craig Topper [Tue, 15 Feb 2022 16:45:21 +0000 (08:45 -0800)]
[RISCV] Match vwmulsu_vx with scalar splat input.

This is a more generic version of D119110 that uses MaskedValueIsZero
to do the matching and SimplifyDemandedBits to remove any unneeded
AND instructions.

Tests were taken from D119110.

Reviewed By: Chenbing.Zheng

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

2 years ago[RISCV] Replace llvm_unreachable with report_fatal_error.
Craig Topper [Mon, 14 Feb 2022 20:06:38 +0000 (12:06 -0800)]
[RISCV] Replace llvm_unreachable with report_fatal_error.

Parsing errors aren't handled earlier in all cases. A simple
example is llc -mtriple=riscv64 -mattr=+zve32f. If F or Finx is
not also specified, this will hit a parse error.

Use a fatal_error so that the error is conveyed to the user.

2 years ago[libTooling] Change Tranformer's consumer to take multiple changes
Eric Li [Tue, 15 Feb 2022 15:48:51 +0000 (15:48 +0000)]
[libTooling] Change Tranformer's consumer to take multiple changes

Previously, Transformer would invoke the consumer once per file modified per
match, in addition to any errors encountered. The consumer is not aware of which
AtomicChanges come from any particular match. It is unclear which sets of edits
may be related or whether an error invalidates any previously emitted changes.

Modify the signature of the consumer to accept a set of changes. This keeps
related changes (i.e. all edits from a single match) together, and clarifies
that errors don't produce partial changes.

Reviewed By: ymandel

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

2 years ago[libc++] Allow backdeployment CI to run on newer macOS
Louis Dionne [Tue, 15 Feb 2022 14:34:04 +0000 (09:34 -0500)]
[libc++] Allow backdeployment CI to run on newer macOS

This should work now that we are using a matching libunwind.dylib when
we run the tests in back-deployment scenarios. The only restriction we
have now is to run on macOS x86_64, since that's what the old dylibs
were compiled for. This should allow us to move to newer AppleClangs
in the CI.

As a fly-by, fix missing availability annotations on optional's
monadic operations.

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

2 years ago[libc++] [test] Improve test coverage for std::{c,}{begin,end}.
Arthur O'Dwyer [Sun, 13 Feb 2022 20:39:14 +0000 (15:39 -0500)]
[libc++] [test] Improve test coverage for std::{c,}{begin,end}.

Incidentally, this removes some unqualified ADL calls to `begin` and `end`.

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

2 years ago[MLIR] Link SerializeToHsaco dependencies to correct MLIR library
Krzysztof Drewniak [Mon, 14 Feb 2022 21:22:35 +0000 (21:22 +0000)]
[MLIR] Link SerializeToHsaco dependencies to correct MLIR library

Reviewed By: mehdi_amini

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

2 years ago[SLP][NFC]Add a test for miscompilation of alternate cmp instructions,
Alexey Bataev [Tue, 15 Feb 2022 16:28:40 +0000 (08:28 -0800)]
[SLP][NFC]Add a test for miscompilation of alternate cmp instructions,
NFC.

2 years ago[libc++] Remove conditional noexcepts from view_interface.
Arthur O'Dwyer [Wed, 9 Feb 2022 19:31:21 +0000 (14:31 -0500)]
[libc++] Remove conditional noexcepts from view_interface.

As suggested in D117966.
These conditional noexcepts are *permitted* by the Standard (as long
as there were no mistakes in them, I guess); but not *mandated*.
The Standard doesn't put any noexcept-specifications on these member functions.
The same logic would apply to `transform_view::iterator::operator*`
and `transform_view::iterator::operator[]`, but the Standard mandates
conditional noexcept on `iter_move(transform_view::iterator)`, and
I think it doesn't make much sense to say "moving from this iterator
is conditionally noexcept but not-moving from it is noexcept(false),"
so I'm leaving transform_view alone for now.

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

2 years ago[NFC][PhaseOrdering] Add some tests from D119839
Andrew Wei [Tue, 15 Feb 2022 15:50:50 +0000 (18:50 +0300)]
[NFC][PhaseOrdering] Add some tests from D119839

Based on original tests from D119839.

See https://github.com/llvm/llvm-project/issues/53853

2 years ago[Analysis] propagate poison through add/sub saturate intrinsics
Sanjay Patel [Tue, 15 Feb 2022 15:17:45 +0000 (10:17 -0500)]
[Analysis] propagate poison through add/sub saturate intrinsics

A more general enhancement needs to add tests and make sure
that intrinsics that return structs are correct. There are also
target-specific intrinsics, and I'm not sure what behavior is
expected for those.

2 years ago[Analysis] propagate poison through integer min/max intrinsics
Sanjay Patel [Tue, 15 Feb 2022 15:09:36 +0000 (10:09 -0500)]
[Analysis] propagate poison through integer min/max intrinsics

A more general enhancement needs to add tests and make sure
that intrinsics that return structs are correct. There are also
target-specific intrinsics, and I'm not sure what behavior is
expected for those.

2 years ago[ConstProp] add tests for intrinsics with poison ops; NFC
Sanjay Patel [Tue, 15 Feb 2022 14:55:28 +0000 (09:55 -0500)]
[ConstProp] add tests for intrinsics with poison ops; NFC

2 years ago[libc++] Rename *SAFE_STATIC to *CONSTINIT, and normalize its uses.
Arthur O'Dwyer [Tue, 8 Feb 2022 18:08:59 +0000 (13:08 -0500)]
[libc++] Rename *SAFE_STATIC to *CONSTINIT, and normalize its uses.

In src/, most files can use `constinit` directly because they're always
compiled with C++20. But some files, like "libcxxabi/src/fallback_malloc.cpp",
can't, because they're `#include`d directly from test cases in libcxxabi/test/
and therefore must (currently) compile as C++03. We might consider refactoring
those offending tests, or at least marking them `UNSUPPORTED: c++03`.

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

2 years ago[libc++] [test] Split "UNSUPPORTED: libcpp-no-concepts, libcpp-has-no-incomplete...
Arthur O'Dwyer [Tue, 15 Feb 2022 15:36:29 +0000 (10:36 -0500)]
[libc++] [test] Split "UNSUPPORTED: libcpp-no-concepts, libcpp-has-no-incomplete-ranges" onto two lines. NFC.

2 years ago[libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.
Arthur O'Dwyer [Tue, 1 Feb 2022 21:52:02 +0000 (16:52 -0500)]
[libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.

The logic here is that we are disabling *only* things in `std::ranges::`.
Everything in `std::` is permitted, including `default_sentinel`, `contiguous_iterator`,
`common_iterator`, `projected`, `swappable`, and so on. Then, we include
anything from `std::ranges::` that is required in order to make those things
work: `ranges::swap`, `ranges::swap_ranges`, `input_range`, `ranges::begin`,
`ranges::iter_move`, and so on. But then that's all. Everything else (including
notably all of the "views" and the `std::views` namespace itself) is still
locked up behind `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`.

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

2 years ago[flang][mlir][NFC] Replace uses of raw accessors with prefixed accessors
Shraiysh Vaishay [Tue, 15 Feb 2022 15:05:46 +0000 (20:35 +0530)]
[flang][mlir][NFC] Replace uses of raw accessors with prefixed accessors

`kEmitAccessorPrefix_Raw ` is being removed, and so updating the
accessors to `kEmitAccessorPrefix_Prefixed`.

Reviewed By: clementval

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

2 years ago[AArch64] Suggest b.nfrst if the user tries b.nfirst.
Matt Devereau [Thu, 10 Feb 2022 16:37:50 +0000 (16:37 +0000)]
[AArch64] Suggest b.nfrst if the user tries b.nfirst.

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

Co-authored-by: George Steed <george.steed@arm.com>
2 years ago[flang] Handle lowering of ranked array
Valentin Clement [Tue, 15 Feb 2022 15:00:28 +0000 (16:00 +0100)]
[flang] Handle lowering of ranked array

This patch adds lowering of ranked array as function return.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[NFC] Introduce option to switch off compatible invokes merge
Max Kazantsev [Tue, 15 Feb 2022 14:34:55 +0000 (21:34 +0700)]
[NFC] Introduce option to switch off compatible invokes merge

Does not affect default behavior (transform is on).

2 years ago[PowerPC] Add default handling for single element vectors, and split/promote vNi1...
Amy Kwan [Fri, 11 Feb 2022 18:45:07 +0000 (12:45 -0600)]
[PowerPC] Add default handling for single element vectors, and split/promote vNi1 vectors.

This patch updates the handling of vectors in getPreferredVectorAction():

For single-element and scalable vectors, fall back to default vector legalization
handling. For vNi1 vectors, add handling to either split or promote them in
order to prevent the production of wide v256i1/v512i1 types.

The following assertion is fixed by this patch, as we ended up producing the
wide vector types (that are used for MMA) in the backend prior to this fix.

```
Assertion failed: VT.getSizeInBits() == Operand.getValueSizeInBits() &&
"Cannot BITCAST between types of different sizes!"
```

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

2 years ago[llvm-nm] add a new option -X to specify the type of object file llvm-nm should examine
zhijian [Tue, 15 Feb 2022 14:43:31 +0000 (09:43 -0500)]
[llvm-nm] add a new option -X to specify the type of object file llvm-nm should examine
Summary:
Added a new option "-X" to specify, which type of object file should be examine.

For example:

1. "llvm-nm -X64 archive.a" only deal with the 64bit object files in the archive.a ,ignore the all 32bit object files in the archive.a
2. "llvm-nm -X32 xcoffobj32.o xcoffobj64.o " only deal with the 32bit object file "xcoffobj32.o" , 64bit object file "xcoffobj64.o" will be ignored

Reviewers: James Henderson,Fangrui Song
Differential Revision: https://reviews.llvm.org/D118193

2 years agoUse functions with prototypes when appropriate; NFC
Aaron Ballman [Tue, 15 Feb 2022 14:27:12 +0000 (09:27 -0500)]
Use functions with prototypes when appropriate; NFC

A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the tenth batch of tests being updated (there are a
significant number of other tests left to be updated).

2 years ago[libc++] Fix broken stdatomic test on GCC
Louis Dionne [Tue, 15 Feb 2022 14:25:29 +0000 (09:25 -0500)]
[libc++] Fix broken stdatomic test on GCC

The test would trigger -Wtautological-compare. I think that the little
we gain from comparing addresses isn't worth the added complexity to
work around the warning.

2 years ago[X86] LowerVSETCC - always split 512-bit vectors before lowering to PCMPEQ/GT (PR53842)
Simon Pilgrim [Tue, 15 Feb 2022 14:17:00 +0000 (14:17 +0000)]
[X86] LowerVSETCC - always split 512-bit vectors before lowering to PCMPEQ/GT (PR53842)

Extend the existing split where we already do this for v32i16/v64i8

We can end up trying to use PCMPEQ/GT if the result needs to be sign-extended (typically due to the DAGCombiner::foldSextSetcc fold).

Fixes #53842

2 years ago[mlir][Math] Fix NaN handling in Exp approximation
Adrian Kuegel [Tue, 15 Feb 2022 12:49:30 +0000 (13:49 +0100)]
[mlir][Math] Fix NaN handling in Exp approximation

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

2 years ago[mlir][gpu] Make header parse standalone. NFC.
Benjamin Kramer [Tue, 15 Feb 2022 14:09:39 +0000 (15:09 +0100)]
[mlir][gpu] Make header parse standalone. NFC.

2 years agoRevert "[asan] Add support for disable_sanitizer_instrumentation attribute"
Alexander Potapenko [Tue, 15 Feb 2022 13:57:28 +0000 (14:57 +0100)]
Revert "[asan] Add support for disable_sanitizer_instrumentation attribute"

This reverts commit dd145f953db3dafbc019f1d3783bb4f09a28af92.

https://reviews.llvm.org/D119726, like https://reviews.llvm.org/D114421,
still causes TSan to fail, see https://lab.llvm.org/buildbot/#/builders/70/builds/18020

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

2 years ago[mlir][gpu] sinkOperationsIntoLaunchOp: Add user hook for isSinkingBeneficiary
Ivan Butygin [Sat, 12 Feb 2022 16:13:43 +0000 (19:13 +0300)]
[mlir][gpu] sinkOperationsIntoLaunchOp: Add user hook for isSinkingBeneficiary

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

2 years ago[libc++][AIX] Remove "pragma priority" from locale.cpp
Xing Xue [Tue, 15 Feb 2022 13:36:29 +0000 (08:36 -0500)]
[libc++][AIX] Remove "pragma priority" from locale.cpp

Summary:
The pragma priority guarded for AIX in locale.cpp is no longer useful and is ignored by the current AIX build compilers. This patch removes it from the source.

Reviewed by: ldionne, hubert.reinterpretcast, libc++

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

2 years ago[InstCombine] reassociate min/max intrinsics with constant operands
Sanjay Patel [Tue, 15 Feb 2022 13:18:11 +0000 (08:18 -0500)]
[InstCombine] reassociate min/max intrinsics with constant operands

Integer min/max operations are associative:
  max (max X, C0), C1 --> max X, (max C0, C1) --> max X, NewC

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

This would avoid a regression when we canonicalize to min/max intrinsics
(see D98152 ).

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

2 years ago[Test] Add test demonstating how deopt bundle constants may be merged into instruction
Max Kazantsev [Tue, 15 Feb 2022 13:12:52 +0000 (20:12 +0700)]
[Test] Add test demonstating how deopt bundle constants may be merged into instruction

2 years ago[InstCombine] Fold sub(Y,and(lshr(X,C),1)) --> add(ashr(shl(X,(BW-1)-C),BW-1),Y)...
Simon Pilgrim [Tue, 15 Feb 2022 13:24:20 +0000 (13:24 +0000)]
[InstCombine] Fold sub(Y,and(lshr(X,C),1)) --> add(ashr(shl(X,(BW-1)-C),BW-1),Y) (PR53610)

As noted on PR53610, we can fold a 'bit splat' negation of a shifted bitmask pattern into a pair of shifts.

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

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

2 years ago[SLP] Don't try to vectorize pair with insertelement
Anton Afanasyev [Sun, 13 Feb 2022 13:07:45 +0000 (16:07 +0300)]
[SLP] Don't try to vectorize pair with insertelement

Particularly this breaks vectorization of insertelements where some of
intermediate (i.e. not last) insertelements are used externally.

Fixes PR52275
Fixes #51617

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

2 years ago[Test][SLP] Add tests for PR52275
Anton Afanasyev [Thu, 10 Feb 2022 19:02:47 +0000 (22:02 +0300)]
[Test][SLP] Add tests for PR52275

2 years ago[asan] Add support for disable_sanitizer_instrumentation attribute
Alexander Potapenko [Tue, 23 Nov 2021 09:32:35 +0000 (10:32 +0100)]
[asan] Add support for disable_sanitizer_instrumentation attribute

For ASan this will effectively serve as a synonym for
__attribute__((no_sanitize("address")))

This is a reland of https://reviews.llvm.org/D114421

Reviewed By: melver, eugenis

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

2 years ago[mlir][OpenMP] NFC: Remove unused variable
Adrian Kuegel [Tue, 15 Feb 2022 13:01:12 +0000 (14:01 +0100)]
[mlir][OpenMP] NFC: Remove unused variable

2 years ago[InstCombine] add tests for min/max intrinsics; NFC
Sanjay Patel [Mon, 14 Feb 2022 21:46:42 +0000 (16:46 -0500)]
[InstCombine] add tests for min/max intrinsics; NFC

2 years ago[clang][NFC] Remove IgnoreLinkageSpecDecls
Nathan Sidwell [Mon, 14 Feb 2022 18:19:04 +0000 (10:19 -0800)]
[clang][NFC] Remove IgnoreLinkageSpecDecls

The Itanium mangler uses IgnoreLinkageSpecDecls to strip linkage spec
contexts.  It doesn't do this consistently, but there is no need for
it to do it at all.  getEffectiveDeclContext never returns a linkage
spec, as it either recurses, uses getRedeclContext (which itself
removes the specs), or gets the decl context of non-namespace entities.

This patch removes the function and all calls to it.  For safety I add
a couple of asserts to make sure we never get them.

Reviewed By: ChuanqiXu

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

2 years ago[mlir][OpenMP] Change omp.atomic.update to have generic updates
Shraiysh Vaishay [Tue, 15 Feb 2022 12:01:31 +0000 (17:31 +0530)]
[mlir][OpenMP] Change omp.atomic.update to have generic updates

This patch changes the syntax of omp.atomic.update to allow the other
dialects to modify the variable with appropriate operations in the
region.

Reviewed By: ftynse

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

2 years ago[mlir][bufferize] Add vector-bufferize pass and remove obsolete patterns from Linalg...
Matthias Springer [Tue, 15 Feb 2022 12:16:50 +0000 (21:16 +0900)]
[mlir][bufferize] Add vector-bufferize pass and remove obsolete patterns from Linalg Bufferize

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

2 years ago[InstCombine] Add shift+trunc+mask tests requested for D119715
Simon Pilgrim [Tue, 15 Feb 2022 12:16:54 +0000 (12:16 +0000)]
[InstCombine] Add shift+trunc+mask tests requested for D119715

2 years ago[OpenCL] opencl-c.h: fix atomic_fetch_max with addrspace
Sven van Haastregt [Tue, 15 Feb 2022 12:12:03 +0000 (12:12 +0000)]
[OpenCL] opencl-c.h: fix atomic_fetch_max with addrspace

Commit 3c7d2f1b67d1 ("[OpenCL] opencl-c.h: add CL 3.0 non-generic
address space atomics", 2021-07-30) added some atomic_fetch_add/sub
overloads with uintptr_t arguments twice.  Instead, they should have
been atomic_fetch_max overloads with non-generic address spaces.

2 years ago[DSE] Extract a common PDT check (NFC)
Nikita Popov [Tue, 15 Feb 2022 12:04:52 +0000 (13:04 +0100)]
[DSE] Extract a common PDT check (NFC)

2 years ago[VE] v256i1 broadcast isel and tests
Simon Moll [Tue, 15 Feb 2022 09:55:14 +0000 (10:55 +0100)]
[VE] v256i1 broadcast isel and tests

Reviewed By: kaz7

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

2 years ago[clang][lex] Remove misleading comment
Jan Svoboda [Tue, 15 Feb 2022 11:39:20 +0000 (12:39 +0100)]
[clang][lex] Remove misleading comment

The resiliency to `HeaderSearch::Add{,System}SearchPath` is implemented in later patch (D116750).

2 years ago[lldb] Remove memory region non-address change from release notes
David Spickett [Tue, 15 Feb 2022 11:36:55 +0000 (11:36 +0000)]
[lldb] Remove memory region non-address change from release notes

This is now on 14.x as af19ae529271f9ae96927662d7d876489115fb26
so it is not new to 15.

2 years ago[AMDGPU] Reenable some disabled RUN lines
Jay Foad [Tue, 15 Feb 2022 11:06:44 +0000 (11:06 +0000)]
[AMDGPU] Reenable some disabled RUN lines

These look like they were temporarily disabled to placate
update_mir_test_checks and then committed by mistake.

2 years ago[clang] Remove a duplicate action kind table entry.
iains [Tue, 15 Feb 2022 09:55:22 +0000 (09:55 +0000)]
[clang] Remove a duplicate action kind table entry.

We have two entries for OPT_emit_codegen_only in the frontend action kind
table, delete one.

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

2 years ago[X86][Win64] Avoid statepoints in trailing call position
Markus Böck [Sun, 13 Feb 2022 10:07:36 +0000 (11:07 +0100)]
[X86][Win64] Avoid statepoints in trailing call position

The "avoid trailing call pass" makes sure that no function ends with a call instruction for the purpose of the unwinder.
It starts of by skipping over any non real instruction, which is approximated via the Pseudo and Meta property. This sadly leads to issues when the last machine instruction is a STATEPOINT, as it is skipped despite it lowering to a call.

This patch fixes the use of a statepoint in the trailing call position by making sure call instructions are not skipped.

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

2 years ago[llvm][doc] Update comments and documentation of custom stackmap formats in GC
Markus Böck [Sun, 13 Feb 2022 19:34:00 +0000 (20:34 +0100)]
[llvm][doc] Update comments and documentation of custom stackmap formats in GC

Since https://reviews.llvm.org/D53892 it is possible to emit a custom stackmap by overwriting the emitStackMaps method of GCMetadataPrinter. That way even AOT compilers can generate a more efficient and more suitable format for their needs.

This patch updates documentation and stale comments in source code. In particular it removes the issue from the issue list in the Statepoints documentation and adjusts comments in GCStrategy.

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

2 years ago[mlir][Math] Fix NaN handling in ExpM1 approximation.
Adrian Kuegel [Tue, 15 Feb 2022 10:14:20 +0000 (11:14 +0100)]
[mlir][Math] Fix NaN handling in ExpM1 approximation.

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