platform/upstream/llvm.git
4 years ago[IRMover] Add missing open quote in the warning message
Steven Wu [Fri, 9 Oct 2020 22:17:16 +0000 (15:17 -0700)]
[IRMover] Add missing open quote in the warning message

Fix the missing single quotation mark in the warning message for
target triple mismatch.

4 years agoTemporarily revert "[ThinLTO] Re-order modules for optimal multi-threaded processing"
Jordan Rupprecht [Fri, 9 Oct 2020 21:36:20 +0000 (14:36 -0700)]
Temporarily revert "[ThinLTO] Re-order modules for optimal multi-threaded processing"

This reverts commit 6537004913f3009d896bc30856698e7d22199ba7. This is causing test failures internally, and while a few of the cases turned out to be bad user code (relying on a specific order of static initialization across translation units), some cases are less clear. Temporarily reverting for now, and Teresa is going to follow up with more details.

4 years ago[WebAssembly] Prototype i16x8.q15mulr_sat_s
Thomas Lively [Fri, 9 Oct 2020 21:17:53 +0000 (21:17 +0000)]
[WebAssembly] Prototype i16x8.q15mulr_sat_s

This saturating, rounding, Q-format multiplication instruction is proposed in
https://github.com/WebAssembly/simd/pull/365.

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

4 years ago[libc++] Remove code to prevent overwriting the system libc++ on Darwin
Louis Dionne [Fri, 9 Oct 2020 19:06:04 +0000 (15:06 -0400)]
[libc++] Remove code to prevent overwriting the system libc++ on Darwin

The system partition is read-only since Catalina.

4 years ago[libc++] Remove redundant if(LIBCXX_INSTALL_LIBRARY)
Louis Dionne [Fri, 9 Oct 2020 19:04:12 +0000 (15:04 -0400)]
[libc++] Remove redundant if(LIBCXX_INSTALL_LIBRARY)

The individual LIBCXX_INSTALL_(SHARED|STATIC)_LIBRARY are already
dependent on whether LIBCXX_INSTALL_LIBRARY is ON or OFF.

4 years agoDirectoryWatcher: add an implementation for Windows
Saleem Abdulrasool [Thu, 1 Oct 2020 05:42:17 +0000 (22:42 -0700)]
DirectoryWatcher: add an implementation for Windows

This implements the directory watcher on Windows.  It does the most
naive thing for simplicity.  ReadDirectoryChangesW is used to monitor
the changes.  However, in order to support interruption, we must use
overlapped IO, which allows us to use the blocking, synchronous
mechanism.  We create a thread to post the notification to the consumer
to allow the monitoring to continue.  The two threads communicate via a
locked queue.

Differential Revision: https://reviews.llvm.org/D88666
Reviewed By: Adrian McCarthy

4 years ago[NFC][Regalloc] VirtRegAuxInfo::Hint does not need to be a field
Mircea Trofin [Fri, 9 Oct 2020 20:35:56 +0000 (13:35 -0700)]
[NFC][Regalloc] VirtRegAuxInfo::Hint does not need to be a field

It is only used in weightCalcHelper, and cleared upon its finishing its
job there.

The patch further cleans up style guide discrepancies, and simplifies
CopyHint by removing duplicate 'IsPhys' information (it's what the Reg
field would report).

4 years ago[Hexagon] Remove ISD node VSPLATW, use VSPLAT instead
Krzysztof Parzyszek [Thu, 8 Oct 2020 22:20:31 +0000 (17:20 -0500)]
[Hexagon] Remove ISD node VSPLATW, use VSPLAT instead

This is a step towards improving HVX codegen for splat.

4 years ago[Hexagon] Generalize handling of SDNodes created during ISel
Krzysztof Parzyszek [Thu, 8 Oct 2020 22:12:32 +0000 (17:12 -0500)]
[Hexagon] Generalize handling of SDNodes created during ISel

The selection of HVX shuffles can produce more nodes in the DAG,
which need special handling, or otherwise they would be left
unselected by the main selection code. Make the handling of such
nodes more general.

4 years agoAdd GPU async op interface and token type.
Christian Sigg [Thu, 8 Oct 2020 11:43:18 +0000 (13:43 +0200)]
Add GPU async op interface and token type.

See https://llvm.discourse.group/t/rfc-new-dialect-for-modelling-asynchronous-execution-at-a-higher-level/1345

Reviewed By: herhut

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

4 years ago[mlir][Linalg] NFC - Cleanup explicitly instantiated paterns 2/n - Loops.cpp
Nicolas Vasilache [Fri, 9 Oct 2020 19:15:16 +0000 (19:15 +0000)]
[mlir][Linalg] NFC - Cleanup explicitly instantiated paterns 2/n - Loops.cpp

This revision belongs to a series of patches that reduce reliance of Linalg transformations on templated rewrite and conversion patterns.
Instead, this uses a MatchAnyTag pattern for the vast majority of cases and dispatches internally.

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

4 years ago[mlir][Linalg] NFC - Cleanup explicitly instantiated paterns 1/n - LinalgToStandard.cpp
Nicolas Vasilache [Fri, 9 Oct 2020 14:31:52 +0000 (14:31 +0000)]
[mlir][Linalg] NFC - Cleanup explicitly instantiated paterns 1/n - LinalgToStandard.cpp

