platform/upstream/llvm.git
23 months ago[libc++][NFC] Fix weird unicode character in release notes
Louis Dionne [Thu, 21 Jul 2022 14:55:06 +0000 (10:55 -0400)]
[libc++][NFC] Fix weird unicode character in release notes

23 months ago[flang] Lower F08 merge_bits intrinsic.
Tarun Prabhu [Thu, 21 Jul 2022 16:39:54 +0000 (10:39 -0600)]
[flang] Lower F08 merge_bits intrinsic.

Lower F08 merge_bits intrinsic.

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

23 months ago[mlir][linalg] Add tile_size option to `structured.tile_to_foreach_thread_op`
Christopher Bate [Thu, 21 Jul 2022 15:26:46 +0000 (09:26 -0600)]
[mlir][linalg] Add tile_size option to `structured.tile_to_foreach_thread_op`

This change modifies `structured.tile_to_foreach_thread_op` so that
it accepts either `tile_sizes` or `num_threads` parameters. If
`tile_sizes` are specified, then the number of threads required is
derived the tile sizes rather than the other way around. In both cases,
more aggressive folding of loop parameters is enabled during the
transformation, allowing for the potential elimination of `affine.min`
and `affine.max` operations in the static shape case when calculating
the final adjusted tile size.

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

23 months ago[flang][NFC] Test folding of F08 merge_bits intrinsic.
Tarun Prabhu [Thu, 21 Jul 2022 16:26:56 +0000 (10:26 -0600)]
[flang][NFC] Test folding of F08 merge_bits intrinsic.

Test compile-time folding of the F2008 merge_bits intrinsic.

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

23 months ago[lldb][NFCI] Refactor regex filtering logic in CommandObjectTypeFormatterList
Jorge Gorbe Moya [Thu, 21 Jul 2022 16:19:19 +0000 (09:19 -0700)]
[lldb][NFCI] Refactor regex filtering logic in CommandObjectTypeFormatterList

Extract a bit of copy/pasted regex filtering logic into a separate
function and simplify it a little bit.

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

23 months ago[AArch64] Add target hook for preferPredicateOverEpilogue
David Sherwood [Tue, 12 Jul 2022 11:03:39 +0000 (12:03 +0100)]
[AArch64] Add target hook for preferPredicateOverEpilogue

This patch adds the AArch64 hook for preferPredicateOverEpilogue,
which currently returns true if SVE is enabled and one of the
following conditions (non-exhaustive) is met:

1. The "sve-tail-folding" option is set to "all", or
2. The "sve-tail-folding" option is set to "all+noreductions"
and the loop does not contain reductions,
3. The "sve-tail-folding" option is set to "all+norecurrences"
and the loop has no first-order recurrences.

Currently the default option is "disabled", but this will be
changed in a later patch.

I've added new tests to show the options behave as expected here:

  Transforms/LoopVectorize/AArch64/sve-tail-folding-option.ll

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

23 months ago[clangd] Refactor forwarding call detection logic
Kadir Cetinkaya [Thu, 21 Jul 2022 10:41:00 +0000 (12:41 +0200)]
[clangd] Refactor forwarding call detection logic

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

23 months ago[clangd] Mention whether compile flags were inferred in check mode
Kadir Cetinkaya [Thu, 21 Jul 2022 08:20:00 +0000 (10:20 +0200)]
[clangd] Mention whether compile flags were inferred in check mode

That way when looking at logs it's clear whether diagnostics are a
result of compile flags mismatch.

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

23 months ago[libc++][format] Adhere to clang-tidy style.
Mark de Wever [Thu, 21 Jul 2022 15:31:45 +0000 (17:31 +0200)]
[libc++][format] Adhere to clang-tidy style.

D126971 broke the CI due to recent changes in the clang-tidy settings.
This fixes them.

23 months ago[AMDGPU] NFC. Auto-generate test for vcclo
Joe Nash [Wed, 20 Jul 2022 19:42:57 +0000 (15:42 -0400)]
[AMDGPU] NFC. Auto-generate test for vcclo

23 months ago[lldb] [gdb-remote] Fix process ID after following forked child
Michał Górny [Mon, 18 Jul 2022 15:54:31 +0000 (17:54 +0200)]
[lldb] [gdb-remote] Fix process ID after following forked child

Update the process ID after handling fork/vfork to ensure that
the process plugin reports the correct PID immediately.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D130037

23 months ago[Libomptarget] Build the device library even if the sm list is empty
Joseph Huber [Thu, 21 Jul 2022 13:34:58 +0000 (09:34 -0400)]
[Libomptarget] Build the device library even if the sm list is empty

