platform/upstream/llvm.git
3 years ago[AArch64][GlobalISel] Add AArch64::G_DUPLANE[X] opcodes for lane duplicates.
Amara Emerson [Thu, 5 Nov 2020 05:21:39 +0000 (21:21 -0800)]
[AArch64][GlobalISel] Add AArch64::G_DUPLANE[X] opcodes for lane duplicates.

These were previously handled by pattern matching shuffles in the selector, but
adding a new opcode and making it equivalent to the AArch64duplane SDAG node
allows us to select more patterns, like lane indexed FMLAs (patch adding a test
for that will be committed later).

The pattern matching code has been simply moved to postlegalize lowering.

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

3 years ago[libc] Fix WrapperGen seeing no arguments as a void argument.
Michael Jones [Wed, 4 Nov 2020 22:58:25 +0000 (22:58 +0000)]
[libc] Fix WrapperGen seeing no arguments as a void argument.

This corrects WrapperGen generating incorrect wrappers for functions
that take no arguments. Previously it would generate a wrapper with a
single argument of type `void`.

Reviewed By: sivachandra

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

3 years ago[gn build] (manually) port 82f86ae01 more
Nico Weber [Thu, 5 Nov 2020 19:12:33 +0000 (14:12 -0500)]
[gn build] (manually) port 82f86ae01 more

3 years ago[gn build] (manually) port 82f86ae01
Nico Weber [Thu, 5 Nov 2020 19:11:26 +0000 (14:11 -0500)]
[gn build] (manually) port 82f86ae01

3 years ago[LegalizeTypes] Remove unnecessary if around switch in ScalarizeVectorOperand and...
Craig Topper [Thu, 5 Nov 2020 18:58:42 +0000 (10:58 -0800)]
[LegalizeTypes] Remove unnecessary if around switch in ScalarizeVectorOperand and SplitVectorOperand. NFC

The if was checking !Res.getNode() but that's always true since
Res was initialized to SDValue() and not touched before the if.

This appears to be a leftover from a previous implementation of
Custom legalization where Res was updated instead of returning
immediately.

3 years agoAPINotes: add APINotesYAMLCompiler
Saleem Abdulrasool [Mon, 28 Sep 2020 20:26:02 +0000 (20:26 +0000)]
APINotes: add APINotesYAMLCompiler

This adds the skeleton of the YAML Compiler for APINotes.  This change
only adds the YAML IO model for the API Notes along with a new testing
tool `apinotes-test` which can be used to verify that can round trip the
YAML content properly.  It provides the basis for the future work which
will add a binary serialization and deserialization format to the data
model.

This is based on the code contributed by Apple at
https://github.com/llvm/llvm-project-staging/tree/staging/swift/apinotes.

Differential Revision: https://reviews.llvm.org/D88859
Reviewed By: Gabor Marton

3 years agoAdd default value for MachineInstr::modifiesRegister. NFC.
Momchil Velikov [Thu, 5 Nov 2020 18:48:47 +0000 (18:48 +0000)]
Add default value for MachineInstr::modifiesRegister. NFC.

Looks accidentally omitted, it's present on `readsRegister`,
`definesRegister` and few others.

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

3 years ago[RISCV] Use the 'si' lib call for (double (fp_to_sint/uint i32 X)) when F extension...
Craig Topper [Thu, 5 Nov 2020 18:07:03 +0000 (10:07 -0800)]
[RISCV] Use the 'si' lib call for (double (fp_to_sint/uint i32 X)) when F extension is enabled.

D80526 added custom lowering to pick the si lib call on RV64, but this custom handling is only enabled when the F and D extension are both disabled. This prevents the si library call from being used for double when F is enabled but D is not.

This patch changes the behavior so we always enable the Custom hook on RV64 and decide in ReplaceNodeResults if we should emit a libcall based on whether the FP type should be softened or not.

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

3 years ago[AMDGPU] Add default 1 glc operand to rtn atomics
Stanislav Mekhanoshin [Wed, 4 Nov 2020 00:21:36 +0000 (16:21 -0800)]
[AMDGPU] Add default 1 glc operand to rtn atomics

This change adds a real glc operand to the return atomic
instead of just string " glc" in the middle of the asm
string.

Improves asm parser diagnostics.

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

3 years ago[NFC] Add InitializePlatformCommonFlags for Fuchsia
Leonard Chan [Thu, 5 Nov 2020 18:37:08 +0000 (10:37 -0800)]
[NFC] Add InitializePlatformCommonFlags for Fuchsia

https://reviews.llvm.org/D90811 is breaking our CI builders because
InitializePlatformCommonFlags is not defined. This just adds an empty definition.

This would've been caught on our upstream buildbot, but it's red at the moment
and most likely won't be sending out alert emails for recent failures.

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

3 years ago[flang][f18] Remove unimplemented options (NFC)
Andrzej Warzynski [Thu, 5 Nov 2020 18:33:27 +0000 (18:33 +0000)]
[flang][f18] Remove unimplemented options (NFC)

These options are in practice passes to the external tool (defined with
F18_FC), i.e. fall into "unrecognised" category. No need to keep them
among other options that are actually parsed.

3 years ago[Sema] Special case -Werror-implicit-function-declaration and reject other -Werror-
Fangrui Song [Thu, 5 Nov 2020 18:25:30 +0000 (10:25 -0800)]
[Sema] Special case -Werror-implicit-function-declaration and reject other -Werror-

This is the only -Werror- form warning option GCC supports (gcc/c-family/c.opt).
Fortunately no other form is used anywhere.

3 years ago[clangd] Trivial: Log missing completion signals.
Utkarsh Saxena [Thu, 5 Nov 2020 07:47:21 +0000 (08:47 +0100)]
[clangd] Trivial: Log missing completion signals.

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

3 years ago[RISCV] Remove shadow register list passed to AllocateReg when allocating FP register...
Craig Topper [Thu, 5 Nov 2020 17:48:07 +0000 (09:48 -0800)]
[RISCV] Remove shadow register list passed to AllocateReg when allocating FP registers for calling convention

