platform/upstream/llvm.git
21 months agoCheck whether the allocated type is an array type before calling
Akira Hatanaka [Mon, 26 Sep 2022 21:19:53 +0000 (14:19 -0700)]
Check whether the allocated type is an array type before calling
checkArrayElementAlignment in Sema::BuildCXXNew

This commit fixes a bug that was introduced by adaf62ced and reported
here: https://reviews.llvm.org/D133711#3814717

21 months ago[ELF] Rewrite R_RISCV_ALIGN nops when r.addend%4 != 0
Fangrui Song [Mon, 26 Sep 2022 21:20:27 +0000 (14:20 -0700)]
[ELF] Rewrite R_RISCV_ALIGN nops when r.addend%4 != 0

For RVC, GNU assembler and LLVM integrated assembler add c.nop followed by a
sequence of 4-byte nops. Even if remove % 4 == 0, we have to split one 4-byte
nop and therefore need to write the code sequence, otherwise we create an
incorrect c.unimp.

21 months ago[LoopDeletion] Regenerate check lines for test added in f076a7097999d.
Florian Hahn [Mon, 26 Sep 2022 21:11:32 +0000 (22:11 +0100)]
[LoopDeletion] Regenerate check lines for test added in f076a7097999d.

21 months ago[LoopDeletion] Add cache verification failure test case.
Florian Hahn [Mon, 26 Sep 2022 20:59:40 +0000 (21:59 +0100)]
[LoopDeletion] Add cache verification failure test case.

Extra test coverage for D134613.

21 months ago[Matrix] Add tests for addition transpose optimizations
Francis Visoiu Mistrih [Sun, 11 Sep 2022 05:13:41 +0000 (22:13 -0700)]
[Matrix] Add tests for addition transpose optimizations

Tests before transpose optimizations around additions.

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

21 months ago[AMDGPU] Move SIModeRegisterDefaults to SI MFI
Stanislav Mekhanoshin [Mon, 26 Sep 2022 19:40:22 +0000 (12:40 -0700)]
[AMDGPU] Move SIModeRegisterDefaults to SI MFI

It does not belong to a general AMDGPU MFI.

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

21 months agoRevert "[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)"
Lorenzo Chelini [Mon, 26 Sep 2022 20:11:40 +0000 (22:11 +0200)]
Revert "[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)"

It introduces a circular build dependence: DialectUtils <-
ArithmeticUtils <- ArithDialect <- DialectUtils

This reverts commit 27224fe7272a791bcc9f28c997ce322f7d3856cd.

21 months ago[InstCombine] add assert/test for zext to i1
Sanjay Patel [Mon, 26 Sep 2022 19:59:16 +0000 (15:59 -0400)]
[InstCombine] add assert/test for zext to i1

This is a test to verify that we do not crash with the
problem noted in issue #57986. The root problem should
be fixed with a prior change to InstSimplify.

21 months ago[InstSimplify] don't commute constant expression operand in min/max calls
Sanjay Patel [Mon, 26 Sep 2022 19:15:20 +0000 (15:15 -0400)]
[InstSimplify] don't commute constant expression operand in min/max calls

The test shows that we would fail to consistently fold the
instruction based on the max value operand. This is also
the root cause for issue #57986, but I'll add an instcombine
test + assert for that exact problem in another commit.

21 months ago[InstSimplify] add tests for max intrinsic with constant expression; NFC
Sanjay Patel [Mon, 26 Sep 2022 19:11:30 +0000 (15:11 -0400)]
[InstSimplify] add tests for max intrinsic with constant expression; NFC

This shows the root problem that leads to the crash in issue #57986.

21 months ago[clang][deps] Fix test on AIX
Jan Svoboda [Mon, 26 Sep 2022 19:40:01 +0000 (12:40 -0700)]
[clang][deps] Fix test on AIX

The "-fno-integrated-as" on AIX expands the driver invocation into multiple jobs. This patch makes new test accommodates for that.

21 months ago[Hexagon] Avoid some unnecessary sign-extend instructions
Krzysztof Parzyszek [Mon, 26 Sep 2022 19:27:56 +0000 (12:27 -0700)]
[Hexagon] Avoid some unnecessary sign-extend instructions

Simplify (sext_inreg (extractu ...)) -> (extract ...) where appropriate.

21 months ago[mlir][TilingInterface] Fix `iter_args` handling in tile (and fuse).
Mahesh Ravishankar [Thu, 22 Sep 2022 06:01:45 +0000 (06:01 +0000)]
[mlir][TilingInterface] Fix `iter_args` handling in tile (and fuse).

The current approach for handling `iter_args` was to replace all uses
of the value that is used as `init` value with the corresponding
region block argument within the `scf.for`. This is not always
correct. Instead a more deliberate approach needs to be taken to
handle these. If the slice being fused represents a slice of the
destination operand of the untiled op, then
- Make the destination of the fused producer the `init` value of the
  loop nest
- For the tiled and fused producer op created, replace the slice of
  the destination operand with a slice of the corresponding region
  iter arg of the innermost loop of the generated loop nest

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

21 months ago[InstSimplify] rearrange matching for select-of-min/max folds; NFC
Sanjay Patel [Mon, 26 Sep 2022 16:47:05 +0000 (12:47 -0400)]
[InstSimplify] rearrange matching for select-of-min/max folds; NFC

This makes the code a little shorter and should be easier to extend
for a pattern like in issue #42100.

