platform/upstream/llvm.git
2 years ago[AArch64] Make machine combiner patterns preserve MIFlags
John Brawn [Mon, 31 Jan 2022 15:13:34 +0000 (15:13 +0000)]
[AArch64] Make machine combiner patterns preserve MIFlags

This is mainly done so that we don't lose the nofpexcept flag once we
start emitting it.

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

2 years ago[clangd] NFC, remove an unused local varaiable.
Haojian Wu [Thu, 3 Feb 2022 11:42:52 +0000 (12:42 +0100)]
[clangd] NFC, remove an unused local varaiable.

2 years ago[llvm-ar] Prevent automatic conversion from thin to full archive
gbreynoo [Thu, 3 Feb 2022 11:33:49 +0000 (11:33 +0000)]
[llvm-ar] Prevent automatic conversion from thin to full archive

llvm-ar silently converts a thin archive to a regular archive when you
specify a modification operation (e.g. 'r') without the 'T' modifier.
This change stops this from occuring. If a user is trying to convert
between thin and full archives then they can explicitly use the 'L'
command to createa new archive.

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

2 years ago[mlir][vector] Sink StandardOps include to its user in VectorUtils
Benjamin Kramer [Thu, 3 Feb 2022 11:34:07 +0000 (12:34 +0100)]
[mlir][vector] Sink StandardOps include to its user in VectorUtils

2 years ago[RS4GC] Regenerate test checks (NFC)
Nikita Popov [Thu, 3 Feb 2022 11:25:05 +0000 (12:25 +0100)]
[RS4GC] Regenerate test checks (NFC)

2 years ago[OpenCL] Move most _explicit atomics into multiclass; NFC
Sven van Haastregt [Thu, 3 Feb 2022 11:09:41 +0000 (11:09 +0000)]
[OpenCL] Move most _explicit atomics into multiclass; NFC

This will simplify future conditionalization for OpenCL 3.0
optionality of atomic features.

The only set of atomic functions not using the multiclass is
atomic_compare_exchange_strong/weak, as these don't fit the common
pattern due to having 2 MemoryOrder arguments.

2 years ago[ConstraintElimination] Handle degenerate case with branch to same dest.
Florian Hahn [Thu, 3 Feb 2022 11:09:14 +0000 (11:09 +0000)]
[ConstraintElimination] Handle degenerate case with branch to same dest.

When a conditional branch has the same block as both true and false
successor it is not safe to add the condition.

Fixes PR49819.

2 years ago[ConstraintElimination] Add test cases from PR49819.
Florian Hahn [Thu, 3 Feb 2022 11:09:10 +0000 (11:09 +0000)]
[ConstraintElimination] Add test cases from PR49819.

2 years ago[AArch64] Reassociate integer extending reductions to pairwise addition.
David Green [Thu, 3 Feb 2022 11:05:48 +0000 (11:05 +0000)]
[AArch64] Reassociate integer extending reductions to pairwise addition.

Given an (integer) vecreduce, we know the order of the inputs does not matter.
We can convert UADDV(add(zext(extract_lo(x)), zext(extract_hi(x)))) into
UADDV(UADDLP(x)). This can also happen through an extra add, where we transform
UADDV(add(y, add(zext(extract_lo(x)), zext(extract_hi(x))))).

This makes sure the same thing happens signed cases too, which requires adding
a new SADDLP node.

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

2 years ago[clang-format] Revert a feature in RemoveBracesLLVM
Owen Pan [Thu, 3 Feb 2022 05:52:14 +0000 (21:52 -0800)]
[clang-format] Revert a feature in RemoveBracesLLVM

Revert the handling of a single-statement block that gets wrapped.

See issue #53543.

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

2 years ago[compiler-rt][lsan] Increase libdl_deadlock test timeout
David Spickett [Thu, 3 Feb 2022 10:52:02 +0000 (10:52 +0000)]
[compiler-rt][lsan] Increase libdl_deadlock test timeout

We (Linaro) still have the occasional failure here due
to high load on a shared buildbot machine.

We are looking into general soloutions but perhaps this
will help in the meantime.

2 years ago[mlir][NFC] Fully qualify a default C++ string in Pattern.cpp
Markus Böck [Thu, 3 Feb 2022 10:50:26 +0000 (11:50 +0100)]
[mlir][NFC] Fully qualify a default C++ string in Pattern.cpp

2 years ago[fir] Add fir.array_access op
Valentin Clement [Thu, 3 Feb 2022 10:41:04 +0000 (11:41 +0100)]
[fir] Add fir.array_access op

The `array_access` provides a reference to a single element from an array
value. This is *not* a view in the immutable array, otherwise it couldn't
be stored to. It can be see as a logical copy of the element and its
position in the array. This reference can be written to and modified without
changing the original array.

The `array_access` operation is used to fetch the memory reference of an
element in an array value.

```fortran
      real :: a(n,m)
      ...
      ... a ...
      ... a(r,s+1) ...
```

One can use `fir.array_access` to recover the implied memory reference to
the element `a(i,j)` in an array expression `a` as shown above. It can also
be used to recover the reference element `a(r,s+1)` in the second
expression.

```mlir
      %s = fir.shape %n, %m : (index, index) -> !fir.shape<2>
      // load the entire array 'a'
      %v = fir.array_load %a(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shape<2>) -> !fir.array<?x?xf32>
      // fetch the value of one of the array value's elements
      %1 = fir.array_access %v, %i, %j : (!fir.array<?x?xf32>, index, index) -> !fir.ref<f32>
```

More information about `array_access` and other array operations can be
found in flang/docs/FIRArrayOperations.md.

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

