platform/upstream/llvm.git
4 years agoRevert "[InstCombine][NFC] Factor out constant check"
Max Kazantsev [Fri, 5 Jun 2020 05:00:44 +0000 (12:00 +0700)]
Revert "[InstCombine][NFC] Factor out constant check"

This reverts commit 9bdb91889020b3e61cba26adb1b9c64a24c09f95.

This refactoring proved to not be useful.

4 years ago[DWARFYAML][debug_aranges] Replace InitialLength with Format and Length.
Xing GUO [Fri, 5 Jun 2020 04:15:34 +0000 (12:15 +0800)]
[DWARFYAML][debug_aranges] Replace InitialLength with Format and Length.

This patch addresses the comment in [D80972](https://reviews.llvm.org/D80972#inline-744217).

Before this patch, the initial length field of .debug_aranges section should be declared as:

```
## 32-bit DWARF
debug_aranges:
  - Length:
      TotalLength: 0x20
    Version: 2
    ...

## 64-bit DWARF
debug_aranges:
  - Length:
      TotalLength:   0xffffffff
      TotalLength64: 0x20
    Version: 2
    ...
```

After this patch:

```
## 32-bit DWARF
debug_aranges:
  - [[Format:  DWARF32]] ## Optional
    Length:  0x20
    Version: 2
    ...

## 64-bit DWARF
debug_aranges:
  - Format:  DWARF64
    Length:  0x20
    Version: 2
```

Current implementation of generating DWARF64 .debug_aranges section is buggy. A follow-up patch will improve it and add test cases for DWARF64.

Reviewed By: jhenderson

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

4 years ago[StackSafety,NFC] Ignore callee declarations
Vitaly Buka [Fri, 5 Jun 2020 02:44:42 +0000 (19:44 -0700)]
[StackSafety,NFC] Ignore callee declarations

It's going to fail FunctionInfo lookup anyway.

4 years ago[AddressSanitizer] Don't use weak linkage for __{start,stop}_asan_globals
Petr Hosek [Fri, 5 Jun 2020 03:18:35 +0000 (20:18 -0700)]
[AddressSanitizer] Don't use weak linkage for __{start,stop}_asan_globals

It should not be necessary to use weak linkage for these. Doing so
implies interposablity and thus PIC generates indirections and
dynamic relocations, which are unnecessary and suboptimal. Aside
from this, ASan instrumentation never introduces GOT indirection
relocations where there were none before--only new absolute relocs
in RELRO sections for metadata, which are less problematic for
special linkage situations that take pains to avoid GOT generation.

Patch By: mcgrathr

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

4 years ago[Driver] Migrate some -f/-fno options to use OptInFFlag and OptOutFFlag
Fangrui Song [Fri, 5 Jun 2020 02:28:54 +0000 (19:28 -0700)]
[Driver] Migrate some -f/-fno options to use OptInFFlag and OptOutFFlag

4 years agoPR46209: properly determine whether a copy assignment operator is
Richard Smith [Fri, 5 Jun 2020 02:16:05 +0000 (19:16 -0700)]
PR46209: properly determine whether a copy assignment operator is
trivial.

We previously took a shortcut by assuming that if a subobject had a
trivial copy assignment operator (with a few side-conditions), we would
always invoke it, and could avoid going through overload resolution.
That turns out to not be correct in the presenve of ref-qualifiers (and
also won't be the case for copy-assignments with requires-clauses
either). Use the same logic for lazy declaration of copy-assignments
that we use for all other special member functions.

4 years agoSet the captures on a CXXRecordDecl representing a lambda closure type
Richard Smith [Fri, 5 Jun 2020 02:15:22 +0000 (19:15 -0700)]
Set the captures on a CXXRecordDecl representing a lambda closure type
before marking it complete.

No functionality change intended.

4 years ago[Statepoint] Migrate a few tests to gc-live bundle format and fix assert
Philip Reames [Fri, 5 Jun 2020 01:15:04 +0000 (18:15 -0700)]
[Statepoint] Migrate a few tests to gc-live bundle format and fix assert

The assert was missed in 0e7c7705, migrating the test revealed the problem.

4 years ago[LiveDebugValues] Cache LexicalScopes::getMachineBasicBlocks, NFCI
Vedant Kumar [Thu, 28 May 2020 22:57:11 +0000 (15:57 -0700)]
[LiveDebugValues] Cache LexicalScopes::getMachineBasicBlocks, NFCI

Summary:
Cache the results from getMachineBasicBlocks in LexicalScopes to speed
up UserValueScopes::dominates queries.  This replaces the caching done
in UserValueScopes. Compared to the old caching method, this reduces
memory traffic when a VarLoc is copied (e.g. when a VarLocMap grows),
and enables caching across basic blocks.

When compiling sqlite 3.5.7 (CTMark version), this patch reduces the
number of calls to getMachineBasicBlocks from 10,207 to 1,093. I also
measured a small compile-time reduction (~ 0.1% of total wall time, on
average, on my machine).

As a drive-by, I made the DebugLoc in UserValueScopes a const reference
to cut down on MetadataTracking traffic.

Reviewers: jmorse, Orlando, aprantl, nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Refactor BoolAttr to be a special case of IntegerAttr
River Riddle [Wed, 3 Jun 2020 01:20:38 +0000 (18:20 -0700)]
[mlir] Refactor BoolAttr to be a special case of IntegerAttr

This simplifies a lot of handling of BoolAttr/IntegerAttr. For example, a lot of places currently have to handle both IntegerAttr and BoolAttr. In other places, a decision is made to pick one which can lead to surprising results for users. For example, DenseElementsAttr currently uses BoolAttr for i1 even if the user initialized it with an Array of i1 IntegerAttrs.

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

4 years ago[docs] Referenced llvm workflow in HowToAddABuilder
Mircea Trofin [Wed, 3 Jun 2020 00:48:02 +0000 (17:48 -0700)]
[docs] Referenced llvm workflow in HowToAddABuilder

Reviewers: gkistanova, dblaikie

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[WebAssembly] Fix a testcase to be independent of the sysroot default
Dan Gohman [Thu, 4 Jun 2020 22:55:08 +0000 (15:55 -0700)]
[WebAssembly] Fix a testcase to be independent of the sysroot default

As a followup to D62922, add a sysroot command-line option to this test
to ensure that the output is independent of any default sysroot options,
and adjust the reactor test to be more consistent with the command test.

4 years ago[mlir][Linalg] Add a hoistViewAllocOps helper function
Nicolas Vasilache [Thu, 4 Jun 2020 22:55:26 +0000 (18:55 -0400)]
[mlir][Linalg] Add a hoistViewAllocOps helper function

This revision adds a helper function to hoist alloc/dealloc pairs and
alloca op out of immediately enclosing scf::ForOp if both conditions are true:
   1. all operands are defined outside the loop.
   2. all uses are ViewLikeOp or DeallocOp.

This is now considered Linalg-specific and will be generalized on a per-need basis.

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

4 years ago[Analyzer][NoUncountedMembersChecker] Fix crash for C structs
Jan Korous [Thu, 4 Jun 2020 22:55:44 +0000 (15:55 -0700)]
[Analyzer][NoUncountedMembersChecker] Fix crash for C structs

Fixes https://bugs.llvm.org/show_bug.cgi?id=46177
Fixes second bug reported in https://bugs.llvm.org/show_bug.cgi?id=46142

4 years ago[Statepoint] Switch RS4GC to using gc-live bundle form
Philip Reames [Thu, 4 Jun 2020 22:22:07 +0000 (15:22 -0700)]
[Statepoint] Switch RS4GC to using gc-live bundle form

Now that we have an operand based form for the GC arguments to a statepoint intrinsic, update RS4GC to use it and update tests to reflect. This is pretty straight forward. I nearly landed without review, but figured a second set of eyes didn't hurt.

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

4 years ago[Fuchsia] Rely on linker switch rather than dead code ref for profile runtime
Petr Hosek [Thu, 4 Jun 2020 22:47:05 +0000 (15:47 -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.

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

4 years agoRevert "[Fuchsia] Rely on linker switch rather than dead code ref for profile runtime"
Petr Hosek [Thu, 4 Jun 2020 22:44:10 +0000 (15:44 -0700)]
Revert "[Fuchsia] Rely on linker switch rather than dead code ref for profile runtime"

This reverts commit d51054217403b47f452619e11318bd214749a845 since
it broke several bots.

4 years agoMake linter happy
Julian Lettner [Thu, 4 Jun 2020 21:48:42 +0000 (14:48 -0700)]
Make linter happy

4 years ago[docs] HowToUpdateDebugInfo: Minor cleanups
Vedant Kumar [Thu, 4 Jun 2020 21:32:46 +0000 (14:32 -0700)]
[docs] HowToUpdateDebugInfo: Minor cleanups

- Change the reference to salvageDebugInfoOrUndef to salvageDebugInfo
  (in accordance with https://reviews.llvm.org/D78369).

- Reorganize a few sections in preparation for an upcoming change that
  attempts to specify rules for updating debug locations.

- Fix some intra-document links.

- Some spelling / wording fixes.

4 years ago[Docs] Add the entry for `Advanced builds` in UserGuide.rst
Yuanfang Chen [Tue, 2 Jun 2020 00:09:40 +0000 (17:09 -0700)]
[Docs] Add the entry for `Advanced builds` in UserGuide.rst

Also add a link to it from ThinLTO.rst.

4 years agoFix undefined behaviour when trying to deref nullptr.
Alexey Bataev [Thu, 4 Jun 2020 21:33:13 +0000 (17:33 -0400)]
Fix undefined behaviour when trying to deref nullptr.

4 years ago[Reassociate] Teach ConvertShiftToMul to preserve nsw flag if the shift amount is...
Craig Topper [Thu, 4 Jun 2020 19:21:04 +0000 (12:21 -0700)]
[Reassociate] Teach ConvertShiftToMul to preserve nsw flag if the shift amount is not bitwidth - 1.

Multiply and shl have different signed overflow behavior in
some cases. But it looks like we should be ok as long as the
shift amount is less than bitwidth - 1.

Alive2: http://volta.cs.utah.edu:8080/z/MM4WZP

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

4 years agoAMDGPU: Fix overriding global FP atomic feature predicates
Matt Arsenault [Thu, 4 Jun 2020 18:37:39 +0000 (14:37 -0400)]
AMDGPU: Fix overriding global FP atomic feature predicates

Global TableGen let override blocks are pretty dangerous and override
any local special cases. In this case, the broader HasFlatGlobalInsts
was overriding the more specific predicate for
FeatureAtomicFaddInsts. Make sure HasFlatGlobalInsts is implied by
FeatureAtomicFaddInsts, and make sure the right predicate is used.

One issue with independently setting the subtarget features on
incompatible targets is all of the encoding families do not define all
opcodes. This will hit an assert on gfx10 for example, since we set
the encoding independently based on the generation and not based on a
feature.

4 years agoAMDGPU: Select strict_fmul
Matt Arsenault [Thu, 28 May 2020 00:12:11 +0000 (20:12 -0400)]
AMDGPU: Select strict_fmul

4 years agoAMDGPU: Select strict_fma
Matt Arsenault [Sat, 23 May 2020 17:56:02 +0000 (13:56 -0400)]
AMDGPU: Select strict_fma

Like with strict_fadd, the legalization is scalarizing the v4f16 when
it should split.

4 years agoAMDGPU: Select strict_fadd
Matt Arsenault [Sat, 23 May 2020 14:41:40 +0000 (10:41 -0400)]
AMDGPU: Select strict_fadd

4 years ago[mlir] Add support for bf16 to StandardToLLVM conversion
Diego Caballero [Thu, 4 Jun 2020 21:08:49 +0000 (14:08 -0700)]
[mlir] Add support for bf16 to StandardToLLVM conversion

Reviewed By: ftynse

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

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.