The _F and _D registers are already sub/super registers. When one gets allocated all its aliases are already marked as allocated. We don't need to explicitly shadow it too.

I believe shadow is for calling conventions like 64-bit Windows on X86 where have rules like this

CCIfType<[i32], CCAssignToRegWithShadow<[ECX , EDX , R8D , R9D ],
                                         [XMM0, XMM1, XMM2, XMM3]>>

For that calling convention the argument number determines which register is used regardless of how many scalars or vectors came before it.

Removing this removes a question I had in D90738.

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

3 years ago[RISCV] Add isel patterns for fshl with immediate to select FSRI/FSRIW
Craig Topper [Thu, 5 Nov 2020 17:37:43 +0000 (09:37 -0800)]
[RISCV] Add isel patterns for fshl with immediate to select FSRI/FSRIW

There is no FSLI instruction, but we can emulate it using FSRI by swapping operands and subtracting the immediate from the bitwidth.

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

3 years ago[libc++] Rework the whole availability markup implementation
Louis Dionne [Wed, 4 Nov 2020 20:01:25 +0000 (15:01 -0500)]
[libc++] Rework the whole availability markup implementation

Currently, vendor-specific availability markup is enabled by default.
This means that even when building against trunk libc++, the headers
will by default prevent you from using some features that were not
released in the dylib on your target platform. This is a source of
frustration since people building libc++ from sources are usually not
trying to use some vendor's released dylib.

For that reason, I've been thinking for a long time that availability
annotations should be off by default, which is the primary change that
this commit enables.

In addition, it reworks the implementation to make it easier for new
vendors to add availability annotations for their platform, and it
refreshes the documentation to reflect the current state of the codebase.

Finally, a CMake configuration option is added to control whether
availability annotations should be turned on for the flavor of libc++
being created. The intent is for vendors like Apple to turn it on, and
for the upstream libc++ to leave it off (the default).

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

3 years agoRevert "[CaptureTracking] Avoid overly restrictive dominates check"
Anna Thomas [Thu, 5 Nov 2020 17:26:36 +0000 (12:26 -0500)]
Revert "[CaptureTracking] Avoid overly restrictive dominates check"

This reverts commit 15694fd6ad955c6a16b446a6324364111a49ae8b.
Need to investigate and fix a failing clang test: synchronized.m.
Might need a test update.

3 years agoscudo: Don't memset previously released cached pages in the secondary allocator.
Peter Collingbourne [Wed, 4 Nov 2020 02:00:40 +0000 (18:00 -0800)]
scudo: Don't memset previously released cached pages in the secondary allocator.

There is no need to memset released pages because they are already
zero. On db845c, before:

BM_stdlib_malloc_free_default/131072      34562 ns        34547 ns        20258 bytes_per_second=3.53345G/s

after:

BM_stdlib_malloc_free_default/131072      29618 ns        29589 ns        23485 bytes_per_second=4.12548G/s

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

3 years ago[OpenMP] Add ident_t flags for compiler OpenMP version
Peyton, Jonathan L [Mon, 2 Nov 2020 18:28:13 +0000 (12:28 -0600)]
[OpenMP] Add ident_t flags for compiler OpenMP version

This patch adds the mask and ident_t function to get the
openmp version. It also adds logic to force monotonic:dynamic
behavior when OpenMP version less than 5.0.

The OpenMP version is stored in the format:
major*10+minor e.g., OpenMP 5.0 = 50

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

3 years ago[DAG] computeKnownBits - Replace ISD::SREM handling with KnownBits::srem to reduce...
Simon Pilgrim [Thu, 5 Nov 2020 15:44:38 +0000 (15:44 +0000)]
[DAG] computeKnownBits - Replace ISD::SREM handling with KnownBits::srem to reduce code duplication

3 years ago[GlobalISel] Don't use Register type for getNumOperands(). NFCI.
Simon Pilgrim [Thu, 5 Nov 2020 15:34:55 +0000 (15:34 +0000)]
[GlobalISel] Don't use Register type for getNumOperands(). NFCI.

Copy+Paste typo - we were storing getNumOperands() opcounts in a Register type instead of just an unsigned.

3 years ago[mlir] Fix missing namespaces in OpBuildGen.cpp
Alexander Belyaev [Thu, 5 Nov 2020 16:55:00 +0000 (17:55 +0100)]
[mlir]  Fix missing namespaces in OpBuildGen.cpp

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

3 years ago[IndVarSimplify][SimplifyIndVar] Move WidenIV to Utils/SimplifyIndVar. NFCI.
Sjoerd Meijer [Thu, 5 Nov 2020 15:56:19 +0000 (15:56 +0000)]
[IndVarSimplify][SimplifyIndVar] Move WidenIV to Utils/SimplifyIndVar. NFCI.

This moves WidenIV from IndVarSimplify to Utils/SimplifyIndVar so that we have
createWideIV available as a generic helper utility. I.e., this is not only
useful in IndVarSimplify, but could be useful for loop transformations. For
example, motivation for this refactoring is the loop flatten transformation: if
induction variables in a loop nest can be widened, we can avoid having to
perform certain overflow checks, enabling this transformation.

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

3 years ago[lldb] Enable FreeBSDRemote plugin by default and update test status
Michał Górny [Wed, 4 Nov 2020 09:16:30 +0000 (10:16 +0100)]
[lldb] Enable FreeBSDRemote plugin by default and update test status

The new FreeBSDRemote plugin has reached feature parity on i386
and amd64 targets.  Use it by default on these architectures, while
allowing the use of the legacy plugin via FREEBSD_LEGACY_PLUGIN envvar.

Revisit the method of switching plugins.  Apparently, the return value
of PlatformFreeBSD::CanDebugProcess() is what really decides whether
the legacy or the new plugin is used.

