platform/upstream/llvm.git
5 years ago[x86] fold vperm2x128 to concat of 128-bit high half vectors
Sanjay Patel [Wed, 22 Jan 2020 19:48:28 +0000 (14:48 -0500)]
[x86] fold vperm2x128 to concat of 128-bit high half vectors

vperm (ins ?, X, C), (ins ?, Y, C), 0x31 --> concat X, Y

This is another shuffle problem seen with PR42024:
https://bugs.llvm.org/show_bug.cgi?id=42024

We have this small crack in legalization/lowering/combining/demanded
that allows forming a vperm2f128 of high halves with AVX1 when we
could do better by peeking through the insert_subvector nodes.
AFAICT, it requires IR as shown in the diffs - much larger than legal
vectors - to avoid all of the usual folds.

Another option would prevent forming the 256-bit vperm in lowering.

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

5 years ago[SVE] Pass Scalable argument to VectorType::get in Bitcode Reader
Chris Tetreault [Wed, 22 Jan 2020 19:50:10 +0000 (11:50 -0800)]
[SVE] Pass Scalable argument to VectorType::get in Bitcode Reader

Pass the Scalability test to VectorType::get in order to be able to
deserialize bitcode that contains scalable vector operations

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

5 years agoExtend misc-misplaced-const to detect using declarations as well as typedef
Alexander Lanin [Wed, 22 Jan 2020 20:26:11 +0000 (15:26 -0500)]
Extend misc-misplaced-const to detect using declarations as well as typedef

5 years agoAdd a bit of documentation on attribute spellings that were missing.
Aaron Ballman [Wed, 22 Jan 2020 20:21:43 +0000 (15:21 -0500)]
Add a bit of documentation on attribute spellings that were missing.

5 years ago[LoopDeletion] Teach LoopDeletion to preserve MemorySSA if available.
Alina Sbirlea [Wed, 22 Jan 2020 00:56:39 +0000 (16:56 -0800)]
[LoopDeletion] Teach LoopDeletion to preserve MemorySSA if available.

If MemorySSA analysis is analysis, LoopDeletion now preserves it.

5 years ago[mlir] Add baseAttr to TypedArrayAttrBase.
Abdurrahman Akkas [Wed, 22 Jan 2020 19:35:12 +0000 (19:35 +0000)]
[mlir] Add baseAttr to TypedArrayAttrBase.

Element type is useful in code generators but it is lost after construction.

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

5 years agoAMDGPU/R600: Emit rodata in text segment
Jan Vesely [Sun, 19 Jan 2020 05:29:30 +0000 (00:29 -0500)]
AMDGPU/R600: Emit rodata in text segment

R600 relies on this behaviour.
Fixes: 6e18266aa4dd78953557b8614cb9ff260bad7c65 ('Partially revert D61491 "AMDGPU: Be explicit about whether the high-word in SI_PC_ADD_REL_OFFSET is 0"')
Fixes ~100 piglit regressions since 6e18266

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

5 years agoAdd LLVM_VALUE_FUNCTION to Optional::map(); NFC
Aaron Ballman [Wed, 22 Jan 2020 19:20:15 +0000 (14:20 -0500)]
Add LLVM_VALUE_FUNCTION to Optional::map(); NFC

This is for future-proofing when compiling with MSVC once we drop support for 2017.

5 years ago[gn build] reformat all build files again
Nico Weber [Wed, 22 Jan 2020 19:04:06 +0000 (14:04 -0500)]
[gn build] reformat all build files again

Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
after recent fixes to formatting of comments after single-element
lists.

5 years ago[Concepts] Fix bug when referencing function parameters in instantiated function...
Saar Raz [Wed, 22 Jan 2020 18:43:38 +0000 (20:43 +0200)]
[Concepts] Fix bug when referencing function parameters in instantiated function template requires clause

Fixes bug #44613 - incorrect instantiated parameters were being added when checking instantiated function constraints

5 years agoAdd a comment about when we can remove this construct; NFC.
Aaron Ballman [Wed, 22 Jan 2020 18:16:19 +0000 (13:16 -0500)]
Add a comment about when we can remove this construct; NFC.

5 years ago[CMake][Fuchsia] Disable in-process cc1
Petr Hosek [Wed, 22 Jan 2020 18:09:27 +0000 (10:09 -0800)]
[CMake][Fuchsia] Disable in-process cc1

The in-process cc1 currently breaks Goma client and therefore prevents
the use of tip-of-tree Clang with Goma, so we disable the in-process cc1
in our toolchain until this issue is resolved.

5 years ago[X86][SSE] combineExtractWithShuffle - extract(bitcast(broadcast(x))) --> x
Simon Pilgrim [Wed, 22 Jan 2020 17:23:56 +0000 (17:23 +0000)]
[X86][SSE] combineExtractWithShuffle - extract(bitcast(broadcast(x))) --> x

Removes some unnecessary gpr<-->fpu traffic

5 years ago[ARM] Mark MVE loads/store as not having side effects
David Green [Wed, 22 Jan 2020 15:59:33 +0000 (15:59 +0000)]
[ARM] Mark MVE loads/store as not having side effects

The hasSideEffect parameter is usually automatically inferred from
instruction patterns. For some of our MVE instructions, we do not have
patterns though, such as for the pre/post inc loads and stores. This
instead specifies the flag manually on the base MVE_VLDRSTR_base
tablegen class, making sure we get this correct.

This can help with scheduling multiple loads more optimally. Here I've
added a unittest as a more direct form of testing.

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

5 years agoRevert "[DA][TTI][AMDGPU] Add option to select GPUDA with TTI"
Nico Weber [Wed, 22 Jan 2020 17:56:19 +0000 (12:56 -0500)]
Revert "[DA][TTI][AMDGPU] Add option to select GPUDA with TTI"

