platform/upstream/llvm.git
4 years agoAMDGPU: Don't pass MachineFunction if only the IR Function is used
Matt Arsenault [Thu, 18 Jun 2020 12:39:13 +0000 (08:39 -0400)]
AMDGPU: Don't pass MachineFunction if only the IR Function is used

4 years ago[AVR] Fix miscompilation of zext + add
Ayke van Laethem [Sun, 19 Apr 2020 00:22:06 +0000 (02:22 +0200)]
[AVR] Fix miscompilation of zext + add

Code like the following:

    define i32 @foo(i32 %a, i1 zeroext %b) addrspace(1) {
    entry:
      %conv = zext i1 %b to i32
      %add = add nsw i32 %conv, %a
      ret i32 %add
    }

Would compile to the following (incorrect) code:

    foo:
        mov     r18, r20
        clr     r19
        add     r22, r18
        adc     r23, r19
        sbci    r24, 0
        sbci    r25, 0
        ret

Those sbci instructions are clearly wrong, they should have been adc
instructions.

This commit improves codegen to use adc instead:

    foo:
        mov     r18, r20
        clr     r19
        ldi     r20, 0
        ldi     r21, 0
        add     r22, r18
        adc     r23, r19
        adc     r24, r20
        adc     r25, r21
        ret

This code is not optimal (it could be just 5 instructions instead of the
current 9) but at least it doesn't miscompile.

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

4 years ago[clang-tidy] RenamerClangTidy group redecls into 1 warning.
Nathan James [Thu, 18 Jun 2020 14:50:15 +0000 (15:50 +0100)]
[clang-tidy] RenamerClangTidy group redecls into 1 warning.

This changes the behavious of `RenamerClangTidyCheck` based checks by grouping declarations of the same thing into 1 warning where it is first declared.
This cleans up clang-tidy output and prevents issues where 1 fix-it couldn't be applied, yet all other warnings(and fix-its) for the same declaration would be applied.
The old behaviour of forward declaring a class without defining it isn't affected, i.e. no warnings will be emitted for that case.

Reviewed By: aaron.ballman

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

4 years agoLanai: Remove unused method
Matt Arsenault [Thu, 18 Jun 2020 14:20:43 +0000 (10:20 -0400)]
Lanai: Remove unused method

This was depending on the MachineFunction at MachineFunctionInfo
construction, which will soon be disallowed.

4 years ago[X86][SSE] Fold MOVMSK(PCMPEQ(X,0)) == -1 -> PTESTZ(X,X)
Simon Pilgrim [Thu, 18 Jun 2020 13:22:02 +0000 (14:22 +0100)]
[X86][SSE] Fold MOVMSK(PCMPEQ(X,0)) == -1 -> PTESTZ(X,X)

Allow combineSetCCMOVMSK to handle 'allof' X == 0 patterns to be replaced with PTESTZ

This is a preliminary patch before properly handling PR35129

4 years ago[libc++] Add equality for spaceship types for themselves
Christopher Di Bella [Thu, 18 Jun 2020 14:17:57 +0000 (10:17 -0400)]
[libc++] Add equality for spaceship types for themselves

- Adds operator==(partial_ordering, partial_ordering)
- Adds operator==(weak_ordering, weak_ordering)
- Adds operator==(strong_ordering, strong_ordering)

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

4 years ago[libcxx/variant] Fix build error for when exceptions disabled.
Michael Park [Tue, 16 Jun 2020 22:15:10 +0000 (15:15 -0700)]
[libcxx/variant] Fix build error for when exceptions disabled.

Reviewers: #libc!

Subscribers: libcxx-commits

Tags: #libc

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

4 years agoFix linker error in clang-fuzzer following 89ea0b05207d45c145fb525df554b3b986ae379b.
Alexandre Ganea [Thu, 18 Jun 2020 14:07:18 +0000 (10:07 -0400)]
Fix linker error in clang-fuzzer following 89ea0b05207d45c145fb525df554b3b986ae379b.

This fixes:
tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o:handle_cxx.cpp:function clang_fuzzer::HandleCXX(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, std::vector<char const*, std::allocator<char const*> > const&): error: undefined reference to 'clang::tooling::newInvocation(clang::DiagnosticsEngine*, llvm::SmallVector<char const*, 16u> const&)'

4 years ago[CodeView] Fix generated command-line expansion in LF_BUILDINFO. Fix the 'pdb' entry...
Alexandre Ganea [Thu, 18 Jun 2020 14:02:02 +0000 (10:02 -0400)]
[CodeView] Fix generated command-line expansion in LF_BUILDINFO. Fix the 'pdb' entry which was previously a null reference, now an empty string.

Previously, the DIA SDK didn't like the empty reference in the 'pdb' entry.

4 years ago[libc++] Allow specifying custom Lit config files
Louis Dionne [Fri, 12 Jun 2020 19:19:55 +0000 (15:19 -0400)]
[libc++] Allow specifying custom Lit config files

Before this patch, the libc++ test suite first loads lit.site.cfg
(generated by CMake), and then lit.cfg. It's also possible to load
lit.cfg before lit.site.cfg and to point to a custom lit.site.cfg
file using '--param=libcxx_site_config'. However, in that case, lit.cfg
still relies on the site configuration filling up the 'config' object
like the default lit.site.cfg file does, which isn't flexible enough.

This commit simplifies the setup by having just a single Lit site config
file per CMake configuration, and always loading exactly that config file.
However, the config file to use can be selected when setting up CMake via
the LIBCXX_TEST_CONFIG setting. Furthermore, the site configs are entirely
standalone, which means that a new site config can be added that doesn't
need to conform what's expected by config.py.

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

4 years ago[RISCV64] Emit correct lib call for fp(float/double) to ui/si
Kamlesh Kumar [Thu, 18 Jun 2020 13:46:54 +0000 (19:16 +0530)]
[RISCV64] Emit correct lib call for fp(float/double) to ui/si

Since i32 is not legal in riscv64,
it always promoted to i64 before emitting lib call and
for conversions like float/double to int and float/double to unsigned int
wrong lib call was emitted. This commit fix it using custom lowering.

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

4 years ago[llvm][docs] Document the LLVM_INSTALL_UTILS CMake option (NFC)
Jean-Michel Gorius [Thu, 18 Jun 2020 13:31:13 +0000 (15:31 +0200)]
[llvm][docs] Document the LLVM_INSTALL_UTILS CMake option (NFC)

4 years ago[MC] Rename a misnamed function. NFC.
Igor Kudrin [Thu, 18 Jun 2020 13:15:55 +0000 (20:15 +0700)]
[MC] Rename a misnamed function. NFC.

The patch renames MakeStartMinusEndExpr() to makeEndMinusStartExpr() to
better reflect an expression it creates and fix a naming style issue.

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