21 months ago[InstSimplify] remove redundant predicate check; NFC
Sanjay Patel [Mon, 26 Sep 2022 14:37:23 +0000 (10:37 -0400)]
[InstSimplify] remove redundant predicate check; NFC

It's still possible that there's a simpler way to specify
the conditions needed for this set of folds, but "getStrictPred"
converts >= to > for example, so there's no need to explicitly
check that.

21 months ago[lldb][test] 2 - Add gmodules test category explicitly where previously done implicitly
Michael Buch [Fri, 23 Sep 2022 22:39:01 +0000 (00:39 +0200)]
[lldb][test] 2 - Add gmodules test category explicitly where previously done implicitly

Since we don't compile with `gmodules` implicitly via
debug-info test replication, we should mark all implicit
`gmodules` tests with the appropriate category so the API
tests get actually run as intended.

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

21 months ago[lldb][test] 1 - Don't do test-replication for gmodules debug_info variant
Michael Buch [Fri, 23 Sep 2022 09:39:43 +0000 (11:39 +0200)]
[lldb][test] 1 - Don't do test-replication for gmodules debug_info variant

Currently, by default LLDB runs an API test with 3 variants,
one of which, depending on platform, is `gmodules`. However,
most tests don't actually make use of any specific `gmodules`
feature since they compile a single `main.cpp` file without
imporint types from other modules.

Instead of running all tests an extra time with `-gmodules`
enabled, we plan to test `gmodules` features with dedicated
API tests that explicitly opt-into compiling with `-gmodules`.
One of the main benefits of this will be a reduction in total
API test-suite run-time (by around 1/3).

This patch adds a flag to `debug_info_categories` that indicates
whether a category is eligible to be replicated by `lldbtest`.

Keeping `gmodules` a debug-info category is desirable because
`builder.py` knows how to inject the appropriate Makefile flags
into the build command for debug-info categories already. Whereas
for non-debug-info categories we'd have to teach it how to. The
category is inferred from the test-name debug-info suffix currently.

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

21 months ago[mlir][spirv] Format a define. NFC.
Jakub Kuderski [Mon, 26 Sep 2022 18:53:21 +0000 (14:53 -0400)]
[mlir][spirv] Format a define. NFC.

21 months agoGuardWidening: Pass through AssumptionCache (NFC)
Matt Arsenault [Mon, 19 Sep 2022 20:53:47 +0000 (16:53 -0400)]
GuardWidening: Pass through AssumptionCache (NFC)

21 months agoLoopPeel: Pass through AssumptionCache (NFC)
Matt Arsenault [Mon, 19 Sep 2022 21:50:00 +0000 (17:50 -0400)]
LoopPeel: Pass through AssumptionCache (NFC)

21 months agoLoopUnroll: Pass through AssumptionCache (NFC)
Matt Arsenault [Mon, 19 Sep 2022 21:50:22 +0000 (17:50 -0400)]
LoopUnroll: Pass through AssumptionCache (NFC)

Using these queries with a context instruction and without a cache
seems to be about 2x slower than with it so this theoretically
improves compile time.

21 months agoReland "[mlir][spirv] Change td def/class prefix from SPV to SPIRV"
Jakub Kuderski [Mon, 26 Sep 2022 17:53:58 +0000 (13:53 -0400)]
Reland "[mlir][spirv] Change td def/class prefix from SPV to SPIRV"

This reverts commit ce82530cd03d884a2c9fa48e1f9eb931064b2553.

Undo accidental Vulkan/SPIR-V name changes.
Tested with `ninja check-mlir check-mlir-mlir-spirv-cpu-runner check-mlir-mlir-vulkan-runner`.

21 months ago[mlir][vector] Handle subview correctly in sotre to load opt on memref
Thomas Raoux [Fri, 23 Sep 2022 23:00:18 +0000 (23:00 +0000)]
[mlir][vector] Handle subview correctly in sotre to load opt on memref

Make sure we consider other subviews of the same buffer when doing store
to load forwarding or dead store elimination.

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

21 months ago[lldb] Fix completion of 'settings set' values
Dave Lee [Fri, 23 Sep 2022 04:03:31 +0000 (21:03 -0700)]
[lldb] Fix completion of 'settings set' values

Some time ago, a refactor (1153dc960) broke completion for assigning settings
values (`settings set`). This was most annoying for enum settings, where you'd
have to get the valid enum names separately.

This restores the logic in the post-refactor completion function, as well as
adding a test to catch future regressions.

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

21 months ago[Hexagon] Make sure we can still shift scalar vectors by non-splats
Krzysztof Parzyszek [Mon, 26 Sep 2022 18:13:41 +0000 (11:13 -0700)]
[Hexagon] Make sure we can still shift scalar vectors by non-splats

21 months ago[mlir] Relax transfer op hoisting on tensor
Thomas Raoux [Mon, 26 Sep 2022 05:22:06 +0000 (05:22 +0000)]
[mlir] Relax transfer op hoisting on tensor

Improve hoisting logic to support cases where the read being hoisted
comes from a transfer_write with disjoint indices.

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

21 months ago[JITLink] Remove overly-restrictive visibility check introduced in 75404e9ef88.
Lang Hames [Mon, 26 Sep 2022 14:31:07 +0000 (07:31 -0700)]
[JITLink] Remove overly-restrictive visibility check introduced in 75404e9ef88.

ELF undefined symbols can have non-default visibility.