This reverts commit a90a6502ab35d3c15c7d56772e409c5632ce6cfb.
Broke tests on Windows: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/13808

5 years agoRevert "[gn build] [win] produce symbolized stack frames in release builds too"
Nico Weber [Wed, 22 Jan 2020 17:54:19 +0000 (12:54 -0500)]
Revert "[gn build] [win] produce symbolized stack frames in release builds too"

This reverts commit fd98eccf984f203e39452da238a142f83f61d368.
Seems to have no effect, need to try it locally for a bit first.

5 years ago[Flang] add some cmake code to allow for out-of-tree building of MLIR and LLVM
Mehdi Amini [Wed, 22 Jan 2020 00:44:17 +0000 (00:44 +0000)]
[Flang] add some cmake code to allow for out-of-tree building of MLIR and LLVM

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

5 years ago[scudo][standalone] Reduce Android region sizes to 128MB
Kostya Kortchinsky [Tue, 21 Jan 2020 22:38:30 +0000 (14:38 -0800)]
[scudo][standalone] Reduce Android region sizes to 128MB

Summary:
Unity is making irresponsible assumptions as to how clumped up memory
should be. With larger regions, we break those, resulting in errors
like:

"Using memoryadresses from more that 16GB of memory"

This is unfortunately one of those situations where we have to bend to
existing code because we doubt it's going to change any time soon.

128MB should be enough, but we could be flirting with OOMs in the
higher class sizes.

Reviewers: cferris, eugenis, hctim, morehouse, pcc

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

5 years agoRevert "Unconditionally enable lvalue function designators; NFC"
Aaron Ballman [Wed, 22 Jan 2020 17:36:48 +0000 (12:36 -0500)]
Revert "Unconditionally enable lvalue function designators; NFC"

This reverts commit 968561bcdc34c7d74482fe3bb69a045abf08d2c1

5 years ago[gn build] [win] produce symbolized stack frames in release builds too
Nico Weber [Wed, 22 Jan 2020 17:36:38 +0000 (12:36 -0500)]
[gn build] [win] produce symbolized stack frames in release builds too

5 years ago[AArch64] Don't rename registers with pseudo defs in Ld/St opt.
Florian Hahn [Wed, 22 Jan 2020 17:16:40 +0000 (09:16 -0800)]
[AArch64] Don't rename registers with pseudo defs in Ld/St opt.

If the root def of for renaming is a noop-pseudo instruction like kill,
we would end up without a correct def for the renamed register, causing
miscompiles.

This patch conservatively bails out on any pseudo instruction.

This fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1037912#c70

5 years agoAMDGPU/GlobalISel: Handle 16-bank LDS llvm.amdgcn.interp.p1.f16
Matt Arsenault [Sun, 12 Jan 2020 17:32:03 +0000 (12:32 -0500)]
AMDGPU/GlobalISel: Handle 16-bank LDS llvm.amdgcn.interp.p1.f16

The pattern is also mishandled by the generated matcher, so workaround
this as in the DAG path.

The existing DAG tests aren't particularly targeted to just this one
intrinsic. These also end up differing in scheduling from SGPR->VGPR
operand constraint copies.

5 years ago[NFC][XCOFF] Refactor Csect creation into TargetLoweringObjectFile
David Tenty [Wed, 22 Jan 2020 16:09:34 +0000 (11:09 -0500)]
[NFC][XCOFF] Refactor Csect creation into TargetLoweringObjectFile

Summary:
We create a number of standard types of control sections in multiple places for
things like the function descriptors, external references and the TOC anchor
among others, so it is possible for  their properties to be defined
inconsistently in different places. This refactor moves their creation and
properties into functions in the TargetLoweringObjectFile class hierarchy, where
functions for retrieving various special types of sections typically seem
to reside.

Note: There is one case in PPCISelLowering which is specific to function entry
points which we don't address since we don't have access to the TLOF there.

Reviewers: DiggerLin, jasonliu, hubert.reinterpretcast

Reviewed By: jasonliu, hubert.reinterpretcast

Subscribers: wuzish, nemanjai, hiraditya, kbarton, jsji, llvm-commits

Tags: #llvm

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

5 years agoPrecommit NFC part of DAGCombiner change. NFC.
Stanislav Mekhanoshin [Wed, 22 Jan 2020 17:01:22 +0000 (09:01 -0800)]
Precommit NFC part of DAGCombiner change. NFC.

This is NFC part of DAGCombiner::visitEXTRACT_SUBVECTOR()
change in the D73132.

5 years agoRegenerate test/CodeGen/ARM/vext.ll. NFC.
Stanislav Mekhanoshin [Wed, 22 Jan 2020 16:48:54 +0000 (08:48 -0800)]
Regenerate test/CodeGen/ARM/vext.ll. NFC.

This is to pre-commit whitespace only changes before D73132.

5 years agoAMDGPU/GlobalISel: Select llvm.amdgcn.mov.dpp
Matt Arsenault [Fri, 17 Jan 2020 15:49:26 +0000 (10:49 -0500)]
AMDGPU/GlobalISel: Select llvm.amdgcn.mov.dpp

This is deprecated, but easy to support.

5 years agoAMDGPU/GlobalISel: Select llvm.amdgcn.mov.dpp8
Matt Arsenault [Fri, 17 Jan 2020 15:02:57 +0000 (10:02 -0500)]
AMDGPU/GlobalISel: Select llvm.amdgcn.mov.dpp8

5 years ago[PGO][PGSO] Update BFI in CodeGenPrepare::optimizeSelectInst.
Hiroshi Yamauchi [Tue, 21 Jan 2020 23:49:04 +0000 (15:49 -0800)]
[PGO][PGSO] Update BFI in CodeGenPrepare::optimizeSelectInst.

