platform/upstream/llvm.git
2 years agopre-commit test for D109767
Alex Richardson [Mon, 20 Sep 2021 11:33:25 +0000 (12:33 +0100)]
pre-commit test for D109767

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

2 years agoFix CLANG_ENABLE_STATIC_ANALYZER=OFF building all analyzer source
Alex Richardson [Mon, 20 Sep 2021 11:32:56 +0000 (12:32 +0100)]
Fix CLANG_ENABLE_STATIC_ANALYZER=OFF building all analyzer source

Since https://reviews.llvm.org/D87118, the StaticAnalyzer directory is
added unconditionally. In theory this should not cause the static analyzer
sources to be built unless they are referenced by another target. However,
the clang-cpp target (defined in clang/tools/clang-shlib) uses the
CLANG_STATIC_LIBS global property to determine which libraries need to
be included. To solve this issue, this patch avoids adding libraries to
that property if EXCLUDE_FROM_ALL is set.

In case something like this comes up again: `cmake --graphviz=targets.dot`
is quite useful to see why a target is included as part of `ninja all`.

Reviewed By: thakis

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

2 years agoMachOObjectFile - checkOverlappingElement - use const-ref to avoid unnecessary copies...
Simon Pilgrim [Fri, 17 Sep 2021 16:47:28 +0000 (17:47 +0100)]
MachOObjectFile - checkOverlappingElement - use const-ref to avoid unnecessary copies. NFCI.

Reported by MSVC static analyzer.

2 years ago[X86] X86TargetTransformInfo - remove unnecessary if-else after early exit. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 15:25:30 +0000 (16:25 +0100)]
[X86] X86TargetTransformInfo - remove unnecessary if-else after early exit. NFCI.

(style) Break the if-else chain as they all return.

2 years ago[MCA] InstructionTables::execute() - use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 15:22:55 +0000 (16:22 +0100)]
[MCA] InstructionTables::execute() - use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

2 years ago[mlir][openacc] Make use of the second counter extension in DataOp translation
Valentin Clement [Thu, 22 Jul 2021 01:47:54 +0000 (21:47 -0400)]
[mlir][openacc] Make use of the second counter extension in DataOp translation

Make use of runtime extension for the second reference counter used in
structured data region. This extension is implemented in D106510 and D106509.

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

2 years ago[lldb] [gdb-remote] Always send PID when detaching w/ multiprocess
Michał Górny [Sun, 19 Sep 2021 11:02:31 +0000 (13:02 +0200)]
[lldb] [gdb-remote] Always send PID when detaching w/ multiprocess

Always send PID in the detach packet when multiprocess extensions are
enabled.  This is required by qemu's GDB server, as plain 'D' packet
results in an error and the emulated system is not resumed.

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

2 years ago[GlobalISel] Improve elimination of dead instructions in legalizer
Petar Avramovic [Mon, 20 Sep 2021 11:00:13 +0000 (13:00 +0200)]
[GlobalISel] Improve elimination of dead instructions in legalizer

Add eraseInstr(s) utility functions. Before deleting an instruction
collects its use instructions. After deletion deletes use instructions
that became trivially dead.
This patch clears all dead instructions in existing legalizer mir tests.

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

2 years ago[NewPM] Make InlinerPass (aka 'inline') a parameterized pass
Bjorn Pettersson [Thu, 16 Sep 2021 07:28:32 +0000 (09:28 +0200)]
[NewPM] Make InlinerPass (aka 'inline') a parameterized pass

In default pipelines the ModuleInlinerWrapperPass is adding the
InlinerPass to the pipeline twice, once due to MandatoryFirst (passing
true in the ctor) and then a second time with false as argument.

To make it possible to bisect and reduce opt test cases for this
part of the pipeline we need to be able to choose between the two
different variants of the InlinerPass when running opt. This patch is
changing 'inline' to a CGSCC_PASS_WITH_PARAMS in the PassRegistry,
making it possible run opt with both -passes=cgscc(inline) and
-passes=cgscc(inline<only-mandatory>).

Reviewed By: aeubanks, mtrofin

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

2 years ago[clang][NFC] Remove dead code
Andy Wingo [Wed, 4 Aug 2021 08:39:52 +0000 (10:39 +0200)]
[clang][NFC] Remove dead code

Remove code that has no effect in SemaType.cpp:processTypeAttrs.

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

2 years agoAdd myself as a code owner for SYCL support
Alexey Bader [Mon, 20 Sep 2021 06:31:35 +0000 (09:31 +0300)]
Add myself as a code owner for SYCL support

2 years ago[OpenCL] Supports optional writing to 3d images in C++ for OpenCL 2021
Justas Janickas [Mon, 6 Sep 2021 15:04:19 +0000 (16:04 +0100)]
[OpenCL] Supports optional writing to 3d images in C++ for OpenCL 2021

Adds support for a feature macro __opencl_c_3d_image_writes in
C++ for OpenCL 2021 enabling a respective optional core feature
from OpenCL 3.0.

This change aims to achieve compatibility between C++ for OpenCL
2021 and OpenCL 3.0.

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