Update the test status.  Reenable the tests that were previously
disabled on FreeBSD and do not cause hangs or are irrelevant to FreeBSD.
Mark all tests that fail reliably as expectedFailure.  For now, tests
that are flaky (i.e. produce unstable results) are left enabled
and cause unpredictable test failures.

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

3 years ago[lldb] [test/Shell] Simplify -pthread condition
Michał Górny [Wed, 4 Nov 2020 23:10:06 +0000 (00:10 +0100)]
[lldb] [test/Shell] Simplify -pthread condition

Pass -pthread on all systems except for Darwin and Windows.
Suggested by Pavel Labath.

3 years ago[CaptureTracking] Avoid overly restrictive dominates check
Anna Thomas [Tue, 3 Nov 2020 16:06:41 +0000 (11:06 -0500)]
[CaptureTracking] Avoid overly restrictive dominates check

CapturesBefore tracker has an overly restrictive dominates check when
the `BeforeHere` and the capture point are in different basic blocks.
All we need to check is that there is no path from the capture point
to `BeforeHere` (which is less stricter than the dominates check).
See added testcase in one of the users of CapturesBefore.

Reviewed-By: jdoerfert
Differential Revision: https://reviews.llvm.org/D90688

3 years ago[lldb][NFC] Fix compiler warnings after removal of eValueTypeVector
Raphael Isemann [Thu, 5 Nov 2020 16:11:38 +0000 (17:11 +0100)]
[lldb][NFC] Fix compiler warnings after removal of eValueTypeVector

5d64574301836c4c17127794121d49a62d24f803 removes this enum value and now
all the switch statements that previously relied on handling this in the
'default' branch are causes compiler warnings due to redundant default cases.

This just removes the now unreachable code in there.

3 years ago[lldb] Set the default architecture also in buildDefault
Raphael Isemann [Thu, 5 Nov 2020 15:13:20 +0000 (16:13 +0100)]
[lldb] Set the default architecture also in buildDefault

In D89056 the default value for architecture was moved to `build` so that
all called functions see the same architecture value. It seems there are a
few functions that call buildDefault directly (and not via build), so
on some test configurations that set a custom arch value the architecture
value is no longer available.

This just adds the architecture code from build to buildDefault to get
the bots green again while I'm looking for a better solution.

3 years agoImplement Lambda Conversion Operators for All CCs for MSVC.
Erich Keane [Mon, 2 Nov 2020 15:43:45 +0000 (07:43 -0800)]
Implement Lambda Conversion Operators for All CCs for MSVC.

As described here:
https://devblogs.microsoft.com/oldnewthing/20150220-00/?p=44623

In order to allow Lambdas to be used with traditional Win32 APIs, they
emit a conversion function for (what Raymond Chen claims is all) a
number of the calling conventions.  Through experimentation, we
discovered that the list isn't quite 'all'.