Summary:
Without the BFI update, some hot blocks are incorrectly treated as cold code.

This fixes a FDO perf regression in the TSVC benchmark from D71288.

Reviewers: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

5 years ago[AArch64] Add test for DWARF return address signing
Pablo Barrio [Thu, 16 Jan 2020 11:47:37 +0000 (11:47 +0000)]
[AArch64] Add test for DWARF return address signing

Summary: Patch by LukeCheeseman and pbarrio

Reviewers: samparker, chill

Subscribers: kristof.beyls, llvm-commits

Tags: #llvm

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

5 years agoAMDGPU: Fix element size assertion
Matt Arsenault [Wed, 22 Jan 2020 16:18:45 +0000 (11:18 -0500)]
AMDGPU: Fix element size assertion

The GlobalISel usage called this with bits, but the DAG usage was
incorrectly using bytes.

5 years agoAMDGPU/GlobalISel: Keep G_BITCAST out of waterfall loop
Matt Arsenault [Sat, 4 Jan 2020 16:48:00 +0000 (11:48 -0500)]
AMDGPU/GlobalISel: Keep G_BITCAST out of waterfall loop

The waterfall utility function blindly inserts a phi for every def in
the loop. We don't need this one to be preserved for every
iteration. Saves an extra phi and copy inside the loop body.

5 years ago[RISCV] Support ABI checking with per function target-features
Zakk Chen [Fri, 29 Nov 2019 02:00:54 +0000 (18:00 -0800)]
[RISCV] Support ABI checking with per function target-features

1. if users don't specific -mattr, the default target-feature come
from IR attribute.
2. fixed bug and re-land this patch

Reviewers: lenary, asb

Reviewed By: lenary

Tags: #llvm

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

5 years ago[X86][SSE] combineExtractWithShuffle - extract(bictcast(scalar_to_vector(x))) --> x
Simon Pilgrim [Wed, 22 Jan 2020 15:47:59 +0000 (15:47 +0000)]
[X86][SSE] combineExtractWithShuffle - extract(bictcast(scalar_to_vector(x))) --> x

Removes some unnecessary gpr<-->fpu traffic

5 years agoAMDGPU/GlobalISel: Fold add of constant into G_INSERT_VECTOR_ELT
Matt Arsenault [Sat, 4 Jan 2020 04:13:15 +0000 (23:13 -0500)]
AMDGPU/GlobalISel: Fold add of constant into G_INSERT_VECTOR_ELT

Move the subregister base like in the extract case.

5 years ago[gn build] (manually) port a174f0da62f
Nico Weber [Wed, 22 Jan 2020 16:00:44 +0000 (11:00 -0500)]
[gn build] (manually) port a174f0da62f

5 years ago[compiler-rt] [builtins] Fix clear_cache_test to work with MPROTECT
Michał Górny [Sun, 12 Jan 2020 21:49:36 +0000 (22:49 +0100)]
[compiler-rt] [builtins] Fix clear_cache_test to work with MPROTECT

Fix clear_cache_test to work on NetBSD with PaX MPROTECT enabled, that
is when creating W+X mmaps is prohibited.  Use the recommended solution:
create two mappings for the same memory area, make one of them RW, while
the other RX.  Copy the function into the RW area but run it from the RX
area.

In order to implement this, I've split the pointer variables to
'write_buffer' and 'execution_buffer'.  Both are separate pointers
on NetBSD, while they have the same value on other systems.

I've also split the memcpy_f() into two: new memcpy_f() that only takes
care of copying memory and discards the (known) result of memcpy(),
and realign_f() that applies ARM realignment to the given pointer.
Again, there should be no difference on non-NetBSD systems but on NetBSD
copying is done on write_buffer, while realignment on pointer
to the execution_buffer.

I have tested this change on NetBSD and Linux.

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

5 years agoAMDGPU/GlobalISel: Select G_INSERT_VECTOR_ELT
Matt Arsenault [Fri, 3 Jan 2020 17:17:56 +0000 (12:17 -0500)]
AMDGPU/GlobalISel: Select G_INSERT_VECTOR_ELT

5 years agoAMDGPU/GlobalISel: Fix RegBankSelect for G_INSERT_VECTOR_ELT
Matt Arsenault [Sat, 4 Jan 2020 01:22:01 +0000 (20:22 -0500)]
AMDGPU/GlobalISel: Fix RegBankSelect for G_INSERT_VECTOR_ELT

The result and source vector are going to be tied, so these need to be
the same bank.

The inserted value also needs to be broken down based on the result
bank, not the inserted value itself.

5 years ago[mlir] Swap use of to_vector() with lookupValues() in LLVMIRIntrinsicGen
Marcello Maggioni [Tue, 21 Jan 2020 21:20:23 +0000 (13:20 -0800)]
[mlir] Swap use of to_vector() with lookupValues() in LLVMIRIntrinsicGen

Summary:
llvm::to_vector() accepts a Range value and not the pair of arguments
we are currently passing. Also we probably want the lowered LLVM
values in the vector, while operand_begin()/operand_end() on MLIR ops
returns MLIR types. lookupValues() seems the correct way to collect
such values.

Reviewers: rriddle, andydavis1, antiagainst, nicolasvasilache, ftynse

Subscribers: jdoerfert, mehdi_amini, jpienaar, burmako, shauheen, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits

Tags: #llvm

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

5 years agoAMDGPU/GlobalISel: Fold constant offset vector extract indexes
Matt Arsenault [Fri, 3 Jan 2020 15:07:51 +0000 (10:07 -0500)]
AMDGPU/GlobalISel: Fold constant offset vector extract indexes

Handle dynamic vector extracts that use an index that's an add of a
constant offset into moving the base subregister of the indexing
operation.

Force the add into the loop in regbankselect, which will be recognized
when selected.