This revision belongs to a series of patches that reduce reliance of Linalg transformations on templated rewrite and conversion patterns.
Instead, this uses a MatchAnyTag pattern for the vast majority of cases and dispatches internally.

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

4 years agoRevert "Give attributes C++ namespaces."
Nicolas Vasilache [Fri, 9 Oct 2020 10:45:59 +0000 (10:45 +0000)]
Revert "Give attributes C++ namespaces."

This reverts commit 0a34492f36d77f043d371cc91f359b2d65e86475.

This change turned out to be very intrusive wrt some internal projects.
Reverting until this can be sorted out.

4 years ago[Reg2Mem][NewPM] Pin test to legacy PM
Arthur Eubanks [Fri, 9 Oct 2020 19:35:23 +0000 (12:35 -0700)]
[Reg2Mem][NewPM] Pin test to legacy PM

This pass hasn't been touched in a long time and isn't used in tree.

4 years ago Enable LSAN for Android
Vy Nguyen [Mon, 21 Sep 2020 21:41:48 +0000 (17:41 -0400)]
Enable LSAN for Android

    Make use of the newly added thread-properties API (available since 31).

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

4 years ago[NFC][Regalloc] Fix coding style in CalcSpillWeights
Mircea Trofin [Fri, 9 Oct 2020 19:18:52 +0000 (12:18 -0700)]
[NFC][Regalloc] Fix coding style in CalcSpillWeights

4 years agoNFC: Address post-commit doc/formatting comments on TypeID.h.
Stella Laurenzo [Fri, 9 Oct 2020 19:16:45 +0000 (12:16 -0700)]
NFC: Address post-commit doc/formatting comments on TypeID.h.

4 years ago[mlir] Fix TypeID for shared libraries built with -fvisibility=hidden.
Stella Laurenzo [Fri, 9 Oct 2020 18:49:38 +0000 (11:49 -0700)]
[mlir] Fix TypeID for shared libraries built with -fvisibility=hidden.

* Isolates the visibility controlled parts of its implementation to a detail namespace.
* Applies a struct level visibility attribute which applies to the static local within the get() functions.
* The prior version was not emitting a symbol for the static local "instance" fields when the user TU was compiled with -fvisibility=hidden.

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

4 years ago[clang] Add a test for CGDebugInfo treatment of blocks
Scott Linder [Fri, 9 Oct 2020 19:02:53 +0000 (19:02 +0000)]
[clang] Add a test for CGDebugInfo treatment of blocks

There doesn't seem to be a direct test of this, and I'm planning to make
future changes which will affect it.

I'm not particularly familiar with the blocks extension, so suggestions
for better tests are welcome.

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

4 years ago[X86] When expanding LCMPXCHG16B_NO_RBX in EmitInstrWithCustomInserter, directly...
Craig Topper [Fri, 9 Oct 2020 18:48:10 +0000 (11:48 -0700)]
[X86] When expanding LCMPXCHG16B_NO_RBX in EmitInstrWithCustomInserter, directly copy address operands instead of going through X86AddressMode.

I suspect getAddressFromInstr and addFullAddress are not handling
all addresses cases properly based on a report from MaskRay.

So just copy the operands directly. This should be more efficient
anyway.

4 years ago[X86] Don't copy kill flag when expanding LCMPXCHG16B_SAVE_RBX
Craig Topper [Fri, 9 Oct 2020 17:26:50 +0000 (10:26 -0700)]
[X86] Don't copy kill flag when expanding LCMPXCHG16B_SAVE_RBX

The expansion code creates a copy to RBX before the real LCMPXCHG16B.
It's possible this copy uses a register that is also used by the
real LCMPXCHG16B. If we set the kill flag on the use in the copy,
then we'll fail the machine verifier on the use on the LCMPXCHG16B.

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

4 years ago[MemCpyOpt] Add test for incorrectly hoisted store (NFC)
Nikita Popov [Fri, 9 Oct 2020 18:52:08 +0000 (20:52 +0200)]
[MemCpyOpt] Add test for incorrectly hoisted store (NFC)

4 years ago[libc++] Fixup a missing occurrence of LIBCXX_ENABLE_DEBUG_MODE
Louis Dionne [Fri, 9 Oct 2020 18:40:47 +0000 (14:40 -0400)]
[libc++] Fixup a missing occurrence of LIBCXX_ENABLE_DEBUG_MODE

4 years ago[libc++] Rename LIBCXX_ENABLE_DEBUG_MODE to LIBCXX_ENABLE_DEBUG_MODE_SUPPORT
Louis Dionne [Fri, 9 Oct 2020 18:39:20 +0000 (14:39 -0400)]
[libc++] Rename LIBCXX_ENABLE_DEBUG_MODE to LIBCXX_ENABLE_DEBUG_MODE_SUPPORT

To make it clearer this is about whether the library supports the debug
mode at all, not whether the debug mode is enabled. Per comment by Nico
Weber on IRC.

4 years ago[libc++] NFCI: Define small methods of basic_stringstream inline
Louis Dionne [Fri, 9 Oct 2020 18:21:23 +0000 (14:21 -0400)]
[libc++] NFCI: Define small methods of basic_stringstream inline

