platform/upstream/llvm.git
3 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.

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

3 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

3 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

3 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

3 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

3 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.

3 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.

3 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

3 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

3 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

3 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

3 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.

3 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.

3 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)

3 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

3 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

3 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

3 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

3 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

3 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.

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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.

3 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

3 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.

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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.

3 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

3 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.

3 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

3 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

3 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

3 years ago[mlir][sparse] add a sparse quantized_matmul example to integration test
Aart Bik [Thu, 16 Sep 2021 23:43:03 +0000 (16:43 -0700)]
[mlir][sparse] add a sparse quantized_matmul example to integration test

Note that this revision adds a very tiny bit of constant folding in the
sparse compiler lattice construction. Although I am generally trying to
avoid such canonicalizations (and rely on other passes to fix this instead),
the benefits of avoiding a very expensive disjunction lattice construction
justify having this special code (at least for now).

Reviewed By: bixia

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

3 years ago[mlir][sparse] add dce test for all sparse tensor ops
Aart Bik [Fri, 17 Sep 2021 18:55:45 +0000 (11:55 -0700)]
[mlir][sparse] add dce test for all sparse tensor ops

Reviewed By: ThomasRaoux

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

3 years ago[NFC] Precommit tests for D109954
Dávid Bolvanský [Fri, 17 Sep 2021 19:58:57 +0000 (21:58 +0200)]
[NFC] Precommit tests for D109954

3 years ago[DFSan] Add force_zero_label abilist option to DFSan. This can be used as a work...
Andrew Browne [Wed, 15 Sep 2021 18:50:07 +0000 (11:50 -0700)]
[DFSan] Add force_zero_label abilist option to DFSan. This can be used as a work-around for overtainting.

Reviewed By: morehouse

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

3 years ago[nfc] [lldb] Remove unused DIEPointerSet, DeclToDIEMap and m_decl_to_die
Jan Kratochvil [Fri, 17 Sep 2021 19:51:36 +0000 (21:51 +0200)]
[nfc] [lldb] Remove unused DIEPointerSet, DeclToDIEMap and m_decl_to_die

In whole GIT history this map has been always only written but never read.

3 years ago[compiler-rt] Implement __clear_cache() on OpenBSD/riscv64
Jeremie Courreges-Anglas [Fri, 17 Sep 2021 19:15:46 +0000 (15:15 -0400)]
[compiler-rt] Implement __clear_cache() on OpenBSD/riscv64

3 years ago[flang] Fix build
peter klausler [Fri, 17 Sep 2021 19:39:38 +0000 (12:39 -0700)]
[flang] Fix build

An unused variable declaration from a recent change is eliciting
a fatal warning; remove it.

3 years ago[llvm-reduce] Add reduce operands pass
Samuel [Fri, 17 Sep 2021 19:18:03 +0000 (12:18 -0700)]
[llvm-reduce] Add reduce operands pass

Add reduction to set operands to default values

Reviewed By: aeubanks

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

3 years ago[CSSPGO] Tweakes to lower pseudo probe runtime overhead
Hongtao Yu [Fri, 17 Sep 2021 16:21:39 +0000 (09:21 -0700)]
[CSSPGO] Tweakes to lower pseudo probe runtime overhead

A couple tweaks to

1. allow more thinlto importing by excluding probe intrinsics from IR size in module summary

2. Allow general default attributes (nofree nosync nounwind) for pseudo probe intrinsic. Without those attributes, pseudo probes will be basically treated as unknown calls which will in turn block their containing functions from annotated with those attributes.

Reviewed By: wenlei

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

3 years ago[clang][darwin] Add support for --emit-static-lib
Keith Smiley [Wed, 8 Sep 2021 20:49:16 +0000 (13:49 -0700)]
[clang][darwin] Add support for --emit-static-lib

This uses darwin's default libtool since llvm-ar isn't normally
available.

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

3 years ago[MLIR][Affine] Simplify nested modulo operations when able
Krzysztof Drewniak [Thu, 16 Sep 2021 21:25:20 +0000 (21:25 +0000)]
[MLIR][Affine] Simplify nested modulo operations when able