We previously had some logic that stopped us from building the device runtime if
there were no NVPTX architectures provided. This is incorrect because we could
have AMDGPU libraries. Even if the lists are empty we should be able to attempt
to build these and get dummy output. THis wilil make it much easier for our
tooling which expects certain libraries. If the user wishes to disable the
library entirely they should use `-DLIBOMPTARGET_BUILD_DEVICERTL_BCLIB=OFF"

Reviewed By: tianshilei1992

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

23 months ago[X86] Remove cfi directives and duplicated check in tests. NFC
Phoebe Wang [Thu, 21 Jul 2022 14:53:23 +0000 (22:53 +0800)]
[X86] Remove cfi directives and duplicated check in tests. NFC

23 months ago[lldb/test] Fix flakyness in TestNonStop.test_stdio
Pavel Labath [Thu, 21 Jul 2022 14:51:54 +0000 (16:51 +0200)]
[lldb/test] Fix flakyness in TestNonStop.test_stdio

The test was assuming that the output will come in two messages. The
truth is that it will come in **at least** two messages.

23 months ago[mlir][python] Fix issues with block argument slices
Alex Zinenko [Thu, 21 Jul 2022 14:00:37 +0000 (14:00 +0000)]
[mlir][python] Fix issues with block argument slices

The type extraction helper function for block argument and op result
list objects was ignoring the slice entirely. So was the slice addition.
Both are caused by a misleading naming convention to implement slices
via CRTP. Make the convention more explicit and hide the helper
functions so users have harder time calling them directly.

Closes #56540.

Reviewed By: stellaraccident

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

23 months ago[NFC][LoopVectorize] Explicitly disable tail-folding on some SVE tests
David Sherwood [Tue, 12 Jul 2022 12:38:45 +0000 (13:38 +0100)]
[NFC][LoopVectorize] Explicitly disable tail-folding on some SVE tests

This patch is in preparation for enabling vectorisation with tail-folding
by default for SVE targets. Once we do that many existing tests will
break that depend upon having normal unpredicated vector loops. For
all such tests I have added the flag:

  -prefer-predicate-over-epilogue=scalar-epilogue

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

23 months ago[LAA] Precommit add/sub tests for forked pointers
Graham Hunter [Thu, 21 Jul 2022 13:24:58 +0000 (14:24 +0100)]
[LAA] Precommit add/sub tests for forked pointers

Adds new tests for add and sub instructions before reaching a select.

Also adds tests using different bit widths for memory, including
non-power-of-two integers.

23 months ago[mlir][Linalg] Add a Transform dialect NavigationOp op to match a list of ops or...
Nicolas Vasilache [Thu, 21 Jul 2022 13:44:43 +0000 (06:44 -0700)]
[mlir][Linalg] Add a Transform dialect NavigationOp op to match a list of ops or an interface.

This operation is a NavigationOp that simplifies the writing of transform IR.
Since there is no way of refering to an interface by name, the current implementation uses
an EnumAttr and depends on the interfaces it supports.
In the future, it would be worthwhile to remove this dependence and generalize.

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

23 months ago[AMDGPU][MC][NFC] Refine SMEM load definitions.
Ivan Kosarev [Thu, 21 Jul 2022 13:56:25 +0000 (14:56 +0100)]
[AMDGPU][MC][NFC] Refine SMEM load definitions.

Reviewed By: dp

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

23 months ago[AMDGPU][NFC] Validate G_MERGE_VALUES as we match zero-extended 32-bit scalars.
Ivan Kosarev [Thu, 21 Jul 2022 13:25:09 +0000 (14:25 +0100)]
[AMDGPU][NFC] Validate G_MERGE_VALUES as we match zero-extended 32-bit scalars.

Reviewed By: arsenm

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

23 months ago[lld-macho] Fix assertion when two symbols at same addr have unwind info
Jez Ng [Thu, 21 Jul 2022 13:44:01 +0000 (09:44 -0400)]
[lld-macho] Fix assertion when two symbols at same addr have unwind info

If there are multiple symbols at the same address, our unwind info
implementation assumes that we always register unwind entries to a
single canonical symbol.

This assumption was violated by the `registerEhFrame` code.

Fixes #56570.

Reviewed By: #lld-macho, thakis

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

23 months agoRevert "Rewording the "static_assert" to static assertion"
Erich Keane [Thu, 21 Jul 2022 13:39:22 +0000 (06:39 -0700)]
Revert "Rewording the "static_assert" to static assertion"

Looks like we again are going to have problems with libcxx tests that
are overly specific in their dependency on clang's diagnostics.

This reverts commit 6542cb55a3eb115b1c3592514590a19987ffc498.

23 months ago[lld-macho][NFC] Remove redundant StringRef construction
Daniel Bertalan [Thu, 21 Jul 2022 09:26:09 +0000 (11:26 +0200)]
[lld-macho][NFC] Remove redundant StringRef construction

It's only used in one branch, so we were unnecessarily calculating the
length of many symbol names.

Tiny speedup when linking chromium_framework on my M1 Mac mini:

x before.txt
+ after.txt

    N           Min           Max        Median           Avg        Stddev
x  10     3.9917109        4.0418     4.0318099     4.0203902   0.021459873
+  10      3.944725      4.053988     3.9708955     3.9825602   0.037257609
Difference at 95.0% confidence
-0.03783 +/- 0.0285663
-0.940953% +/- 0.710536%
(Student's t, pooled s = 0.0304028)

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

23 months agoRewording the "static_assert" to static assertion
Muhammad Usman Shahid [Thu, 21 Jul 2022 13:32:54 +0000 (06:32 -0700)]
Rewording the "static_assert" to static assertion

This patch is basically the rewording of the static assert statement's
output(error) on screen after failing. Failing a _Static_assert in C
should not report that static_assert failed. It’d probably be better to
reword the diagnostic to be more like GCC and say “static assertion”
failed in both C and C++.

consider a c file having code

_Static_assert(0, "oh no!");

In clang the output is like:

<source>:1:1: error: static_assert failed: oh no!
_Static_assert(0, "oh no!");
^              ~
1 error generated.
Compiler returned: 1

Thus here the "static_assert" is not much good, it will be better to
reword it to the "static assertion failed" to more generic. as the gcc
prints as:

<source>:1:1: error: static assertion failed: "oh no!"
    1 | _Static_assert(0, "oh no!");
          | ^~~~~~~~~~~~~~
          Compiler returned: 1

The above can also be seen here. This patch is about rewording
the static_assert to static assertion.

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

23 months ago[Binary] Hard-code the alignment of the offloading binary
Joseph Huber [Thu, 21 Jul 2022 13:25:43 +0000 (09:25 -0400)]
[Binary] Hard-code the alignment of the offloading binary

Summary:
We previously used `alignof` to get the necessary alignment of the
binary header. However this was different on 32-bit platforms and caused
a few tests to fail because of it. This patch just changes this to be a
hard-coded constant of 8.

23 months ago[AMDGPU] Pre-sink IR input for some tests
Jay Foad [Wed, 20 Jul 2022 12:45:27 +0000 (13:45 +0100)]
[AMDGPU] Pre-sink IR input for some tests

Edit the IR input for some codegen tests to simulate what the IR code
sinking pass would do to it. This makes the tests immune to the presence
or absence of the code sinking pass in the codegen pass pipeline, which
does not belong there.

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

23 months ago[LLDB][ClangExpression] Fix initialization of static enum alias members
Michael Buch [Thu, 21 Jul 2022 00:04:03 +0000 (01:04 +0100)]
[LLDB][ClangExpression] Fix initialization of static enum alias members

`IntegerLiteral::Create` operates on integer types. For that reason
when we parse DWARF into an AST, when we encounter a constant
initialized enum member variable, we try to determine the underlying
integer type before creating the `IntegerLiteral`. However, we
currently don't desugar the type and for enum typedefs
`dyn_cast<EnumType>` fails. In debug builds this triggers following
assert:

```
Assertion failed: (type->isIntegerType() && "Illegal type in IntegerLiteral"), function IntegerLiteral, file Expr.cpp, line 892
```

This patch turns the `dyn_cast<EnumType>` into a `getAs<EnumType>`
which `dyn_cast`s the canonical type, allowing us to get to the
underlying integer type.

**Testing**

* API test
* Manual repro is fixed

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

23 months ago[LLDB][DataFormatter] Add support for std::__map_const_iterator
Michael Buch [Sun, 17 Jul 2022 11:16:39 +0000 (12:16 +0100)]
[LLDB][DataFormatter] Add support for std::__map_const_iterator

This patch adds support for formatting `std::map::const_iterator`.
It's just a matter of adding `const_` to the existing regex.

**Testing**

* Added test case to existing API tests

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

23 months agoAMDGPU: Refine user-sgpr-init16-bug
Matt Arsenault [Thu, 21 Jul 2022 00:30:12 +0000 (20:30 -0400)]
AMDGPU: Refine user-sgpr-init16-bug

It only applies to gfx1100 and gfx1102, and for wave32.

23 months ago[MemoryBuiltins] Add getReallocatedOperand() function (NFC)
Nikita Popov [Thu, 21 Jul 2022 12:54:16 +0000 (14:54 +0200)]
[MemoryBuiltins] Add getReallocatedOperand() function (NFC)

Replace the value-accepting isReallocLikeFn() overload with a
getReallocatedOperand() function, which returns which operand is
the one being reallocated. Currently, this is always the first one,
but once allockind(realloc) is respected, the reallocated operand
will be determined by the allocptr parameter attribute.

23 months ago[MemoryBuiltins] Remove isFreeCall() function (NFC)
Nikita Popov [Thu, 21 Jul 2022 12:42:08 +0000 (14:42 +0200)]
[MemoryBuiltins] Remove isFreeCall() function (NFC)

Remove isFreeCall() in favor of getFreedOperand(). Replace the
two remaining uses with a getFreedOperand() != nullptr check, as
they only care that something is getting freed. (The usage in DSE
is correct as such. The allocator-related checks in CFLGraph look
rather questionable in general.)

23 months ago[InstCombine] Use getFreedOperand() (NFC)
Nikita Popov [Thu, 21 Jul 2022 12:33:55 +0000 (14:33 +0200)]
[InstCombine] Use getFreedOperand() (NFC)

Use getFreedOperand() instead of isFreeCall() to remove the
implicit assumption that any pointer operand to a free function
is the operand being freed. This won't actually matter until we
handle allockind(free).

23 months ago[Attributor] Use getFreedOperand() (NFC)
Nikita Popov [Thu, 21 Jul 2022 12:25:54 +0000 (14:25 +0200)]
[Attributor] Use getFreedOperand() (NFC)

Track which operand is actually freed, to avoid the implicit
assumption that it is the first call argument.

23 months ago[AMDGPU] Combine s_or_saveexec, s_xor instructions.
Thomas Symalla [Wed, 29 Jun 2022 17:58:08 +0000 (19:58 +0200)]
[AMDGPU] Combine s_or_saveexec, s_xor instructions.

This patch merges a consecutive sequence of

s_or_saveexec s_o, s_i
s_xor exec, exec, s_o

into a single

s_andn2_saveexec s_o, s_i instruction.
This patch also cleans up the SIOptimizeExecMasking pass a bit.

Reviewed By: nhaehnle

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

23 months ago[pseudo] Fix an invalid assertion on recoveryBrackets.
Haojian Wu [Thu, 21 Jul 2022 11:57:33 +0000 (13:57 +0200)]
[pseudo] Fix an invalid assertion on recoveryBrackets.

The `Begin` is not the index of the left bracket, `Begin-1` is,
otherwise the assertion will be triggered on case `Foo().call();`.

23 months agoRevert "[Flang] Generate documentation for compiler flags"
Andrzej Warzynski [Thu, 21 Jul 2022 11:54:49 +0000 (11:54 +0000)]
Revert "[Flang] Generate documentation for compiler flags"

This reverts commit 396e944d82f3e212746cd241e4caba445523aff6.

Failing bot: https://lab.llvm.org/buildbot/#/builders/89/builds/30096

23 months ago[Flang] Generate documentation for compiler flags
Dylan Fleming [Thu, 21 Jul 2022 11:11:48 +0000 (11:11 +0000)]
[Flang] Generate documentation for compiler flags

This patch aims to create a webpage to document
Flang's command line options on https://flang.llvm.org/docs/
in a similar way to Clang's
https://clang.llvm.org/docs/ClangCommandLineReference.html

This is done by using clang_tablegen to generate an .rst
file from Options.td (which is current shared with Clang)
For this to work, ClangOptionDocEmitter.cpp was updated
to allow specific Flang flags to be included,
rather than bulk excluding clang flags.

Reviewed By: awarzynski

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

23 months ago[Reland][DebugInfo][llvm-dwarfutil] Combine overlapped address ranges.
Alexey Lapshin [Tue, 19 Jul 2022 15:11:07 +0000 (18:11 +0300)]
[Reland][DebugInfo][llvm-dwarfutil] Combine overlapped address ranges.

DWARF files may contain overlapping address ranges. f.e. it can happen if the two
copies of the function have identical instruction sequences and they end up sharing.
That looks incorrect from the point of view of DWARF spec. Current implementation
of DWARFLinker does not combine overlapped address ranges. It would be good if such
ranges would be handled in some useful way. Thus, this patch allows DWARFLinker
to combine overlapped ranges in a single one.

Depends on D86539

Reviewed By: aprantl

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

23 months ago[AArch64][SVE] Add DAG-Combine to push bitcasts from floating point loads after DUPLA...
Matt Devereau [Mon, 18 Jul 2022 14:39:35 +0000 (14:39 +0000)]
[AArch64][SVE] Add DAG-Combine to push bitcasts from floating point loads after DUPLANE128

This patch lowers
  duplane128(insert_subvector(undef, bitcast(op(128bitsubvec)), 0), 0)
to
  bitcast(duplane128(insert_subvector(undef, op(128bitsubvec), 0), 0)).

This enables floating-point loads to match patterns added in
https://reviews.llvm.org/D130010

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

23 months ago[AArch64][SVE] Add ISel pattern to lower DUPLANE128 to LD1RQD
Matt Devereau [Tue, 12 Jul 2022 15:54:53 +0000 (15:54 +0000)]
[AArch64][SVE] Add ISel pattern to lower DUPLANE128 to LD1RQD

Following on from https://reviews.llvm.org/D128902, lower DUPLANE128 to LD1RQD
for integer load types from instruction selection.

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

23 months ago[AArch64] Add i128 parity test
Simon Pilgrim [Thu, 21 Jul 2022 10:46:27 +0000 (11:46 +0100)]
[AArch64] Add i128 parity test

AArch64 has custom i128 ctpop handling, so match this in the parity tests

Added as part of triaging Issue #56531

23 months ago[AMDGPU][GlobalISel] Fix subtarget checks for combining to v_med3_i16
Jay Foad [Thu, 21 Jul 2022 10:12:14 +0000 (11:12 +0100)]
[AMDGPU][GlobalISel] Fix subtarget checks for combining to v_med3_i16

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

23 months agoRevert "[DebugInfo][llvm-dwarfutil] Combine overlapped address ranges."
Alexey Lapshin [Thu, 21 Jul 2022 10:39:50 +0000 (13:39 +0300)]
Revert "[DebugInfo][llvm-dwarfutil] Combine overlapped address ranges."

This reverts commit d2a4d6bf9c52861f3d418bf7bb7d05f6e74dfead.

23 months ago[MemoryBuiltins] Add getFreedOperand() function (NFCI)
Nikita Popov [Thu, 21 Jul 2022 10:10:36 +0000 (12:10 +0200)]
[MemoryBuiltins] Add getFreedOperand() function (NFCI)

We currently assume in a number of places that free-like functions
free their first argument. This is true for all hardcoded free-like
functions, but with the new attribute-based design, the freed
argument is supposed to be indicated by the allocptr attribute.

To make sure we handle this correctly once allockind(free) is
respected, add a getFreedOperand() helper which returns the freed
argument, rather than just indicating whether the call frees *some*
argument.

This migrates most but not all users of isFreeCall() to the new
API. The remaining users are a bit more tricky.

23 months ago[DebugInfo][llvm-dwarfutil] Combine overlapped address ranges.
Alexey Lapshin [Tue, 19 Jul 2022 15:11:07 +0000 (18:11 +0300)]
[DebugInfo][llvm-dwarfutil] Combine overlapped address ranges.

DWARF files may contain overlapping address ranges. f.e. it can happen if the two
copies of the function have identical instruction sequences and they end up sharing.
That looks incorrect from the point of view of DWARF spec. Current implementation
of DWARFLinker does not combine overlapped address ranges. It would be good if such
ranges would be handled in some useful way. Thus, this patch allows DWARFLinker
to combine overlapped ranges in a single one.

Depends on D86539

Reviewed By: aprantl

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

23 months agotsan: remove unnecessary brackets
Dmitry Vyukov [Thu, 21 Jul 2022 09:44:48 +0000 (11:44 +0200)]
tsan: remove unnecessary brackets

Reviewed By: melver

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

23 months agoReapply [InstCombine] Don't check for alloc fn before fetching alloc size
Nikita Popov [Thu, 21 Jul 2022 08:05:48 +0000 (10:05 +0200)]
Reapply [InstCombine] Don't check for alloc fn before fetching alloc size

Reapply the patch with getObjectSize() replaced by getAllocSize().
The former will also look through calls that return their argument,
and we'll end up placing dereferenceable attributes on intrinsics
like llvm.launder.invariant.group. While this isn't wrong, it also
doesn't seem to be particularly useful. For now, use getAllocSize()
instead, which sticks closer to the original behavior of this code.

-----

This code is just interested in the allocsize, not any other
allocator properties.

23 months ago[MemoryBuiltins] Default to trivial mapper in getAllocSize() (NFC)
Nikita Popov [Thu, 21 Jul 2022 09:40:35 +0000 (11:40 +0200)]
[MemoryBuiltins] Default to trivial mapper in getAllocSize() (NFC)

Default getAllocSize() to use the trivial mapper. Also switch
from using std::function to function_ref.

Furthermore, update the doc comment to point out a subtle difference
between getAllocSize() and getObjectSize(): The latter may also
return something for calls that return their argument (via "returned"
attribute or special intrinsics like invariant groups).

23 months agorecommit "[DAGCombiner] Teach scalarizeBinOpOfSplats handle scalable splat."
jacquesguan [Thu, 7 Jul 2022 08:48:55 +0000 (16:48 +0800)]
recommit "[DAGCombiner] Teach scalarizeBinOpOfSplats handle scalable splat."

With fix for AArch64 and Hexgon test cases.

23 months ago[MemoryBuiltins] Don't query TLI for non-pointer functions (NFC)
Nikita Popov [Thu, 21 Jul 2022 08:46:50 +0000 (10:46 +0200)]
[MemoryBuiltins] Don't query TLI for non-pointer functions (NFC)

Fetching allocation data for calls is a rather hot operation, and
TLI lookups are slow. We can greatly reduce the number of calls
for which TLI is queried by checking that they return a pointer
value first, as this is a requirement for allocation functions
anyway.

23 months ago[C++20] [Modules] Avoid inifinite loop when iterating default args
Chuanqi Xu [Thu, 21 Jul 2022 09:19:11 +0000 (17:19 +0800)]
[C++20] [Modules] Avoid inifinite loop when iterating default args

Currently, clang may meet an infinite loop in a very tricky case when it
iterates the default args. This patch tries to fix this by adding a
`fixed` check.

23 months ago[flang][nfc] Add missing `REQUIRES: asserts` in tests
Andrzej Warzynski [Wed, 20 Jul 2022 17:00:50 +0000 (17:00 +0000)]
[flang][nfc] Add missing `REQUIRES: asserts` in tests

Tests that use `--mlir-pass-statistics-display=` from MLIR require the
following condition to hold: (extracted from LLVM's Statistics.h):
```
  #define LLVM_ENABLE_STATS 1
