platform/upstream/llvm.git
3 years ago[PowerPC] Use correct node to get a super register from a subreg
Nemanja Ivanovic [Wed, 14 Apr 2021 00:40:36 +0000 (19:40 -0500)]
[PowerPC] Use correct node to get a super register from a subreg

The VSX tablegen file has some rather eggregious uses of
COPY_TO_REGCLASS even in situations where it needs to use
SUBREG_TO_REG. While this produces correct code, it often doesn't
allow the register coalescer to coalesce copies and the resulting
code ends up being suboptimal. This patch just changes over
patterns that should use SUBREG_TO_REG.

3 years agoRevert "[GlobalOpt] Revert valgrind hacks"
Sterling Augustine [Wed, 14 Apr 2021 00:42:46 +0000 (17:42 -0700)]
Revert "[GlobalOpt] Revert valgrind hacks"

This reverts commit dbc16ed199dce2598f0e49943bf8354ef92a0ecc.

3 years ago[mlir] Fix return values of AMX tests
Matthias Springer [Tue, 13 Apr 2021 23:10:10 +0000 (08:10 +0900)]
[mlir] Fix return values of AMX tests

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

3 years ago[MLIR] PresburgerSet subtraction: add documentation and assertion saying we don't...
Arjun P [Mon, 12 Apr 2021 15:08:27 +0000 (20:38 +0530)]
[MLIR] PresburgerSet subtraction: add documentation and assertion saying we don't support divisions yet

Reviewed By: ftynse

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

3 years ago[CSSPGO] Fix a test issue due to portablity of std::hash
Hongtao Yu [Tue, 13 Apr 2021 00:11:38 +0000 (17:11 -0700)]
[CSSPGO] Fix a test issue due to portablity of std::hash

As a follow-up to D99815, this patch enables the test by using a DAG order instead of a sequential order to mitigate the platform portability issue due to `std:: _Hash_bytes`.

Reviewed By: wenlei, jsji

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

3 years agoFix resolution-err.ll
Stella Stamenova [Tue, 13 Apr 2021 23:11:58 +0000 (16:11 -0700)]
Fix resolution-err.ll

chmod tries to be very helpful on some platforms and prevent naive mistakes, by warning the user. This results in the following error during the test:

```chmod: ...resolution-err.ll.tmp.resolution.txt: new permissions are r--rw-rw-, not r--r--r--```

To fix the test, call chmod with u.

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

3 years ago[Sema] Move 'char-expression-as-unsigned < 0' into a separate diagnostic
Anton Bikineev [Fri, 2 Apr 2021 18:14:44 +0000 (20:14 +0200)]
[Sema] Move 'char-expression-as-unsigned < 0' into a separate diagnostic

This change splits '-Wtautological-unsigned-zero-compare' by reporting
char-expressions-interpreted-as-unsigned under a separate diagnostic
'-Wtautological-unsigned-char-zero-compare'. This is beneficial for
projects that want to enable '-Wtautological-unsigned-zero-compare' but at
the same time want to keep code portable for platforms with char being
signed or unsigned, such as Chromium.

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

3 years ago[flang] More precise enforcement of runtime constraint
peter klausler [Tue, 13 Apr 2021 00:05:05 +0000 (17:05 -0700)]
[flang] More precise enforcement of runtime constraint

An OPEN statement that affects an already connected unit
without changing its external file is required to have
STATUS="OLD" or default STATUS=.  The code was eliciting
spurious runtime errors in situations where an OPEN statement
pertained to an existing unit number but did not need to have
STATUS="OLD'.

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

3 years agoTitle: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper...
root [Tue, 13 Apr 2021 22:06:07 +0000 (06:06 +0800)]
Title: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper  Differential Revision : https://reviews.llvm.org/D100115

3 years agoTitle: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper...
root [Tue, 13 Apr 2021 22:02:07 +0000 (06:02 +0800)]
Title: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper  Differential Revision : https://reviews.llvm.org/D100115

3 years agoTitle: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper...
root [Tue, 13 Apr 2021 21:52:16 +0000 (05:52 +0800)]
Title: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper  Differential Revision : https://reviews.llvm.org/D100115

3 years ago[mlir] Prevent operations with users from being hoisted
Sumesh Udayakumaran [Tue, 13 Apr 2021 19:11:25 +0000 (12:11 -0700)]
[mlir] Prevent operations with users from being hoisted

This patch collects operations that have users in a for loop and uses
them  when loop invariant operations are detected and hoisted.

Reviewed By: bondhugula, vinayaka-polymage

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

3 years ago[TableGen] Resolve concrete but not complete field access initializers
Daniel Sanders [Tue, 13 Apr 2021 18:14:30 +0000 (11:14 -0700)]
[TableGen] Resolve concrete but not complete field access initializers

This fixes the resolution of Rec10.Zero in ListSlices.td.

As part of this, correct the definition of complete for ListInit such that
it's complete iff all the elements in the list are complete rather than
always being complete regardless of the elements. This is the reason
Rec10.TwoFive from ListSlices.td previously resolved despite being
incomplete like Rec10.Zero was

Depends on D100247

Reviewed By: Paul-C-Anagnostopoulos

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

3 years ago[Driver] Make the findVCToolChainViaEnvironment case-insensitive
Artur Gainullin [Tue, 13 Apr 2021 04:39:57 +0000 (21:39 -0700)]
[Driver] Make the findVCToolChainViaEnvironment case-insensitive

PATH usage on Windows is case-insensitive. There could be situations
when toolchain path can't be obtained from PATH because of
case-sensitivity of the findVCToolChainViaEnvironment.

Reviewed By: rnk

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