21 months ago[LegalizeTypes][RISCV] Support f16 in ExpandIntRes_LLROUND_LLRINT.
Craig Topper [Mon, 26 Sep 2022 18:09:31 +0000 (11:09 -0700)]
[LegalizeTypes][RISCV] Support f16 in ExpandIntRes_LLROUND_LLRINT.

Promote f16 to f32 and use the f32 libcall.

I deleted rv64zfh-half-intrinsics-strict.ll because it only existed due to this issue breaking rv32.

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

21 months ago[clang][modules] Over-align the `Module` class
Jan Svoboda [Mon, 26 Sep 2022 16:40:02 +0000 (09:40 -0700)]
[clang][modules] Over-align the `Module` class

This makes `llvm::PointerIntPair<Module *, 3>` from f35230ae work across platforms.

Reviewed By: srj

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

21 months ago[lldb] Skip tests incompatible with older versions of Clang
Felipe de Azevedo Piovezan [Mon, 26 Sep 2022 14:16:53 +0000 (10:16 -0400)]
[lldb] Skip tests incompatible with older versions of Clang

The coroutine tests require a standard library implementation of
coroutines, which was only made available some time _after_ Clang 13.
The first such Clang tested by the LLDB matrix bot is 15.0.1

The TestObjCExceptions test forces the use of the system's libcxx. For
the lldb matrix bot, the first Clang version compatible with the bot's
libraries is 13.0.

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

21 months ago[MLIR] Add doc for Attribute print `elideType` (NFC)
Jeff Niu [Mon, 26 Sep 2022 17:21:09 +0000 (10:21 -0700)]
[MLIR] Add doc for Attribute print `elideType` (NFC)

21 months ago[mlir] Allow accessing TypeID of attrs/types defs
Mathieu Fehr [Mon, 26 Sep 2022 16:42:33 +0000 (09:42 -0700)]
[mlir] Allow accessing TypeID of attrs/types defs

SelfOwningTypeID was inherited privately, so it was not possible to access
the TypeID of an attribute or a type definition.

Reviewed By: Mogball

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

21 months ago[clang] initialize type qualifiers for FunctionNoProtoType
Richard Howell [Fri, 9 Sep 2022 16:58:18 +0000 (09:58 -0700)]
[clang] initialize type qualifiers for FunctionNoProtoType

When initializing FunctionNoProtoType types, zero out the type
qualifiers. This will ensure the ODR hash remains stable as it
hashes the values for these qualifiers for all function types.

Reviewed By: aaron.ballman

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

21 months agoRevert "[mlir][spirv] Change td def/class prefix from SPV to SPIRV"
Jakub Kuderski [Mon, 26 Sep 2022 16:40:35 +0000 (12:40 -0400)]
Revert "[mlir][spirv] Change td def/class prefix from SPV to SPIRV"

This reverts commit a2052b8794cb5abac131cd62f68505eebcfaffcb.

This commit renamed some Vulkan identifiers that shouldn't have been
renamed, e.g., `SPV_KHR_storage_buffer_storage_class`.

21 months agoAMDGPU: Handle new address pattern in LowerKernelAttributes introduced by opaque...
Changpeng Fang [Mon, 26 Sep 2022 16:31:52 +0000 (09:31 -0700)]
AMDGPU: Handle new address pattern in LowerKernelAttributes introduced by opaque pointers

Summary:
  With opaque pointer support, the "ptr" type is introduced and thus BitCast is not necessary in some cases.
This work takes care of this change, and recognizes the new address patterns to do appropriate optimizations.

Reviewers:
  arsenm

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

21 months ago[flang] Lower F08 bitwise-reduction intrinsics (IALL, IANY, IPARITY)
Tarun Prabhu [Mon, 26 Sep 2022 16:14:17 +0000 (10:14 -0600)]
[flang] Lower F08 bitwise-reduction intrinsics (IALL, IANY, IPARITY)

This calls the corresponding runtime functions when appropriate. The implementation
follows the pattern of the SUM and PRODUCT intrinsics.

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

21 months ago[mlir][MemRef] Simplify extract_strided_metadata(allocLikeOp)
Quentin Colombet [Sat, 24 Sep 2022 00:02:06 +0000 (00:02 +0000)]
[mlir][MemRef] Simplify extract_strided_metadata(allocLikeOp)

Teach the pass that simplifies extract_strided_metadata(other_op(memref))
how to get rid of extract_strided_metadata when they are fed by
allocLikeOp.

For the simplification to happen the allocLikeOp needs to have been
normalized. I.e., no weird offset and strides.

When this is the case, we replace:
```
base, offset, sizes, strides =
    extract_strided_metadata(allocLikeOp(allocSizes))
```

With
```
base = reinterpret_cast allocLikeOp(allocSizes) to a flat memref<eltTy>
offset = 0
sizes = allocSizes
strides#i = prod(allocSizes#j, for j in {i+1..rank-1})
```

The computation involving dynamic sizes are expanded in affine.apply.

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

21 months ago[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)
Lorenzo Chelini [Mon, 26 Sep 2022 08:39:46 +0000 (10:39 +0200)]
[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)

The utility function should live in `StaticValueUtils.h` as it provides
a convenient way to convert a vector of OpFoldResults into a vector of
Values.

Reviewed By: nicolasvasilache

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

21 months ago[LLD][COFF] Generate map file even if no /out flag is present
Pengxuan Zheng [Fri, 23 Sep 2022 19:39:34 +0000 (12:39 -0700)]
[LLD][COFF] Generate map file even if no /out flag is present

