platform/upstream/llvm.git
2 years ago[PGO] Remove legacy PM passes
Fangrui Song [Fri, 15 Apr 2022 17:26:43 +0000 (10:26 -0700)]
[PGO] Remove legacy PM passes

Legacy PM for optimization pipeline was deprecated in 13.0.0 and Clang dropped
legacy PM support in D123609. This change removes legacy PM passes for PGO so
that downstream projects won't be able to use it. It seems appropriate to start
removing such "add-on" features like instrumentations, before we remove more
stuff after 15.x is branched.

I have checked many LLVM users and only ldc[1] uses the legacy PGO pass.

[1]: https://github.com/ldc-developers/ldc/issues/3961

Reviewed By: davidxl

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

2 years ago[MLIR] Fix operation clone
William S. Moses [Sat, 26 Mar 2022 18:42:15 +0000 (14:42 -0400)]
[MLIR] Fix operation clone

Operation clone is currently faulty.

Suppose you have a block like as follows:

```
(%x0 : i32) {
   %x1 = f(%x0)
   return %x1
}
```

The test case we have is that we want to "unroll" this, in which we want to change this to compute `f(f(x0))` instead of just `f(x0)`. We do so by making a copy of the body at the end of the block and set the uses of the argument in the copy operations with the value returned from the original block.
This is implemented as follows:
1) map to the block arguments to the returned value (`map[x0] = x1`).
2) clone the body

Now for this small example, this works as intended and we get the following.

```
(%x0 : i32) {
   %x1 = f(%x0)
   %x2 = f(%x1)
   return %x2
}
```

This is because the current logic to clone `x1 = f(x0)` first looks up the arguments in the map (which finds `x0` maps to `x1` from the initialization), and then sets the map of the result to the cloned result (`map[x1] = x2`).

However, this fails if `x0` is not an argument to the op, but instead used inside the region, like below.

```
(%x0 : i32) {
   %x1 = f() {
      yield %x0
   }
   return %x1
}
```

This is because cloning an op currently first looks up the args (none), sets the map of the result (`map[%x1] = %x2`), and then clones the regions. This results in the following, which is clearly illegal:

```
(%x0 : i32) {
   %x1 = f() {
      yield %x0
   }
   %x2 = f() {
      yield %x2
   }
   return %x2
}
```

Diving deeper, this is partially due to the ordering (how this PR fixes it), as well as how region cloning works. Namely it will first clone with the mapping, and then it will remap all operands. Since the ordering above now has a map of `x0 -> x1` and `x1 -> x2`, we end up with the incorrect behavior here.

Reviewed By: ftynse

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

2 years ago[flang] Fix Symbol::Rank for ProcEntityDetails
Peter Klausler [Wed, 6 Apr 2022 22:55:53 +0000 (15:55 -0700)]
[flang] Fix Symbol::Rank for ProcEntityDetails

When a procedure pointer or procedure dummy argument has a
defined interface, the rank of the pointer (or dummy) is the
rank of the interface.

Also tweak code discovered in shape analysis when investigating
this problam so that it returns a vector of emptied extents rather
than std::nullopt when the extents are not scope-invariant, so that
the rank can at least be known.

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

2 years ago[mlir][ods][NFC] Move enum attribute definitions from OpBase.td to EnumAttr.td
jfurtek [Fri, 15 Apr 2022 16:41:56 +0000 (16:41 +0000)]
[mlir][ods][NFC] Move enum attribute definitions from OpBase.td to EnumAttr.td

This diff moves `EnumAttr` tablegen definitions (specifically, `IntEnumAttr` and
`BitEnumAttr`-related classes) from `OpBase.td` to `EnumAttr.td`. No
functionality is changed.

Reviewed By: rriddle

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

2 years ago[mlir] Support opaque types in LLVM IR -> MLIR translation
Alex Zinenko [Fri, 15 Apr 2022 10:00:55 +0000 (12:00 +0200)]
[mlir] Support opaque types in LLVM IR -> MLIR translation

LLVM IR is moving towards adoption of opaque pointer types. These require extra
information to be passed when constructing some operations, in particular GEP
and Alloca. Adapt the builders of said operations and modify the translation
code to handle both opaque and non-opaque pointers.

This incidentally adds the translation for Alloca alignment and fixes the translation
of struct-related GEP indices that must be constant.

Reviewed By: wsmoses

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

2 years agoProperly identify builtins in a diagnostic note
Aaron Ballman [Fri, 15 Apr 2022 15:45:52 +0000 (11:45 -0400)]
Properly identify builtins in a diagnostic note

When emitting a "conflicting types" warning for a function declaration,
it's more clear to diagnose the previous declaration specifically as
being a builtin if it one.

2 years agoClean up `OMPAtomicDirective::Create`
Shilei Tian [Fri, 15 Apr 2022 15:39:04 +0000 (11:39 -0400)]
Clean up `OMPAtomicDirective::Create`

2 years ago[VP] Rename ISD::VP_FPROUND and ISD::VP_FPEXT
Fraser Cormack [Fri, 15 Apr 2022 08:34:04 +0000 (09:34 +0100)]
[VP] Rename ISD::VP_FPROUND and ISD::VP_FPEXT

Rename them to be more closely related to their non-VP counterparts.

Reviewed By: jacquesguan, ym1813382441

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

2 years ago[NFC][UpdateTestChecks] Fix whitespace in common.py and asm.py
Daniil Kovalev [Fri, 15 Apr 2022 15:11:24 +0000 (18:11 +0300)]
[NFC][UpdateTestChecks] Fix whitespace in common.py and asm.py