3 years ago[mlir][tosa] Add conv2d lowering to linalg.conv2d operator for FP
Rob Suderman [Wed, 7 Apr 2021 01:31:51 +0000 (18:31 -0700)]
[mlir][tosa] Add conv2d lowering to linalg.conv2d operator for FP

Handles lowering conv2d to linalg's convolution operator. This implementation
only supports floating point values but handles all strides, dilations, and
padding values.

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

3 years ago[AArch64][SVE] Always use overloaded methods instead of preprocessor macro.
Sander de Smalen [Tue, 13 Apr 2021 15:04:02 +0000 (16:04 +0100)]
[AArch64][SVE] Always use overloaded methods instead of preprocessor macro.

This fixes a subtle issue where:

  svprf(pg, ptr, SV_ALL /*is sv_pattern instead of sv_prfop*/)

would be quietly accepted. With this change, the function declaration
guards that the third parameter is a `enum sv_prfop`. Previously `svprf`
would map directly to `__builtin_sve_svprfb`, which accepts the enum
operand as a signed integer and only checks that the incoming range is
valid, meaning that SV_ALL would be discarded as being outside the valid
immediate range, but would have allowed SV_VL1 without issuing a warning
(C) or error (C++).

Reviewed By: c-rhodes

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

3 years agoRemove warning "suggest braces" for aggregate initialization of an empty class with...
Hana Dusíková [Tue, 13 Apr 2021 19:45:09 +0000 (15:45 -0400)]
Remove warning "suggest braces" for aggregate initialization of an empty class with an aggregate base class.

I recently ran into issues with aggregates and inheritance, I'm using
it for creating a type-safe library where most of the types are build
over "tagged" std::array. After bit of cleaning and enabling -Wall
-Wextra -pedantic I noticed clang only in my pipeline gives me warning.
After a bit of focusing on it I found it's not helpful, and contemplate
disabling the warning all together. After a discussion with other
library authors I found it's bothering more people and decided to fix
it.

Removes this warning:

template<typename T, int N> struct StdArray {
    T contents[N];
  };

template<typename T, int N> struct AggregateAndEmpty : StdArray<T,N> { };

AggregateAndEmpty<int, 3> p = {1, 2, 3}; // <-- warning here about omitted braces

3 years ago[mlir][spirv] Only attach struct offset for required storage classes
Lei Zhang [Tue, 13 Apr 2021 19:18:32 +0000 (15:18 -0400)]
[mlir][spirv] Only attach struct offset for required storage classes

Per the SPIR-V spec "2.16.2. Validation Rules for Shader Capabilities":

  Composite objects in the StorageBuffer, PhysicalStorageBuffer,
  Uniform, and PushConstant Storage Classes must be explicitly
  laid out.

For other cases we don't need to attach the struct offsets.

Reviewed By: hanchung

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

3 years ago[AsmParser][SystemZ][z/OS] Add support to AsmLexer to accept HLASM style integers
Anirudh Prasad [Tue, 13 Apr 2021 19:25:00 +0000 (15:25 -0400)]
[AsmParser][SystemZ][z/OS] Add support to AsmLexer to accept HLASM style integers

- Add support for HLASM style integers. These are the decimal integers [0-9].
- HLASM does not support the additional prefixed integers like, `0b`, `0x`, octal integers and Masm style integers.
- To achieve this, a field `LexHLASMStyleIntegers` (similar to the `LexMasmStyleIntegers` field) is introduced in `MCAsmLexer.h` as well as a corresponding setter.

Note: This field could also go into MCAsmInfo.h. I used the previous precedent set by the `LexMasmIntegers` field.

Depends on https://reviews.llvm.org/D99286

Reviewed By: epastor

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

3 years agoCorrect the tablegen for checking mutually exclusive stmt attrs
Aaron Ballman [Tue, 13 Apr 2021 19:18:13 +0000 (15:18 -0400)]
Correct the tablegen for checking mutually exclusive stmt attrs

The previous implementation was insufficient for checking statement
attribute mutual exclusion because attributed statements do not collect
their attributes one-at-a-time in the same way that declarations do. So
the design that was attempting to check for mutual exclusion as each
attribute was processed would not ever catch a mutual exclusion in a
statement. This was missed due to insufficient test coverage, which has
now been added for the [[likely]] and [[unlikely]] attributes.

The new approach is to check all of attributes that are to be applied
to the attributed statement in a group. This required generating
another DiagnoseMutualExclusions() function into AttrParsedAttrImpl.inc.

3 years ago[RISCV] Add a generic PatGprImm class and use it to simplify patterns in RISCVInstrIn...
Craig Topper [Tue, 13 Apr 2021 18:57:10 +0000 (11:57 -0700)]
[RISCV] Add a generic PatGprImm class and use it to simplify patterns in RISCVInstrInfoB.td. NFC

3 years ago[RISCV] Make use of PatGprGpr and PatGpr in RISCVInstrInfoB.td. NFC
Craig Topper [Tue, 13 Apr 2021 18:29:34 +0000 (11:29 -0700)]
[RISCV] Make use of PatGprGpr and PatGpr in RISCVInstrInfoB.td. NFC

3 years agoShip `llvm-cxxfilt` in the toolchain.
Dan Liew [Tue, 13 Apr 2021 18:53:39 +0000 (11:53 -0700)]
Ship `llvm-cxxfilt` in the toolchain.

Originally done for rdar://problem/57155465.

rdar://76602859

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

3 years ago[gn build] Port 8ca366935b05
LLVM GN Syncbot [Tue, 13 Apr 2021 18:49:06 +0000 (18:49 +0000)]
[gn build] Port 8ca366935b05