Reviewed By: kiranchandramohan, schweitz

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang] Lower integer constant code for STOP stmt
Valentin Clement [Thu, 3 Feb 2022 10:30:50 +0000 (11:30 +0100)]
[flang] Lower integer constant code for STOP stmt

This patch lower the integer constant code in the STOP statement.

The code is lowered to `arith.constant`.

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

Reviewed By: schweitz, kiranchandramohan

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

2 years ago[syntax][pseudo] Add Grammar for the clang pseudo-parser
Haojian Wu [Wed, 19 Jan 2022 12:14:57 +0000 (13:14 +0100)]
[syntax][pseudo] Add Grammar for the clang pseudo-parser

This patch introduces the Grammar class, which is a critial piece for constructing
a tabled-based parser.

As the first patch, the scope is limited to:
  - define base types (symbol, rules) of modeling the grammar
  - construct Grammar by parsing the BNF file (annotations are excluded for now)

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

2 years ago[flang] Add lowering for integer constant
Valentin Clement [Thu, 3 Feb 2022 09:40:19 +0000 (10:40 +0100)]
[flang] Add lowering for integer constant

This patch enables the lowering of integer constant.

The `ScalarExprLowering` class is introduced in `ConvertExpr.cpp` to help
the lowering of expression. This patch adds all the placeholder as well for future
expression lowering with the appropriate TODOs.

Integer constant expression are lowered to `arith.constant` with an integer type corresponding to the kind value.

This patch is in support of D118787

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

Reviewed By: schweitz, kiranchandramohan

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

2 years ago[clang][Hexagon] Match -lc option more specifically in toolchain test
David Spickett [Thu, 3 Feb 2022 09:56:17 +0000 (09:56 +0000)]
[clang][Hexagon] Match -lc option more specifically in toolchain test

In https://lab.llvm.org/buildbot/#/builders/185/builds/1341
our bot happened to generate a temporary file path with -lc in
it.

Match with "" around the options so this doesn't happen again.

2 years ago[VE] Packed v512i32 isel and tests
Simon Moll [Thu, 3 Feb 2022 10:01:42 +0000 (11:01 +0100)]
[VE] Packed v512i32 isel and tests

Reviewed By: kaz7

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

2 years ago[ConstantFolding] Fold constrained compare intrinsics
Serge Pavlov [Thu, 3 Feb 2022 07:10:51 +0000 (14:10 +0700)]
[ConstantFolding] Fold constrained compare intrinsics

The change implements constant folding of ‘llvm.experimental.constrained.fcmp’
and ‘llvm.experimental.constrained.fcmps’ intrinsics.

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

2 years agoRevert "[compiler-rt][Darwin] Add arm64 to simulator platforms"
Tim Northover [Thu, 3 Feb 2022 09:41:50 +0000 (09:41 +0000)]
Revert "[compiler-rt][Darwin] Add arm64 to simulator platforms"

This reverts commit a8e5ce76b475a22546090a73c22fa4f83529aa4e.

It looks like older Xcodes' headers don't allow arm64 builds so it was causing
CI failures.

2 years ago[clang-format] Reserve vectors when the number of items is known beforehand. NFC.
Marek Kurdej [Thu, 3 Feb 2022 09:37:58 +0000 (10:37 +0100)]
[clang-format] Reserve vectors when the number of items is known beforehand. NFC.

2 years agoRevert "[SimplifyCFG] Start redesigning `FoldTwoEntryPHINode()`."
Roman Lebedev [Thu, 3 Feb 2022 09:22:43 +0000 (12:22 +0300)]
Revert "[SimplifyCFG] Start redesigning `FoldTwoEntryPHINode()`."

Unfortunately, it seems we really do need to take the long route;
start from the "merge" block, find (all the) "dispatch" blocks,
and deal with each "dispatch" block separately, instead of simply
starting from each "dispatch" block like it would logically make sense,
otherwise we run into a number of other missing folds around
`switch` formation, missing sinking/hoisting and phase ordering.

This reverts commit 85628ce75b3084dc0f185a320152baf85b59aba7.
This reverts commit c5fff9095342a792bf4b9a077fe3c3a83c4e566c.
This reverts commit 34a98e1046e3aa55e5f26ab20a15e96b4034d25a.
This reverts commit 1e353f092288309d74d380367aa50bbd383780ed.

2 years ago[ISEL] Canonicalize STEP_VECTOR to LHS if RHS is a splat.
Sander de Smalen [Thu, 3 Feb 2022 08:59:49 +0000 (08:59 +0000)]
[ISEL] Canonicalize STEP_VECTOR to LHS if RHS is a splat.

This helps recognise patterns where we're trying to match STEP_VECTOR
patterns to INDEX instructions that take a GPR for the Start/Step.

The reason for canonicalising this operation to the LHS is
because it will already be canonicalised to the LHS if the RHS
is a constant splat vector.

Reviewed By: paulwalker-arm

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

2 years ago[AMDGPU] Update two Codegen tests. (NFC)
Thomas Symalla [Thu, 3 Feb 2022 09:25:55 +0000 (10:25 +0100)]
[AMDGPU] Update two Codegen tests. (NFC)

This change adds a new Codegen test with auto-generated checks and
updates divergence-driven-trunc-to-i1.ll with auto-generated checks.
This is in preparation to D118461 to visualize the Codegen changes.

2 years agoRemove -Wweak-template-vtables
Hans Wennborg [Wed, 2 Feb 2022 09:57:39 +0000 (10:57 +0100)]
Remove -Wweak-template-vtables

as it was planned for removal in clang 15 and we're now past the branch point

See https://github.com/llvm/llvm-project/issues/19107

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