This patch implements this by taking the list of conversions that MSVC
emits (across 'all' architectures, I don't see any CCs on ARM), then
emits them if they are supported by the current target.

However, we also add 3 other options (which may be duplicates):
free-function, member-function, and operator() calling conventions.  We
do this because we have an extension where we generate both free and
member for these cases so th at people specifying a calling convention
on the lambda will have the expected behavior when specifying one of
those two.

MSVC doesn't seem to permit specifying calling-convention on lambdas,
but we do, so we need to make sure those are emitted as well. We do this
so that clang-only conventions are supported if the user specifies them.

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

3 years ago[gn build] Port 659f4bd87ef
LLVM GN Syncbot [Thu, 5 Nov 2020 15:11:13 +0000 (15:11 +0000)]
[gn build] Port 659f4bd87ef

3 years ago[clang] Add an option for hiding line numbers in diagnostics
Raphael Isemann [Thu, 5 Nov 2020 14:41:09 +0000 (15:41 +0100)]
[clang] Add an option for hiding line numbers in diagnostics

Clang offers a `-f[no]-show-column` flag for hiding the column numbers when
printing diagnostics but there is no option for doing the same with line
numbers.

In LLDB having this option would be useful, as LLDB sometimes only knows the
file name for a SourceLocation and just assigns it the dummy line/column `1:1`.
These fake line/column numbers are confusing to the user and LLDB should be able
to tell clang to hide *both* the column and the line number when rendering text
diagnostics.

This patch adds a flag for also hiding the line numbers. It's not exposed via
the command line flags as it's most likely not very useful for any user and can
lead to ambiguous output when the user decides to only hide either the line or
the column number (where `file:1: ...` could now refer to both line 1 or column
1 depending on the compiler flags). LLDB can just access the DiagnosticOptions
directly when constructing its internal Clang instance.

The effect doesn't apply to Vi/MSVC style diagnostics because it's not defined
how these diagnostic styles would show an omitted line number (MSVC doesn't have
such an option and Vi's line mode is theory only supporting line numbers if I
understand it correctly).

Reviewed By: thakis, MaskRay

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

3 years ago[FileCheck] Use %ProtectFileCheckOutput in allow-unused-prefixes.txt
Mircea Trofin [Mon, 2 Nov 2020 18:26:28 +0000 (10:26 -0800)]
[FileCheck] Use %ProtectFileCheckOutput in allow-unused-prefixes.txt

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

3 years ago[KnownBits] Move ValueTracking SREM KnownBits handling to KnownBits::srem. NFCI.
Simon Pilgrim [Thu, 5 Nov 2020 14:55:42 +0000 (14:55 +0000)]
[KnownBits] Move ValueTracking SREM KnownBits handling to KnownBits::srem. NFCI.

Move the ValueTracking implementation to KnownBits, the SelectionDAG version is more limited so I'm intending to replace that as a separate commit.

3 years ago[lldb] Add Apple simulator platforms to lldbplatform.py
Raphael Isemann [Thu, 5 Nov 2020 14:32:03 +0000 (15:32 +0100)]
[lldb] Add Apple simulator platforms to lldbplatform.py

This just adds the simulator platforms to the lldbplatform enumerations
and the respective test decorator.

The platform names for the simulator are just the SDK names since D85537, so
that's why we are not using LLDB's usual platform names here (e.g., SDK =
"iphonesimulator" vs LLDB platform ="ios-simulator").

Also removes the duplicate platform enumaration in lldbplatformutil.py.

Reviewed By: JDevlieghere

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

3 years ago[KnownBits] Move ValueTracking/SelectionDAG UREM KnownBits handling to KnownBits...
Simon Pilgrim [Thu, 5 Nov 2020 14:29:13 +0000 (14:29 +0000)]
[KnownBits] Move ValueTracking/SelectionDAG UREM KnownBits handling to KnownBits::urem. NFCI.

Both these have the same implementation - so move them to a single KnownBits copy.

GlobalISel will be able to use this as well with minimal effort.

3 years ago[mlir] Move TestDialect and its passes to mlir::test namespace.
Alexander Belyaev [Wed, 4 Nov 2020 21:18:26 +0000 (22:18 +0100)]
[mlir] Move TestDialect and its passes to mlir::test namespace.

TestDialect has many operations and they all live in ::mlir namespace.
Sometimes it is not clear whether the ops used in the code for the test passes
belong to Standard or to Test dialects.

Also, with this change it is easier to understand what test passes registered
in mlir-opt are actually passes in mlir/test.

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

3 years ago[sanitizers] Remove the test case involving `new int[0]`
Vy Nguyen [Thu, 5 Nov 2020 05:27:38 +0000 (00:27 -0500)]
[sanitizers] Remove the test case involving `new int[0]`

Bionic doesn't acutally allocate any memory in this case, so there won't be a leak on Android.

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

3 years agoReland [lldb] Explicitly use the configuration architecture when building test execut...
Raphael Isemann [Thu, 22 Oct 2020 13:10:22 +0000 (15:10 +0200)]
Reland [lldb] Explicitly use the configuration architecture when building test executables

This originally broke the TestQuoting which explicitly called buildDefault
instead of calling build() and marking the test as no_debug_info_test.
TestQuoting has been rewritten by now and is using `build`, so this should now
pass on all platforms.

Original summary:

The Darwin builder currently assumes in `getArchCFlags` that the passed `arch`
value is an actual string it can string.join with vendor/os/version/env strings:

```
   triple = '-'.join([arch, vendor, os, version, env])
```

However this is not true for most tests as we just pass down the `arch=None`
default value from `TestBase.build`. This causes that if we actually end up in
this function we just error out when concatenating `None` with the other actual
strings of vendor/os/version/env. What we should do instead is check that if
there is no test-specific architecture that we fall back to the configuration's
architecture value.

It seems we already worked around this in `builder.getArchSpec` by explicitly
falling back to the architecture specified in the configuration.

This patch just moves this fallback logic to the top `build` function so that it
affects all functions called from `TestBase.build`.

Reviewed By: JDevlieghere

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

3 years ago[lldb] Skip TestChangeProcessGroup on watchOS/tvOS
Raphael Isemann [Thu, 5 Nov 2020 14:09:38 +0000 (15:09 +0100)]
[lldb] Skip TestChangeProcessGroup on watchOS/tvOS

`fork` is marked as `__WATCHOS_PROHIBITED __TVOS_PROHIBITED` so the test source
which is calling fork will never compile on watchOS/tvOS. This just adds the
skip decorator for these platforms.

Reviewed By: mib

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

3 years ago[TableGen] Add true and false literals to represent booleans
Paul C. Anagnostopoulos [Mon, 2 Nov 2020 17:37:25 +0000 (12:37 -0500)]
[TableGen] Add true and false literals to represent booleans

Update the Programmer's Reference document.

Add a test. Update a couple of tests with an improved error message.

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

3 years ago[libc++] Correct XFAILs for the C++20 Synchronization Library
Louis Dionne [Thu, 5 Nov 2020 13:44:38 +0000 (08:44 -0500)]
[libc++] Correct XFAILs for the C++20 Synchronization Library

Technically, these tests don't only fail against macosx10.9 to 10.15,
but really against any released macOS yet.

3 years ago[KnownBits] Move ValueTracking/SelectionDAG UDIV KnownBits handling to KnownBits...
Simon Pilgrim [Thu, 5 Nov 2020 13:42:27 +0000 (13:42 +0000)]
[KnownBits] Move ValueTracking/SelectionDAG UDIV KnownBits handling to KnownBits::udiv. NFCI.

Both these have the same implementation - so move them to a single KnownBits copy.

GlobalISel will be able to use this as well with minimal effort.

3 years ago[lldb] Also Catch invalid calls to TestPExpectTest's expect()
Raphael Isemann [Thu, 5 Nov 2020 12:41:26 +0000 (13:41 +0100)]
[lldb] Also Catch invalid calls to TestPExpectTest's expect()

This is a follow up to D88792 which found an issue in a call to PExpectTest's
expect function that allows passing a string to the `substrs` parameter. However
this issue was found by just grepping and TestPExpect's expect function is still
accepting a single string as a value to `substrs`.

This patch adds the same sanity check that D88792 added to the PExpectTest's
implementation of `expect` and also adds a small test for it.

Reviewed By: kastiglione, JDevlieghere

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

3 years ago[Flang][f18] Remove unimplemented options from `flang -help` (NFC)
Andrzej Warzynski [Thu, 5 Nov 2020 12:34:42 +0000 (12:34 +0000)]
[Flang][f18] Remove unimplemented options from `flang -help` (NFC)

3 years ago[GVN] Fix MemorySSA update when replacing assume(false) with stores.
Florian Hahn [Thu, 5 Nov 2020 11:51:06 +0000 (11:51 +0000)]
[GVN] Fix MemorySSA update when replacing assume(false) with stores.

When replacing an assume(false) with a store, we have to be more careful
with the order we insert the new access. This patch updates the code to
look at the accesses in the block to find a suitable insertion point.

Alterantively we could check the defining access of the assume, but IIRC
there has been some discussion about making assume() readnone, so
looking at the access list might be more future proof.

Fixes PR48072.

Reviewed By: asbirlea

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

3 years ago[OpenCL] Support vec_step in C++ for OpenCL mode
Sven van Haastregt [Thu, 5 Nov 2020 12:02:59 +0000 (12:02 +0000)]
[OpenCL] Support vec_step in C++ for OpenCL mode

Enable the vec_step builtin in C++ for OpenCL mode for compatibility
with OpenCL C.

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

3 years ago[GlobalISel] ComputeKnownBits - use common KnownBits shift handling (PR44526)
Simon Pilgrim [Thu, 5 Nov 2020 11:52:07 +0000 (11:52 +0000)]
[GlobalISel] ComputeKnownBits - use common KnownBits shift handling (PR44526)

Convert GISelKnownBits.computeKnownBitsImpl shift handling to use the common KnownBits implementations, which makes use of the known leading/trailing bits for shifted values in cases where we don't know the shift amount value, as detailed in https://blog.regehr.org/archives/1709

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

3 years ago[lsan] Disable some LSAN tests for arm-linux-gnueabi{hf}
Adhemerval Zanella [Mon, 2 Nov 2020 17:42:24 +0000 (14:42 -0300)]
[lsan] Disable some LSAN tests for arm-linux-gnueabi{hf}

The tests do not report the expected leak when issued with use_stack
or use_tls option equal to 0 on arm-linux-gnueabihf (ubuntu 18.04,
glibc 2.27).

This issue is being tracked by https://bugs.llvm.org/show_bug.cgi?id=48052

3 years ago[sanitizer] Assume getrandom might not be supported by the kernel
Adhemerval Zanella [Mon, 2 Nov 2020 17:38:12 +0000 (14:38 -0300)]
[sanitizer] Assume getrandom might not be supported by the kernel

It was added on kernel 3.17.

3 years ago[OpenMP] avoid warning: equality comparison with extraneous parentheses
Joachim Protze [Thu, 5 Nov 2020 09:50:17 +0000 (10:50 +0100)]
[OpenMP] avoid warning: equality comparison with extraneous parentheses

The macros are used in several places with an if(macro) pattern. This results
in several warnings about extraneous parenteses in equality comparison.

Having the constant at the lhs of the comparison, avoids this warning.

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

3 years ago[SVE] Return StackOffset for TargetFrameLowering::getFrameIndexReference.
Sander de Smalen [Wed, 4 Nov 2020 08:56:54 +0000 (08:56 +0000)]
[SVE] Return StackOffset for TargetFrameLowering::getFrameIndexReference.

To accommodate frame layouts that have both fixed and scalable objects
on the stack, describing a stack location or offset using a pointer + uint64_t
is not sufficient. For this reason, we've introduced the StackOffset class,
which models both the fixed- and scalable sized offsets.

The TargetFrameLowering::getFrameIndexReference is made to return a StackOffset,
so that this can be used in other interfaces, such as to eliminate frame indices
in PEI or to emit Debug locations for variables on the stack.

This patch is purely mechanical and doesn't change the behaviour of how
the result of this function is used for fixed-sized offsets. The patch adds
various checks to assert that the offset has no scalable component, as frame
offsets with a scalable component are not yet supported in various places.

Reviewed By: arsenm

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

3 years agoRevert rGbbeb08497ce58 "Revert "[GlobalISel] GISelKnownBits::computeKnownBitsImpl...
Simon Pilgrim [Thu, 5 Nov 2020 10:39:53 +0000 (10:39 +0000)]
Revert rGbbeb08497ce58 "Revert "[GlobalISel] GISelKnownBits::computeKnownBitsImpl - Replace TargetOpcode::G_MUL handling with the common KnownBits::computeForMul implementation""

Updated the GISel KnownBits tests as KnownBits::computeForMul allows more accurate computation.

3 years ago[UnitTests] Add exhaustive tests for KnownBits shl/lshr/ashr
Simon Pilgrim [Wed, 4 Nov 2020 18:19:26 +0000 (18:19 +0000)]
[UnitTests] Add exhaustive tests for KnownBits shl/lshr/ashr

Thanks to @foad for the suggestion.

3 years ago[InstCombine] Remove orphan InstCombinerImpl method declarations. NFCI.
Simon Pilgrim [Wed, 4 Nov 2020 17:34:08 +0000 (17:34 +0000)]
[InstCombine] Remove orphan InstCombinerImpl method declarations. NFCI.

3 years ago[SyntaxTree] Add reverse links to syntax Nodes.
Eduardo Caldas [Tue, 27 Oct 2020 15:14:03 +0000 (15:14 +0000)]
[SyntaxTree] Add reverse links to syntax Nodes.

Rationale:
Children of a syntax tree had forward links only, because there was no
need for reverse links.

This need appeared when we started mutating the syntax tree.
On a forward list, to remove a target node in O(1) we need a pointer to the node before the target. If we don't have this "before" pointer, we have to find it, and that requires O(n).
So in order to remove a syntax node from a tree, we would similarly need to find the node before to then remove. This is both not ergonomic nor does it have a good complexity.

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

3 years ago[mlir] Restructure C API tests for IR
Alex Zinenko [Wed, 4 Nov 2020 09:30:00 +0000 (10:30 +0100)]
[mlir] Restructure C API tests for IR

The test file is a long list of functions, followed by equally long FileCheck
comments inside "main". Distribute FileCheck comments closer to the functions
that produce the output we are checking.

Reviewed By: mehdi_amini, stellaraccident

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

3 years ago[mlir][Linalg] Side effects interface for Linalg ops
Nicolas Vasilache [Thu, 5 Nov 2020 08:17:15 +0000 (08:17 +0000)]
[mlir][Linalg] Side effects interface for Linalg ops

The LinalgDependenceGraph and alias analysis provide the necessary analysis for the Linalg fusion on buffers case.

However this is not enough for linalg on tensors which require proper memory effects to play nicely with DCE and other transformations.
This revision adds side effects to Linalg ops that were previously missing and has 2 consequences:
1. one example in the copy removal pass now fails since the linalg.generic op has side effects and the pass does not perform alias analysis / distinguish between reads and writes.
2. a few examples in fusion-tensor.mlir need to return the resulting tensor otherwise DCE automatically kicks in as part of greedy pattern application.

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

3 years ago[flang] update ODS syntax to use OpBuidlerDAG instead of OpBuilder
Alex Zinenko [Tue, 27 Oct 2020 11:59:22 +0000 (12:59 +0100)]
[flang] update ODS syntax to use OpBuidlerDAG instead of OpBuilder

Upstream MLIR has deprecated OpBuilder in ODS.

Reviewed By: schweitz

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

3 years ago[ARM] Make tests less dependent on scheduling. NFC
David Green [Thu, 5 Nov 2020 08:26:55 +0000 (08:26 +0000)]
[ARM] Make tests less dependent on scheduling. NFC

3 years ago[mlir][spirv] Add VectorExtractDynamicOp and vector.extractelement lowering
Artur Bialas [Thu, 5 Nov 2020 07:26:54 +0000 (08:26 +0100)]
[mlir][spirv] Add VectorExtractDynamicOp and vector.extractelement lowering

VectorExtractDynamicOp in SPIRV dialect
conversion from vector.extractelement to spirv VectorExtractDynamicOp

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

3 years ago[mlir][spirv] Allow usage of vector size 8 and 16 with Vector16 capability
Artur Bialas [Thu, 5 Nov 2020 07:26:15 +0000 (08:26 +0100)]
[mlir][spirv] Allow usage of vector size 8 and 16 with Vector16 capability

Per spec, vector sizes 8 and 16 are allowed when Vector16 capability is present.
This change expands the limitation of vector sizes to accept these sizes.

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

3 years ago[test] Add 'REQUIRES: bpf-registered-target' to bpf-O0.c
Arthur Eubanks [Thu, 5 Nov 2020 07:18:48 +0000 (23:18 -0800)]
[test] Add 'REQUIRES: bpf-registered-target' to bpf-O0.c

3 years ago[NFC] Fix cpplint warnings
Vitaly Buka [Thu, 5 Nov 2020 06:56:08 +0000 (22:56 -0800)]
[NFC] Fix cpplint warnings

3 years ago[LSAN] Fix compilation error on MSVC
Vitaly Buka [Thu, 5 Nov 2020 06:32:49 +0000 (22:32 -0800)]
[LSAN] Fix compilation error on MSVC

3 years agoRevert "[LSAN] Fix preprocessor condition for MSVC"
Vitaly Buka [Thu, 5 Nov 2020 06:31:36 +0000 (22:31 -0800)]
Revert "[LSAN] Fix preprocessor condition for MSVC"

Missread the error message. It was not the reason.

This reverts commit 2d041554d1f94abed3ddd396d8af944acf63fe4e.

3 years ago[LSAN] Fix preprocessor condition for MSVC
Vitaly Buka [Thu, 5 Nov 2020 06:27:35 +0000 (22:27 -0800)]
[LSAN] Fix preprocessor condition for MSVC

3 years ago[NewPM] Provide method to run all pipeline callbacks, used for -O0
Arthur Eubanks [Fri, 30 Oct 2020 16:35:32 +0000 (09:35 -0700)]
[NewPM] Provide method to run all pipeline callbacks, used for -O0

    Some targets may add required passes via
    TargetMachine::registerPassBuilderCallbacks(). We need to run those even
    under -O0. As an example, BPFTargetMachine adds
    BPFAbstractMemberAccessPass, a required pass.

    This also allows us to clean up BackendUtil.cpp (and out-of-tree Rust
    usage of the NPM) by allowing us to share added passes like coroutines
    and sanitizers between -O0 and other optimization levels.

    Tests are a continuation of those added in
    https://reviews.llvm.org/D89083.

    In order to prevent TargetMachines from adding unnecessary optimization
    passes at -O0, TargetMachine::registerPassBuilderCallbacks() will be
    changed to take an OptimizationLevel, but that will be done separately.

Reviewed By: asbirlea

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

3 years ago[LSAN] Enabled only with __ANDROID_API__ >= 28
Vitaly Buka [Thu, 5 Nov 2020 05:42:51 +0000 (21:42 -0800)]
[LSAN] Enabled only with __ANDROID_API__ >= 28

Code does not work as-is with emulated tls even if
lsan is disabled with runtime flag.

3 years agoCapture the name for mlir::OpPassManager in std::string instead of StringRef (NFC)
Mehdi Amini [Thu, 5 Nov 2020 03:09:20 +0000 (03:09 +0000)]
Capture the name for mlir::OpPassManager in std::string instead of StringRef (NFC)

The previous behavior was fragile when building an OpPassManager using a
string, as it was forcing the client to ensure the string to outlive the
entire PassManager.
This isn't a performance sensitive area either that would justify
optimizing further.

3 years ago[sanitizers] Add missing definition
Vy Nguyen [Thu, 5 Nov 2020 05:19:38 +0000 (00:19 -0500)]
[sanitizers] Add missing definition

Fix breakages from https://reviews.llvm.org/D90811

http://lab.llvm.org:8011/#/builders/37/builds/471/steps/8/logs/stdio

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

3 years ago[Driver] Add callback to Command execution
Serge Pavlov [Fri, 24 Apr 2020 05:48:39 +0000 (12:48 +0700)]
[Driver] Add callback to Command execution

Summary:
Object of type `Compilation` now can keep a callback that is called
after each execution of `Command`. This must simplify adaptation of
clang in custom distributions and allow facilities like collection of
execution statistics.

Reviewers: rsmith, rjmccall, Eugene.Zelenko

Subscribers: cfe-commits

Tags: #clang

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

3 years agoRevert "[SCEV] Handle non-positive case in isImpliedViaOperations"
Max Kazantsev [Thu, 5 Nov 2020 04:27:23 +0000 (11:27 +0700)]
Revert "[SCEV] Handle non-positive case in isImpliedViaOperations"

This reverts commit 8dc98897c4af20aeb52f1f19f538c08e55793283.

Commited by mistake.

3 years ago[MachineSink] add more profitable pattern.
Chen Zheng [Tue, 22 Sep 2020 00:33:05 +0000 (20:33 -0400)]
[MachineSink] add more profitable pattern.

Add more profitable sinking patterns if the target bb register pressure
is not too high.

Reviewed By: qcolombet

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

3 years ago[SCEV] Handle non-positive case in isImpliedViaOperations
Max Kazantsev [Thu, 5 Nov 2020 03:30:42 +0000 (10:30 +0700)]
[SCEV] Handle non-positive case in isImpliedViaOperations

We already handle non-negative case there. Add support for non-positive.

3 years agoRecommit "[RISCV] Move some test cases from rv64i-single-softfloat.ll to a new rv64i...
Craig Topper [Thu, 5 Nov 2020 03:55:52 +0000 (19:55 -0800)]
Recommit "[RISCV] Move some test cases from rv64i-single-softfloat.ll to a new rv64i-double-softfloat.ll. NFC""

With new test file this time.

Original message

This new test covers both with and without the F extension enabled.

This shows that the fptosi/fptoui for double->i32 use a different
libcall depending on whether the F extension is enabled. If it's
not enabled we use the 'si' library call. If it is enabled we use 'di'.

3 years agoRevert "[RISCV] Move some test cases from rv64i-single-softfloat.ll to a new rv64i...
Craig Topper [Thu, 5 Nov 2020 03:55:13 +0000 (19:55 -0800)]
Revert "[RISCV] Move some test cases from rv64i-single-softfloat.ll to a new rv64i-double-softfloat.ll. NFC"

I failed to git add the new test file.

This reverts commit 36072cc0a487fb5ad315d264064daa73d916469c.

3 years ago[RISCV] Move some test cases from rv64i-single-softfloat.ll to a new rv64i-double...
Craig Topper [Thu, 5 Nov 2020 03:51:43 +0000 (19:51 -0800)]
[RISCV] Move some test cases from rv64i-single-softfloat.ll to a new rv64i-double-softfloat.ll. NFC

This new test covers both with and without the F extension enabled.

This shows that the fptosi/fptoui for double->i32 use a different
libcall depending on whether the F extension is enabled. If it's
not enabled we use the 'si' library call. If it is enabled we use 'di'.

3 years ago[LangRef] Adds llvm.loop.mustprogress loop metadata
Atmn Patel [Thu, 5 Nov 2020 03:30:58 +0000 (22:30 -0500)]
[LangRef] Adds llvm.loop.mustprogress loop metadata

This patch adds the llvm.loop.mustprogress loop metadata. This is to be
added to loops where the frontend language requires that the loop makes
observable interactions with the environment. This is the loop-level
equivalent to the function attribute `mustprogress` defined in D86233.

Reviewed By: jdoerfert

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

3 years ago[sanitizer] Fix -fno-emulated-tls setup
Vitaly Buka [Thu, 5 Nov 2020 03:22:28 +0000 (19:22 -0800)]
[sanitizer] Fix -fno-emulated-tls setup

COMPILER_RT_TEST_COMPILER_CFLAGS is a string

3 years ago[NFC] Extract InitializePlatformCommonFlags
Vitaly Buka [Thu, 5 Nov 2020 02:52:15 +0000 (18:52 -0800)]
[NFC] Extract InitializePlatformCommonFlags

And move some Android specifi declarations from headers

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

3 years ago[lsan] Remove unnecessary elf-tls condition
Vy Nguyen [Thu, 5 Nov 2020 02:09:36 +0000 (21:09 -0500)]
[lsan] Remove unnecessary elf-tls condition

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

3 years ago[clang] Add mustprogress and llvm.loop.mustprogress attribute deduction
Atmn Patel [Mon, 2 Nov 2020 21:03:21 +0000 (16:03 -0500)]
[clang] Add mustprogress and llvm.loop.mustprogress attribute deduction

Since C++11, the C++ standard has a forward progress guarantee
[intro.progress], so all such functions must have the `mustprogress`
requirement. In addition, from C11 and onwards, loops without a non-zero
constant conditional or no conditional are also required to make
progress (C11 6.8.5p6). This patch implements these attribute deductions
so they can be used by the optimization passes.

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

3 years ago[sanitizer] Quick fix for non-Linux build
Vitaly Buka [Thu, 5 Nov 2020 02:34:19 +0000 (18:34 -0800)]
[sanitizer] Quick fix for non-Linux build

3 years ago[LSAN] Fix CAN_SANITIZE_LEAKS on Android
Vitaly Buka [Thu, 5 Nov 2020 02:28:51 +0000 (18:28 -0800)]
[LSAN] Fix CAN_SANITIZE_LEAKS on Android

3 years ago[mlir] Change deprecated -Werror-implicit-function-declaration to -Werror=implicit...
Fangrui Song [Thu, 5 Nov 2020 02:33:51 +0000 (18:33 -0800)]
[mlir] Change deprecated -Werror-implicit-function-declaration to -Werror=implicit-function-declaration

This -Werror- form has been deprecated since 2007 (GCC r122017).

And only enable it for CMAKE_C_FLAGS. C++ does not need it.

3 years ago[flang][openacc] Lower wait directive
Valentin Clement [Thu, 5 Nov 2020 02:15:35 +0000 (21:15 -0500)]
[flang][openacc] Lower wait directive

This patch upstream the lowering of Wait directive that was initially done in
https://github.com/flang-compiler/f18-llvm-project/pull/532

Reviewed By: schweitz

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

3 years agoReland [lsan] Enable LSAN for Android
Vy Nguyen [Wed, 4 Nov 2020 22:09:08 +0000 (14:09 -0800)]
Reland [lsan] Enable LSAN for Android

Reland: a2291a58bf1c860d026581fee6fe96019dc25440.

New fixes for the breakages reported in D85927 include:
 - declare a weak decl for `dl_iterate_phdr`, because it does not exist on older  APIs
 - Do not enable leak-sanitizer if api_level is less than 29, because of  `ld.lld: error: undefined symbol: __aeabi_read_tp` for armv7, API level 16.
 - Put back the interceptor for `memalign` but still opt out intercepting `__libc_memalign` and `cfree` because both of these don't exist in Bionic.

Reviewed By: srhines, vitalybuka

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

3 years ago[X86] Enable shrink-wrapping for no-frame-pointer non-nounwind functions on platforms...
Fangrui Song [Thu, 5 Nov 2020 00:51:48 +0000 (16:51 -0800)]
[X86] Enable shrink-wrapping for no-frame-pointer non-nounwind functions on platforms not using compact unwind

The current compact unwind scheme does not work when the prologue is not at the
start (the instructions before the prologue cannot be described).  (Technically
this is fixable, but it requires multiple compact unwind descriptors for one
function.)

rL255175 chose to not perform shrink-wrapping for no-frame-pointer functions not
marked as nounwind to work around PR25614. This is overly limited, as platforms
not supporting compact unwind (all non-Darwin) does not need the workaround.
This patch restricts the limitation to compact unwind platforms.

Reviewed By: qcolombet

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

3 years ago[sanitizer] Allow preinit array on Android
Vy Nguyen [Wed, 4 Nov 2020 22:09:08 +0000 (14:09 -0800)]
[sanitizer] Allow preinit array on Android

Extracted from D89251

3 years ago[flang][openacc] Lower init and shutdown directive
Valentin Clement [Thu, 5 Nov 2020 00:30:39 +0000 (19:30 -0500)]
[flang][openacc] Lower init and shutdown directive

This patch upstream the lowering of Init and Shutdown directives that was initially done in
https://github.com/flang-compiler/f18-llvm-project/pull/529

Reviewed By: schweitz

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

3 years ago[MLIR][NFC] Update syntax of global_memref in ODS description.
Rahul Joshi [Wed, 4 Nov 2020 21:43:57 +0000 (13:43 -0800)]
[MLIR][NFC] Update syntax of global_memref in ODS description.

- The ODS description was using an old syntax that was updated during the review.
  This fixes the ODS description to match the current syntax.

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

3 years ago[NFC][sanitizer] Reformat some code
Vitaly Buka [Wed, 4 Nov 2020 23:37:48 +0000 (15:37 -0800)]
[NFC][sanitizer] Reformat some code

Extracted from D89251

3 years ago[PowerPC] Add Sema checks for MMA types
Baptiste Saleil [Wed, 4 Nov 2020 23:00:48 +0000 (17:00 -0600)]
[PowerPC] Add Sema checks for MMA types

The use of the new types introduced for PowerPC MMA instructions needs to be restricted.
We add a PowerPC function checking that the given type is valid in a context in which we don't allow MMA types.
This function is called from various places in Sema where we want to prevent the use of these types.

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

3 years agoFix UB in one libcxx test, when deleting D through a pointer to B.
Arthur O'Dwyer [Wed, 4 Nov 2020 22:34:05 +0000 (17:34 -0500)]
Fix UB in one libcxx test, when deleting D through a pointer to B.

This undefined behavior was found by applying Lénárd Szolnoki's proposal
to disable implicit conversion of default_delete<D> to default_delete<B>.

The offending part of the test is circa line 243.

The wording that makes it undefined behavior is http://eel.is/c++draft/expr.delete#3 .

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

3 years ago[sanitizer] Get Android API from --target
Vitaly Buka [Wed, 4 Nov 2020 21:10:17 +0000 (13:10 -0800)]
[sanitizer] Get Android API from --target

Depends on D90792.

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

3 years ago[NFC][LSAN] Remove unused variable
Vitaly Buka [Wed, 4 Nov 2020 21:09:09 +0000 (13:09 -0800)]
[NFC][LSAN] Remove unused variable

Depends on D90791.

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

3 years ago[NFC] Fix comment in test
Vitaly Buka [Wed, 4 Nov 2020 21:06:59 +0000 (13:06 -0800)]
[NFC] Fix comment in test

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

3 years agoBasic: Change Module::Umbrella to a PointerUnion, NFC
Duncan P. N. Exon Smith [Thu, 29 Oct 2020 19:14:30 +0000 (15:14 -0400)]
Basic: Change Module::Umbrella to a PointerUnion, NFC

Change `Module::Umbrella` from a `const void *` to a `PointerUnion` of
`FileEntry` and `DirectoryEntry`. We can drop the `HasUmbrellaDir` bit
(since `PointerUnion` includes that).

This change makes it safer to update to `FileEntryRef` and
`DirectoryEntryRef` in a future patch.

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

3 years agoReland [NewPM] Add OptimizationLevel param to registerPipelineStartEPCallback
Arthur Eubanks [Wed, 4 Nov 2020 18:14:37 +0000 (10:14 -0800)]
Reland [NewPM] Add OptimizationLevel param to registerPipelineStartEPCallback

This allows targets to skip optional optimization passes at -O0.

Reviewed By: ychen

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

3 years agoRevert "[NewPM] Add OptimizationLevel param to registerPipelineStartEPCallback"
Arthur Eubanks [Wed, 4 Nov 2020 20:57:32 +0000 (12:57 -0800)]
Revert "[NewPM] Add OptimizationLevel param to registerPipelineStartEPCallback"

This reverts commit 7a83aa0520d24ee5285a9c60b97b57a1db1d65e8.

Causing buildbot failures.