platform/upstream/llvm.git
4 years agoAMDGPU: Add test for fdiv nofpexcept preservation
Matt Arsenault [Mon, 1 Jun 2020 18:04:02 +0000 (14:04 -0400)]
AMDGPU: Add test for fdiv nofpexcept preservation

This logically belongs with 89d48ccabe6a950369b2bd922b1d8e987b856ac7,
but this order was needed to avoid regressions before adding
mayRaiseFPExceptions to relevant instructions.

4 years agoAMDGPU: Set mayRaiseFPException
Matt Arsenault [Wed, 27 May 2020 01:56:53 +0000 (21:56 -0400)]
AMDGPU: Set mayRaiseFPException

This may be missing a few overrides to set it off still in some
special cases. Since the flags set during selection should now be
reliably preserved, this should not change codegen for non-strictfp
functions.

4 years ago[InstCombine] avoid crashing on select-shuffle detection
Sanjay Patel [Thu, 4 Jun 2020 21:25:22 +0000 (17:25 -0400)]
[InstCombine] avoid crashing on select-shuffle detection

As mentioned in the post-commit comments of D81013 -
the mask check API has to assume the shuffle is
not length-changing, but we have not ruled that out
in this code. Use the ShuffleVectorInst call instead.

4 years ago[Fuchsia] Rely on linker switch rather than dead code ref for profile runtime
Petr Hosek [Thu, 4 Jun 2020 21:24:33 +0000 (14:24 -0700)]
[Fuchsia] Rely on linker switch rather than dead code ref for profile runtime

Follow the model used on Linux, where the clang driver passes the
linker a -u switch to force the profile runtime to be linked in,
rather than having every TU emit a dead function with a reference.

Patch By: mcgrathr

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

4 years ago[OpenMP] Improve D2D memcpy to use more efficient driver API
Shilei Tian [Thu, 4 Jun 2020 20:58:37 +0000 (16:58 -0400)]
[OpenMP] Improve D2D memcpy to use more efficient driver API

Summary:
In current implementation, D2D memcpy is first to copy data back to host and then
copy from host to device. This is very efficient if the device supports D2D
memcpy, like CUDA.

In this patch, D2D memcpy will first try to use native supported driver API. If
it fails, fall back to original way. It is worth noting that D2D memcpy in this
scenerio contains two ideas:
- Same devices: this is the D2D memcpy in the CUDA context.
- Different devices: this is the PeerToPeer memcpy in the CUDA context.
My implementation merges this two parts. It chooses the best API according to
the source device and destination device.

Reviewers: jdoerfert, AndreyChurbanov, grokos

Reviewed By: jdoerfert

Subscribers: yaxunl, guansong, sstefan1, openmp-commits

Tags: #openmp

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

4 years ago[CUDA][HIP] Fix implicit HD function resolution
Yaxun (Sam) Liu [Fri, 24 Apr 2020 20:41:24 +0000 (16:41 -0400)]
[CUDA][HIP] Fix implicit HD function resolution

recommit e03394c6a6ff with fix

When implicit HD function calls a function in device compilation,
if one candidate is an implicit HD function, current resolution rule is:

D wins over HD and H
HD and H are equal

this caused regression when there is an otherwise worse D candidate

This patch changes that to

D, HD and H are all equal

The rationale is that we already know for host compilation there is already
a valid candidate in HD and H candidates that will not cause error. Allowing
HD and H gives us a fall back candidate that will not cause error. If D wins,
that means D has to be a better match otherwise, therefore D should also
be a valid candidate that will not cause error. In this way, we can guarantee
no regression.

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

4 years agoAMDGPU: Fix using unencodable instructions in tests
Matt Arsenault [Thu, 4 Jun 2020 19:31:28 +0000 (15:31 -0400)]
AMDGPU: Fix using unencodable instructions in tests

There are a number of MIR tests using instructions on subtargets where
they don't really exist. These are some of the easy cases that don't
require splitting up test functions.

4 years agoAMDGPU/GlobalISel: Fix making LDS FP atomics legal on SI/CI
Matt Arsenault [Thu, 4 Jun 2020 19:21:20 +0000 (15:21 -0400)]
AMDGPU/GlobalISel: Fix making LDS FP atomics legal on SI/CI

4 years agoAMDGPU/GlobalISel: Fix trying to use wave32 for gfx9 test
Matt Arsenault [Thu, 4 Jun 2020 19:14:23 +0000 (15:14 -0400)]
AMDGPU/GlobalISel: Fix trying to use wave32 for gfx9 test

4 years ago[OPENMP50]Codegen for inscan reductions in worksharing directives.
Alexey Bataev [Mon, 4 May 2020 20:19:31 +0000 (16:19 -0400)]
[OPENMP50]Codegen for inscan reductions in worksharing directives.

Summary:
Implemented codegen for reduction clauses with inscan modifiers in
worksharing constructs.

Emits the code for the directive with inscan reductions.
The code is the following:
```
size num_iters = <num_iters>;
<type> buffer[num_iters];
for (i: 0..<num_iters>) {
  <input phase>;
  buffer[i] = red;
}
for (int k = 0; k != ceil(log2(num_iters)); ++k)
for (size cnt = last_iter; cnt >= pow(2, k); --k)
  buffer[i] op= buffer[i-pow(2,k)];
for (0..<num_iters>) {
  red = InclusiveScan ? buffer[i] : buffer[i-1];
  <scan phase>;
}
```

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, arphaman, cfe-commits, caomhin

Tags: #clang

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

4 years ago[WebAssembly] Lower llvm.debugtrap properly
Thomas Lively [Thu, 4 Jun 2020 20:25:10 +0000 (13:25 -0700)]
[WebAssembly] Lower llvm.debugtrap properly