5 years ago[lldb/Target] Sort CMakeLists (NFC)
Med Ismail Bennani [Wed, 22 Jan 2020 14:15:00 +0000 (15:15 +0100)]
[lldb/Target] Sort CMakeLists (NFC)

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
5 years ago[VE] select and selectcc patterns
Kazushi (Jam) Marukawa [Wed, 22 Jan 2020 15:30:35 +0000 (16:30 +0100)]
[VE] select and selectcc patterns

Summary: select and selectcc isel patterns and tests for i32/i64 and fp32/fp64.
Includes optimized selectcc patterns for fmin/fmax/maxs/mins.

Reviewed By: arsenm

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

5 years agoAMDGPU: Fix typo
Matt Arsenault [Wed, 22 Jan 2020 15:17:46 +0000 (10:17 -0500)]
AMDGPU: Fix typo

5 years agoAMDGPU: Look through casted selects to constant fold bin ops
Matt Arsenault [Tue, 21 Jan 2020 00:27:21 +0000 (19:27 -0500)]
AMDGPU: Look through casted selects to constant fold bin ops

The promotion of the uniform select to i32 interfered with this fold.

5 years agoAMDGPU: Do binop of select of constant fold in AMDGPUCodeGenPrepare
Matt Arsenault [Sun, 19 Jan 2020 18:24:47 +0000 (13:24 -0500)]
AMDGPU: Do binop of select of constant fold in AMDGPUCodeGenPrepare

DAGCombiner does this, but divisions expanded here miss this
optimization. Since 67aa18f165640374cf0e0a6226dc793bbda6e74f,
divisions have been expanded here and missed out on this
optimization. Avoids test regressions in a future patch.

5 years agoAMDGPU/GlobalISel: Add pre-legalize combiner pass
Matt Arsenault [Sun, 5 Jan 2020 17:22:21 +0000 (12:22 -0500)]
AMDGPU/GlobalISel: Add pre-legalize combiner pass

Just copy the AArch64 pass as-is for now, except for removing the
memcpy handling.

5 years agoUnconditionally enable lvalue function designators; NFC
Aaron Ballman [Wed, 22 Jan 2020 14:53:06 +0000 (09:53 -0500)]
Unconditionally enable lvalue function designators; NFC

We previously had to guard against older MSVC and GCC versions which had rvalue
references but not support for marking functions with ref qualifiers. However,
having bumped our minimum required version to MSVC 2017 and GCC 5.1 mean we can
unconditionally enable this feature. Rather than keeping the macro around, this
replaces use of the macro with the actual ref qualifier.

5 years ago[InstCombine] fneg(X + C) --> -C - X
Sanjay Patel [Wed, 22 Jan 2020 14:29:19 +0000 (09:29 -0500)]
[InstCombine] fneg(X + C) --> -C - X

This is 1 of the potential folds uncovered by extending D72521.

We don't seem to do this in the backend either (unless I'm not
seeing some target-specific transform).

icc and gcc (appears to be target-specific) do this transform.

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

5 years ago[VE] setcc isel patterns
Kazushi (Jam) Marukawa [Wed, 22 Jan 2020 14:45:42 +0000 (15:45 +0100)]
[VE] setcc isel patterns

Summary: SETCC isel patterns and tests for i32/64 and fp32/64 comparison

Reviewers: arsenm, rengolin, craig.topper, k-ishizaka

Reviewed By: arsenm

Subscribers: merge_guards_bot, wdng, hiraditya, llvm-commits

Tags: #ve, #llvm

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

5 years ago[ARM] Basic gather scatter cost model
David Green [Wed, 22 Jan 2020 13:45:16 +0000 (13:45 +0000)]
[ARM] Basic gather scatter cost model

This is a very basic MVE gather/scatter cost model, based roughly on the
code that we will currently produce. It does not handle truncating
scatters or extending gathers correctly yet, as it is difficult to tell
that they are going to be correctly extended/truncated from the limited
information in the cost function.

This can be improved as we extend support for these in the future.

Based on code originally written by David Sherwood.

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

5 years ago[ARM] MVE Gather Scatter cost model tests. NFC
David Green [Wed, 22 Jan 2020 13:44:36 +0000 (13:44 +0000)]
[ARM] MVE Gather Scatter cost model tests. NFC

5 years ago[AArch64][SVE] Add patterns for unpredicated load/store to frame-indices.
Sander de Smalen [Wed, 22 Jan 2020 10:42:57 +0000 (10:42 +0000)]
[AArch64][SVE] Add patterns for unpredicated load/store to frame-indices.

This patch also fixes up a number of cases in DAGCombine and
SelectionDAGBuilder where the size of a scalable vector is used in a
fixed-width context (thus triggering an assertion failure).

Reviewers: efriedma, c-rhodes, rovka, cameron.mcinally

Reviewed By: efriedma

Tags: #llvm

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

5 years ago[MachineScheduler] Allow clustering mem ops with complex addresses
Jay Foad [Mon, 6 Jan 2020 11:22:51 +0000 (11:22 +0000)]
[MachineScheduler] Allow clustering mem ops with complex addresses

The generic BaseMemOpClusterMutation calls into TargetInstrInfo to
analyze the address of each load/store instruction, and again to decide
whether two instructions should be clustered. Previously this had to
represent each address as a single base operand plus a constant byte
offset. This patch extends it to support any number of base operands.

The old target hook getMemOperandWithOffset is now a convenience
function for callers that are only prepared to handle a single base
operand. It calls the new more general target hook
getMemOperandsWithOffset.

The only requirements for the base operands returned by
getMemOperandsWithOffset are:
- they can be sorted by MemOpInfo::Compare, such that clusterable ops
  get sorted next to each other, and
- shouldClusterMemOps knows what they mean.