2 years agoAArch64: use ldp/stp for 128-bit atomic load/store in v.84 onwards
Tim Northover [Wed, 15 Sep 2021 11:20:03 +0000 (12:20 +0100)]
AArch64: use ldp/stp for 128-bit atomic load/store in v.84 onwards

v8.4 says that normal loads/stores of 128-bytes are single-copy atomic if
they're properly aligned (which all LLVM atomics are) so we no longer need to
do a full RMW operation to guarantee we got a clean read.

2 years ago[mlir] Fix integration tests failures introduced in D108505
Vladislav Vinogradov [Mon, 20 Sep 2021 08:48:24 +0000 (11:48 +0300)]
[mlir] Fix integration tests failures introduced in D108505

2 years agoRevert "[AArch64][SVE] Teach cost model that masked loads/stores are cheap"
David Spickett [Mon, 20 Sep 2021 08:44:09 +0000 (08:44 +0000)]
Revert "[AArch64][SVE] Teach cost model that masked loads/stores are cheap"

This reverts commit 734708e04f84b72f1ae7c8b35c002b8bf97dc064.

Due to build failures on the 2 stage SVE VLS bot.
https://lab.llvm.org/buildbot/#/builders/176/builds/908/steps/11/logs/stdio

2 years ago[lldb] [gdb-remote] Recognize aarch64v type from gdbserver
Michał Górny [Thu, 16 Sep 2021 17:01:55 +0000 (19:01 +0200)]
[lldb] [gdb-remote] Recognize aarch64v type from gdbserver

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

2 years ago[lldb] [gdb-remote] Remove unused arg from GDBRemoteRegisterContext::ReadRegisterBytes()
Michał Górny [Mon, 30 Aug 2021 08:23:22 +0000 (10:23 +0200)]
[lldb] [gdb-remote] Remove unused arg from GDBRemoteRegisterContext::ReadRegisterBytes()

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

2 years ago[MLIR][Linalg] Make detensoring cost-model more flexible.
KareemErgawy-TomTom [Mon, 20 Sep 2021 07:35:42 +0000 (09:35 +0200)]
[MLIR][Linalg] Make detensoring cost-model more flexible.

So far, the CF cost-model for detensoring was limited to discovering
pure CF structures. This means, if while discovering the CF component,
the cost-model found any op that is not detensorable, it gives up on
detensoring altogether. This patch makes it a bit more flexible by
cleaning-up the detensorable component from non-detensorable ops without
giving up entirely.

Reviewed By: silvas

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

2 years ago[CaptureTracking] Allow passing LI to PointerMayBeCapturedBefore (NFC).
Florian Hahn [Mon, 20 Sep 2021 08:07:34 +0000 (09:07 +0100)]
[CaptureTracking] Allow passing LI to PointerMayBeCapturedBefore (NFC).

isPotentiallyReachable can use LoopInfo to return earlier. This patch
allows passing an optional LI to PointerMayBeCapturedBefore. Used in
D109844.

Reviewed By: nikic, asbirlea

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

2 years ago[CMake] Add debuginfo-tests to LLVM_ALL_PROJECTS after D110016
Fangrui Song [Mon, 20 Sep 2021 07:56:27 +0000 (00:56 -0700)]
[CMake] Add debuginfo-tests to LLVM_ALL_PROJECTS after D110016

2 years ago[MLIR] Simplex::appendVariable: early return if count == 0
Arjun P [Mon, 20 Sep 2021 07:39:05 +0000 (13:09 +0530)]
[MLIR] Simplex::appendVariable: early return if count == 0

2 years ago[mlir] Fix bug in partial dialect conversion
Vladislav Vinogradov [Fri, 20 Aug 2021 11:25:42 +0000 (14:25 +0300)]
[mlir] Fix bug in partial dialect conversion

The discussion on forum:
https://llvm.discourse.group/t/bug-in-partial-dialect-conversion/4115

The `applyPartialConversion` didn't handle the operations, that were
marked as illegal inside dynamic legality callback.
Instead of reporting error, if such operation was not converted to legal set,
the method just added it to `unconvertedSet` in the same way as unknown operations.

This patch fixes that and handle dynamically illegal operations as well.

The patch includes 2 fixes for existing passes:

* `tensor-bufferize` - explicitly mark `std.return` as legal.
* `convert-parallel-loops-to-gpu` - ugly fix with marking visited operations
  to avoid recursive legality checks.

Reviewed By: rriddle

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

2 years ago[mlir][NFC] Add explicit "::mlir" namespace to tblgen generated code
Vladislav Vinogradov [Fri, 3 Sep 2021 11:02:34 +0000 (14:02 +0300)]
[mlir][NFC] Add explicit "::mlir" namespace to tblgen generated code

Reviewed By: lattner, ftynse

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

2 years ago[lldb] Remove two #ifndef linux from Platform.cpp
Pavel Labath [Fri, 17 Sep 2021 11:16:26 +0000 (13:16 +0200)]
[lldb] Remove two #ifndef linux from Platform.cpp

These have been here since r215992, guarding the calls to HostInfo, but
their purpose unclear -- HostInfoLinux provides these functions and they
work fine.

2 years ago[libc][obvious] Add inttypes.h and stdlib.h as deps to *div functions.
Siva Chandra Reddy [Mon, 20 Sep 2021 05:54:32 +0000 (05:54 +0000)]
[libc][obvious] Add inttypes.h and stdlib.h as deps to *div functions.