Currently LLD does not generate a map file if no /out flag (e.g., /out:a.exe) is
present. This is because LLD derives the map file's name from the default output
file name is no output file name is specified explicitly on the command
line. However, in this case, the default output file name has not been set by
LLD yet when LLD tries to set the name of the map file. This patch fixes this
corner case by moving the logic handling map file flags to a place after the
default output file name is set.

Reviewed By: thakis

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

21 months ago[xmm] Remove duplicate #define
Nathan Sidwell [Fri, 23 Sep 2022 15:33:17 +0000 (08:33 -0700)]
[xmm] Remove duplicate #define

I noticed a duplicate macro definition in xmmintrin.h.

Reviewed By: RKSimon

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

21 months ago[mlir][Memref] Introduce a memref::ExtractAlignedPointerAsIndexOp
Nicolas Vasilache [Mon, 26 Sep 2022 15:43:20 +0000 (08:43 -0700)]
[mlir][Memref] Introduce a memref::ExtractAlignedPointerAsIndexOp

As experience with memref::ExtractStridedMetadataOp grows we are
still missing a simple way to extract the pointer held by a memref
and lower to different backednds (LLVM, SPIRV, library calls).

This revision introduces a memref.extract_aligned_pointer_as_index that
returns an index containing the aligned pointer of the strided memref.

This operation is intended to be used solely as step during lowering,
it has no side effects. A reverse operation that creates a memref from
an index interpreted as a pointer is explicitly discouraged.

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

21 months ago[ConstraintElimination] Add initial usub.with.overflow tests.
Zain Jaffal [Mon, 26 Sep 2022 15:44:35 +0000 (16:44 +0100)]
[ConstraintElimination] Add initial usub.with.overflow tests.

Optimizations can be used to eliminate unecessary overflow checks. This patch introduces some test cases where the checks can be safely removed

Reviewed By: fhahn, fcloutier

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

21 months ago[mlir][spirv] Change td def/class prefix from SPV to SPIRV
Jakub Kuderski [Mon, 26 Sep 2022 15:42:26 +0000 (11:42 -0400)]
[mlir][spirv] Change td def/class prefix from SPV to SPIRV

Tested with `check-mlir` and `check-mlir-integration`.

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

Reviewed By: antiagainst

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

21 months agoReapply "[Concepts] Recover properly from a RecoveryExpr in a concept"
Erich Keane [Mon, 26 Sep 2022 13:57:25 +0000 (06:57 -0700)]
Reapply "[Concepts] Recover properly from a RecoveryExpr in a concept"

This reverts commit 192d69f7e65a625e344421841e731e39f80595f5.

This fixes the condition to check whether this is a situation where we
are in a recovery-expr'ed concept a little better, so we don't access an
inactive member of a union, which should make the bots happy.

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

21 months ago[mlir][MemRef] Add pattern that forwards constant strided metadata.
Nicolas Vasilache [Thu, 22 Sep 2022 15:52:18 +0000 (08:52 -0700)]
[mlir][MemRef] Add pattern that forwards constant strided metadata.

`memref.extract_strided_metadata` can forward constants independently of the
exsistence of other operations such as subview or reshape.

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

21 months ago[mlir] Fix a deprecation warning
Kazu Hirata [Mon, 26 Sep 2022 15:30:59 +0000 (08:30 -0700)]
[mlir] Fix a deprecation warning

This patch fixes:

  mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp:99:16:
  error: 'getValue' is deprecated: Use value
  instead. [-Werror,-Wdeprecated-declarations]

21 months ago[libc++] Use XXYYZZ instead of XXYZZ for _LIBCPP_VERSION
Louis Dionne [Mon, 19 Sep 2022 19:38:18 +0000 (15:38 -0400)]
[libc++] Use XXYYZZ instead of XXYZZ for _LIBCPP_VERSION

As discussed on Discord.

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

21 months ago[AMDGPU] Precommit switching test to generated checks for D134463
jeff [Mon, 26 Sep 2022 15:09:24 +0000 (15:09 +0000)]
[AMDGPU] Precommit switching test to generated checks for D134463

Change-Id: I6ed91aacf6856ef535a54284d48e937db33be1a3

21 months ago[mlir][spirv] Change dialect name from 'spv' to 'spirv'
Jakub Kuderski [Mon, 26 Sep 2022 14:58:13 +0000 (10:58 -0400)]
[mlir][spirv] Change dialect name from 'spv' to 'spirv'

Tested with `check-mlir` and `check-mlir-integration`.

Issue: https://github.com/llvm/llvm-project/issues/56863

Reviewed By: antiagainst

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

21 months agoAutogenerate stack-folding-fp X86 tests. NFC
Amaury Séchet [Mon, 26 Sep 2022 14:25:53 +0000 (14:25 +0000)]
Autogenerate stack-folding-fp X86 tests. NFC

21 months agoRevert "[Concepts] Recover properly from a RecoveryExpr in a concept"
Erich Keane [Mon, 26 Sep 2022 13:55:25 +0000 (06:55 -0700)]
Revert "[Concepts] Recover properly from a RecoveryExpr in a concept"

This reverts commit e3d14bee238b672a7a112311eefee55e142eaefc.

There are apparently a large number of crashes in libcxx and some JSON
Parser thing, so clearly this has some sort of serious issue.  Reverting
so I can take some time to figure out what is going on.