One simple follow-on is to enable clustering of AMDGPU FLAT instructions
with both vaddr and saddr (base register + offset register). I've left
a FIXME in the code for this case.

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

5 years agoAMDGPU/GlobalISel: Fix RegbankSelect for llvm.amdgcn.fmul.legacy
Matt Arsenault [Wed, 22 Jan 2020 02:35:56 +0000 (21:35 -0500)]
AMDGPU/GlobalISel: Fix RegbankSelect for llvm.amdgcn.fmul.legacy

5 years agoAMDGPU/GlobalISel: Handle atomic_inc/atomic_dec
Matt Arsenault [Sat, 18 Jan 2020 01:51:01 +0000 (20:51 -0500)]
AMDGPU/GlobalISel: Handle atomic_inc/atomic_dec

The intermediate instruction drops the extra volatile argument. We are
missing an atomic ordering on these.

5 years agoAMDGPU: Fix interaction of tfe and d16
Matt Arsenault [Fri, 17 Jan 2020 20:40:15 +0000 (15:40 -0500)]
AMDGPU: Fix interaction of tfe and d16

This using the wrong result register, and dropping the result entirely
for v2f16. This would fail to select on the scalar case. I believe it
was also mishandling packed/unpacked subtargets.

5 years ago[ASTImporter] Properly delete decls from SavedImportPaths
Jaroslav Sevcik [Wed, 22 Jan 2020 14:19:44 +0000 (15:19 +0100)]
[ASTImporter] Properly delete decls from SavedImportPaths

Summary:
We see a significant regression (~40% slower on large codebases) in expression evaluation after https://reviews.llvm.org/rL364771. A sampling profile shows the extra time is spent in SavedImportPathsTy::operator[] when called from ASTImporter::Import. I believe this is because ASTImporter::Import adds an element to the SavedImportPaths map for each decl unconditionally (see https://github.com/llvm/llvm-project/blob/7b81c3f8793d30a4285095a9b67dcfca2117916c/clang/lib/AST/ASTImporter.cpp#L8256).

To fix this, we call SavedImportPathsTy::erase on the declaration rather than clearing its value vector. That way we do not accidentally introduce new empty elements.  (With this patch the performance is restored, and we do not see SavedImportPathsTy::operator[] in the profile anymore.)

Reviewers: martong, teemperor, a.sidorin, shafik

Reviewed By: martong

Subscribers: rnkovacs, cfe-commits

Tags: #clang

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

5 years agoRevert "Extend misc-misplaced-const to detect using declarations as well as typedef"
Aaron Ballman [Wed, 22 Jan 2020 14:05:38 +0000 (09:05 -0500)]
Revert "Extend misc-misplaced-const to detect using declarations as well as typedef"

This reverts commit ecc7dae50c41bc8a129a158ecf0ae0270126505c due to breaking bots:

http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/22157
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/43297

5 years agoAMDGPU/GlobalISel: RegBankSelect interp intrinsics
Matt Arsenault [Wed, 17 Jul 2019 02:37:02 +0000 (22:37 -0400)]
AMDGPU/GlobalISel: RegBankSelect interp intrinsics

Note this assumes the future use of immediates for immarg, not the
current G_CONSTANT which will be emitted.

5 years agoAMDGPU: Fix missing immarg on llvm.amdgcn.interp.mov
Matt Arsenault [Sun, 12 Jan 2020 17:34:10 +0000 (12:34 -0500)]
AMDGPU: Fix missing immarg on llvm.amdgcn.interp.mov

The first operand maps to an immediate field, so this should be
immarg.

5 years ago[InstCombine] add tests for fneg+fadd; NFC
Sanjay Patel [Mon, 20 Jan 2020 18:32:55 +0000 (13:32 -0500)]
[InstCombine] add tests for fneg+fadd; NFC

5 years ago[SelectionDAG] getShiftAmountConstant - assert the type is an integer.
Simon Pilgrim [Wed, 22 Jan 2020 13:52:26 +0000 (13:52 +0000)]
[SelectionDAG] getShiftAmountConstant - assert the type is an integer.

5 years agoUse SelectionDAG::getShiftAmountConstant(). NFCI.
Simon Pilgrim [Wed, 22 Jan 2020 13:47:58 +0000 (13:47 +0000)]
Use SelectionDAG::getShiftAmountConstant(). NFCI.

5 years ago[llvm-mca][NFC] Regenerate tests @HEAD.
Clement Courbet [Wed, 22 Jan 2020 13:40:53 +0000 (14:40 +0100)]
[llvm-mca][NFC] Regenerate tests @HEAD.

For Zen2.

5 years agoExtend misc-misplaced-const to detect using declarations as well as typedef
Alexander Lanin [Wed, 22 Jan 2020 13:45:20 +0000 (08:45 -0500)]
Extend misc-misplaced-const to detect using declarations as well as typedef

5 years ago[mlir][spirv] Add lowering for composite std.constant.
Denis Khalikov [Wed, 22 Jan 2020 13:05:27 +0000 (08:05 -0500)]
[mlir][spirv] Add lowering for composite std.constant.

Add lowering for constant operation with ranked tensor type to
spv.constant with spv.array type.

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

5 years ago[mlir] Enable specifying verify on OpInterface
Jacques Pienaar [Tue, 21 Jan 2020 17:40:22 +0000 (09:40 -0800)]
[mlir] Enable specifying verify on OpInterface

Summary:
Add method in ODS to specify verification for operations implementing a
OpInterface. Use this with infer type op interface to verify that the
inferred type matches the return type and remove special case in
TestPatterns.

This could also have been achieved by using OpInterfaceMethod but verify
seems pretty common and it is not an arbitrary method that just happened
to be named verifyTrait, so having it be defined in special way seems
appropriate/better documenting.

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