Summary:
Unlike normal traps, debug traps are allowed to return and can have
additional instructions in the same basic block. Without explicit
backend support for debug traps, they are lowered in ISel as normal
traps. Since normal traps are lowered in the WebAssembly backend to
the UNREACHABLE instruction, which is a terminator, using debug traps
could lead to invalid MBBs when there are additional instructions
after the trap. This patch fixes the issue by lowering debug traps to
a new version of the UNREACHABLE instruction, DEBUG_UNREACHABLE, that
is not a terminator.

An alternative approach would have been to make UNREACHABLE not a
terminator, but that breaks a large number of tests. In particular, it
would require removing the traps inserted after noreturn calls to
@llvm.wasm.throw because otherwise the terminator throw would be
followed by a non-terminator UNREACHABLE and we would be back to
having invalid MBBs. Overall the approach in this patch seems simpler.

Reviewers: aheejin, dschuff

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

Tags: #llvm

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

4 years ago[flang] Fixed crash on forward referenced `len` parameter
Pete Steinfeld [Tue, 26 May 2020 22:12:15 +0000 (15:12 -0700)]
[flang] Fixed crash on forward referenced `len` parameter

Summary:
Using a forward reference to define a `len` parameter causes a crash.
The underlying cause was that a previously declared type had an
erroneous expression for its `LEN` param value.  When this expression
was referenced to evaluate a subsequent expression, bad things happened.
I fixed this by putting in code to detect this case.

Reviewers: tskeith, klausler, DavidTruby

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[NFC] Move test vscale-factor-out-constant.ll to AArch64 sub-directory.
Huihui Zhang [Thu, 4 Jun 2020 19:43:51 +0000 (12:43 -0700)]
[NFC] Move test vscale-factor-out-constant.ll to AArch64 sub-directory.

Vscale scalable vector is specific to AArch64 target.

Bring back 'uglygep' check.

4 years ago[flang] Add the conversions for types.
Eric Schweitz [Tue, 2 Jun 2020 20:58:12 +0000 (13:58 -0700)]
[flang] Add the conversions for types.

Part of lowering is to convert the front-end types to their FIR dialect representations.  These conversions are done by here in the ConvertType module.

proactively update the code to conform better with LLVM coding conventions

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

4 years ago[mlir] [VectorOps] Add missing comments to CreateMaskOp lowering
aartbik [Wed, 3 Jun 2020 23:54:26 +0000 (16:54 -0700)]
[mlir] [VectorOps] Add missing comments to CreateMaskOp lowering

Summary: Add missing comment to CreateMask. Fixed typo in ConstantMask comment.

Reviewers: nicolasvasilache, rriddle, reidtatge, ftynse

Reviewed By: ftynse

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul

Tags: #mlir

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

4 years ago[SemaOverload] Use iterator_range to iterate over VectorTypes (NFC).
Florian Hahn [Thu, 4 Jun 2020 19:15:21 +0000 (20:15 +0100)]
[SemaOverload] Use iterator_range to iterate over VectorTypes (NFC).

We can simplify the code a bit by using iterator_range instead of
plain iterators. Matrix type support here (added in 6f6e91d19337)
already uses an iterator_range.

Reviewers: rjmccall, arphaman, jfb, Bigcheese

Reviewed By: rjmccall

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

4 years agoAST Matchers test: use arrays instead of vectors
Dmitri Gribenko [Thu, 4 Jun 2020 18:20:33 +0000 (20:20 +0200)]
AST Matchers test: use arrays instead of vectors

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[flang] avoid GCC < 8 compiler failure after D80794
Valentin Clement [Thu, 4 Jun 2020 18:47:13 +0000 (14:47 -0400)]
[flang] avoid GCC < 8 compiler failure after D80794

Summary:
Patch D80794 remove the custom flags for release build for flang.
This leads to build failure with GCC < 8. This patch add upperbound check
in order to avoid the -Werror=array-bounds to trigger a build failure.

```
/home/4vn/versioning/llvm-project/flang/lib/Decimal/big-radix-floating-point.h:183:29: error: array subscript is above array bounds [-Werror=array-bounds]
           digit_[j] = digit_[j + remove];
                       ~~~~~~^
/home/4vn/versioning/llvm-project/flang/lib/Decimal/big-radix-floating-point.h:183:29: error: array subscript is above array bounds [-Werror=array-bounds]
           digit_[j] = digit_[j + remove];
                       ~~~~~~^
/home/4vn/versioning/llvm-project/flang/lib/Decimal/big-radix-floating-point.h:183:29: error: array subscript is above array bounds [-Werror=array-bounds]
           digit_[j] = digit_[j + remove];
                       ~~~~~~^
/home/4vn/versioning/llvm-project/flang/lib/Decimal/big-radix-floating-point.h:183:29: error: array subscript is above array bounds [-Werror=array-bounds]
           digit_[j] = digit_[j + remove];
                       ~~~~~~^
/home/4vn/versioning/llvm-project/flang/lib/Decimal/big-radix-floating-point.h:183:29: error: array subscript is above array bounds [-Werror=array-bounds]
           digit_[j] = digit_[j + remove];
```

```
/home/4vn/versioning/llvm-project/flang/include/flang/Evaluate/integer.h:809:28: error: array subscript is above array bounds [-Werror=array-bounds]
               xy += product[to];
                     ~~~~~~~^
/home/4vn/versioning/llvm-project/flang/include/flang/Evaluate/integer.h:810:22: error: array subscript is above array bounds [-Werror=array-bounds]
               product[to] = xy & partMask;
               ~~~~~~~^
/home/4vn/versioning/llvm-project/flang/include/flang/Evaluate/integer.h:809:28: error: array subscript is above array bounds [-Werror=array-bounds]
               xy += product[to];
                     ~~~~~~~^
```