2 years ago[flang] add ExtendedValue type helpers and factory::genZeroValue
Jean Perier [Thu, 3 Feb 2022 09:13:39 +0000 (10:13 +0100)]
[flang] add ExtendedValue type helpers and factory::genZeroValue

Add some helpers to get the base type and element type of
fir::ExtendedValue and to test if a fir::ExtendedValue is
a derived type with length parameters.

Add a new helper factory::genZeroValue to generate zero scalar value for
all the numerical types and false for logicals.

These helpers are used only in lowering for now, so add unit tests.

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

2 years ago[clang-format] Use back() instead of rbegin(). NFC.
Marek Kurdej [Thu, 3 Feb 2022 09:07:02 +0000 (10:07 +0100)]
[clang-format] Use back() instead of rbegin(). NFC.

2 years ago[clang-format] Remove unnecessary non-null check and assert instead. NFC.
Marek Kurdej [Thu, 3 Feb 2022 08:49:49 +0000 (09:49 +0100)]
[clang-format] Remove unnecessary non-null check and assert instead. NFC.

After a non-eof token, there is at least an eof token.

2 years ago[mlir] Fix crash in RewriterGen when a `TypeConstraint` is not given an argument
Markus Böck [Thu, 3 Feb 2022 08:08:27 +0000 (09:08 +0100)]
[mlir] Fix crash in RewriterGen when a `TypeConstraint` is not given an argument

The code assumes that a TypeConstraint in the additional constraints list specifies precisely one argument.
If the user were to not specify any, it'd result in a crash. If given more than one, the additional ones were ignored.

This patch fixes the crash and disallows user errors by adding a check that a single argument is supplied to the TypeConstraint

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

2 years ago[llvm-jitlink] Add comment to clarify testcase intent.
Lang Hames [Thu, 3 Feb 2022 07:59:09 +0000 (18:59 +1100)]
[llvm-jitlink] Add comment to clarify testcase intent.

2 years ago[llvm-jitlink] Add -alias option, shorten "-define-abs" option to "-abs".
Lang Hames [Thu, 3 Feb 2022 06:46:49 +0000 (17:46 +1100)]
[llvm-jitlink] Add -alias option, shorten "-define-abs" option to "-abs".

The -alias option can be used to define aliases within a JITDylib. The
immediate motivation is to simplify testing of ORC runtime functions using
existing testcases (e.g. by aliasing dlfcn functions to their ORC-runtime
counterparts, like -alias dlopen=__orc_rt_macho_dlopen). The option is likely
to be useful for testing in general.

The -define-abs option is shortened to -abs for consistency with -alias.

2 years ago[asan][test] Re-generate asan-check-memaccess-add.ll with update_llc_test_checks.py
Fangrui Song [Thu, 3 Feb 2022 07:40:10 +0000 (23:40 -0800)]
[asan][test] Re-generate asan-check-memaccess-add.ll with update_llc_test_checks.py

* LABEL is important to give a better diagnostic in case a check pattern fails
* Some NOT negative patterns are not effective. NEXT is useful to ensure
  a code sequence has the desired instructions and report a better
  diagnostic if something goes off.
* Since the ABI says the first parameter is in RDI. Replacing the
  pattern `[[REG16:.*]]` with `RDI` should not cause maintenance burden.

Since the test is pretty mechanical, just use update_llc_test_checks.py
to re-generate it. Most functions can use `nounwind` to avoid CFI
directives.

Reviewed By: kstoimenov, vitalybuka

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

2 years ago[libc++][nfc] Add TEST_HAS_NO_UNICODE_CHARS.
Mark de Wever [Wed, 2 Feb 2022 18:28:03 +0000 (19:28 +0100)]
[libc++][nfc] Add TEST_HAS_NO_UNICODE_CHARS.

This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, philnik, ldionne

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

2 years ago[libc++][ranges][NFC] Test the specializations of `tuple_{size,element}` for ranges.
Konstantin Varlamov [Thu, 3 Feb 2022 06:58:12 +0000 (22:58 -0800)]
[libc++][ranges][NFC] Test the specializations of `tuple_{size,element}` for ranges.

Also update the synopsis in `<ranges>` to mention the specializations.

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

2 years ago[BOLT][NFC] Use isInt<> instead of range checks
Amir Ayupov [Wed, 2 Feb 2022 17:04:10 +0000 (09:04 -0800)]
[BOLT][NFC] Use isInt<> instead of range checks

Summary: Reuse LLVM isInt check

Reviewed By: maksfb

FBD33945182

2 years ago[RISCV] Remove unused variables. NFC
Craig Topper [Thu, 3 Feb 2022 03:21:14 +0000 (19:21 -0800)]
[RISCV] Remove unused variables. NFC

2 years ago[BOLT][TEST] Add heatmap.test
Amir Ayupov [Thu, 3 Feb 2022 01:54:19 +0000 (17:54 -0800)]
[BOLT][TEST] Add heatmap.test

Add a basic test for heatmap mode

Reviewed By: maksfb, ayermolo

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

2 years ago[clang] Mark `trivial_abi` types as "trivially relocatable".
Devin Jeanpierre [Thu, 3 Feb 2022 01:20:11 +0000 (17:20 -0800)]
[clang] Mark `trivial_abi` types as "trivially relocatable".

This change enables library code to skip paired move-construction and destruction for `trivial_abi` types, as if they were trivially-movable and trivially-destructible. This offers an extension to the performance fix offered by `trivial_abi`: rather than only offering trivial-type-like performance for pass-by-value, it also offers it for library code that moves values but not as arguments.

