platform/upstream/llvm.git
4 years ago[RDA] Switch isSafeToMove iterators
Sam Parker [Mon, 28 Sep 2020 14:46:56 +0000 (15:46 +0100)]
[RDA] Switch isSafeToMove iterators

So forwards is forwards and backwards is reverse. Also add a check
so that we know the instructions are in the expected order.

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

4 years ago[ARM] Change VPT state assertion
Sam Parker [Thu, 24 Sep 2020 13:02:53 +0000 (14:02 +0100)]
[ARM] Change VPT state assertion

Just because we haven't encountered an instruction setting the VPR,
it doesn't mean we can't create a VPT block - the VPR maybe a
live-in.

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

4 years ago[lldb] Use config.lldb_src_root in lit_config.load_config (NFC)
Jonas Devlieghere [Wed, 30 Sep 2020 06:00:18 +0000 (23:00 -0700)]
[lldb] Use config.lldb_src_root in lit_config.load_config (NFC)

Rather than relaying on CMake to substitute the full path to the lldb
source root, use the  value set in config.lldb_src_root. This makes it
slightly easier to write a custom lit.site.cfg.py.

4 years agoRemove test AST/const-fpfeatures-diag.c
Serge Pavlov [Wed, 30 Sep 2020 04:07:55 +0000 (11:07 +0700)]
Remove test AST/const-fpfeatures-diag.c

This test is going to be removed because using dynamic rounding mode
in initializers is changing. It also causes build failures in some
cases, so remove it now.

4 years ago[mlir] Update docs referencing OpTrait::Symbol.
Scott Todd [Wed, 30 Sep 2020 03:55:54 +0000 (03:55 +0000)]
[mlir] Update docs referencing OpTrait::Symbol.

Since https://reviews.llvm.org/D78522, Symbol is not a Trait itself.

Reviewed By: rriddle

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

4 years ago[gn build] Add missing dependency to Extensions
Arthur Eubanks [Wed, 30 Sep 2020 03:12:00 +0000 (20:12 -0700)]
[gn build] Add missing dependency to Extensions

4 years agoRemove further OpenBSD/sparc bits
Brad Smith [Wed, 30 Sep 2020 02:17:12 +0000 (22:17 -0400)]
Remove further OpenBSD/sparc bits

4 years ago[GlobalISel] Fix multiply with overflow intrinsics legalization generating invalid...
Amara Emerson [Tue, 29 Sep 2020 21:39:54 +0000 (14:39 -0700)]
[GlobalISel] Fix multiply with overflow intrinsics legalization generating invalid MIR.

During lowering of G_UMULO and friends, the previous code moved the builder's
insertion point to be after the legalizing instruction. When that happened, if
there happened to be a "G_CONSTANT i32 0" immediately after, the CSEMIRBuilder
would try to find that constant during the buildConstant(zero) call, and since
it dominates itself would return the iterator unchanged, even though the def
of the constant was *after* the current insertion point. This resulted in the
compare being generated *before* the constant which it was using.

There's no need to modify the insertion point before building the mul-hi or
constant. Delaying moving the insert point ensures those are built/CSEd before
the G_ICMP is built.

Fixes PR47679

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

4 years ago[X86] Increase the depth threshold required to form VPERMI2W/VPERMI2B in shuffle...
Craig Topper [Tue, 29 Sep 2020 17:51:49 +0000 (10:51 -0700)]
[X86] Increase the depth threshold required to form VPERMI2W/VPERMI2B in shuffle combining

These instructions are implemented with two port 5 uops and one port 015 uop so they are more complicated that most shuffles.

This patch increases the depth threshold for when we form them during shuffle combining to try to limit increasing the number of uops especially on port 5.

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

4 years ago[AIX] asm output: use character literals in byte lists for strings
Hubert Tong [Wed, 30 Sep 2020 01:11:16 +0000 (21:11 -0400)]
[AIX] asm output: use character literals in byte lists for strings

This patch improves the assembly output produced for string literals by
using character literals in byte lists. This provides the benefits of
having printable characters appear as such in the assembly output and of
having strings kept as logical units on the same line.

Reviewed By: daltenty

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

4 years ago[RISCV] Use the extensions in the canonical order (NFC)
Evandro Menezes [Tue, 29 Sep 2020 22:11:12 +0000 (17:11 -0500)]
[RISCV] Use the extensions in the canonical order (NFC)

Use the ISA extensions for specific processors in the conventional canonical order.

4 years agoAdd remquo, frexp and modf overload functions to HIP header
Yaxun (Sam) Liu [Tue, 29 Sep 2020 12:51:26 +0000 (08:51 -0400)]
Add remquo, frexp and modf overload functions to HIP header

4 years ago[gardening] Replace some uses of setDebugLoc(DebugLoc()) with dropLocation(), NFC
Vedant Kumar [Wed, 30 Sep 2020 00:37:36 +0000 (17:37 -0700)]
[gardening] Replace some uses of setDebugLoc(DebugLoc()) with dropLocation(), NFC

4 years ago[lldb] Hoist -s (trace directory) argument out of LLDB_TEST_COMMON_ARGS (NFC)
Jonas Devlieghere [Wed, 30 Sep 2020 00:22:16 +0000 (17:22 -0700)]
[lldb] Hoist -s (trace directory) argument out of LLDB_TEST_COMMON_ARGS (NFC)