5 years ago[X86][SSE] combineExtractWithShuffle - pull out repeated extract index code. NFCI.
Simon Pilgrim [Wed, 22 Jan 2020 12:08:41 +0000 (12:08 +0000)]
[X86][SSE] combineExtractWithShuffle - pull out repeated extract index code. NFCI.

5 years agoRemove extra ';' to fix Wpedantic. NFCI.
Simon Pilgrim [Wed, 22 Jan 2020 11:07:27 +0000 (11:07 +0000)]
Remove extra ';' to fix Wpedantic. NFCI.

5 years ago[lldb/DWARF] Remove one more auto-dwo method
Pavel Labath [Tue, 21 Jan 2020 16:04:39 +0000 (17:04 +0100)]
[lldb/DWARF] Remove one more auto-dwo method

Summary:
Our DWARFUnit was automatically forwarding the requests to the split
unit when looking for a DIE by offset. llvm::DWARFUnit does not do that,
and is not likely to start doing it any time soon.

This patch deletes the this logic and updates the callers to request the
correct unit instead. While doing that, I've found a bit of duplicated
code for lookup up a function and block by address, so I've extracted
that into a helper function.

Reviewers: JDevlieghere, aprantl, clayborg, jdoerfert

Subscribers: lldb-commits

Tags: #lldb

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

5 years ago[lld/ELF] PR44498: Support input filename in double quote
Thomas Preud'homme [Fri, 10 Jan 2020 16:56:07 +0000 (16:56 +0000)]
[lld/ELF] PR44498: Support input filename in double quote

Summary:
Linker scripts allow filenames to be put in double quotes to prevent
characters in filenames that are part of the linker script syntax from
having their special meaning. Case in point the * wildcard character.

Availability of double quoting filenames also allows to fix a failure in
ELF/linkerscript/filename-spec.s when the path contain a @ which the
lexer consider as a special characters and thus break up a filename
containing it. This may happens under Jenkins which createspath such as
pipeline@2.

To avoid the need for escaping GlobPattern metacharacters in filename
in double quotes, GlobPattern::create is augmented with a new parameter
to request literal matching instead of relying on the presence of a
wildcard character in the pattern.

Reviewers: jhenderson, MaskRay, evgeny777, espindola, alexshap

Reviewed By: MaskRay

Subscribers: peter.smith, grimar, ruiu, emaste, arichardson, hiraditya, llvm-commits

Tags: #llvm

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

5 years ago[AArch64][SVE] Add intrinsic for non-faulting loads
Kerry McLaughlin [Wed, 22 Jan 2020 10:15:40 +0000 (10:15 +0000)]
[AArch64][SVE] Add intrinsic for non-faulting loads

Summary:
This patch adds the llvm.aarch64.sve.ldnf1 intrinsic, plus
DAG combine rules for non-faulting loads and sign/zero extends

Reviewers: sdesmalen, efriedma, andwar, dancgr, mgudim, rengolin

Reviewed By: sdesmalen

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

Tags: #llvm

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

5 years ago[LLD][ELF][ARM] Don't apply --fix-cortex-a8 to relocatable links.
Peter Smith [Tue, 21 Jan 2020 14:05:01 +0000 (14:05 +0000)]
[LLD][ELF][ARM] Don't apply --fix-cortex-a8 to relocatable links.

The --fix-cortex-a8 is sensitive to alignment and the precise destination
of branch instructions. These are not knowable at relocatable link time. We
follow GNU ld and the --fix-cortex-a53-843419 (D72968) by not patching the
code when there is a relocatable link.

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

5 years ago[clangd] Do not duplicate TemplatedDecls in findExplicitReferences
Kadir Cetinkaya [Tue, 21 Jan 2020 14:15:06 +0000 (15:15 +0100)]
[clangd] Do not duplicate TemplatedDecls in findExplicitReferences

Reviewers: hokein

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

Tags: #clang

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

5 years agoRevert "[Concepts] Fix bug when referencing function parameters in instantiated funct...
Saar Raz [Wed, 22 Jan 2020 10:16:35 +0000 (12:16 +0200)]
Revert "[Concepts] Fix bug when referencing function parameters in instantiated function template requires clause"

This temporarily reverts commit 45538b5fb280e5b2903f7924fd4fa5b07a6dd3ea which breaks a test.

5 years agoAdd support for (expressing) vscale.
Sander de Smalen [Tue, 21 Jan 2020 10:20:27 +0000 (10:20 +0000)]
Add support for (expressing) vscale.

In LLVM IR, vscale can be represented with an intrinsic. For some targets,
this is equivalent to the constexpr:

  getelementptr <vscale x 1 x i8>, <vscale x 1 x i8>* null, i32 1

This can be used to propagate the value in CodeGenPrepare.

In ISel we add a node that can be legalized to one or more
instructions to materialize the runtime vector length.

This patch also adds SVE CodeGen support for VSCALE, which maps this
node to RDVL instructions (for scaled multiples of 16bytes) or CNT[HSD]
instructions (scaled multiples of 2, 4, or 8 bytes, respectively).

Reviewers: rengolin, cameron.mcinally, hfinkel, sebpop, SjoerdMeijer, efriedma, lattner

Reviewed by: efriedma

Tags: #llvm

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

5 years ago[Concepts] Placeholder constraints and abbreviated templates
Saar Raz [Wed, 22 Jan 2020 00:03:05 +0000 (02:03 +0200)]
[Concepts] Placeholder constraints and abbreviated templates

This patch implements P1141R2 "Yet another approach for constrained declarations".

General strategy for this patch was:

