platform/upstream/llvm.git
2 years ago[mlir][NFC] Drop a few dead forward declarations of FuncOp
River Riddle [Sat, 5 Mar 2022 03:41:15 +0000 (19:41 -0800)]
[mlir][NFC] Drop a few dead forward declarations of FuncOp

2 years ago[mlir][NFC] Rename StandardToLLVM to FuncToLLVM
River Riddle [Tue, 1 Mar 2022 22:53:41 +0000 (14:53 -0800)]
[mlir][NFC] Rename StandardToLLVM to FuncToLLVM

The current StandardToLLVM conversion patterns only really handle
the Func dialect. The pass itself adds patterns for Arithmetic/CFToLLVM, but
those should be/will be split out in a followup. This commit focuses solely
on being an NFC rename.

Aside from the directory change, the pattern and pass creation API have been renamed:
 * populateStdToLLVMFuncOpConversionPattern -> populateFuncToLLVMFuncOpConversionPattern
 * populateStdToLLVMConversionPatterns -> populateFuncToLLVMConversionPatterns
 * createLowerToLLVMPass -> createConvertFuncToLLVMPass

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

2 years ago[pseudo] Strip comments for TokenStream.
Haojian Wu [Mon, 7 Mar 2022 09:47:38 +0000 (10:47 +0100)]
[pseudo] Strip comments for TokenStream.

Add a utility function to strip comments from a "raw" tokenstream. The
derived stream will be fed to the GLR parser (for early testing).

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

2 years ago[OpenMP] libomp: implemented task priorities.
AndreyChurbanov [Mon, 7 Mar 2022 19:24:18 +0000 (22:24 +0300)]
[OpenMP] libomp: implemented task priorities.

Before this patch task priorities were ignored, that was a valid implementation
as the task priority is a hint according to OpenMP specification.

Implemented shared list of sorted (high -> low) task deques one per task
priority value. Tasks execution changed to first check if priority tasks ready
for execution exist, and these tasks executed before others;
otherwise usual tasks execution mechanics work.

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

2 years ago[libc++][AIX][test] Enable put_double/long_double locale tests
Jinsong Ji [Mon, 7 Mar 2022 19:08:57 +0000 (14:08 -0500)]
[libc++][AIX][test] Enable put_double/long_double locale tests

AIX print -0.0 , inf, nan differently, which are causing the test
failures. We are OK for most other tests.

This patch remove the tests related these limitations conditionally on AIX,
so that we can enable the other tests to avoid losing test coverage.

The general direction is:

```
if strings don't differ between environments, keep the string literal "INF" and the padding, instead of folding them into variables.
```

Reviewed By: ldionne, #libc, Mordante

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

2 years ago[pseudo] empty parameter-declaration should be allowed in lambda declarator.
Haojian Wu [Mon, 7 Mar 2022 09:13:12 +0000 (10:13 +0100)]
[pseudo] empty parameter-declaration should be allowed in lambda declarator.

This was an oversight, as we did a avoild-nullable modication to
parameter-declaration-clause.

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

2 years ago[flang] Add lowering for host association
Valentin Clement [Mon, 7 Mar 2022 18:55:48 +0000 (19:55 +0100)]
[flang] Add lowering for host association

This patches adds the code to handle host association for
inner subroutines and functions.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years agoRevert "[lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash"
Nico Weber [Mon, 7 Mar 2022 18:50:38 +0000 (13:50 -0500)]
Revert "[lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash"

This reverts commit 112135e77444e8c8106efa77416af09f4b9a5012.
Breaks lld/test/MachO/{icf.s,cfstring-dedup.s,invalid/cfstring.s}

2 years ago[flang] Accommodate arrays with a zero-extent dimension in location folding
Peter Klausler [Fri, 18 Feb 2022 22:08:57 +0000 (14:08 -0800)]
[flang] Accommodate arrays with a zero-extent dimension in location folding

The index incrementation code used for FINDLOC, MAXLOC, and MINLOC folding
would crash if the array had a zero extent on the dimension selected with
a DIM= argument since the subscript passed to IncrementSubscripts would
have a value less than the lower bound.  Fix, and add tests.

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

2 years agoRevert "[gn build] (manually) port 0c2b43ab8cb1 (X86MCTests)"
Nico Weber [Mon, 7 Mar 2022 18:43:29 +0000 (13:43 -0500)]
Revert "[gn build] (manually) port 0c2b43ab8cb1 (X86MCTests)"

This reverts commit 336e3677eac3f0ab7af212505723ef5041bacb6c.
0c2b43ab8cb1 was reverted in cf9b3ef941d4b4.

2 years agoRevert "[X86] Fix MCSymbolizer interface for X86Disassembler"
Maksim Panchenko [Mon, 7 Mar 2022 18:40:48 +0000 (10:40 -0800)]
Revert "[X86] Fix MCSymbolizer interface for X86Disassembler"

This reverts commit 0c2b43ab8cb1067dd1c7899094b824890803a7d2.

2 years ago[gn build] (manually) port 0c2b43ab8cb1 (X86MCTests)
Nico Weber [Mon, 7 Mar 2022 18:36:44 +0000 (13:36 -0500)]
[gn build] (manually) port 0c2b43ab8cb1 (X86MCTests)