It is the case that, for all positive a and b such that b divides a
(e mod (a * b)) mod b = e mod b. For example, ((d0 mod 35) mod 5) can
be simplified to (d0 mod 5), but ((d0 mod 35) mod 4) cannot be simplified
further (x = 36 is a counterexample).

This change enables more complex simplifications. For example,
((d0 * 72 + d1) mod 144) mod 9 can now simplify to (d0 * 72 + d1) mod 9
and thus to d1 mod 9. Expressions with chained modulus operators are
reasonably common in tensor applications, and this change _should_
improve code generation for such expressions.

Reviewed By: nicolasvasilache

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

3 years ago[mlir] Prevent crash in DropUnitDim pattern due to tensor with encoding
thomasraoux [Fri, 17 Sep 2021 17:56:21 +0000 (10:56 -0700)]
[mlir] Prevent crash in DropUnitDim pattern due to tensor with encoding

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

3 years ago[clang] [ARM] Don't set the strict alignment flag for armv7 on Windows
Martin Storsjö [Thu, 16 Sep 2021 10:31:31 +0000 (13:31 +0300)]
[clang] [ARM] Don't set the strict alignment flag for armv7 on Windows

Windows on armv7 is as alignment tolerant as Linux.

The alignment considerations in the Windows on ARM ABI are documented
at https://docs.microsoft.com/en-us/cpp/build/overview-of-arm-abi-conventions?view=msvc-160#alignment.

The document doesn't explicitly say in which state the OS configures
the SCTLR.A register (and it's not accessible from user space to
inspect), but in practice, unaligned loads/stores do work and seem
to be as fast as aligned loads and stores. (Unaligned strd also does
seem to work, contrary to Linux, but significantly slower, as they're
handled by the kernel - exactly as the document describes.)

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

3 years ago[flang] Enforce specification function rules on callee, not call
peter klausler [Thu, 16 Sep 2021 00:25:15 +0000 (17:25 -0700)]
[flang] Enforce specification function rules on callee, not call

A function can't be a specification function if it has a dummy procedure
argument, even if it's optional and unused.  So don't check the reference
for actual procedure arguments, but rather the characteristics of the
function.

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

3 years ago[flang] Enforce fixed form rules about END continuation
peter klausler [Wed, 15 Sep 2021 22:46:43 +0000 (15:46 -0700)]
[flang] Enforce fixed form rules about END continuation

From subclause 6.3.3.5: a program unit END statement cannot be
continued in fixed form, and other statements cannot have initial
lines that look like program unit END statements.  I think this
is to avoid violating assumptions that are important to legacy
compilers' statement classification routines.

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

3 years agoAdd information about C99 to the C status page.
Aaron Ballman [Fri, 17 Sep 2021 17:48:33 +0000 (13:48 -0400)]
Add information about C99 to the C status page.

3 years ago[Dexter] Mutually exclusive argument group for --builder and --binary
Tozer [Fri, 10 Sep 2021 12:02:59 +0000 (13:02 +0100)]
[Dexter] Mutually exclusive argument group for --builder and --binary

Dexter currently accepts two possible arguments to determine the binary
used for testing; either --builder <builder> (and optionally
compiler/linker flags) to build the binary, or --binary <binary> to use
the provided binary directly. If both are passed, then --binary
overrides --builder; if neither are passed, then an error is raised.
This patch instead puts these arguments into a required mutually
exclusive argument group, so that an error is automatically raised by
argparse if both or neither are given.

As an additional change, the --cflags and --ldflags will now raise a
warning if they are passed without the --builder flag, as they are
meaningless if Dexter is using a pre-built binary.

Reviewed By: Orlando

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

3 years ago[SLP][NFC]Add a test for reorder of alt shuffle operands.
Alexey Bataev [Fri, 17 Sep 2021 17:30:35 +0000 (10:30 -0700)]
[SLP][NFC]Add a test for reorder of alt shuffle operands.

3 years ago[flang] Validate SIZE(x,DIM=n) dimension for assumed-size array x
peter klausler [Mon, 13 Sep 2021 20:45:30 +0000 (13:45 -0700)]
[flang] Validate SIZE(x,DIM=n) dimension for assumed-size array x