3 years ago[gn build] Port 46b8ea2fff90
LLVM GN Syncbot [Tue, 13 Apr 2021 18:49:05 +0000 (18:49 +0000)]
[gn build] Port 46b8ea2fff90

3 years ago[lld-macho] rm old test directory for segments.s
Jez Ng [Tue, 13 Apr 2021 18:45:26 +0000 (14:45 -0400)]
[lld-macho] rm old test directory for segments.s

This should unbreak incremental builds after https://github.com/llvm/llvm-project/commit/8ca366935b055283b571ba0893f53a7a18ac59bb

3 years ago[mlir] Convert async dialect passes from function passes to op agnostic passes
Eugene Zhulenev [Tue, 13 Apr 2021 18:40:04 +0000 (11:40 -0700)]
[mlir] Convert async dialect passes from function passes to op agnostic passes

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

3 years ago[clang-tidy] Add check for implicit widening of multiplication result
Roman Lebedev [Tue, 13 Apr 2021 18:21:19 +0000 (21:21 +0300)]
[clang-tidy] Add check for implicit widening of multiplication result

Overflows are never fun.
In most cases (in most of the code), they are rare,
because usually you e.g. don't have as many elements.

However, it's exceptionally easy to fall into this pitfail
in code that deals with images, because, assuming 4-channel 32-bit FP data,
you need *just* ~269 megapixel image to case an overflow
when computing at least the total byte count.