It greatly increases readability because defining the methods out-of-line
involves a ton of boilerplate template declarations.

4 years ago[BPF] Make BPFAbstractMemberAccessPass required
Arthur Eubanks [Wed, 7 Oct 2020 03:28:43 +0000 (20:28 -0700)]
[BPF] Make BPFAbstractMemberAccessPass required

Or else on optnone functions we get the following during instruction selection:
  fatal error: error in backend: Cannot select: intrinsic %llvm.preserve.struct.access.index

Currently the -O0 pipeline doesn't properly run passes registered via
TargetMachine::registerPassBuilderCallbacks(), so don't add that RUN
line yet. That will be fixed after this.

Reviewed By: yonghong-song

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

4 years ago[ARM][MIPS] Add funnel shift test coverage
Simon Pilgrim [Fri, 9 Oct 2020 18:19:35 +0000 (19:19 +0100)]
[ARM][MIPS] Add funnel shift test coverage

Based on offline discussions regarding D89139 and D88783 - we want to make sure targets aren't doing anything particularly dumb

Tests copied from aarch64 which has a mixture of general, legalization and special case tests

4 years ago[lldb] Update docs with new buildbot URLs
Jonas Devlieghere [Fri, 9 Oct 2020 17:57:37 +0000 (10:57 -0700)]
[lldb] Update docs with new buildbot URLs

Buildbot got upgraded and now the (LLDB) builders have different URLs.

4 years ago[OpenMPOpt] Merge parallel regions
Giorgis Georgakoudis [Tue, 7 Jul 2020 21:14:47 +0000 (14:14 -0700)]
[OpenMPOpt] Merge parallel regions

There are cases that generated OpenMP code consists of multiple,
consecutive OpenMP parallel regions, either due to high-level
programming models, such as RAJA, Kokkos, lowering to OpenMP code, or
simply because the programmer parallelized code this way.  This
optimization merges consecutive parallel OpenMP regions to: (1) reduce
the runtime overhead of re-activating a team of threads; (2) enlarge the
scope for other OpenMP optimizations, e.g., runtime call deduplication
and synchronization elimination.

This implementation defensively merges parallel regions, only when they
are within the same BB and any in-between instructions are safe to
execute in parallel.

Reviewed By: jdoerfert

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

4 years ago[libc++] Clean up logic around aligned/sized allocation and deallocation
Louis Dionne [Fri, 25 Sep 2020 13:24:14 +0000 (09:24 -0400)]
[libc++] Clean up logic around aligned/sized allocation and deallocation

Due to the need to support compilers that implement builtin operator
new/delete but not their align_val_t overloaded versions, there was a
lot of complexity. By assuming that a compiler that supports the builtin
new/delete operators also supports their align_val_t overloads, the code
can be simplified quite a bit.

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

4 years ago[clang] Don't look into <sysroot> for C++ headers if they are found alongside the...
Louis Dionne [Wed, 7 Oct 2020 18:27:55 +0000 (14:27 -0400)]
[clang] Don't look into <sysroot> for C++ headers if they are found alongside the toolchain

Currently, Clang looks for libc++ headers alongside the installation
directory of Clang, and it also adds a search path for headers in the
-isysroot. This is problematic if headers are found in both the toolchain
and in the sysroot, since #include_next will end up finding the libc++
headers in the sysroot instead of the intended system headers.

This patch changes the logic such that if the toolchain contains libc++
headers, no C++ header paths are added in the sysroot. However, if the
toolchain does *not* contain libc++ headers, the sysroot is searched as
usual.

This should not be a breaking change, since any code that previously
relied on some libc++ headers being found in the sysroot suffered from
the #include_next issue described above, which renders any libc++ header
basically useless.

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

4 years ago[libc++] Remove some workarounds for C++03
Louis Dionne [Fri, 9 Oct 2020 16:33:49 +0000 (12:33 -0400)]
[libc++] Remove some workarounds for C++03

We don't support any compiler that doesn't support variadics and rvalue
references in C++03 mode, so these workarounds can be dropped. There's
still *a lot* of cruft related to these workarounds, but I try to tackle
a bit of it here and there.

4 years ago[FixIrreducible][NewPM] Port -fix-irreducible to NPM
Arthur Eubanks [Thu, 8 Oct 2020 15:53:00 +0000 (08:53 -0700)]
[FixIrreducible][NewPM] Port -fix-irreducible to NPM

In the NPM, a pass cannot depend on another non-analysis pass. So pin
the test that tests that -lowerswitch is run automatically to legacy PM.

Reviewed By: sameerds

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

4 years ago[LoopInterchange][NewPM] Port -loop-interchange to NPM
Arthur Eubanks [Thu, 17 Sep 2020 23:19:04 +0000 (16:19 -0700)]
[LoopInterchange][NewPM] Port -loop-interchange to NPM

Reviewed By: fhahn

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

4 years ago[AMDGPU] Only enable mad/mac legacy f32 patterns if denormals may be flushed
Jay Foad [Fri, 9 Oct 2020 12:28:19 +0000 (13:28 +0100)]
[AMDGPU] Only enable mad/mac legacy f32 patterns if denormals may be flushed

