platform/upstream/llvm.git
4 years ago[llvm-objdump][test] Move {AArch64,ARM}/* to ELF/ARM/ or MachO/ARM/ and {AMDGPU,Hexag...
Fangrui Song [Sun, 15 Mar 2020 22:07:25 +0000 (15:07 -0700)]
[llvm-objdump][test] Move {AArch64,ARM}/* to ELF/ARM/ or MachO/ARM/ and {AMDGPU,Hexagon,Mips,powerPC}/ to ELF/

4 years ago[ORC] Enable JITEventListeners in the RTDyldObjectLinkingLayer.
Lang Hames [Mon, 9 Mar 2020 06:00:48 +0000 (23:00 -0700)]
[ORC] Enable JITEventListeners in the RTDyldObjectLinkingLayer.

Enable use of ExecutionEngine JITEventListeners in RTDyldObjectLinkingLayer.
This allows existing MCJIT clients to more easily migrate to LLJIT / ORCv2.

Example usage in llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener.

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

4 years ago[llvm-objdump][test] Move {AArch64,X86}/macho-* to MachO/
Fangrui Song [Sun, 15 Mar 2020 21:51:33 +0000 (14:51 -0700)]
[llvm-objdump][test] Move {AArch64,X86}/macho-* to MachO/

4 years agoAMDGPU/GlobalISel: Remove -global-isel-abort=0 from some tests
Matt Arsenault [Sun, 15 Mar 2020 20:58:26 +0000 (16:58 -0400)]
AMDGPU/GlobalISel: Remove -global-isel-abort=0 from some tests

4 years agoAMDGPU/GlobalISel: Add more tests for G_SADDE/G_SSUBE
Matt Arsenault [Thu, 27 Feb 2020 00:19:16 +0000 (19:19 -0500)]
AMDGPU/GlobalISel: Add more tests for G_SADDE/G_SSUBE

These don't work, but add baseline tests.

4 years ago[gn build] Port 5087ace6519
LLVM GN Syncbot [Sun, 15 Mar 2020 20:28:52 +0000 (20:28 +0000)]
[gn build] Port 5087ace6519

4 years ago[gn build] (manually) port 5087ace6519 more
Nico Weber [Sun, 15 Mar 2020 20:28:19 +0000 (16:28 -0400)]
[gn build] (manually) port 5087ace6519 more

4 years ago[Driver][test] Add a specific test file for -fmerge-all-constants
Fangrui Song [Sun, 15 Mar 2020 20:06:47 +0000 (13:06 -0700)]
[Driver][test] Add a specific test file for -fmerge-all-constants

Also, delete the option from the `// Test that we don't error on these.` block in test/Driver/clang_f_opts.c

4 years ago[gn build] (manually) port 5087ace6519
Nico Weber [Sun, 15 Mar 2020 20:06:37 +0000 (16:06 -0400)]
[gn build] (manually) port 5087ace6519

4 years agoAMDGPU/GlobalISel: Add baseline test for mul
Matt Arsenault [Sun, 15 Mar 2020 18:53:24 +0000 (14:53 -0400)]
AMDGPU/GlobalISel: Add baseline test for mul

4 years agoAMDGPU/GlobalISel: Add baseline test for mul
Matt Arsenault [Thu, 27 Feb 2020 14:32:25 +0000 (09:32 -0500)]
AMDGPU/GlobalISel: Add baseline test for mul

4 years ago[PowerPC] Regenerate rotate tests
Simon Pilgrim [Sun, 15 Mar 2020 18:29:00 +0000 (18:29 +0000)]
[PowerPC] Regenerate rotate tests

4 years ago[Thumb2] Regenerate rotate tests
Simon Pilgrim [Sun, 15 Mar 2020 18:28:54 +0000 (18:28 +0000)]
[Thumb2] Regenerate rotate tests

4 years ago[SystemZ] Regenerate rotate/shift tests
Simon Pilgrim [Sun, 15 Mar 2020 16:42:27 +0000 (16:42 +0000)]
[SystemZ] Regenerate rotate/shift tests

4 years ago[tblgen] Remove unused private field. NFC.
Benjamin Kramer [Sun, 15 Mar 2020 15:51:22 +0000 (16:51 +0100)]
[tblgen] Remove unused private field. NFC.

4 years ago[AVR] Make helper functions static. NFC.
Benjamin Kramer [Sun, 15 Mar 2020 15:50:15 +0000 (16:50 +0100)]
[AVR] Make helper functions static. NFC.

4 years ago[Clang][SVE] Parse builtin type string for scalable vectors
Sander de Smalen [Sun, 15 Mar 2020 14:29:45 +0000 (14:29 +0000)]
[Clang][SVE] Parse builtin type string for scalable vectors

This patch adds 'q' to mean 'scalable vector' in the builtin
type string, and for SVE will return the matching builtin
type as defined in the C/C++ language extensions for SVE.

This patch also adds some scaffolding to generate the arm_sve.h
header file, and some builtin definitions (+CodeGen) to be able
to implement some simple masked load intrinsics that use the
ACLE types, such as:

 svint8_t test_svld1_s8(svbool_t pg, const int8_t *base) {
   return svld1_s8(pg, base);
 }

Reviewers: efriedma, rjmccall, rovka, rsandifo-arm, rengolin

Reviewed By: efriedma

Tags: #clang

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

4 years ago[TypeSize] Allow returning scalable size in implicit conversion to uint64_t
Sander de Smalen [Fri, 13 Mar 2020 09:13:34 +0000 (09:13 +0000)]
[TypeSize] Allow returning scalable size in implicit conversion to uint64_t

This patch removes compiler runtime assertions that ensure the implicit
conversion are only guaranteed to work for fixed-width vectors.

With the assert it would be impossible to get _anything_ to build until
the
entire codebase has been upgraded, even when the indiscriminate uses of
the size as uint64_t would work fine for both scalable and fixed-width
types.

This issue will need to be addressed differently, with build-time errors
rather than assertion failures, but that effort falls beyond the scope
of this patch.

Returning the scalable size and avoiding the assert in getFixedSize()
is a temporary stop-gap in order to use LLVM for compiling and using
the SVE ACLE intrinsics.

Reviewers: efriedma, huntergr, rovka, ctetreau, rengolin

Reviewed By: efriedma

Tags: #llvm

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

4 years ago[DAG] MatchRotate - Add funnel shift by variable support
Simon Pilgrim [Sun, 15 Mar 2020 11:49:30 +0000 (11:49 +0000)]
[DAG] MatchRotate - Add funnel shift by variable support

Followup to D75114, this patch reuses the existing MatchRotate ROTL/ROTR rotation pattern code to also recognize the more general FSHL/FSHR funnel shift patterns when we have variable shift amounts, matched with MatchFunnelPosNeg which acts in an (almost) equivalent manner to MatchRotatePosNeg.

4 years ago[ValueLattice] Add singlecrfromundef lattice value.
Florian Hahn [Sun, 15 Mar 2020 10:35:39 +0000 (10:35 +0000)]
[ValueLattice] Add singlecrfromundef lattice value.

This patch adds a new singlecrfromundef lattice value, indicating a
single element constant range which was merge with undef at some point.
Merging it with another constant range results in overdefined, as we
won't be able to replace all users with a single value.

This patch uses a ConstantRange instead of a Constant*, because regular
integer constants are represented as single element constant ranges as
well and this allows the existing code working without additional
changes.

Reviewers: efriedma, nikic, reames, davide

Reviewed By: efriedma

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

4 years ago[mlir] Add support for generating dialect declarations via tablegen.
River Riddle [Sun, 15 Mar 2020 03:33:53 +0000 (20:33 -0700)]
[mlir] Add support for generating dialect declarations via tablegen.

Summary: This generates the class declarations for dialects using the existing 'Dialect' tablegen classes.

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

4 years agoBe more strict when checking existence of foo
Juneyoung Lee [Sun, 15 Mar 2020 03:02:19 +0000 (12:02 +0900)]
Be more strict when checking existence of foo

4 years ago[CodeGenPrepare] Freeze condition when transforming select to br
Juneyoung Lee [Sat, 14 Mar 2020 16:34:33 +0000 (01:34 +0900)]
[CodeGenPrepare] Freeze condition when transforming select to br

Summary:
This is a simple fix for CodeGenPrepare that freezes branch condition when transforming select to branch.
If it is not freezed, instsimplify or the later pipeline can potentially exploit undefined behavior.

The diff shows optimized form becase D75859 and D76048 already made a few changes to CodeGenPrepare for optimizing freeze(cmp).

Reviewers: jdoerfert, spatel, lebedev.ri, efriedma

Reviewed By: lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ORC] Remove an undefined static method from LLJIT.
Lang Hames [Sun, 15 Mar 2020 01:55:49 +0000 (18:55 -0700)]
[ORC] Remove an undefined static method from LLJIT.

Fixes http://llvm.org/PR44255. Thanks to Raoul Gough for finding the bug!

4 years ago[JITLink][AArch64] Fix incorrect capitalization in a testcase name.
Lang Hames [Sun, 15 Mar 2020 01:54:40 +0000 (18:54 -0700)]
[JITLink][AArch64] Fix incorrect capitalization in a testcase name.

4 years ago[ORC] Print symbol flags and materializer name in ExecutionSession::dump.
Lang Hames [Sun, 15 Mar 2020 01:52:10 +0000 (18:52 -0700)]
[ORC] Print symbol flags and materializer name in ExecutionSession::dump.

The extra information can be helpful in diagnosing JIT bugs.

4 years ago[JITLink][MachO] Re-apply b64afadf306, MachO linker-private support, with fixes.
Lang Hames [Sat, 14 Mar 2020 23:53:05 +0000 (16:53 -0700)]
[JITLink][MachO] Re-apply b64afadf306, MachO linker-private support, with fixes.

Global symbols with linker-private prefixes should be resolvable across object
boundaries, but internal symbols with linker-private prefixes should not.

4 years agoBasic Block Sections Support.
Sriraman Tallam [Fri, 13 Mar 2020 22:58:57 +0000 (15:58 -0700)]
Basic Block Sections Support.

This is the first in a series of patches to enable Basic Block Sections
in LLVM.

We introduce a new compiler option, -fbasicblock-sections=, which places every
basic block in a unique ELF text section in the object file along with a
symbol labeling the basic block. The linker can then order the basic block
sections in any arbitrary sequence which when done correctly can encapsulate
block layout, function layout and function splitting optimizations. However,
there are a couple of challenges to be addressed for this to be feasible:

1) The compiler must not allow any implicit fall-through between any two
   adjacent basic blocks as they could be reordered at link time to be
   non-adjacent. In other words, the compiler must make a fall-through
   between adjacent basic blocks explicit by retaining the direct jump
   instruction that jumps to the next basic block. These branches can only
   be removed later by the linker after the blocks have been reordered.
2) All inter-basic block branch targets would now need to be resolved by
   the linker as they cannot be calculated during compile time. This is
   done using static relocations which bloats the size of the object files.
   Further, the compiler tries to use short branch instructions on some ISAs
   for branch offsets that can be accommodated in one byte. This is not
   possible with basic block sections as the offset is not determined at
   compile time, and long branch instructions have to be used everywhere.
3) Each additional section bloats object file sizes by tens of bytes. The
   number of basic blocks can be potentially very large compared to the
   size of functions and can bloat object sizes significantly. Option
   fbasicblock-sections= also takes a file path which can be used to
   specify a subset of basic blocks that needs unique sections to keep
   the bloats small.
4) Debug Info and CFI need special handling and will be presented as
   separate patches.

Basic Block Labels

With -fbasicblock-sections=labels, or when a basic block is placed in a
unique section, it is labelled with a symbol. This allows easy mapping of
virtual addresses from PMU profiles back to the corresponding basic blocks.
Since the number of basic blocks is large, the labeling bloats the symbol
table sizes and the string table sizes significantly. While the binary size
does increase, it does not affect performance as the symbol table is not
loaded in memory during run-time. The string table size bloat is kept very
minimal using a unary naming scheme that uses string suffix compression.
The basic blocks for function foo are named "a.BB.foo", "aa.BB.foo", ...
This turns out to be very good for string table sizes and the bloat in the
string table size for a very large binary is ~8 %. The naming also allows
using the --symbol-ordering-file option in LLD to arbitrarily reorder the
sections.

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

4 years agoTest commit.
Sriraman Tallam [Sun, 15 Mar 2020 01:08:26 +0000 (18:08 -0700)]
Test commit.

4 years agoRevert "[JITLink][MachO] Treat linker private symbols as hidden rather than private."
Lang Hames [Sat, 14 Mar 2020 23:52:25 +0000 (16:52 -0700)]
Revert "[JITLink][MachO] Treat linker private symbols as hidden rather than private."

This reverts commit b64afadf306f284a684ee656c6eefbd43c192c8d.

Reverting while I investigate bot failures.

4 years ago[X86] Add avx512f only command lines to the vector add/sub saturation tests. NFC
Craig Topper [Sat, 14 Mar 2020 23:28:28 +0000 (16:28 -0700)]
[X86] Add avx512f only command lines to the vector add/sub saturation tests. NFC

Gives us coverage of splitting the v32i16/v64i8 when we have
avx512f and not avx512bw.

Considering making v32i16/v64i8 a legal type on avx512f which
needs this test coverage.

4 years ago[JITLink][MachO] Treat linker private symbols as hidden rather than private.
Lang Hames [Sat, 14 Mar 2020 23:22:48 +0000 (16:22 -0700)]
[JITLink][MachO] Treat linker private symbols as hidden rather than private.

Linker-private symbols should be resolvable across object file boundaries.

4 years ago[llvm-jitlink] Add -show-init-es option to dump initial ExecutionSession state.
Lang Hames [Sat, 14 Mar 2020 23:07:46 +0000 (16:07 -0700)]
[llvm-jitlink] Add -show-init-es option to dump initial ExecutionSession state.

Inspecting this state can be helpful when debugging jit-linking testcases.

4 years ago[Orc][examples] Actually return MainResult from main
Lang Hames [Sat, 14 Mar 2020 22:10:59 +0000 (15:10 -0700)]
[Orc][examples] Actually return MainResult from main

4 years ago[gn build] Port 633ea07200e
LLVM GN Syncbot [Sat, 14 Mar 2020 21:50:50 +0000 (21:50 +0000)]
[gn build] Port 633ea07200e

4 years ago[Orc] Add basic OrcV2 C bindings and example.
Lang Hames [Sat, 14 Mar 2020 21:16:42 +0000 (14:16 -0700)]
[Orc] Add basic OrcV2 C bindings and example.

Renames the llvm/examples/LLJITExamples directory to llvm/examples/OrcV2Examples
since it is becoming a home for all OrcV2 examples, not just LLJIT.

See http://llvm.org/PR31103.

4 years agoRemove an unnecessary explicit 'WarnDiag'; NFC
Aaron Ballman [Sat, 14 Mar 2020 21:15:59 +0000 (17:15 -0400)]
Remove an unnecessary explicit 'WarnDiag'; NFC

4 years agoRemove some explicit calls to getName() when printing diagnostics; NFC
Aaron Ballman [Sat, 14 Mar 2020 21:00:45 +0000 (17:00 -0400)]
Remove some explicit calls to getName() when printing diagnostics; NFC

4 years ago[mlir] Only treat "Alloc" effects as dead if they are for operation results.
River Riddle [Sat, 14 Mar 2020 20:50:01 +0000 (13:50 -0700)]
[mlir] Only treat "Alloc" effects as dead if they are for operation results.

Allocate could be used for an "output" of an operation in the case of buffer-style operations.

4 years ago[mlir][NFC] Move the LoopLike interface out of Transforms/ and into Interfaces/
River Riddle [Sat, 14 Mar 2020 20:36:42 +0000 (13:36 -0700)]
[mlir][NFC] Move the LoopLike interface out of Transforms/ and into Interfaces/

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

4 years agoImprove the attribute language option interface somewhat; NFCi.
Aaron Ballman [Sat, 14 Mar 2020 19:57:28 +0000 (15:57 -0400)]
Improve the attribute language option interface somewhat; NFCi.

The name field is optional if the custom code is supplied, so this updates the
documentation for LangOpt and introduces a tablegen warning if both custom code
and a language option name are supplied.

4 years ago[ValueLattice] Go to overdefined in getRange() for full ranges.
Florian Hahn [Sat, 14 Mar 2020 17:54:38 +0000 (17:54 +0000)]
[ValueLattice] Go to overdefined in getRange() for full ranges.

This is was split off 4878aa36d4aa27df644430139fab2734fde4a000,
as it can go in separately.

4 years ago[Hexagon] Only allow single HVX vector loads/stores in lowering
Krzysztof Parzyszek [Fri, 13 Mar 2020 13:37:57 +0000 (08:37 -0500)]
[Hexagon] Only allow single HVX vector loads/stores in lowering

This will prevent store widening from forming vector pair stores,
which eventually end up broken up into single stores.

4 years ago[mlir] Fix cross compiling MLIR
Isuru Fernando [Sat, 14 Mar 2020 18:41:12 +0000 (18:41 +0000)]
[mlir] Fix cross compiling MLIR

Setting MLIR_TABLEGEN_EXE would prevent building the native tool which is used in cross-compiling

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

4 years ago[clang-tidy] extend bugprone-signed-char-misuse check.
Tamás Zolnai [Sat, 14 Mar 2020 16:57:02 +0000 (17:57 +0100)]
[clang-tidy] extend bugprone-signed-char-misuse check.

Summary:
Cover a new use case when using a 'signed char' as an integer
might lead to issue with non-ASCII characters. Comparing
a 'signed char' with an 'unsigned char' using equality / unequality
operator produces an unexpected result for non-ASCII characters.

Reviewers: aaron.ballman, alexfh, hokein, njames93

Reviewed By: njames93

Subscribers: xazax.hun, cfe-commits

Tags: #clang, #clang-tools-extra

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

4 years agoFix signed/unsigned comparison warning.
Simon Pilgrim [Sat, 14 Mar 2020 18:42:27 +0000 (18:42 +0000)]
Fix signed/unsigned comparison warning.

4 years ago[X86] getFauxShuffleMask - pull out repeated byte sizes varaibles. NFC.
Simon Pilgrim [Sat, 14 Mar 2020 17:35:16 +0000 (17:35 +0000)]
[X86] getFauxShuffleMask - pull out repeated byte sizes varaibles. NFC.

4 years ago[ValueLattice] Add new state for undef constants.
Florian Hahn [Sat, 14 Mar 2020 16:50:09 +0000 (16:50 +0000)]
[ValueLattice] Add new state for undef constants.

This patch adds a new undef lattice state, which is used to represent
UndefValue constants or instructions producing undef.

The main difference to the unknown state is that merging undef values
with constants (or single element constant ranges) produces  the
constant/constant range, assuming all uses of the merge result will be
replaced by the found constant.

Contrary, merging non-single element ranges with undef needs to go to
overdefined. Using unknown for UndefValues currently causes mis-compiles
in CVP/LVI (PR44949) and will become problematic once we use
ValueLatticeElement for SCCP.

Reviewers: efriedma, reames, davide, nikic

Reviewed By: efriedma

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

4 years ago[yaml2obj] - Set a default value for `PAddr` property of a program header to a value...
Georgii Rymar [Fri, 13 Mar 2020 13:31:16 +0000 (16:31 +0300)]
[yaml2obj] - Set a default value for `PAddr` property of a program header to a value of `VAddr`

`PAddr` corresponds to `p_paddr` of a program header, which is the segment's physical
address for systems in which physical addressing is relevant. `p_paddr` is often equal
to `p_vaddr`, which is the virtual address of a segment.

This patch changes the default for `PAddr` from 0 to a value of `VAddr`.

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

4 years ago[X86] getFauxShuffleMask - merge insertelement paths
Simon Pilgrim [Sat, 14 Mar 2020 13:11:03 +0000 (13:11 +0000)]
[X86] getFauxShuffleMask - merge insertelement paths

Merge the INSERT_VECTOR_ELT/SCALAR_TO_VECTOR and PINSRW/PINSRB shuffle mask paths - they both do the same thing (find source vector + handle implicit zero extension). The PINSRW/PINSRB path also handled in the insertion of zero case which needed to be added to the general case as well.

4 years ago[llvm-dlltool] Add a testcase to show the kind of weak external used for import libra...
Martin Storsjö [Wed, 11 Mar 2020 08:54:37 +0000 (10:54 +0200)]
[llvm-dlltool] Add a testcase to show the kind of weak external used for import library aliases. NFC.

4 years ago[X86] Disable nop padding before instruction following a prefix
Shengchen Kan [Thu, 12 Mar 2020 09:13:09 +0000 (17:13 +0800)]
[X86] Disable nop padding before instruction following a prefix

Reviewers: reames, MaskRay, craig.topper, LuoYuanke, jyknight

Reviewed By: LuoYuanke

Subscribers: hiraditya, llvm-commits, annita.zhang

Tags: #llvm

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

4 years ago[mlir][NFC] modernize / clean up some loop transform utils, affine analysis utils
Uday Bondhugula [Sat, 14 Mar 2020 04:15:07 +0000 (21:15 -0700)]
[mlir][NFC] modernize / clean up some loop transform utils, affine analysis utils

Summary:
- remove stale declarations on flat affine constraints
- avoid allocating small vectors where possible
- clean up code comments, rename some variables

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

4 years agoPR44992 Don't crash when a defaulted <=> is in a class declared in a
Richard Smith [Sat, 14 Mar 2020 02:29:44 +0000 (19:29 -0700)]
PR44992 Don't crash when a defaulted <=> is in a class declared in a
transparent context.

(The same crash would happen if a class template with a friend was
declared in an 'export' block, but there are more issues with that
case.)

4 years ago[AArch64][Fix] LdSt optimization generate premature stack-popping
Diogo Sampaio [Fri, 13 Mar 2020 17:32:31 +0000 (17:32 +0000)]
[AArch64][Fix] LdSt optimization generate premature stack-popping

Summary:
When moving add and sub to memory operand instructions,
aarch64-ldst-opt would prematurally pop the stack pointer,
before memory instructions that do access the stack using
indirect loads.
e.g.
```
int foo(int offset){
    int local[4] = {0};
    return local[offset];
}
```
would generate:
```
sub     sp, sp, #16            ; Push the stack
mov     x8, sp                 ; Save stack in register
stp     xzr, xzr, [sp], #16    ; Zero initialize stack, and post-increment, making it invalid
------ If an exception goes here, the stack value might be corrupted
ldr     w0, [x8, w0, sxtw #2]  ; Access correct position, but it is not guarded by SP
```

Reviewers: fhahn, foad, thegameg, eli.friedman, efriedma

Reviewed By: efriedma

Subscribers: efriedma, kristof.beyls, hiraditya, danielkiss, llvm-commits, simon_tatham

Tags: #llvm

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

4 years agoPR45063: Fix crash on invalid processing an elaborated class template-id
Richard Smith [Sat, 14 Mar 2020 01:53:08 +0000 (18:53 -0700)]
PR45063: Fix crash on invalid processing an elaborated class template-id
with an invalid scope specifier.

4 years ago[X86] Remove isel patterns for X86VBroadcast+trunc+extload. Replace with DAG combines.
Craig Topper [Sat, 14 Mar 2020 01:02:48 +0000 (18:02 -0700)]
[X86] Remove isel patterns for X86VBroadcast+trunc+extload. Replace with DAG combines.

This is a little more complicated than I'd like it to be. We have
to manually match a trunc+srl+load pattern that generic DAG
combine won't do for us due to isTypeDesirableForOp.

4 years agoFix `-Wunused-variable`. NFC.
Michael Liao [Sat, 14 Mar 2020 00:50:35 +0000 (20:50 -0400)]
Fix `-Wunused-variable`. NFC.

4 years agoRevert "Revert "Move more tests to globalMemCounter and reset.""
Dan Albert [Fri, 13 Mar 2020 20:55:26 +0000 (13:55 -0700)]
Revert "Revert "Move more tests to globalMemCounter and reset.""

Test regressions not included this time :)

This reverts commit 1ed671082ef4b13d44e2c0f42ddedf9d450258a7.

4 years ago[NFC][LoopUnrollAndJam] clang-format.
Whitney Tsang [Sat, 14 Mar 2020 00:04:10 +0000 (00:04 +0000)]
[NFC][LoopUnrollAndJam] clang-format.

I am currently working on this file.

4 years agoAdjust debug output for MCRelaxableFragment to include the size so that sanity checki...
Philip Reames [Fri, 13 Mar 2020 22:54:43 +0000 (15:54 -0700)]
Adjust debug output for MCRelaxableFragment to include the size so that sanity checking relaxation offsets from -debug output is easier

4 years ago[SCEV] Add support for GEPs over scalable vectors.
Eli Friedman [Fri, 13 Mar 2020 23:12:45 +0000 (16:12 -0700)]
[SCEV] Add support for GEPs over scalable vectors.

Because we have to use a ConstantExpr at some point, the canonical form
isn't set in stone, but this seems reasonable.

The pretty sizeof(<vscale x 4 x i32>) dumping is a relic of ancient
LLVM; I didn't have to touch that code. :)

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

4 years agoInitialize IsFast* values
Brian Cain [Fri, 13 Mar 2020 20:24:19 +0000 (15:24 -0500)]
Initialize IsFast* values

We must initialize these values in case some targets do not assign to
them in allowsMemoryAccess().

4 years ago[LLJIT] Add std::move() as a workaround for older compilers
Jan Korous [Fri, 13 Mar 2020 22:21:12 +0000 (15:21 -0700)]
[LLJIT] Add std::move() as a workaround for older compilers

Clang 3.8 isn't able to bind the variable to rvalue-ref which breaks the build.

4 years ago[OPENMP]Fix PR45047: Do not copy firstprivates in tasks twice.
Alexey Bataev [Mon, 9 Mar 2020 12:55:57 +0000 (08:55 -0400)]
[OPENMP]Fix PR45047: Do not copy firstprivates in tasks twice.

Avoid copying of the orignal variable if it is going to be marked as
firstprivate in task regions. For taskloops, still need to copy the
non-trvially copyable variables to correctly construct them upon task
creation.

4 years agoAdd Builder::getI64VectorAttr.
Sean Silva [Wed, 11 Mar 2020 22:15:06 +0000 (15:15 -0700)]
Add Builder::getI64VectorAttr.

This matches Builder::getI32VectorAttr.

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

4 years ago[mlir][LLVMIR] Add a support for boolean type arguments conversion
Ahmed Taei [Fri, 13 Mar 2020 20:41:14 +0000 (13:41 -0700)]
[mlir][LLVMIR] Add a support for boolean type arguments conversion

Summary:
Otherwise this will fail translating ops with boolean arguments and
added test will fail.

Reviewers: nicolasvasilache, rriddle

Subscribers: mehdi_amini, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Linalg] Implement padding for linalg.conv and lowering to loops.
Hanhan Wang [Fri, 13 Mar 2020 21:33:27 +0000 (14:33 -0700)]
[mlir][Linalg] Implement padding for linalg.conv and lowering to loops.

Summary:
To enable this, two changes are needed:
1) Add an optional attribute `padding` to linalg.conv.
2) Compute if the indices accessing is out of bound in the loops. If so, use the
padding value `0`. Otherwise, use the value derived from load.

In the patch, the padding only works for lowering without other transformations,
e.g., tiling, fusion, etc.

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

4 years ago[mlir] Automatically add DerivedAttribute op interface
Jacques Pienaar [Fri, 13 Mar 2020 17:09:02 +0000 (10:09 -0700)]
[mlir] Automatically add DerivedAttribute op interface

Summary: When an operation has derived attributes, add the DerivedAttribute op interface.

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

4 years ago[ELF] Add test for freebsd bfdname
Shoaib Meenai [Fri, 13 Mar 2020 21:15:58 +0000 (14:15 -0700)]
[ELF] Add test for freebsd bfdname

Make sure the output error contains the full bfdname. Suggested by
George Rimar in https://reviews.llvm.org/D76109#inline-693972.

4 years ago[clangd] Add json::Object->Value conversion workaround for older compilers
Jan Korous [Thu, 12 Mar 2020 22:27:08 +0000 (15:27 -0700)]
[clangd] Add json::Object->Value conversion workaround for older compilers

The build was broken for clang-3.8 which we still support.

4 years ago[SelectionDAGBuilder] Simplify the struct type handling in getUniformBase.
Craig Topper [Fri, 13 Mar 2020 19:57:20 +0000 (12:57 -0700)]
[SelectionDAGBuilder] Simplify the struct type handling in getUniformBase.

4 years ago[IR] Fix formatting. NFC
Craig Topper [Fri, 13 Mar 2020 19:19:36 +0000 (12:19 -0700)]
[IR] Fix formatting. NFC

4 years ago[MCJIT] Check for RuntimeDyld errors in MCJIT::finalizeLoadedModules.
Lang Hames [Fri, 13 Mar 2020 16:24:09 +0000 (09:24 -0700)]
[MCJIT] Check for RuntimeDyld errors in MCJIT::finalizeLoadedModules.

Patch based on https://reviews.llvm.org/D75912 by Alexander Shishkin. Thanks
Alexander!

To minimize disruption to existing clients, who may be relying on the fact that
unused references to unresolved symbols do not generate an error, this patch
makes error checking opt-in: Clients can call ExecutionEngine::hasError or
LLVMExecutionEngineGetError to check whether and error has occurred.

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

4 years agoFix "unused variable" warning in NDEBUG builds.
Richard Smith [Fri, 13 Mar 2020 20:56:57 +0000 (13:56 -0700)]
Fix "unused variable" warning in NDEBUG builds.

4 years agoCMake: Turn LLVM_ENABLE_ZLIB into a tri-state option
Amy Huang [Thu, 12 Mar 2020 22:51:40 +0000 (15:51 -0700)]
CMake: Turn LLVM_ENABLE_ZLIB into a tri-state option

Summary:
Add FORCE_ON option to LLVM_ENABLE_ZLIB, which causes a configuration
error if zlib is not found.
Similar to https://reviews.llvm.org/D40050.

Reviewers: hans, thakis, rnk

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

4 years ago[ObjC][ARC] Don't remove autoreleaseRV/retainRV pairs if the call isn't
Akira Hatanaka [Fri, 13 Mar 2020 19:15:17 +0000 (12:15 -0700)]
[ObjC][ARC] Don't remove autoreleaseRV/retainRV pairs if the call isn't
a tail call

This reapplies the patch in https://reviews.llvm.org/rG1f5b471b8bf4,
which was reverted because it was causing crashes.

https://bugs.chromium.org/p/chromium/issues/detail?id=1061289#c2

Check that HasSafePathToCall is true before checking the call is a tail
call.

Original commit message:

Previosly ARC optimizer removed the autoreleaseRV/retainRV pair in the
following code, which caused the object returned by @something to be
placed in the autorelease pool because the call to @something isn't a
tail call:

```
  %call = call i8* @something(...)
  %2 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call)
  %3 = call i8* @objc_autoreleaseReturnValue(i8* %2)
  ret i8* %3
```

Fix the bug by checking whether @something is a tail call.

rdar://problem/59275894

4 years ago[AMDGPU] Fix endcf collapse
Stanislav Mekhanoshin [Fri, 13 Mar 2020 19:44:59 +0000 (12:44 -0700)]
[AMDGPU] Fix endcf collapse

Only collapse inner endcf if the outer one belongs to SI_IF.
If it does belong to SI_ELSE then mask being restored in fact
a partial inverse of what we need.

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

4 years ago[COFF] Assign unique names to autogenerated .weak.<name>.default symbols
Martin Storsjö [Tue, 10 Mar 2020 21:44:03 +0000 (23:44 +0200)]
[COFF] Assign unique names to autogenerated .weak.<name>.default symbols

These symbols need to be external (MSVC tools error out if a weak
external points at a symbol that isn't external; this was tried before
but had to be reverted in bc5b7217dceecd3eec69593026a9e38dfbfd6908,
and this was originally explicitly fixed in
732eeaf2a930ad2755cb4eb5d99a3deae0de4a72).

If multiple object files have weak symbols with defaults, their
defaults could cause linker errors due to duplicate definitions,
unless the names of the defaults are unique.

GNU binutils handles this by appending the name of another symbol
from the same object file to the name of the default symbol. Try
to implement something similar; before writing the object file,
locate a symbol that should have a unique name and use the name of
that one for making the weak defaults unique.

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

4 years ago[mlir][Vector]Lower vector.contract to llvm.intr.matrix_multiply
Nicolas Vasilache [Fri, 13 Mar 2020 20:32:27 +0000 (16:32 -0400)]
[mlir][Vector]Lower vector.contract to llvm.intr.matrix_multiply

Summary:
This revision adds lowering of vector.contract to llvm.intr.matrix_multiply.
Note that there is currently a mismatch between the MLIR vector dialect which
expects row-major layout and the LLVM matrix intrinsics which expect column
major layout.

As a consequence, we currently only match a vector.contract with indexing maps
that express column-major matrix multiplication.
Other cases would require additional transposes and it is better to wait for
LLVM intrinsics to provide a per-operation attribute that would specify which
layout is expected.

A separate integration test, not submitted to MLIR core, has independently
verified that correct execution occurs on a 2x2x2 matrix multiplication.

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

4 years agoAMDGPU: Add flag to used fixed function ABI
Matt Arsenault [Wed, 11 Mar 2020 20:13:52 +0000 (16:13 -0400)]
AMDGPU: Add flag to used fixed function ABI

Pass all arguments to every function, rather than only passing the
minimum set of inputs needed for the call graph.

4 years agoRevert "Move more tests to globalMemCounter and reset."
Dan Albert [Fri, 13 Mar 2020 20:26:35 +0000 (13:26 -0700)]
Revert "Move more tests to globalMemCounter and reset."

Not all of these changes were correct. Will reland appropriate parts
in a follow up.

This reverts commit 4a792965de08fb69652370625f1aec2e87111313.

4 years ago[Sema] Use the canonical type in function isVector
Akira Hatanaka [Fri, 13 Mar 2020 20:08:48 +0000 (13:08 -0700)]
[Sema] Use the canonical type in function isVector

This reapplies the following patch, which was reverted because it caused
neon CodeGen tests to fail:

https://reviews.llvm.org/rGa6150b48cea00ab31e9335cc73770327acc4cb3a

I've added checks to detect half precision neon vectors and avoid
promiting them to vectors of floats.

See the discussion here: https://reviews.llvm.org/rG825235c140e7

Original commit message:

This fixes an assertion in Sema::CreateBuiltinBinOp that fails when one
of the vector operand's element type is a typedef of __fp16.

rdar://problem/55983556

4 years ago[LoopInterchange] Fix interchanging contents of preheader BBs
Alexey Zhikhartsev [Fri, 13 Mar 2020 19:15:11 +0000 (15:15 -0400)]
[LoopInterchange] Fix interchanging contents of preheader BBs

Summary:
Previously LCSSA was getting broken by placing instructions into the
(newly) inner *header* instead of the *pre*header.

Fixes PR43474

Reviewers: fhahn

Reviewed By: fhahn

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoAMDGPU: Don't handle kernarg.segment.ptr in functions
Matt Arsenault [Thu, 12 Mar 2020 18:35:22 +0000 (14:35 -0400)]
AMDGPU: Don't handle kernarg.segment.ptr in functions

Just lower this to null. Pass implicitarg.ptr in its place in the
argument list.

4 years agoRevert "Reland "[DebugInfo] Enable the debug entry values feature by default""
Nico Weber [Fri, 13 Mar 2020 19:37:44 +0000 (15:37 -0400)]
Revert "Reland "[DebugInfo] Enable the debug entry values feature by default""

This reverts commit 5aa5c943f7da155b95564058cd5d50a93eabfc89.
Causes clang to assert, see
https://bugs.chromium.org/p/chromium/issues/detail?id=1061533#c4
for a repro.

4 years ago[AMDGPU] Disable endcf collapse
Stanislav Mekhanoshin [Fri, 13 Mar 2020 17:58:19 +0000 (10:58 -0700)]
[AMDGPU] Disable endcf collapse

There are some functional regressions and I suspect our
scopes are not as perfectly enclosed as I expected.
Disable it for now.

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

4 years ago[Sema][SVE] Reject arrays of sizeless types
Richard Sandiford [Thu, 27 Feb 2020 10:25:31 +0000 (10:25 +0000)]
[Sema][SVE] Reject arrays of sizeless types

The SVE ACLE doesn't allow arrays of sizeless types.  At the moment
clang accepts the TU:

  __SVInt8_t x[2];

but trying to code-generate it triggers the LLVM assertion:

  llvm/lib/IR/Type.cpp:588: static llvm::ArrayType* llvm::ArrayType::get(llvm::Type*, uint64_t): Assertion `isValidElementType(ElementType) && "Invalid type for array element!"' failed.

This patch reports an appropriate error instead.

The rules are slightly more restrictive than for general incomplete types.
For example:

  struct s;
  typedef struct s arr[2];

is valid as far as it goes, whereas arrays of sizeless types are
invalid in all contexts.  BuildArrayType therefore needs a specific
check for isSizelessType in addition to the usual handling of
incomplete types.

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

4 years ago[Sema][SVE] Reject by-copy capture of sizeless types
Richard Sandiford [Fri, 21 Feb 2020 17:12:44 +0000 (17:12 +0000)]
[Sema][SVE] Reject by-copy capture of sizeless types

Since fields can't have sizeless type, it also doesn't make sense
to capture sizeless types by value in lambda expressions.  This patch
makes sure that we diagnose that and that we use "sizeless type" rather
"incomplete type" in the associated message.  (Both are correct, but
"sizeless type" is more specific and hopefully more user-friendly.)

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

4 years agoAllow site-specific test_exec_root.
Dan Albert [Fri, 13 Mar 2020 19:23:45 +0000 (12:23 -0700)]
Allow site-specific test_exec_root.

Reviewers: EricWF, mclow.lists, #libc, ldionne

Reviewed By: #libc, ldionne

Subscribers: dexonsmith, ldionne, libcxx-commits

Tags: #libc

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

4 years ago[Sema][SVE] Don't allow fields to have sizeless type
Richard Sandiford [Fri, 21 Feb 2020 16:14:55 +0000 (16:14 +0000)]
[Sema][SVE] Don't allow fields to have sizeless type

The SVE ACLE doesn't allow fields to have sizeless type.  At the moment
clang accepts things like:

  struct s { __SVInt8_t x; } y;

but trying to code-generate it leads to LLVM asserts like:

  llvm/include/llvm/Support/TypeSize.h:126: uint64_t llvm::TypeSize::getFixedSize() const: Assertion `!IsScalable && "Request for a fixed size on a scalable object"' failed.

This patch adds an associated clang diagnostic.

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

4 years agoRevert "Revert "Update system_error tests for more platforms.""
Dan Albert [Fri, 13 Mar 2020 19:01:59 +0000 (12:01 -0700)]
Revert "Revert "Update system_error tests for more platforms.""

This time using old fashioned starts_with.

This reverts commit d4a8c3f2511f12e21e3c9adf58e162db25538c16.

4 years agoRevert "[ObjC][ARC] Check the basic block size before calling DominatorTree::dominate"
Reid Kleckner [Tue, 18 Feb 2020 22:51:32 +0000 (14:51 -0800)]
Revert "[ObjC][ARC] Check the basic block size before calling DominatorTree::dominate"

This reverts commit 5c3117b0a98dd11717eaffd7fb583985d39544b2

This should not be necessary after
7593a480dbce4e26f7dda4aa8f15bffd03acbfdb, and Florian Hahn has confirmed
that the problem no longer reproduces with this patch.

I happened to notice this code because the FIXME talks about
OrderedBasicBlock.

Reviewed By: fhahn, dexonsmith

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

4 years ago[X86][SSE] Prefer trunc(movd(x)) to pextrb(x,0)
Simon Pilgrim [Fri, 13 Mar 2020 18:42:43 +0000 (18:42 +0000)]
[X86][SSE] Prefer trunc(movd(x)) to pextrb(x,0)

If we're extracting the 0'th index of a v16i8 vector we're better off using MOVD than PEXTRB, unless we're storing the value or we require the implicit zero extension of PEXTRB.

The biggest perf diff is on SLM targets where MOVD (uops=1, lat=3 tp=1) is notably faster than PEXTRB (uops=2, lat=5, tp=4).

This matches what we already do for PEXTRW.

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

4 years ago[mlir] [VectorOps,LinAlg] Remove direct LLVM lowering for vector.broadcast
aartbik [Fri, 13 Mar 2020 16:35:29 +0000 (09:35 -0700)]
[mlir] [VectorOps,LinAlg] Remove direct LLVM lowering for vector.broadcast

Summary:
The direct lowering of vector.broadcast into LLVM has been replaced by
progressive lowering into elementary vector ops. This also required a
small refactoring of a llvm.mlir test that used a direct vector.broadcast
operator (just to define a matmul).

Reviewers: nicolasvasilache, andydavis1, rriddle

Reviewed By: nicolasvasilache

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[SimplifyCFG] add test for chain of empty block conditional branches; NFC
Sanjay Patel [Fri, 13 Mar 2020 18:36:26 +0000 (14:36 -0400)]
[SimplifyCFG] add test for chain of empty block conditional branches; NFC

4 years ago[SLPVectorizer][SVE] Bail out early for scalable vector.
Huihui Zhang [Fri, 13 Mar 2020 18:23:01 +0000 (11:23 -0700)]
[SLPVectorizer][SVE] Bail out early for scalable vector.

Summary:
SLPVectorizer try to vectorize list of scalar instructions of the same type,
instructions already vectorized are rejected through isValidElementType().

Without this patch, tryToVectorizeList() will first try to determine vectorization
factor of a list of Instructions before checking whether each instruction has unsupported
type or not. For instructions already vectorized for SVE, it will crash at getVectorElementSize(),
where it try to return a fixed size.

This patch make sure invalid element types are rejected before trying to get vectorization
factor. This make sure we are not trying to vectorize instructions already vectorized.

Reviewers: sdesmalen, efriedma, spatel, RKSimon, ABataev, apazos, rengolin

Reviewed By: efriedma

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

Tags: #llvm

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

4 years agoDebug Info: Store the SDK in the DICompileUnit.
Adrian Prantl [Thu, 12 Mar 2020 21:19:04 +0000 (14:19 -0700)]
Debug Info: Store the SDK in the DICompileUnit.

This is another intermediate step for PR44213
(https://bugs.llvm.org/show_bug.cgi?id=44213).

This stores the SDK *name* in the debug info, to make it possible to
`-fdebug-prefix-map`-replace the sysroot with a recognizable string
and allowing the debugger to find a fitting SDK relative to itself,
not the machine the executable was compiled on.

rdar://problem/51645582

4 years ago[SimplifyCFG] regenerate complete test checks; NFC
Sanjay Patel [Fri, 13 Mar 2020 18:12:04 +0000 (14:12 -0400)]
[SimplifyCFG] regenerate complete test checks; NFC

4 years ago[SimplifyCFG] regenerate test checks; NFC
Sanjay Patel [Fri, 13 Mar 2020 18:08:54 +0000 (14:08 -0400)]
[SimplifyCFG] regenerate test checks; NFC