In [[ https://github.com/darktable-org/darktable | darktable ]], there is a *long*, painful history of dealing with such bugs:
* https://github.com/darktable-org/darktable/pull/7740
* https://github.com/darktable-org/darktable/pull/7419
* https://github.com/darktable-org/darktable/commit/eea1989f2c9fa76710db07baaec4c19c1e40e81c
* https://github.com/darktable-org/darktable/commit/70626dd95bf0fab36f2d011dab075e3ebbf7aa28
* https://github.com/darktable-org/darktable/pull/670
* https://github.com/darktable-org/darktable/commit/38c69fb1b2bc90057c569242cb9945a10be0b583

and yet they clearly keep resurfacing still.

It would be immensely helpful to have a diagnostic for those patterns,
which is what this change proposes.

Currently, i only diagnose the most obvious case, where multiplication
is directly widened with no other expressions inbetween,
(i.e. `long r = (int)a * (int)b` but not even e.g. `long r = ((int)a * (int)b)`)
however that might be worth relaxing later.

Reviewed By: aaron.ballman

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

3 years ago[libc][Obvious] Fix nextafter* implementation.
Siva Chandra Reddy [Tue, 13 Apr 2021 18:35:41 +0000 (11:35 -0700)]
[libc][Obvious] Fix nextafter* implementation.

It broke when FPBits was converted to a union.

3 years agoBPF: remove default .extern data section
Yonghong Song [Tue, 13 Apr 2021 16:15:21 +0000 (09:15 -0700)]
BPF: remove default .extern data section

Currently, for any extern variable, if it doesn't have
section attribution, it will be put into a default ".extern"
btf DataSec. The initial design is to put every extern
variable in a DataSec so libbpf can use it.

But later on, libbpf actually requires extern variables
to put into special sections, e.g., ".kconfig", ".ksyms", etc.
so they can be used properly based on section name.

Andrii mentioned since ".extern" variables are
not actually used, it makes sense to remove it from
the compiler so libbpf does not need to deal with it,
esp. for static linking. The BTF for these extern variables
is still generated.

With this patch, I tested kernel selftests/bpf and all tests
passed. Indeed, removing ".extern" DataSec seems having no
impact.

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

3 years ago[libFuzzer] Fix fuzzer-oom.test.
Matt Morehouse [Tue, 13 Apr 2021 18:12:05 +0000 (11:12 -0700)]
[libFuzzer] Fix fuzzer-oom.test.

SinkPtr was not correctly marked as volatile, causing the malloc to get
optimized out.  This was causing 20-minute timeouts for the test and no
OOM.

3 years ago[lli] Honor the --entry-function flag in orc and orc-lazy modes.
Lang Hames [Tue, 13 Apr 2021 18:26:57 +0000 (11:26 -0700)]
[lli] Honor the --entry-function flag in orc and orc-lazy modes.

Fixes https://llvm.org/PR49906.

3 years ago[SCEV] Don't walk uses of phis without SCEV expression when forgetting
Nikita Popov [Sat, 10 Apr 2021 21:50:23 +0000 (23:50 +0200)]
[SCEV] Don't walk uses of phis without SCEV expression when forgetting

I've run into some cases where a large fraction of compile-time is
spent invalidating SCEV. One of the causes is forgetLoop(), which
walks all values that are def-use reachable from the loop header
phis. When invalidating a topmost loop, that might be close to all
values in a function. Additionally, it's fairly common for there to
not actually be anything to invalidate, but we'll still be performing
this walk again and again.

My first thought was that we don't need to continue walking the uses
if the current value doesn't have a SCEV expression. However, this
isn't quite right, because SCEV construction can skip over values
(e.g. for a chain of adds, we might only create a SCEV expression
for the final value).

What this patch does instead is to only walk the (full) def-use chain
of loop phis that have a SCEV expression. If there's no expression
for a phi, then we also don't have any dependent expressions to
invalidate.

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

3 years agoString Literal and Wide String Literal Encoding from the Preprocessor
ThePhD [Tue, 13 Apr 2021 18:15:45 +0000 (14:15 -0400)]
String Literal and Wide String Literal Encoding from the Preprocessor

Adds the __clang_literal_encoding__ and __clang_wide_literal_encoding__
predefined macros to expose the encoding used for string literals to
the preprocessor.

3 years ago[RISCV] Rename RISCVISD::GREVI(W)/GORCI(W) to RISCVISD::GREV(W)/GORC(W). Don't requir...
Craig Topper [Tue, 13 Apr 2021 14:54:24 +0000 (07:54 -0700)]
[RISCV] Rename RISCVISD::GREVI(W)/GORCI(W) to RISCVISD::GREV(W)/GORC(W). Don't require second operand to be a constant.

Prep work for adding intrinsics for these instructions in the
future.

3 years ago[AArch64][GlobalISel] Mark G_CTPOP as legal for v16s8 and v8s8
Jessica Paquette [Mon, 12 Apr 2021 21:49:20 +0000 (14:49 -0700)]
[AArch64][GlobalISel] Mark G_CTPOP as legal for v16s8 and v8s8

G_CTPOP can be directly selected to CNT in these cases.

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

3 years ago[flang][OpenMP] Modify semantic check for nesting of `ordered` regions to include...
Arnamoy Bhattacharyya [Tue, 13 Apr 2021 17:56:43 +0000 (13:56 -0400)]
[flang][OpenMP] Modify semantic check for nesting of `ordered` regions to include `close` nesting check.

Reviewed By: kiranchandramohan

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

3 years ago[MemorySSA] Add test for PR49859.
Alina Sbirlea [Tue, 13 Apr 2021 00:53:29 +0000 (17:53 -0700)]
[MemorySSA] Add test for PR49859.

3 years ago[flang] Handle instantiation of procedure pointer components
Peter Steinfeld [Mon, 12 Apr 2021 20:11:42 +0000 (13:11 -0700)]
[flang] Handle instantiation of procedure pointer components

We were not instantiating procedure pointer components.  If the instantiation
contained errors, we were not reporting them.  This resulted in internal errors
in later processing.

I fixed this by adding code in .../lib/Semantics/type.cpp in
InstantiateComponent() to handle a component with ProcEntityDetails.  I also
added several tests for various good and bad instantiations of procedure
pointer components.

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

3 years ago[libFuzzer] Fix MSan false positives with custom mutators.
Matt Morehouse [Tue, 13 Apr 2021 16:25:12 +0000 (09:25 -0700)]
[libFuzzer] Fix MSan false positives with custom mutators.

We need to unpoison parameters before calling into MSan-instrumented
user-defined mutators.

Addresses https://github.com/google/oss-fuzz/issues/4605.

Reviewed By: metzman

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

3 years ago[debugserver] Use class member initialization for RNBContext
Jonas Devlieghere [Tue, 13 Apr 2021 17:23:04 +0000 (10:23 -0700)]
[debugserver] Use class member initialization for RNBContext

Address Shafik Yaghmour's post commit code review feedback.

3 years agoRemove a -O2 usage from a CSE specific test file
Philip Reames [Tue, 13 Apr 2021 17:22:30 +0000 (10:22 -0700)]
Remove a -O2 usage from a CSE specific test file

Given this is checking attributes, there are a bunch of valid ways that O2 can infer attributes that CSE will not.

3 years ago[Clang][OpenMP][NVPTX] Fixed failure in openmp-offload-gpu.c if the system has CUDA
Shilei Tian [Tue, 13 Apr 2021 17:22:24 +0000 (13:22 -0400)]
[Clang][OpenMP][NVPTX] Fixed failure in openmp-offload-gpu.c if the system has CUDA

https://lists.llvm.org/pipermail/openmp-dev/2021-March/003940.html reports
test failure in `openmp-offload-gpu.c`. The failure is, when using `-S` in the
clang driver, it still reports bitcode library doesn't exist. However, it is not
exposed in my local run and Phabiractor test. The reason it escaped from Phabricator
test is, the test machine doesn't have CUDA, so `LibDeviceFile` is empty. In this
case, the check of `OPT_S` will be hit, and we get "expected" result. However, if
the test machine has CUDA, `LibDeviceFile` will not be empty, then the check will
not be done, and it just proceeds, trying to add the bitcode library. The reason
it escaped from my local run is, I didn't build ALL targets, so this case was
marked UNSUPPORTED.

Reviewed By: kkwli0

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

3 years ago[lldb] [gdb-remote server] Abstract away getting current process
Michał Górny [Sun, 11 Apr 2021 09:37:36 +0000 (11:37 +0200)]
[lldb] [gdb-remote server] Abstract away getting current process

Introduce new m_current_process and m_continue_process variables that
keep the pointers to currently selected process.  At this moment, this
is equivalent to m_debugged_process_up but it lays foundations for
the future multiprocess support.

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

3 years ago[debugserver] Fix unintialized member variable
Jonas Devlieghere [Tue, 13 Apr 2021 15:58:40 +0000 (08:58 -0700)]
[debugserver] Fix unintialized member variable

Caught by ubsan (__ubsan_handle_load_invalid_value_abort) when running
the unit tests.

3 years ago[mlgo] Skip AOT-compiling a model if a header/object pair is provided
Mircea Trofin [Mon, 5 Apr 2021 23:15:36 +0000 (16:15 -0700)]
[mlgo] Skip AOT-compiling a model if a header/object pair is provided

This allows one to cross-compile the header/object for a model in a
setup where the compiler is built on a system that cannot host the AOT
compiler. For example, if arm-hostable clang is desired, while the AOT
Tensorflow compiler can cross-compile to arm, it can't currently run on
arm.

The only alternative in that scenario would be to cross-compile clang
itself, but that gets complicated when trying to run tests after that.

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

3 years agoRevert "[lld-macho] Add support for arm64_32" and other stacked diffs
Jez Ng [Tue, 13 Apr 2021 16:39:24 +0000 (12:39 -0400)]
Revert "[lld-macho] Add support for arm64_32" and other stacked diffs

This reverts commits:
8914902b01a3f8bdea9c71a0d9d23e4ee0ae80e4
35a745d814e1cde3de25d0d959fddc31e1061a41
682d1dfe09436857aa3b64365b5cc6fcbf1f043b

3 years ago[X86][SSE] combineSetCCMOVMSK - allow comparison with upper (known zero) bits in...
Simon Pilgrim [Tue, 13 Apr 2021 14:54:40 +0000 (15:54 +0100)]
[X86][SSE] combineSetCCMOVMSK - allow comparison with upper (known zero) bits in CMP(MOVMSK(PACKSS())) -> CMP(MOVMSK()) fold

We already allow the comparison of the upper bits of 'IsAllOf' (allbits) patterns, but we can safely compare the known zero bits for 'IsAnyOf' (zerobits) patterns as well.

This fixes an issues where we are comparing a type wide than the number of vector elements, which avoids a regression mentioned in rGbaadbe04bf75.

3 years agoImplement WG21 P2156R1/WG14 N2557 on duplicate attributes
Aaron Ballman [Tue, 13 Apr 2021 16:24:16 +0000 (12:24 -0400)]
Implement WG21 P2156R1/WG14 N2557 on duplicate attributes

These proposals make the same changes to both C++ and C and remove a
restriction on standard attributes appearing multiple times in the same
attribute list.

We could warn on the duplicate attributes, but do not. This is for
consistency as we do not warn on attributes duplicated within the
attribute specifier sequence. If we want to warn on duplicated
standard attributes, we should do so both for both situations:
[[foo, foo]] and [[foo]][[foo]].

3 years ago[libc] Make FPBits a union.
Siva Chandra Reddy [Mon, 12 Apr 2021 22:56:09 +0000 (15:56 -0700)]
[libc] Make FPBits a union.

This helps us avoid the uncomfortable reinterpret-casts. Avoiding the
reinterpret casts prevents us from tripping the sanitizers as well.

Reviewed By: lntue

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

3 years agoRemove empty test case
Evgeny Leviant [Tue, 13 Apr 2021 16:17:11 +0000 (19:17 +0300)]
Remove empty test case

3 years ago[SystemZ][z/OS] Introduce dialect querying helper functions
Anirudh Prasad [Tue, 13 Apr 2021 15:55:21 +0000 (11:55 -0400)]
[SystemZ][z/OS] Introduce dialect querying helper functions

- In the SystemZAsmParser, there will be a few queries to the type of dialect it is (AD_ATT, AD_HLASM) in future patches.
- It would be nice to have two small helper functions `isParsingATT()` and `isParsingHLASM()`
- Putting this as a separate smaller patch allows us to remove its definitions from other dependent patches.

Reviewed By: uweigand, abhina.sreeskantharajan

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

3 years ago[GlobalOpt] Revert valgrind hacks
Evgeny Leviant [Tue, 13 Apr 2021 16:11:10 +0000 (19:11 +0300)]
[GlobalOpt] Revert valgrind hacks

Differential revision: https://reviews.llvm.org/D69428

3 years ago[gn build] Port bb6d96ced80f
LLVM GN Syncbot [Tue, 13 Apr 2021 16:05:40 +0000 (16:05 +0000)]
[gn build] Port bb6d96ced80f

3 years ago[gn build] Port 8914902b01a3
LLVM GN Syncbot [Tue, 13 Apr 2021 16:05:39 +0000 (16:05 +0000)]
[gn build] Port 8914902b01a3

3 years agoFix the const overload of IgnoreExprNodes
Jesse Zhang [Tue, 13 Apr 2021 15:17:38 +0000 (17:17 +0200)]
Fix the const overload of IgnoreExprNodes

The existing code causes an infinite recursion. This is likely an
oversight of commit c0e5e3fbfa504c37 [1] where the intent must have been
to call the non-const overload.

[1] https://reviews.llvm.org/D87278

Reviewed By: gribozavr2

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

3 years ago[OpenMP] Fix incompatible attributes in OpenMPIRBuilder test.
Joseph Huber [Tue, 13 Apr 2021 15:23:16 +0000 (11:23 -0400)]
[OpenMP] Fix incompatible attributes in OpenMPIRBuilder test.

Summary:
After D98740 the function attributes were changes to append rather than
overwrite when using the values defined in OMPKinds.def. One of the
OpenMPIRBuilder tests erroenously used `readnone` instead of `readonly` which
would cause a conflict and result in a broken module once `readonly` was
appended to it. This patch fixes the test to use the correct attributes.

3 years ago[analyzer] [NFC] Eliminate dispatchCast, evalCastFromNonLoc and evalCastFromLoc funct...
Denys Petrov [Tue, 13 Apr 2021 15:55:53 +0000 (18:55 +0300)]
[analyzer] [NFC] Eliminate dispatchCast, evalCastFromNonLoc and evalCastFromLoc functions from SValBuilder

Summary: Remove dispatchCast, evalCastFromNonLoc and evalCastFromLoc functions since their functionality has been moved to common evalCast function. Use evalCast instead.

Post-clean up patch for https://reviews.llvm.org/D96090 patch. The patch shall not change any behavior.

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

3 years ago[lld-macho] arm64_32 executables are always PIE
Jez Ng [Tue, 13 Apr 2021 15:45:41 +0000 (11:45 -0400)]
[lld-macho] arm64_32 executables are always PIE

This should fix the assert that's currently breaking the build.

3 years agoBPF: generate proper BTF for globals with WeakODRLinkage
Yonghong Song [Tue, 13 Apr 2021 05:45:51 +0000 (22:45 -0700)]
BPF: generate proper BTF for globals with WeakODRLinkage

For a global weak symbol defined as below:
  char g __attribute__((weak)) = 2;
LLVM generates an allocated global with WeakAnyLinkage,
for which BPF backend generates proper BTF info.

For the above example, if a modifier "const" is added like
  const char g __attribute__((weak)) = 2;
LLVM generates an allocated global with WeakODRLinkage,
for which BPF backend didn't generate any BTF as it
didn't handle WeakODRLinkage.

This patch addes support for WeakODRLinkage and proper
BTF info can be generated for weak symbol defined with
"const" modifier.

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

3 years ago[clangd] Propagate data in diagnostics
Kadir Cetinkaya [Fri, 12 Mar 2021 15:10:24 +0000 (16:10 +0100)]
[clangd] Propagate data in diagnostics

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

3 years ago[clangd] Introduce ASTHooks to FeatureModules
Kadir Cetinkaya [Fri, 12 Mar 2021 13:23:45 +0000 (14:23 +0100)]
[clangd] Introduce ASTHooks to FeatureModules

These can be invoked at different stages while building an AST to let
FeatureModules implement features on top of it. The patch also
introduces a sawDiagnostic hook, which can mutate the final clangd::Diag
while reading a clang::Diagnostic.

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

3 years ago[clangd] Enable modules to contribute tweaks.
Kadir Cetinkaya [Fri, 12 Mar 2021 11:27:19 +0000 (12:27 +0100)]
[clangd] Enable modules to contribute tweaks.

First patch to enable diagnostic fix generation through modules. The
workflow will look like:
- ASTWorker letting modules know about diagnostics while building AST,
modules can read clang::Diagnostic and mutate clangd::Diagnostic through
that hook.
- Modules can implement and expose tweaks to fix diagnostics or act as
general refactorings.
- Tweak::Selection will contain information about the diagnostic
associated with the codeAction request to enable modules to fail their
diagnostic fixing tweakson prepare if need be.

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

3 years ago[mlir] X86Vector: Add AVX Rsqrt
Emilio Cota [Tue, 13 Apr 2021 15:33:17 +0000 (08:33 -0700)]
[mlir] X86Vector: Add AVX Rsqrt

Reviewed By: aartbik

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

3 years ago[docs][scudo] Update Scudo documentation
Kostya Kortchinsky [Fri, 9 Apr 2021 21:15:13 +0000 (14:15 -0700)]
[docs][scudo] Update Scudo documentation

Update the Scudo document to align with the standalone version.
Add some more verbiage about the various component of the
allocator, rework a bit everything.
The build instructions have been updated.
The options and their default values have been updated, and
the `mallopt` ones have been added.

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

3 years ago[libc++] [P0458] Add map::contains and set::contains for heterogenous lookup missed...
Marek Kurdej [Tue, 13 Apr 2021 15:10:55 +0000 (17:10 +0200)]
[libc++] [P0458] Add map::contains and set::contains for heterogenous lookup missed in a17b1aed.

Commit rGa17b1aed added `bool contains(const key_type& x) const;` methods to associative containers, but didn't add `template<class K> bool contains(const K& x) const;` for heterogenous lookup.

Reviewed By: #libc, Quuxplusone, ldionne

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

3 years ago[AsmParser][SystemZ][z/OS] Add in support to allow use of additional comment strings.
Anirudh Prasad [Tue, 13 Apr 2021 15:07:46 +0000 (11:07 -0400)]
[AsmParser][SystemZ][z/OS] Add in support to allow use of additional comment strings.

- Currently, MCAsmInfo provides a CommentString attribute, that various targets can set, so that the AsmLexer can appropriately lex a string as a comment based on the set value of the attribute.
- However, AsmLexer also supports a few additional comment syntaxes, in addition to what's specified as a CommentString attribute. This includes regular C-style block comments (/* ... */), regular C-style line comments (// .... ) and #. While I'm not sure as to why this behaviour exists, I am assuming it does to maintain backward compatibility with GNU AS (see https://sourceware.org/binutils/docs/as/Comments.html#Comments for reference)
For example:
Consider a target which sets the CommentString attribute to '*'.
The following strings are all lexed as comments.

```
"# abc" -> comment
"// abc" -> comment
"/* abc */ -> comment
"* abc" -> comment
```

- In HLASM however, only "*" is accepted as a comment string, and nothing else.
- To achieve this, an additional attribute (`AllowAdditionalComments`) has been added to MCAsmInfo. If this attribute is set to false, then only the string specified by the CommentString attribute is used as a possible comment string to be lexed by the AsmLexer. The regular C-style block comments, line comments and "#" are disabled. As a final note, "#" will still be treated as a comment, if the CommentString attribute is set to "#".

Depends on https://reviews.llvm.org/D99277

Reviewed By: abhina.sreeskantharajan, myiwanch

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

3 years ago[lldb/test] s/add_no_ack_remote_stream/do_handshake
Pavel Labath [Tue, 13 Apr 2021 15:03:09 +0000 (17:03 +0200)]
[lldb/test] s/add_no_ack_remote_stream/do_handshake

These two functions are doing the same thing, only one of them is
sending the packets immediately and the other "queues" them to be sent
later. The first one is better as in case of errors, the backtrace will
point straight to the place that caused them.

Modify the first method to avoid duplication, and ten standardize on it.

3 years ago[analyzer] Replace StoreManager::CastRetrievedVal with SValBuilder::evalCast
Denys Petrov [Tue, 13 Apr 2021 15:09:10 +0000 (18:09 +0300)]
[analyzer] Replace StoreManager::CastRetrievedVal with SValBuilder::evalCast

Summary: Move logic from CastRetrievedVal to evalCast and replace CastRetrievedVal with evalCast. Also move guts from SimpleSValBuilder::dispatchCast inside evalCast.
evalCast intends to substitute dispatchCast, evalCastFromNonLoc and evalCastFromLoc in the future. OriginalTy provides additional information for casting, which is useful for some cases and useless for others.  If `OriginalTy.isNull()` is true, then cast performs based on CastTy only. Now evalCast operates in two ways. It retains all previous behavior and take over dispatchCast behavior. dispatchCast, evalCastFromNonLoc and evalCastFromLoc is considered as buggy since it doesn't take into account OriginalTy of the SVal and should be improved.

From this patch use evalCast instead of dispatchCast, evalCastFromNonLoc and evalCastFromLoc functions. dispatchCast redirects to evalCast.

This patch shall not change any behavior.

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

3 years ago[lld-macho] Make load relaxation work for arm64_32
Jez Ng [Tue, 13 Apr 2021 14:40:24 +0000 (10:40 -0400)]
[lld-macho] Make load relaxation work for arm64_32

arm64_32 uses 32-bit GOT loads, so we should accept those
instructions in `ARM64Common::relaxGotLoad()` too.

Reviewed By: #lld-macho, gkm

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

3 years ago[lld-macho] Have toString() emit full path to archive files
Jez Ng [Tue, 13 Apr 2021 14:40:22 +0000 (10:40 -0400)]
[lld-macho] Have toString() emit full path to archive files

It doesn't make sense to take just the base filename for archives when we emit
the full path for object files. (LLD-ELF emits the full path too.)

This will also make it easier to write a proper test for {D100147}.

Reviewed By: #lld-macho, oontvoo

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

3 years ago[lld-macho] Add 32-bit compact unwind support
Jez Ng [Tue, 13 Apr 2021 14:40:21 +0000 (10:40 -0400)]
[lld-macho] Add 32-bit compact unwind support

This could probably have been part of D99633, but I split it up to make
things a bit more reviewable. I also fixed some bugs in the implementation that
were masked through integer underflows when operating in 64-bit mode.

Reviewed By: #lld-macho, gkm

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

3 years ago[lld-macho] Add support for arm64_32
Jez Ng [Tue, 13 Apr 2021 14:40:20 +0000 (10:40 -0400)]
[lld-macho] Add support for arm64_32

From what I can tell, it's pretty similar to arm64. The two main differences
are:

1. No 64-bit relocations
2. Stub code writes to 32-bit registers instead of 64-bit

Plus of course the various on-disk structures like `segment_command` are using
the 32-bit instead of the 64-bit variants.

Reviewed By: #lld-macho, gkm

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

3 years ago[lldb][AArch64] Only run MTE memory region test if we have MTE
David Spickett [Tue, 13 Apr 2021 14:37:06 +0000 (15:37 +0100)]
[lldb][AArch64] Only run MTE memory region test if we have MTE

This test is flakey because it tries to read the proc/smaps
file of the first lldb-server process it finds. This process
can finish before we finish doing that.

http://lab.llvm.org:8011/#/builders/96/builds/6634/steps/6/logs/stdio

For now limit this to MTE targets which basically means
QEMU via lldb-dotest, which doesn't have this issue.

I'll fix the race condition shortly.

3 years ago[mlir][linalg] update tiling to support linalg index operations.
Tobias Gysi [Tue, 13 Apr 2021 14:04:45 +0000 (14:04 +0000)]
[mlir][linalg] update tiling to support linalg index operations.

The patch updates the tiling pass to add the tile offsets to the indices returned by the linalg operations.

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

3 years ago[lldb] Remove self-skipping code from lldb-server tests
Pavel Labath [Tue, 13 Apr 2021 14:21:45 +0000 (16:21 +0200)]
[lldb] Remove self-skipping code from lldb-server tests

We already do category based skipping in checkDebugServerSupport in
dotest.py.

3 years agoStackProtector: ensure protection does not interfere with tail call frame.
Tim Northover [Wed, 17 Mar 2021 10:48:20 +0000 (10:48 +0000)]
StackProtector: ensure protection does not interfere with tail call frame.

The IR stack protector pass must insert stack checks before the call instead of
between it and the return.

Similarly, SDAG one should recognize that ADJCALLFRAME instructions could be
part of the terminal sequence of a tail call. In this case because such call
frames cannot be nested in LLVM the stack protection code must skip over the
whole sequence (or risk clobbering argument registers).

3 years ago[lldb] Remote @debugserver_test from TestAppleSimulatorOSType
Pavel Labath [Thu, 14 Jan 2021 14:13:07 +0000 (15:13 +0100)]
[lldb] Remote @debugserver_test from TestAppleSimulatorOSType

The annotation is now (since the introduction of @apple_simulator_test)
redundant, and the test could theoretically run on lldb-server too (if
it supported darwin hosts).

3 years ago[TTI] NFC: Change get[Interleaved]MemoryOpCost to return InstructionCost
Sander de Smalen [Sat, 23 Jan 2021 12:14:21 +0000 (12:14 +0000)]
[TTI] NFC: Change get[Interleaved]MemoryOpCost to return InstructionCost

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: dmgreen

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

3 years ago[TTI] NFC: Change getMaskedMemoryOpCost to return InstructionCost
Sander de Smalen [Fri, 22 Jan 2021 22:41:19 +0000 (22:41 +0000)]
[TTI] NFC: Change getMaskedMemoryOpCost to return InstructionCost

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: dmgreen

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

3 years ago[TTI] NFC: Change getCmpSelInstrCost to return InstructionCost
Sander de Smalen [Fri, 22 Jan 2021 21:44:23 +0000 (21:44 +0000)]
[TTI] NFC: Change getCmpSelInstrCost to return InstructionCost

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: dmgreen

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

3 years ago[TTI] NFC: Change getMinMaxReductionCost to return InstructionCost
Sander de Smalen [Fri, 22 Jan 2021 22:07:09 +0000 (22:07 +0000)]
[TTI] NFC: Change getMinMaxReductionCost to return InstructionCost

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: dmgreen

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

3 years ago[TTI] NFC: Change getArithmeticReductionCost to return InstructionCost
Sander de Smalen [Fri, 22 Jan 2021 21:33:51 +0000 (21:33 +0000)]
[TTI] NFC: Change getArithmeticReductionCost to return InstructionCost

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

This patch is practically NFC, with the exception of an AArch64 SVE related
cost-model change, where we can now return an Invalid cost instead of some
bogus number.

Reviewed By: dmgreen

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

3 years ago[TTI] NFC: Change getGatherScatterOpCost to return InstructionCost
Sander de Smalen [Fri, 22 Jan 2021 21:25:50 +0000 (21:25 +0000)]
[TTI] NFC: Change getGatherScatterOpCost to return InstructionCost

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: dmgreen

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

3 years ago[TTI] NFC: Change getCastInstrCost and getExtractWithExtendCost to return InstructionCost
Sander de Smalen [Thu, 21 Jan 2021 13:40:22 +0000 (13:40 +0000)]
[TTI] NFC: Change getCastInstrCost and getExtractWithExtendCost to return InstructionCost

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: dmgreen

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

3 years ago[AMDGPU] Set implicit arg attributes for indirect calls
madhur13490 [Thu, 25 Mar 2021 07:25:51 +0000 (07:25 +0000)]
[AMDGPU] Set implicit arg attributes for indirect calls

This patch adds attributes corresponding to
implicits to functions/kernels if
1. it has an indirect call OR
2. it's address is taken.

Once such attributes are set, rest of the codegen would work
out-of-box for indirect calls. This patch eliminates
the potential overhead -fixed-abi imposes even though indirect functions
calls are not used.

Reviewed By: arsenm

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

3 years ago[gn build] Port be54341cd2ff
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:25 +0000 (13:07 +0000)]
[gn build] Port be54341cd2ff

3 years ago[gn build] Port 9b0a3388eb36
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:25 +0000 (13:07 +0000)]
[gn build] Port 9b0a3388eb36

3 years ago[gn build] Port 916fecb499c5
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:24 +0000 (13:07 +0000)]
[gn build] Port 916fecb499c5