Following on from D88890, this makes the newly added patterns
conditional on NoFP32Denormals. mad/mac f32 instructions always flush
denormals regardless of the MODE register setting, and I believe the
legacy variants do the same.

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

4 years ago[mlir] Forward listeners when utilizing scf::IfOp::get*BodyBuilder.
Tres Popp [Fri, 9 Oct 2020 13:37:42 +0000 (15:37 +0200)]
[mlir] Forward listeners when utilizing scf::IfOp::get*BodyBuilder.

Without this PatternRewriting infrastructure does not know of modifications and
cannot properly legalize nor rollback changes.

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

4 years ago[InstCombine] Support lshr(trunc(lshr(x,c1)), c2) -> trunc(lshr(lshr(x,c1),c2)) unifo...
Simon Pilgrim [Fri, 9 Oct 2020 15:54:32 +0000 (16:54 +0100)]
[InstCombine] Support lshr(trunc(lshr(x,c1)), c2) -> trunc(lshr(lshr(x,c1),c2)) uniform vector tests

FoldShiftByConstant is hardcoded for scalar/uniform outer shift amounts atm so that needs to be fixed first to support non-uniform cases

4 years ago[InstCombine] Add lshr(trunc(lshr(x,c1)), c2) -> trunc(lshr(lshr(x,c1),c2)) vector...
Simon Pilgrim [Fri, 9 Oct 2020 15:32:07 +0000 (16:32 +0100)]
[InstCombine] Add lshr(trunc(lshr(x,c1)), c2) -> trunc(lshr(lshr(x,c1),c2)) vector tests

4 years ago[MLIR] Add async token/value arguments to async.execute op
Eugene Zhulenev [Thu, 8 Oct 2020 20:28:09 +0000 (13:28 -0700)]
[MLIR] Add async token/value arguments to async.execute op

Async execute operation can take async arguments as dependencies.

Change `async.execute` custom parser/printer format to use `%value as %unwrapped: !async.value<!type>` sytax.

Reviewed By: mehdi_amini, herhut

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

4 years ago[mlir] Fix shared libs build
Andrzej Warzynski [Fri, 9 Oct 2020 09:57:35 +0000 (10:57 +0100)]
[mlir] Fix shared libs build

Reverts one breaking change introduced in
https://reviews.llvm.org/D88846.

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

4 years ago[ARM] Add MVE vecreduce costmodel tests. NFC
David Green [Fri, 9 Oct 2020 15:25:25 +0000 (16:25 +0100)]
[ARM] Add MVE vecreduce costmodel tests. NFC

There were some existing tests that were not super useful. New ones are
added for testing MVE specific patterns.

4 years ago[NFC] Reformat MILexer.cpp:getIdentifierKind
Scott Linder [Fri, 9 Oct 2020 15:13:45 +0000 (15:13 +0000)]
[NFC] Reformat MILexer.cpp:getIdentifierKind

Reformat to avoid unrelated changes in diff of future patch.
Committed as obvious.

4 years ago[InstCombine] commonShiftTransforms - add support for pow2 nonuniform constant vector...
Simon Pilgrim [Fri, 9 Oct 2020 14:59:19 +0000 (15:59 +0100)]
[InstCombine] commonShiftTransforms - add support for pow2 nonuniform constant vectors in srem fold

Note: we already fold srem to undef if any denominator vector element is undef.

4 years ago[Hexagon] Return 1 instead of 0 from getMaxInterleaveFactor
Krzysztof Parzyszek [Fri, 9 Oct 2020 14:34:24 +0000 (09:34 -0500)]
[Hexagon] Return 1 instead of 0 from getMaxInterleaveFactor

4 years ago[InstCombine] allow vector splats for add+and with high-mask
Sanjay Patel [Fri, 9 Oct 2020 14:25:08 +0000 (10:25 -0400)]
[InstCombine] allow vector splats for add+and with high-mask

There might be a better way to specify the pre-conditions,
but this is hopefully clearer than the way it was written:
https://rise4fun.com/Alive/Jhk3

  Pre: C2 < 0 && isShiftedMask(C2) && (C1 == C1 & C2)
  %a = and %x, C2
  %r = add %a, C1
  =>
  %a2 = add %x, C1
  %r = and %a2, C2

4 years ago[InstCombine] Add tests for X shift (A srem B) -> X shift (A and B-1) pow2 nonuniform...
Simon Pilgrim [Fri, 9 Oct 2020 13:42:34 +0000 (14:42 +0100)]
[InstCombine] Add tests for X shift (A srem B) -> X shift (A and B-1) pow2 nonuniform constant vectors

4 years ago[OpenCL] Add new compilation mode for OpenCL 3.0.
Anastasia Stulova [Fri, 9 Oct 2020 14:13:39 +0000 (15:13 +0100)]
[OpenCL] Add new compilation mode for OpenCL 3.0.

Extended -cl-std/std flag with CL3.0 and added predefined version macros.

Patch by Anton Zabaznov (azabaznov)!

Tags: #clang

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

4 years ago[libc++] Make sure we don't cache DSL functions too aggressively
Louis Dionne [Fri, 9 Oct 2020 14:08:02 +0000 (10:08 -0400)]
[libc++] Make sure we don't cache DSL functions too aggressively