Give the trace directory argument its own variable
(LLDB_TEST_TRACE_DIRECTORY) so that we can configure it in
lit.site.cfg.py if we so desire.

4 years agoFix test failures with trunk clang
Richard Smith [Wed, 30 Sep 2020 00:08:42 +0000 (17:08 -0700)]
Fix test failures with trunk clang

- Make the consteval constructor for the zero type be noexcept
- Don't expect three-way comparison of 0 against a comparison category
  to fail

4 years ago[NFC][Msan] Add llvm.fabs test
Vitaly Buka [Tue, 29 Sep 2020 22:31:25 +0000 (15:31 -0700)]
[NFC][Msan] Add llvm.fabs test

llvm.fabs does not need a special handler as llvm.abs as its
single argument type match the return type.

4 years ago[NFC][MSAN] Remove an attribute in test
Vitaly Buka [Tue, 29 Sep 2020 21:38:56 +0000 (14:38 -0700)]
[NFC][MSAN] Remove an attribute in test

4 years ago[docs] Recommend dropLocation() over setDebugLoc(DebugLoc())
Vedant Kumar [Wed, 30 Sep 2020 00:07:06 +0000 (17:07 -0700)]
[docs] Recommend dropLocation() over setDebugLoc(DebugLoc())

4 years ago[DebugInfo] Add types from constructor homing to the retained types list.
Amy Huang [Tue, 29 Sep 2020 23:19:08 +0000 (16:19 -0700)]
[DebugInfo] Add types from constructor homing to the retained types list.

Add class types to the retained types list to make sure they
don't get dropped if the constructor is optimized out later.

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

4 years agoFix a variety of minor issues with ObjC method mangling:
John McCall [Tue, 29 Sep 2020 22:47:37 +0000 (18:47 -0400)]
Fix a variety of minor issues with ObjC method mangling:

- Fix a memory leak accidentally introduced yesterday by using CodeGen's
  existing mangling context instead of creating a new context afresh.

- Move GNU-runtime ObjC method mangling into the AST mangler; this will
  eventually be necessary to support direct methods there, but is also
  just the right architecture.

- Make the Apple-runtime method mangling work properly when given an
  interface declaration, fixing a bug (which had solidified into a test)
  where mangling a category method from the interface could cause it to
  be mangled as if the category name was a class name.  (Category names
  are namespaced within their class and have no global meaning.)

- Fix a code cross-reference in dsymutil.

Based on a patch by Ellis Hoag.

4 years ago[mlir] Remove more OpBuilder args which are now injected
Jacques Pienaar [Tue, 29 Sep 2020 23:47:21 +0000 (16:47 -0700)]
[mlir] Remove more OpBuilder args which are now injected

NFC. Some small changes to make things more consistent but primarily
avoiding old behavior without any further change.

4 years ago[CodeExtractor] Don't create bitcasts when inserting lifetime markers (NFCI)
Vedant Kumar [Tue, 29 Sep 2020 23:32:06 +0000 (16:32 -0700)]
[CodeExtractor] Don't create bitcasts when inserting lifetime markers (NFCI)

Lifetime marker intrinsics support any pointer type, so CodeExtractor
does not need to bitcast to `i8*` in order to use these markers.

4 years agoFix use of wrong printf format specifier for size_t argument.
Richard Smith [Tue, 29 Sep 2020 23:01:25 +0000 (16:01 -0700)]
Fix use of wrong printf format specifier for size_t argument.

This causes a build break under -Werror=format.

4 years ago[AMDGPU] Remove SIEncodingFamily.GFX10_B
Stanislav Mekhanoshin [Tue, 29 Sep 2020 22:32:04 +0000 (15:32 -0700)]
[AMDGPU] Remove SIEncodingFamily.GFX10_B

It turns to be not needed anymore.

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

4 years agoRecognize setjmp and friends as builtins even if jmp_buf is not declared yet.
Richard Smith [Tue, 29 Sep 2020 22:20:11 +0000 (15:20 -0700)]
Recognize setjmp and friends as builtins even if jmp_buf is not declared yet.

This happens in glibc's headers. It's important that we recognize these
functions so that we can mark them as returns_twice.

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

4 years agoImprove the representation of <compare>'s zero-only type.
Richard Smith [Fri, 31 Jul 2020 22:03:21 +0000 (15:03 -0700)]
Improve the representation of <compare>'s zero-only type.

* Use an empty struct instead of a member pointer to represent this
  type, so that we don't actually pass a zero member pointer at runtime.

* Mark the constructor as consteval to ensure that no code is emitted
  for it whenever possible.

* Add a honeypot constructor to reject all non-int arguments, so that
  the only argument that can arrive at the real constructor is the
  literal 0.

This results in better generated code, and rejecting invalid comparisons
against nullptr, 0L, and so on, while also rejecting invalid comparisons
against (1-1) and similar that would be allowed if we required an
integer constant expression with value 0.

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

4 years ago[nfc][libomptarget] Drop parameter to named_sync
JonChesterfield [Tue, 29 Sep 2020 22:11:46 +0000 (23:11 +0100)]
[nfc][libomptarget] Drop parameter to named_sync