3 years ago[gn build] Port 7f1963dc8e23
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:23 +0000 (13:07 +0000)]
[gn build] Port 7f1963dc8e23

3 years ago[gn build] Port 4f9b2469f33f
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:23 +0000 (13:07 +0000)]
[gn build] Port 4f9b2469f33f

3 years ago[gn build] Port 21d6636d83b3
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:22 +0000 (13:07 +0000)]
[gn build] Port 21d6636d83b3

3 years ago[gn build] fix bug in fb0b19c3de3b
Nico Weber [Tue, 13 Apr 2021 13:06:11 +0000 (09:06 -0400)]
[gn build] fix bug in fb0b19c3de3b

Since __config is no longer in the concatenated generated __config_site,
it now needs to be copied.

(Also fix a comment typo while here.)

3 years ago[lldb] Require x86 for various NativePDB, Breakpad and Minidump tests
David Spickett [Fri, 9 Apr 2021 13:19:20 +0000 (13:19 +0000)]
[lldb] Require x86 for various NativePDB, Breakpad and Minidump tests

These tests fail if you build without the x86 llvm backend.
Either because they use an x86 triple or try to backtrace which
requires some x86 knowledge to see all frames.

Reviewed By: labath

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

3 years agoReland "[lldb] [Process] Watch for fork/vfork notifications" for Linux
Michał Górny [Tue, 13 Apr 2021 12:37:56 +0000 (14:37 +0200)]
Reland "[lldb] [Process] Watch for fork/vfork notifications" for Linux

