platform/upstream/llvm.git
4 years ago[lldb/Test] Don't use the env to pass around configuration variables (NFC)
Jonas Devlieghere [Tue, 2 Jun 2020 23:49:03 +0000 (16:49 -0700)]
[lldb/Test] Don't use the env to pass around configuration variables (NFC)

Don't use the environment to pass values to the builder. Use the
configuration instead.

4 years ago[lldb/Test] Pass Make arguments in invocation instead of environment
Jonas Devlieghere [Tue, 2 Jun 2020 23:40:07 +0000 (16:40 -0700)]
[lldb/Test] Pass Make arguments in invocation instead of environment

The Darwin builder is passing some of the make arguments trough the
environment instead of the command line. Update the dsym builder to do
the same as the other variants.

4 years ago[mlir][spirv] Fix coop matrix getExtension
Thomas Raoux [Tue, 2 Jun 2020 23:30:43 +0000 (16:30 -0700)]
[mlir][spirv] Fix coop matrix getExtension

Stack variable was being used beyond its lifetime.

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

4 years ago[mlir][spirv] Fix encoding of cooperative matrix type to match SPIRV spec
Thomas Raoux [Tue, 2 Jun 2020 23:14:24 +0000 (16:14 -0700)]
[mlir][spirv] Fix encoding of cooperative matrix type to match SPIRV spec

Scope, rows and columns need to be encoded in a separate constant operation.

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

4 years ago[X86] Add a flag to guard the wide load
Guozhi Wei [Tue, 2 Jun 2020 23:12:50 +0000 (16:12 -0700)]
[X86] Add a flag to guard the wide load

As shown in http://lists.llvm.org/pipermail/llvm-dev/2020-May/141854.html,
widen load can also cause stall. Add a flag to guard the widening code,
so users can disable it and evaluate its performance impact.

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

4 years ago[lldb/Test] Don't use the env to pass around configuration variables (NFC)
Jonas Devlieghere [Tue, 2 Jun 2020 23:08:11 +0000 (16:08 -0700)]
[lldb/Test] Don't use the env to pass around configuration variables (NFC)

Don't use the environment to pass values to the builder that are present
in the dotest configuration module. A subsequent patch will pass the
remaining values through the configuration instead of the environment.

4 years ago[MTE] Convert StackSafety into analysis
Vitaly Buka [Fri, 29 May 2020 00:26:15 +0000 (17:26 -0700)]
[MTE] Convert StackSafety into analysis

This lets us to remove !stack-safe metadata and
better controll when to perform StackSafety
analysis.

Reviewers: eugenis

Subscribers: hiraditya, steven_wu, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[StackSafety] Delete useless test
Vitaly Buka [Mon, 1 Jun 2020 07:21:55 +0000 (00:21 -0700)]
[StackSafety] Delete useless test

4 years ago[Analyzer][NFC] Fix markup in WebKit checkers documentation
Jan Korous [Tue, 2 Jun 2020 23:03:24 +0000 (16:03 -0700)]
[Analyzer][NFC] Fix markup in WebKit checkers documentation

4 years ago[Clang][A32/T32][Linux] -O1 implies -fomit-frame-pointer
Nick Desaulniers [Tue, 2 Jun 2020 22:54:09 +0000 (15:54 -0700)]
[Clang][A32/T32][Linux] -O1 implies -fomit-frame-pointer

Summary:
An upgrade of LLVM for CrOS [0] containing [1] triggered a bunch of
errors related to writing to reserved registers for a Linux kernel's
arm64 compat vdso (which is a aarch32 image).

After a discussion on LKML [2], it was determined that
-f{no-}omit-frame-pointer was not being specified. Comparing GCC and
Clang [3], it becomes apparent that GCC defaults to omitting the frame
pointer implicitly when optimizations are enabled, and Clang does not.
ie. setting -O1 (or above) implies -fomit-frame-pointer. Clang was
defaulting to -fno-omit-frame-pointer implicitly unless -fomit-frame-pointer
was set explicitly.

Why this becomes a problem is that the Linux kernel's arm64 compat vdso
contains code that uses r7. r7 is used sometimes for the frame pointer
(for example, when targeting thumb (-mthumb)). See useR7AsFramePointer()
in llvm/llvm-project/llvm/lib/Target/ARM/ARMSubtarget.h. This is mostly
for legacy/compatibility reasons, and the 2019 Q4 revision of the ARM
AAPCS looks to standardize r11 as the frame pointer for aarch32, though
this is not yet implemented in LLVM.

Users that are reliant on the implicit value if unspecified when
optimizations are enabled should explicitly choose -fomit-frame-pointer
(new behavior) or -fno-omit-frame-pointer (old behavior).

[0] https://bugs.chromium.org/p/chromium/issues/detail?id=1084372
[1] https://reviews.llvm.org/D76848
[2] https://lore.kernel.org/lkml/20200526173117.155339-1-ndesaulniers@google.com/
[3] https://godbolt.org/z/0oY39t

Reviewers: kristof.beyls, psmith, danalbert, srhines, MaskRay, ostannard, efriedma

Reviewed By: psmith, danalbert, srhines, MaskRay, efriedma

Subscribers: efriedma, olista01, MaskRay, vhscampos, cfe-commits, llvm-commits, manojgupta, llozano, glider, hctim, eugenis, pcc, peter.smith, srhines

Tags: #clang, #llvm

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

4 years ago[mlir][Affine] Enable fusion of loops with vector loads/stores
Diego Caballero [Tue, 2 Jun 2020 22:10:47 +0000 (01:10 +0300)]
[mlir][Affine] Enable fusion of loops with vector loads/stores

This patch enables affine loop fusion for loops with affine vector loads
and stores. For that, we only had to use affine memory op interfaces in
LoopFusionUtils.cpp and Utils.cpp so that vector loads and stores are
also taken into account.