21 months ago[libc++] Add release note about unary_function and binary_function being removed...
Louis Dionne [Mon, 26 Sep 2022 13:45:14 +0000 (09:45 -0400)]
[libc++] Add release note about unary_function and binary_function being removed in >= C++17

21 months agoSmall formating nit in DAGCombiner. NFC
Amaury Séchet [Mon, 26 Sep 2022 13:36:01 +0000 (13:36 +0000)]
Small formating nit in DAGCombiner. NFC

21 months ago[Concepts] Recover properly from a RecoveryExpr in a concept
Erich Keane [Fri, 23 Sep 2022 15:03:41 +0000 (08:03 -0700)]
[Concepts] Recover properly from a RecoveryExpr in a concept

Discovered by reducing a different problem, we currently assert because
we failed to make the constraint expressions not dependent, since a
RecoveryExpr cannot be transformed.

This patch fixes that, and gets reasonably nice diagnostics by
introducing a concept (hah!) of "ContainsErrors" to the Satisfaction
types, which causes us to treat the candidate as non-viable.

However, just making THAT candidate non-viable would result in choosing
the 'next best' canddiate, which can result in awkward errors, where we
start evaluating a candidate that is not intended to be selected.
Because of this, and to make diagnostics more relevant, we now just
cause the entire lookup to result in a 'no-viable-candidates'.

This means we will only emit the list of candidates, rather than any
cascading failures.

21 months ago[Bazel] Remove template_rule and use @bazel_skylib's expand_template instead.
Christian Sigg [Wed, 21 Sep 2022 13:22:58 +0000 (15:22 +0200)]
[Bazel] Remove template_rule and use @bazel_skylib's expand_template instead.

Reviewed By: GMNGeoffrey

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

21 months ago[LoopUnroll] Add cache verification failure test case.
Florian Hahn [Mon, 26 Sep 2022 13:25:36 +0000 (14:25 +0100)]
[LoopUnroll] Add cache verification failure test case.

Test case for D134612.

21 months ago[flang] Lowers calls to procedure with CONTIGUOUS assumed shape dummies
Jean Perier [Mon, 26 Sep 2022 13:09:30 +0000 (15:09 +0200)]
[flang] Lowers calls to procedure with CONTIGUOUS assumed shape dummies

Copy-in/copy-out was not triggered when calling a procedure with a
CONTIGUOUS assumed shape. The actual argument must be copied-in/out
if it is not contiguous.
The copy-in/copy-out takes care of argument optionality, and uses a
runtime check in order to only do the copy if the actual is not
contiguous at runtime.

This was already implemented for explicit shape dummy arguments. This
patch takes advantage of this implementation to deal with the copy-in
copy-out aspects. It only need add code to deals with wrapping the
created bare contiguous address into a fir.box (runtime descriptor),
taking care of the optional box aspects.

Using this existing code is only possible for actual argument that can
be passed via a bare address. Add a TODO for polymorphic entity, PDTs
and assumed rank where the existing copy-in/copy-out code may fail
(these copies are more complex) and that cannot be tested currently.

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

21 months ago[VE] Disable automatic maxnum/minnum selection
Kazushi (Jam) Marukawa [Sat, 24 Sep 2022 20:31:28 +0000 (05:31 +0900)]
[VE] Disable automatic maxnum/minnum selection

Disable FMAX/FMIN selection from select_cc in VEInstrInfo.td because of
the lack of NaN consideration.  This patch removes such selection from
VEInstrInfo.td and lets llvm work on it in combineMinNumMaxNum.

Reviewed By: efocht

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

21 months ago[MustExecute] Add additional test for PR57780 (NFC)
Nikita Popov [Mon, 26 Sep 2022 13:02:50 +0000 (15:02 +0200)]
[MustExecute] Add additional test for PR57780 (NFC)

21 months ago[VE] Support smax/smin
Kazushi (Jam) Marukawa [Sat, 24 Sep 2022 05:51:07 +0000 (14:51 +0900)]
[VE] Support smax/smin

Support smax/smin in VEInstrInfo.td.  Remove obsolete patterns for
smax/smin.  Add regression tests for smax/smin/umax/umin.

Reviewed By: efocht

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

21 months ago[libc][NFC] Move bzero_inline to separate file
Guillaume Chatelet [Mon, 26 Sep 2022 12:57:21 +0000 (12:57 +0000)]
[libc][NFC] Move bzero_inline to separate file
This allows for easier discovery.

21 months ago[libc][NFC] Remove new framework, a simpler one is coming
Guillaume Chatelet [Mon, 26 Sep 2022 12:42:38 +0000 (12:42 +0000)]
[libc][NFC] Remove new framework, a simpler one is coming

21 months ago[libc][NFC] introduce inline_bzero
Guillaume Chatelet [Mon, 26 Sep 2022 12:33:01 +0000 (12:33 +0000)]
[libc][NFC] introduce inline_bzero

21 months agoUpdate the status of a few more C99 DRs
Aaron Ballman [Mon, 26 Sep 2022 12:20:27 +0000 (08:20 -0400)]
Update the status of a few more C99 DRs

21 months ago[LoopDistribute] Add LAA invalidation test for #50940.
Florian Hahn [Mon, 26 Sep 2022 11:21:13 +0000 (12:21 +0100)]
[LoopDistribute] Add LAA invalidation test for #50940.

Test case for #50940, to be fixed by D134606.