Big thanks to Pavel Labath for figuring out my mistake.

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

3 years agoReland "[lldb] [Process] Watch for fork/vfork notifications" for NetBSD
Michał Górny [Tue, 13 Apr 2021 11:59:05 +0000 (13:59 +0200)]
Reland "[lldb] [Process] Watch for fork/vfork notifications" for NetBSD

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

3 years ago[libc++] Move pointer safety related utilities out of <memory>
Louis Dionne [Fri, 9 Apr 2021 19:57:21 +0000 (15:57 -0400)]
[libc++] Move pointer safety related utilities out of <memory>

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

3 years ago[libc++] Split std::shared_ptr & friends out of <memory>
Louis Dionne [Fri, 9 Apr 2021 19:16:14 +0000 (15:16 -0400)]
[libc++] Split std::shared_ptr & friends out of <memory>

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

3 years ago[libc++] Split std::unique_ptr out of <memory>
Louis Dionne [Fri, 9 Apr 2021 19:00:57 +0000 (15:00 -0400)]
[libc++] Split std::unique_ptr out of <memory>

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

3 years ago[libc++] Split the memory-related algorithms out of <memory>
Louis Dionne [Fri, 9 Apr 2021 18:47:46 +0000 (14:47 -0400)]
[libc++] Split the memory-related algorithms out of <memory>

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