4 years ago[CodeView] Add full repro to LF_BUILDINFO record
Alexandre Ganea [Thu, 18 Jun 2020 13:16:59 +0000 (09:16 -0400)]
[CodeView] Add full repro to LF_BUILDINFO record

This patch adds some missing information to the LF_BUILDINFO which allows for rebuilding an .OBJ without any external dependency but the .OBJ itself (other than the compiler executable).

Some tools need this information to reproduce a build without any knowledge of the build system. The LF_BUILDINFO therefore stores a full path to the compiler, the PWD (which is the CWD at program startup), a relative or absolute path to the TU, and the full CC1 command line. The command line needs to be freestanding (not depend on any environment variable). In the same way, MSVC doesn't store the provided command-line, but an expanded version (somehow their equivalent of CC1) which is also freestanding.

For more information see PR36198 and D43002.

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

4 years ago[MC] Pass down argv0 & cc1 cmd-line to the back-end and store in MCTargetOptions
Alexandre Ganea [Thu, 18 Jun 2020 12:57:50 +0000 (08:57 -0400)]
[MC] Pass down argv0 & cc1 cmd-line to the back-end and store in MCTargetOptions

When targetting CodeView, the goal is to store argv0 & cc1 cmd-line in the emitted .OBJ, in order to allow a reproducer from the .OBJ alone.

This patch is to simplify https://reviews.llvm.org/D80833

4 years ago[CodeView] Add TypeCollection::replaceType to replace type records post-merging
Alexandre Ganea [Thu, 18 Jun 2020 12:21:39 +0000 (08:21 -0400)]
[CodeView] Add TypeCollection::replaceType to replace type records post-merging

The API is not called in this patch. This is to simply/support https://reviews.llvm.org/D80833

4 years ago[Clang] Move clang::Job::printArg to llvm::sys::printArg. NFCI.
Alexandre Ganea [Wed, 17 Jun 2020 22:33:18 +0000 (18:33 -0400)]
[Clang] Move clang::Job::printArg to llvm::sys::printArg. NFCI.

This patch is to support/simplify https://reviews.llvm.org/D80833

4 years ago[HIP] Fix rocm not found on rocm3.5
Yaxun (Sam) Liu [Fri, 12 Jun 2020 03:24:50 +0000 (23:24 -0400)]
[HIP] Fix rocm not found on rocm3.5

Currently rocm detector expects device library bitcodes named as *.bc
instead of *.amdgcn.bc. However in rocm3.5 the device library bitcodes
are named as *.amdgcn.bc, which causes rocm3.5 not detected.

This patch fixes that.

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

4 years ago[clang][utils] Modify make-ast-dump-check.sh to generate AST serialization dump tests
Bruno Ricci [Thu, 18 Jun 2020 12:02:11 +0000 (13:02 +0100)]
[clang][utils] Modify make-ast-dump-check.sh to generate AST serialization dump tests

An AST serialization dump test is a test which compares the output of -ast-dump
on the source and of -ast-dump-all on a PCH generated from the source. Modulo
a few differences the outputs should match.

This patch to make-ast-dump-check.sh enables automatically generating
these tests.

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

Reviewed By: aaron.ballman, lebedev.ri

4 years ago[clang] Fix the serialization of LambdaExpr and the bogus mutation in LambdaExpr...
Bruno Ricci [Thu, 18 Jun 2020 11:51:11 +0000 (12:51 +0100)]
[clang] Fix the serialization of LambdaExpr and the bogus mutation in LambdaExpr::getBody

The body of LambdaExpr is currently not properly serialized. Instead
LambdaExpr::getBody checks if the body has been already deserialized and if
not mutates LambdaExpr. This can be observed with an AST dump test, where
the body of the LambdaExpr will be null.

The mutation in LambdaExpr::getBody was left because of another bug: it is not
true that the body of a LambdaExpr is always a CompoundStmt; it can also be
a CoroutineBodyStmt wrapping a CompoundStmt. This is fixed by returning a
Stmt * from getBody and introducing a convenience function getCompoundStmtBody
which always returns a CompoundStmt *. This function can be used by callers who
do not care about the coroutine node.

Happily all but one user of getBody treat it as a Stmt * and so this change
is non-intrusive.

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

Reviewed By: aaron.ballman

4 years ago[Matrix] Pass darwin tripe to SeamObjc test to fix windows bot failure.
Florian Hahn [Thu, 18 Jun 2020 12:33:14 +0000 (13:33 +0100)]
[Matrix] Pass darwin tripe to SeamObjc test to fix windows bot failure.

Without the triple, the test fails on a windows bot
(http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/16531/steps/stage%201%20check/logs/stdio)

because of different full type widths (unsigned long long vs unsigned long)

4 years ago[Matrix] Use alignment info when lowering loads/stores.
Florian Hahn [Thu, 18 Jun 2020 12:06:00 +0000 (13:06 +0100)]
[Matrix] Use alignment info when lowering loads/stores.

This patch updates LowerMatrixIntrinsics to preserve the alignment
specified at the original load/stores and the align attribute for the
pointer argument of the column.major.load/store intrinsics.

We can always use the specified alignment for the load of the first
column. For subsequent columns, the alignment may need to be reduced.

For ConstantInt strides, compute the offset for the start of the column in
bytes and use commonAlignment to get the largest valid alignment.

For non-ConstantInt strides, we need to take the common alignment of the
initial alignment and the element size in bytes.

Reviewers: anemet, Gerolf, hfinkel, andrew.w.kaylor, LuoYuanke, rjmccall

Reviewed By: rjmccall

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

4 years ago[SVE] Add checks for no warnings in SVE tests
David Sherwood [Thu, 28 May 2020 10:29:26 +0000 (11:29 +0100)]
[SVE] Add checks for no warnings in SVE tests

There are now quite a few SVE tests in LLVM and Clang that do not
emit warnings related to invalid use of EVT::getVectorNumElements()
and VectorType::getNumElements(). For these tests I have added
additional checks that there are no warnings in order to prevent
any future regressions.

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

4 years ago[ARM][Clang] Removing lowering of half-precision FP arguments and returns from Clang...
Lucas Prates [Tue, 9 Jun 2020 08:52:01 +0000 (09:52 +0100)]
[ARM][Clang] Removing lowering of half-precision FP arguments and returns from Clang's CodeGen

Summary:
On the process of moving the argument lowering handling for
half-precision floating point arguments and returns to the backend, this
patch removes the code that was responsible for handling the coercion of
those arguments in Clang's Codegen.

Reviewers: rjmccall, chill, ostannard, dnsampaio

Reviewed By: ostannard

Subscribers: stuij, kristof.beyls, dmgreen, danielkiss, cfe-commits

Tags: #clang

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