21 months ago[mlir] Add IteratorType enum to StructuredOpsUtils.
Oleg Shyshkov [Mon, 26 Sep 2022 10:33:08 +0000 (10:33 +0000)]
[mlir] Add IteratorType enum to StructuredOpsUtils.

Summary:
Use the new enum in TilingIterface and verify that `iterator_type` attribute in
LinalgOp interface is compatible with the enum values. Later IteratorType enum
will be used in LinalgInterface to replace the current `iterator_type` attribute
array of string.

Existing enums in Linalg are moved into a separate td file and tablegen build
target. This is necessary, have one I32EnumAttr in a shared space that generated
enum class definition and EnumAttrs is dialect-specific location. Otherwise
there might be a conflict that I32EnumAttr generates enum definitions in
multiple places.

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

21 months ago[LLDB] Add an llvm::Optional version of GetRegisterInfo
David Spickett [Fri, 23 Sep 2022 14:28:36 +0000 (14:28 +0000)]
[LLDB] Add an llvm::Optional version of GetRegisterInfo

We have some 500 ish uses of the bool plus ref version
so changing them all at once isn't a great idea.

This adds an overload that doesn't take a RegisterInfo&
and returns an optional.

Once I'm done switching all the existing callers I'll
remove the original function.

Benefits of optional over bool plus ref:
* The intent of the function is clear from the prototype.
* It's harder to forget to check if the return is valid,
  and if you do you'll get an assert.
* You don't hide ununsed variables, which happens because
  passing by ref marks a variable used.
* You can't forget to reset the RegisterInfo in between
  calls.

Reviewed By: clayborg

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

21 months ago[ARM] Enable and/cmp0 folding
Momchil Velikov [Mon, 26 Sep 2022 10:30:31 +0000 (11:30 +0100)]
[ARM] Enable and/cmp0 folding

The `CodeGenPrepare` pass can sink bitwise `and` used by compare to
zero into the basic blocks where the users are. This operation is
guarded by lowering hook, which is disabled for ARM.  In the ARM
architecture versions from v7-M up these two operations can be folded
into `tst rN, #imm` instruction. Sinking of `and` can also enable
the cmov-to-bfi DAG combiner.

This patch fixes some benchmark regressions caused
by https://reviews.llvm.org/D129370 as well scoring slightly better overall.

Reviewed By: dmgreen

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

21 months ago[ARM] Enable and/cmp0 folding - precommit test
Momchil Velikov [Mon, 26 Sep 2022 09:56:39 +0000 (10:56 +0100)]
[ARM] Enable and/cmp0 folding - precommit test

Precommit test for D134360

Reviewed By: dmgreen

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

21 months ago[analyzer] Pass correct bldrCtx to computeObjectUnderConstruction
Tomasz Kamiński [Mon, 26 Sep 2022 09:17:41 +0000 (11:17 +0200)]
[analyzer] Pass correct bldrCtx to computeObjectUnderConstruction

In case when the prvalue is returned from the function (kind is one
of `SimpleReturnedValueKind`, `CXX17ElidedCopyReturnedValueKind`),
then it construction happens in context of the caller.
We pass `BldrCtx` explicitly, as `currBldrCtx` will always refer to callee
context.

In the following example:
```
struct Result {int value; };
Result create() { return Result{10}; }
int accessValue(Result r) { return r.value; }

void test() {
   for (int i = 0; i < 2; ++i)
      accessValue(create());
}
```

In case when the returned object was constructed directly into the
argument to a function call `accessValue(create())`, this led to
inappropriate value of `blockCount` being used to locate parameter region,
and as a consequence resulting object (from `create()`) was constructed
into a different region, that was later read by inlined invocation of
outer function (`accessValue`).
This manifests itself only in case when calling block is visited more
than once (loop in above example), as otherwise there is no difference
in `blockCount` value between callee and caller context.
This happens only in case when copy elision is disabled (before C++17).

Reviewed By: NoQ

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

21 months agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Mon, 26 Sep 2022 09:27:38 +0000 (10:27 +0100)]
Fix MSVC "not all control paths return a value" warning. NFCI.

21 months ago[AArch64] Enable FeatureFuseAdrpAdd for all Arm cpus
David Green [Mon, 26 Sep 2022 08:55:10 +0000 (09:55 +0100)]
[AArch64] Enable FeatureFuseAdrpAdd for all Arm cpus

The commit D120104 enabled FeatureFuseAdrpAdd for -mcpu=generic,
allowing the linker to relax adrp;add pairs where possible. D132075
extended that to neoverse-n1, this patch extends it to all other cortex
and neoverse cpus for the same reasons.

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

21 months ago[clang-tidy] adjust treating of array-of-pointers when 'AnalyzePointers' is deactivated
Jonas Toth [Sun, 25 Sep 2022 17:26:32 +0000 (19:26 +0200)]
[clang-tidy] adjust treating of array-of-pointers when 'AnalyzePointers' is deactivated

'misc-const-correctness' previously considered arrays as 'Values' independent of the type of the elements.
This is inconsistent with the configuration of the check to disable treating pointers as values.
This patch rectifies this inconsistency.

Fixes #56749

Reviewed By: njames93

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

21 months ago[mlir] Apply ClangTidyLegacy finding.
Adrian Kuegel [Mon, 26 Sep 2022 08:31:10 +0000 (10:31 +0200)]
[mlir] Apply ClangTidyLegacy finding.

Prefer using 'override' instead of 'virtual'.