Reviewers: DavidTruby, sscalpone, jdoerfert

Reviewed By: DavidTruby

Subscribers: llvm-commits

Tags: #llvm, #flang

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

4 years ago[PGO] Enable the working set size scaling under the partial sample PGO.
Hiroshi Yamauchi [Mon, 1 Jun 2020 17:45:28 +0000 (10:45 -0700)]
[PGO] Enable the working set size scaling under the partial sample PGO.

Summary: Following up D79831.

Reviewers: davidxl

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] move vector select ahead of select-shuffle
Sanjay Patel [Thu, 4 Jun 2020 18:17:59 +0000 (14:17 -0400)]
[InstCombine] move vector select ahead of select-shuffle

select Cond, (shuf_sel X, Y), X --> shuf_sel X, (select Cond, Y, X)

A select of a select-shuffle ("blend" in x86 lingo) can be reversed
so that the select is done first.
This is a more limited version of what I was trying in D80658,
but it enables existing demanded bits transforms to catch some of the
motivating cases. The tricky bit in that seems to be that by moving
the shuffle later, we can always guarantee that poison is correctly
inhibited by the shuffle mask in the final value.

Alive2 checks for the basic tests:
http://volta.cs.utah.edu:8080/z/Qqd3RK
http://volta.cs.utah.edu:8080/z/S4wchM
http://volta.cs.utah.edu:8080/z/wf9zPL
http://volta.cs.utah.edu:8080/z/wJeEGk

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

4 years ago[docs] Fix self-contradictory description of llvm_unreachable
Jan Korous [Thu, 4 Jun 2020 03:04:48 +0000 (20:04 -0700)]
[docs] Fix self-contradictory description of llvm_unreachable

Just two paragraphs above it says:
"If the compiler does not support this [skipping code generation for a particular branch], it will fall back
to the "abort" implementation."

And that actually correctly describes llvm_unreachable implementation.

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

4 years agoPropose naming principle for NodeRole and apply it
Eduardo Caldas [Thu, 4 Jun 2020 17:27:35 +0000 (19:27 +0200)]
Propose naming principle for NodeRole and apply it

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[libc++] Avoid warning for large types with std::atomic in the test suite
Louis Dionne [Thu, 4 Jun 2020 18:04:01 +0000 (14:04 -0400)]
[libc++] Avoid warning for large types with std::atomic in the test suite

It is legitimate for the test suite to use types that are slow to use
with std::atomic, since we need coverage for those too. If we don't
disable the warning, it is promoted to an error, which prevents us
from testing such types.

4 years ago[gn build] Port e53f5580578
LLVM GN Syncbot [Thu, 4 Jun 2020 17:56:21 +0000 (17:56 +0000)]
[gn build] Port e53f5580578

4 years ago[gn build] Port c973ad1878f
LLVM GN Syncbot [Thu, 4 Jun 2020 17:56:21 +0000 (17:56 +0000)]
[gn build] Port c973ad1878f

4 years ago[gn build] Port ba2a01645b5
LLVM GN Syncbot [Thu, 4 Jun 2020 17:56:20 +0000 (17:56 +0000)]
[gn build] Port ba2a01645b5

4 years ago[gn build] Port 69fa84a6e95
LLVM GN Syncbot [Thu, 4 Jun 2020 17:56:20 +0000 (17:56 +0000)]
[gn build] Port 69fa84a6e95

4 years ago[gn build] Port 6756a2c9533
LLVM GN Syncbot [Thu, 4 Jun 2020 17:56:19 +0000 (17:56 +0000)]
[gn build] Port 6756a2c9533

4 years ago[gn build] Port 49a4f3f7d88
LLVM GN Syncbot [Thu, 4 Jun 2020 17:56:19 +0000 (17:56 +0000)]
[gn build] Port 49a4f3f7d88

4 years ago[NFC] Temporarily disable check for 'uglygep' while investigating some buildbot failure.
Huihui Zhang [Thu, 4 Jun 2020 17:46:32 +0000 (10:46 -0700)]
[NFC] Temporarily disable check for 'uglygep' while investigating some buildbot failure.

The purpose of vscale-factor-out-constant.ll is to check we are crashing
with blind cast 'Factor' in a MulExpr to SCEVConstant.

4 years ago[mlir][gpu] Add subgroup Id/Size/Num to GPU dialect
Thomas Raoux [Thu, 4 Jun 2020 17:45:53 +0000 (10:45 -0700)]
[mlir][gpu] Add subgroup Id/Size/Num to GPU dialect

Add SubgroupId, SubgroupSize and NumSubgroups to GPU dialect ops and add the
lowering of those ops to SPIRV.

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

4 years ago[AArch64][GlobalISel] Move GlobalISel source files to a dedicated subdir.
Amara Emerson [Wed, 3 Jun 2020 18:42:09 +0000 (11:42 -0700)]
[AArch64][GlobalISel] Move GlobalISel source files to a dedicated subdir.

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

4 years agoDisable this test for Windows.
Jim Ingham [Thu, 4 Jun 2020 17:49:26 +0000 (10:49 -0700)]
Disable this test for Windows.

The printf expression crashes with the message:

Attempted to dereference an invalid pointer

Someone who knows more about Windows should suggest how to fix this.

4 years agoMake regcoal_remat_empty_subrange.ll test require asserts build.
Hans Wennborg [Thu, 4 Jun 2020 17:44:36 +0000 (19:44 +0200)]
Make regcoal_remat_empty_subrange.ll test require asserts build.

The -stress-sched flag is only available when asserts are enabled.