4 years ago[ARM] Moving CMSE handling of half arguments and return to the backend
Lucas Prates [Fri, 5 Jun 2020 12:23:30 +0000 (13:23 +0100)]
[ARM] Moving CMSE handling of half arguments and return to the backend

Summary:
As half-precision floating point arguments and returns were previously
coerced to either float or int32 by clang's codegen, the CMSE handling
of those was also performed in clang's side by zeroing the unused MSBs
of the coercer values.

This patch moves this handling to the backend's calling convention
lowering, making sure the high bits of the registers used by
half-precision arguments and returns are zeroed.

Reviewers: chill, rjmccall, ostannard

Reviewed By: ostannard

Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[ARM] Supporting lowering of half-precision FP arguments and returns in AArch32's...
Lucas Prates [Tue, 9 Jun 2020 08:45:47 +0000 (09:45 +0100)]
[ARM] Supporting lowering of half-precision FP arguments and returns in AArch32's backend

Summary:
Half-precision floating point arguments and returns are currently
promoted to either float or int32 in clang's CodeGen and there's
no existing support for the lowering of `half` arguments and returns
from IR in AArch32's backend.

Such frontend coercions, implemented as coercion through memory
in clang, can cause a series of issues in argument lowering, as causing
arguments to be stored on the wrong bits on big-endian architectures
and incurring in missing overflow detections in the return of certain
functions.

This patch introduces the handling of half-precision arguments and returns in
the backend using the actual "half" type on the IR. Using the "half"
type the backend is able to properly enforce the AAPCS' directions for
those arguments, making sure they are stored on the proper bits of the
registers and performing the necessary floating point convertions.

Reviewers: rjmccall, olista01, asl, efriedma, ostannard, SjoerdMeijer

Reviewed By: ostannard

Subscribers: stuij, hiraditya, dmgreen, llvm-commits, chill, dnsampaio, danielkiss, kristof.beyls, cfe-commits

Tags: #clang, #llvm

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

4 years ago[SVE] Add flag to specify SVE register size, using this to calculate legal vector...
Paul Walker [Fri, 13 Dec 2019 15:03:17 +0000 (15:03 +0000)]
[SVE] Add flag to specify SVE register size, using this to calculate legal vector types.

Adds aarch64-sve-vector-bits-{min,max} to allow the size of SVE
data registers (in bits) to be specified. This allows the code
generator to make assumptions it normally couldn't. As a starting
point this information is used to mark fixed length vector types
that can fit within the specified size as legal.

Reviewers: rengolin, efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[DA] conservatively mark the join of every divergent branch
Sameer Sahasrabuddhe [Thu, 18 Jun 2020 12:09:20 +0000 (17:39 +0530)]
[DA] conservatively mark the join of every divergent branch

For a loop, a join block is a block that is reachable along multiple
disjoint paths from the exiting block of a loop. If the exit condition
of the loop is divergent, then such join blocks must also be marked
divergent. This currently fails in some cases because not all join
blocks are identified correctly.

The workaround is to conservatively mark every join block of any
branch (not necessarily the exiting block of a loop) as divergent.

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

Reviewed By: simoll

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

4 years agoMake matrix-type-builtins.m pass also on platforms where the type is 'unsigned long...
Hans Wennborg [Thu, 18 Jun 2020 12:06:55 +0000 (14:06 +0200)]
Make matrix-type-builtins.m pass also on platforms where the type is 'unsigned long long'

4 years ago[mlir] Add a pass to remove all shape.cstr_ and assuming_ ops.
Tres Popp [Tue, 9 Jun 2020 09:33:43 +0000 (11:33 +0200)]
[mlir] Add a pass to remove all shape.cstr_ and assuming_ ops.

Summary:
This is to provide a utility to remove unsupported constraints or for
pipelines that happen to receive these but cannot lower them due to not
supporting assertions.

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

4 years ago[Matrix] Preserve volatile when loading loads/stores.
Florian Hahn [Thu, 18 Jun 2020 11:14:19 +0000 (12:14 +0100)]
[Matrix] Preserve volatile when loading loads/stores.

Currently the matrix lowering turns volatile loads/stores into
non-volatile ones. This patch updates the lowering to preserve the
volatile bit.

Reviewers: anemet, Gerolf, hfinkel, andrew.w.kaylor, LuoYuanke, nicolasvasilache

Reviewed By: anemet

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

4 years ago[Matrix] Add __builtin_matrix_column_store to Clang.
Florian Hahn [Thu, 18 Jun 2020 09:49:56 +0000 (10:49 +0100)]
[Matrix] Add __builtin_matrix_column_store to Clang.

This patch add __builtin_matrix_column_major_store to Clang,
as described in clang/docs/MatrixTypes.rst. In the initial version,
the stride is not optional yet.

Reviewers: rjmccall, jfb, rsmith, Bigcheese

Reviewed By: rjmccall

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

4 years ago[SveEmitter] Add builtins to insert/extract subvectors from tuples (svget/svset)
Sander de Smalen [Thu, 18 Jun 2020 09:08:25 +0000 (10:08 +0100)]
[SveEmitter] Add builtins to insert/extract subvectors from tuples (svget/svset)

For example:
  svint32_t svget4(svint32x4_t tuple, uint64_t imm_index)

returns the subvector at `index`, which must be in range `0..3`.
  svint32x3_t svset3(svint32x3_t tuple, uint64_t index, svint32_t vec)

returns a tuple vector with `vec` inserted into `tuple` at `index`,
which must be in range `0..2`.

Reviewers: c-rhodes, efriedma

Reviewed By: c-rhodes

Tags: #clang

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

4 years agoTry to remove the acle_sve_adda.s file that's breaking tests
Hans Wennborg [Thu, 18 Jun 2020 09:59:42 +0000 (11:59 +0200)]
Try to remove the acle_sve_adda.s file that's breaking tests

4 years ago[mlir] NFC: Fix link in traits documentation
Jean-Michel Gorius [Thu, 18 Jun 2020 09:58:07 +0000 (11:58 +0200)]
[mlir] NFC: Fix link in traits documentation

4 years ago[NFC][LiveDebugValues] Document how LiveDebugValues operates
Jeremy Morse [Thu, 18 Jun 2020 09:54:09 +0000 (10:54 +0100)]
[NFC][LiveDebugValues] Document how LiveDebugValues operates

We're missing a plain English explanation of how this pass is supposed
to operate -- add one to the file comment.

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

4 years ago[Matrix] Add __builtin_matrix_column_load to Clang.
Florian Hahn [Thu, 18 Jun 2020 09:06:38 +0000 (10:06 +0100)]
[Matrix] Add __builtin_matrix_column_load to Clang.

This patch add __builtin_matrix_column_major_load to Clang,
as described in clang/docs/MatrixTypes.rst. In the initial version,
the stride is not optional yet.

Reviewers: rjmccall, rsmith, jfb, Bigcheese

Reviewed By: rjmccall

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