Catch invalid attempts to extract the unknowable extent of the last
dimension of an assumed-size array dummy argument, and clean up
problems with assumed-rank arguments in similar circumstances
exposed by testing the fix.

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

3 years ago[flang] Upgrade warning to error in case of PURE procedure
peter klausler [Tue, 14 Sep 2021 19:44:57 +0000 (12:44 -0700)]
[flang] Upgrade warning to error in case of PURE procedure

A procedure actual argument to a PURE procedure should be required
to have an explicit interface.  Implicit-interface actual arguments
to non-PURE procedures remain a warning.

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

3 years ago[mlir][linalg] Extend drop unit dim pattern to all cases of reduction
thomasraoux [Fri, 17 Sep 2021 17:09:57 +0000 (10:09 -0700)]
[mlir][linalg] Extend drop unit dim pattern to all cases of reduction

Even with all parallel loops reading the output value is still allowed so we
don't have to handle reduction loops differently.

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

3 years ago[mlir] Linalg hoisting should ignore uses outside the loop
thomasraoux [Fri, 17 Sep 2021 17:06:57 +0000 (10:06 -0700)]
[mlir] Linalg hoisting should ignore uses outside the loop

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

3 years ago[mlir] Fix potential crash in hoistRedundantVectorTransfers
thomasraoux [Thu, 16 Sep 2021 14:37:30 +0000 (07:37 -0700)]
[mlir] Fix potential crash in hoistRedundantVectorTransfers

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

3 years ago [lld-macho] Ignore local personality symbols if non-local with the same name...
Vy Nguyen [Wed, 15 Sep 2021 19:49:56 +0000 (15:49 -0400)]
[lld-macho] Ignore local personality symbols if non-local with the same name exisst,  to avoid "too many personalities" error.

    Sometimes people intentionally re-define a dylib personlity symbol as a local defined symbol as a workaround to a ld -r bug.
    As a result, we could see "too many personalities" to encode. This patch tries to handle this case by ignoring the local symbols entirely.

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

3 years ago[NFC] clang-format -i /openmp/libomptarget/deviceRTLs/interface.h
Shilei Tian [Fri, 17 Sep 2021 16:54:40 +0000 (12:54 -0400)]
[NFC] clang-format -i /openmp/libomptarget/deviceRTLs/interface.h

3 years ago[flang] Correct overflow detection in folding of real->integer conversions
peter klausler [Tue, 14 Sep 2021 18:39:48 +0000 (11:39 -0700)]
[flang] Correct overflow detection in folding of real->integer conversions

INT, NINT, FLOOR, and CEILING were failing to report overflow as an
error while folding operations with constant operands.

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

3 years ago[OpenMP] NFC: add type casts to silence gcc warnings
AndreyChurbanov [Fri, 17 Sep 2021 16:49:40 +0000 (19:49 +0300)]
[OpenMP] NFC: add type casts to silence gcc warnings

3 years ago[OpenMP] libomp: Update third-party sources of ittnotify client code.
AndreyChurbanov [Fri, 17 Sep 2021 16:38:34 +0000 (19:38 +0300)]
[OpenMP] libomp: Update third-party sources of ittnotify client code.

The third-party ittnotify sources updated from https://github.com/intel/ittapi.
Changes applied:
- llvm license aded to all files; initial BSD license saved in LICENSE.txt;
- clang-formatted;
- renamed *.c to *.cpp, similar to what we did with all our sources;
- added #include "kmp_config.h" with definition of INTEL_ITTNOTIFY_PREFIX macro
  into ittnotify_static.cpp.

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

3 years ago[flang] Catch errors with intrinsic array inquiry functions
peter klausler [Sat, 11 Sep 2021 00:35:47 +0000 (17:35 -0700)]
[flang] Catch errors with intrinsic array inquiry functions

The intrinsic inquiry functions SIZE and UBOUND -- but not LBOUND --
require a DIM= argument if their first argument is an assumed-size
array.  The intrinsic SHAPE must not be used with an assumed-size
array.

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

3 years ago[llvm] Use drop_begin (NFC)
Kazu Hirata [Fri, 17 Sep 2021 16:16:39 +0000 (09:16 -0700)]
[llvm] Use drop_begin (NFC)