To make sure we don't store a mutable object (which could be modified by
outside code without us noticing) as the cache key, we pickle the cache
key to get a byte stream. If two keys are unequal, we know for sure they
will not have the same pickling. And if they are equal, there's a large
chance they will have the same pickling. If they don't, we might end up
not reusing a cached entry when we could have, but at least the behavior
we'll have is semantically correct.

4 years ago[mlir][openmp][NFC]Remove unnecessary brackets and rephrase ParallelOp description...
Irina Dobrescu [Fri, 2 Oct 2020 14:45:44 +0000 (15:45 +0100)]
[mlir][openmp][NFC]Remove unnecessary brackets and rephrase ParallelOp description in mlir definition

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

4 years ago[clangd] Stop logging in fromJSON, report instead.
Sam McCall [Fri, 9 Oct 2020 14:08:44 +0000 (16:08 +0200)]
[clangd] Stop logging in fromJSON, report instead.

4 years ago[SystemZ][z/OS] Update target specific __attribute__((aligned)) value for test
Fanbo Meng [Fri, 9 Oct 2020 14:13:45 +0000 (10:13 -0400)]
[SystemZ][z/OS] Update target specific __attribute__((aligned)) value for test

z/OS defaults to 16 bytes for  __attribute__((aligned)), modify the test to differentiate between z/OS and Linux on s390x.

Reviewed By: abhina.sreeskantharajan

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

4 years ago[libc++] More consistency with declaring int main(int, char**)
Louis Dionne [Fri, 9 Oct 2020 14:08:42 +0000 (10:08 -0400)]
[libc++] More consistency with declaring int main(int, char**)

4 years ago[mlir] Use PatternRewriter infrastructure for shape.assuming bufferization
Tres Popp [Fri, 9 Oct 2020 12:34:44 +0000 (14:34 +0200)]
[mlir] Use PatternRewriter infrastructure for shape.assuming bufferization

Without this, legalization might not recursively handle child ops properly.
Additionally, this is required for pattern rewriting to properly rollback conversions.

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

4 years ago[gn build] Port 0741a2c9cac
LLVM GN Syncbot [Fri, 9 Oct 2020 13:54:24 +0000 (13:54 +0000)]
[gn build] Port 0741a2c9cac

4 years ago[Clang][unittests][NFC] Break up test in Callbacks.cpp
Stefan Pintilie [Fri, 9 Oct 2020 13:20:00 +0000 (08:20 -0500)]
[Clang][unittests][NFC] Break up test in Callbacks.cpp

The Callbacks.cpp test was taking a long time to compile on some build bots
causing timeouts. This patch splits up that test into five separate cpp
files and a header file.

Reviewed By: gribozavr2

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

4 years ago[SCEV] Do not apply info from loop guards in AddRecs.
Florian Hahn [Fri, 9 Oct 2020 13:32:21 +0000 (14:32 +0100)]
[SCEV] Do not apply info from loop guards in AddRecs.

We cannot guarantee that the replacement expression is loop-invariant in
all AddRecs in the source expression. Use a rewriter that skips
AddRecExpr for now.

Fixes PR47776.

4 years ago[InstCombine] foldShiftOfShiftedLogic - add support for nonuniform constant vectors
Simon Pilgrim [Fri, 9 Oct 2020 13:22:19 +0000 (14:22 +0100)]
[InstCombine] foldShiftOfShiftedLogic - add support for nonuniform constant vectors

4 years agoRemove old create(MainFile)?IncludeInsertion overloads
Alexander Kornienko [Thu, 8 Oct 2020 22:56:00 +0000 (00:56 +0200)]
Remove old create(MainFile)?IncludeInsertion overloads

Reviewed By: hokein

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

4 years ago[InstCombine] foldShiftOfShiftedLogic - replace cast<BinaryOperator> with m_BinOp...
Simon Pilgrim [Fri, 9 Oct 2020 13:09:52 +0000 (14:09 +0100)]
[InstCombine] foldShiftOfShiftedLogic - replace cast<BinaryOperator> with m_BinOp matcher. NFCI.

Allows us to drop the !isa<ConstantExpr> check.

4 years ago[mlir][gpu] Fix bug in kernel outlining
Stephan Herhut [Fri, 9 Oct 2020 10:12:35 +0000 (12:12 +0200)]
[mlir][gpu] Fix bug in kernel outlining

The updated version of kernel outlining did not handle cases correctly
where an operand of a candidate for sinking itself was defined by an operation
that is a sinking candidate. In such cases, it could happen that sunk
operations were inserted in the wrong order, breaking ssa properties.

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