For example, if we use `memcpy` for trivially relocatable types inside of vector reallocation, and mark `unique_ptr` as `trivial_abi` (via `_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI` / `_LIBCPP_ABI_UNSTABLE` / etc.), this would speed up `vector<unique_ptr>::push_back` by 40% on my benchmarks. (Though note that in this case, the compiler could have done this anyway, but happens not to due to the inlining horizon.)

If accepted, I intend to follow up with exactly such changes to library code, including and especially `std::vector`, making them use a trivial relocation operation on trivially relocatable types.

**D50119 and P1144:**

This change is very similar to D50119, which was rejected from Clang. (That change was an implementation of P1144, which is not yet part of the C++ standard.)

The intent of this change, rather than trying to pick a winning proposal for trivial relocation operations, is to extend the behavior of `trivial_abi` in a way that could be made compatible with any such proposal. If P1144 or any similar proposal were accepted, then `trivial_abi`, `__is_trivially_relocatable`, and everything else in this change would be redefined in terms of that.

**Safety:**

It's worth pointing out, specifically, that `trivial_abi` already implies trivial relocatability in a narrow sense: a `trivial_abi` type, when passed by value, has its constructor run in one location, and its destructor run in another, after the type has been trivially relocated (through registers).

Trivial relocatability optimizations could change the number of paired constructor/destructor calls, but this seems unlikely to matter for `trivial_abi` types.

Reviewed By: rsmith

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

2 years ago[gn build] Port 610979b301c5
LLVM GN Syncbot [Thu, 3 Feb 2022 01:19:34 +0000 (01:19 +0000)]
[gn build] Port 610979b301c5

2 years ago[libc++][ranges] Add ranges::in_out_out_result
Nikolas Klauser [Thu, 3 Feb 2022 01:17:03 +0000 (02:17 +0100)]
[libc++][ranges] Add ranges::in_out_out_result

Add `ranges::in_out_out_result`

Reviewed By: Quuxplusone, Mordante, #libc

Spies: libcxx-commits, mgorny

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

2 years agoPR45879: Fix assert when constant evaluating union assignment.
Richard Smith [Thu, 3 Feb 2022 01:00:35 +0000 (17:00 -0800)]
PR45879: Fix assert when constant evaluating union assignment.

Consider the form of the first operand of a class assignment not the
second operand when implicitly starting the lifetimes of union members.
Also add a missing check that the assignment call actually came from a
syntactic assignment, not from a direct call to `operator=`.

2 years ago[bazel] Port ead1107257e6
Benjamin Kramer [Thu, 3 Feb 2022 00:41:03 +0000 (01:41 +0100)]
[bazel] Port ead1107257e6

2 years ago[asan][X86] Change some std::string variables to StringRef. NFC
Fangrui Song [Thu, 3 Feb 2022 00:34:35 +0000 (16:34 -0800)]
[asan][X86] Change some std::string variables to StringRef. NFC

2 years ago[gn build] (manually) port ded733bd4 (llvm-remark-size-diff)
Nico Weber [Thu, 3 Feb 2022 00:32:41 +0000 (19:32 -0500)]
[gn build] (manually) port ded733bd4 (llvm-remark-size-diff)

2 years ago[ASan] Added intermediate functions between assembly and __asan_report.* to avoid...
Kirill Stoimenov [Wed, 2 Feb 2022 17:57:58 +0000 (17:57 +0000)]
[ASan] Added intermediate functions between assembly and __asan_report.* to avoid link errors.

Instead of calling asan_report.* directly from assembly code they have been replaced with corresponding asan_report.*_asm function, which call asan_report.*. All asan_report.* are now undefined weak symbols, which allows DSOs to link when z defs is used.

Reviewed By: MaskRay, morehouse

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

2 years agoFix buildbot failure after D112940
Jessica Paquette [Thu, 3 Feb 2022 00:16:49 +0000 (16:16 -0800)]
Fix buildbot failure after D112940

Change a type from `int64_t` to `long long` to make a buildbot happy.

https://lab.llvm.org/buildbot/#/builders/196/builds/7371

```
error: no matching function for call to 'getAsSignedInteger'
 if (getAsSignedInteger(ValStr, 0, Val))
```

Worked With My Compiler (TM)

2 years agoRegScavenger: Add function to externally reserve a scavenging index
Matt Arsenault [Wed, 1 Dec 2021 00:34:59 +0000 (19:34 -0500)]
RegScavenger: Add function to externally reserve a scavenging index

AMDGPU separately tracks the frame index we use for the emergency
spill slot. In the case where we need to spill SGPRs to memory, we
manually handle the save and restore. In other cases, the scavenger
handles the spills normally.

In a future change, I will need to add a second scavenging index in
order to free a second register in case we are spilling to a large
offset and also have to avoid clobbering a condition register
(SCC). In the intersection of these two cases, we will end up
recursively calling eliminateFrameIndex. We need to report to the
scavenger that the first scavenging frame index is unavailable, and
that the register is already used to avoid double spilling to the
scavenging slot (and avoid clobbering the previously evicted register,
and getting the same register for both scavenge calls).

This is really ugly but I don't see a better way without requiring
targets to be far more aware of how the scavenger iterator is
advanced.

2 years ago[mte] fix compiler crash with musttail.
Florian Mayer [Wed, 2 Feb 2022 23:38:20 +0000 (15:38 -0800)]
[mte] fix compiler crash with musttail.

see D118852 for matching hwasan fix.

Reviewed By: eugenis

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

2 years agoAdd a tool for diffing size remarks
Jessica Paquette [Fri, 29 Oct 2021 01:51:52 +0000 (18:51 -0700)]
Add a tool for diffing size remarks