Reviewed By: andydavis1, ftynse

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

4 years ago[lld-macho] Fix PAGEZERO=4GB errors on Windows by ensuring enum is uint64_t
Jez Ng [Tue, 2 Jun 2020 22:22:45 +0000 (15:22 -0700)]
[lld-macho] Fix PAGEZERO=4GB errors on Windows by ensuring enum is uint64_t

It appears that MSVC doesn't resize the enum properly to fit the
constants.

4 years agoUndo initialization of TRI in CGP as this is unconditionally initialized
Eric Christopher [Tue, 2 Jun 2020 22:05:54 +0000 (15:05 -0700)]
Undo initialization of TRI in CGP as this is unconditionally initialized
later.

4 years ago[mlir] NFC - Add AffineMinMaxOpBase getDim/SymbolOperands
Nicolas Vasilache [Tue, 2 Jun 2020 22:04:10 +0000 (18:04 -0400)]
[mlir] NFC - Add AffineMinMaxOpBase getDim/SymbolOperands

4 years agoUndo removal of test for dr777.
Richard Smith [Tue, 2 Jun 2020 20:51:35 +0000 (13:51 -0700)]
Undo removal of test for dr777.

4 years ago[X86] Remove DeleteNode calls from PreprocessISelDAG. Rely on the RemoveDeadNodes...
Craig Topper [Tue, 2 Jun 2020 20:54:10 +0000 (13:54 -0700)]
[X86] Remove DeleteNode calls from PreprocessISelDAG. Rely on the RemoveDeadNodes call at the end.

Add a MadeChange flag so we don't call RemoveDeadNodes unless
something changed.

4 years ago[LLD] Have only one SpecificAllocator per type
Reid Kleckner [Tue, 2 Jun 2020 20:58:50 +0000 (13:58 -0700)]
[LLD] Have only one SpecificAllocator per type

Previously, the SpecificAllocator was a static local in the `make<T>`
function template. Using static locals is nice because they are only
constructed and registered if they are accessed. However, if there are
multiple calls to make<> with different constructor parameters, we would
get multiple static local variable instances. This is undesirable and
leads to extra memory allocations. I noticed there were two sources of
DefinedRegular allocations while checking heap profiles.

4 years ago[X86] Cleanup inconsistencies in our zext/sext vector patterns.
Craig Topper [Tue, 2 Jun 2020 19:24:26 +0000 (12:24 -0700)]
[X86] Cleanup inconsistencies in our zext/sext vector patterns.

-Fix one place where we had a X86vzload64 but should have had
 X86vzload32.
-Make sure all patterns that have scalar_to_vector+loadi64 also
have scalar_to_vector+f64 to match 32-bit codegen.
-Add some bitcasts that were missing from patterns.
-Make sure that if we have a scalar_to_vector+load pattern
 we also have a vzload pattern.

We probably need some better canonicalization to avoid having
so many patterns.

4 years agoPR23029 / C++ DR2233: Allow expanded parameter packs to follow
Richard Smith [Tue, 2 Jun 2020 17:42:36 +0000 (10:42 -0700)]
PR23029 / C++ DR2233: Allow expanded parameter packs to follow
parameters with default arguments.

Directly follow the wording by relaxing the AST invariant that all
parameters after one with a default arguemnt also have default
arguments, and removing the diagnostic on missing default arguments
on a pack-expanded parameter following a parameter with a default
argument.

Testing also revealed that we need to special-case explicit
specializations of templates with a pack following a parameter with a
default argument, as such explicit specializations are otherwise
impossible to write. The standard wording doesn't address this case; a
issue has been filed.

This exposed a bug where we would briefly consider a parameter to have
no default argument while we parse a delay-parsed default argument for
that parameter, which is also fixed.

Partially incorporates a patch by Raul Tambre.

4 years ago[llvm] Fix unused variable warning
Kadir Cetinkaya [Tue, 2 Jun 2020 20:46:24 +0000 (22:46 +0200)]
[llvm] Fix unused variable warning

4 years ago[gn build] Port f99d5f8c32a
LLVM GN Syncbot [Tue, 2 Jun 2020 20:36:52 +0000 (20:36 +0000)]
[gn build] Port f99d5f8c32a

4 years ago[libc] Remove integration test target from check libc.
Paula Toth [Tue, 2 Jun 2020 20:25:03 +0000 (13:25 -0700)]
[libc] Remove integration test target from check libc.

Summary:
This is failing on the asan build because we use `-nostdlib`.
I also took this opportunity to make the target name match the naming structure we've been using.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

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

4 years ago[mlir][spirv] Add support for matrix type
HazemAbdelhafez [Tue, 2 Jun 2020 20:22:38 +0000 (16:22 -0400)]
[mlir][spirv] Add support for matrix type

This commit adds basic matrix type support to the SPIR-V dialect
including type definition, IR assembly, parsing, printing, and
(de)serialization.

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

4 years agoFix up clang-tidy warnings around null and pointers.
Eric Christopher [Tue, 2 Jun 2020 20:23:41 +0000 (13:23 -0700)]
Fix up clang-tidy warnings around null and pointers.

4 years ago[DAGCombiner] Combine shifts into multiply-high
Amy Kwan [Tue, 2 Jun 2020 18:01:27 +0000 (13:01 -0500)]
[DAGCombiner] Combine shifts into multiply-high

This patch implements a target independent DAG combine to produce multiply-high
instructions from shifts. This DAG combine will combine shifts for any type as
long as the MULH on the narrow type is legal.

For now, it is enabled on PowerPC as PowerPC is the only target that has an
implementation of the isMulhCheaperThanMulShift TLI hook introduced in
D78271.