```
This is normally enforced with `REQUIRES: asserts`. This patch updates
relevant Flang tests accordingly.

For "Release" builds (with assertions disabled), the affected tests will
be failing without this change.

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

23 months ago[mlir][memref] Missing type conversion in memref.reshape llvm lowering
Ivan Butygin [Sun, 17 Jul 2022 16:47:22 +0000 (18:47 +0200)]
[mlir][memref] Missing type conversion in memref.reshape llvm lowering

Shape can be memref of index type, so memref::LoadOp result need to be converted into llvm type.

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

23 months agoRevert "[InstCombine] Don't check for alloc fn before fetching object size"
Nikita Popov [Thu, 21 Jul 2022 08:59:12 +0000 (10:59 +0200)]
Revert "[InstCombine] Don't check for alloc fn before fetching object size"

This reverts commit c72c22c04df992c95c5912d0075e5263c88f9fec.

This affected an Analysis test that I missed. Reverting for now.

23 months ago[InstCombine] Don't check for alloc fn before fetching object size
Nikita Popov [Thu, 21 Jul 2022 08:05:48 +0000 (10:05 +0200)]
[InstCombine] Don't check for alloc fn before fetching object size

This code is just interested in the allocsize, not any other
allocator properties.

23 months ago[PowerPC] Support x86 compatible intrinsics on AIX
Qiu Chaofan [Thu, 21 Jul 2022 08:33:41 +0000 (16:33 +0800)]
[PowerPC] Support x86 compatible intrinsics on AIX

These headers used to be guarded only on PowerPC64 Linux or FreeBSD, but
they can also be enabled for AIX OS target since it's big-endian ready.

Reviewed By: shchenz

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

23 months agoenable P10 vector builtins test on AIX 64 bit; NFC
Chen Zheng [Thu, 21 Jul 2022 08:21:12 +0000 (04:21 -0400)]
enable P10 vector builtins test on AIX 64 bit; NFC

Verify that P10 vector builtins with type `vector signed __int128`
and `vector unsigned __int128` work well on AIX 64 bit.

23 months agore-land [C++20][Modules] Update handling of implicit inlines [P1779R3]
Iain Sandoe [Sun, 3 Jul 2022 13:27:10 +0000 (14:27 +0100)]
re-land [C++20][Modules] Update handling of implicit inlines [P1779R3]

re-land fixes an unwanted interaction with module-map modules, seen in
Greendragon testing.

This provides updates to
[class.mfct]:
Pre C++20 [class.mfct]p2:
  A member function may be defined (8.4) in its class definition, in
  which case it is an inline member function (7.1.2)
Post C++20 [class.mfct]p1:
  If a member function is attached to the global module and is defined
  in its class definition, it is inline.

and
[class.friend]:
Pre-C++20 [class.friend]p5
  A function can be defined in a friend declaration of a
  class . . . . Such a function is implicitly inline.
Post C++20 [class.friend]p7
  Such a function is implicitly an inline function if it is attached
  to the global module.

We add the output of implicit-inline to the TextNodeDumper, and amend
a couple of existing tests to account for this, plus add tests for the
cases covered above.

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

23 months ago[MLIR][SCF] Enable better bufferization for `TileConsumerAndFuseProducersUsingSCFForOp`
lorenzo chelini [Thu, 21 Jul 2022 07:58:53 +0000 (09:58 +0200)]
[MLIR][SCF] Enable better bufferization for `TileConsumerAndFuseProducersUsingSCFForOp`

Replace iterators of the outermost loop with region arguments of the innermost
one. The changes avoid later `bufferization` passes to insert allocation within
the body of the innermost loop.

Reviewed By: mravishankar

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

23 months ago[pseudo] Make sure we rebuild pseudo_gen tool.
Haojian Wu [Thu, 21 Jul 2022 08:02:29 +0000 (10:02 +0200)]
[pseudo] Make sure we rebuild pseudo_gen tool.

23 months ago[lld-macho] Optimize rebase opcode generation
Daniel Bertalan [Wed, 20 Jul 2022 08:09:58 +0000 (10:09 +0200)]
[lld-macho] Optimize rebase opcode generation

This commit reduces the size of the emitted rebase sections by
generating the REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB and
REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB opcodes.

With this change, chromium_framework's rebase section is a 40% smaller
197 kilobytes, down from the previous 320 kB. That is 6 kB smaller than
what ld64 produces for the same input.

Performance figures from my M1 Mac mini:

x before
+ after

    N           Min           Max        Median           Avg        Stddev
x  10     4.2269349     4.3300061     4.2689675     4.2690016   0.031151669
+  10      4.219331     4.2914009     4.2398136     4.2448277   0.023817308
No difference proven at 95.0% confidence

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

23 months ago[CSKY] Fix the testcase error due to the verifyInstructionPredicates
Zi Xuan Wu (Zeson) [Thu, 21 Jul 2022 07:48:42 +0000 (15:48 +0800)]
[CSKY] Fix the testcase error due to the verifyInstructionPredicates

- Test cases for arch only has 16-bit instruction such as ck801/ck802 need
compile with -mattr=+btst16
- Fix the GPR copy instruction with MOV16 for 16-bit only arch.

23 months agoenable P10 vector builtins test on AIX 64 bit; NFC
Chen Zheng [Thu, 21 Jul 2022 07:48:31 +0000 (03:48 -0400)]
enable P10 vector builtins test on AIX 64 bit; NFC

Verify that P10 vector builtins with type `vector signed __int128`
and `vector unsigned __int128` work well on AIX 64 bit.

23 months agoRevert "[RFC][MLIR][SCF] Enable better bufferization for `TileConsumerAndFuseProducer...
lorenzo chelini [Thu, 21 Jul 2022 07:40:30 +0000 (09:40 +0200)]
Revert "[RFC][MLIR][SCF] Enable better bufferization for `TileConsumerAndFuseProducersUsingSCFForOp`"