This is a tool which can handle bitstream and YAML remarks. The idea here is to
provide more insight into which functions changed in a benchmark when testing
compiler changes.

E.g. "foo got 20% bigger, so maybe we should look more closely at that."

To use the tool, you can use...

```
$ llvm-remark-size-diff remarks_file_a remarks_file_b --parser=yaml|bitstream
```

... on two remarks files containing at least instruction count remarks. This
will output some data on instruction count change and also other relevant
information such as stack size change from `remarks_file_a` to `remarks_file_b`.

This is a bit of a WIP so I'm happy to change the format etc. Ultimately I think
it'd be best to have some JSON output which could be consumed by another tool.
But some base-level, greppable output is very handy to have anyway.

The format I'm proposing here is

```
<files> <inc/dec in inst count> <fn name> <inst count change> <stack B change>
```

Where the files and increase/decrease are indicated like below:

- `<files>` is one of `++` (file B), `--` (file A), `==` (both)
- `<inc/dec in inst count>` is one of `>` (increase) or `<` (decrease)

This makes it easy to grep for things like "which functions appeared in A but
did not appear in B?" Or "what are all the instruction count decreases?"

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

2 years ago[NFC] pull retvec logic to MemoryTaggingSupport.
Florian Mayer [Wed, 2 Feb 2022 23:28:14 +0000 (15:28 -0800)]
[NFC] pull retvec logic to MemoryTaggingSupport.

we will also need this for aarch64 stack tagging.

Reviewed By: eugenis

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

2 years agoAMDGPU: Add second emergency slot for SGPR to vmem for large frames
Matt Arsenault [Wed, 24 Nov 2021 00:47:40 +0000 (19:47 -0500)]
AMDGPU: Add second emergency slot for SGPR to vmem for large frames

In a future change, we will sometimes use a VGPR offset for doing
spills to memory, in which case we need 2 free VGPRs to do the SGPR
spill. In most cases we could spill the VGPR along with the SGPR being
spilled, but we don't have any free lanes for SGPR_1024 in wave32 so
we could still potentially need a second scavenging slot.

2 years ago[SimplifyCFG] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds
Fangrui Song [Wed, 2 Feb 2022 23:11:22 +0000 (15:11 -0800)]
[SimplifyCFG] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds

2 years ago[mlir] Remove dangling reference to std-bufferize which got removed
River Riddle [Wed, 2 Feb 2022 23:04:19 +0000 (15:04 -0800)]
[mlir] Remove dangling reference to std-bufferize which got removed

2 years ago[flang] Add a semantics test for co_broadcast
Damian Rouson [Thu, 18 Nov 2021 17:56:43 +0000 (09:56 -0800)]
[flang] Add a semantics test for co_broadcast

Test a range of acceptable forms of co_broadcast calls, including
combinations of keyword and non-keyword actual arguments of
intrinsic and derived type.  Also test that several invalid forms
of co_sum call generate the correct error messages.

Reviewed By: ktras

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

2 years ago[lld-macho] Fix duplicate symbols with relocatable objects
Keith Smiley [Sat, 29 Jan 2022 01:34:36 +0000 (17:34 -0800)]
[lld-macho] Fix duplicate symbols with relocatable objects

In the case your framework bundles contain relocatable objects, and your
objects include LC_LINKER_OPTIONs for the framework, previously they
would not be deduplicated like they would have if they were static
archives. This was also the case if you passed `-framework` for the
framework as well.

Reviewed By: #lld-macho, thakis, oontvoo

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

2 years agoSkip exception cleanups when the innermost scope is EHTerminateScope.
James Y Knight [Wed, 2 Feb 2022 16:32:41 +0000 (11:32 -0500)]
Skip exception cleanups when the innermost scope is EHTerminateScope.

EHTerminateScope is used to implement C++ noexcept semantics. Per C++
[except.terminate], it is implemented-defined whether no, some, or all
cleanups are run prior to terminatation.

Therefore, the code to run cleanups on the way towards termination is
unnecessary, and may be omitted.

After this change, we will still run some cleanups: any cleanups in a
function called from the noexcept function will continue to run, while
those in the noexcept function itself will not.

(Commit attempt 2: check InnermostEHScope != stable_end() before accessing it.)

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

2 years ago[mlir:Standard] Remove support for creating a `unit` ConstantOp
River Riddle [Mon, 31 Jan 2022 21:53:22 +0000 (13:53 -0800)]
[mlir:Standard] Remove support for creating a `unit` ConstantOp

This is completely unused upstream, and does not really have well defined semantics
on what this is supposed to do/how this fits into the ecosystem. Given that, as part of
splitting up the standard dialect it's best to just remove this behavior, instead of try
to awkwardly fit it somewhere upstream. Downstream users are encouraged to
define their own operations that clearly can define the semantics of this.

This also uncovered several lingering uses of ConstantOp that weren't
updated to use arith::ConstantOp, and worked during conversions because
the constant was removed/converted into something else before
verification.

See https://llvm.discourse.group/t/standard-dialect-the-final-chapter/ for more discussion.

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

2 years ago[mlir] Move StandardOps/Utils to Arithmetic and sever a bunch of dependencies on...
River Riddle [Wed, 26 Jan 2022 20:56:18 +0000 (12:56 -0800)]
[mlir] Move StandardOps/Utils to Arithmetic and sever a bunch of dependencies on Standard

The Utils.cpp file in StandardOps essentially just contains utilities for interacting with arithmetic
operations, and at this point makes more sense as a utility file for the arithemtic dialect.

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