21 months ago[mlir] Fix typo in parameter name annotation.
Adrian Kuegel [Mon, 26 Sep 2022 08:26:51 +0000 (10:26 +0200)]
[mlir] Fix typo in parameter name annotation.

Found by ClangTidy.

21 months agoRevert "[mlir][Bazel] Port 730ae80d3e1c47f93f725acb2d37f06fcba06953"
Adrian Kuegel [Mon, 26 Sep 2022 08:09:02 +0000 (10:09 +0200)]
Revert "[mlir][Bazel] Port 730ae80d3e1c47f93f725acb2d37f06fcba06953"

This reverts commit ec8f08ce08c26f6db61b142ba40590c3c1d158a0.

The change that needed this BUILD fix was reverted.

21 months ago[lldb] Fix CommandInterpreter::DidProcessStopAbnormally() with multiple threads
Martin Storsjö [Fri, 16 Sep 2022 13:13:12 +0000 (16:13 +0300)]
[lldb] Fix CommandInterpreter::DidProcessStopAbnormally() with multiple threads

If a process has multiple threads, the thread with the stop
info might not be the first one in the thread list.

On Windows, under certain circumstances, processes seem to have
one or more extra threads that haven't been launched by the
executable itself, waiting in NtWaitForWorkViaWorkerFactory. If the
main (stopped) thread isn't the first one in the list (the order
seems nondeterministic), DidProcessStopAbnormally() would return
false prematurely, instead of inspecting later threads.

The main observable effect of DidProcessStopAbnormally() erroneously
returning false, is when running lldb with multiple "-o" parameters
to specify multiple commands to execute on the command line.