This reverts commit 9e6585030533e901a8c24dcb05b38d3f0d10331f.

23 months ago[MemoryBuiltins] Avoid isAllocationFn() call before checking removable alloc
Nikita Popov [Thu, 21 Jul 2022 07:37:29 +0000 (09:37 +0200)]
[MemoryBuiltins] Avoid isAllocationFn() call before checking removable alloc

Alloc directly checking whether a given call is a removable
allocation, instead of first checking whether it is an allocation
first.

23 months ago[sanitizer_common] Support Solaris < 11.4 in GetStaticTlsBoundary
Rainer Orth [Thu, 21 Jul 2022 07:18:10 +0000 (09:18 +0200)]
[sanitizer_common] Support Solaris < 11.4 in GetStaticTlsBoundary

This patch, on top of D120048 <https://reviews.llvm.org/D120048>, supports
GetTls on Solaris 11.3 and Illumos that lack `dlpi_tls_modid`.  It's the
same method originally used in D91605 <https://reviews.llvm.org/D91605>,
but integrated into `GetStaticTlsBoundary`.

Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and
`x86_64-pc-linux-gnu`.

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

23 months ago[SelectionDAG] Fix fptoi.sat scalable vector lowering
David Green [Thu, 21 Jul 2022 07:00:22 +0000 (08:00 +0100)]
[SelectionDAG] Fix fptoi.sat scalable vector lowering