4 years ago[InstCombine] Add nonuniform/undef vector tests for shift(binop(shift(x,c1),y),c2...
Simon Pilgrim [Fri, 9 Oct 2020 12:41:58 +0000 (13:41 +0100)]
[InstCombine] Add nonuniform/undef vector tests for shift(binop(shift(x,c1),y),c2) patterns

4 years ago[LLD] [ELF] Fix the help listing for the wrap option. NFC.
Martin Storsjö [Tue, 6 Oct 2020 10:07:17 +0000 (13:07 +0300)]
[LLD] [ELF] Fix the help listing for the wrap option. NFC.

This option just takes a single symbol name per invocation of the
option.

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

4 years agoRegenerate ClangCommandLineReference.rst
Konstantin Zhuravlyov [Fri, 9 Oct 2020 12:29:53 +0000 (08:29 -0400)]
Regenerate ClangCommandLineReference.rst

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

4 years ago[windows-itanium] make dllimport/export handling closer to MS behavior
Ben Dunbobbin [Mon, 31 Aug 2020 20:32:36 +0000 (21:32 +0100)]
[windows-itanium] make dllimport/export handling closer to MS behavior

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

4 years agoRevert "first upstream review"
Ben Dunbobbin [Fri, 9 Oct 2020 12:22:46 +0000 (13:22 +0100)]
Revert "first upstream review"

Pushed by accident :(

This reverts commit 4eb627ed96e3f2f9f24aec8a0654ce5204874bb8.

4 years agofirst upstream review
Ben Dunbobbin [Mon, 31 Aug 2020 20:32:36 +0000 (21:32 +0100)]
first upstream review

4 years ago[clangd] Make the tweak filter a parameter to enumerateTweaks. NFC
Sam McCall [Fri, 2 Oct 2020 09:34:40 +0000 (11:34 +0200)]
[clangd] Make the tweak filter a parameter to enumerateTweaks. NFC

(Required for CodeActionContext.only)

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

4 years agoReland "[NFC][SCEV] Improve tests for ptrtoint modelling (D88806)"
Roman Lebedev [Fri, 9 Oct 2020 11:47:34 +0000 (14:47 +0300)]
Reland "[NFC][SCEV] Improve tests for ptrtoint modelling (D88806)"

I messed up runlines in the original commit.

4 years ago[clang] improve accuracy of ExprMutAnalyzer
Jonas Toth [Fri, 9 Oct 2020 11:17:59 +0000 (13:17 +0200)]
[clang] improve accuracy of ExprMutAnalyzer

This patch extracts the ExprMutAnalyzer changes from https://reviews.llvm.org/D54943
into its own revision for simpler review and more atomic changes.

The analysis results are improved. Nested expressions (e.g. conditional
operators) are now detected properly. Some edge cases, especially
template induced imprecisions are improved upon.

Reviewed By: aaron.ballman

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

4 years ago[Analyzer] Fix for dereferece of smart pointer after branching on unknown inner pointer
Nithin Vadukkumchery Rajendrakumar [Fri, 9 Oct 2020 11:42:25 +0000 (13:42 +0200)]
[Analyzer] Fix for dereferece of smart pointer after branching on unknown inner pointer

Summary: Enabling warning after dereferece of smart pointer after branching on unknown inner pointer.

Reviewers: NoQ, Szelethus, vsavchenko, xazax.hun
Reviewed By: NoQ
Subscribers: martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D87043

4 years ago[NFC] Add option to disable IV widening if needed
Max Kazantsev [Fri, 9 Oct 2020 11:28:12 +0000 (18:28 +0700)]
[NFC] Add option to disable IV widening if needed

IV widening is sometimes a strictly harmful transform (some examples
of this are shown in tests 11, 12 in widen-loop-comp.ll). One of the
reasons of this is that sometimes SCEV fails to prove some facts after
part of guards has been widened.

Though each single such case looks like a bug that can be addressed,
it seems that disabling of IV widening may be profitable in some cases.
We want to have an option to do so. By default, existing behavior is
preserved and IV widening is on.

4 years ago[mlir] Fix bug in computing operation order
James Molloy [Fri, 9 Oct 2020 11:12:11 +0000 (12:12 +0100)]
[mlir] Fix bug in computing operation order

When attempting to compute a differential orderIndex we were calculating the
bailout condition correctly, but then an errant "+ 1" meant the orderIndex we
created was invalid.

Added test.

Reviewed By: ftynse

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

4 years agoRevert "[NFC][SCEV] Improve tests for ptrtoint modelling (D88806)"
Roman Lebedev [Fri, 9 Oct 2020 11:10:43 +0000 (14:10 +0300)]
Revert "[NFC][SCEV] Improve tests for ptrtoint modelling (D88806)"

Buildbots aren't happy, need to investigate.
This reverts commit 32cc8f7998abe1824e0832a49b66559471c9b879.

4 years ago[SystemZ] Use LA instead of AGR in eliminateFrameIndex().
Jonas Paulsson [Thu, 8 Oct 2020 11:18:29 +0000 (13:18 +0200)]
[SystemZ] Use LA instead of AGR in eliminateFrameIndex().

Since AGR clobbers CC it should not be used here.

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

Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D89034

4 years ago[Diagnostics] Diagnose -Wsizeof-array-div for array of pointers
Dávid Bolvanský [Fri, 9 Oct 2020 10:55:46 +0000 (12:55 +0200)]
[Diagnostics] Diagnose  -Wsizeof-array-div for array of pointers

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

4 years ago[NFC][SCEV] Improve tests for ptrtoint modelling (D88806)
Roman Lebedev [Fri, 9 Oct 2020 10:35:34 +0000 (13:35 +0300)]
[NFC][SCEV] Improve tests for ptrtoint modelling (D88806)

4 years ago[mlir] NFC: small improvement to how we print a gpu.launch op.
Christian Sigg [Thu, 8 Oct 2020 11:17:22 +0000 (13:17 +0200)]
[mlir] NFC: small improvement to how we print a gpu.launch op.

Reviewed By: mehdi_amini

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

4 years ago[NFC] Fix banner
Luís Marques [Fri, 9 Oct 2020 09:00:11 +0000 (10:00 +0100)]
[NFC] Fix banner

4 years ago[DAGCombiner] Add decomposition patterns for Mul-by-Imm.
Esme-Yi [Fri, 9 Oct 2020 08:51:40 +0000 (08:51 +0000)]
[DAGCombiner] Add decomposition patterns for Mul-by-Imm.

Summary: This patch is derived from D87384.
In this patch we expand the existing decomposition of mul-by-constant to be more general by implementing 2 patterns:
```
  mul x, (2^N + 2^M) --> (add (shl x, N), (shl x, M))
  mul x, (2^N - 2^M) --> (sub (shl x, N), (shl x, M))
```
The conversion will be trigged if the multiplier is a big constant that the target can't use a single multiplication instruction to handle. This is controlled by the hook `decomposeMulByConstant`.
More over, the conversion benefits from an ILP improvement since the instructions are independent. A case with the sequence like following also gets benefit since a shift instruction is saved.

```
*res1 = a * 0x8800;
*res2 = a * 0x8080;
```

Reviewed By: spatel

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

4 years ago[llvm-readelf/obj][test] - Stop using precompiled binary in mips-plt.test
Georgii Rymar [Fri, 9 Oct 2020 07:13:56 +0000 (10:13 +0300)]
[llvm-readelf/obj][test] - Stop using precompiled binary in mips-plt.test

This removes the precompiled binary and rewrites test to use YAML.

After this change we'll have no more precompiled inputs in `llvm-readobj/ELF/Inputs`.

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

4 years ago[lldb] Delete copy operations on PluginInterface class
Pavel Labath [Fri, 9 Oct 2020 08:35:02 +0000 (10:35 +0200)]
[lldb] Delete copy operations on PluginInterface class

This is a polymorphic class, copying it is a bad idea.

This was not a problem because most classes inheriting from it were
deleting their copy operations themselves. However, this enables us to
delete those explicit deletions, and ensure noone forgets to add them in
the future.

4 years ago[Fixed Point] Add floating point methods to APFixedPoint.
Bevin Hansson [Fri, 14 Aug 2020 09:47:25 +0000 (11:47 +0200)]
[Fixed Point] Add floating point methods to APFixedPoint.

This adds methods to APFixedPoint for converting to and from
floating point values.

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

4 years agoRefactor fixed point conversion test.
Bevin Hansson [Tue, 25 Aug 2020 13:59:12 +0000 (15:59 +0200)]
Refactor fixed point conversion test.

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

4 years ago[IR] Add Type::getFloatingPointTy.
Bevin Hansson [Fri, 11 Sep 2020 11:59:22 +0000 (13:59 +0200)]
[IR] Add Type::getFloatingPointTy.

It is possible to get a fltSemantics of a particular Type,
but there is no way to produce a Type based on a
fltSemantics.

This adds the function Type::getFloatingPointTy, which
will return the appropriate floating point Type for a given
fltSemantics.

ConstantFP is modified to use this function instead of
implementing it itself. Also some minor refactors to use
Type::getFltSemantics instead of a hand-rolled version.

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

4 years ago[clangd] Fix dead variable, typo. NFC
Sam McCall [Fri, 9 Oct 2020 08:21:25 +0000 (10:21 +0200)]
[clangd] Fix dead variable, typo. NFC

4 years ago[clangd] Enable partial namespace matches for workspace symbols
Kadir Cetinkaya [Mon, 5 Oct 2020 09:52:58 +0000 (11:52 +0200)]
[clangd] Enable partial namespace matches for workspace symbols

This will enable queries like "clangd::" to find symbols under clangd
namespace, without requiring full "clang::clangd::" qualification.

Since Fuzzyfind performs the search under all scopes and only boosts the symbols
from relevant namespaces, we might get symbols from non-matching namespaces.
This patch chooses to drop those as they clearly do not match the query.

Fixes https://github.com/clangd/clangd/issues/550.

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

4 years ago[clangd] Reduce availability of extract function
Kadir Cetinkaya [Wed, 5 Aug 2020 20:18:39 +0000 (22:18 +0200)]
[clangd] Reduce availability of extract function

This patch introduces hoisting detection logic into prepare state with
a partial AST traversal of the enclosing function.

We had some complaints from the users about this code action being almost always
available but failing most of the time. Hopefully this should reduce that noise.

The latency/correctness tradeoff is a bunch of hand-waving, but at least today
we don't have any other actions that are available on selection of statements,
so when we get to do the traversal it is quite likely that all the other checks
will bail out early. But this is still up for discussion, I am happy to abandon
the patch if you believe this is not practical.

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

4 years ago[clangd] Add more incomplete_type diagnostics that could be fixed by include-fixer.
Haojian Wu [Fri, 9 Oct 2020 06:51:17 +0000 (08:51 +0200)]
[clangd] Add more incomplete_type diagnostics that could be fixed by include-fixer.

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

4 years agoRemove -gen-pass-doc from Flang CMake configuration: the documentation generation...
Mehdi Amini [Fri, 9 Oct 2020 06:17:53 +0000 (06:17 +0000)]
Remove -gen-pass-doc from Flang CMake configuration: the documentation generation is broken

`ninja mlir-doc` fails when Flang is configured with this.

4 years agoRevert "[MLIR] Add a foldTrait() mechanism to allow traits to define folding and...
Mehdi Amini [Fri, 9 Oct 2020 06:16:42 +0000 (06:16 +0000)]
Revert "[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it with an Involution trait"

This reverts commit 1ceaffd95a6bdc4b7d2193e049bcd6b40ee9ff50.

The build is broken with  -DBUILD_SHARED_LIBS=ON ; seems like a possible
layering issue to investigate:

tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Operation.cpp.o: In function `mlir::MemoryEffectOpInterface::hasNoEffect(mlir::Operation*)':
Operation.cpp:(.text._ZN4mlir23MemoryEffectOpInterface11hasNoEffectEPNS_9OperationE[_ZN4mlir23MemoryEffectOpInterface11hasNoEffectEPNS_9OperationE]+0x9c): undefined reference to `mlir::MemoryEffectOpInterface::getEffects(llvm::SmallVectorImpl<mlir::SideEffects::EffectInstance<mlir::MemoryEffects::Effect> >&)'

4 years agoGive attributes C++ namespaces.
Federico Lebrón [Fri, 9 Oct 2020 03:58:42 +0000 (03:58 +0000)]
Give attributes C++ namespaces.

Reviewed By: mehdi_amini, jpienaar

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

4 years ago[mlir] Improve LLVM shlib support
Serge Guelton [Mon, 5 Oct 2020 19:35:18 +0000 (15:35 -0400)]
[mlir] Improve LLVM shlib support

mlir-tblgen was incompatible with libLLVM, due to explicit linkage with
libLLVMSupport etc.
As it cannot link with libLLVM, make sure all lib it uses are not using libLLVM
either.

As a side effect, also remove some explicit references to LLVM libs and use
components instead.

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

4 years ago[MCRegister] Simplify isStackSlot & isPhysicalRegister and delete isPhysical. NFC
Fangrui Song [Fri, 9 Oct 2020 05:08:13 +0000 (22:08 -0700)]
[MCRegister] Simplify isStackSlot & isPhysicalRegister and delete isPhysical. NFC

4 years ago[lldb] Format remaining signal table (NFC)
Jonas Devlieghere [Fri, 9 Oct 2020 03:01:21 +0000 (20:01 -0700)]
[lldb] Format remaining signal table (NFC)

Restore the signal tables to its original glory and mark it as not to be
clang-formatted.

4 years agoFix incorect Register -> MCRegister conversion
Fangrui Song [Fri, 9 Oct 2020 04:38:17 +0000 (21:38 -0700)]
Fix incorect Register -> MCRegister conversion

getReg returns a Register which may represent a virtual register.

4 years ago[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it...
ahmedsabie [Fri, 9 Oct 2020 02:58:10 +0000 (02:58 +0000)]
[MLIR] Add a foldTrait() mechanism to allow traits to define folding and test it with an Involution trait

This change allows folds to be done on a newly introduced involution trait rather than having to manually rewrite this optimization for every instance of an involution

Reviewed By: rriddle, andyly, stephenneuendorffer

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

4 years ago[X86] Passing union type through register
Liu, Chen3 [Fri, 9 Oct 2020 03:20:29 +0000 (11:20 +0800)]
[X86] Passing union type through register

For example:

  union M256 {
    double d;
    __m256 m;
  };
  extern void foo1(union M256 A);
  union M256 m1;
  void test() {
    foo1(m1);
  }

clang will pass m1 through stack which does not follow the ABI.

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

4 years ago[llvm-dwarfdump][test] Rewrite verify_die_ranges.s in YAML. NFC.
Xing GUO [Fri, 9 Oct 2020 03:13:05 +0000 (11:13 +0800)]
[llvm-dwarfdump][test] Rewrite verify_die_ranges.s in YAML. NFC.

This patch rewrites test case verify_die_ranges.s in YAML which helps
simplify the test.

Reviewed By: jhenderson, JDevlieghere, dblaikie

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

4 years ago[DWARFYAML] Make the opcode_base and the standard_opcode_lengths fields optional.
Xing GUO [Fri, 9 Oct 2020 03:09:29 +0000 (11:09 +0800)]
[DWARFYAML] Make the opcode_base and the standard_opcode_lengths fields optional.

This patch makes the opcode_base and the standard_opcode_lengths fields
of the line table optional. When both of them are not specified,
yaml2obj emits them according to the line table's version.

Reviewed By: jhenderson

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

4 years ago[VE] Add new MVT types for NEC SX Aurora VE vector
Kazushi (Jam) Marukawa [Sat, 3 Oct 2020 05:27:51 +0000 (14:27 +0900)]
[VE] Add new MVT types for NEC SX Aurora VE vector

This patch adds entries for:
    v64i64
    v128i64
    v256i64
    v64f64
    v128f64
    v256f64

Reviewed By: simoll

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