[nfc][libomptarget] Drop parameter to named_sync

named_sync has one call site (in sync.cu) where it always passed L1_BARRIER.
Folding this into the call site and dropping the macro is a simplification.

amdgpu doesn't have ptx' bar.sync instruction. A correct implementation of
__kmpc_impl_named_sync in terms of shared memory is much easier if it can
assume that the barrier argument is this constant. Said implementation is left
for a second patch.

Reviewed By: jdoerfert

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

4 years ago[flang][msvc] Define access flags under Windows. NFC.
Michael Kruse [Tue, 29 Sep 2020 21:57:05 +0000 (16:57 -0500)]
[flang][msvc] Define access flags under Windows. NFC.

The flags F_OK, R_OK and W_OK are defined in unistd.h, which does not exist under the Windows platform. Windows still defines the `access` function. Its access flags are documented at https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/access-waccess. For compatibility, define the flags F_OK, R_OK and W_OK using these constants.

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: klausler

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

4 years ago[flang][msvc] Define implicit conversion from UnsignedInt128 to int64_t.
Michael Kruse [Tue, 29 Sep 2020 21:30:07 +0000 (16:30 -0500)]
[flang][msvc] Define implicit conversion from UnsignedInt128 to int64_t.

The custom implementation of UnsignedInt128 has an implicit conversion operator to unit64_t, but not int64_t. Considering that the former is already truncating, and C++ implicitly converts uint64_t to int64_t, UnsignedInt128  should also support an implicit conversion to int64_t. An analogous conversion would be from uint32_t to int16_t.

Without the conversion operator overload, the msvc emits the following error:
```
descriptor-io.h(44): error C2440: 'static_cast': cannot convert from 'A' to 'int64_t'
        with
        [
            A=Fortran::common::uint128_t
        ]
```

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: klausler

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

4 years ago[SVE] Lower fixed length VECREDUCE_[FMAX|FMIN] to Scalable
Cameron McInally [Tue, 29 Sep 2020 21:20:33 +0000 (16:20 -0500)]
[SVE] Lower fixed length VECREDUCE_[FMAX|FMIN] to Scalable

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

4 years ago[ms] [llvm-ml] Create the @feat.00 symbol, and populate it appropriately
Eric Astor [Tue, 29 Sep 2020 21:02:18 +0000 (17:02 -0400)]
[ms] [llvm-ml] Create the @feat.00 symbol, and populate it appropriately

@feat.00 is a bitfield read by Microsoft-style linkers, and is required to signal (e.g.) /safeseh support on 32-bit systems.

Reviewed By: rnk

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

4 years ago[ms] [llvm-ml] Accept whitespace around the dot operator
Eric Astor [Tue, 29 Sep 2020 21:01:05 +0000 (17:01 -0400)]
[ms] [llvm-ml] Accept whitespace around the dot operator

MASM allows arbitrary whitespace around the Intel dot operator, especially when used for struct field lookup

Reviewed By: rnk

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

4 years ago[ms] [llvm-ml] Add support for "alias" directive
Eric Astor [Tue, 29 Sep 2020 20:59:42 +0000 (16:59 -0400)]
[ms] [llvm-ml] Add support for "alias" directive

Support the "alias" directive.

Required support for emitWeakReference in MCWinCOFFStreamer.

Reviewed By: thakis

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

4 years ago[ms] [llvm-ml] Add REAL10 support (x87 extended precision)
Eric Astor [Tue, 29 Sep 2020 20:58:39 +0000 (16:58 -0400)]
[ms] [llvm-ml] Add REAL10 support (x87 extended precision)

Add MASM support for 80-bit reals in the x87 extended precision format.

Reviewed By: thakis

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

4 years ago[ms] [llvm-ml] Add MASM hex float support
Eric Astor [Tue, 29 Sep 2020 20:57:25 +0000 (16:57 -0400)]
[ms] [llvm-ml] Add MASM hex float support

Implement MASM's syntax for specifying floats in raw hexadecimal bytes.

Reviewed By: thakis

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

4 years ago[ms] [llvm-ml] Add support for .radix directive, and accept all radix specifiers
Eric Astor [Tue, 29 Sep 2020 20:17:47 +0000 (16:17 -0400)]
[ms] [llvm-ml] Add support for .radix directive, and accept all radix specifiers

Add support for .radix directive, and radix specifiers [yY] (binary), [oOqQ] (octal), and [tT] (decimal).

Also, when lexing MASM integers, require radix specifier; MASM requires that all literals without a radix specifier be treated as in the default radix. (e.g., 0100 = 100)

Relanding D87400, now with fewer ms-inline-asm tests broken!

Reviewed By: rnk

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

4 years ago[MLIR] Avoid adding debuginfo for a function if it contains calls that has no debug...
Tim Shen [Wed, 23 Sep 2020 06:36:08 +0000 (23:36 -0700)]
[MLIR] Avoid adding debuginfo for a function if it contains calls that has no debug info.

Also add a verifier pass to ExecutionEngine.

It's hard to come up with a test case, since mlir-opt always add location info after parsing it (?)

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

4 years ago[clangd] Trivial setter support when moving items to fields
Nathan James [Tue, 29 Sep 2020 20:51:14 +0000 (21:51 +0100)]
[clangd] Trivial setter support when moving items to fields