2 years ago[libc++] [ranges] Fix `decltype(auto) ranges::iter_move`.
Arthur O'Dwyer [Wed, 2 Mar 2022 22:22:55 +0000 (17:22 -0500)]
[libc++] [ranges] Fix `decltype(auto) ranges::iter_move`.

See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92894#c3
https://reviews.llvm.org/D119589#inline-1151299

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

2 years ago[clang-format] Fix namespace end comments in ObjC++ files too
Nico Weber [Mon, 7 Mar 2022 14:42:35 +0000 (09:42 -0500)]
[clang-format] Fix namespace end comments in ObjC++ files too

See also d96ae867351ec.

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

2 years ago[libc++] Overhaul std::quoted; fix its relationship to character traits.
Arthur O'Dwyer [Fri, 4 Mar 2022 23:24:18 +0000 (18:24 -0500)]
[libc++] Overhaul std::quoted; fix its relationship to character traits.

Move `__quoted_output_proxy` into the one file that uses it.

A `const char*` has no associated traits class, so `std::quoted("literal")`
should be printable into any basic_ostream regardless of traits.

Use hidden-friend `operator<<` and `operator>>`, since we're permitted to.
(The exact signature is unspecified because the class itself is unspecified.)

We shouldn't support `std::quoted("literal")` in C++03 or C++11 mode.
(We do need `std::__quoted(s)` and `std::__quoted(cs)` in C++11 mode,
because they're used by `std::__fs::filesystem::path`.)

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

2 years ago[X86] Fix MCSymbolizer interface for X86Disassembler
Maksim Panchenko [Mon, 7 Mar 2022 18:27:28 +0000 (10:27 -0800)]
[X86] Fix MCSymbolizer interface for X86Disassembler

Fix a number of issues with MCSymbolizer::tryAddingSymbolicOperand()
in X86Disassembler:

  * Pass instruction size instead of immediate size.
  * Correctly adjust the value of PC-relative operands.
  * Set operand offset to zero when the operand is specified
    implicitly.

Reviewed By: Amir, skan

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

2 years agoSimplify OpenMP Lambda use
David Blaikie [Mon, 7 Mar 2022 17:56:51 +0000 (17:56 +0000)]
Simplify OpenMP Lambda use

* Use default ref capture for non-escaping lambdas (this makes
  maintenance easier by allowing new uses, removing uses, having
  conditional uses (such as in assertions) not require updates to an
  explicit capture list)
* Simplify addPrivate API not to take a lambda, since it calls it
  unconditionally/immediately anyway - most callers are simply passing
  in a named value or short expression anyway and the lambda syntax just
  adds noise/overhead

Reviewed By: ABataev

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

2 years ago[clang][debug] port clang-cl /JMC flag to ELF
Yuanfang Chen [Mon, 7 Mar 2022 18:15:37 +0000 (10:15 -0800)]
[clang][debug] port clang-cl /JMC flag to ELF

The motivation is to enable the MSVC-style JMC instrumentation usable by a ELF-based
debugger. Since there is no prior experience implementing JMC feature for ELF-based
debugger, it might be better to just reuse existing MSVC-style JMC instrumentation.
For debuggers that support both ELF&COFF (like lldb), the JMC implementation might
be shared between ELF&COFF. If this is found to inadequate, it is pretty low-cost
switching to alternatives.

Implementation:
- The '-fjmc' is already a driver and cc1 flag. Wire it up for ELF in the driver.
- Refactor the JMC instrumentation pass a little bit.
- The ELF handling is different from MSVC in two places:
  * the flag section name is ".just.my.code" instead of ".msvcjmc"
  * the way default function is provided: MSVC uses /alternatename; ELF uses weak function.

Based on D118428.

Reviewed By: rnk

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

2 years ago[mlir][sparse][taco] Add more unit tests.
Bixia Zheng [Fri, 4 Mar 2022 21:25:10 +0000 (13:25 -0800)]
[mlir][sparse][taco] Add more unit tests.

These unit tests resides in an internal repository. Porting the tests to the
public repository.

Reviewed By: aartbik

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

2 years agoRevert "Add CMake option not to build BOLT tests"
Yi Kong [Mon, 7 Mar 2022 18:01:15 +0000 (02:01 +0800)]
Revert "Add CMake option not to build BOLT tests"

This reverts commit d8f4d54664171bac46e6c8446df04850b40cc4f7.

Merged by accident.

2 years agoFix the comment for EnableNoundefAttrs, NFC
Yi Kong [Mon, 7 Mar 2022 17:59:06 +0000 (01:59 +0800)]
Fix the comment for EnableNoundefAttrs, NFC

2 years agoAdd CMake option not to build BOLT tests
Yi Kong [Wed, 2 Mar 2022 16:43:24 +0000 (00:43 +0800)]
Add CMake option not to build BOLT tests

2 years ago[mlir][Vector] Improve default lowering of vector transpose operations
Diego Caballero [Mon, 7 Mar 2022 17:40:21 +0000 (17:40 +0000)]
[mlir][Vector] Improve default lowering of vector transpose operations

The default lowering of vector transpose operations generates a large sequence of
scalar extract/insert operations, one pair for each scalar element in the input tensor.
In other words, the vector transpose is scalarized. However, there are transpose
patterns where one or more adjacent high-order dimensions are not transposed (for
example, in the transpose pattern [1, 0, 2, 3], dimensions 2 and 3 are not transposed).
This patch improves the lowering of those cases by not scalarizing them and extracting/
inserting a full n-D vector, where 'n' is the number of adjacent high-order dimensions
not being transposed. By doing so, we prevent the scalarization of the code and generate a
more performant vector version.

Paradoxically, this patch shouldn't improve the performance of transpose operations if
we are using LLVM. The LLVM pipeline is able to optimize away some of the extract/insert
operations and the SLP vectorizer is converting the scalar operations back to its vector
form. However, scalarizing a vector version of the code in MLIR and relying on the SLP
vectorizer to reconstruct the vector code again is highly undesirable for several reasons.

Reviewed By: nicolasvasilache, ThomasRaoux

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

2 years ago[clang][dataflow] Extend flow conditions from block terminators
Stanislav Gatev [Fri, 4 Mar 2022 11:03:29 +0000 (11:03 +0000)]
[clang][dataflow] Extend flow conditions from block terminators

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D120984

2 years ago[lld-macho][nfc] Reduce size of icfEqClass hash
Jez Ng [Mon, 7 Mar 2022 17:35:49 +0000 (12:35 -0500)]
[lld-macho][nfc] Reduce size of icfEqClass hash

... from a `uint64_t` to a `uint32_t`. (LLD-ELF uses a `uint32_t` too.)

About a 1.7% reduction in peak RSS when linking chromium_framework on my
3.2 GHz 16-Core Intel Xeon W Mac Pro, and no stat sig change in wall
time.

           </Users/jezng/test2.sh ["before"]>  </Users/jezng/test2.sh ["after"]>  difference (95% CI)
  RSS      1003036672.000 ± 9891065.259        985539505.231 ± 10272748.749       [  -2.3% ..   -1.2%]
  samples  27                                  26

             base           diff           difference (95% CI)
  sys_time   1.277 ± 0.023  1.277 ± 0.024  [  -0.9% ..   +0.9%]
  user_time  6.682 ± 0.046  6.598 ± 0.043  [  -1.6% ..   -0.9%]
  wall_time  5.904 ± 0.062  5.895 ± 0.063  [  -0.7% ..   +0.4%]
  samples    46             28

No appreciable change (~0.01%) in number of `equals` comparisons either:

Before:

  ld64.lld: ICF needed 8 iterations
  ld64.lld: equalsConstant() called 701643 times
  ld64.lld: equalsVariable() called 3438526 times

After:

  ld64.lld: ICF needed 8 iterations
  ld64.lld: equalsConstant() called 701729 times
  ld64.lld: equalsVariable() called 3438526 times

Reviewed By: #lld-macho, MaskRay, thakis

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

2 years ago[lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash
Jez Ng [Mon, 7 Mar 2022 08:02:40 +0000 (03:02 -0500)]
[lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash

The existing hashing of stubsHelperIndex has mostly been a no-op* for
some time now (ever since we made ICF run before dylib symbols get their
stubs indices assigned). I guess we could consider hashing the name +
filename of the DylibSymbol instead, but I'm not sure the overhead's
worth it... moreover, LLD/ELF only hashes their Defined symbols as well.

*: Technically it does change the hash value since stubsHelperIndex is
initialized to `UINT32_MAX` by default. But since all stubsHelperIndex
values are the same at when ICF runs, they don't add any useful
information to the hash.

2 years ago[lld-macho][nfc] Rename isec -> referentIsec to avoid shadowing
Jez Ng [Mon, 7 Mar 2022 04:27:35 +0000 (23:27 -0500)]
[lld-macho][nfc] Rename isec -> referentIsec to avoid shadowing

I found the shadowing a bit confusing

2 years ago[lld-macho][nfc] Track # of ICF calls to `equals*` methods
Jez Ng [Mon, 7 Mar 2022 17:35:15 +0000 (12:35 -0500)]
[lld-macho][nfc] Track # of ICF calls to `equals*` methods

This is debug code that is disabled by default. It'll provide a easy way
to figure out the impact (if any) of tweaking ICF's hashing algorithm
(since a poor quality hash will result in many more `equals*` calls).

Reviewed By: #lld-macho, oontvoo

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

2 years ago[lld-macho][nfc] Use llvm::function_ref instead of std::function
Jez Ng [Sat, 5 Mar 2022 01:22:40 +0000 (20:22 -0500)]
[lld-macho][nfc] Use llvm::function_ref instead of std::function

2 years ago[lld-macho][nfc] Remove file statics from ICF.cpp
Jez Ng [Mon, 7 Mar 2022 17:35:12 +0000 (12:35 -0500)]
[lld-macho][nfc] Remove file statics from ICF.cpp

This gets us closer to the [LLD-as-a-library goal][1].

[1]: https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html

Reviewed By: #lld-macho, thakis

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

2 years agoUpdateTestChecks: fix handling of UTC with spaces
Roman Lebedev [Mon, 7 Mar 2022 17:25:09 +0000 (20:25 +0300)]
UpdateTestChecks: fix handling of UTC with spaces

We can't just split by space, that's not going to give us the same
argv we'd have gotten from the shell, it could be in a string,
we must actually parse that as argv.

2 years ago[AArch64] Perform first active true vector combine
zhongyunde [Mon, 7 Mar 2022 16:31:07 +0000 (00:31 +0800)]
[AArch64] Perform first active true vector combine

Materialize : i1 = extract_vector_elt t37, Constant:i64<0>
   ... into: "ptrue p, all" + PTEST
Test bit of lane 0 can use P register directly, and the instruction “pture all”
is loop invariant, which will beneficial to SVE after hoisting out the loop.

Reviewed By: david-arm, paulwalker-arm

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

2 years ago[LV] Add test from PR54227.
Florian Hahn [Mon, 7 Mar 2022 17:01:21 +0000 (17:01 +0000)]
[LV] Add test from PR54227.

Test from https://github.com/llvm/llvm-project/issues/54227.

The underlying issue has already been fixed in de8ac48 with a separate
test.

2 years ago[mlir] Add missing override keyword. NFC.
Benjamin Kramer [Mon, 7 Mar 2022 16:58:32 +0000 (17:58 +0100)]
[mlir] Add missing override keyword. NFC.

2 years ago[lldb] Add a setting to change the autosuggestion ANSI escape codes
Jonas Devlieghere [Mon, 7 Mar 2022 16:37:42 +0000 (08:37 -0800)]
[lldb] Add a setting to change the autosuggestion ANSI escape codes

I'm a big fan of the autosuggestion feature but my terminal/color scheme
doesn't display faint any differently than regular lldb output, which
makes the feature a little confusing. This patch add a setting to change
the autosuggestion ANSI escape codes.

For example, to display the autosuggestion in italic, you can add this
to your ~/.lldbinit

  settings set show-autosuggestion-ansi-prefix ${ansi.italic}
  setting set show-autosuggestion-ansi-suffix ${ansi.normal}

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

2 years ago[llvm] remove empty __LLVM segment in llvm-bitcode-strip
Richard Howell [Thu, 3 Mar 2022 19:23:44 +0000 (11:23 -0800)]
[llvm] remove empty __LLVM segment in llvm-bitcode-strip

When running llvm-bitcode-strip we want to remove the __LLVM
segment as well as the __bundle section when there are no other
sections in the segment.

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

2 years ago[libc++] Better handling for zero-sized types.
Arthur O'Dwyer [Sun, 27 Feb 2022 17:41:22 +0000 (12:41 -0500)]
[libc++] Better handling for zero-sized types.

Zero-sized types are a GCC extension, also supported by Clang.
In theory it's already invalid to `delete` a void pointer or a
pointer-to-incomplete, so we shouldn't need any special code
to catch those cases; but in practice Clang accepts both
constructs with just a warning, and GCC even accepts `sizeof(void)`
with just a warning! So we must keep the static_asserts.
The hard errors are tested in `unique_ptr_dltr_dflt/*.compile.fail.cpp`.

In ranges::begin/end, check `sizeof >= 0` instead of `sizeof != 0`,
so as to permit zero-sized types while still disallowing incomplete
types.

Fixes #54100.

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

2 years ago[gn build] Port 54d6b5b67fb3
LLVM GN Syncbot [Mon, 7 Mar 2022 16:44:43 +0000 (16:44 +0000)]
[gn build] Port 54d6b5b67fb3

2 years ago[mlir] Fix dumping invalid ops
Sergei Grechanik [Mon, 7 Mar 2022 15:49:46 +0000 (07:49 -0800)]
[mlir] Fix dumping invalid ops

This patch fixes the crash when printing some ops (like affine.for and
scf.for) when they are dumped in invalid state, e.g. during pattern
application. Now the AsmState constructor verifies the operation
first and switches to generic operation printing when the verification
fails. Also operations are now printed in generic form when emitting
diagnostics and the severity level is Error.

Reviewed By: rriddle, mehdi_amini

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

2 years ago[pseudo] Rename {Preprocess,PPStructure} -> DirectiveMap. NFC
Sam McCall [Mon, 7 Mar 2022 16:40:30 +0000 (17:40 +0100)]
[pseudo] Rename {Preprocess,PPStructure} -> DirectiveMap. NFC

More precisely describes what this file does.
Per comments on https://reviews.llvm.org/D121092

2 years ago[VE] Split v512.32 load store into interleaved v256.32 ops
Simon Moll [Mon, 7 Mar 2022 16:24:08 +0000 (17:24 +0100)]
[VE] Split v512.32 load store into interleaved v256.32 ops

Without passthru for now. Support for packed passthru requires
evl-into-mask folding.

Reviewed By: kaz7

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

2 years ago[analyzer][NFC] Merge similar conditional paths
phyBrackets [Sat, 5 Mar 2022 11:54:24 +0000 (17:24 +0530)]
[analyzer][NFC] Merge similar conditional paths

Reviewed By: aaron.ballman, steakhal

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

2 years ago[NFC][LV] Use different braces in debug output
Roman Lebedev [Mon, 7 Mar 2022 12:13:10 +0000 (15:13 +0300)]
[NFC][LV] Use different braces in debug output

The analysis passes output function name encapsulated in `'` braces,
but LV uses `"`. Harmonizing this may help in creating an update script
for the LV costmodel test checks.

Reviewed By: fhahn

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

2 years ago[AMDGPU] Ensure return address is save/restored if clobbered or when function has...
Venkata Ramanaiah Nalamothu [Thu, 3 Mar 2022 18:33:36 +0000 (00:03 +0530)]
[AMDGPU] Ensure return address is save/restored if clobbered or when function has calls

This test is to make sure the return address registers, if clobbered in the
function or when the function has calls, are save/restored irrespective of
whether the IPRA is enabled/disabled.

This test is found to be not save/restore the return address registers, when
clobbered in the function, with the corresponding downstream changes of D114652.

The test could not be reduced further as the register allocator needs enough
register pressure so that it allocates the return address registers as well.

Reviewed By: arsenm

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

2 years ago[AMDGPU] Omit unnecessary waitcnt before barriers
Austin Kerbow [Fri, 25 Feb 2022 07:26:51 +0000 (23:26 -0800)]
[AMDGPU] Omit unnecessary waitcnt before barriers

It is not necessary to wait for all outstanding memory operations before
barriers on hardware that can back off of the barrier in the event of an
exception when traps are enabled. Add a new subtarget feature which
tracks which HW has this ability.

Reviewed By: #amdgpu, rampitec

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

2 years ago[gn build] Port 205557c908ff
LLVM GN Syncbot [Mon, 7 Mar 2022 16:17:21 +0000 (16:17 +0000)]
[gn build] Port 205557c908ff

2 years ago[libc++][ranges] Implement ranges::max_element
Nikolas Klauser [Mon, 7 Mar 2022 16:01:52 +0000 (17:01 +0100)]
[libc++][ranges] Implement ranges::max_element

Implement ranges::max_element

Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits, mgorny

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

2 years ago[AArch64] Move FeatureSpecRestrict into core 8.0-R architecture.
Simon Tatham [Mon, 7 Mar 2022 15:55:06 +0000 (15:55 +0000)]
[AArch64] Move FeatureSpecRestrict into core 8.0-R architecture.

It was included in HasV8_0rOps when D88660 first introduced that
architecture definition. In D118045 I moved it out of there and into
ProcessorFeatures.R82, so that -mcpu=cortex-r82 would continue to
behave the same as before but -march=armv8-r would include only the
mandatory parts of the architecture.

In fact, that was a mistake. Firstly, Cortex-R82 _doesn't_ implement
that feature, so it makes no sense to deliberately enable it for that
CPU in particular. But also, it's an extension that only adds system
registers, and we're generally more relaxed about where we enable
those (because kernel developers find it useful to write sysreg-access
instructions after runtime checking, and because sysreg accesses
aren't manufactured during code generation so the risk is small).

So, in line with that usual AArch64 policy, FeatureSpecRestrict ought
to be considered part of 8.0-R for LLVM purposes. So I'm moving it
back into HasV8_0rOps, where it started out.

Reviewed By: lenary

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

2 years ago[clang-format] Fix assertion failure/crash with `AllowShortFunctionsOnASingleLine...
Marek Kurdej [Thu, 3 Mar 2022 14:37:43 +0000 (15:37 +0100)]
[clang-format] Fix assertion failure/crash with `AllowShortFunctionsOnASingleLine: Inline/InlineOnly`.

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

When handling `AllowShortFunctionsOnASingleLine`, we were searching for the last line with a smaller level than the current line. The search was incorrect when the first line had the same level as the current one. This led to an unsatisfied assumption about the existence of a brace (non-comment token).

Reviewed By: HazardyKnusperkeks, owenpan

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

2 years ago[libc++][NFC] Improve release note formatting
Louis Dionne [Mon, 7 Mar 2022 15:26:33 +0000 (10:26 -0500)]
[libc++][NFC] Improve release note formatting

2 years agoupdate_analyze_test_checks.py: fix UTC_ARGS handling
Roman Lebedev [Mon, 7 Mar 2022 13:54:57 +0000 (16:54 +0300)]
update_analyze_test_checks.py: fix UTC_ARGS handling

They should be both used if provided in the input test
and manifested in the updated test.

2 years ago[clang] Adjust LookupTest for UsingTypeLocs
Kadir Cetinkaya [Mon, 7 Mar 2022 11:51:13 +0000 (12:51 +0100)]
[clang] Adjust LookupTest for UsingTypeLocs

We no longer traverse the underlying RecordTypeLoc directly, but rather
visit the UsingTypeLoc.

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

2 years ago[clang-tools-extra] Document clang tidy unit tests target
Richard [Fri, 4 Mar 2022 00:18:08 +0000 (17:18 -0700)]
[clang-tools-extra] Document clang tidy unit tests target

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

2 years ago[pseudo] Add readme
Sam McCall [Mon, 7 Mar 2022 12:45:44 +0000 (13:45 +0100)]
[pseudo] Add readme

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

2 years ago[libc++][NFC] Add missing whitespace in release notes
Louis Dionne [Mon, 7 Mar 2022 14:00:17 +0000 (09:00 -0500)]
[libc++][NFC] Add missing whitespace in release notes

2 years ago[analyzer] Fix buildbot failure for D120369
Endre Fülöp [Mon, 7 Mar 2022 13:53:26 +0000 (14:53 +0100)]
[analyzer] Fix buildbot failure for D120369

Fix test case for GenericTaintChecker.
Redefinition of types is a C11 feature, and it broke a buildbot.
Commit amended: 4fd6c6e65ab59f82284d8272aa3bec8d5084511e.

2 years ago[gn build] Port 311ff3917827
LLVM GN Syncbot [Mon, 7 Mar 2022 13:49:22 +0000 (13:49 +0000)]
[gn build] Port 311ff3917827

2 years ago[libc++] Add missing header <cuchar>
Louis Dionne [Thu, 3 Feb 2022 20:42:40 +0000 (15:42 -0500)]
[libc++] Add missing header <cuchar>

Fixes llvm-project#44216

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

2 years ago[ConstraintElimination] Use ZExtValue for unsigned decomposition.
Florian Hahn [Mon, 7 Mar 2022 13:33:50 +0000 (13:33 +0000)]
[ConstraintElimination] Use ZExtValue for unsigned decomposition.

When decomposing constraints for unsigned conditions, we can use
negative values by zero-extending them, as long as they are less than
the maximum constraint value.

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

2 years ago[ConstraintElimination] Add tests inspired by PR54224.
Florian Hahn [Mon, 7 Mar 2022 13:33:08 +0000 (13:33 +0000)]
[ConstraintElimination] Add tests inspired by PR54224.

2 years agoUpdate normalizeAffineFor to canonicalize maps/operands before using them
Uday Bondhugula [Sat, 5 Mar 2022 18:04:57 +0000 (23:34 +0530)]
Update normalizeAffineFor to canonicalize maps/operands before using them

Update normalizeAffineFor utility to canonicalize maps and operands
before using them.

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

2 years ago[flang] Update tco after 0dc66b76fe4c
Diana Picus [Mon, 7 Mar 2022 12:53:49 +0000 (12:53 +0000)]
[flang] Update tco after 0dc66b76fe4c

Minor fix to appease the buildbots.

2 years ago[mlir][shape] Migrate bufferization to BufferizableOpInterface
Matthias Springer [Mon, 7 Mar 2022 12:27:53 +0000 (21:27 +0900)]
[mlir][shape] Migrate bufferization to BufferizableOpInterface

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

2 years agoupdate_analyze_test_checks.py: fix --filter handling
Roman Lebedev [Mon, 7 Mar 2022 12:37:06 +0000 (15:37 +0300)]
update_analyze_test_checks.py: fix --filter handling

In particular, after filtering the check lines can't necessarily
use `-NEXT`, they may not be one directly after another.

2 years ago[mlir][Bazel] Remove unused dependencies (NFC)
Adrian Kuegel [Mon, 7 Mar 2022 12:25:36 +0000 (13:25 +0100)]
[mlir][Bazel] Remove unused dependencies (NFC)

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

2 years ago[MLIR] Fix bazel BUILD file after Parser.h moved.
Christian Sigg [Mon, 7 Mar 2022 12:04:05 +0000 (13:04 +0100)]
[MLIR] Fix bazel BUILD file after Parser.h moved.

See D121024, D121025, D121026.

Reviewed By: ftynse

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

2 years ago[analyzer] Add more propagations to Taint analysis
Endre Fülöp [Tue, 1 Mar 2022 08:40:49 +0000 (09:40 +0100)]
[analyzer] Add more propagations to Taint analysis

Add more functions as taint propators to GenericTaintChecker.

Reviewed By: steakhal

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

2 years ago[ConstraintElimination] Only add cond from assume to succs if valid.
Florian Hahn [Mon, 7 Mar 2022 12:01:15 +0000 (12:01 +0000)]
[ConstraintElimination] Only add cond from assume to succs if valid.

Add missing CanAdd check before adding a condition from an assume
to the successor blocks. When adding information from assume to
successor blocks we need to perform the same CanAdd as we do for adding
a condition from a branch.

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

2 years ago[ConstraintElimination] Add test case for PR54217.
Florian Hahn [Mon, 7 Mar 2022 12:01:09 +0000 (12:01 +0000)]
[ConstraintElimination] Add test case for PR54217.

Adds test case for https://github.com/llvm/llvm-project/issues/54217.

2 years agoPartially revert 03e6d10cac86: it broke the build
Mehdi Amini [Mon, 7 Mar 2022 11:18:20 +0000 (11:18 +0000)]
Partially revert 03e6d10cac86: it broke the build

2 years agoRevert "Apply clang-tidy fixes for bugprone-macro-parentheses to MLIR (NFC)"
Mehdi Amini [Mon, 7 Mar 2022 11:11:09 +0000 (11:11 +0000)]
Revert "Apply clang-tidy fixes for bugprone-macro-parentheses to MLIR (NFC)"

This reverts commit 393c6db7a173836b4ee350ad5598ed67b8fb14b9.
This broke the build.

2 years ago[README] Add hint, how to use automatically the optimal number of CPU cores
Heiko Thiel [Mon, 7 Mar 2022 11:07:11 +0000 (12:07 +0100)]
[README] Add hint, how to use automatically the optimal number of CPU cores

2 years ago[Attributor] Remove restriction on simplifying function pointers
Nikita Popov [Thu, 3 Mar 2022 15:10:09 +0000 (16:10 +0100)]
[Attributor] Remove restriction on simplifying function pointers

Dropping this restriction seems to work fine (there are no assertion
failures), so it appears that either the updater got smarter or the
problematic cases are restricted elsewhere.

If doing this still causes issues, then the place to address it
would probably be https://github.com/llvm/llvm-project/blob/8f5bdaf481c3f4e6876a5ae0e4d7c6ed2042e6a6/llvm/lib/Transforms/IPO/Attributor.cpp#L1856-L1859,
which already prevents replacement outside the SCC, so I'm not
quite sure what this check is intended to avoid.

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

2 years ago[CODE_OWNERS/CREDITS] Update my email address
Alex Bradbury [Mon, 7 Mar 2022 10:53:29 +0000 (10:53 +0000)]
[CODE_OWNERS/CREDITS] Update my email address

2 years agoApply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:48 +0000 (10:12 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC)

2 years agoApply clang-tidy fixes for readability-identifier-naming to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:47 +0000 (10:12 +0000)]
Apply clang-tidy fixes for readability-identifier-naming to MLIR (NFC)

2 years agoApply clang-tidy fixes for performance-unnecessary-value-param to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:46 +0000 (10:12 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param to MLIR (NFC)

2 years agoApply clang-tidy fixes for modernize-use-emplace to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:44 +0000 (10:12 +0000)]
Apply clang-tidy fixes for modernize-use-emplace to MLIR (NFC)

2 years agoApply clang-tidy fixes for modernize-use-default-member-init to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:43 +0000 (10:12 +0000)]
Apply clang-tidy fixes for modernize-use-default-member-init to MLIR (NFC)

2 years agoApply clang-tidy fixes for modernize-loop-convert to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:39 +0000 (10:12 +0000)]
Apply clang-tidy fixes for modernize-loop-convert to MLIR (NFC)

2 years agoApply clang-tidy fixes for llvm-qualified-auto to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:38 +0000 (10:12 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto to MLIR (NFC)

2 years agoApply clang-tidy fixes for bugprone-macro-parentheses to MLIR (NFC)
Mehdi Amini [Mon, 7 Mar 2022 10:12:37 +0000 (10:12 +0000)]
Apply clang-tidy fixes for bugprone-macro-parentheses to MLIR (NFC)

2 years ago[CoroElide] Remove fallback for frame layout determination
Nikita Popov [Fri, 4 Mar 2022 12:07:58 +0000 (13:07 +0100)]
[CoroElide] Remove fallback for frame layout determination

Only determine the frame layout based on dereferenceable and align
attributes, and remove the type-based fallback, which is incompatible
with opaque pointers. The dereferenceable attribute is required,
while the align attribute uses default alignment of 1 (commonly,
align 1 attributes do not get placed, relying on default alignment).

The CoroSplit pass producing the resume function adds the necessary
attributes in https://github.com/llvm/llvm-project/blob/7daed359111f6d151fef447f520f85ef1dabedf6/llvm/lib/Transforms/Coroutines/CoroSplit.cpp#L840,
and their presence is checked in coro-debug.ll at least.

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

2 years ago[clang][modules] Fix failing test
Jan Svoboda [Mon, 7 Mar 2022 10:21:06 +0000 (11:21 +0100)]
[clang][modules] Fix failing test

This test started failing on Windows after b45888e959ad2d6562b8d321166e6387facdd412 due to path separators not matching up.

2 years agoRemove Simon Atanasyan from the code owners list. MIPS Backend.
Simon Atanasyan [Mon, 7 Mar 2022 10:08:12 +0000 (13:08 +0300)]
Remove Simon Atanasyan from the code owners list. MIPS Backend.

2 years ago[Coroutines] Allow FramePtr to be an Argument
Nikita Popov [Fri, 4 Mar 2022 14:09:57 +0000 (15:09 +0100)]
[Coroutines] Allow FramePtr to be an Argument

With opaque pointers, after splitRetconCoroutine() the FramePtr
may be an Argument rather than an Instruction. With typed pointers,
this currently doesn't happen because the FramePtr would be a
bitcast instruction.

Fix this by making FramePtr a Value and adding a helper for the
"after FramePtr" insertion point, which would be the start of the
function in the Argument case.

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

2 years ago[clang][modules] Report module maps affecting `no_undeclared_includes` modules
Jan Svoboda [Mon, 7 Mar 2022 09:22:06 +0000 (10:22 +0100)]
[clang][modules] Report module maps affecting `no_undeclared_includes` modules

Since D106876, PCM files don't report module maps as input files unless they contributed to the compilation.

Reporting only module maps of (transitively) imported modules is not enough, though. For modules marked with `[no_undeclared_includes]`, other module maps affect the compilation by introducing anti-dependencies.

This patch makes sure such module maps are being reported as input files.

Depends on D120463.

Reviewed By: dexonsmith

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

2 years ago[clang][modules] NFC: Simplify and clarify test
Jan Svoboda [Mon, 7 Mar 2022 09:21:30 +0000 (10:21 +0100)]
[clang][modules] NFC: Simplify and clarify test

This patch simplifies a test that checks only used module map files are reported as input files in PCM files.

Instead of using opaque `diff`, this patch uses `clang -module-file-info` and `FileCheck` to verify this.

Reviewed By: dexonsmith

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

2 years ago[AArch64] Turn truncating buildvectors into truncates
David Green [Mon, 7 Mar 2022 09:42:54 +0000 (09:42 +0000)]
[AArch64] Turn truncating buildvectors into truncates

When lowering large v16f32->v16i8 fp_to_si_sat, the fp_to_si_sat node is
split several times, creating an illegal v4i8 concat that gets expanded
into a BUILD_VECTOR. After some combining and other legalisation, it
ends up the a buildvector that extracts from 4 vectors, looking like
BUILDVECTOR(a0,a1,a2,a3,b0,b1,b2,b3,c0,c1,c2,c3,d0,d1,d2,d3). That is
really an v16i32->v16i8 truncate in disguise.

This adds a ReconstructTruncateFromBuildVector method to detect the
pattern, converting it back into the legal "concat(trunc(concat(trunc(a),
trunc(b))), trunc(concat(trunc(c), trunc(d))))" tree. The extracted
nodes could also be v4i16, in which case the truncates are not needed.
All those truncates and concats then become uzip1's, which is much
better than expanding by moving vector lanes around.

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

2 years ago[libc] Fix alignment logic in TLS image size calculation.
Siva Chandra Reddy [Mon, 7 Mar 2022 05:56:04 +0000 (05:56 +0000)]
[libc] Fix alignment logic in TLS image size calculation.

2 years ago[gn build] Port 5f62156762d4
LLVM GN Syncbot [Mon, 7 Mar 2022 09:08:13 +0000 (09:08 +0000)]
[gn build] Port 5f62156762d4

2 years ago[mlir][NFC] Move Translation.h to a Tools/mlir-translate directory
River Riddle [Sat, 5 Mar 2022 20:27:00 +0000 (12:27 -0800)]
[mlir][NFC] Move Translation.h to a Tools/mlir-translate directory

Translation.h is currently awkwardly shoved into the top-level mlir, even though it is
specific to the mlir-translate tool. This commit moves it to a new Tools/mlir-translate
directory, which is intended for libraries used to implement tools. It also splits the
translate registry from the main entry point, to more closely mirror what mlir-opt
does.

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

2 years ago[mlir][NFC] Move MlirOptMain to the Tools/ directory
River Riddle [Fri, 4 Mar 2022 21:49:30 +0000 (13:49 -0800)]
[mlir][NFC] Move MlirOptMain to the Tools/ directory

MlirOptMain is currently awkwardly shoved into mlir/Support. This commit
moves it to the Tools/ directory, which is intended for libraries used to
implement tools.

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

2 years ago[mlir][NFC] Move Parser.h to Parser/
River Riddle [Fri, 4 Mar 2022 20:53:22 +0000 (12:53 -0800)]
[mlir][NFC] Move Parser.h to Parser/

There is no reason for this file to be at the top-level, and
its current placement predates the Parser/ folder's existence.

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

2 years ago[ConstraintElimination] Remove dead variables when dropping constraints.
Florian Hahn [Mon, 7 Mar 2022 09:03:48 +0000 (09:03 +0000)]
[ConstraintElimination] Remove dead variables when dropping constraints.

This patch extends ConstraintElimination to also remove dead variables
when removing a constraint. When a constraint is removed because it is
out of scope, all new variables added for this constraint can also be
removed.

This keeps the total size of the systems much smaller, because it
reduces the number of variables drastically.

It also fixes a bug where variables where removed incorrectly.

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

2 years ago[ConstraintElimination] Add test from PR54228.
Florian Hahn [Mon, 7 Mar 2022 09:03:42 +0000 (09:03 +0000)]
[ConstraintElimination] Add test from PR54228.

Test for https://github.com/llvm/llvm-project/issues/54228

2 years ago[X86] Update some of the AVX512 intrinsic tests to avoid adds.
Luo, Yuanke [Mon, 7 Mar 2022 08:51:42 +0000 (16:51 +0800)]
[X86] Update some of the AVX512 intrinsic tests to avoid adds.

As noticed in D119654, by adding the masked intrinsics results together
we can end up with the selects being canonicalized away from the
intrinsic - this isn't what we want to test here so replace with a
insertvalue chain into a aggregate instead to retain all the results.

2 years ago[VP] Introducing VectorBuilder, the VP intrinsic builder
Simon Moll [Mon, 7 Mar 2022 09:01:31 +0000 (10:01 +0100)]
[VP] Introducing VectorBuilder, the VP intrinsic builder

VectorBuilder wraps around an IRBuilder and
VectorBuilder::createVectorInstructions emits VP intrinsics as if they
were regular instructions.

Reviewed By: craig.topper

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

2 years ago[Attributor] Remove function pointer restriction for AAAlign
Nikita Popov [Thu, 3 Mar 2022 14:41:06 +0000 (15:41 +0100)]
[Attributor] Remove function pointer restriction for AAAlign

This check is not compatible with opaque pointers. We can avoid
it by adjusting the getPointerAlignment() implementation to avoid
creating unnecessary ptrtoint expressions for bitcasted pointers.
The code already uses OnlyIfReduced to not create an expression
if it does not simplify, and this makes sure that folding a
bitcast and ptrtoint into a ptrtoint doesn't count as a
simplification.

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

2 years ago[AArch64] Use NPM for cost model tests. NFC
David Green [Mon, 7 Mar 2022 08:57:50 +0000 (08:57 +0000)]
[AArch64] Use NPM for cost model tests. NFC

As per the other tests, this switches the run lines back to using the
NPM via
-passes='print<cost-model>' -cost-kind=throughput 2>&1 -disable-output