Vector fptosi_sat and fptoui_sat were being expanded by unrolling the
vector operation. This doesn't work for scalable vector, so this patch
adds a call to TLI.expandFP_TO_INT_SAT if the vector is scalable.

Scalable tests are added for AArch64 and RISCV. Some of the AArch64
fptoi_sat operations should be legal, but that will be handled in
another patch.

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

23 months ago[RFC][MLIR][SCF] Enable better bufferization for `TileConsumerAndFuseProducersUsingSC...
lorenzo chelini [Tue, 19 Jul 2022 13:25:03 +0000 (15:25 +0200)]
[RFC][MLIR][SCF] Enable better bufferization for `TileConsumerAndFuseProducersUsingSCFForOp`

Replace iterators of the outermost loop with region arguments of the innermost
one. The changes avoid later `bufferization` passes to insert allocation within
the body of the innermost loop.

Reviewed By: mravishankar

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

23 months ago[X86] Add test case for shuffle
Luo, Yuanke [Thu, 21 Jul 2022 06:41:34 +0000 (14:41 +0800)]
[X86] Add test case for shuffle

23 months ago[LoopCacheAnalysis] Fix a type mismatch problem in cost calculation
Congzhe Cao [Thu, 21 Jul 2022 05:35:58 +0000 (01:35 -0400)]
[LoopCacheAnalysis] Fix a type mismatch problem in cost calculation

There is a problem in loop cache analysis that the types of SCEV variables
`Coeff` and `ElemSize` in function `isConsecutive()` may not match. The
mismatch would cause SCEV failures when `Coeff` is multiplied with `ElemSize`.

The fix in this patch is to extend the type of both `Coeff` and `ElemSize` to
whichever is wider in those two variables. As a clean-up, duplicate calculations
of `Stride` in `computeRefCost()` is then removed.

Reviewed By: Meinersbur, #loopoptwg

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

23 months ago[clang][OpenMP] Add IRBuilder support for taskgroup
Shraiysh Vaishay [Thu, 21 Jul 2022 04:58:12 +0000 (10:28 +0530)]
[clang][OpenMP] Add IRBuilder support for taskgroup

This patch makes use of OMPIRBuilder support for codegen of taskgroup
construct in clang.

Depends on D128203

Reviewed By: Meinersbur

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

23 months ago[RISCV] Combine (select_cc (srl (and X, 1<<C), C), 0, eq/ne, true, fale)
Craig Topper [Thu, 21 Jul 2022 05:18:25 +0000 (22:18 -0700)]
[RISCV] Combine (select_cc (srl (and X, 1<<C), C), 0, eq/ne, true, fale)

(srl (and X, 1<<C), C) is the form we receive for testing bit C.
An earlier combine removed the setcc so it wasn't there to match
when we created the SELECT_CC. This doesn't happen for BR_CC because
generic DAG combine rebuilds the setcc if it is used by BRCOND.

We can shift X left by XLen-1-C to put the bit to be tested in the
MSB, and use a signed compare with 0 to test the MSB.

23 months ago[sanitizer] Use consistent checks for XDR
Ian Anderson [Tue, 19 Jul 2022 05:52:09 +0000 (22:52 -0700)]
[sanitizer] Use consistent checks for XDR

sanitizer_platform_limits_posix.h defines `__sanitizer_XDR ` if `SANITIZER_LINUX && !SANITIZER_ANDROID`, but sanitizer_platform_limits_posix.cpp tries to check it if `HAVE_RPC_XDR_H`. This coincidentally works because macOS has a broken <rpc/xdr.h> which causes `HAVE_RPC_XDR_H` to be 0, but if <rpc/xdr.h> is fixed then clang fails to compile on macOS. Restore the platform checks so that <rpc/xdr.h> can be fixed on macOS.

Reviewed By: vitalybuka

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

23 months ago[AIX] follow-up of D124654.
esmeyi [Thu, 21 Jul 2022 05:10:09 +0000 (01:10 -0400)]
[AIX] follow-up of D124654.
Emitting the remaining aliases instead of reporting
an error to avoid SPEC2017 PEAK failures.
And mark this as a TODO.

23 months ago[mlir][Linalg] Deprecate `tileAndFuseLinalgOps` method and associated patterns.
Mahesh Ravishankar [Fri, 15 Jul 2022 20:11:23 +0000 (20:11 +0000)]
[mlir][Linalg] Deprecate `tileAndFuseLinalgOps` method and associated patterns.

The `tileAndFuseLinalgOps` is a legacy approach for tiling + fusion of
Linalg operations. Since it was also intended to work on operations
with buffer operands, this method had fairly complex logic to make
sure tile and fuse was correct even with side-effecting linalg ops.
While complex, it still wasnt robust enough. This patch deprecates
this method and thereby deprecating the tiling + fusion method for ops
with buffer semantics. Note that the core transformation to do fusion
of a producer with a tiled consumer still exists. The deprecation here
only removes methods that auto-magically tried to tile and fuse
correctly in presence of side-effects.

The `tileAndFuseLinalgOps` also works with operations with tensor
semantics. There are at least two other ways the same functionality
exists.
1) The `tileConsumerAndFuseProducers` method. This does a similar
   transformation, but using a slightly different logic to
   automatically figure out the legal tile + fuse code. Note that this
   is also to be deprecated soon.
2) The prefered way uses the `TilingInterface` for tile + fuse, and
   relies on the caller to set the tiling options correctly to ensure
   that the generated code is correct.
As proof that (2) is equivalent to the functionality provided by
`tileAndFuseLinalgOps`, relevant tests have been moved to use the
interface, where the test driver sets the tile sizes appropriately to
generate the expected code.

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

23 months ago[clang-format][NFC] Refactor RequiresDoesNotChangeParsingOfTheRest
owenca [Tue, 19 Jul 2022 08:22:31 +0000 (01:22 -0700)]
[clang-format][NFC] Refactor RequiresDoesNotChangeParsingOfTheRest

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

23 months ago[clang-format] Indent tokens after hash only if it starts a line
owenca [Wed, 20 Jul 2022 01:11:31 +0000 (18:11 -0700)]
[clang-format] Indent tokens after hash only if it starts a line

Fixes #56602.

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

23 months ago[RISCV] Refactor the common combines for SELECT_CC and BR_CC into a helper function.
Craig Topper [Thu, 21 Jul 2022 04:07:07 +0000 (21:07 -0700)]
[RISCV] Refactor the common combines for SELECT_CC and BR_CC into a helper function.

The only difference between the combines were the calls to getNode
that include the true/false values for SELECT_CC or the chain
and branch target for BR_CC.

Wrap the rest of the code into a helper that reads LHS, RHS, and
CC and outputs new values and a bool if a new node needs to be
created.

23 months agoPort address sanitizer to LoongArch
Xi Ruoyao [Thu, 21 Jul 2022 02:33:11 +0000 (10:33 +0800)]
Port address sanitizer to LoongArch

Depends on D129371.

It survived all GCC ASan tests.

Changes are trivial and mostly "borrowed" RISC-V logics, except that a different SHADOW_OFFSET is used.

Reviewed By: SixWeining, MaskRay, XiaodongLoong

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

23 months ago[mlir][Math] Add constant folder for LogOp.
jacquesguan [Wed, 20 Jul 2022 06:47:25 +0000 (14:47 +0800)]
[mlir][Math] Add constant folder for LogOp.

This patch adds constant folder for LogOp which only supports single and double precision floating-point.

Reviewed By: ftynse

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

23 months ago[InstCombine] (ShiftValC >> Y) >s -1/<s 0 --> Y != 0/==0
Chenbing Zheng [Thu, 21 Jul 2022 02:12:29 +0000 (10:12 +0800)]
[InstCombine] (ShiftValC >> Y) >s -1/<s 0 --> Y != 0/==0

We can do folds (ShiftValC >> Y) >s -1 --> Y != 0 and
(ShiftValC >> Y) <s 0 --> Y == 0, with ShiftValC < 0.

Alive2: https://alive2.llvm.org/ce/z/-PRHfD

Reviewed By: spatel

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

23 months ago[InstCombine] add fold (X > C - 1) ^ (X < C + 1) --> X != C
Chenbing Zheng [Thu, 21 Jul 2022 01:54:43 +0000 (09:54 +0800)]
[InstCombine] add fold (X > C - 1) ^ (X < C + 1) --> X != C

Considering the correctness of this pattern, we should avoid that C - 1
is non-negative and C + 1 is negative.

Alive2: https://alive2.llvm.org/ce/z/c_rBaq

Reviewed By: spatel

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

23 months ago[NFC][asan] Clang-format a code
Vitaly Buka [Thu, 21 Jul 2022 01:56:02 +0000 (18:56 -0700)]
[NFC][asan] Clang-format a code

23 months ago[NFC][memprof] Remove unused code
Vitaly Buka [Thu, 21 Jul 2022 01:09:24 +0000 (18:09 -0700)]
[NFC][memprof] Remove unused code

23 months ago[NFC][asan] Use RoundDownTo
Vitaly Buka [Wed, 20 Jul 2022 21:40:10 +0000 (14:40 -0700)]
[NFC][asan] Use RoundDownTo

23 months ago[RISCV] Optimize (brcond (seteq (and X, 1 << C), 0))
Craig Topper [Thu, 21 Jul 2022 01:11:19 +0000 (18:11 -0700)]
[RISCV] Optimize (brcond (seteq (and X, 1 << C), 0))

If C > 10, this will require a constant to be materialized for the
And. To avoid this, we can shift X left by XLen-1-C bits to put the
tested bit in the MSB, then we can do a signed compare with 0 to
determine if the MSB is 0 or 1. Thanks to @reames for the suggestion.

I've implemented this inside of translateSetCCForBranch which is
called when setcc+brcond or setcc+select is converted to br_cc or
select_cc during lowering. It doesn't make sense to do this for
general setcc since we lack a sgez instruction.

I've tested bit 10, 11, 31, 32, 63 and a couple bits betwen 11 and 31
and between 32 and 63 for both i32 and i64 where applicable. Select
has some deficiencies where we receive (and (srl X, C), 1) instead.
This doesn't happen for br_cc due to the call to rebuildSetCC in the
generic DAGCombiner for brcond. I'll explore improving select in a
future patch.

Reviewed By: reames

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

23 months ago[libc++] Fix proxy iterator issues that trigger an assertion in Chromium.
Hui Xie [Thu, 21 Jul 2022 00:03:29 +0000 (17:03 -0700)]
[libc++] Fix proxy iterator issues that trigger an assertion in Chromium.

Crash report:
https://bugs.chromium.org/p/chromium/issues/detail?id=1346012

The triggered assertion is related sorting with `v8::internal::AtomicSlot`.
`AtomicSlot` is a proxy iterator with a proxy type `AtomicSlot::Reference`
(see https://chromium.googlesource.com/v8/v8/+/9bcb5eb590643db0c1f688fea316c7f1f4786a3c/src/objects/slots-atomic-inl.h).

https://reviews.llvm.org/D130197 correctly spotted the issue in
`__iter_move` but doesn't actually fix the issue. The reason is that
`AtomicSlot::operator*` returns a prvalue `Reference`. After the fix in
D130197, the return type of `__iter_move` is `Reference&&`. But the
rvalue reference is bound to the temporary value returned by
`operator*`, which will be dangling after `__iter_move` returns.

The idea of the fix in this change is borrowed from C++17's move_iterator
https://timsong-cpp.github.io/cppwp/n4659/move.iterators#move.iterator-1
When the underlying reference is a prvalue, we just return it by value.

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

23 months ago[gn build] Port 4fcf8434dd77
LLVM GN Syncbot [Thu, 21 Jul 2022 00:53:15 +0000 (00:53 +0000)]
[gn build] Port 4fcf8434dd77

23 months ago[ORC] Add a new MemoryMapper-based JITLinkMemoryManager implementation.
Anubhab Ghosh [Thu, 21 Jul 2022 00:32:56 +0000 (17:32 -0700)]
[ORC] Add a new MemoryMapper-based JITLinkMemoryManager implementation.

MapperJITLinkMemoryManager supports executor memory management using any
implementation of MemoryMapper to do the transfer such as InProcessMapper or
SharedMemoryMapper.

Reviewed By: lhames

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

23 months agoRevert "[flang] Run algebraic simplification optimization pass."
Slava Zakharin [Wed, 20 Jul 2022 23:56:28 +0000 (16:56 -0700)]
Revert "[flang] Run algebraic simplification optimization pass."

This reverts commit 4fbd1d6c872e8228f23a6e13914222af40ca6461.

23 months ago[ORC] Don't try to copy from an empty segment in SimpleExecutorMemoryManager.
Lang Hames [Wed, 20 Jul 2022 22:38:34 +0000 (15:38 -0700)]
[ORC] Don't try to copy from an empty segment in SimpleExecutorMemoryManager.

Since 67220c2ad72e empty SPSSequence<char>s deserialize to default-constructed
ArrayRef<char>s, which have a null data field. We need to check for this to
avoid memcpy'ing from a nullptr.

This should fix the bot failure in
https://lab.llvm.org/buildbot/#/builders/85/builds/9323

23 months ago[Darwin toolchain] Tune the logic for finding arclite.
Steven Wu [Wed, 20 Jul 2022 23:45:09 +0000 (16:45 -0700)]
[Darwin toolchain] Tune the logic for finding arclite.

The heuristic used to determine where the arclite libraries are to be
found was based on the path of the `clang` executable. However, in some
scenarios the `clang` executable is within a toolchain that does not
have arclite. When this happens, derive the arclite paths from the
sysroot option.

This allows Clang to correctly derive the arclite directory in, e.g.,
Swift CI, using similar logic to what the Swift driver has been doing
for several years.

Patched by Doug Gregor.

Reviewed By: keith

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

23 months ago[flang] Run algebraic simplification optimization pass.
Slava Zakharin [Thu, 14 Jul 2022 23:50:41 +0000 (16:50 -0700)]
[flang] Run algebraic simplification optimization pass.

Flang algebraic simplification pass will run algebraic simplification
rewrite patterns for Math/Complex/etc. dialects. It is enabled
under opt-for-speed optimization levels (i.e. for O1/O2/O3; Os/Oz will not
enable it).

With this change the FIR/MLIR optimization pipeline becomes affected
by the -O* optimization level switches. Until now these switches
only affected the middle-end and back-end.

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

2 years ago[mlir:LSP] Add a quickfix code action for inserting expected-* diagnostic checks
River Riddle [Wed, 20 Jul 2022 08:43:07 +0000 (01:43 -0700)]
[mlir:LSP] Add a quickfix code action for inserting expected-* diagnostic checks

This allows for automatically inserting expected checks for parser and verifier
diagnostics, which simplifies the workflow when building new dialect
constructs or extending existing ones.

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

2 years ago[Attributor] Deal with complex PHI nodes better during AAPointerInfo
Johannes Doerfert [Sun, 10 Jul 2022 18:49:36 +0000 (13:49 -0500)]
[Attributor] Deal with complex PHI nodes better during AAPointerInfo

We were quite conservative when it came to PHI node handling to avoid
recursive reasoning. Now we check more direct if we have seen a PHI
already or not. This allows non-recursive PHI chains to be handled.

This also exposed a bug as we did only model the effect of one loop
traversal. `phi_no_store_3` has been adapted to show how we would have
used `undef` instead of `1` before. With this patch we don't replace
it at all, which is expected as we do not argue about loop iterations
(or alignments).

2 years ago[Attributor] Only non-exact accesses require a uniform bit-pattern (=0)
Johannes Doerfert [Sun, 10 Jul 2022 18:46:42 +0000 (13:46 -0500)]
[Attributor] Only non-exact accesses require a uniform bit-pattern (=0)

If we only have exact accesses we should never require the bit-pattern
to be uniform (in this case 0). Only a non-exact access should force us
to require only 0 values.

2 years ago[GlobalOpt] Enable evaluation of atomic stores
Alexander Shaposhnikov [Wed, 20 Jul 2022 22:29:03 +0000 (22:29 +0000)]
[GlobalOpt] Enable evaluation of atomic stores

Relax the check to allow evaluation of atomic stores
(but still skip volatile stores).

Test plan:
1/ ninja check-llvm check-clang
2/ Bootstrapped LLVM/Clang pass tests

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

2 years ago[MemProf] Basic metadata support and verification
Teresa Johnson [Mon, 6 Jun 2022 13:57:36 +0000 (06:57 -0700)]
[MemProf] Basic metadata support and verification

Add basic support for the MemProf metadata (!memprof and !callsite)
which was initially described in "RFC: IR metadata format for MemProf"
(https://discourse.llvm.org/t/rfc-ir-metadata-format-for-memprof/59165).

The bulk of the patch is verification support, along with some tests.

There are a couple of changes to the format described in the original
RFC:

Initial measurements suggested that a tree format for the stack ids in
the contexts would be more efficient, but subsequent evaluation with
large applications showed that in fact the cost of the additional
metadata nodes required by this deduplication scheme overwhelmed the
benefit from sharing stack id nodes. Therefore, the implementation here
and in follow on patches utilizes a simpler scheme of lists of stack id
integers in the memprof profile contexts and callsite metadata. The
follow on matching patch employs context trimming optimizations to
reduce the cost.

Secondly, instead of verbosely listing all profiled fields in each
profiled context (memory info block or MIB), and deferring the
interpretation of the profile data, the profile data is evaluated and
converted into string tags specifying the behavior (e.g. "cold") during
profile matching. This reduces the verbosity of the profile metadata,
and allows additional context trimming optimizations. As a result, the
named metadata schema description is also no longer needed.

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

2 years ago[ThinLTO] Support aliased GlobalIFunc
Schrodinger ZHU Yifan [Wed, 20 Jul 2022 22:30:38 +0000 (15:30 -0700)]
[ThinLTO] Support aliased GlobalIFunc

Fixes https://github.com/llvm/llvm-project/issues/56290: when an ifunc is
aliased in LTO, clang will attempt to create an alias summary; however, as ifunc
is not included in the module summary, doing so will lead to crash.

Reviewed By: MaskRay

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

2 years agollvm-reduce: Fix register mask test
Matt Arsenault [Wed, 20 Jul 2022 20:52:07 +0000 (16:52 -0400)]
llvm-reduce: Fix register mask test

This was sometimes failing with "input module no longer interesting
after counting chunks" assert.