Extend the Trivial setter documentation to support cases where the value is moved into a field using `std::move`.

Reviewed By: sammccall, kadircet

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

4 years agoRevert "[Sema] Address-space sensitive check for unbounded arrays (v2)"
Chris Hamilton [Tue, 29 Sep 2020 20:34:46 +0000 (22:34 +0200)]
Revert "[Sema] Address-space sensitive check for unbounded arrays (v2)"

This reverts commit d9ee935679e7164d1c47e351bbbcf5c25742b59c.

4 years agoBetter diagnostics for anonymous bit-fields with attributes or an initializer.
Aaron Ballman [Tue, 29 Sep 2020 20:27:51 +0000 (16:27 -0400)]
Better diagnostics for anonymous bit-fields with attributes or an initializer.

The current C++ grammar allows an anonymous bit-field with an attribute,
but this is ambiguous (the attribute in that case could appertain to the
type instead of the bit-field). The current thinking in the Core Working
Group is that it's better to disallow attributes in that position at the
grammar level so that the ambiguity resolves in favor of applying to the
type.

During discussions about the behavior of the attribute, the Core Working
Group also felt it was better to disallow anonymous bit-fields from
specifying a default member initializer.

This implements both sets of related grammar changes.

4 years ago[libc++] Rename the -fno-rtti Lit feature to just no-rtti
Louis Dionne [Tue, 29 Sep 2020 20:28:41 +0000 (16:28 -0400)]
[libc++] Rename the -fno-rtti Lit feature to just no-rtti

This is consistent to the way we name other Lit features, and it removes
the possibility for confusing the Lit feature with the actual compiler
flag.

4 years ago[lldb] Hoist --server argument out of LLDB_TEST_COMMON_ARGS (NFC)
Jonas Devlieghere [Tue, 29 Sep 2020 20:26:09 +0000 (13:26 -0700)]
[lldb] Hoist --server argument out of LLDB_TEST_COMMON_ARGS (NFC)

Give the server argument its own variable (LLDB_TEST_SERVER) so that we
can configure it in lit.site.cfg.py if we so desire.

4 years ago[libc++] Fix some test failures in unusual configurations
Louis Dionne [Tue, 29 Sep 2020 20:21:20 +0000 (16:21 -0400)]
[libc++] Fix some test failures in unusual configurations

4 years agoFix TODO in the mlir-cpu-runner/bare_ptr_call_conv.mlir test: call ops in bare-ptr...
Mehdi Amini [Tue, 29 Sep 2020 20:19:23 +0000 (20:19 +0000)]
Fix TODO in the mlir-cpu-runner/bare_ptr_call_conv.mlir test: call ops in bare-ptr calling convention is supported now (NFC)

This was fixed in a89fc12653c.

4 years ago[trace] Fix destructor declaration
Walter Erquinigo [Tue, 29 Sep 2020 20:08:22 +0000 (13:08 -0700)]
[trace] Fix destructor declaration

The destructor must be defined in the implementation class so that it
can be called, as Vedant Kumar pointed out in:

'''
What were your thoughts, re:

+class Trace : public PluginInterface {
+public:
+  ~Trace() override = default;

   Does this need to be `virtual ~Trace() = ...`?

      Otherwise, when a std::shared_ptr<Trace> is destroyed, the
      destructor for the derived TraceIntelPT instance won't run.
'''

4 years ago[libc++][ci] Turn on Phabricator reporting by default
Louis Dionne [Thu, 24 Sep 2020 15:45:55 +0000 (11:45 -0400)]
[libc++][ci] Turn on Phabricator reporting by default

4 years ago[lldb/docs] Remove manual codesigning documentation
Dave Lee [Tue, 29 Sep 2020 19:50:38 +0000 (12:50 -0700)]
[lldb/docs] Remove manual codesigning documentation

The `macos-setup-codesign.sh` script has been in place for over two years. If there are no known issues, it's a good time to drop the manual steps from the docs.

Reviewed By: JDevlieghere

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

4 years ago[libc++][ci] Improve the phabricator-report script
Louis Dionne [Tue, 29 Sep 2020 19:29:11 +0000 (15:29 -0400)]
[libc++][ci] Improve the phabricator-report script

- Detect whether a build has passed more accurately
- Retry pushing the status to Phabricator
- Allow running on a non-review branch

4 years ago[libc++][ci] Add a script to describe when to trigger libc++ CI builds
Louis Dionne [Tue, 29 Sep 2020 19:30:42 +0000 (15:30 -0400)]
[libc++][ci] Add a script to describe when to trigger libc++ CI builds

4 years ago[InstCombine] ease alignment restriction for converting masked load to normal load
Sanjay Patel [Tue, 29 Sep 2020 19:25:04 +0000 (15:25 -0400)]
[InstCombine] ease alignment restriction for converting masked load to normal load

I think we initially made this fold conservative to be safer, but we do not
need the alignment attribute/metadata limitation because the masked load
intrinsic itself specifies the alignment. A normal vector load is better for
IR transforms and should be no worse in codegen than the masked alternative.
If it is worse for some target, the backend can reverse this transform.

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