Moreover, this DAG combine focuses on catching the pattern:
(shift (mul (ext <narrow_type>:$a to <wide_type>), (ext <narrow_type>:$b to <wide_type>)), <narrow_width>)
to produce mulhs when we have a sign-extend, and mulhu when we have
a zero-extend.

The patch performs the following checks:
- Operation is a right shift arithmetic (sra) or logical (srl)
- Input to the shift is a multiply
- Both operands to the shift are sext/zext nodes
- The extends into the multiply are both the same
- The narrow type is half the width of the wide type
- The shift amount is the width of the narrow type
- The respective mulh operation is legal

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

4 years ago[Driver] Add multiclass OptInFlag and OptOutFlag to simplify boolean option definition
Fangrui Song [Tue, 2 Jun 2020 20:16:44 +0000 (13:16 -0700)]
[Driver] Add multiclass OptInFlag and OptOutFlag to simplify boolean option definition

Reviewed By: dblaikie, echristo

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

4 years ago[NFC][ASTMatchers] StringRef-ify and Twine-ify ASTMatchers tests.
Nathan James [Tue, 2 Jun 2020 20:20:58 +0000 (21:20 +0100)]
[NFC][ASTMatchers] StringRef-ify and Twine-ify ASTMatchers tests.

4 years ago[lld-macho] Ensure reads from nlist_64 structs are aligned when necessary
Jez Ng [Thu, 21 May 2020 22:26:35 +0000 (15:26 -0700)]
[lld-macho] Ensure reads from nlist_64 structs are aligned when necessary

My test refactoring in D80217 seems to have caused yaml2obj to emit
unaligned nlist_64 structs, causing ASAN'd lld to be unhappy. I don't
think this is an issue with yaml2obj though -- llvm-mc also seems to
emit unaligned nlist_64s. This diff makes lld able to safely do aligned
reads under ASAN builds while hopefully creating no overhead for regular
builds on architectures that support unaligned reads.

Reviewed By: thakis

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

4 years ago[lld-macho] Move all tests for erroneous inputs under invalid/
Jez Ng [Tue, 19 May 2020 14:57:14 +0000 (07:57 -0700)]
[lld-macho] Move all tests for erroneous inputs under invalid/

For consistency.

The no-id-dylib test was originally referencing the Inputs/ folder via a
relative path. Instead of updating that path, I decided to make the test
self-contained.

Reviewed By: MaskRay

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

4 years ago[lld-macho] Set __PAGEZERO size to 4GB
Jez Ng [Tue, 19 May 2020 03:28:50 +0000 (20:28 -0700)]
[lld-macho] Set __PAGEZERO size to 4GB

That's what ld64 uses for 64-bit targets. I figured it's best to make
this change sooner rather than later since a bunch of our tests are
relying on hardcoded addresses that depend on this value.

Reviewed By: smeenai

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

4 years ago[lld-macho] Error on encountering undefined symbols
Jez Ng [Mon, 18 May 2020 22:46:33 +0000 (15:46 -0700)]
[lld-macho] Error on encountering undefined symbols

... instead of silently emitting a reference to the zero address.

Reviewed By: smeenai

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

4 years ago[lld-macho] Add some relocation validation logic
Jez Ng [Fri, 15 May 2020 20:42:28 +0000 (13:42 -0700)]
[lld-macho] Add some relocation validation logic

I considered making a `Target::validate()` method, but I wasn't sure how
I felt about the overhead of doing yet another switch-dispatch on the
relocation type, so I put the validation in `relocateOne` instead...
might be a bit of a micro-optimization, but `relocateOne` does assume
certain things about the relocations it gets, and this error handling
makes that explicit, so it's not a totally unreasonable code
organization.

Reviewed By: smeenai

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

4 years agoFix test on PS4 linux bot.
Douglas Yung [Tue, 2 Jun 2020 20:14:09 +0000 (20:14 +0000)]
Fix test on PS4 linux bot.

Commit 301a6da8c24a09052e3bda10e90b450b7b39ffea changed the test and modified a CHECK
line that is inconsisent with similar lines elsewhere in the file and was causing failures
when run in slightly different configurations. This change makes the line more consistent
and should fix the bot failure.

link: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/68593
4 years ago[WebAssembly] Eliminate range checks on br_tables
Thomas Lively [Tue, 2 Jun 2020 20:14:27 +0000 (13:14 -0700)]
[WebAssembly] Eliminate range checks on br_tables

Summary:
Jump tables for most targets cannot handle out of range indices by
themselves, so LLVM emits range checks to guard the jump
tables. WebAssembly, on the other hand, implements jump tables using
the br_table instruction, which takes a default branch target as an
operand, making the range checks redundant. This patch introduces a
new MachineFunction pass in the WebAssembly backend to find and
eliminate the redundant range checks.

Reviewers: aheejin, dschuff

Subscribers: mgorny, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

4 years ago[Analyzer][WebKit] Check record definition is available in NoUncountedMembers checker
Jan Korous [Tue, 2 Jun 2020 17:17:01 +0000 (10:17 -0700)]
[Analyzer][WebKit] Check record definition is available in NoUncountedMembers checker

isRefCountable asserts that the record passed as an argument has a definition available.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=46142

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

4 years ago[RISCV-V] Provide muldi3 builtin assembly implementation
kamlesh kumar [Tue, 2 Jun 2020 19:48:30 +0000 (20:48 +0100)]
[RISCV-V] Provide muldi3 builtin assembly implementation

Provides an assembly implementation of muldi3 for RISC-V, to solve bug 43388.
Since the implementation is the same as for mulsi3, that code was moved to
`riscv/int_mul_impl.inc` and is now reused by both `mulsi3.S` and `muldi3.S`.

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

4 years ago[WebAssembly] Improve macro hygiene in wasm_simd128.h
Thomas Lively [Tue, 2 Jun 2020 19:55:06 +0000 (12:55 -0700)]
[WebAssembly] Improve macro hygiene in wasm_simd128.h