3 years ago[X86] Improve `matchBinaryShuffle()`'s `BLEND` lowering with per-element all-zero...
Roman Lebedev [Fri, 17 Sep 2021 16:07:01 +0000 (19:07 +0300)]
[X86] Improve `matchBinaryShuffle()`'s `BLEND` lowering with per-element all-zero/all-ones knowledge

We can use `OR` instead of `BLEND` if either the element we are not picking is zero (or masked away);
or the element we are picking overwhelms (e.g. it's all-ones) whatever the element we are not picking:
https://alive2.llvm.org/ce/z/RKejao

Reviewed By: RKSimon

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

3 years ago[gn build] (semi-manually) port 750d5fc65c92
Nico Weber [Fri, 17 Sep 2021 16:01:55 +0000 (12:01 -0400)]
[gn build] (semi-manually) port 750d5fc65c92

3 years ago[flang] Accept SIZE(assumed-rank, DIM=n)
peter klausler [Mon, 13 Sep 2021 17:41:27 +0000 (10:41 -0700)]
[flang] Accept SIZE(assumed-rank, DIM=n)

Silence a bogus error message about an out-of-range DIM= argument
when the argument is assumed-rank.  (More generally, don't pretend
to be able to discern a shape of known rank for an assumed-rank
object.)

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

3 years ago[InstCombine] allow splat vectors for narrowing masked fold
Sanjay Patel [Fri, 17 Sep 2021 14:54:59 +0000 (10:54 -0400)]
[InstCombine] allow splat vectors for narrowing masked fold

Mostly cosmetic diffs, but the use of m_APInt matches splat constants.

3 years ago[InstCombine] add vector tests for 'and' folds; NFC
Sanjay Patel [Fri, 17 Sep 2021 13:45:56 +0000 (09:45 -0400)]
[InstCombine] add vector tests for 'and' folds; NFC

3 years ago[mlir][linalg] Add helper to update IndexOps after tiling (NFC).
Tobias Gysi [Fri, 17 Sep 2021 14:54:04 +0000 (14:54 +0000)]
[mlir][linalg] Add helper to update IndexOps after tiling (NFC).

Add the addTileLoopIvsToIndexOpResults method to shift the IndexOp results after tiling.

Reviewed By: nicolasvasilache

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

3 years ago[flang] Revamp C1502 checking of END INTERFACE [generic-spec]
peter klausler [Thu, 9 Sep 2021 22:23:48 +0000 (15:23 -0700)]
[flang] Revamp C1502 checking of END INTERFACE [generic-spec]

Validation of the optional generic-spec on an END INTERFACE statement
was missing many possible error cases; reimplement it.

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

3 years agoFix CodeGen/pgo-sample-thinlto-summary.c with old PM
Thomas Preud'homme [Fri, 17 Sep 2021 09:23:40 +0000 (10:23 +0100)]
Fix CodeGen/pgo-sample-thinlto-summary.c with old PM

Re-add -fexperimental-new-pass-manager to
Clang::CodeGen/pgo-sample-thinlto-summary.c for the test to work on
builds that still default to the old pass manager.

Reviewed By: tejohnson

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

3 years ago[HWASan] Intercept setjmp/longjmp on x86_64.
Matt Morehouse [Fri, 17 Sep 2021 14:08:57 +0000 (07:08 -0700)]
[HWASan] Intercept setjmp/longjmp on x86_64.

Reviewed By: xiangzhangllvm

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

3 years ago[flang][OpenMP] Add semantic checks for ordered construct
PeixinQiao [Fri, 17 Sep 2021 13:53:07 +0000 (21:53 +0800)]
[flang][OpenMP] Add semantic checks for ordered construct

This patch implements the following semantic checks according to
OpenMP Version 5.1 Ordered construct restriction:

```
At most one threads clause can appear on an ordered construct; At most
one simd clause can appear on an ordered construct; At most one
depend(source) clause can appear on an ordered construct; Either
depend(sink:vec) clauses or depend(source) clauses may appear on an
ordered construct, but not both.
```

This patch also implements the following semantic checks according to
the syntax and descriptions in OpenMP Version 5.1 Ordered construct:

```
The dependence types of sink or source are only allowed on an ordered
construct. The depend(*) clauses are not allowed when ordered construct
is a block construct with an ordered region. The threads or simd clauses
are not allowed when the ordered construct is a standalone construct
with no ordered region.
```

Co-authored-by: Sameeran Joshi <sameeranjayant.joshi@amd.com>
Reviewed By: kiranchandramohan

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

3 years ago[NFC] Added testcase for PR25725
Dávid Bolvanský [Fri, 17 Sep 2021 13:48:36 +0000 (15:48 +0200)]
[NFC] Added testcase for PR25725

3 years agoFix test failure from e3b10525b489b604d6a1e540be78bda80afb5868
Erich Keane [Fri, 17 Sep 2021 13:20:55 +0000 (06:20 -0700)]
Fix test failure from e3b10525b489b604d6a1e540be78bda80afb5868

Seemingly, names in anonymous namespaces are ALWAYS given the unique
internal linkage name on windows, and I was not aware of this when I put
the names in my test!  Replaced them with a wildcard.

3 years ago[OpenCL] Supports optional same image reads and writes in C++ for OpenCL 2021
Justas Janickas [Wed, 1 Sep 2021 14:20:01 +0000 (15:20 +0100)]
[OpenCL] Supports optional same image reads and writes in C++ for OpenCL 2021

Adds support for a feature macro `__opencl_c_read_write_images` 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/D109307

3 years ago[DebugInfo] DWARF - Use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 13:03:38 +0000 (14:03 +0100)]
[DebugInfo] DWARF - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years ago[CodeGen] LiveDebug - Use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 13:00:16 +0000 (14:00 +0100)]
[CodeGen] LiveDebug - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years ago[TableGen] X86EVEX2VEXTablesEmitter - Use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 12:36:42 +0000 (13:36 +0100)]
[TableGen] X86EVEX2VEXTablesEmitter - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years ago[X86] X86PreTileConfig - Use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 12:35:59 +0000 (13:35 +0100)]
[X86] X86PreTileConfig - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years agoMake multiversioning work with internal linkage
Erich Keane [Thu, 16 Sep 2021 16:57:54 +0000 (09:57 -0700)]
Make multiversioning work with internal linkage