2 years ago[mlir] Move SelectOp from Standard to Arithmetic
River Riddle [Mon, 31 Jan 2022 20:44:35 +0000 (12:44 -0800)]
[mlir] Move SelectOp from Standard to Arithmetic

This is part of splitting up the standard dialect. See https://llvm.discourse.group/t/standard-dialect-the-final-chapter/ for discussion.

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

2 years ago[mlir] Split std.splat into tensor.splat and vector.splat
River Riddle [Tue, 25 Jan 2022 23:51:05 +0000 (15:51 -0800)]
[mlir] Split std.splat into tensor.splat and vector.splat

This is part of the larger effort to split the standard dialect. This will also allow for pruning some
additional dependencies on Standard (done in a followup).

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

2 years ago[mte] support more complicated lifetimes (e.g. for exceptions).
Florian Mayer [Wed, 2 Feb 2022 21:53:34 +0000 (13:53 -0800)]
[mte] support more complicated lifetimes (e.g. for exceptions).

Reviewed By: eugenis

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

2 years ago[InstrProf][NFC] Remove stray option in InstrProfWriter
Ellis Hoag [Wed, 2 Feb 2022 22:12:58 +0000 (14:12 -0800)]
[InstrProf][NFC] Remove stray option in InstrProfWriter

This variable was added to `InstrProfWriter.cpp`  in D115693 by mistake and it isn't needed.

Reviewed By: kyulee

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

2 years agoAMDGPU [NFC]: Fix a few typos in docs AMDGPUUsage.rst
Changpeng Fang [Wed, 2 Feb 2022 22:22:52 +0000 (14:22 -0800)]
AMDGPU [NFC]: Fix a few typos in docs AMDGPUUsage.rst

Summery:
  Fix a few typos in docs AMDGPUUsage.rst

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

2 years ago[LLDB] add sub regigter enums on x64 Windows
Zequan Wu [Wed, 2 Feb 2022 00:54:32 +0000 (16:54 -0800)]
[LLDB] add sub regigter enums on x64 Windows

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

2 years ago[release] Use the Bootstrapping build for building LLVM releases
Louis Dionne [Thu, 28 Oct 2021 15:53:48 +0000 (11:53 -0400)]
[release] Use the Bootstrapping build for building LLVM releases

Instead of using the (now deprecated) Projects build for libcxx, libcxxabi,
libunwind and compiler-rt, this patch uses the Bootstrapping build. This
implies that Clang will be built from scratch, and then the runtimes will
be built using that just-built Clang instead of the system compiler.
This is the correct way of assembling a toolchain, since we don't want
to ship runtimes that were built with a non-Clang compiler (or a
potentially older Clang).

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

2 years ago[lld-macho][nfc] Hoist out creation of Section in parseSections()
Jez Ng [Wed, 2 Feb 2022 22:08:35 +0000 (17:08 -0500)]
[lld-macho][nfc] Hoist out creation of Section in parseSections()

Simplifies the code slightly.

Reviewed By: #lld-macho, thakis

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

2 years ago[x86] add test for 'sbb' false dependency stall; NFC
Sanjay Patel [Wed, 2 Feb 2022 19:11:40 +0000 (14:11 -0500)]
[x86] add test for 'sbb' false dependency stall; NFC

2 years ago[x86] make helper function to create sbb with zero operands; NFC
Sanjay Patel [Wed, 2 Feb 2022 18:54:50 +0000 (13:54 -0500)]
[x86] make helper function to create sbb with zero operands; NFC

As noted in D116804, we want to effectively invert that patch
for CPUs (intel) that don't break the false dependency on
sbb %eax, %eax

So we will likely want to create that here in the
X86DAGToDAGISel::Select() case for X86::SETCC_CARRY.

2 years ago[mte] work around lifetime issue with setjmp.
Florian Mayer [Wed, 2 Feb 2022 00:44:23 +0000 (16:44 -0800)]
[mte] work around lifetime issue with setjmp.

setjmp can return twice, but PostDominatorTree is unaware of this. as
such, it overestimates postdominance, leaving some cases where memory
does not get untagged on return. this causes false positives later in
the program execution.

this is a workaround for now, in the longer term PostDominatorTree
should be made aware of returns_twice, as this may cause problems
elsewhere.

See D118647 for equivalent fix to HWASan.

Reviewed By: eugenis

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

2 years ago[flang] Modify right modes for READ/WRITE vs OPEN
Peter Klausler [Mon, 31 Jan 2022 18:06:40 +0000 (10:06 -0800)]
[flang] Modify right modes for READ/WRITE vs OPEN

When a mode flag is modified (e.g., BLANK='ZERO') in an I/O data transfer
statement, ensure that the right set of mode flags is modified.
There's one set of mode flags that are captured by an OPEN
statement and maintained in the connection, and another that
is maintained in an I/O statement state record for local mutability.
Some I/O API routines were unconditionally modifying the persistent
set of flags.

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

2 years ago[NFC] remove excessive whitespace.
Florian Mayer [Wed, 2 Feb 2022 21:26:56 +0000 (13:26 -0800)]
[NFC] remove excessive whitespace.

2 years ago[mlir][NFC] Update remaining dialect operations to use `hasVerifier` instead of ...
River Riddle [Wed, 2 Feb 2022 18:24:48 +0000 (10:24 -0800)]
[mlir][NFC] Update remaining dialect operations to use `hasVerifier` instead of `verifier`

The verifier field is deprecated, and slated for removal.

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

2 years ago[mlir][NFC] Update PDL operations to use `hasVerifier` instead of `verifier`
River Riddle [Wed, 2 Feb 2022 18:24:43 +0000 (10:24 -0800)]
[mlir][NFC] Update PDL operations to use `hasVerifier` instead of `verifier`