4 years ago[mlir] Provide OpBuilder-based replacements for edsc::BlockBuilder
Alex Zinenko [Wed, 17 Jun 2020 14:46:45 +0000 (16:46 +0200)]
[mlir] Provide OpBuilder-based replacements for edsc::BlockBuilder

The ScopedBuilder class in EDSC is being gradually phased out in favor of core
OpBuilder-based helpers with callbacks. Provide helper functions that are
compatible with `edsc::ScopedContext` and can be used to create and populate
blocks using callbacks that take block arguments as callback arguments. This
removes the need for `edsc::BlockHandle`, forward-declaration of `Value`s used
for block arguments and the tag `edsc::Append` class, leading to noticable
reduction in the verbosity of the code using helper functions.

Remove "eager mode" construction tests that are only relevant to the
`BlockBuilder`-based approach.

`edsc::BlockHandle` and `edsc::BlockBuilder` are now deprecated and will be
removed soon.

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

4 years ago[MLIR][Linalg] Retire C++ MatvecOp in favor of a linalg-ods-gen'd op
lorenzo chelini [Thu, 18 Jun 2020 09:32:09 +0000 (11:32 +0200)]
[MLIR][Linalg] Retire C++ MatvecOp in favor of a linalg-ods-gen'd op

Replace C++ MatvecOp, now that DRR rules have been dropped.

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

4 years ago[AVR] Implement disassembly of 32-bit instructions
Ayke van Laethem [Tue, 16 Jun 2020 19:39:09 +0000 (21:39 +0200)]
[AVR] Implement disassembly of 32-bit instructions

This needed two fixes:

  * 32-bit instructions were read in the wrong order. The machine code
    swaps the two 16-bit instruction words, which wasn't undone when
    decoding instructions.
  * Jump and call instructions don't encode the lowest address bit,
    which is always zero. Therefore, the address needed to be shifted by
    one to fix that.

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

4 years ago[SveEmitter] Add builtins for tuple creation (svcreate2/svcreate3/etc)
Sander de Smalen [Thu, 18 Jun 2020 08:36:40 +0000 (09:36 +0100)]
[SveEmitter] Add builtins for tuple creation (svcreate2/svcreate3/etc)