4 years ago[mlir] Support return and call ops in bare-ptr calling convention
Diego Caballero [Tue, 29 Sep 2020 18:11:27 +0000 (11:11 -0700)]
[mlir] Support return and call ops in bare-ptr calling convention

This patch adds support for the 'return' and 'call' ops to the bare-ptr
calling convention. These changes also align the bare-ptr calling
convention code with the latest changes in the default calling convention
and reduce the amount of customization code needed.

Reviewed By: ftynse

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

4 years ago[ValueTracking] Early exit known non zero for phis
Nikita Popov [Tue, 29 Sep 2020 18:48:32 +0000 (20:48 +0200)]
[ValueTracking] Early exit known non zero for phis

After D88276 we no longer expect computeKnownBits() to prove
non-zeroness for cases where isKnownNonZero() can't, so don't
fall through to it.

4 years agoUse "default member initializer" instead of "in-class initializer" for diagnostics.
Aaron Ballman [Tue, 29 Sep 2020 19:03:29 +0000 (15:03 -0400)]
Use "default member initializer" instead of "in-class initializer" for diagnostics.

This changes some diagnostics to use terminology from the standard
rather than invented terminology, which improves consistency with other
diagnostics as well. There are no functional changes intended other
than wording and naming.

4 years ago[CodeGen] emit CG profile for COFF object file
Zequan Wu [Tue, 29 Sep 2020 18:58:37 +0000 (11:58 -0700)]
[CodeGen] emit CG profile for COFF object file

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

4 years agoRevert "Revert "Add the ability to write target stop-hooks using the ScriptInterpreter.""
Jim Ingham [Mon, 28 Sep 2020 17:28:29 +0000 (10:28 -0700)]
Revert "Revert "Add the ability to write target stop-hooks using the ScriptInterpreter.""

This reverts commit f775fe59640a2e837ad059a8f40e26989d4f9831.

I fixed a return type error in the original patch that was causing a test failure.
Also added a REQUIRES: python to the shell test so we'll skip this for
people who build lldb w/o Python.
Also added another test for the error printing.

4 years ago[clangd] Fix assertion in remote-index marshalling
Kadir Cetinkaya [Tue, 29 Sep 2020 18:06:47 +0000 (20:06 +0200)]
[clangd] Fix assertion in remote-index marshalling

convert_to_slash is a no-op on posix style.

4 years ago[MLIR] Add Async dialect with trivial async.region operation
Eugene Zhulenev [Tue, 29 Sep 2020 05:47:00 +0000 (22:47 -0700)]
[MLIR] Add Async dialect with trivial async.region operation

Start Async dialect for modeling asynchronous execution.

Reviewed By: mehdi_amini, herhut

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

4 years ago[gn build] Port 6d193ba3337
LLVM GN Syncbot [Tue, 29 Sep 2020 17:50:16 +0000 (17:50 +0000)]
[gn build] Port 6d193ba3337

4 years agoAdds MLIR C-API for marshaling Python capsules.
Stella Laurenzo [Mon, 28 Sep 2020 16:08:09 +0000 (09:08 -0700)]
Adds MLIR C-API for marshaling Python capsules.

* Providing stable, C-accessible definitions for bridging MLIR Python<->C APIs, we eliminate inter-extension dependencies (i.e. they can all share a diamond dependency on the MLIR C-API).
* Just provides accessors for context and module right now.
* Needed in NPComp in ~a week or so for high level Torch APIs.

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

4 years ago[NFC][regalloc] Unit test for AllocationOrder iteration.
Mircea Trofin [Mon, 28 Sep 2020 23:41:28 +0000 (16:41 -0700)]
[NFC][regalloc] Unit test for AllocationOrder iteration.

Added unittests. In the process, separated core construction - which just
needs the hits, order, and 'HardHints' values - from construction from
current register allocation state, to simplify testing.

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

4 years agoAdd -fprofile-update={atomic,prefer-atomic,single}
Fangrui Song [Tue, 29 Sep 2020 17:38:51 +0000 (10:38 -0700)]
Add -fprofile-update={atomic,prefer-atomic,single}

GCC 7 introduced -fprofile-update={atomic,prefer-atomic} (prefer-atomic is for
best efforts (some targets do not support atomics)) to increment counters
atomically, which is exactly what we have done with -fprofile-instr-generate
(D50867) and -fprofile-arcs (b5ef137c11b1cc6ae839ee75b49233825772bdd0).
This patch adds the option to clang to surface the internal options at driver level.

GCC 7 also turned on -fprofile-update=prefer-atomic when -pthread is specified,
but it has performance regression
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89307). So we don't follow suit.

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

4 years ago[InstCombine] adjust duplicate test for masked load; NFC
Sanjay Patel [Tue, 29 Sep 2020 17:29:34 +0000 (13:29 -0400)]
[InstCombine] adjust duplicate test for masked load; NFC

The test after the changed test was checking exactly the same dereferenceable bytes.

4 years ago[InstCombine] visitTrunc - trunc (*shr (trunc A), C) --> trunc(*shr A, C)
Simon Pilgrim [Tue, 29 Sep 2020 17:27:28 +0000 (18:27 +0100)]
[InstCombine] visitTrunc - trunc (*shr (trunc A), C) --> trunc(*shr A, C)