We previously made all multiversioning resolvers/ifuncs have weak
ODR linkage in IR, since we NEED to emit the whole resolver every time
we see a call, but it is not necessarily the place where all the
definitions live.

HOWEVER, when doing so, we neglected the case where the versions have
internal linkage.  This patch ensures we do this, so you don't get weird
behavior with static functions.

3 years ago[MLIR] PresbugerSet: slightly expand documentation
Arjun P [Fri, 17 Sep 2021 11:07:28 +0000 (16:37 +0530)]
[MLIR] PresbugerSet: slightly expand documentation

3 years agoFix Wdocumentation warnings. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 11:45:56 +0000 (12:45 +0100)]
Fix Wdocumentation warnings. NFCI.

Fix parameter name typos and drop returns statements from void functions

3 years ago[X86][Atom] Fix integer shuffles uops, latency and throughput
Simon Pilgrim [Fri, 17 Sep 2021 10:51:46 +0000 (11:51 +0100)]
[X86][Atom] Fix integer shuffles uops, latency and throughput

The MMX pack/unpck shuffles don't need an override - they have the same behaviour as other shuffles (Port0 only).
The SSE pslldq/psrldq shuffles don't need an override - they have the same behaviour as other shuffles (Port0 only).
The SSE pshufb shuffles use 4uops (+1 load).

Noticed the pslldq/psrldq issue while trying to improve reduction costs via the D103695 helper script, and fixed the others while reviewing. Confirmed with Intel AoM / Agner / InstLatX64.

3 years ago[CodeGen] MachineInstr::getUsedDebugRegs() - Use const-ref iterator in for-range...
Simon Pilgrim [Thu, 16 Sep 2021 17:50:20 +0000 (18:50 +0100)]
[CodeGen] MachineInstr::getUsedDebugRegs() - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years ago[AsmPrinter] DebugLocEntry::dump() - Use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Thu, 16 Sep 2021 17:48:20 +0000 (18:48 +0100)]
[AsmPrinter] DebugLocEntry::dump() - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.