2 years ago[libc][obvious] Make *abs and *div functions buildable in default mode.
Siva Chandra Reddy [Mon, 20 Sep 2021 05:44:10 +0000 (05:44 +0000)]
[libc][obvious] Make *abs and *div functions buildable in default mode.

2 years ago[NFC] Add assert and test showing that revert of D109596 wasn't justified
Max Kazantsev [Mon, 20 Sep 2021 04:58:17 +0000 (11:58 +0700)]
[NFC] Add assert and test showing that revert of D109596 wasn't justified

All transforms of IndVars have prerequisite requirement of LCSSA and LoopSimplify
form and rely on it. Added test that shows that this actually stands.

2 years agoRevert "Revert "[IndVars] Replace PHIs if loop exits on 1st iteration""
Max Kazantsev [Mon, 20 Sep 2021 04:28:56 +0000 (11:28 +0700)]
Revert "Revert "[IndVars] Replace PHIs if loop exits on 1st iteration""

This reverts commit 6fec6552f54885ae06bf76b35f9f1173a0561a4c.

The patch was reverted on incorrect claim that this patch may break LCSSA form
when the loop is not in a simplify form. All IndVars' transform insure that
the loop is in simplify and LCSSA form, so if it wasn't broken before this
transform, it will also not be broken after it.

2 years ago[libc] Add implementations of div, ldiv, lldiv and imaxdiv.
Siva Chandra Reddy [Fri, 17 Sep 2021 04:38:17 +0000 (04:38 +0000)]
[libc] Add implementations of div, ldiv, lldiv and imaxdiv.

Reviewed By: michaelrj

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

2 years ago[SCEV] Support negative values in signed/unsigned predicate reasoning
Max Kazantsev [Mon, 20 Sep 2021 04:26:33 +0000 (11:26 +0700)]
[SCEV] Support negative values in signed/unsigned predicate reasoning

There is a piece of logic that uses the fact that signed and unsigned
versions of the same predicate are equivalent when both values are
non-negative. It's also true when both of them are negative.

Differential Revision: https://reviews.llvm.org/D109957
Reviewed By: nikic

2 years agollvm-dwarfdump: pretty type printing: print fully qualified names in function type...
David Blaikie [Mon, 20 Sep 2021 00:33:56 +0000 (17:33 -0700)]
llvm-dwarfdump: pretty type printing: print fully qualified names in function type parameter types

2 years agollvm-dwarfdump: support for type printing "decltype(nullptr)" as "nullptr_t"
David Blaikie [Mon, 20 Sep 2021 00:33:56 +0000 (17:33 -0700)]
llvm-dwarfdump: support for type printing "decltype(nullptr)" as "nullptr_t"

This should probably be rendered as "std::nullptr_t" but for now clang
uses the unqualified name (which is ambiguous with possible user defined
name in the global namespace), so match that here.

2 years agollvm-dwarfdump: Don't print even an empty string when a type is unprintable
David Blaikie [Mon, 20 Sep 2021 00:03:10 +0000 (17:03 -0700)]
llvm-dwarfdump: Don't print even an empty string when a type is unprintable

2 years agollvm-dwarfdump: Pretty print names qualified/with scopes
David Blaikie [Sun, 19 Sep 2021 22:31:35 +0000 (15:31 -0700)]
llvm-dwarfdump: Pretty print names qualified/with scopes

2 years ago[X86] SimplifyDemandedBits - only narrow a broadcast source if we only have one use.
Simon Pilgrim [Sun, 19 Sep 2021 21:53:13 +0000 (22:53 +0100)]
[X86] SimplifyDemandedBits - only narrow a broadcast source if we only have one use.

Helps with the regression noted on D109065 - don't truncate a broadcast source if the source has multiple uses.

2 years ago[llvm] Use pop_back_val (NFC)
Kazu Hirata [Sun, 19 Sep 2021 20:44:23 +0000 (13:44 -0700)]
[llvm] Use pop_back_val (NFC)

2 years ago[DebugInfo][LSR] Emit shorter expressions from scev-based salvaging
Chris Jackson [Sun, 19 Sep 2021 14:52:20 +0000 (15:52 +0100)]
[DebugInfo][LSR] Emit shorter expressions from scev-based salvaging

The scev-based salvaging for LSR can sometimes produce unnecessarily
verbose expressions. This patch adds logic to detect when the value to
be recovered and the induction variable differ by only a constant
offset. Then, the expression to derive the current iteration count can
be omitted from the dbg.value in favour of the offset.

Reviewed by: aprantl

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

2 years agollvm-dwarfdump: Pretty printing types including a space between const and parenthesiz...
David Blaikie [Sun, 19 Sep 2021 20:32:21 +0000 (13:32 -0700)]
llvm-dwarfdump: Pretty printing types including a space between const and parenthesized references/pointers to arrays

2 years ago[X86] Remove Commutable flag from mpsadbw intrinsics.
Craig Topper [Sun, 19 Sep 2021 20:20:36 +0000 (13:20 -0700)]
[X86] Remove Commutable flag from mpsadbw intrinsics.