Attempt to fold trunc (*shr (trunc A), C) --> trunc(*shr A, C) iff the shift amount if small enough that all zero/sign bits created by the shift are removed by the last trunc.

Helps fix the regressions encountered in D88316.

I've tweaked a couple of shift values as suggested by @lebedev.ri to ensure we have coverage of shift values close (above/below) to the max limit.

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

4 years ago[ELF] Fix multiple -mllvm after D70378
Fangrui Song [Tue, 29 Sep 2020 17:25:16 +0000 (10:25 -0700)]
[ELF] Fix multiple -mllvm after D70378

Fixes https://reviews.llvm.org/D70378#2299569 Multiple -mllvm is intended to be supported.

We don't have a proper test for `-plugin-opt=-`. This patch adds the test as well.

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

4 years ago[InstCombine] fix weird formatting in test file; NFC
Sanjay Patel [Tue, 29 Sep 2020 17:20:28 +0000 (13:20 -0400)]
[InstCombine] fix weird formatting in test file; NFC

It apparently didn't cause trouble for the parser or FileCheck,
but it was confusing to see a function def split by asserts.

4 years agoLanaiTargetMachine.h - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 29 Sep 2020 17:14:43 +0000 (18:14 +0100)]
LanaiTargetMachine.h - remove unnecessary includes. NFCI.

4 years agoLanaiSubtarget.h - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 29 Sep 2020 17:14:18 +0000 (18:14 +0100)]
LanaiSubtarget.h - remove unnecessary includes. NFCI.

TargetFrameLowering.h is guaranteed to be covered by LanaiFrameLowering.h

4 years ago[BuildLibCalls] Add noundef to the returned pointers of allocators and argument of...
Juneyoung Lee [Sun, 20 Sep 2020 09:08:27 +0000 (18:08 +0900)]
[BuildLibCalls] Add noundef to the returned pointers of allocators and argument of free

This patch adds noundef to the returned pointers of allocators (malloc, calloc, ...)
and the pointer argument of free.
The returned pointer of allocators cannot be poison or (partially) undef.
Since the pointer that is given to free should precisely have zero offset,
it cannot be poison or (partially) undef too.

For the size arguments of allocators, noundef wasn't attached simply because
I wasn't sure whether attaching it is okay or not.

Reviewed By: jdoerfert

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

4 years ago[mlir][openacc] Add shutdown operation
Valentin Clement [Tue, 29 Sep 2020 17:12:54 +0000 (13:12 -0400)]
[mlir][openacc] Add shutdown operation

This patch introduces the acc.shutdown operation that represents an OpenACC shutdown directive.
Clauses are derived from the spec 2.14.2

Reviewed By: ftynse

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

4 years ago[lldb] Remove redundant ctor call (NFC)
Jonas Devlieghere [Tue, 29 Sep 2020 17:04:15 +0000 (10:04 -0700)]
[lldb] Remove redundant ctor call (NFC)

As pointed out by Pavel in D88249.

4 years ago[clangd] findNearbyIdentifier(): guaranteed to give up after 2^N lines
Aleksandr Platonov [Tue, 29 Sep 2020 16:54:33 +0000 (19:54 +0300)]
[clangd] findNearbyIdentifier(): guaranteed to give up after 2^N lines

As @kadircet mentions in D84912#2184144, `findNearbyIdentifier()` traverses the whole file if there is no identifier for the word.
This patch ensures give up after 2^N lines in any case.

Reviewed By: sammccall

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

4 years ago[libc++][ci] Update how we build the Docker image
Louis Dionne [Tue, 29 Sep 2020 16:48:44 +0000 (12:48 -0400)]
[libc++][ci] Update how we build the Docker image

This fixes a couple of issues, such as failing filesystem tests (due to
running the tests as root), and not running with the GCC we downloaded.

4 years ago[COFF][CG Profile] set undefined symbol to external
Zequan Wu [Tue, 29 Sep 2020 00:17:23 +0000 (17:17 -0700)]
[COFF][CG Profile] set undefined symbol to external

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

4 years ago[flang][msvc] Avoid templated initializer list initialization of vector. NFC.
Michael Kruse [Tue, 29 Sep 2020 16:37:35 +0000 (11:37 -0500)]
[flang][msvc] Avoid templated initializer list initialization of vector. NFC.

The Microsoft compiler emits an error when populating the vector with a single element of a templated argument using the brace syntax. The error is:
```
constant.h(102,1): error C2664: 'std::vector<Fortran::evaluate::value::Complex<...>, ...>::vector(std::initializer_list<_Ty>,const _Alloc &)': cannot convert argument 1 from 'initializer list' to 'std::initializer_list<_Ty>'
```
To work around this error, we replace the templated constructor with one for the expected type. Conversion to the element type has to be done by the caller.

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: klausler

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

4 years ago[libc++] Add a regression test for erasing from a vector
Arthur O'Dwyer [Tue, 29 Sep 2020 16:17:26 +0000 (12:17 -0400)]
[libc++] Add a regression test for erasing from a vector

After rebasing my trivially-relocatable branch, this behavior was broken...
but no libc++ unit test caught it! Add a regression test specifically for
erasing out of a vector.

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

4 years ago[InstCombine] Fix the outofrange tests and add exact shift tests for D88429
Simon Pilgrim [Tue, 29 Sep 2020 16:15:00 +0000 (17:15 +0100)]
[InstCombine] Fix the outofrange tests and add exact shift tests for D88429