After an abnormal stop, lldb would stop executing "-o" parameters
and execute "-k" parameters instead - but due to this issue, it
would instead keep executing "-o" parameters as if there was no
abnormal stop. (If multiple parameters are specified via a script
file via the "-s" option, all of the commands in that file are
executed regardless of whether there's an abnormal stop inbetween.)

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

21 months ago[llvm-readobj][COFF] Print forwarder export symbols correctly
Alvin Wong [Mon, 26 Sep 2022 07:41:17 +0000 (10:41 +0300)]
[llvm-readobj][COFF] Print forwarder export symbols correctly

Reviewed By: mstorsjo

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

21 months ago[LLD][COFF] Fix absolute & synthetic symbols in COFF symbol table
Alvin Wong [Mon, 26 Sep 2022 07:40:51 +0000 (10:40 +0300)]
[LLD][COFF] Fix absolute & synthetic symbols in COFF symbol table

Absolute symbol should contain its absolute value, but LLD had been
writing its RVA instead. Write its VA instead.

DefinedSynthetic were being skipped before with the reasoning "Relative
symbols are unrepresentable in a COFF symbol table", which is only true
if the RVA points to outside of a section. LLD does create synthetic
symbols which points to actual data chunks (typical for symbols embedded
into the load config directory). Write these symbols to the COFF symbol
table too.

Reviewed By: mstorsjo

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

21 months agoRevert "[mlir][Bazel] Port 730ae80d3e1c47f93f725acb2d37f06fcba06953 part 2."
Adrian Kuegel [Mon, 26 Sep 2022 08:04:56 +0000 (10:04 +0200)]
Revert "[mlir][Bazel] Port 730ae80d3e1c47f93f725acb2d37f06fcba06953 part 2."

This reverts commit b4cc363e86e7506e41560af333b12beefd9f4bbd.

The change which needed this BUILD fix was reverted.

21 months agoRevert "[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)"
Lorenzo Chelini [Mon, 26 Sep 2022 08:01:23 +0000 (10:01 +0200)]
Revert "[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)"

This reverts commit 730ae80d3e1c47f93f725acb2d37f06fcba06953.

It fails with a linking errors: `undefined reference to
`mlir::getValueOrCreateConstantIndexOp` in `libMLIRDialectUtils`.

21 months ago[MLIR] Migrate MemRef -> LLVM conversion pass to the auto-generated constructor
Michele Scuttari [Sun, 25 Sep 2022 19:52:18 +0000 (21:52 +0200)]
[MLIR] Migrate MemRef -> LLVM conversion pass to the auto-generated constructor

See #57475

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

21 months ago[mlir][Bazel] Port 730ae80d3e1c47f93f725acb2d37f06fcba06953 part 2.
Adrian Kuegel [Mon, 26 Sep 2022 07:51:22 +0000 (09:51 +0200)]
[mlir][Bazel] Port 730ae80d3e1c47f93f725acb2d37f06fcba06953 part 2.

21 months ago[mlir][Bazel] Port 730ae80d3e1c47f93f725acb2d37f06fcba06953
Adrian Kuegel [Mon, 26 Sep 2022 07:45:24 +0000 (09:45 +0200)]
[mlir][Bazel] Port 730ae80d3e1c47f93f725acb2d37f06fcba06953

21 months ago[mlir][Bazel] Port afb0b21f24adecfa0b302c79366980453b15ba7b
Adrian Kuegel [Mon, 26 Sep 2022 07:37:32 +0000 (09:37 +0200)]
[mlir][Bazel] Port afb0b21f24adecfa0b302c79366980453b15ba7b

21 months ago[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)
Lorenzo Chelini [Sun, 25 Sep 2022 14:32:13 +0000 (16:32 +0200)]
[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)

The utility function should live in `StaticValueUtils.h` as it provides
a convenient way to convert a vector of OpFoldResults into a vector of
Values.

Reviewed By: nicolasvasilache

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

21 months ago[mlir][Arithmetic] Support commutative canonicalization for continuous XOrIOp.
jacquesguan [Tue, 20 Sep 2022 07:22:15 +0000 (15:22 +0800)]
[mlir][Arithmetic] Support commutative canonicalization for continuous XOrIOp.

This patch adds commutative canonicalization support for D116383.

Reviewed By: Mogball

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

21 months ago[Analysis] Introduce getStaticBonusApplied (NFC)
Kazu Hirata [Mon, 26 Sep 2022 06:21:40 +0000 (23:21 -0700)]
[Analysis] Introduce getStaticBonusApplied (NFC)

InlineCostCallAnalyzer encourages inlining of the last call to the
static function by subtracting LastCallToStaticBonus from Cost.

This patch introduces getStaticBonusApplied to make available the
amount of LastCallToStaticBonus applied.

The intent is to allow the module inliner to determine whether
inlining a given call site is expected to reduce the caller size with
an expression like:

  IC.getCost() + IC.getStaticBonusApplied() < 0

This patch does not add a use of getStaticBonus yet.

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

21 months ago[llvm] Use std::underlying_type_t (NFC)
Kazu Hirata [Mon, 26 Sep 2022 06:14:15 +0000 (23:14 -0700)]
[llvm] Use std::underlying_type_t (NFC)

21 months ago[ADT] Use std::conditional_t (NFC)
Kazu Hirata [Mon, 26 Sep 2022 06:14:13 +0000 (23:14 -0700)]
[ADT] Use std::conditional_t (NFC)

21 months ago[LoongArch] Add codegen support for strict_fsetccs and any_fsetcc
gonglingqin [Mon, 26 Sep 2022 04:09:13 +0000 (12:09 +0800)]
[LoongArch] Add codegen support for strict_fsetccs and any_fsetcc

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

21 months ago[ORC] Update LinkGraph unit tests for API change in 75404e9ef88.
Lang Hames [Mon, 26 Sep 2022 05:02:15 +0000 (22:02 -0700)]
[ORC] Update LinkGraph unit tests for API change in 75404e9ef88.

21 months ago[clang-format] Handle constructor invocations after new operator in C# correct
Danil Sidoruk [Mon, 26 Sep 2022 04:07:18 +0000 (21:07 -0700)]
[clang-format] Handle constructor invocations after new operator in C# correct

Fixes #56549.

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

21 months ago[JITLink] Introduce new weakly-referenced concept separate from linkage.
Lang Hames [Mon, 26 Sep 2022 02:25:13 +0000 (19:25 -0700)]
[JITLink] Introduce new weakly-referenced concept separate from linkage.

Introduces two new methods on Symbol: isWeaklyReferenced and
setWeaklyReferenced. These are now used to track/set whether an external symbol
is weakly referenced, rather than having the Symbol's linkage set to weak.

This change is a first step towards proper handling of weak defs used across
JITDylib boundaries: It frees up the Linkage field on external symbols so that
it can be used to represent the linkage of the definition that the symbol resolves
to. It is expected that Platform plugins will use this information to track
locations that need to be updated if the selected weak definition changes (e.g.
because JITDylibs were dlclosed and then dlopened again in a different order).

21 months ago[LoongArch] Lower BlockAddress/JumpTable
wanglei [Mon, 26 Sep 2022 02:22:58 +0000 (10:22 +0800)]
[LoongArch] Lower BlockAddress/JumpTable

This patch uses a unified interface for lower GlobalAddress ConstantPool
BlockAddress and JumpTable.

This patch allows lowering addresses by using PC-relative addressing
for DSO-local symbols, and accessing the address through the global
offset table for DSO-preemptable symbols.

Remove hardcoded `MininumJumpTableEntries` for test lower JumpTable.

Also updated some test cases using ConstantPool, due to the addition of
relocation information.

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

21 months agoDon't crash when code completing `using enum ^Foo`.
Sam McCall [Mon, 19 Sep 2022 23:39:49 +0000 (01:39 +0200)]
Don't crash when code completing `using enum ^Foo`.

Fixes https://github.com/clangd/clangd/issues/1281

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

21 months ago[VP][RISCV] Add vp.sqrt intrinsic and RISC-V support.
Yeting Kuo [Mon, 12 Sep 2022 12:57:39 +0000 (20:57 +0800)]
[VP][RISCV] Add vp.sqrt intrinsic and RISC-V support.

The patch modeled vp.fabs patch D132793.

Reviewed By: craig.topper

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

21 months ago[LoongArch] Support 'generic' as a valid CPU name
WANG Xuerui [Mon, 26 Sep 2022 02:18:46 +0000 (10:18 +0800)]
[LoongArch] Support 'generic' as a valid CPU name

As the LoongArch port is largely modeled after RISCV it has the same
behavior of not accepting `generic` as a CPU name. For better
compatibility with consumers of LLVM (e.g. mesa) follow D121149's suit
and treat `generic` the same as an empty CPU name.

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

21 months agoAdd override for runOnFunction()
Ruiling Song [Mon, 26 Sep 2022 02:14:09 +0000 (10:14 +0800)]
Add override for runOnFunction()

Fix build-bot failure.

21 months ago[clangd] Make go-to-type work on member function calls
Sam McCall [Mon, 26 Sep 2022 02:17:27 +0000 (04:17 +0200)]
[clangd] Make go-to-type work on member function calls