The verifier field is deprecated, and slated for removal.

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

2 years ago[mlir][NFC] Update GPU/SCF operations to use `hasVerifier` instead of `verifier`
River Riddle [Wed, 2 Feb 2022 18:24:22 +0000 (10:24 -0800)]
[mlir][NFC] Update GPU/SCF operations to use `hasVerifier` instead of `verifier`

The verifier field is deprecated, and slated for removal.

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

2 years ago[mlir][NFC] Update Affine operations to use `hasVerifier` instead of `verifier`
River Riddle [Wed, 2 Feb 2022 18:23:28 +0000 (10:23 -0800)]
[mlir][NFC] Update Affine operations to use `hasVerifier` instead of `verifier`

The verifier field is deprecated, and slated for removal.

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

2 years ago[mlir][NFC] Update OpenACC/OpenMP operations to use `hasVerifier` instead of `verifier`
River Riddle [Wed, 2 Feb 2022 18:22:57 +0000 (10:22 -0800)]
[mlir][NFC] Update OpenACC/OpenMP operations to use `hasVerifier` instead of `verifier`

The verifier field is deprecated, and slated for removal.

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

2 years ago[mlir][NFC] Update MemRef/Tensor operations to use `hasVerifier` instead of `verifier`
River Riddle [Wed, 2 Feb 2022 18:18:06 +0000 (10:18 -0800)]
[mlir][NFC] Update MemRef/Tensor operations to use `hasVerifier` instead of `verifier`

The verifier field is deprecated, and slated for removal.

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

2 years ago[mlir][NFC] Update Vector operations to use `hasVerifier` instead of `verifier`
River Riddle [Wed, 2 Feb 2022 18:17:02 +0000 (10:17 -0800)]
[mlir][NFC] Update Vector operations to use `hasVerifier` instead of `verifier`

The verifier field is deprecated, and slated for removal.

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

2 years ago[mlir][NFC] Update AMX/LLVM/NVVM/X86 vector operations to use `hasVerifier` instead...
River Riddle [Wed, 2 Feb 2022 18:16:28 +0000 (10:16 -0800)]
[mlir][NFC] Update AMX/LLVM/NVVM/X86 vector operations to use `hasVerifier` instead of `verifier`

The verifier field is deprecated, and slated for removal.

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

2 years ago[mlir][NFC] Update SPIRV operations to use `hasVerifier` instead of `verifier`
River Riddle [Wed, 2 Feb 2022 18:06:30 +0000 (10:06 -0800)]
[mlir][NFC] Update SPIRV operations to use `hasVerifier` instead of `verifier`

The verifier field is deprecated, and slated for removal.

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

2 years ago[mlir][NFC] Update Toy operations to use `hasVerifier` instead of `verifier`
River Riddle [Wed, 2 Feb 2022 18:05:01 +0000 (10:05 -0800)]
[mlir][NFC] Update Toy operations to use `hasVerifier` instead of `verifier`

The verifier field is deprecated, and slated for removal.

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

2 years ago[mlir] Refactor how additional verification is specified in ODS
River Riddle [Tue, 1 Feb 2022 23:01:30 +0000 (15:01 -0800)]
[mlir] Refactor how additional verification is specified in ODS

Currently if an operation requires additional verification, it specifies an inline
code block (`let verifier = "blah"`). This is quite problematic for various reasons, e.g.
it requires defining C++ inside of Tablegen which is discouraged when possible, but mainly because
nearly all usages simply forward to a static function `static LogicalResult verify(SomeOp op)`.
This commit adds support for a `hasVerifier` bit field that specifies if an additional verifier
is needed, and when set to `1` declares a `LogicalResult verify()` method for operations to
override. For migration purposes, the existing behavior is untouched. Upstream usages will
be replaced in a followup to keep this patch focused on the hasVerifier implementation.

One main user facing change is that what was one `MyOp::verify` is now `MyOp::verifyInvariants`.
This better matches the name this method is called everywhere else, and also frees up `verify` for
the user defined additional verification. The `verify` function when generated now (for additional
verification) is private to the operation class, which should also help avoid accidental usages after
this switch.

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

2 years ago[libc++][ranges][NFC] Small updates to the Ranges status page:
Konstantin Varlamov [Wed, 2 Feb 2022 21:32:23 +0000 (13:32 -0800)]
[libc++][ranges][NFC] Small updates to the Ranges status page:

- note that `split_view` has been renamed to `lazy_split_view`.
- fix formatting.

2 years ago[gn build] Port 712b31e2d4dc
LLVM GN Syncbot [Wed, 2 Feb 2022 21:28:57 +0000 (21:28 +0000)]
[gn build] Port 712b31e2d4dc

2 years ago[libc++][ranges] Implement `indirectly_copyable{,_storable}`.
Konstantin Varlamov [Wed, 2 Feb 2022 21:27:28 +0000 (13:27 -0800)]
[libc++][ranges] Implement `indirectly_copyable{,_storable}`.

Also refactor tests for `indirectly_movable{,_storable}`.

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

2 years ago[NFC] factor isStandardLifetime out of HWASan
Florian Mayer [Wed, 2 Feb 2022 01:05:37 +0000 (17:05 -0800)]
[NFC] factor isStandardLifetime out of HWASan

this is so we can use it for aarch64 stack tagging.

Reviewed By: eugenis

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

2 years ago[libc++][ranges][NFC] In the Ranges status, mark move_sentinel as "in progress"
Konstantin Varlamov [Wed, 2 Feb 2022 21:14:57 +0000 (13:14 -0800)]
[libc++][ranges][NFC] In the Ranges status, mark move_sentinel as "in progress"