While working on D122986, noticed that indentation size varies even within
one file. Fixed that - now indentation is 2 spaces everywhere. This indentation

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

2 years ago[clang] Implement Change scope of lambda trailing-return-type
Corentin Jabot [Sun, 6 Feb 2022 21:58:43 +0000 (22:58 +0100)]
[clang] Implement Change scope of lambda trailing-return-type

Implement P2036R3.

Captured variables by copy (explicitely or not), are deduced
correctly at the point we know whether the lambda is mutable,
and ill-formed before that.

Up until now, the entire lambda declaration up to the start of the body would be parsed in the parent scope, such that capture would not be available to look up.

The scoping is changed to have an outer lambda scope, followed by the lambda prototype and body.

The lambda scope is necessary because there may be a template scope between the start of the lambda (to which we want to attach the captured variable) and the prototype scope.

We also need to introduce a declaration context to attach the captured variable to (and several parts of clang assume captures are handled from the call operator context), before we know the type of the call operator.

The order of operations is as follow:

* Parse the init capture in the lambda's parent scope

* Introduce a lambda scope

* Create the lambda class and call operator

* Add the init captures to the call operator context and the lambda scope. But the variables are not capured yet (because we don't know their type).
Instead, explicit  captures are stored in a temporary map that conserves the order of capture (for the purpose of having a stable order in the ast dumps).

* A flag is set on LambdaScopeInfo to indicate that we have not yet injected the captures.

* The parameters are parsed (in the parent context, as lambda mangling recurses in the parent context, we couldn't mangle a lambda that is attached to the context of a lambda whose type is not yet known).

* The lambda qualifiers are parsed, at this point We can switch (for the second time) inside the lambda context, unset the flag indicating that we have not parsed the lambda qualifiers,
record the lambda is mutable and capture the explicit variables.

* We can parse the rest of the lambda type, transform the lambda and call operator's types and also transform the call operator to a template function decl where necessary.

At this point, both captures and parameters can be injected in the body's scope. When trying to capture an implicit variable, if we are before the qualifiers of a lambda, we need to remember that the variables are still in the parent's context (rather than in the call operator's).

Reviewed By: aaron.ballman, #clang-language-wg, ChuanqiXu

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

2 years ago[NFC][Costmodel][LV][X86] Refresh one or two interleaved load/store tests
Roman Lebedev [Fri, 15 Apr 2022 13:24:46 +0000 (16:24 +0300)]
[NFC][Costmodel][LV][X86] Refresh one or two interleaved load/store tests

2 years ago[clang][deps] NFC: Update documentation
Jan Svoboda [Mon, 11 Apr 2022 08:20:38 +0000 (10:20 +0200)]
[clang][deps] NFC: Update documentation

2 years ago[clang][deps] NFC: Inline function with single caller
Jan Svoboda [Mon, 11 Apr 2022 08:20:20 +0000 (10:20 +0200)]
[clang][deps] NFC: Inline function with single caller

2 years ago[Clang][Sema] Fix invalid redefinition error in if/switch/for statement
Jun Zhang [Fri, 15 Apr 2022 07:14:38 +0000 (15:14 +0800)]
[Clang][Sema] Fix invalid redefinition error in if/switch/for statement

Clang should no longer incorrectly diagnose a variable declaration inside of a
lambda expression that shares the name of a variable in a containing
if/while/for/switch init statement as a redeclaration.

After this patch, clang is supposed to accept code below:

void foo() {
  for (int x = [] { int x = 0; return x; }(); ;) ;
}

Fixes https://github.com/llvm/llvm-project/issues/54913

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

2 years agoAdjust Bazel BUILD files for 6d45558c1
Dmitri Gribenko [Fri, 15 Apr 2022 13:45:18 +0000 (15:45 +0200)]
Adjust Bazel BUILD files for 6d45558c1

2 years ago[BOLT] Check if LLVM_REVISION is defined
Amir Ayupov [Fri, 15 Apr 2022 13:13:19 +0000 (06:13 -0700)]
[BOLT] Check if LLVM_REVISION is defined

Handle the case where LLVM_REVISION is undefined (due to LLVM_APPEND_VC_REV=OFF
or otherwise) by setting "<unknown>" value as before D123549.

Reviewed By: yota9

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

2 years agoFix failing test case found by bots:
Aaron Ballman [Fri, 15 Apr 2022 13:19:25 +0000 (09:19 -0400)]
Fix failing test case found by bots:

https://lab.llvm.org/buildbot#builders/109/builds/36683
https://lab.llvm.org/buildbot#builders/164/builds/15456
(and others)

2 years ago[clang][lex] NFC: Use FileEntryRef in PreprocessorLexer::getFileEntry()
Jan Svoboda [Fri, 15 Apr 2022 12:48:34 +0000 (14:48 +0200)]
[clang][lex] NFC: Use FileEntryRef in PreprocessorLexer::getFileEntry()

This patch changes the return type of `PreprocessorLexer::getFileEntry()` so that its clients may stop using the deprecated APIs of `FileEntry`.

Reviewed By: bnbarham

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

2 years ago[clang] NFCI: Use FileEntryRef in FileManagerTest
Jan Svoboda [Fri, 15 Apr 2022 12:48:27 +0000 (14:48 +0200)]
[clang] NFCI: Use FileEntryRef in FileManagerTest

This patch removes use of the deprecated `{File,Directory}Entry::getName()` from `FileManager` unit tests by using `{File,Directory}EntryRef` instead.

Reviewed By: bnbarham

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

2 years ago[clang] NFCI: Use DirectoryEntryRef in collectIncludePCH
Jan Svoboda [Fri, 15 Apr 2022 12:48:19 +0000 (14:48 +0200)]
[clang] NFCI: Use DirectoryEntryRef in collectIncludePCH

This patch removes use of the deprecated `DirectoryEntry::getName()` from `collectIncludePCH` by using `{File,Directory}EntryRef` instead.

Reviewed By: bnbarham

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

2 years ago[clang][CodeGen] NFCI: Use FileEntryRef
Jan Svoboda [Fri, 15 Apr 2022 12:48:01 +0000 (14:48 +0200)]
[clang][CodeGen] NFCI: Use FileEntryRef

This patch removes use of the deprecated `DirectoryEntry::getName()` from clangCodeGen by using `{File,Directory}EntryRef` instead.

Reviewed By: bnbarham

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

2 years ago[clang][parse] NFCI: Use FileEntryRef in Parser::ParseModuleImport()
Jan Svoboda [Fri, 15 Apr 2022 12:47:34 +0000 (14:47 +0200)]
[clang][parse] NFCI: Use FileEntryRef in Parser::ParseModuleImport()

This patch removes use of the deprecated `DirectoryEntry::getName()` from `Parser` by using `{File,Directory}EntryRef` instead.

Reviewed By: bnbarham

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

2 years ago[C89/C2x] Diagnose calls to a function without a prototype but passes arguments
Aaron Ballman [Fri, 15 Apr 2022 13:07:28 +0000 (09:07 -0400)]
[C89/C2x] Diagnose calls to a function without a prototype but passes arguments

This catches places where a function without a prototype is
accidentally used, potentially passing an incorrect number of
arguments, and is a follow-up to the work done in
https://reviews.llvm.org/D122895 and described in the RFC
(https://discourse.llvm.org/t/rfc-enabling-wstrict-prototypes-by-default-in-c).
The diagnostic is grouped under the new -Wdeprecated-non-prototypes
warning group and is enabled by default.

The diagnostic is disabled if the function being called was implicitly
declared (the user already gets an on-by-default warning about the
creation of the implicit function declaration, so no need to warn them
twice on the same line). Additionally, the diagnostic is disabled if
the declaration of the function without a prototype was in a location
where the user explicitly disabled deprecation warnings for functions
without prototypes (this allows the provider of the API a way to
disable the diagnostic at call sites because the lack of prototype is
intentional).

2 years ago[mlir][vector] Reorder elementwise(transpose)
Lei Zhang [Fri, 15 Apr 2022 12:57:24 +0000 (08:57 -0400)]
[mlir][vector] Reorder elementwise(transpose)

Similar to the existing pattern for reodering cast(transpose),
this makes transpose following transpose and increases the chance
of embedding the transposition inside contraction op. Actually
cast ops are just special instances of elementwise ops.

Reviewed By: ThomasRaoux

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

2 years ago[AArch64] Async unwind - Fix MTE codegen emitting frame adjustments in a loop
Momchil Velikov [Fri, 15 Apr 2022 11:19:02 +0000 (12:19 +0100)]
[AArch64] Async unwind - Fix MTE codegen emitting frame adjustments in a loop

When untagging the stack, the compiler may emit a sequence like:
```
        .LBB0_1:
          st2g sp, [sp], #32
          sub x8, x8, #32
          cbnz x8, .LBB0_1
          stg sp, [sp], #16
```
These stack adjustments cannot be described by CFI instructions.

This patch disables merging of SP update with untagging, i.e. makes the
compiler use an additional scratch register (there should be plenty
available at this point as we are in the epilogue) and generate:
```
            mov     x9, sp
            mov     x8, #256
            stg     x9, [x9], #16
    .LBB0_1:
            sub     x8, x8, #32
            st2g    x9, [x9], #32
            cbnz    x8, .LBB0_1
            add     sp, sp, #272
```
Merging is disabled only when we need to generate asynchronous unwind
tables.

Reviewed By: eugenis

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

2 years agoRequire asserts in newly added test
Roman Lebedev [Fri, 15 Apr 2022 12:56:37 +0000 (15:56 +0300)]
Require asserts in newly added test

2 years ago[UpdateTestChecks] Prevent rapid onset insanity when forced to write LoopVectorize...
Roman Lebedev [Fri, 15 Apr 2022 12:37:29 +0000 (15:37 +0300)]
[UpdateTestChecks] Prevent rapid onset insanity when forced to write LoopVectorize-driven costmodel tests

Subj, or on other words, we have a lot of tests that are driven by
the LoopVectorizer's debug output, but we don't have
any meaningful way to autogenerate checklines in them,
which means that an insurmountable amount of manual work
is required when modifying the appropriate cost models.

That is not sustainable, so this presents a solution.

Reviewed By: RKSimon

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

2 years ago[gn build] Port 1d83750f631d
LLVM GN Syncbot [Fri, 15 Apr 2022 11:44:38 +0000 (11:44 +0000)]
[gn build] Port 1d83750f631d

2 years ago[libc++] Implement ranges::copy{, _n, _if, _backward}
Nikolas Klauser [Fri, 15 Apr 2022 11:43:40 +0000 (13:43 +0200)]
[libc++] Implement ranges::copy{, _n, _if, _backward}

Reviewed By: Mordante, var-const, #libc

Spies: sstefan1, libcxx-commits, mgorny

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

2 years ago[AArch64][SelectionDAG] Refactor to support more scalable vector extending stores
zhongyunde [Fri, 15 Apr 2022 01:44:11 +0000 (09:44 +0800)]
[AArch64][SelectionDAG] Refactor to support more scalable vector extending stores

Similar to D122281, we should firstly exclude all scalable vector extending
stores and then selectively enable those which we directly support.

Also merge integer and float scalable vector into scalable_vector_valuetypes.

Reviewed By: paulwalker-arm

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

2 years ago[gn build] (manually) port 6d45558c1a05d (MipsGenPostLegalizeGICombiner)
Nico Weber [Fri, 15 Apr 2022 11:05:15 +0000 (07:05 -0400)]
[gn build] (manually) port 6d45558c1a05d (MipsGenPostLegalizeGICombiner)

2 years ago[ExpandMemCmp] Properly expand `bcmp` to an equality pattern.
Clement Courbet [Fri, 15 Apr 2022 09:11:26 +0000 (11:11 +0200)]
[ExpandMemCmp] Properly expand `bcmp` to an equality pattern.

Before that change, constant-size `bcmp` would miss an opportunity to generate
a more efficient equality pattern and would generate a -1/0-1 pattern
instead.

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

2 years ago[NFC] Add test in preparation for D123849.
Clement Courbet [Fri, 15 Apr 2022 09:08:52 +0000 (11:08 +0200)]
[NFC] Add test in preparation for D123849.

2 years ago[WebAssembly] Remove TODO comment for IAS, NFC
Brad Smith [Fri, 15 Apr 2022 08:24:49 +0000 (04:24 -0400)]
[WebAssembly] Remove TODO comment for IAS, NFC

IAS has been enabled on WebAssembly since commit 0a55d3f557a74cfb459b24e442072302d5444baf.

2 years ago[UpdateTestChecks] Add NVPTX support in update_llc_test_checks.py
Daniil Kovalev [Fri, 15 Apr 2022 07:57:38 +0000 (10:57 +0300)]
[UpdateTestChecks] Add NVPTX support in update_llc_test_checks.py

This patch makes possible generating NVPTX assembly check lines with
update_llc_test_checks.py utility.

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

2 years agoApply clang-tidy fixes for readability-identifier-naming in TestTypes.cpp (NFC)
Mehdi Amini [Mon, 4 Apr 2022 00:18:47 +0000 (00:18 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in TestTypes.cpp (NFC)

2 years agoApply clang-tidy fixes for modernize-use-default-member-init in ControlFlowSinkUtils...
Mehdi Amini [Mon, 4 Apr 2022 00:03:35 +0000 (00:03 +0000)]
Apply clang-tidy fixes for modernize-use-default-member-init in ControlFlowSinkUtils.cpp (NFC)

2 years ago[Driver] Move Lanai IAS enabling to Generic_GCC::IsIntegratedAssemblerDefault, NFC
Brad Smith [Fri, 15 Apr 2022 07:52:58 +0000 (03:52 -0400)]
[Driver] Move Lanai IAS enabling to Generic_GCC::IsIntegratedAssemblerDefault, NFC

Reviewed By: MaskRay, jpienaar

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

2 years ago[lit] Forward more sanitizer env in TestingConfig
Vitaly Buka [Fri, 15 Apr 2022 07:31:22 +0000 (00:31 -0700)]
[lit] Forward more sanitizer env in TestingConfig

2 years ago[NFC] Reformat a part of TestingConfig.py
Vitaly Buka [Fri, 15 Apr 2022 07:22:23 +0000 (00:22 -0700)]
[NFC] Reformat a part of TestingConfig.py

2 years ago[RISCV][NFC] Refactor VL patterns for vnsrl and vnsra
Lian Wang [Fri, 8 Apr 2022 02:51:12 +0000 (02:51 +0000)]
[RISCV][NFC] Refactor VL patterns for vnsrl and vnsra

Reviewed By: frasercrmck

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

2 years ago[ELF][ARM] Fix unneeded thunk for branches to hidden undefined weak
Fangrui Song [Fri, 15 Apr 2022 06:58:13 +0000 (23:58 -0700)]
[ELF][ARM] Fix unneeded thunk for branches to hidden undefined weak

Similar to D123750 for AArch64.

2 years agoAMDGPU: Add more mad_64_32 test cases
Nicolai Hähnle [Fri, 15 Apr 2022 04:50:57 +0000 (23:50 -0500)]
AMDGPU: Add more mad_64_32 test cases

Test the behavior when a MUL is used multiple times, as well as when it
is uniform.

Run the tests for gfx9 as well, which added S_MUL_HI_[IU]32.

2 years ago[mlir] Fix verification order of nested ops.
Chia-hung Duan [Fri, 15 Apr 2022 04:33:40 +0000 (04:33 +0000)]
[mlir] Fix verification order of nested ops.

In order to increase parallism, certain ops with regions and have the
IsIsolatedFromAbove trait will have their verification delayed. That
means the region verifier may access the invalid ops and may lead to a
crash.

Reviewed By: rriddle

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

2 years agoAMDGPU: Add mixed sign/zero-extend multiply-add test
Nicolai Hähnle [Fri, 15 Apr 2022 04:02:02 +0000 (23:02 -0500)]
AMDGPU: Add mixed sign/zero-extend multiply-add test

There's a missed opportunity here that a later patch will exploit.

2 years ago[flang][runtime] Don't skip input spaces when they are significant
Peter Klausler [Wed, 6 Apr 2022 21:42:29 +0000 (14:42 -0700)]
[flang][runtime] Don't skip input spaces when they are significant

When formatted input (not list-directed or NAMELIST) is in "BZ" mode,
either because a BZ control edit descriptor appeared in a FORMAT or
BLANK="ZERO" appeared in OPEN or READ, input editing must not skip
over blanks before or within the input field.

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

2 years ago[mlir] Update bazel file after adding nvgpu to nvvm conversion
Thomas Raoux [Fri, 15 Apr 2022 04:07:46 +0000 (04:07 +0000)]
[mlir] Update bazel file after adding nvgpu to nvvm conversion

2 years ago[LoongArch] Fix shared build. NFC.
Michael Liao [Fri, 15 Apr 2022 04:16:26 +0000 (00:16 -0400)]
[LoongArch] Fix shared build. NFC.

2 years ago[PGO][test] Fix memop_size_opt.ll
Fangrui Song [Fri, 15 Apr 2022 04:16:04 +0000 (21:16 -0700)]
[PGO][test] Fix memop_size_opt.ll

2 years ago[PGO][test] Remove duplicate --pgo-instr-memop tests
Fangrui Song [Fri, 15 Apr 2022 04:13:43 +0000 (21:13 -0700)]
[PGO][test] Remove duplicate --pgo-instr-memop tests

2 years ago[LoongArch] Add support for selecting constant materializations.
wanglei [Fri, 15 Apr 2022 03:43:36 +0000 (11:43 +0800)]
[LoongArch] Add support for selecting constant materializations.

Integer materializing can generate LU12I_W, ORI, LU32I_D, LU52I_D and
ADDI_W instructions.

According to the sign-extended behavior of these instructions
(except ORI), the generated instruction sequence can be improved.

For example, load -1 into general register:
The ADDI_W instruction performs the operation that the [31:0] bit data
in the general register `rj` plus the 12-bit immediate `simm12` sign
extension 32-bit data; the resultant [31:0] bit is sign extension, then
written into the general register `rd`.

Normal sequence:

```
lu12i.w $a0, -1
ori $a0, $a0, 2048
```

Improved with sign-extended instruction:

```
addi.w $a0, $zero,  -1
```

Reviewed By: SixWeining, MaskRay

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

2 years ago[mlir][vector] Add operations used for Vector distribution
Thomas Raoux [Wed, 13 Apr 2022 18:38:11 +0000 (18:38 +0000)]
[mlir][vector] Add operations used for Vector distribution

Add vector op warp_execute_on_lane_0 that will be used to do incremental
vector distribution in order to target warp level vector programming for
architectures with GPU-like SIMT programming model.
The idea behing the op is discussed further on discourse:
https://discourse.llvm.org/t/vector-vector-distribution-large-vector-to-small-vector/1983/23

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

2 years ago[PGO][test] Change opt -foo tests to -passes= and remove duplicates
Fangrui Song [Fri, 15 Apr 2022 03:35:35 +0000 (20:35 -0700)]
[PGO][test] Change opt -foo tests to -passes= and remove duplicates

2 years ago[mlir] Add assert to fail with more info (NFC)
Jacques Pienaar [Fri, 15 Apr 2022 02:54:12 +0000 (19:54 -0700)]
[mlir] Add assert to fail with more info (NFC)

This would have assert before during tensor type construction with
opaque error, assert and fail earlier now.

2 years ago[RISCV][VP] Add RVV codegen for vp.trunc.
jacquesguan [Tue, 12 Apr 2022 09:34:40 +0000 (09:34 +0000)]
[RISCV][VP] Add RVV codegen for vp.trunc.

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

2 years agoAdd missing word in llc docs
Michael Williamson [Fri, 15 Apr 2022 02:28:23 +0000 (22:28 -0400)]
Add missing word in llc docs

2 years ago[BOLT][NFC] Use LLVM_REVISION instead of BOLT_VERSION_STRING
Amir Ayupov [Fri, 15 Apr 2022 02:09:44 +0000 (19:09 -0700)]
[BOLT][NFC] Use LLVM_REVISION instead of BOLT_VERSION_STRING

Remove duplicate version string identification

Reviewed By: rafauler

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

2 years ago[mlir][LLVMIR] Add more vector predication intrinsic ops.
jacquesguan [Fri, 8 Apr 2022 03:38:40 +0000 (03:38 +0000)]
[mlir][LLVMIR] Add more vector predication intrinsic ops.

This revision adds vector predication select, merge and load/store intrinsic ops.

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

2 years ago[gcov][test] Change some legacy PM tests to new PM and remove others
Fangrui Song [Fri, 15 Apr 2022 02:12:14 +0000 (19:12 -0700)]
[gcov][test] Change some legacy PM tests to new PM and remove others

2 years agoclang/AMDGPU: Define macro for -munsafe-fp-atomics
Matt Arsenault [Thu, 14 Apr 2022 22:49:50 +0000 (18:49 -0400)]
clang/AMDGPU: Define macro for -munsafe-fp-atomics

The HIP headers want to use this to swap the implementation of the
function, rather than relying on backend expansion of the generic
atomic instruction.

Fixes: SWDEV-332998

2 years agoMips/GlobalISel: Add stub post-legalizer combiner
Matt Arsenault [Sun, 10 Apr 2022 16:08:10 +0000 (12:08 -0400)]
Mips/GlobalISel: Add stub post-legalizer combiner

This enables no combines, just adds the boilerplate for the new pass.

2 years ago[utils] Use git to checkout code instead of svn in building docker image
Xiaodong Liu [Fri, 15 Apr 2022 01:34:16 +0000 (01:34 +0000)]
[utils] Use git to checkout code instead of svn in building docker image

Reviewed By: sammccall

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

2 years agoFix MLIR website generation
Mehdi Amini [Fri, 15 Apr 2022 01:28:10 +0000 (01:28 +0000)]
Fix MLIR website generation

2 years agollvm-reduce: Handle cloning MachineFrameInfo and stack objects
Matt Arsenault [Wed, 13 Apr 2022 23:01:20 +0000 (19:01 -0400)]
llvm-reduce: Handle cloning MachineFrameInfo and stack objects

This didn't work at all before, and would assert on any frame
index. Also copy the other fields, which I believe should cover
everything. There are a few that are untested since MIR serialization
is apparently still missing them (isStatepointSpillSlot,
ObjectSSPLayout, and ObjectSExt/ObjectZExt).

2 years ago[flang] Accept TYPE(intrinsic type) in declarations only for non-extension type
Peter Klausler [Wed, 6 Apr 2022 21:00:40 +0000 (14:00 -0700)]
[flang] Accept TYPE(intrinsic type) in declarations only for non-extension type

To avoid clashing with names of user derived types, the redundant
syntax TYPE(intrinsic type spec) must be interpreted as a monomorphic
derived type when "intrinsic type spec" is a single word.  This
affects TYPE(BYTE) and TYPE(DOUBLECOMPLEX), but not TYPE(DOUBLE COMPLEX)
in free form source.

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

2 years ago[libomptarget] [amdgpu] Hostcall offset check should consider implicit args
Dhruva Chakrabarti [Thu, 14 Apr 2022 23:38:49 +0000 (23:38 +0000)]
[libomptarget] [amdgpu] Hostcall offset check should consider implicit args

Fixed hostcall offset check to compare against kernarg segment size
and implicit arguments. Improved the corresponding debug print.

Reviewed By: JonChesterfield

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

2 years agollvm-reduce: Inform MRI of used phys reg masks
Matt Arsenault [Wed, 13 Apr 2022 22:40:52 +0000 (18:40 -0400)]
llvm-reduce: Inform MRI of used phys reg masks

I'm not sure how to directly observe this invisible cache for a test.

2 years agollvm-reduce: Copy register allocation hints to clone
Matt Arsenault [Wed, 13 Apr 2022 21:39:04 +0000 (17:39 -0400)]
llvm-reduce: Copy register allocation hints to clone

2 years agoAMDGPU: Select i8/i16 global and flat atomic load/store
Matt Arsenault [Tue, 12 Apr 2022 22:10:02 +0000 (18:10 -0400)]
AMDGPU: Select i8/i16 global and flat atomic load/store

As far as I know these should be atomic anyway, as long as the address
is aligned. Unaligned atomics hit an ugly error in AtomicExpand.

2 years ago[flang] Defer NAMELIST group item name resolution
Peter Klausler [Wed, 6 Apr 2022 19:51:57 +0000 (12:51 -0700)]
[flang] Defer NAMELIST group item name resolution

Items in NAMELIST groups might be host-associated implicitly-typed
variables, but name resolution can't know that when the NAMELIST
appears in a specification part and the host's execution part has
not yet been analyzed.  So defer NAMELIST group item name resolution
to the end of the execution part.  This is safe because nothing
else in name resolution depends on whether a variable is in a
NAMELIST group or not.

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

2 years agoAMDGPU: Fix assert if v_mov_b32_dpp is last instruction in the block
Matt Arsenault [Fri, 8 Apr 2022 14:16:56 +0000 (10:16 -0400)]
AMDGPU: Fix assert if v_mov_b32_dpp is last instruction in the block

This can happen if the use instruction is a phi.

Fixes issue 49961

2 years agollvm-reduce: Fix asserting on undef virtual registers
Matt Arsenault [Wed, 13 Apr 2022 21:07:44 +0000 (17:07 -0400)]
llvm-reduce: Fix asserting on undef virtual registers

This was only populating the virtual register map for def operands
that appeared in the function, but that may not exist if there are
only undef uses.

2 years agollvm-reduce: Fix handling of generic virtual registers
Matt Arsenault [Wed, 13 Apr 2022 17:18:41 +0000 (13:18 -0400)]
llvm-reduce: Fix handling of generic virtual registers

Try to preserve register banks, types and names. Fixes the lowest
hanging fruit in issue 54894.

2 years agoMachineCSE: Report this requires SSA
Matt Arsenault [Wed, 13 Apr 2022 14:45:27 +0000 (10:45 -0400)]
MachineCSE: Report this requires SSA

2 years agollvm-reduce: Fix some copy-pasted comment errors
Matt Arsenault [Wed, 13 Apr 2022 01:51:30 +0000 (21:51 -0400)]
llvm-reduce: Fix some copy-pasted comment errors

2 years agoMachineFunction: Remove unused field
Matt Arsenault [Fri, 15 Apr 2022 00:16:15 +0000 (20:16 -0400)]
MachineFunction: Remove unused field

2 years agoRemove folder introduced by incorrect patch level
Jonas Devlieghere [Thu, 14 Apr 2022 23:59:56 +0000 (16:59 -0700)]
Remove folder introduced by incorrect patch level

2 years ago[flang] Allow modification of construct entities
Peter Klausler [Tue, 5 Apr 2022 20:42:12 +0000 (13:42 -0700)]
[flang] Allow modification of construct entities

Construct entities from ASSOCIATE, SELECT TYPE, and SELECT RANK
are modifiable if the are associated with modifiable variables
without vector subscripts.  Update WhyNotModifiable() to accept
construct entities that are appropriate.

A need for more general error reporting from one overload of
WhyNotModifiable() caused its result type to change to
std::optional<parser::Message> instead of ::MessageFixedText,
and this change had some consequences that rippled through
call sites.

Some test results that didn't allow for modifiable construct
entities needed to be updated.

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

2 years ago[lldb] Show the DBGError if dsymForUUID can't find a dSYM
Jonas Devlieghere [Thu, 14 Apr 2022 23:52:38 +0000 (16:52 -0700)]
[lldb] Show the DBGError if dsymForUUID can't find a dSYM

Show the user the DBGError (if available) when dsymForUUID fails.

rdar://90949180

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

2 years ago[mlir][nvgpu] Move mma.sync and ldmatrix in nvgpu dialect
Thomas Raoux [Thu, 14 Apr 2022 22:10:51 +0000 (22:10 +0000)]
[mlir][nvgpu] Move mma.sync and ldmatrix in nvgpu dialect

Move gpu operation mma.sync and ldmatrix in nvgpu as they are specific
to nvidia target.

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

2 years ago[randstruct] Add test for "-frandomize-layout-seed-file" flag
Bill Wendling [Thu, 14 Apr 2022 23:35:41 +0000 (16:35 -0700)]
[randstruct] Add test for "-frandomize-layout-seed-file" flag

This test makes sure that the "-frandomize-layout-seed" and
"-frandomize-layout-seed-file" flags generate the same layout for the
record.

Reviewed By: aaron.ballman, MaskRay

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

2 years agoRevert "[lldb] Pin the shared cache when iterating over its images"
Jonas Devlieghere [Thu, 14 Apr 2022 22:05:07 +0000 (15:05 -0700)]
Revert "[lldb] Pin the shared cache when iterating over its images"

This reverts commit af969141fa285157044e34fb6b27963c3278241b because it
didn't have the intended performance benefit to offset the increase in
our (virtual) memory usage.

2 years ago[flang] Fix TYPE/CLASS IS (T(...)) in SELECT TYPE
Peter Klausler [Mon, 4 Apr 2022 23:43:44 +0000 (16:43 -0700)]
[flang] Fix TYPE/CLASS IS (T(...)) in SELECT TYPE

TYPE IS and CLASS IS guards in SELECT TYPE constructs are
allowed to specify the same type as the type of the selector
but f18's implementation of that predicate required strict
equality of the derived type representations.  We need to
allow for assumed values of LEN type parameters to match
explicit and deferred type parameter values in the selector
and require equality for KIND type parameters.  Implement
DerivedTypeSpec::Match() to perform this more relaxed type
comparison, and use it in check-select-type.cpp.

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

2 years agoRevert "[randstruct] Add test for "-frandomize-layout-seed-file" flag"
Bill Wendling [Thu, 14 Apr 2022 23:07:00 +0000 (16:07 -0700)]
Revert "[randstruct] Add test for "-frandomize-layout-seed-file" flag"

There's a test failure.

This reverts commit 31ea4798ad0990838ccd27f80ca112f177ce91d9.

2 years agoApply clang-tidy fixes for modernize-use-default-member-init in PDLLServer.cpp (NFC)
Mehdi Amini [Sun, 3 Apr 2022 23:59:34 +0000 (23:59 +0000)]
Apply clang-tidy fixes for modernize-use-default-member-init in PDLLServer.cpp (NFC)

2 years agoApply clang-tidy fixes for modernize-use-default-member-init in SparseTensorUtils...
Mehdi Amini [Sun, 3 Apr 2022 23:40:43 +0000 (23:40 +0000)]
Apply clang-tidy fixes for modernize-use-default-member-init in SparseTensorUtils.cpp (NFC)

2 years ago[flang] Local generics must not shadow host-associated generics
Peter Klausler [Wed, 13 Apr 2022 17:27:36 +0000 (10:27 -0700)]
[flang] Local generics must not shadow host-associated generics

It is possible for generic interfaces of equivalent (but not necessarily
identical -- operator(.eq.) is equivalent to operator(==)) names to
be declared in a host scope and a nested scope, and the nested declaration
should function as an extension of the host's.

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

2 years ago[flang] Inner INTRINSIC must not shadow host generic
Peter Klausler [Thu, 14 Apr 2022 21:55:47 +0000 (14:55 -0700)]
[flang] Inner INTRINSIC must not shadow host generic

A generic interface (however spelled) can have the same name as
an intrinsic procedure in the same scope.  When an explicit INTRINSIC
attribute statement appears in a nested scope, semantics was
unconditionally declaring a new symbol that hid the generic entirely.
Catch this case and create instead a host association symbol for
the generic that can then be decorated with the INTRINSIC attribute.

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

2 years ago[randstruct] Add test for "-frandomize-layout-seed-file" flag
Bill Wendling [Thu, 14 Apr 2022 22:40:48 +0000 (15:40 -0700)]
[randstruct] Add test for "-frandomize-layout-seed-file" flag

This test makes sure that the "-frandomize-layout-seed" and
"-frandomize-layout-seed-file" flags generate the same layout for the
record.

Reviewed By: aaron.ballman, MaskRay

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

2 years ago[flang][runtime] Preserve effect of positioning in record in non-advancing output
Peter Klausler [Mon, 4 Apr 2022 21:30:38 +0000 (14:30 -0700)]
[flang][runtime] Preserve effect of positioning in record in non-advancing output

When formatted non-advancing output ends in a control edit descriptor
like nX or Tn or TRn that effectively extends the record, fill any
gap with explicit blanks at the completion of the WRITE.

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

2 years ago[flang] Make F0.1 output editing of zero edge case consistent
Peter Klausler [Mon, 4 Apr 2022 19:09:05 +0000 (12:09 -0700)]
[flang] Make F0.1 output editing of zero edge case consistent

The statement
  PRINT '(2F0.1)', 0.0, 0.5
should emit consistent ".0 .5" output, not "0.0 .5".

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

2 years ago[Driver] Remove unneeded -f[no-]pascal-strings translation. NFC
Fangrui Song [Thu, 14 Apr 2022 22:20:58 +0000 (15:20 -0700)]
[Driver] Remove unneeded -f[no-]pascal-strings translation. NFC

They used to translate to -m[no-]pascal-strings.
This is unneeded after 28c96319c8ab397c2e7d1a47b852bf2afae4f04b or some point in
2009 when -m[no-]pascal-strings became aliases for -f[no-]pascal-strings.

2 years ago[mlir][sparse][taco] Use the SparseCompiler from python/tools.
Bixia Zheng [Thu, 14 Apr 2022 16:41:27 +0000 (09:41 -0700)]
[mlir][sparse][taco] Use the SparseCompiler from python/tools.

Copy the implementation of SparseCompiler from python/tools to taco/tools until we have a common place to install it. Modify TACO to use this SparseCompiler for compilation and jitting.

Reviewed By: aartbik

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

2 years ago[flang] Raise FP exceptions from runtime conversion to binary
Peter Klausler [Mon, 4 Apr 2022 18:39:51 +0000 (11:39 -0700)]
[flang] Raise FP exceptions from runtime conversion to binary

Formatted READs of REAL should convert the exception flags from
the decimal-to-binary conversion library into real runtime FP
exceptions so that they at least show up in the termination message
of a STOP statement.

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

2 years ago[NVPTX][tests] Do not run the test CodeGen/Generic/2010-11-04-BigByval.ll
Igor Chebykin [Thu, 14 Apr 2022 21:22:12 +0000 (14:22 -0700)]
[NVPTX][tests] Do not run the test CodeGen/Generic/2010-11-04-BigByval.ll

NVPTX does not support the testcase llvm/test/CodeGen/Generic/2010-11-04-BigByval.ll
There are NVPTX specific testcases for byval args in the llvm/test/CodeGen/NVPTX
The test is marked as UNSUPPORTED for NVPTX due to unacceptable run time when using XFAIL

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

2 years ago[DFSan] Avoid replacing uses of functions in comparisions.
Andrew Browne [Wed, 13 Apr 2022 18:49:49 +0000 (11:49 -0700)]
[DFSan] Avoid replacing uses of functions in comparisions.

This can cause crashes by accidentally optimizing out checks for
extern_weak_func != nullptr, when replaced with a known-not-null wrapper.

This solution isn't perfect (only avoids replacement on specific patterns)
but should address common cases.

Internal reference: b/185245029

Reviewed By: vitalybuka

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

2 years agoComment out assertions about initializer size added in D123649.
Eli Friedman [Thu, 14 Apr 2022 20:50:03 +0000 (13:50 -0700)]
Comment out assertions about initializer size added in D123649.

They're causing failures in LLVM test-suite.  Added some regression
tests that explain the issue.

2 years ago[flang] Correct interaction between generics and intrinsics
Peter Klausler [Mon, 4 Apr 2022 13:44:05 +0000 (06:44 -0700)]
[flang] Correct interaction between generics and intrinsics

Fortran allows a generic interface to have he same name as an
intrinsic procedure.  If the intrinsic is explicitly marked with
the INTRINSIC attribute, restrictions apply (C848) - the generic
must contain only functions or subroutines, depending on the
intrinsic.  Explicit or not, the generic overrides the intrinsic,
but the intrinsic behavior must still be available for calls
whose actual arguments do not match any of the specific procedures.

Semantics was not checking constraint C848, and it didn't allow
an explicit INTRINSIC attribute on a name of a generic interface.

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

2 years ago[X86] Fix test case for SoftPromoteHalf of STRICT_FP_EXTEND/STRICT_FP_ROUND.
Jameson Nash [Wed, 13 Apr 2022 21:49:36 +0000 (17:49 -0400)]
[X86] Fix test case for SoftPromoteHalf of STRICT_FP_EXTEND/STRICT_FP_ROUND.

Tests that should have been with
33b9f3abd78ffe31e2f468f64d36dbdf75b25d6e
when writing the tests that should have been with
0daf9b8e41327b1511b2bbc272184ff4fdb8de79.

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

2 years ago[libc++][NFC] Add missing 'return 0' to test
Louis Dionne [Thu, 14 Apr 2022 20:08:43 +0000 (16:08 -0400)]
[libc++][NFC] Add missing 'return 0' to test