4 years ago[lldb] Fix SLEB128 decoding
Jan Kratochvil [Thu, 4 Jun 2020 17:41:24 +0000 (19:41 +0200)]
[lldb] Fix SLEB128 decoding

Bug 46181 shows SLEB128 0xED9A924C00011151 decoded as 0xffffffff80011151.
        LLDB show a wrong value for function argument
        https://bugs.llvm.org/show_bug.cgi?id=46181

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

4 years ago[TRE] Allow accumulator elimination when base case returns non-constant
Layton Kifer [Thu, 4 Jun 2020 17:33:03 +0000 (10:33 -0700)]
[TRE] Allow accumulator elimination when base case returns non-constant

Remove the requirement, that when performing accumulator elimination,
all other cases must return the same dynamic constant. We can do this by
initializing the accumulator with the identity value of the accumulation
operation, and inserting an additional operation before any return.

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

4 years ago[LSR][SCEVExpander] Avoid blind cast 'Factor' to SCEVConstant in FactorOutConstant.
Huihui Zhang [Thu, 4 Jun 2020 17:32:36 +0000 (10:32 -0700)]
[LSR][SCEVExpander] Avoid blind cast 'Factor' to SCEVConstant in FactorOutConstant.

Summary:
In SCEVExpander FactorOutConstant(), when GEP indexing into/over scalable vector,
it is legal for the 'Factor' in a MulExpr to be the size of a scalable vector
instead of a compile-time constant.

Current upstream crash with the test attached.

Reviewers: efriedma, sdesmalen, sanjoy.google, mkazantsev

Reviewed By: efriedma