- Expand AutoType to include optional type-constraint, reflecting the wording and easing the integration of constraints.
- Replace autos in parameter type specifiers with invented parameters in GetTypeSpecTypeForDeclarator, using the same logic
  previously used for generic lambdas, now unified with abbreviated templates, by:
  - Tracking the template parameter lists in the Declarator object
  - Tracking the template parameter depth before parsing function declarators (at which point we can match template
    parameters against scope specifiers to know if we have an explicit template parameter list to append invented parameters
    to or not).
- When encountering an AutoType in a parameter context we check a stack of InventedTemplateParameterInfo structures that
  contain the info required to create and accumulate invented template parameters (fields that were already present in
  LambdaScopeInfo, which now inherits from this class and is looked up when an auto is encountered in a lambda context).

Resubmit after incorrect check in NonTypeTemplateParmDecl broke lldb.

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

5 years ago[Alignment][NFC] Use Align with CreateMaskedStore
Guillaume Chatelet [Tue, 21 Jan 2020 15:13:04 +0000 (16:13 +0100)]
[Alignment][NFC] Use Align with CreateMaskedStore

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

5 years ago[lldb] s/lldb/%lldb in two tests
Pavel Labath [Wed, 22 Jan 2020 09:58:09 +0000 (10:58 +0100)]
[lldb] s/lldb/%lldb in two tests

%lldb is the proper substitution. Using "lldb" can cause us to execute
the system lldb instead of the one we are testing. This happens at least
in standalone builds.

5 years ago[llvm-exegesis] Serial snippet: Restrict the set of back-to-back instructions
Clement Courbet [Wed, 22 Jan 2020 08:33:50 +0000 (09:33 +0100)]
[llvm-exegesis] Serial snippet: Restrict the set of back-to-back instructions

Summary:
Right now when picking a back-to-back instruction at random, we might select
instructions that we do not know how to handle.
Add a ExegesisTarget hook to possibly filter instructions.

Reviewers: gchatelet

Subscribers: tschuett, mstojanovic, llvm-commits

Tags: #llvm

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

5 years ago[Doc] Update requirements for masked load/store
Guillaume Chatelet [Wed, 22 Jan 2020 09:42:37 +0000 (10:42 +0100)]
[Doc] Update requirements for masked load/store

5 years ago[llvm-readobj] - Rewrite gnuhash.test test to stop using precompiled objects.
Georgii Rymar [Tue, 21 Jan 2020 13:06:15 +0000 (16:06 +0300)]
[llvm-readobj] - Rewrite gnuhash.test test to stop using precompiled objects.

This rewrites the test to use YAML and removes 4 precompiled object.

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

5 years ago[ARM][MVE] Clear MaskedInsts vector
Sam Parker [Wed, 22 Jan 2020 09:26:37 +0000 (04:26 -0500)]
[ARM][MVE] Clear MaskedInsts vector

In MVETailPredication, clear the vector before running on a new loop.

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

5 years ago[Concepts] Fix bug when referencing function parameters in instantiated function...
Saar Raz [Wed, 22 Jan 2020 09:23:26 +0000 (11:23 +0200)]
[Concepts] Fix bug when referencing function parameters in instantiated function template requires clause

Fixes bug #44613 - instantiated parameters were not being added when instantiating the requires clauses.

5 years ago[mlir][orc] unbreak MLIR ExecutionEngine after ORC changes
Alex Zinenko [Wed, 22 Jan 2020 09:12:04 +0000 (10:12 +0100)]
[mlir][orc] unbreak MLIR ExecutionEngine after ORC changes

Changes to ORC in ce2207abaf9a925b35f15ef92aaff6b301ba6d22 changed the
APIs in IRCompileLayer, now requiring the custom compiler to be wrapped
in IRCompileLayer::IRCompiler. Even though MLIR relies on Orc
CompileUtils, the type is still visible in several places in the code.
Adapt those to the new API.

5 years ago[lldb] Fix an asan error from 27df2d9f556c
Pavel Labath [Wed, 22 Jan 2020 09:02:27 +0000 (10:02 +0100)]
[lldb] Fix an asan error from 27df2d9f556c

This error is caused by a combination of a couple of factors:
- the test accidentally creating a list with a single (empty) FileSpec
  instead of an empty list
- lldb overzeleously converting empty strings into nullptrs
- asan overzeleously validating symlink(2) arguments (the real symlink
  call would just fail with EFAULT)

I fix this by using FileSpec::GetPath instead of GetCString. This avoids
the nullptr and also avoids inserting the path into the global string
pool.

I also enhance the test case to test both empty paths and empty lists.

5 years agoChange the googlemock link
Sunil Singh [Wed, 22 Jan 2020 09:09:43 +0000 (10:09 +0100)]
Change the googlemock link

Summary:
This commit changes the googlemock link in the Testing Guide doc as googlemock is absorbed into the GoogleTest project

Reviewers: shafik, labath, JDevlieghere, mib

Reviewed By: labath

Subscribers: llvm-commits

Tags: #llvm

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

5 years ago[clangd] Handle the missing injectedClassNameType in targetDecl.
Haojian Wu [Tue, 21 Jan 2020 14:28:06 +0000 (15:28 +0100)]
[clangd] Handle the missing injectedClassNameType in targetDecl.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

5 years ago[llvm-as] Fix assembling of index with multiple summaries sharing single GUID
Evgeny Leviant [Wed, 22 Jan 2020 09:09:13 +0000 (01:09 -0800)]
[llvm-as] Fix assembling of index with multiple summaries sharing single GUID

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

5 years ago[clang][index] Index the injected class name types.
Haojian Wu [Tue, 21 Jan 2020 15:42:18 +0000 (16:42 +0100)]
[clang][index] Index the injected class name types.

Summary: Currently, we (clangd) are missing this kind of references.

Reviewers: kadircet

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

Tags: #clang

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

5 years ago[Concepts] Fix incorrect recovery in TryAnnotateTypeConstraint
Saar Raz [Wed, 22 Jan 2020 08:46:05 +0000 (10:46 +0200)]
[Concepts] Fix incorrect recovery in TryAnnotateTypeConstraint