4 years ago[InstCombine] visitTrunc - remove dead trunc(lshr (zext A), C) combine. NFCI.
Simon Pilgrim [Tue, 29 Sep 2020 15:54:13 +0000 (16:54 +0100)]
[InstCombine] visitTrunc - remove dead trunc(lshr (zext A), C) combine. NFCI.

I added additional test coverage at rG7a55989dc4305 - but all are handled independently of this combine and http://lab.llvm.org:8080/coverage/coverage-reports/ indicates the code is never used.

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

4 years ago[lldb] Also configure lldb_framework_dir in the lit.site.cfg.py
Jonas Devlieghere [Tue, 29 Sep 2020 16:12:29 +0000 (09:12 -0700)]
[lldb] Also configure lldb_framework_dir in the lit.site.cfg.py

Configuring the variable in CMake isn't enought, because the build mode
can't be resolved until execution time, which requires the build mode to
be substituted by lit.

4 years ago[libc++] Fix tests on GCC 10
Louis Dionne [Tue, 29 Sep 2020 14:49:52 +0000 (10:49 -0400)]
[libc++] Fix tests on GCC 10

Also, remove workarounds for ancient Clangs from is_constructible tests.

4 years ago[lldb] Configure LLDB_FRAMEWORK_DIR in multi-generator builds
Jonas Devlieghere [Tue, 29 Sep 2020 15:56:27 +0000 (08:56 -0700)]
[lldb] Configure LLDB_FRAMEWORK_DIR in multi-generator builds

4 years agoNFC, add a missing stdlib include for the use of abort
Alex Lorenz [Tue, 29 Sep 2020 15:48:07 +0000 (08:48 -0700)]
NFC, add a missing stdlib include for the use of abort

The FatalErrorHandler.cpp file uses 'abort', but doesn't include
'stdlib.h'. This causes a build error when modules are used in clang.

4 years ago[clangd] Disable msan instrumentation for generated Evaluate().
Utkarsh Saxena [Tue, 29 Sep 2020 15:06:13 +0000 (17:06 +0200)]
[clangd] Disable msan instrumentation for generated Evaluate().

MSAN build times out for generated DecisionForest inference runtime.

A solution worth trying is splitting the function into 300 smaller
functions and then re-enable msan.

For now we are disabling instrumentation for the generated function.

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

4 years agoMSP430TargetMachine.h - remove unused includes. NFCI.
Simon Pilgrim [Tue, 29 Sep 2020 15:36:58 +0000 (16:36 +0100)]
MSP430TargetMachine.h - remove unused includes. NFCI.

4 years agoNVPTXTargetMachine.h - remove unused includes. NFCI.
Simon Pilgrim [Tue, 29 Sep 2020 15:29:51 +0000 (16:29 +0100)]
NVPTXTargetMachine.h - remove unused includes. NFCI.

4 years agoSparcSubtarget.h - cleanup include dependencies. NFCI.
Simon Pilgrim [Tue, 29 Sep 2020 15:15:35 +0000 (16:15 +0100)]
SparcSubtarget.h - cleanup include dependencies. NFCI.

TargetFrameLowering.h is guaranteed to be covered by SparcFrameLowering.h

Fix missing implicit Triple.h dependency.

4 years ago[OpenMP][VE plugin] Fixing failure to build VE plugin with consolidated error handlin...
Manoel Roemmer [Tue, 29 Sep 2020 14:21:09 +0000 (16:21 +0200)]
[OpenMP][VE plugin] Fixing failure to build VE plugin with consolidated error handling in libomptarget

The libomptarget VE plugin [[
http://lab.llvm.org:8014/builders/clang-ve-ninja/builds/8937/steps/build-unified-tree/logs/stdio
| fails zu build ]] after ae95ceeb8f98d81f615c69da02f73b5ee6b1519a .

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

4 years ago[scudo][standalone] Fix Primary's ReleaseToOS test
Kostya Kortchinsky [Tue, 29 Sep 2020 00:21:00 +0000 (17:21 -0700)]
[scudo][standalone] Fix Primary's ReleaseToOS test

Said test was flaking on Fuchsia for non-obvious reasons, and only
for ASan variants (the release was returning 0).

It turned out that the templating was off, `true` being promoted to
a `s32` and used as the minimum interval argument. This meant that in
some circumstances, the normal release would occur, and the forced
release would have nothing to release, hence the 0 byte released.

The symbols are giving it away (note the 1):
```
scudo::SizeClassAllocator64<scudo::FixedSizeClassMap<scudo::DefaultSizeClassConfig>,24ul,1,2147483647,false>::releaseToOS(void)
```

This also probably means that there was no MTE version of that test!

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

4 years ago[SVE] Fix typo in CHECK lines for sve-fixed-length-int-reduce.ll
Cameron McInally [Tue, 29 Sep 2020 15:12:58 +0000 (10:12 -0500)]
[SVE] Fix typo in CHECK lines for sve-fixed-length-int-reduce.ll

4 years ago[InstCombine] use redirect of input file in regression tests; NFC
Sanjay Patel [Tue, 29 Sep 2020 15:02:03 +0000 (11:02 -0400)]
[InstCombine] use redirect of input file in regression tests; NFC