The svcreate builtins allow constructing a tuple from individual vectors, e.g.

  svint32x2_t svcreate2(svint32_t v2, svint32_t v2)`

Reviewers: c-rhodes, david-arm, efriedma

Reviewed By: c-rhodes, efriedma

Tags: #clang

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

4 years ago[Clang][Sema] Use of incorrect __has_feature vs __has_builtin
Guillaume Chatelet [Thu, 18 Jun 2020 08:59:34 +0000 (08:59 +0000)]
[Clang][Sema] Use of incorrect __has_feature vs __has_builtin

4 years ago[Matrix] Add volatile load/store tests (NFC).
Florian Hahn [Tue, 9 Jun 2020 15:25:11 +0000 (16:25 +0100)]
[Matrix] Add volatile load/store tests (NFC).

4 years ago[CodeGen] Fix warnings in getVectorTypeBreakdown
David Sherwood [Thu, 11 Jun 2020 06:47:23 +0000 (07:47 +0100)]
[CodeGen] Fix warnings in getVectorTypeBreakdown

Added NextPowerOf2() routine to TypeSize and rewritten the code
in getVectorTypeBreakdown to avoid warnings being generated.

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

4 years ago[Matrix] Update load/store intrinsics.
Florian Hahn [Thu, 18 Jun 2020 08:30:41 +0000 (09:30 +0100)]
[Matrix] Update load/store intrinsics.

This patch adjust the load/store matrix intrinsics, formerly known as
llvm.matrix.columnwise.load/store, to improve the naming and allow
passing of extra information (volatile).

The patch performs the following changes:
 * Rename columnwise.load/store to column.major.load/store. This is more
   expressive and also more in line with the naming in Clang.
 * Changes the stride arguments from i32 to i64. The stride can be
   larger than i32 and this makes things more uniform with the way
   things are handled in Clang.
 * A new boolean argument is added to indicate whether the load/store
   is volatile. The lowering respects that when emitting vector
   load/store instructions
 * MatrixBuilder is updated to require both Alignment and IsVolatile
   arguments, which are passed through to the generated intrinsic. The
   alignment is set using the `align` attribute.

The changes are grouped together in a single patch, to have a single
commit that breaks the compatibility. We probably should be fine with
updating the intrinsics, as we did not yet officially support them in
the last stable release. If there are any concerns, we can add
auto-upgrade rules for the columnwise intrinsics though.

Reviewers: anemet, Gerolf, hfinkel, andrew.w.kaylor, LuoYuanke, nicolasvasilache, rjmccall, ftynse

Reviewed By: anemet, nicolasvasilache

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

4 years ago[CodeGen] Fix warnings in foldCONCAT_VECTORS
David Sherwood [Tue, 16 Jun 2020 13:12:38 +0000 (14:12 +0100)]
[CodeGen] Fix warnings in foldCONCAT_VECTORS

Instead of asserting the number of elements is the same, we should be
comparing the element counts instead. In addition, when looking at
concats of extract_subvectors it's fine to use getVectorMinNumElements()
for scalable vectors.

I discovered these warnings when compiling the structured loads tests in
this file:

  test/CodeGen/AArch64/sve-intrinsics-loads.ll

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

4 years agoCorrectly report modified status for HWAddressSanitizer
serge-sans-paille [Mon, 15 Jun 2020 10:21:05 +0000 (12:21 +0200)]
Correctly report modified status for HWAddressSanitizer

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

4 years ago[mlir] [Vector] Add missing edsc intrinsics.
Pierre Oechsel [Thu, 18 Jun 2020 08:21:53 +0000 (10:21 +0200)]
[mlir] [Vector] Add missing edsc intrinsics.

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

4 years ago[CodeGen] Fix warnings in isPow2VectorType and getPow2VectorType
David Sherwood [Tue, 16 Jun 2020 16:00:12 +0000 (17:00 +0100)]
[CodeGen] Fix warnings in isPow2VectorType and getPow2VectorType

We should either call getVectorMinNumElements() or
getVectorElementCount().

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

4 years ago[MLIR][Shape] Lower `size_to_index` and `index_to_size` with declarative rules
Frederik Gossen [Thu, 18 Jun 2020 08:00:33 +0000 (08:00 +0000)]
[MLIR][Shape] Lower `size_to_index` and `index_to_size` with declarative rules

Replace implemented rewrite patterns with equivalent declarative rules.

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

4 years ago[MLIR][Shape] Realize `shape` to `std` lowering with declarative patterns
Frederik Gossen [Thu, 18 Jun 2020 07:51:03 +0000 (07:51 +0000)]
[MLIR][Shape] Realize `shape` to `std` lowering with declarative patterns

Setup declarative rewrite rules to lower the `shape` dialect to the `std`
dialect with two exemplary rules for `from/to_extent_tensor`.

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

4 years ago[ARM] Adjust AND/OR combines to not call isConstantSplat on i1 vectors. NFC.
David Green [Wed, 17 Jun 2020 21:16:43 +0000 (22:16 +0100)]
[ARM] Adjust AND/OR combines to not call isConstantSplat on i1 vectors. NFC.

The rearranges PerformANDCombine and PerformORCombine to try and make
sure we don't call isConstantSplat on any i1 vectors. As pointed out in
D81860 it may not be very well defined in those cases.

4 years agoRevert "[SVE] Add checks for no warnings in SVE tests"
David Sherwood [Thu, 18 Jun 2020 07:03:11 +0000 (08:03 +0100)]
Revert "[SVE] Add checks for no warnings in SVE tests"

This reverts commit fb495c31701b2cd697cf4282f63764c9cefd49c0.

Was causing test failures and broke buildbot.

4 years ago[CodeGen] Fix warnings in getVectorElementCount()
David Sherwood [Tue, 16 Jun 2020 11:18:00 +0000 (12:18 +0100)]
[CodeGen] Fix warnings in getVectorElementCount()

In EVT::getVectorElementCount() when the type is not simple we
should return getExtendedVectorElementCount() from the function
instead of constructing the ElementCount object manually.

I discovered this warning in an existing test:

  test/CodeGen/AArch64/sve-intrinsics-loads.ll

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

4 years ago[SVE] Add checks for no warnings in SVE tests
David Sherwood [Thu, 28 May 2020 10:29:26 +0000 (11:29 +0100)]
[SVE] Add checks for no warnings in SVE tests

There are now quite a few SVE tests in LLVM and Clang that do not
emit warnings related to invalid use of EVT::getVectorNumElements()
and VectorType::getNumElements(). For these tests I have added
additional checks that there are no warnings in order to prevent
any future regressions.

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

4 years ago[AST] Move the "fallback to recovery expr" mechanism to CorrectDelayedTyposInExpr...
Haojian Wu [Fri, 5 Jun 2020 14:48:32 +0000 (16:48 +0200)]
[AST] Move the "fallback to recovery expr" mechanism to CorrectDelayedTyposInExpr, NFC

Summary: Also delete two overloads, which don't seem necessary.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[flang] AMAX0, MIN1... rewrite to MAX/MIN: make result conversion explicit
Jean Perier [Thu, 18 Jun 2020 05:46:19 +0000 (07:46 +0200)]
[flang] AMAX0, MIN1... rewrite to MAX/MIN: make result conversion explicit

Summary:
This patch changes speficic extremum functions rewrite to generic MIN/MAX.
It applies to AMAX0, AMIN0, AMAX1, AMIN1, MAX0, MIN0, MAX1, MIN1, DMAX1,
and DMIN1.

- Do not re-write specific extremums to MAX/MIN in intrinsic Probe and let
folding rewrite it and introduc the conversion on the MIN/MAX result.
- Also make operand promotion explicit in MIN/MAX folding.

For instance, after this patch:
AMAX0(int8, int4) is rewritten to REAL(MAX(int8, INT(int4, 8)))

All this care is to avoid rewritting it to MAX(REAL(int8), REAL(int4))
that may not always be numerically equivalent to the first rewrite.

Reviewers: klausler, schweitz, sscalpone, jdoerfert, DavidTruby

Reviewed By: klausler, schweitz

Subscribers: llvm-commits, flang-commits

Tags: #flang, #llvm

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

4 years ago[IndirectThunks] Tiny comment fix
Kristof Beyls [Thu, 18 Jun 2020 05:50:30 +0000 (06:50 +0100)]
[IndirectThunks] Tiny comment fix

4 years ago[IndirectThunks] Make generated MF structure as expected by all instruction selectors.
Kristof Beyls [Thu, 11 Jun 2020 18:28:47 +0000 (19:28 +0100)]
[IndirectThunks] Make generated MF structure as expected by all instruction selectors.

This also enables running the AArch64 SLSHardening pass with GlobalISel,
so add a test for that.

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

4 years ago[AArch64] SLSHardening: compute correct thunk name for X29.
Kristof Beyls [Wed, 17 Jun 2020 09:12:40 +0000 (10:12 +0100)]
[AArch64] SLSHardening: compute correct thunk name for X29.

The enum values for AArch64 registers are not all consecutive.
Therefore, the computation
  "__llvm_slsblr_thunk_x" + utostr(Reg - AArch64::X0)
is not always correct. utostr(Reg - AArch64::X0) will not generate the
expected string for the registers that do not have consecutive values in
the enum.
This happened to work for most registers, but does not for AArch64::FP
(i.e. register X29).
This can get triggered when the X29 is not used as a frame pointer.

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

4 years ago[Test] Add more tests showing missing opportunities in Select instcombine
Max Kazantsev [Thu, 18 Jun 2020 05:32:55 +0000 (12:32 +0700)]
[Test] Add more tests showing missing opportunities in Select instcombine

4 years ago[DWARFYAML][debug_abbrev] Make the abbreviation code optional.
Xing GUO [Thu, 18 Jun 2020 05:02:08 +0000 (13:02 +0800)]
[DWARFYAML][debug_abbrev] Make the abbreviation code optional.

This patch helps make the `Code` optional in abbreviations table.

Reviewed By: jhenderson

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

4 years ago[MLIR] Move SymbolOpInterface::isPublic() and friends to SymbolOpInterface Trait.
Rahul Joshi [Wed, 17 Jun 2020 22:51:49 +0000 (15:51 -0700)]
[MLIR] Move SymbolOpInterface::isPublic() and friends to SymbolOpInterface Trait.

- This will allow calling these functions from Op's that support this interface (like FuncOp) directly:

```
FuncOp func = ...
 func.isPrivate()