2 years agoThe methods visited for a special class must have an identifier.
Zahira Ammarguellat [Wed, 2 Feb 2022 19:28:44 +0000 (11:28 -0800)]
The methods visited for a special class must have an identifier.

2 years ago[flang] Debugging of ACCESS='STREAM' I/O
Peter Klausler [Fri, 28 Jan 2022 23:34:28 +0000 (15:34 -0800)]
[flang] Debugging of ACCESS='STREAM' I/O

Corrects the runtime implementation of I/O on files with
the access mode ACCESS='STREAM'.  This is a collection
of edge-case tweaks to ensure that the distinctions between
stream and direct/sequential files, unformatted or formatted,
are respected where appropriate.
Moves NextInField() from io-stmt.h to io-stmt.cpp --
it was getting too big to keep in a header.

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

2 years agoFollow up to 6e03a68b776dc, squelch another leak
Jeremy Morse [Wed, 2 Feb 2022 21:00:20 +0000 (21:00 +0000)]
Follow up to 6e03a68b776dc, squelch another leak

This patch is a sticking-paster until D118774 solves the situation with
unique_ptrs. I'm certainly wishing I'd focused on that first X_X.

2 years ago[libc++][ranges][NFC] Test new requirements for `basic_string_view` and `span` iterators.
Konstantin Varlamov [Wed, 2 Feb 2022 20:54:29 +0000 (12:54 -0800)]
[libc++][ranges][NFC] Test new requirements for `basic_string_view` and `span` iterators.

Note that most changes to `strings` and `views.span` from the One Ranges
Proposal are no longer applicable:
- free `begin` and `end` functions taking `basic_string_view` and `span`
  were removed by [P1870](http://wg21.link/p1870);
- `span::const_iterator` was removed by [LWG3320](https://cplusplus.github.io/LWG/lwg-defects.html#3320).

Reviewed By: #libc, Quuxplusone, ldionne

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

2 years ago[libc++][ranges][NFC] Add contiguous_iterator_tag to the <iterator> synopsis
Konstantin Varlamov [Wed, 2 Feb 2022 20:53:07 +0000 (12:53 -0800)]
[libc++][ranges][NFC] Add contiguous_iterator_tag to the <iterator> synopsis

It was previously implemented by commit [45d048c20](https://reviews.llvm.org/rG45d048c20440989df2b4e1be1f9343225e7741ab).

Reviewed By: #libc, Quuxplusone, philnik, ldionne

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

2 years ago[OMPIRBuilder] Add support for atomic compare
Shilei Tian [Wed, 2 Feb 2022 20:38:59 +0000 (15:38 -0500)]
[OMPIRBuilder] Add support for atomic compare

This patch adds the support for `atomic compare` in `OMPIRBuilder`.

Reviewed By: jdoerfert

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

2 years ago[libc++] Add UNSUPPORTED for clang-15
Haowei Wu [Wed, 2 Feb 2022 20:15:58 +0000 (12:15 -0800)]
[libc++] Add UNSUPPORTED for clang-15

This started breaking in the CI because we bumped the Clang version
to 15, which requires adjusting the markup in the test suite.

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

2 years ago[RISCV] Cleanup some places that assumed VLMaxSentinel and -1 constant mean the same...
Craig Topper [Wed, 2 Feb 2022 20:15:36 +0000 (12:15 -0800)]
[RISCV] Cleanup some places that assumed VLMaxSentinel and -1 constant mean the same thing. NFCI

VLMaxSentintel happens to be represented as -1 TargetConstant. A user
provided -1 would be an ISD::Constant. We shouldn't assume that they
are the same thing. I'm still not entirely convinced that we should be
treating -1 from the user as VLMAX.

Also fix one place that failed to use XLenVT for the VLMaxSentinel,
using MVT::i64 in code that only executes on RV32.

2 years ago[libc][bazel overlay] Add a target for strncpy.
Siva Chandra Reddy [Wed, 2 Feb 2022 20:18:52 +0000 (20:18 +0000)]
[libc][bazel overlay] Add a target for strncpy.

2 years agoRevert "[SLP]Alternate vectorization for cmp instructions."
Alexey Bataev [Wed, 2 Feb 2022 20:05:50 +0000 (12:05 -0800)]
Revert "[SLP]Alternate vectorization for cmp instructions."

This reverts commit 842a2360a84692f2e4c37cc3e652640e6627d004 to fix the
bugs reported by users in https://reviews.llvm.org/D115955#3291538.

2 years ago[LoopFuse] Change DT to reference in FusionCandidate struct. NFC
Anna Thomas [Wed, 2 Feb 2022 18:49:20 +0000 (13:49 -0500)]
[LoopFuse] Change DT to reference in FusionCandidate struct. NFC

Assertion added in f50821cff0 confirms that the DT is indeed nonnull.
Change it to a reference instead of a pointer to make this explicit in
FusionCandidate.
Suggested in D118472.

2 years ago[analyzer] Add support for __attribute__((returns_nonnull)).
Rashmi Mudduluru [Wed, 2 Feb 2022 02:28:42 +0000 (18:28 -0800)]
[analyzer] Add support for __attribute__((returns_nonnull)).

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

2 years ago[DebugInfo] Re-enable instruction referencing for x86_64
Jeremy Morse [Wed, 2 Feb 2022 19:17:42 +0000 (19:17 +0000)]
[DebugInfo] Re-enable instruction referencing for x86_64

After discussion in D116821 this was turned off in 74db5c8c95e,
14aaaa12366f7 applied to limit the maximum memory consumption in rare
conditions, plus some performance patches.