Summary:
The shuffle intrinsic macros did not parenthesize usages of their
constant parameters, which could lead to incorrect results due to
operator precedence issues. This patch fixes the problem by adding the
missing paretheses.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, cfe-commits

Tags: #clang

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

4 years ago[libc] Add integration tests.
Paula Toth [Tue, 2 Jun 2020 19:13:57 +0000 (12:13 -0700)]
[libc] Add integration tests.

Summary:
This patch aims to add integration tests to check the following:
1) Header files are generated as expected.
2) Libc functions have the correct public name.
3) Libc functions have the correct return type and parameter types.
4) Symbols are exposed in the public lib.a files.

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra

Subscribers: aheejin, ecnelises, dxf, mgorny, jfb, tschuett, libc-commits

Tags: #libc-project

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

4 years ago[TableGen] Avoid generating switch with just default
dstuttar [Tue, 2 Jun 2020 18:12:54 +0000 (19:12 +0100)]
[TableGen] Avoid generating switch with just default

Summary:
Switch with just default causes an MSVC warning (warning C4065: switch statement
contains 'default' but no 'case' labels).

Change-Id: I9ddeccdef93666256b5454b164b567b73b488461

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoFix compiler crash when an expression parsed in the tentative parsing and must be...
Alexey Bataev [Fri, 29 May 2020 21:56:07 +0000 (17:56 -0400)]
Fix compiler crash when an expression parsed in the tentative parsing and must be claimed in the another evaluation context.

Summary:
Clang crashes when trying to finish function body. MaybeODRUseExprs is
not empty because of const static data member parsed in outer evaluation
context, upon call for isTypeIdInParens() function. It builds
annot_primary_expr, later parsed in ParseConstantExpression() in
inner constant expression evaluation context.

Reviewers: rjmccall, rsmith

Subscribers: cfe-commits

Tags: #clang

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

4 years agoUpdate 'git push' command in GettingStarted guide
Diego Caballero [Tue, 2 Jun 2020 17:14:17 +0000 (20:14 +0300)]
Update 'git push' command in GettingStarted guide

'git push' command, without any other arguments, can do different
things depending on the local configuration of Git. This patch
updates the 'git push' command with extra arguments to be more
resilient to any local configuration.

Reviewed By: mehdi_amini

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

4 years ago[Sema] Use isAlwaysUninit for -Wuninitialized-const-reference after D79895
Fangrui Song [Tue, 2 Jun 2020 18:25:03 +0000 (11:25 -0700)]
[Sema] Use isAlwaysUninit for -Wuninitialized-const-reference after D79895

4 years ago[llvm-dwarfdump] Print [=<offset>] after --debug-* options in help output.
Jonas Devlieghere [Tue, 2 Jun 2020 18:03:21 +0000 (11:03 -0700)]
[llvm-dwarfdump] Print [=<offset>] after --debug-* options in help output.

Some of the --debug-* options can take an optional offset. Although the
man page does a good job of making that clear, it's much harder to
discover from the help output.

Currently the only reference to this is the following sentence:

> Where applicable these parameters take an optional =<offset> argument
> to dump only the entry at the specified offset.

This patch changes the help output from to print [=<offset>] after the
options that take an offset.

  --debug-info[=<offset>]    - Dump the .debug_info section

rdar://problem/63150066

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

4 years agoAMDGPU: Fix a test to be more stable
Matt Arsenault [Tue, 2 Jun 2020 17:05:07 +0000 (13:05 -0400)]
AMDGPU: Fix a test to be more stable

The chained unconditional branches can be eliminated and it's not
relevant to the test.

4 years agoAMDGPU: Don't run indexing mode switches with exec = 0
Matt Arsenault [Tue, 2 Jun 2020 13:22:40 +0000 (09:22 -0400)]
AMDGPU: Don't run indexing mode switches with exec = 0

Add mode defs rather than special casing this like some of the other
instructions.

4 years agoAMDGPU: Don't run mode switches with exec 0
Matt Arsenault [Tue, 2 Jun 2020 01:37:13 +0000 (21:37 -0400)]
AMDGPU: Don't run mode switches with exec 0

These are scalar instructions that change vector instructions, so they
should not be executed without any active lanes.

The implementation of -amdgpu-skip-threshold also seem to be backwards
from expected, since decreasing it prevents removal.

4 years ago[mlir] Provide defaults to make enabling dumping simpler
Jacques Pienaar [Tue, 2 Jun 2020 17:47:06 +0000 (10:47 -0700)]
[mlir] Provide defaults to make enabling dumping simpler

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

4 years ago[PGO] Enable memcmp/bcmp size value profiling.
Hiroshi Yamauchi [Tue, 26 May 2020 18:02:17 +0000 (11:02 -0700)]
[PGO] Enable memcmp/bcmp size value profiling.

Summary: Following up D79751.

Reviewers: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] add tests for select-of-select-shuffle; NFC
Sanjay Patel [Tue, 2 Jun 2020 15:06:15 +0000 (11:06 -0400)]
[InstCombine] add tests for select-of-select-shuffle; NFC

4 years ago[InstCombine] regenerate complete test checks; NFC
Sanjay Patel [Tue, 2 Jun 2020 14:54:33 +0000 (10:54 -0400)]
[InstCombine] regenerate complete test checks; NFC

4 years ago[lldb] NFC remove DISALLOW_COPY_AND_ASSIGN
Konrad Kleine [Tue, 2 Jun 2020 16:19:55 +0000 (12:19 -0400)]
[lldb] NFC remove DISALLOW_COPY_AND_ASSIGN