```

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

4 years ago[lld-macho] Add missing search-paths-darwin.test
Greg McGary [Thu, 18 Jun 2020 03:49:46 +0000 (20:49 -0700)]
[lld-macho] Add missing search-paths-darwin.test

Summary: Forgot to `git add` it when patching D80677

4 years ago[lld-macho] Handle framework search path, alongside library search path
Greg McGary [Thu, 18 Jun 2020 02:59:27 +0000 (19:59 -0700)]
[lld-macho] Handle framework search path, alongside library search path

Summary:
Add front-end support for `lld::macho::Configuration::frameworkSearchPath`.

Depends on D80582.

Reviewers: ruiu, pcc, MaskRay, smeenai, int3, Ktwu, alexshap, christylee

Reviewed By: int3

Subscribers: ormris, llvm-commits

Tags: #llvm

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

4 years ago[lld-macho] Handle alignment correctly when merging InputSections
Jez Ng [Sun, 14 Jun 2020 03:06:29 +0000 (20:06 -0700)]
[lld-macho] Handle alignment correctly when merging InputSections

Summary:
Previously, we weren't updating isecAddr when aligning InputSections,
resulting in truncated sections under the right conditions.

Reviewers: #lld-macho, compnerd

Reviewed By: #lld-macho, compnerd

Subscribers: smeenai, compnerd, llvm-commits

Tags: #llvm

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

4 years ago[lld-macho] Ensure __bss sections we output have file offset of zero
Jez Ng [Sun, 14 Jun 2020 03:00:36 +0000 (20:00 -0700)]
[lld-macho] Ensure __bss sections we output have file offset of zero

Summary:
llvm-mc emits `__bss` sections with an offset of zero, but we weren't expecting
that in our input, so we were copying non-zero data from the start of the file and
putting it in `__bss`, with obviously undesirable runtime results. (It appears that
the kernel will copy those nonzero bytes as long as the offset is nonzero, regardless
of whether S_ZERO_FILL is set.)

I debated on whether to make a special ZeroFillSection -- separate from a
regular InputSection -- but it seemed like too much work for now. But I'm happy
to refactor if anyone feels strongly about having it as a separate class.

Depends on D80857.

Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee

Reviewed By: smeenai

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[lld-macho] Handle GOT relocations of non-dylib symbols
Jez Ng [Sun, 14 Jun 2020 03:00:06 +0000 (20:00 -0700)]
[lld-macho] Handle GOT relocations of non-dylib symbols

Summary:
Turns out this case is actually really common -- it happens whenever there's
a reference to an `extern` variable that ends up statically linked.

Depends on D80856.

Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee

Reviewed By: smeenai

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[lld-macho] Support X86_64_RELOC_GOT
Jez Ng [Sun, 14 Jun 2020 02:58:15 +0000 (19:58 -0700)]
[lld-macho] Support X86_64_RELOC_GOT

Summary:
As far as I can tell, it's identical to _GOT_LOAD. llvm-mc has the following
comment explaining why _GOT exists:

```
// x86_64 distinguishes movq foo@GOTPCREL so that the linker can
// rewrite the movq to an leaq at link time if the symbol ends up in
// the same linkage unit.
```

Depends on D80855.

Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee

Reviewed By: MaskRay, smeenai

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[lld-macho] Support non-pcrel section relocs
Jez Ng [Sun, 14 Jun 2020 02:56:04 +0000 (19:56 -0700)]
[lld-macho] Support non-pcrel section relocs

Summary: Depends on D80854.

Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[lld-macho] Avoid explicit -arch in tests by defaulting to x86-64
Jez Ng [Wed, 17 Jun 2020 00:52:45 +0000 (17:52 -0700)]
[lld-macho] Avoid explicit -arch in tests by defaulting to x86-64

Summary:
As mentioned in https://reviews.llvm.org/D81326#2093931, I'm not sure it
makes sense to use the default target triple to determine -arch.
Long-term we should probably detect it from the input object files, but
in the meantime it would be nice not to have to add it to all our tests
by using a convenient default.

Reviewers: #lld-macho

Subscribers: arphaman, llvm-commits

Tags: #llvm

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

4 years agoRemove "unused" member ModuleSlice from `struct OpenMPOpt`
Mehdi Amini [Wed, 17 Jun 2020 17:22:54 +0000 (17:22 +0000)]
Remove "unused" member ModuleSlice from `struct OpenMPOpt`

This is fixing warning from clang:

 warning: private field 'ModuleSlice' is not used [-Wunused-private-field]
  SmallPtrSetImpl<Function *> &ModuleSlice;
                               ^

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

4 years ago[PowerPC] Don't convert Loop to CTR Loop for fp128 BinaryOperator
Kang Zhang [Thu, 18 Jun 2020 02:54:19 +0000 (02:54 +0000)]
[PowerPC] Don't convert Loop to CTR Loop for fp128 BinaryOperator

Summary:
For PPC BinaryOperator of fp128 will become libcall, we shouldn't
convert loop to CTR loop if the loop contain libCall.

But currently, in the PPCTTIImpl::mightUseCTR() function, we only deal
with BinaryOperator for ppc_fp128, don't deal with the fp128.

Reviewed By: shchenz

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

4 years ago[ObjectYAML][ELF] Add support for emitting the .debug_abbrev section.
Xing GUO [Wed, 17 Jun 2020 08:10:58 +0000 (16:10 +0800)]
[ObjectYAML][ELF] Add support for emitting the .debug_abbrev section.

This patch enables yaml2elf emit the .debug_abbrev section.

The generated .debug_abbrev is verified using `llvm-dwarfdump`.

Known issues that will be addressed later:
- Current implementation doesn't support generating multiple abbreviation tables in one .debug_abbrev section.

Reviewed By: jhenderson, grimar

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

4 years ago[PowerPC] Custom lower rotl v1i128 to vector_shuffle.
Esme-Yi [Thu, 18 Jun 2020 01:32:23 +0000 (01:32 +0000)]
[PowerPC] Custom lower rotl v1i128 to vector_shuffle.

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. We have MatchRotate to handle an ‘or’ of two operands and generate a rot[lr] if the case matches the idiom of rotate. While PPC doesn’t support ROTL v1i128. We can custom lower ROTL v1i128 to the vector_shuffle. The vector_shuffle will be matched to a single HW instruction during the phase of instruction selection.

Reviewed By: steven.zhang

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

4 years ago[ELF] Improve --export-dynamic-symbol performance by checking whether wildcard is...
Fangrui Song [Thu, 18 Jun 2020 00:11:38 +0000 (17:11 -0700)]
[ELF] Improve --export-dynamic-symbol performance by checking whether wildcard is really used

A hasWildcard pattern iterates over symVector, which can be slow when there
are many --export-dynamic-symbol. In optimistic cases, most patterns don't use
a wildcard character. hasWildcard: false can avoid a symbol table iteration.

While here, add two tests using `[` and `?`, respectively.

4 years ago[WebAssembly] MC: Fix for data aliases with offsets (getelementptr)
Sam Clegg [Wed, 29 Apr 2020 22:38:11 +0000 (15:38 -0700)]
[WebAssembly] MC: Fix for data aliases with offsets (getelementptr)

For some reason we hadn't seen such cases in the wild which makes
me think that clang and rustc don't generate these.  In the bug which
reproduces it only occurs with LTO so my guess is that some LTO pass
is creating this alias + gep.

See: https://github.com/emscripten-core/emscripten/issues/8731

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

4 years ago[Driver] Search computed sysroot for libc++ header paths
Ryan Prichard [Thu, 11 Jun 2020 00:08:04 +0000 (17:08 -0700)]
[Driver] Search computed sysroot for libc++ header paths

Summary:
The Android NDK's clang driver is used with an Android -target setting,
and the driver automatically finds the Android sysroot at a path
relative to the driver. The sysroot has the libc++ headers in it.

Remove Hurd::computeSysRoot as it is equivalent to the new
ToolChain::computeSysRoot method.

Fixes PR46213.

Reviewers: srhines, danalbert, #libc, kristina

Reviewed By: srhines, danalbert

Subscribers: ldionne, sthibaul, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits

Tags: #clang

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

4 years agoAMDGPU: Don't use 16-bit FP inline constants in integer operands
Matt Arsenault [Sun, 14 Jun 2020 17:09:02 +0000 (13:09 -0400)]
AMDGPU: Don't use 16-bit FP inline constants in integer operands

It seems to be a hardware defect that the half inline constants do not
work as expected for the 16-bit integer operations (the inverse does
work correctly). Experimentation seems to show these are really
reading the 32-bit inline constants, which can be observed by writing
inline asm using op_sel to see what's in the high half of the
constant. Theoretically we could fold the high halves of the 32-bit
constants using op_sel.

The *_asm_all.s MC tests are broken, and I don't know where the script
to autogenerate these are. I started manually fixing it, but there's
just too many cases to fix. This also does break the
assembler/disassembler support for these values, and I'm not sure what
to do about it. These are still valid encodings, so it seems like you
should be able to use them in some way. If you wrote assembly using
them, you could have really meant it (perhaps to read the high bits
with op_sel?). The disassembler will print the invalid literal
constant which will fail to re-assemble. The behavior is also
different depending on the use context. Consider this example, which
was previously accepted and encoded using the inline constant:

  v_mad_i16 v5, v1, -4.0, v3
  ; encoding: [0x05,0x00,0xec,0xd1,0x01,0xef,0x0d,0x04]

In contexts where an inline immediate is required (such as on gfx8/9),
this will now be rejected. For gfx10, this will produce the literal
encoding and change the printed format:
  v_mad_i16 v5, v1, 0xc400, v3
  ; encoding: [0x05,0x00,0x5e,0xd7,0x01,0xff,0x0d,0x04,0x00,0xc4,0x00,0x00]

This is just another variation of the issue that we don't perfectly
handle round trip assembly/disassembly due to not tracking how
immediates were encoded. This doesn't matter much in practice, since
compilers don't emit the suboptimal encoding. I doubt any users are
relying on this behavior (although I did make use of the old behavior
to figure out what was wrong).

Fixes bug 46302.

4 years agoRevert "When performing a substitution into a dependent alias template, mark the"
Richard Smith [Wed, 17 Jun 2020 23:07:58 +0000 (16:07 -0700)]
Revert "When performing a substitution into a dependent alias template, mark the"

This change depends on reverted change c7fbe2191b8b9cd64570ed3906d1bed1dd5fff8e.

This reverts commit c851d6cf4a4ab803d01d0059f4659f4f9f4435ea.

4 years agoRevert "Fix rejects-valid when referencing an implicit operator== from within a"
Richard Smith [Wed, 17 Jun 2020 23:05:04 +0000 (16:05 -0700)]
Revert "Fix rejects-valid when referencing an implicit operator== from within a"

This change may have caused some self-host failures. Reverting while
investigating.

This reverts commit c7fbe2191b8b9cd64570ed3906d1bed1dd5fff8e.

4 years ago[flang] More Fortran runtime support for CHARACTER operations
peter klausler [Wed, 17 Jun 2020 20:17:24 +0000 (13:17 -0700)]
[flang] More Fortran runtime support for CHARACTER operations

Summary:
- Remove C++ library dependence from lock.h
- Implement LEN_TRIM, REPEAT, ADJUSTL, ADJUSTR, MAX/MIN
  intrinsic functions for CHARACTER

Reviewers: tskeith, PeteSteinfeld, sscalpone, schweitz, DavidTruby

Reviewed By: PeteSteinfeld

Subscribers: llvm-commits, flang-commits

Tags: #flang, #llvm

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

4 years ago[mlir][Inliner] Properly handle callgraph node deletion
River Riddle [Wed, 17 Jun 2020 20:13:48 +0000 (13:13 -0700)]
[mlir][Inliner] Properly handle callgraph node deletion

We previously weren't properly updating the SCC iterator when nodes were removed, leading to asan failures in certain situations. This commit adds a CallGraphSCC class and defers operation deletion until inlining has finished.

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

4 years ago[mlir][spirv] Add MatrixTimesScalar operation
HazemAbdelhafez [Tue, 16 Jun 2020 01:50:18 +0000 (21:50 -0400)]
[mlir][spirv] Add MatrixTimesScalar operation

Summary:
- Define the MatrixTimesScalar operation and add roundtrip tests.
- Added a new base class for matrix-specific operations to avoid invalid operands type mismatch check.
- Created a separate Matrix arithmetic operations td file to add more operations in the future.
- Augmented the automatically generated verify method to print more fine-grained error messages.
- Made minor Updates to the matrix type tests.

Reviewers: antiagainst, rriddle, mravishankar

Reviewed By: antiagainst

Subscribers: mehdi_amini, jpienaar, shauheen, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, bader, grosul1, frgossen, Kayjukh, jurahul, msifontes

Tags: #mlir

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

4 years ago[CUDA] make the test more hermetic
Artem Belevich [Wed, 17 Jun 2020 22:20:46 +0000 (15:20 -0700)]
[CUDA] make the test more hermetic

Otherwise the -Werror tests fail if the locally installed CUDA version found by
the driver is newer than 10.1 and produces a warning.

4 years ago[clang-format] NFC 3% improvement in the overall clang-formatted status
mydeveloperday [Wed, 17 Jun 2020 22:14:32 +0000 (23:14 +0100)]
[clang-format] NFC 3% improvement in the overall clang-formatted status

Update Clang-Formatted Formatted status

4 years ago[BPF] fix a bug for BTF pointee type pruning
Yonghong Song [Wed, 17 Jun 2020 17:13:00 +0000 (10:13 -0700)]
[BPF] fix a bug for BTF pointee type pruning

In BTF, pointee type pruning is used to reduce cluttering
too many unused types into prog BTF. For example,
   struct task_struct {
      ...
      struct mm_struct *mm;
      ...
   }
If bpf program does not access members of "struct mm_struct",
there is no need to bring types for "struct mm_struct" to BTF.

This patch fixed a bug where an incorrect pruning happened.
The test case like below:
    struct t;
    typedef struct t _t;
    struct s1 { _t *c; };
    int test1(struct s1 *arg) { ... }

    struct t { int a; int b; };
    struct s2 { _t c; }
    int test2(struct s2 *arg) { ... }

After processing test1(), among others, BPF backend generates BTF types for
    "struct s1", "_t" and a placeholder for "struct t".
Note that "struct t" is not really generated. If later a direct access
to "struct t" member happened, "struct t" BTF type will be generated
properly.

During processing test2(), when processing member type "_t c",
BPF backend sees type "_t" already generated, so returned.
This caused the problem that "struct t" BTF type is never generated and
eventually causing incorrect type definition for "struct s2".

To fix the issue, during DebugInfo type traversal, even if a
typedef/const/volatile/restrict derived type has been recorded in BTF,
if it is not a type pruning candidate, type traversal of its base type continues.

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

4 years agoWhen performing a substitution into a dependent alias template, mark the
Richard Smith [Wed, 17 Jun 2020 21:49:03 +0000 (14:49 -0700)]
When performing a substitution into a dependent alias template, mark the
outer levels as retained rather than omitting their arguments.

This better reflects what's going on (we're performing a substitution
while still inside a template). In theory this is also more correct, but
I've not found a testcase where it matters in practice (largely because
we don't allow alias templates to be declared inside a function).

4 years agoFix rejects-valid when referencing an implicit operator== from within a
Richard Smith [Wed, 17 Jun 2020 21:06:11 +0000 (14:06 -0700)]
Fix rejects-valid when referencing an implicit operator== from within a
templated class.

When a defaulted operator<=> results in the injection of a defaulted
operator==, that operator== can be named by unqualified name within the
same class, even if the class is templated. To make this work, perform
the transform from defaulted operator<=> to defaulted operator== in the
template definition context instead of the template instantiation
context.

This results in our substituting into a declaration from a context where
we don't have a full list of template arguments (or indeed any), for
which we are now more careful to not spuriously instantiate declarations
that are not dependent on the arguments we're substituting.

4 years ago[MLIR][SPIRVToLLVM] Support cast ops, some logical ops, UModOp
George Mitenkov [Wed, 17 Jun 2020 21:42:27 +0000 (17:42 -0400)]
[MLIR][SPIRVToLLVM] Support cast ops, some logical ops, UModOp

Added support of simple logical ops: `LogicalAnd`, `LogicalOr`,
`LogicalEqual` and `LogicalNotEqual`. Added a missing conversion
for `UMod` op.

Also, implemented SPIR-V cast ops conversion. There are 4 simple
case where there is a clear equivalent in LLVM (e.g. `ConvertFToS`
is `fptosi`). For `FConvert`, `SConvert` and `UConvert` we
distinguish between truncation and extension based on the bit
width of the operand.

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

4 years agoRevert "Remove unused class variable ModuleSlice." as it was
Eric Christopher [Wed, 17 Jun 2020 21:45:17 +0000 (14:45 -0700)]
Revert "Remove unused class variable ModuleSlice." as it was
used in debug only code.

This reverts commit 07a1749081bac07515d357fd96165662031de527.

4 years ago[flang] Fix fallout from varous changes to the cmake files.
Eric Schweitz [Wed, 17 Jun 2020 20:09:07 +0000 (13:09 -0700)]
[flang] Fix fallout from varous changes to the cmake files.

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

4 years agoRemove unused class variable ModuleSlice.
Eric Christopher [Wed, 17 Jun 2020 19:31:42 +0000 (12:31 -0700)]
Remove unused class variable ModuleSlice.

4 years ago[MLIR] Fix parallel loop tiling.
Stephan Herhut [Wed, 17 Jun 2020 14:22:07 +0000 (16:22 +0200)]
[MLIR] Fix parallel loop tiling.

Summary:
Parallel loop tiling did not properly compute the updated loop
indices when tiling, which lead to wrong results.

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

4 years ago[SVE] Eliminate bad VectorType::getNumElements() calls from ConstantFold
Christopher Tetreault [Wed, 17 Jun 2020 21:12:48 +0000 (14:12 -0700)]
[SVE] Eliminate bad VectorType::getNumElements() calls from ConstantFold

Summary:
Assume all usages of this function are explicitly fixed-width operations
and cast to FixedVectorType

Reviewers: efriedma, sdesmalen, c-rhodes, majnemer, dblaikie

Reviewed By: sdesmalen

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

Tags: #llvm

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

4 years ago[SVE] Fix invalid usages of getNumElements in ShuffleVectorInstruction
Christopher Tetreault [Wed, 17 Jun 2020 19:30:44 +0000 (12:30 -0700)]
[SVE] Fix invalid usages of getNumElements in ShuffleVectorInstruction

Summary:
Fix invalid usages of getNumElements identified by test case
LLVM.Transforms/InstCombine::vscale_extractelement.ll.

changesLength: Since the length of the llvm::SmallVector shufflemask
is related to the minimum number of elements in a scalable vector, it is
fine to just get the Min field of the ElementCount

isIdentityWithExtract: Since it is not possible to express the mask
needed for this pattern for scalable vectors, we can just bail before
calling getNumElements()

Reviewers: efriedma, sdesmalen, fpetrogalli, gchatelet, yrouban, craig.topper

Reviewed By: sdesmalen

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

Tags: #llvm

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

4 years ago[NFC] Use llvm::hasSingleElement() in place of .size() == 1
Rahul Joshi [Wed, 17 Jun 2020 20:20:36 +0000 (13:20 -0700)]
[NFC] Use llvm::hasSingleElement() in place of .size() == 1

- Also use functions in Region instead of Region::getBlocks() where possible.

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

4 years agoRemove code duplication from RegisterContextPOSIX_*
Muhammad Omair Javaid [Wed, 17 Jun 2020 19:59:27 +0000 (00:59 +0500)]
Remove code duplication from RegisterContextPOSIX_*

Summary:
This patch aims to remove multiple copies of GetByteOrder() and ConvertRegisterKindToRegisterNumber used in various versions of RegisterContextPOSIX_*.

Both register implementations are move to RegisterContext class which is parent of RegisterContextPOSIX_* classes.

Built and tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabihf targets.

Reviewers: labath

Reviewed By: labath

Subscribers: wuzish, nemanjai, kristof.beyls, kbarton, atanasyan, lldb-commits

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

4 years ago[NFC] Silence compiler warning [-Wmissing-braces].
Huihui Zhang [Wed, 17 Jun 2020 19:53:49 +0000 (12:53 -0700)]
[NFC] Silence compiler warning [-Wmissing-braces].

clang/lib/CodeGen/CGNonTrivialStruct.cpp:330:7: warning: suggest braces around initialization of subobject [-Wmissing-braces]
  Address(CGF->Builder.CreateLoad(CGF->GetAddrOfLocalVar(Args[Ints])),
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  {

4 years ago[Driver] Delete CC1 -fxray-function-index and clean up some tests
Fangrui Song [Wed, 17 Jun 2020 19:59:02 +0000 (12:59 -0700)]
[Driver] Delete CC1 -fxray-function-index and clean up some tests