Subscribers: hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from SystemZ
Christopher Tetreault [Thu, 4 Jun 2020 16:57:36 +0000 (09:57 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from SystemZ

Reviewers: efriedma, jnspaulsson, kmclaughlin, sdesmalen, samparker, uweigand

Reviewed By: uweigand

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[clang-tidy] ignore builtin varargs from pro-type-vararg-check
Nathan James [Thu, 4 Jun 2020 16:58:23 +0000 (17:58 +0100)]
[clang-tidy] ignore builtin varargs from pro-type-vararg-check

Disables the check from warning on some built in vararg functions, Address [[ https://bugs.llvm.org/show_bug.cgi?id=45860 | Clang-tidy should not consider __builtin_constant_p a variadic function. ]]

Reviewed By: aaron.ballman

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

4 years ago[clang-tidy][modernize-loop-convert] Make loop var type human readable
Zinovy Nis [Tue, 26 May 2020 06:06:59 +0000 (09:06 +0300)]
[clang-tidy][modernize-loop-convert] Make loop var type human readable

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

4 years ago[Doc] update ReleaseNotes with new warning note.
ZequanWu [Thu, 4 Jun 2020 16:45:04 +0000 (09:45 -0700)]
[Doc] update ReleaseNotes with new warning note.

4 years ago[OPENMP]Fix PR46146: Do not consider globalized variables as NRVO candidates.
Alexey Bataev [Mon, 1 Jun 2020 16:39:25 +0000 (12:39 -0400)]
[OPENMP]Fix PR46146: Do not consider globalized variables as NRVO candidates.

Summary:
If the variables must be globalized in OpenMP mode (local automatic
variable, GPU compilation mode, the variable may escape its declaration
context by the reference or by the pointer), it should not be considered
as the NRVO candidate. Otherwise, incorrect the return value of the
function might not be updated.

Reviewers: jdoerfert

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

Tags: #clang

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

4 years ago[gn build] Port b5fc1deb5ba1f3cd432ecb8b86c2536470463163
Fangrui Song [Thu, 4 Jun 2020 16:22:44 +0000 (09:22 -0700)]
[gn build] Port b5fc1deb5ba1f3cd432ecb8b86c2536470463163

4 years ago[libc++] Disable LLVM benchmarks in the Apple build
Louis Dionne [Thu, 4 Jun 2020 16:03:04 +0000 (12:03 -0400)]
[libc++] Disable LLVM benchmarks in the Apple build

4 years ago[llvm-dwarfdump] Add a table header for -debug-line -verbose output
Fangrui Song [Thu, 4 Jun 2020 15:56:17 +0000 (08:56 -0700)]
[llvm-dwarfdump] Add a table header for -debug-line -verbose output

Like non-verbose output, so that it is easy to recognize the `Line,Column,File,ISA,Discriminator` column values.

Reviewed By: JDevlieghere, jhenderson

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

4 years agoUse libClangTesting in the unittest for AST matchers
Dmitri Gribenko [Thu, 4 Jun 2020 15:40:38 +0000 (17:40 +0200)]
Use libClangTesting in the unittest for AST matchers

Summary:
The unittest for AST matchers has its own way to specify language
standards. I unified it with the shared infrastructure from
libClangTesting.

Reviewers: jdoerfert, hlopko

Reviewed By: hlopko

Subscribers: mgorny, sstefan1, cfe-commits

Tags: #clang

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

4 years ago[libc++] Merge the Apple install-libcxx and libcxxabi scripts
Louis Dionne [Thu, 4 Jun 2020 14:32:16 +0000 (10:32 -0400)]
[libc++] Merge the Apple install-libcxx and libcxxabi scripts

Also, refactor the now-merged script to remove code duplication in the
creation of universal dylibs.

4 years agoDAG: Change computeKnownBitsForFrameIndex to be usable by GISel
Matt Arsenault [Thu, 4 Jun 2020 14:27:45 +0000 (10:27 -0400)]
DAG: Change computeKnownBitsForFrameIndex to be usable by GISel

This wasn't getting much value from the DAG or depth arguments, since
it's only called on the frame index root nodes. FrameIndexes can also
only return a scalar value, so it also didn't need DemandedElts.

4 years ago[clang-format] Update GoogleStyle for C# code to match Google's internal C# style...
Jonathan Coe [Thu, 4 Jun 2020 14:32:48 +0000 (15:32 +0100)]
[clang-format] Update GoogleStyle for C# code to match Google's internal C# style guide

Summary: Google's C# style guide is at https://google.github.io/styleguide/csharp-style.html

Reviewers: krasimir, MyDeveloperDay, sammccall

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits, klimek

Tags: #clang-format, #clang

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

4 years ago[libc++] Move away from the standalone build for Apple libc++ and libc++abi
Louis Dionne [Thu, 4 Jun 2020 14:18:50 +0000 (10:18 -0400)]
[libc++] Move away from the standalone build for Apple libc++ and libc++abi

4 years agoRename arrow -> arrowToken for unified naming
Eduardo Caldas [Thu, 4 Jun 2020 14:12:15 +0000 (16:12 +0200)]
Rename arrow -> arrowToken for unified naming

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[Analyzer][StreamChecker] Updated initialization of BugType's.
Balázs Kéri [Thu, 4 Jun 2020 13:24:08 +0000 (15:24 +0200)]
[Analyzer][StreamChecker] Updated initialization of BugType's.

Summary:
BugType objects are initialized in-class instead of by lazy initialization.
FuchsiaHandleChecker does this already.

Reviewers: Szelethus, baloghadamsoftware, martong

Reviewed By: Szelethus

Subscribers: rnkovacs, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years agoRevert "Relands "[YAMLVFSWriter][Test][NFC] Add couple tests" vol. 2"
Russell Gallop [Thu, 4 Jun 2020 13:56:09 +0000 (14:56 +0100)]
Revert "Relands "[YAMLVFSWriter][Test][NFC] Add couple tests" vol. 2"

This reverts commit 30949926f98576fbff8d5ad0390be5124ffacd7e.

This was failing on bot here:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/32749

4 years agoRegAllocFast: Remove dead code
Matt Arsenault [Wed, 3 Jun 2020 21:14:54 +0000 (17:14 -0400)]
RegAllocFast: Remove dead code

4 years ago[OPENMP]Fix PR45383: type dependent array subscripts are diagnosed erroneously.
Alexey Bataev [Wed, 22 Apr 2020 14:18:04 +0000 (10:18 -0400)]
[OPENMP]Fix PR45383: type dependent array subscripts are diagnosed erroneously.

Summary:
If the array subscript expression is type depent, its analysis must be
delayed before its instantiation.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, caomhin, cfe-commits

Tags: #clang

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

4 years ago[x86] add test/code comment for chain value use (PR46195); NFC
Sanjay Patel [Thu, 4 Jun 2020 12:50:42 +0000 (08:50 -0400)]
[x86] add test/code comment for chain value use (PR46195); NFC

4 years ago[TableGen] Handle (outs variable_ops)
Denis Antrushin [Wed, 3 Jun 2020 14:08:48 +0000 (17:08 +0300)]
[TableGen] Handle (outs variable_ops)

When `variable_ops` is specified in `InOperandList` of instruction,
it behaves as expected, i.e., does not count as operand.
So for `(ins variable_ops)` instruction description will have 0
operands.  However when used in OutOperandList it is counted as
operand. So `(outs variable_ops)` results in instruction with
one def.
This patch makes behavior of `variable_ops` in `out` list to match
that of `in` list.

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

4 years ago[gn build] Port 48cd9d9dd86
LLVM GN Syncbot [Thu, 4 Jun 2020 12:56:45 +0000 (12:56 +0000)]
[gn build] Port 48cd9d9dd86

4 years ago[Support] Use outs() in ToolOutputFile
Pavel Labath [Wed, 3 Jun 2020 10:08:45 +0000 (12:08 +0200)]
[Support] Use outs() in ToolOutputFile

Summary:
If the output filename was specified as "-", the ToolOutputFile class
would create a brand new raw_ostream object referring to the stdout.
This patch changes it to reuse the llvm::outs() singleton.

At the moment, this change should be "NFC", but it does enable other
enhancements, like the automatic stdout/stderr synchronization as
discussed on D80803.

I've checked the history, and I did not find any indication that this
class *has* to use a brand new stream object instead of outs() --
indeed, it is special-casing "-" in a number of places already, so this
change fits the pattern pretty well. I suspect the main reason for the
current state of affairs is that the class was originally introduced
(r111595, in 2010) as a raw_fd_ostream subclass, which made any other
solution impossible.

Another potential benefit of this patch is that it makes it possible to
move the raw_ostream class out of the business of special-casing "-" for
stdout handling. That state of affairs does not seem appropriate because
"-" is a valid filename (albeit hard to access with a lot of command
line tools) on most systems. Handling "-" in ToolOutputFile seems more
appropriate.

To make this possible, this patch changes the return type of
llvm::outs() and errs() to raw_fd_ostream&. Previously the functions
were constructing objects of that type, but returning a generic
raw_ostream reference. This makes it possible for new ToolOutputFile and
other code to use raw_fd_ostream methods like error() on the outs()
object. This does not seem like a bad thing (since stdout is a file
descriptor which can be redirected to anywhere, it makes sense to ask it
whether the writing was successful or if it supports seeking), and
indeed a lot of code was already depending on this fact via the
ToolOutputFile "back door".

Reviewers: dblaikie, JDevlieghere, MaskRay, jhenderson

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[openmp] Fixed nonmonotonic schedule implementation.
AndreyChurbanov [Thu, 4 Jun 2020 12:39:45 +0000 (15:39 +0300)]
[openmp] Fixed nonmonotonic schedule implementation.

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

4 years ago[x86] add FileCheck / assertions to test; NFC
Sanjay Patel [Thu, 4 Jun 2020 12:33:24 +0000 (08:33 -0400)]
[x86] add FileCheck / assertions to test; NFC

4 years ago[OpenCL] Add cl_khr_extended_subgroup extensions.
Anastasia Stulova [Thu, 4 Jun 2020 11:29:02 +0000 (12:29 +0100)]
[OpenCL] Add cl_khr_extended_subgroup extensions.

Added extensions and their function declarations into
the standard header.

Patch by Piotr Fusik!

Tags: #clang

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

4 years ago[analyzer] Ignore calculated indices of <= 0 in VLASizeChecker
Vince Bridgers [Mon, 1 Jun 2020 00:03:16 +0000 (19:03 -0500)]
[analyzer] Ignore calculated indices of <= 0 in VLASizeChecker

Summary:
See https://bugs.llvm.org/show_bug.cgi?id=46128. The checker does not
yet comprehend constraints involving multiple symbols, so it's possible
to calculate a VLA size that's negative or 0. A LIT is added to catch
regressions, and this change simply bails if a VLA size of 0 or less is
calculated.

Reviewers: balazske, NoQ, martong, baloghadamsoftware, Szelethus, gamesh411

Reviewed By: balazske, NoQ, Szelethus

Subscribers: xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, Charusso, ASDenysPetrov, cfe-commits, dkrupp

Tags: #clang

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

4 years ago[PhaseOrdering] add more tests for vector reductions; NFC
Sanjay Patel [Thu, 4 Jun 2020 12:17:53 +0000 (08:17 -0400)]
[PhaseOrdering] add more tests for vector reductions; NFC

More coverage for D80867.

4 years ago[VP][Fix] canIgnoreVectorLength for scalable types
Simon Moll [Thu, 4 Jun 2020 09:09:48 +0000 (11:09 +0200)]
[VP][Fix] canIgnoreVectorLength for scalable types

This patch fixes VPIntrinsic::canIgnoreVectorLength when used on a
VPIntrinsic with scalable vector types. Also includes new unittest cases
for the '<vscale x 1 x whatever>' and '%evl == vscale' corner cases.

4 years ago[ARM] FP16 conversion tests. NFC
David Green [Thu, 4 Jun 2020 11:31:42 +0000 (12:31 +0100)]
[ARM] FP16 conversion tests. NFC

4 years ago[gn build] port some -Wno flags for gcc from the cmake build.
Nico Weber [Thu, 4 Jun 2020 12:10:16 +0000 (08:10 -0400)]
[gn build] port some -Wno flags for gcc from the cmake build.

4 years agoAdd support for IntegerLiteral in SyntaxTree
Eduardo Caldas [Thu, 4 Jun 2020 12:03:04 +0000 (14:03 +0200)]
Add support for IntegerLiteral in SyntaxTree

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[InstCombine][NFC] Factor out constant check
Max Kazantsev [Thu, 4 Jun 2020 11:54:23 +0000 (18:54 +0700)]
[InstCombine][NFC] Factor out constant check

We plan to add more transforms here. Besides, this check should be
done in the beginning just from function's name.

4 years ago[Test] Add test showing missing opportunity of folding ICmp(Phi(Consts...))
Max Kazantsev [Thu, 4 Jun 2020 11:14:30 +0000 (18:14 +0700)]
[Test] Add test showing missing opportunity of folding ICmp(Phi(Consts...))

4 years ago[ObjectYAML] - Remove unused function. NFC.
Georgii Rymar [Thu, 4 Jun 2020 11:22:06 +0000 (14:22 +0300)]
[ObjectYAML] - Remove unused function. NFC.

Was introduced in D81005 by mistake.

Catched by BB:
http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/4070/steps/build%20stage%201/logs/stdio

4 years ago[FileCheck] Implement equality operators for ExpressionValue.
Paul Walker [Mon, 1 Jun 2020 10:09:58 +0000 (10:09 +0000)]
[FileCheck] Implement equality operators for ExpressionValue.

Subscribers: hiraditya, thopre, llvm-commits

Tags: #llvm

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

4 years ago[ARM][MachineOutliner] Remove unneeded dynamic allocation.
Yvan Roux [Thu, 4 Jun 2020 11:12:26 +0000 (13:12 +0200)]
[ARM][MachineOutliner] Remove unneeded dynamic allocation.

4 years ago[DAG] scalarizeBinOpOfSplats - extract from the source of splat vector (PR46189)
Simon Pilgrim [Thu, 4 Jun 2020 10:49:28 +0000 (11:49 +0100)]
[DAG] scalarizeBinOpOfSplats - extract from the source of splat vector (PR46189)

D79003/rG9fa58d1bf2f8 exposed an issue with scalarizeBinOpOfSplats that we were extracting from the splatted vector result instead of the source, the splat index is only valid for the source vector not the result, which may contain undefs, including at the splat index.

4 years agoRevert "[DAGCombiner] avoid unnecessary indirection from SDNode/SDValue; NFCI"
Tim Northover [Thu, 4 Jun 2020 10:15:03 +0000 (11:15 +0100)]
Revert "[DAGCombiner] avoid unnecessary indirection from SDNode/SDValue; NFCI"

This reverts commit 21dadd774f56778ef68c1ce307205dfbdacc793a.

In at least PromoteIntBinOps, they wanted to know about users of *all* values
produced by the node not just the integer being promoted. For example not
replacing chain users if the operation was a load breaks the ordering of the
DAG.

4 years ago[yaml2obj] - Add a way to exclude specified sections from the section header.
Georgii Rymar [Mon, 1 Jun 2020 09:13:02 +0000 (12:13 +0300)]
[yaml2obj] - Add a way to exclude specified sections from the section header.

This implements a new "Excluded" key that can be used
to exclude entries from section header:

```
SectionHeaderTable:
  Sections:
    ...
  Excluded:
    - Name: .foo
```

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

4 years ago[CSInfo][MIPS] Describe parameter value loaded by ADDiu
Djordje Todorovic [Thu, 4 Jun 2020 09:59:04 +0000 (11:59 +0200)]
[CSInfo][MIPS] Describe parameter value loaded by ADDiu

Describe parameter's value loaded by MIPS ADDiu instruction.
When parameter's value is loaded into a register by mips ADDiu/DADDiu
instruction, it could be described correctly and emitted as
DW_AT_GNU_call_site_value.

Patch by Nikola Tesic

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

4 years ago[Sema] Remove unused matrix_begin/end helpers (NFC).
Florian Hahn [Thu, 4 Jun 2020 10:15:01 +0000 (11:15 +0100)]
[Sema] Remove unused matrix_begin/end helpers (NFC).

The matrix_types() helper returning an iterator range is used instead.

4 years ago[X86] Add test case for PR46189
Simon Pilgrim [Thu, 4 Jun 2020 09:43:19 +0000 (10:43 +0100)]
[X86] Add test case for PR46189

4 years agoRevert "[yaml2obj] - Allocate the file space for SHT_NOBITS sections in some cases."
Georgii Rymar [Thu, 4 Jun 2020 10:10:43 +0000 (13:10 +0300)]
Revert "[yaml2obj] - Allocate the file space for SHT_NOBITS sections in some cases."

This reverts commit aa3a85cdaa4432ca389bdbf48049eaa64dc6e266.

There are problems with it. See here: https://reviews.llvm.org/D80629

4 years ago[PowerPC][NFC] Testing ROTL of v1i128.
Esme-Yi [Thu, 4 Jun 2020 10:09:06 +0000 (10:09 +0000)]
[PowerPC][NFC] Testing ROTL of v1i128.

Summary: A bug is reported in bugzilla-45628, where the swap_with_shift case can’t be matched to a single HW instruction xxswapd as expected. In fact the case matches the idiom of rotate, but PPC doesn’t support ROTL v1i128.
This is a NFC patch for testing ROTL with v1i128 at master.

Reviewed By: steven.zhang

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

4 years ago[clangd] Fix build for gcc 7.4
Kadir Cetinkaya [Thu, 4 Jun 2020 10:02:49 +0000 (12:02 +0200)]
[clangd] Fix build for gcc 7.4

4 years ago[StackSafety] Rename testing opts
Vitaly Buka [Thu, 4 Jun 2020 09:38:58 +0000 (02:38 -0700)]
[StackSafety] Rename testing opts

4 years ago[StackSafety,NFC] Remove SCEVRewriteVisitor
Vitaly Buka [Tue, 2 Jun 2020 04:40:47 +0000 (21:40 -0700)]
[StackSafety,NFC] Remove SCEVRewriteVisitor

Summary: Depends on D80956.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU] More accurate gfx10 latencies
Jay Foad [Wed, 11 Mar 2020 11:33:30 +0000 (11:33 +0000)]
[AMDGPU] More accurate gfx10 latencies

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

4 years ago[AMDGPU] Introduce new sched classes for transcendental instructions
Jay Foad [Tue, 10 Mar 2020 13:08:58 +0000 (13:08 +0000)]
[AMDGPU] Introduce new sched classes for transcendental instructions

This is in preparation for scheduling them slightly differently on
gfx10. NFC.

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

4 years ago[VE] Clean SDNodeXForm stuff
Kazushi (Jam) Marukawa [Thu, 4 Jun 2020 09:27:57 +0000 (11:27 +0200)]
[VE] Clean SDNodeXForm stuff

Summary:
Gather definitions of SDNodeXForm and change them to call C functions
instead of copying C expressions in td files.  Doing this solved some
bugs in mimm detections.

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

4 years ago[llvm-readelf] - Do not try to read past the end of the file when dumping the the...
Georgii Rymar [Wed, 3 Jun 2020 15:19:05 +0000 (18:19 +0300)]
[llvm-readelf] - Do not try to read past the end of the file when dumping the the SHT_GNU_HASH.

We have unobvious issue in the condition that is used to check
that we do not read past the EOF.

The problem is that the result of "GnuHashTable->nbuckets * 4" expression is uint32.
Because of that it was still possible to overflow it and pass the check.

There was no such problem with the "GnuHashTable->maskwords * sizeof(typename ELFT::Off)"
condition, because of `sizeof` on the right (which gives 64-bits value on x64),
but I've added an explicit conversion to 64-bit value for `GnuHashTable->maskwords` too.

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

4 years agoMake syntax tree test print the line number when it fails
Dmitri Gribenko [Thu, 4 Jun 2020 08:35:43 +0000 (10:35 +0200)]
Make syntax tree test print the line number when it fails

Summary:
The syntax tree test uses a helper function that executes all testing
assertions. When an assertion fails, the only line number that gets
printed to the log refers to the helper function. After this change, we
would also get the line number of the EXPECT_TRUE macro invocation
(unfortunately, the line number of the last token of it, not the first
one, but there's not much I can do about it).

Reviewers: hlopko, eduucaldas

Reviewed By: hlopko, eduucaldas

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[PowerPC] Require nsz flag for c-a*b to FNMSUB
Qiu Chaofan [Thu, 4 Jun 2020 08:30:17 +0000 (16:30 +0800)]
[PowerPC] Require nsz flag for c-a*b to FNMSUB

On PowerPC, FNMSUB (both VSX and non-VSX version) means -(a*b-c). But
the backend used to generate these instructions regardless whether nsz
flag exists or not. If a*b-c==0, such transformation changes sign of
zero.

This patch introduces PPC specific FNMSUB ISD opcode, which may help
improving combined FMA code sequence.

Reviewed By: steven.zhang

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

4 years agoExtend InvokeInst !prof branch_weights metadata to unwind branches
Yevgeny Rouban [Thu, 4 Jun 2020 08:34:14 +0000 (15:34 +0700)]
Extend InvokeInst !prof branch_weights metadata to unwind branches

Allow InvokeInst to have the second optional prof branch weight for
its unwind branch. InvokeInst is a terminator with two successors.
It might have its unwind branch taken many times. If so
the BranchProbabilityInfo unwind branch heuristic can be inaccurate.
This patch allows a higher accuracy calculated with both branch
weights set.

Changes:
 - A new section about InvokeInst is added to
   the BranchWeightMetadata page. It states the old information that
   missed in the doc and adds new about the second branch weight.
 - Verifier is changed to allow either 1 or 2 branch weights
   for InvokeInst.
 - A new test is written for BranchProbabilityInfo to demonstrate
   the main improvement of the simple fix in calcMetadataWeights().
 - Several new testcases are created for Inliner. Those check that
    both weights are accounted for invoke instruction weight
    calculation.
 - PGOUseFunc::setBranchWeights() is fixed to be applicable to
   InvokeInst.

Reviewers: davidxl, reames, xur, yamauchi
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80618

4 years ago[lldb][NFC] Address some review feedback for D80775 ('command script delete' completion)
Raphael Isemann [Thu, 4 Jun 2020 08:27:03 +0000 (10:27 +0200)]
[lldb][NFC] Address some review feedback for D80775 ('command script delete' completion)

In the similar review D81128, Jonas pointed out some style errors that also
apply to D80775 (which is already committed). Also applying the changes
suggested there to this code.

4 years agoRelands "[YAMLVFSWriter][Test][NFC] Add couple tests" vol. 2
Jan Korous [Thu, 4 Jun 2020 04:39:55 +0000 (21:39 -0700)]
Relands "[YAMLVFSWriter][Test][NFC] Add couple tests" vol. 2

This reverts commit e4e3e41905d182c0f3d5b0b9406e3cbf2aabb30f.

Fixed dangling StringRef in test.

4 years ago[lldb] tab completion for `command script delete'
Gongyu Deng [Thu, 4 Jun 2020 07:53:05 +0000 (09:53 +0200)]
[lldb] tab completion for `command script delete'

Summary: Added the tab completion for `command script delete`.

Reviewers: teemperor, JDevlieghere

Reviewed By: teemperor

Tags: #lldb

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

4 years ago[Support][NFC] Tests for root_name(), root_directory() and root_path()
Jan Korous [Thu, 4 Jun 2020 08:10:49 +0000 (01:10 -0700)]
[Support][NFC] Tests for root_name(), root_directory() and root_path()

It's literally just doc comments converted to unittests.

4 years ago[Instruction] Remove setProfWeight()
Yevgeny Rouban [Thu, 4 Jun 2020 07:30:58 +0000 (14:30 +0700)]
[Instruction] Remove setProfWeight()

Remove the function Instruction::setProfWeight() and make
use of Instruction::copyMetadata(.., {LLVMContext::MD_prof}).
This is correct for all use cases of setProfWeight() as it
is applied to CallBase instructions only.
This change results in prof metadata copied intact even if
the source has "VP". The old pair of calls
extractProfTotalWeight() + setProfWeight() resulted in
setting branch_weights if the source had "VP" data.

Reviewers: yamauchi, davidxl
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80987

4 years ago[WebAssembly] Fix gcc warning [NFC]
Mikael Holmen [Thu, 4 Jun 2020 07:38:56 +0000 (09:38 +0200)]
[WebAssembly] Fix gcc warning [NFC]

gcc 7.4 complained with
../lib/Target/WebAssembly/WebAssemblyFixBrTableDefaults.cpp:125:23: warning: extra ';' [-Wpedantic]
                 false);
                       ^

4 years ago[NFCI][CostModel][AMDGPU] Simplify getUserCost
Sam Parker [Tue, 2 Jun 2020 11:29:42 +0000 (12:29 +0100)]
[NFCI][CostModel][AMDGPU] Simplify getUserCost

Casts and intrinsics are now handled by the default implementation
of getUserCost, so remove them from the backends switch statement.

https://reviews.llvm.org/D80994

4 years ago[flang] Fix IsConstantExpr for division expressions
Jean Perier [Thu, 4 Jun 2020 07:41:28 +0000 (09:41 +0200)]
[flang] Fix IsConstantExpr for division expressions

Summary:
Fortran::evaluate::IsConstantExpr did not check that the numerator
was a constant expression. This patch fixes the issue.

Reviewers: DavidTruby, klausler, schweitz, PeteSteinfeld, jdoerfert, sscalpone

Reviewed By: klausler, PeteSteinfeld, sscalpone

Subscribers: llvm-commits

Tags: #llvm, #flang

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

4 years ago[Inlining] Introduce -enable-npm-pgo-inline-deferral
Kazu Hirata [Thu, 4 Jun 2020 07:40:17 +0000 (00:40 -0700)]
[Inlining] Introduce -enable-npm-pgo-inline-deferral

Summary:
Experiments show that inline deferral past pre-inlining slightly
pessimizes the performance.

This patch introduces an option to control inline deferral during PGO.
The option defaults to true for now (that is, NFC).

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: eraman, hiraditya, haicheng, llvm-commits

Tags: #llvm

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