Summary:
This is how I applied my clang-tidy check (see
https://reviews.llvm.org/D80531) in order to remove
`DISALLOW_COPY_AND_ASSIGN` and have deleted copy ctors and deleted
assignment operators instead.

```
lang=bash
grep DISALLOW_COPY_AND_ASSIGN /opt/notnfs/kkleine/llvm/lldb -r -l | sort | uniq > files

for i in $(cat files);
do
  clang-tidy \
    --checks="-*,modernize-replace-disallow-copy-and-assign-macro" \
    --format-style=LLVM \
    --header-filter=.* \
    --fix \
    -fix-errors \
    $i;
done
```

Reviewers: espindola, labath, aprantl, teemperor

Reviewed By: labath, aprantl, teemperor

Subscribers: teemperor, aprantl, labath, emaste, sbc100, aheejin, MaskRay, arphaman, usaxena95, lldb-commits

Tags: #lldb

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

4 years ago[Clang] Add a new warning to warn when passing uninitialized variables as const refer...
Zequan Wu [Tue, 2 Jun 2020 17:21:02 +0000 (10:21 -0700)]
[Clang] Add a new warning to warn when passing uninitialized variables as const reference parameters to a function

Summary:
Add a new warning -Wuninitialized-const-reference as a subgroup of -Wuninitialized to address a bug filed here: https://bugs.llvm.org/show_bug.cgi?id=45624

This warning is controlled by -Wuninitialized and can be disabled by -Wno-uninitialized-const-reference.
The warning is diagnosed when passing uninitialized variables as const reference parameters to a function.

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

4 years agoSupport ExtVectorType conditional operator
Min-Yih Hsu [Tue, 26 May 2020 06:27:34 +0000 (06:27 +0000)]
Support ExtVectorType conditional operator

Extension vectors now can be used in element-wise conditional selector.
For example:
```
R[i] = C[i]? A[i] : B[i]
```
This feature was previously only enabled in OpenCL C. Now it's also
available in C. Not that it has different behaviors than GNU vectors
(i.e. __vector_size__). Extension vectors selects on signdness of the
vector. GNU vectors on the other hand do normal bool conversions. Also,
this feature is not available in C++.

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

4 years ago[lldb] Skip tests exercising DW_OP_GNU_entry_value with dsymutil
Pavel Labath [Tue, 2 Jun 2020 16:22:25 +0000 (18:22 +0200)]
[lldb] Skip tests exercising DW_OP_GNU_entry_value with dsymutil

It seems that this opcode needs explicit support in dsymutil. Disable
these tests until that is implemented.

4 years ago[libc++abi] Make sure we link in CrashReporterClient.a when it's present
Louis Dionne [Tue, 2 Jun 2020 16:21:01 +0000 (12:21 -0400)]
[libc++abi] Make sure we link in CrashReporterClient.a when it's present

When building the system libc++abi for Apple, we use CrashReporterClient
to provide better crash logs when calling abort(). This is exemplified by
the fact that we test for the presence of <CrashReporterClient.h> in
abort_message.cpp.

However, we must link against CrashReporterClient.a in order to get that
functionality, otherwise we get a linking error.

4 years agoTypeSymbolEmitter.h - reduce includes to forward declarations. NFC.
Simon Pilgrim [Tue, 2 Jun 2020 15:29:16 +0000 (16:29 +0100)]
TypeSymbolEmitter.h - reduce includes to forward declarations. NFC.

4 years ago[flang] Fix release build flags.
David Truby [Fri, 29 May 2020 13:03:21 +0000 (14:03 +0100)]
[flang] Fix release build flags.

Summary:
This patch removes the custom CMAKE_RELEASE_CXX_FLAGS variable.
This variable being set was having the effect of removing other important
Release flags, notably `-DNDEBUG`.

This patch may need to be accompanied by fixes for the macOS issues that
the removed comment mentions; I don't have a mac to test this on though so
hopefully a reviewer can help with that.

Reviewers: Andrzej, tskeith, sscalpone

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

4 years ago[Dexter] Add DexLimitSteps command and ConditionalController
Tom Weaver [Tue, 2 Jun 2020 15:19:43 +0000 (16:19 +0100)]
[Dexter] Add DexLimitSteps command and ConditionalController

  * Adds DexLimitSteps Command.
  * Add ConditionalController, a new DebuggerController type.
  * 5 regression tests
  * documentation

  Reviewers: jmorse

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

4 years ago[Dexter] Add os.path.normcase(...) transform to test path early.
Tom Weaver [Tue, 2 Jun 2020 15:09:17 +0000 (16:09 +0100)]
[Dexter] Add os.path.normcase(...) transform to test path early.

  When passing a test path, if the path points directly at a file, then
  normcase would not be called on path.

  This would change the expected lower case drive path, on windows, to be
  uppercase. This patch simply calls normcase on the test path at the earliest
  point possible to avoid this issue.

  Reviewers: djtodoro, jmorse

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

4 years agoReinstate the syntax tree test for 'static' in an array subscript
Dmitri Gribenko [Tue, 2 Jun 2020 15:01:50 +0000 (17:01 +0200)]
Reinstate the syntax tree test for 'static' in an array subscript

Reviewers: eduucaldas

Reviewed By: eduucaldas

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[OPENMP50]Initial codegen for 'affinity' clauses.
Alexey Bataev [Tue, 19 May 2020 20:29:36 +0000 (16:29 -0400)]
[OPENMP50]Initial codegen for 'affinity' clauses.

Summary:
Added initial codegen for 'affinity' clauses on task directives.
Emits next code:
```
kmp_task_affinity_info_t affs[<num_elems>];

void *td = __kmpc_task_alloc(..);

affs[<i>].base = &data_i;
affs[<i>].size = sizeof(data_i);
__kmpc_omp_reg_task_with_affinity(&loc, <gtid>, td, <num_elems>, affs);
```

The result returned by the call of `__kmpc_omp_reg_task_with_affinity`
function is ignored currently sincethe  runtime currently ignores args
and returns 0 uncoditionally.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, sstefan1, llvm-commits, cfe-commits, caomhin

Tags: #clang, #llvm

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

4 years agoRenamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Dmitri Gribenko [Tue, 2 Jun 2020 14:10:39 +0000 (16:10 +0200)]
Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20

Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".

I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.

Reviewers: shafik, hlopko

Reviewed By: hlopko

Subscribers: jfb, martong, cfe-commits

Tags: #clang

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

4 years ago[yaml2obj] - Allocate the file space for SHT_NOBITS sections in some cases.
Georgii Rymar [Tue, 26 May 2020 16:05:52 +0000 (19:05 +0300)]
[yaml2obj] - Allocate the file space for SHT_NOBITS sections in some cases.

This teaches yaml2obj to allocate file space for a no-bits section
when there is a non-nobits section in the same segment that follows it.

It was discussed in D78005 thread and matches GNU linkers and LLD behavior.

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

4 years agoUse Pseudo Instruction to carry stack probing information
serge-sans-paille [Wed, 27 May 2020 15:42:28 +0000 (17:42 +0200)]
Use Pseudo Instruction to carry stack probing information

Instead of using a fake call and metadata to temporarily represent a probed
static alloca, use a pseudo instruction.

This is inspired by the SystemZ approach proposed in https://reviews.llvm.org/D78717.

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

4 years ago[AST][RecoveryExpr] Build RecoveryExpr for "undef_var" cases.
Haojian Wu [Thu, 28 May 2020 11:43:35 +0000 (13:43 +0200)]
[AST][RecoveryExpr] Build RecoveryExpr for "undef_var" cases.

Summary:
For a none-function-like unresolved expression, clang builds a TypoExpr
for it, and tries to correct it afterwards. If the typo-correction
fails, clang just drops the whole expr.

This patch improves the recovery strategy -- if the typo-correction
fails, we preserve the AST by degrading the typo exprs to recovery
exprs.

This would improve toolings for "undef_var" broken cases:
```
void foo();
void test() {
  fo^o(undef_var); // go-to-def, hover still works.
}
```

TESTED=ran tests with this patch + turn-on-recovery-ast patch, it breaks
one declare_variant_messages testcase (the diagnostics are slightly
changed), I think it is acceptable.

```
Error: 'error' diagnostics seen but not expected:
  File llvm-project/clang/test/OpenMP/declare_variant_messages.cpp Line 16: expected 'match' clause on 'omp declare variant' directive
  File llvm-project/clang/test/OpenMP/declare_variant_messages.cpp Line 57: expected 'match' clause on 'omp declare variant' directive
error: 'warning' diagnostics expected but not seen:
  File llvm-project/clang/test/OpenMP/declare_variant_messages.cpp Line 47: the context selector 'kind' in the context set 'device' cannot have a score ('<invalid>'); score ignored
  File llvm-project/clang/test/OpenMP/declare_variant_messages.cpp Line 87: the context selector 'kind' in the context set 'device' cannot have a score ('<invalid>'); score ignored
error: 'warning' diagnostics seen but not expected:
  File llvm-project/clang/test/OpenMP/declare_variant_messages.cpp Line 47: the context selector 'kind' in the context set 'device' cannot have a score ('<recovery-expr>()'); score ignored
  File llvm-project/clang/test/OpenMP/declare_variant_messages.cpp Line 87: the context selector 'kind' in the context set 'device' cannot have a score ('<recovery-expr>()'); score ignored
6 errors generated.
```

Reviewers: sammccall, jdoerfert

Subscribers: sstefan1, cfe-commits

Tags: #clang

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

4 years agoAMDGPU: Fix not using scalar loads for global reads in shaders
Matt Arsenault [Sat, 30 May 2020 23:37:57 +0000 (19:37 -0400)]
AMDGPU: Fix not using scalar loads for global reads in shaders

The pass which infers when it's legal to load a global address space
as SMRD was only considering amdgpu_kernel, and ignoring the shader
entry type calling conventions.

4 years agoRemove a comment-out llvm::errs debugging code, NFC.
Haojian Wu [Tue, 2 Jun 2020 13:40:09 +0000 (15:40 +0200)]
Remove a comment-out llvm::errs debugging code, NFC.

4 years ago[lldb] Handle a new clang built-in type
Kadir Cetinkaya [Tue, 2 Jun 2020 13:22:26 +0000 (15:22 +0200)]
[lldb] Handle a new clang built-in type

4 years agoAMDGPU: Fix clang side null pointer value for private
Matt Arsenault [Mon, 1 Jun 2020 14:31:05 +0000 (10:31 -0400)]
AMDGPU: Fix clang side null pointer value for private

The change to fold_priv_arith looks strange to me, but this was
already the untested behavior for local.

4 years ago[clangd] Copy existing includes in ReplayPreamble
Kadir Cetinkaya [Tue, 2 Jun 2020 09:52:55 +0000 (11:52 +0200)]
[clangd] Copy existing includes in ReplayPreamble

Summary:
ReplayPreamble was just grabbing the reference of IncludeStructure
passed to it and then replayed any includes seen so while exiting
built-in file.

This implies any include seen in built-in files being replayed as part
of preamble, even though they are not. This wasn't an issue until we've
started patching preambles, as includes from built-in files were not
mapped back to main-file.

This patch copies over existing includes at the time of
ReplayPreamble::attach and only replies those to prevent any includes
from the preamble patch getting mixed-in.

Reviewers: sammccall, jkorous

Subscribers: ilya-biryukov, MaskRay, dexonsmith, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years agoRevert "[clangd] Copy existing includes in ReplayPreamble"
Kadir Cetinkaya [Tue, 2 Jun 2020 12:30:52 +0000 (14:30 +0200)]
Revert "[clangd] Copy existing includes in ReplayPreamble"

This reverts commit bff0c56ff92106afad22b54a90e1c612da4d6f99. I've
pushed the earlier version of the patch by mistake.

4 years ago[gn build] (manually) port 44f989e7809
Nico Weber [Tue, 2 Jun 2020 12:18:42 +0000 (08:18 -0400)]
[gn build] (manually) port 44f989e7809

4 years agoFix a failing test.
Igor Kudrin [Tue, 2 Jun 2020 11:50:01 +0000 (18:50 +0700)]
Fix a failing test.

4 years ago[mlir] support materialization for 1-1 type conversions
Alex Zinenko [Tue, 2 Jun 2020 11:24:04 +0000 (13:24 +0200)]
[mlir] support materialization for 1-1 type conversions

Dialect conversion infrastructure supports 1->N type conversions by requiring
individual conversions to provide facilities to generate operations
retrofitting N values into 1 of the original type when N > 1. This
functionality can also be used to materialize explicit "cast"-like operations,
but it did not support 1->1 type conversions until now. Modify TypeConverter to
support materialization of cast operations for 1-1 conversions.

This also makes materialization specification more extensible following the
same pattern as type conversions. Instead of overloading a virtual function,
users or subclasses of TypeConversion can now register type-specific
materialization callbacks that will be called in order for the given type.

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

4 years ago[clangd] Copy existing includes in ReplayPreamble
Kadir Cetinkaya [Tue, 2 Jun 2020 09:52:55 +0000 (11:52 +0200)]
[clangd] Copy existing includes in ReplayPreamble

ReplayPreamble was just grabbing the reference of IncludeStructure
passed to it and then replayed any includes seen so while exiting
built-in file.

This implies any include seen in built-in files being replayed as part
of preamble, even though they are not. This wasn't an issue until we've
started patching preambles, as includes from built-in files were not
mapped back to main-file.

This patch copies over existing includes at the time of
ReplayPreamble::attach and only replies those to prevent any includes
from the preamble patch getting mixed-in.

4 years ago[CSInfo][NFC] Interpret loaded parameter value separately
Djordje Todorovic [Tue, 2 Jun 2020 09:44:32 +0000 (11:44 +0200)]
[CSInfo][NFC] Interpret loaded parameter value separately

The collectCallSiteParameters() method searches for instructions
which load values into registers used for parameters passing.
Previously, interpretation of those values, loaded by one such
instruction, was implemented inside collectCallSiteParameters() method.

This patch moves the interpretation code from collectCallSiteParameters()
method into a separate static method named interpretValue. New method is
called from collectCallSiteParameters() to process each instruction from
targeted instruction scope.

The collectCallSiteParameters() searches for loaded parameter value
among instructions which precede the call instruction, inside the same
basic block. When needed, new method (interpretValue) could be used for
searching any instruction scope.

This is preparation for search of parameter value, loaded inside call
delay slot.

Patch by Nikola Tesic

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

4 years ago[mlir] SCFToGPUPass: fix macros referring to LOOPS to use SCF instead
Alex Zinenko [Tue, 2 Jun 2020 11:01:37 +0000 (13:01 +0200)]
[mlir] SCFToGPUPass: fix macros referring to LOOPS to use SCF instead

One header guard was overlooked when renaming LoopOps to SCF, rename it.
Also drop two unused macros, one of which referred to LoopOp (not "Ops",
hence the overlook).

4 years ago[Support] Make DataExtractor error messages more clear
Pavel Labath [Mon, 20 Apr 2020 15:28:15 +0000 (17:28 +0200)]
[Support] Make DataExtractor error messages more clear

Summary:
This is a result of the discussion at D78113. Previously we would be
only giving the current offset at which the error was detected. However,
this was phrased somewhat ambiguously (as it could also mean that end of
data was at that offset). The new error message includes the current
offset as well as the extent of the data being read.

I've changed a couple of file-level static functions into private member
functions in order to avoid passing a bunch of new arguments everywhere.

Reviewers: dblaikie, jhenderson

Subscribers: hiraditya, MaskRay, llvm-commits

Tags: #llvm

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

4 years ago[lldb/DWARF] Add support for pre-standard GNU call site attributes
Pavel Labath [Mon, 25 May 2020 12:37:04 +0000 (14:37 +0200)]
[lldb/DWARF] Add support for pre-standard GNU call site attributes

Summary:
The code changes are very straight-forward -- just handle both DW_AT_GNU
and DW_AT_call versions of all tags and attributes. There is just one
small gotcha: in the GNU version, DW_AT_low_pc was used both for the
"return pc" and the "call pc" values, depending on whether the tag was
describing a tail call, while the official scheme uses different
attributes for the two things.

Reviewers: vsk, dblaikie

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[DebugInfo] Report the format of type units [10/10]
Igor Kudrin [Tue, 2 Jun 2020 09:14:48 +0000 (16:14 +0700)]
[DebugInfo] Report the format of type units [10/10]

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

4 years ago[DebugInfo] Report the format of location and range lists [9/10]
Igor Kudrin [Tue, 2 Jun 2020 09:11:02 +0000 (16:11 +0700)]
[DebugInfo] Report the format of location and range lists [9/10]

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

4 years ago[DebugInfo] Report the format of tables in .debug_pub* sections [8/10]
Igor Kudrin [Tue, 2 Jun 2020 09:08:16 +0000 (16:08 +0700)]
[DebugInfo] Report the format of tables in .debug_pub* sections [8/10]

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

4 years ago[DebugInfo] Report the format of line tables [7/10]
Igor Kudrin [Tue, 2 Jun 2020 09:05:43 +0000 (16:05 +0700)]
[DebugInfo] Report the format of line tables [7/10]

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

4 years ago[DebugInfo] Report the format of call frame information entries [6/10]
Igor Kudrin [Tue, 2 Jun 2020 09:00:44 +0000 (16:00 +0700)]
[DebugInfo] Report the format of call frame information entries [6/10]

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

4 years ago[DebugInfo] Report the format of address range tables [5/10]
Igor Kudrin [Tue, 2 Jun 2020 08:44:47 +0000 (15:44 +0700)]
[DebugInfo] Report the format of address range tables [5/10]

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

4 years ago[DebugInfo] Report the format of address tables [4/10]
Igor Kudrin [Tue, 2 Jun 2020 08:40:56 +0000 (15:40 +0700)]
[DebugInfo] Report the format of address tables [4/10]

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

4 years ago[DebugInfo] Report the format of compilation units [3/10]
Igor Kudrin [Tue, 2 Jun 2020 08:37:25 +0000 (15:37 +0700)]
[DebugInfo] Report the format of compilation units [3/10]

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

4 years ago[DebugInfo] Report the format of .debug_names [2/10]
Igor Kudrin [Tue, 2 Jun 2020 05:31:02 +0000 (12:31 +0700)]
[DebugInfo] Report the format of .debug_names [2/10]

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

4 years ago[DebugInfo] Extract a helper function to return the DWARF format name, NFC [1/10]
Igor Kudrin [Tue, 2 Jun 2020 05:16:51 +0000 (12:16 +0700)]
[DebugInfo] Extract a helper function to return the DWARF format name, NFC [1/10]

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

4 years ago[mlir] Toy tutorial: avoid erasing and then re-creating loop terminators
Alex Zinenko [Tue, 2 Jun 2020 10:49:45 +0000 (12:49 +0200)]
[mlir] Toy tutorial: avoid erasing and then re-creating loop terminators

The lower-to-affine-loops pass in chapters 5-7 of the Toy tutorial has
been creating affine loops, erasing their terminator and creating it
anew using a PatternRewriter instance to work around the fact that
implicit terminators were created without notifying the rewriter. Now
that has been fixed in 3ccf4a5bd109, remove the code erasing and
re-creating the terminators and rely on the default ones.

4 years agoAdd missing MemoryBuffer.h include
Simon Pilgrim [Tue, 2 Jun 2020 10:24:42 +0000 (11:24 +0100)]
Add missing MemoryBuffer.h include

4 years ago[mlir] post-commit review fixes
Alex Zinenko [Tue, 2 Jun 2020 10:06:56 +0000 (12:06 +0200)]
[mlir] post-commit review fixes

This fixes several post-commit nits from D79688 and D80135, namely
typos, debug output and control flow inversion.

4 years agoTextAPIReader.h - reduce MemoryBuffer.h include to forward declaration. NFC.
Simon Pilgrim [Tue, 2 Jun 2020 09:52:39 +0000 (10:52 +0100)]
TextAPIReader.h - reduce MemoryBuffer.h include to forward declaration. NFC.

4 years agoTextAPIWriter.h - reduce MemoryBuffer.h include to forward declarations. NFC.
Simon Pilgrim [Tue, 2 Jun 2020 09:51:50 +0000 (10:51 +0100)]
TextAPIWriter.h - reduce MemoryBuffer.h include to forward declarations. NFC.

4 years ago[Sema] Fix -Wunused-variable in CreateBuiltinMatrixSubscriptExpr (NFC).
Florian Hahn [Tue, 2 Jun 2020 09:45:30 +0000 (10:45 +0100)]
[Sema] Fix -Wunused-variable in CreateBuiltinMatrixSubscriptExpr (NFC).

4 years ago[LV] Make sure the MaxVF is a power-of-2 by rounding down.
Florian Hahn [Tue, 2 Jun 2020 09:33:10 +0000 (10:33 +0100)]
[LV] Make sure the MaxVF is a power-of-2 by rounding down.

LV currently only supports power of 2 vectorization factors, which has
been made explicit with the assertion added in
840450549c9199150cbdee29acef756c19660ca1.

However, if the widest type is not a power-of-2 the computed MaxVF won't
be a power-of-2 either. This patch updates computeFeasibleMaxVF to
ensure the returned value is a power-of-2 by rounding down to the
nearest power-of-2.

Fixes PR46139.

Reviewers: Ayal, gilr, rengolin

Reviewed By: Ayal

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

4 years ago[mlir] Introduce CallOp converter for buffer placement
Ehsan Toosi [Tue, 26 May 2020 13:03:45 +0000 (15:03 +0200)]
[mlir] Introduce CallOp converter for buffer placement

Add BufferAssignmentCallOpConverter as a pattern rewriter for Buffer
Placement. It matches the signature of the caller operation with the callee
after rewriting the callee with FunctionAndBlockSignatureConverter.

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

4 years ago[EarlyCSE] Common gc.relocate calls.
Denis Antrushin [Fri, 22 May 2020 14:03:02 +0000 (17:03 +0300)]
[EarlyCSE] Common gc.relocate calls.

gc.relocate intrinsic is special in that its second and third operands
are not real values, but indices into relocate's parent statepoint list
of GC pointers.
To be CSE'd, they need special handling in `isEqual()` and `getHashCode()`.

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D80445

4 years ago[LLDB] Mark TestCreateDuringInstructionStep as flaky on Linux
Muhammad Omair Javaid [Tue, 2 Jun 2020 09:08:10 +0000 (14:08 +0500)]
[LLDB] Mark TestCreateDuringInstructionStep as flaky on Linux

This patch marks TestCreateDuringInstructionStep.py as flakey for Linux.
This is failing randomly on arm/aarch64. I will monitor buildbot and
skip it if it fails again.

4 years ago[VectorCombine][X86] Add loaded insert tests from D80885
Simon Pilgrim [Tue, 2 Jun 2020 09:03:41 +0000 (10:03 +0100)]
[VectorCombine][X86] Add loaded insert tests from D80885