Unlike psadbw, mpsadbw is not commutable because of how it operates
on blocks. We already marked as not commutable for MachineIR, but
had it commutable for the tablegened isel patterns.

Fixes PR51908.

2 years ago[X86] Add test cases for pr51908. NFC
Craig Topper [Sun, 19 Sep 2021 20:12:30 +0000 (13:12 -0700)]
[X86] Add test cases for pr51908. NFC

2 years agoDWARFDie.cpp: Minor follow-up clang-format
David Blaikie [Sun, 19 Sep 2021 20:06:18 +0000 (13:06 -0700)]
DWARFDie.cpp: Minor follow-up clang-format

2 years agoDWARFDie: Improve type printing for function and array types - with qualifiers (cv...
David Blaikie [Sun, 19 Sep 2021 19:52:06 +0000 (12:52 -0700)]
DWARFDie: Improve type printing for function and array types - with qualifiers (cv/reference) and pointers to them

2 years ago[X86][Atom] Fix FP uops + port usage
Simon Pilgrim [Sun, 19 Sep 2021 19:39:10 +0000 (20:39 +0100)]
[X86][Atom] Fix FP uops + port usage

Both ports are required in most cases. Update the uops counts + port usage based off the most recent llvm-exegesis captures (PR36895) and what Intel AoM / Agner / InstLatX64 reports as well.

Noticed while trying to improve fp costs for vectorization via the D103695 helper script.

2 years ago[X86] Fold SHUFPS(shuffle(x),shuffle(y),mask) -> SHUFPS(x,y,mask')
Simon Pilgrim [Sun, 19 Sep 2021 17:41:55 +0000 (18:41 +0100)]
[X86] Fold SHUFPS(shuffle(x),shuffle(y),mask) -> SHUFPS(x,y,mask')

We can combine unary shuffles into either of SHUFPS's inputs and adjust the shuffle mask accordingly.

Unlike general shuffle combining, we can be more aggressive and handle multiuse cases as we're not going to accidentally create additional shuffles.

2 years agollvm-dwarfdump: Refactor type pretty printing tests
David Blaikie [Sun, 19 Sep 2021 16:24:25 +0000 (09:24 -0700)]
llvm-dwarfdump: Refactor type pretty printing tests

Move most type tests to a pre-generated assembly file to make it easier
to add more weird cases without having to hand craft more DWARF.

Move the novel array types that aren't reachable via clang-generated
DWARF to a separate file for easy maintenance.

2 years ago[X86][Atom] Specific uops for all IMUL/IDIV instructions
Simon Pilgrim [Sun, 19 Sep 2021 15:58:40 +0000 (16:58 +0100)]
[X86][Atom] Specific uops for all IMUL/IDIV instructions

Based off a mixture of llvm-exegesis captures (PR36895) and Intel AoM / Agner / InstLatX64 reports.

2 years ago[X86][TLI] SimplifyDemandedVectorEltsForTargetNode(): don't break apart broadcasts...
Roman Lebedev [Sun, 19 Sep 2021 14:38:32 +0000 (17:38 +0300)]
[X86][TLI] SimplifyDemandedVectorEltsForTargetNode(): don't break apart broadcasts from which not just the 0'th elt is demanded

Apparently this has no test coverage before D108382,
but D108382 itself shows a few regressions that this fixes.

It doesn't seem worthwhile breaking apart broadcasts,
assuming we want the broadcasted value to be preset in several elements,
not just the 0'th one.

Reviewed By: RKSimon

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

2 years ago[X86] lowerShuffleAsDecomposedShuffleMerge(): if both inputs are broadcastable/identi...
Roman Lebedev [Sun, 19 Sep 2021 14:32:43 +0000 (17:32 +0300)]
[X86] lowerShuffleAsDecomposedShuffleMerge(): if both inputs are broadcastable/identities, canonicalize broadcasts as such

Split off from D108253.
Broadcast is simpler than any other shuffle we might produce
to do what we want to do here, so prefer it.

Reviewed By: RKSimon

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

2 years ago[NFC] combineX86ShufflesRecursively(): actually address nits for previous patch
Roman Lebedev [Sun, 19 Sep 2021 14:27:35 +0000 (17:27 +0300)]
[NFC] combineX86ShufflesRecursively(): actually address nits for previous patch

2 years ago[X86] combineX86ShufflesRecursively(): call SimplifyMultipleUseDemandedVectorElts...
Roman Lebedev [Sun, 19 Sep 2021 14:21:17 +0000 (17:21 +0300)]
[X86] combineX86ShufflesRecursively(): call SimplifyMultipleUseDemandedVectorElts() on after finishing recursing

This was suggested in https://reviews.llvm.org/D108382#inline-1039018,
and it avoids regressions in that patch.

Reviewed By: RKSimon

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

2 years ago[InstCombine] add/adjust tests for min/max intrinsics; NFC
Sanjay Patel [Sun, 19 Sep 2021 13:18:07 +0000 (09:18 -0400)]
[InstCombine] add/adjust tests for min/max intrinsics; NFC

If we transform these, we have to propagate no-wrap/undef carefully.

2 years ago[ARM] Add VGETLANEu patterns for v4f16 and v8f16
David Green [Sun, 19 Sep 2021 13:25:21 +0000 (14:25 +0100)]
[ARM] Add VGETLANEu patterns for v4f16 and v8f16

These were apparently missing, having no pattern that could convert a
VGETLANEu of a v4f16 to an i32. Added bf16 whilst here, following the
same code.

2 years ago[mlir][emitc] Fix indent in CondBranchOp and block label
xndcn [Sun, 19 Sep 2021 12:01:12 +0000 (20:01 +0800)]
[mlir][emitc] Fix indent in CondBranchOp and block label

1. Add missing indent in CondBranchOp
2. Remove indent in block label

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

2 years ago[X86][Atom] Fix (U)COMISS/SD uops, latency and throughput
Simon Pilgrim [Sat, 18 Sep 2021 20:29:33 +0000 (21:29 +0100)]
[X86][Atom] Fix (U)COMISS/SD uops, latency and throughput

Both ports are required, for reg and mem variants - we can also use the WriteFComX class directly and remove the unnecessary InstRW overrides. Matches what Intel AoM / Agner / InstLatX64 report as well.

2 years agollvm/cmake: fix a typo
Sylvestre Ledru [Sun, 19 Sep 2021 10:17:49 +0000 (12:17 +0200)]
llvm/cmake: fix a typo

2 years ago[RISCV] Optimize (add (shl x, c0), (shl y, c1)) with SH*ADD
Ben Shi [Mon, 30 Aug 2021 13:14:12 +0000 (21:14 +0800)]
[RISCV] Optimize (add (shl x, c0), (shl y, c1)) with SH*ADD

Optimize (add (shl x, c0), (shl y, c1)) ->
         (SLLI (SH*ADD x, y), c1), if c0-c1 == 1/2/3.

Reviewed By: craig.topper, luismarques

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

2 years agoDWARFDie:DWARFTypePrinter: Add common utility function for checking where parentheses...
David Blaikie [Sun, 19 Sep 2021 05:54:57 +0000 (22:54 -0700)]
DWARFDie:DWARFTypePrinter: Add common utility function for checking where parentheses are required

2 years agoDWARFDie.cpp: Reduce indentation with early continue
David Blaikie [Sun, 19 Sep 2021 05:22:25 +0000 (22:22 -0700)]
DWARFDie.cpp: Reduce indentation with early continue

2 years ago[X86] Improve i8 all-ones element insertion in pre-SSE4.1
Roman Lebedev [Sat, 18 Sep 2021 19:13:25 +0000 (22:13 +0300)]
[X86] Improve i8 all-ones element insertion in pre-SSE4.1

Should avoid some regressions in D109065

Reviewed By: RKSimon

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

2 years ago[Tests] Fix noalias metadata in one more test
Nikita Popov [Sat, 18 Sep 2021 19:14:35 +0000 (21:14 +0200)]
[Tests] Fix noalias metadata in one more test

Missed this one in 80110aafa09aff9869cdb50ed718a169888da578. This
is another test mixing up alias scopes and alias scope lists.

2 years ago[Tests] Fix incorrect noalias metadata
Nikita Popov [Thu, 16 Sep 2021 20:17:36 +0000 (22:17 +0200)]
[Tests] Fix incorrect noalias metadata

Mostly this fixes cases where !noalias or !alias.scope were passed
a scope rather than a scope list. In some cases I opted to drop
the metadata entirely instead, because it is not really relevant
to the test.

2 years agoOpenMP 5.0 metadirective
alokmishra.besu [Fri, 17 Sep 2021 21:03:01 +0000 (16:03 -0500)]
OpenMP 5.0 metadirective

This patch supports OpenMP 5.0 metadirective features.
It is implemented keeping the OpenMP 5.1 features like dynamic user condition in mind.

A new function, getBestWhenMatchForContext, is defined in llvm/Frontend/OpenMP/OMPContext.h

Currently this function return the index of the when clause with the highest score from the ones applicable in the Context.
But this function is declared with an array which can be used in OpenMP 5.1 implementation to select all the valid when clauses which can be resolved in runtime. Currently this array is set to null by default and its implementation is left for future.

Reviewed By: jdoerfert

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

2 years agoPrecommit tests for D109807 "[InstCombine] Narrow type of logical operation chains...
Usman Nadeem [Sat, 18 Sep 2021 18:28:49 +0000 (11:28 -0700)]
Precommit tests for D109807 "[InstCombine] Narrow type of logical operation chains when possible"

Change-Id: Iae9bf18619e4926301a866c7e2bd38ced524804e

2 years agoCheck for invalid projects passed in LLVM_ENABLE_PROJECTS
Mehdi Amini [Sat, 18 Sep 2021 02:38:17 +0000 (02:38 +0000)]
Check for invalid projects passed in LLVM_ENABLE_PROJECTS

This is catching misconfiguration. For example one of my automation
had a typo running `-DLLVM_ENABLE_PROJECTS=nlir` and it was just
silently ignored. Instead, an error will now be displayed.

Recommit 4121ac1e after fixing it to not fail on "all"

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

2 years ago[Support] Attempt to fix deadlock in ThreadGroup
Alexandre Ganea [Sat, 18 Sep 2021 16:00:17 +0000 (12:00 -0400)]
[Support] Attempt to fix deadlock in ThreadGroup

This is an attempt to fix the situation described by https://reviews.llvm.org/D104207#2826290 and PR41508.
See sequence of operations leading to the bug in https://reviews.llvm.org/D104207#3004689

We ensure that the Latch is completely "free" before decrementing the number of TaskGroupInstances.

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

2 years ago[ARM] Prevent large integer VQDMULH pattern crashes
David Green [Sat, 18 Sep 2021 17:47:02 +0000 (18:47 +0100)]
[ARM] Prevent large integer VQDMULH pattern crashes

Put a limit on the size of constant integers we test when looking for
VQDMULH, to prevent it from crashing from values more than 64bits.

2 years ago[MLIR] Simplex: rename num{Variables,Constraints} to getNum{Variables,Constraints}
Arjun P [Sat, 18 Sep 2021 16:10:59 +0000 (21:40 +0530)]
[MLIR] Simplex: rename num{Variables,Constraints} to getNum{Variables,Constraints}

As per the LLVM Coding Standards, function names should be verb phrases.

2 years ago[CodeGen] Use make_early_inc_range (NFC)
Kazu Hirata [Sat, 18 Sep 2021 16:29:24 +0000 (09:29 -0700)]
[CodeGen] Use make_early_inc_range (NFC)

2 years ago[MLIR] Simplex: support adding new variables dynamically
Arjun P [Sat, 18 Sep 2021 10:34:46 +0000 (16:04 +0530)]
[MLIR] Simplex: support adding new variables dynamically

Reviewed By: Groverkss

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

2 years ago[lld/mac] Fix comment typo to cycle bots
Nico Weber [Sat, 18 Sep 2021 15:15:21 +0000 (11:15 -0400)]
[lld/mac] Fix comment typo to cycle bots

2 years ago[mlir-c] Add getting fused loc
Jacques Pienaar [Sat, 18 Sep 2021 13:57:51 +0000 (06:57 -0700)]
[mlir-c] Add getting fused loc

For creating a fused loc using array of locations and metadata.

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

2 years agoRevert "OpenMP 5.0 metadirective"
Nico Weber [Sat, 18 Sep 2021 13:10:37 +0000 (09:10 -0400)]
Revert "OpenMP 5.0 metadirective"

This reverts commit c7d7b98e5263472f05b2f3cb767b5d16e1349e9a.
Breaks tests on macOS, see comment on https://reviews.llvm.org/D91944

2 years agoThread safety analysis: Warn when demoting locks on back edges
Aaron Puchert [Sat, 18 Sep 2021 11:46:50 +0000 (13:46 +0200)]
Thread safety analysis: Warn when demoting locks on back edges

Previously in D104261 we warned about dropping locks from back edges,
this is the corresponding change for exclusive/shared joins. If we're
entering the loop with an exclusive change, which is then relaxed to a
shared lock before we loop back, we have already analyzed the loop body
with the stronger exclusive lock and thus might have false positives.

There is a minor non-observable change: we modify the exit lock set of a
function, but since that isn't used further it doesn't change anything.

Reviewed By: aaron.ballman

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

2 years agoRevert "Check for invalid projects passed in LLVM_ENABLE_PROJECTS"
Roman Lebedev [Sat, 18 Sep 2021 10:56:54 +0000 (13:56 +0300)]
Revert "Check for invalid projects passed in LLVM_ENABLE_PROJECTS"

```
CMake Error at CMakeLists.txt:76 (MESSAGE):
  all isn't a know project:
  clang;clang-tools-extra;compiler-rt;cross-project-tests;libc;libclc;libcxx;libcxxabi;libunwind;lld;lldb;mlir;openmp;parallel-libs;polly;pstl;flang;llvm
```

This reverts commit 4121ac1e7f96d826b793bd7e29c181f1eb8168bf.

2 years agollvm doc: remove the old reference to subversion and add a link to the GH repo instead
Sylvestre Ledru [Sat, 18 Sep 2021 10:42:50 +0000 (12:42 +0200)]
llvm doc: remove the old reference to subversion and add a link to the GH repo instead

2 years agollvm doc: subversion isn't necessary in this example
Sylvestre Ledru [Sat, 18 Sep 2021 10:42:09 +0000 (12:42 +0200)]
llvm doc: subversion isn't necessary in this example

2 years agoAdjust the doc after the renaming of debuginfo-tests => cross-project-tests
Sylvestre Ledru [Sat, 18 Sep 2021 07:55:10 +0000 (09:55 +0200)]
Adjust the doc after the renaming of debuginfo-tests => cross-project-tests

2 years ago[MLIR][GPU] Add constant propagator for gpu.launch op
Uday Bondhugula [Sun, 25 Jul 2021 13:32:38 +0000 (19:02 +0530)]
[MLIR][GPU] Add constant propagator for gpu.launch op

Add a constant propagator for gpu.launch op in cases where the
grid/thread IDs can be trivially determined to take a single constant
value of zero.

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

2 years agoCheck for invalid projects passed in LLVM_ENABLE_PROJECTS
Mehdi Amini [Sat, 18 Sep 2021 02:38:17 +0000 (02:38 +0000)]
Check for invalid projects passed in LLVM_ENABLE_PROJECTS

This is catching misconfiguration. For example one of my automation
had a typo running `-DLLVM_ENABLE_PROJECTS=nlir` and it was just
silently ignored. Instead, an error will now be displayed.

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

2 years ago[OpenMP] Add support for dynamic shared memory in new RTL
Joseph Huber [Fri, 17 Sep 2021 18:53:58 +0000 (14:53 -0400)]
[OpenMP] Add support for dynamic shared memory in new RTL

This patch adds support for using dynamic shared memory in the new
device runtime. The new function `__kmpc_get_dynamic_shared` will return a
pointer to the buffer of dynamic shared memory. Currently the amount of memory
allocated is set by an environment variable.

In the future this amount will be added to the amount used for the smart stack
which will be configured in a similar way.

Reviewed By: tianshilei1992

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

2 years ago[OpenMP] Add additional fields to device environment
Joseph Huber [Thu, 16 Sep 2021 18:42:14 +0000 (14:42 -0400)]
[OpenMP] Add additional fields to device environment

This patch adds fields for the device number and number of devices into
the device environment struct and debugging values.

Reviewed By: jdoerfert

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

2 years ago[OpenMP] Implement __assert_fail in the new device runtime
Joseph Huber [Thu, 16 Sep 2021 12:51:12 +0000 (08:51 -0400)]
[OpenMP] Implement __assert_fail in the new device runtime

This patch implements the `__assert_fail` function in the new device
runtime. This allows users and developers to use the standars assert
function inside of the device.

Reviewed By: tianshilei1992

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

2 years ago[OpenMP] Change debugging symbol to weak_odr linkage
Joseph Huber [Fri, 17 Sep 2021 19:48:54 +0000 (15:48 -0400)]
[OpenMP] Change debugging symbol to weak_odr linkage

The new device runtime uses an internal variable to set debugging. This
variable was originally privately linked because every module will have
a copy of it. This caused problems with merging the device bitcode
library because it would get renamed and there was not a way to refer to
an external, private symbol. This changes the symbol to weak_odr so it
can be defined multiply, but will not be renamed.

Reviewed By: jdoerfert

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

2 years ago[lld] Fix small error in previous commit
Amy Huang [Sat, 18 Sep 2021 00:43:28 +0000 (17:43 -0700)]
[lld] Fix small error in previous commit
6f7483b1ece4747f2aafe4baa05fc07e7dc9ed9d.

2 years ago[mlir] Fix syntax example for tensor.from_elements
Geoffrey Martin-Noble [Sat, 18 Sep 2021 00:23:11 +0000 (17:23 -0700)]
[mlir] Fix syntax example for tensor.from_elements

Parens are not used here

2 years agoReland "[LLD] Remove global state in lld/COFF" after fixing asan and msan test failures
Amy Huang [Thu, 16 Sep 2021 23:48:26 +0000 (16:48 -0700)]
Reland "[LLD] Remove global state in lld/COFF" after fixing asan and msan test failures

Original commit description:

  [LLD] Remove global state in lld/COFF

  This patch removes globals from the lldCOFF library, by moving globals
  into a context class (COFFLinkingContext) and passing it around wherever
  it's needed.

  See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for
  context about removing globals from LLD.

  I also haven't moved the `driver` or `config` variables yet.

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

This reverts commit a2fd05ada9030eab2258fff25e77a05adccae128.

Original commits were b4fa71eed34d967195514fe9b0a5211fca2bc5bc
and e03c7e367adb8f228332e3c2ef8f45484597b719.

2 years ago[Attributor] Change AAExecutionDomain to check intrinsic edges
Joseph Huber [Wed, 15 Sep 2021 20:16:00 +0000 (16:16 -0400)]
[Attributor] Change AAExecutionDomain to check intrinsic edges

The AAExecutionDomain instance checks if a BB is executed by the main
thread only. Currently, this only checks the `__kmpc_kernel_init` call
for generic regions to indicate the path taken by the main thread. In
the new runtime, we want to be able to detect basic blocks even in SPMD
mode. For this we enable it to check thread-ID intrinsics being compared
to zero as well.

Reviewed By: jdoerfert

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

2 years ago[OpenMP] Add NoSync attributes to alloc / free shared RTL calls
Joseph Huber [Fri, 17 Sep 2021 19:27:33 +0000 (15:27 -0400)]
[OpenMP] Add NoSync attributes to alloc / free shared RTL calls

This patch adds the `nosync` attribute to the `__kmpc_alloc_shared` and
`__kmpc_free_shared` runtime library calls. This allows code analysis to
know that these functins dont contain any barriers. This will help
optimizations reason about the CFG of blocks containing these calls.

Reviewed By: jdoerfert

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

2 years ago[lld-macho] Construct CFString literals by copying the ConcatInputSection
Jez Ng [Wed, 7 Jul 2021 17:47:26 +0000 (13:47 -0400)]
[lld-macho] Construct CFString literals by copying the ConcatInputSection

... instead of constructing a new one each time. This allows us
to take advantage of {D105305}.

I didn't see a substantial difference when linking chromium_framework,
but this paves the way for reusing similar logic for splitting compact
unwind entries into sections. There are a lot more of those, so the
performance impact is significant.

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

2 years ago[MachCore] Report arm64 thread exception state
Vedant Kumar [Tue, 14 Sep 2021 23:58:40 +0000 (16:58 -0700)]
[MachCore] Report arm64 thread exception state

A MachO userspace corefile may contain LC_THREAD commands which specify
thread exception state.

For arm64* only (for now), report a human-readable version of this state
as the thread stop reason, instead of 'SIGSTOP'.

As a follow-up, similar functionality can be implemented for x86 cores
by translating the trapno/err exception registers.

rdar://82898146

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

2 years ago[flang] More checking of NULL pointer actual arguments
peter klausler [Fri, 17 Sep 2021 15:19:10 +0000 (08:19 -0700)]
[flang] More checking of NULL pointer actual arguments

Catch additional missing error cases for typed and untyped
NULL actual arguments to non-intrinsic procedures in cases
of explicit and implicit interfaces.

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

2 years ago[AArch64][SVE][InstCombine] Fold redundant zip1/2(uzp1/2) operations
Usman Nadeem [Sun, 12 Sep 2021 22:53:26 +0000 (15:53 -0700)]
[AArch64][SVE][InstCombine] Fold redundant zip1/2(uzp1/2) operations

    zip1(uzp1(A, B), uzp2(A, B)) --> A
    zip2(uzp1(A, B), uzp2(A, B)) --> B

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

Change-Id: I4a6578db2fcef9ff71ad0e77b9fe08354e6dbfcd

2 years ago[NFC] Remove FIXMEs about calling LLVMContext::yield()
Arthur Eubanks [Fri, 17 Sep 2021 21:47:28 +0000 (14:47 -0700)]
[NFC] Remove FIXMEs about calling LLVMContext::yield()

Nobody has complained about this, and the documentation for
LLVMContext::yield() states that LLVM is allowed to never call it.

Reviewed By: asbirlea

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

2 years agoApply proper source location to fallthrough switch cases.
Adrian Prantl [Fri, 17 Sep 2021 17:58:46 +0000 (10:58 -0700)]
Apply proper source location to fallthrough switch cases.

This fixes a bug in clang where, when clang sees a switch with a
fallthrough to a default like this:

static void funcA(void) {}
static void funcB(void) {}

int main(int argc, char **argv) {

switch (argc) {
    case 0:
        funcA();
        break;
    case 10:
    default:
        funcB();
        break;
}
}

It does not add a proper debug location for that switch case, such as
case 10: above.

Patch by Shubham Rastogi!

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

2 years agoRevert "[OpenMP] Use irbuilder as default for masked and master construct"
cchen [Fri, 17 Sep 2021 21:44:09 +0000 (16:44 -0500)]
Revert "[OpenMP] Use irbuilder as default for masked and master construct"

This reverts commit 2908fc0d3f16f873b5019f1c62a24482c2b75e36.

2 years agoOpenMP 5.0 metadirective
alokmishra.besu [Fri, 17 Sep 2021 21:03:01 +0000 (16:03 -0500)]
OpenMP 5.0 metadirective

This patch supports OpenMP 5.0 metadirective features.
It is implemented keeping the OpenMP 5.1 features like dynamic user condition in mind.

A new function, getBestWhenMatchForContext, is defined in llvm/Frontend/OpenMP/OMPContext.h

Currently this function return the index of the when clause with the highest score from the ones applicable in the Context.
But this function is declared with an array which can be used in OpenMP 5.1 implementation to select all the valid when clauses which can be resolved in runtime. Currently this array is set to null by default and its implementation is left for future.

Reviewed By: jdoerfert

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

2 years agoRevert "OpenMP 5.0 metadirective"
cchen [Fri, 17 Sep 2021 21:14:16 +0000 (16:14 -0500)]
Revert "OpenMP 5.0 metadirective"

This reverts commit c7d7b98e5263472f05b2f3cb767b5d16e1349e9a.

2 years agoOpenMP 5.0 metadirective
cchen [Fri, 17 Sep 2021 21:03:01 +0000 (16:03 -0500)]
OpenMP 5.0 metadirective

This patch supports OpenMP 5.0 metadirective features.
It is implemented keeping the OpenMP 5.1 features like dynamic user condition in mind.

A new function, getBestWhenMatchForContext, is defined in llvm/Frontend/OpenMP/OMPContext.h

Currently this function return the index of the when clause with the highest score from the ones applicable in the Context.
But this function is declared with an array which can be used in OpenMP 5.1 implementation to select all the valid when clauses which can be resolved in runtime. Currently this array is set to null by default and its implementation is left for future.

Reviewed By: jdoerfert

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

2 years ago[OpenMP] Use irbuilder as default for masked and master construct
cchen [Fri, 17 Sep 2021 20:53:49 +0000 (15:53 -0500)]
[OpenMP] Use irbuilder as default for masked and master construct

Use irbuilder as default and remove redundant Clang codegen for masked construct and master construct.

Reviewed By: jdoerfert

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

2 years ago[InstCombine] add tests for min/max intrinsics with offset operand; NFC
Sanjay Patel [Fri, 17 Sep 2021 18:47:49 +0000 (14:47 -0400)]
[InstCombine] add tests for min/max intrinsics with offset operand; NFC