TryAnnotateTypeConstraint would not put the scope specifier back into the token stream when faced
with a non-concept name after a scope specifier.

5 years ago[VE] i<N> and fp32/64 arguments, return values and constants
Kazushi (Jam) Marukawa [Wed, 22 Jan 2020 08:17:36 +0000 (09:17 +0100)]
[VE] i<N> and fp32/64 arguments, return values and constants

Summary:
Support for i<N> and fp32/64 arguments (in register), return values
and constants along with tests.

Reviewed By: arsenm

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

5 years ago[lldb] Add a display name to ClangASTContext instances
Raphael Isemann [Tue, 21 Jan 2020 11:44:11 +0000 (12:44 +0100)]
[lldb] Add a display name to ClangASTContext instances

Summary:
I often struggle to understand what exactly LLDB is doing by looking at our expression evaluation logging as our messages look like this:
```
CompleteTagDecl[2] on (ASTContext*)0x7ff31f01d240 Completing (TagDecl*)0x7ff31f01d568 named DeclName1
```

From the log messages it's unclear what this ASTContext is. Is it the scratch context, the expression context, some decl vendor context or a context from a module?
The pointer value isn't helpful for anyone unless I'm in a debugger where I could inspect the memory at the address. But even with a debugger it's not easy to
figure out what this ASTContext is without having deeper understanding about all the different ASTContext instances in LLDB (e.g., valid SourceLocation
from the file system usually means that this is the Objective-C decl vendor, a file name from multiple expressions is probably the scratch context, etc.).

This patch adds a name field to ClangASTContext instances that we can use to store a name which can be used for logging and debugging. With this
our log messages now look like this:
```
CompleteTagDecl[2] on scratch ASTContext. Completing (TagDecl*)0x7ff31f01d568 named Foo
```
We can now also just print a ClangASTContext from the debugger and see a useful name in the `m_display_name` field, e.g.
```
  m_display_name = "AST for /Users/user/test/main.o";
```

Reviewers: shafik, labath, JDevlieghere, mib

Reviewed By: shafik

Subscribers: clayborg, lldb-commits

Tags: #lldb

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

5 years ago[AArch64][GlobalISel] Fix llvm.returnaddress(0) selection when LR is clobbered.
Amara Emerson [Wed, 22 Jan 2020 06:38:02 +0000 (22:38 -0800)]
[AArch64][GlobalISel] Fix llvm.returnaddress(0) selection when LR is clobbered.

The code was originally ported from SelectionDAG, which does CSE behind the scenes
automatically. When copying the return address from LR live into the function, we
need to make sure to use the single copy on function entry. Any later copy from LR
could be using clobbered junk.

Implement this by caching the copy in the per-MF state in the selector.

Should hopefully fix the AArch64 sanitiser buildbot failure.

5 years ago[ORC] Fix the LLJITWithObjectCache example to address changes in ce2207abaf9.
Lang Hames [Wed, 22 Jan 2020 06:43:08 +0000 (22:43 -0800)]
[ORC] Fix the LLJITWithObjectCache example to address changes in ce2207abaf9.

5 years ago[lldb/Initializers] Move all ObjC initializers into AppleObjCRuntime
Jonas Devlieghere [Wed, 22 Jan 2020 06:20:48 +0000 (22:20 -0800)]
[lldb/Initializers] Move all ObjC initializers into AppleObjCRuntime

AppleObjCRuntime is the main entry point to the plugin with the same
name. This is part of a greater refactoring to auto generate the
initializers. NFC.

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

5 years ago[LICM] Don't cache AliasSetTrackers when run under legacy PM
Daniil Suchkov [Mon, 20 Jan 2020 05:27:46 +0000 (12:27 +0700)]
[LICM] Don't cache AliasSetTrackers when run under legacy PM

Summary:
This is the first step towards complete removal of AST caching from
LICM. Attempts to keep LICM's AST cache up to date across passes can lead
to miscompiles like this one: https://bugs.llvm.org/show_bug.cgi?id=44320.

LICM has already switched to using MemorySSA to do sinking and hoisting
and only builds an AliasSetTracker on demand for the promoteToScalars
step, without caching it from one LICM instance to the next. Given this,
we don't have compile-time reasons to keep AST caching any more.
The only scenario where the caching would be used currently is when
using the LegacyPassManager and setting -enable-mssa-loop-dependency=false.

This switch should help us to surface any possible issues that may arise
along this way, also it turns subsequent removal of AST caching into NFC.

Reviewers: asbirlea, fhahn, efriedma, reames

Reviewed By: asbirlea

Subscribers: hiraditya, george.burgess.iv, llvm-commits

Tags: #llvm

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

5 years agoUpdate clang-interpreter example to incorporate changes in ce2207abaf9.
Lang Hames [Wed, 22 Jan 2020 06:00:17 +0000 (22:00 -0800)]
Update clang-interpreter example to incorporate changes in ce2207abaf9.

5 years ago[DA][TTI][AMDGPU] Add option to select GPUDA with TTI
Austin Kerbow [Mon, 20 Jan 2020 15:25:20 +0000 (07:25 -0800)]
[DA][TTI][AMDGPU] Add option to select GPUDA with TTI

Summary: Enable the new diveregence analysis by default for AMDGPU.

Reviewers: rampitec, nhaehnle, arsenm

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

5 years ago[ORC] Update examples to incorporate changes in ce2207abaf9.
Lang Hames [Wed, 22 Jan 2020 04:35:40 +0000 (20:35 -0800)]
[ORC] Update examples to incorporate changes in ce2207abaf9.

This should fix the builders that were failing due to broken JIT examples
after ce2207abaf9.