This is a repeat of 1880092722 from 2009. We should have less risk
of hitting bugs at this point because we auto-generate positive CHECK
lines only, but this makes things consistent.

Copying the original commit msg:
"Change tests from "opt %s" to "opt < %s" so that opt doesn't see the
input filename so that opt doesn't print the input filename in the
output so that grep lines in the tests don't unintentionally match
strings in the input filename."

4 years ago[mlir][openacc] Add init operation
Valentin Clement [Tue, 29 Sep 2020 14:58:46 +0000 (10:58 -0400)]
[mlir][openacc] Add init operation

This patch introduces the init operation that represents the init executable directive
from the OpenACC 3.0 specifications.

Reviewed By: ftynse

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

4 years ago[InstCombine] Add some basic trunc(lshr(zext(x),c)) tests
Simon Pilgrim [Tue, 29 Sep 2020 14:49:43 +0000 (15:49 +0100)]
[InstCombine] Add some basic trunc(lshr(zext(x),c)) tests

Copied from the sext equivalents

4 years ago[mlir][openacc] Add wait operation
Valentin Clement [Tue, 29 Sep 2020 14:39:13 +0000 (10:39 -0400)]
[mlir][openacc] Add wait operation

This patch introduce the wait operation that represent the OpenACC wait directive.

Reviewed By: ftynse

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

4 years ago[clangd] Improve PopulateSwitch tweak to work on non-empty switches
Tadeo Kondrak [Tue, 29 Sep 2020 14:29:22 +0000 (16:29 +0200)]
[clangd] Improve PopulateSwitch tweak to work on non-empty switches

Improve the recently-added PopulateSwitch tweak to work on non-empty switches.

Reviewed By: sammccall

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

4 years ago[InstCombine] Inherit exact flags on extended shifts in trunc (lshr (sext A), C)...
Simon Pilgrim [Tue, 29 Sep 2020 14:30:46 +0000 (15:30 +0100)]
[InstCombine] Inherit exact flags on extended shifts in trunc (lshr (sext A), C) --> (ashr A, C)

This was missed in D88475

4 years ago[mlir] Expose Dialect class and registration/loading to C API
Alex Zinenko [Tue, 29 Sep 2020 14:23:02 +0000 (16:23 +0200)]
[mlir] Expose Dialect class and registration/loading to C API

- Add a minimalist C API for mlir::Dialect.
- Allow one to query the context about registered and loaded dialects.
- Add API for loading dialects.
- Provide functions to register the Standard dialect.

When used naively, this will require to separately register each dialect. When
we have more than one exposed, we can add variadic macros that expand to
individual calls.

Reviewed By: mehdi_amini

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

4 years ago[InstCombine] Add exact shift tests missed in D88475
Simon Pilgrim [Tue, 29 Sep 2020 14:05:30 +0000 (15:05 +0100)]
[InstCombine] Add exact shift tests missed in D88475

I missed the post-LGTM comment from @lebedev.ri

4 years ago[Sema] Address-space sensitive check for unbounded arrays (v2)
Chris Hamilton [Tue, 29 Sep 2020 14:11:41 +0000 (16:11 +0200)]
[Sema] Address-space sensitive check for unbounded arrays (v2)

Check applied to unbounded (incomplete) arrays and pointers to spot
cases where the computed address is beyond the largest possible
addressable extent of the array, based on the address space in which the
array is delcared, or which the pointer refers to.

Check helps to avoid cases of nonsense pointer math and array indexing
which could lead to linker failures or runtime exceptions.  Of
particular interest when building for embedded systems with small
address spaces.

This is version 2 of this patch -- version 1 had some testing issues
due to a sign error in existing code.  That error is corrected and
lit test for this chagne is extended to verify the fix.

Originally reviewed/accepted by: aaron.ballman
Original revision: https://reviews.llvm.org/D86796

Reviewed By: ebevhan

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

4 years ago[SDAG] Do not convert undef to 0 when folding CONCAT/BUILD_VECTOR
Krzysztof Parzyszek [Thu, 24 Sep 2020 23:59:02 +0000 (18:59 -0500)]
[SDAG] Do not convert undef to 0 when folding CONCAT/BUILD_VECTOR

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

4 years ago[InstCombine] visitTrunc - trunc (lshr (sext A), C) --> (ashr A, C) non-uniform support
Simon Pilgrim [Tue, 29 Sep 2020 13:45:30 +0000 (14:45 +0100)]
[InstCombine] visitTrunc - trunc (lshr (sext A), C) --> (ashr A, C) non-uniform support

This came from @lebedev.ri's suggestion to use m_SpecificInt_ICMP for D88429 - since I was going to change the m_APInt to m_Constant for that patch I thought I would do it for the only other user of the APInt first.

I've added a ConstantExpr::getUMin helper - its trivial to add UMAX/SMIN/SMAX but thought I'd wait until we have use cases.

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

4 years ago[mlir][openacc] Add update operation
Valentin Clement [Tue, 29 Sep 2020 13:56:54 +0000 (09:56 -0400)]
[mlir][openacc] Add update operation

This patch introduce the update operation that represent the OpenACC update directive.

Reviewed By: ftynse

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