platform/upstream/llvm.git
21 months ago[InstCombine] adjust tests for fptoui + trunc; NFC
Sanjay Patel [Fri, 20 Jan 2023 19:10:23 +0000 (14:10 -0500)]
[InstCombine] adjust tests for fptoui + trunc; NFC

Tests were duplicated for undef-ness, but that's not necessary.
There were no tests for bfloat/double.

I deleted the fptosi tests for now because those will just
be a bitwidth adjustment to the fptoui tests once we settle
on the right set of tests.

I think it should just be 2 tests on either side of the
bitwidth boundary to allow a fold with a couple of extra
tests thrown in to show other type constraints are not
a factor.

Goes with:
D142093

21 months ago[mlir] Add "memref::MemRefDialect" as dependentDialects for GpuToLLVMConversionPass
Xiang Li [Wed, 18 Jan 2023 04:20:11 +0000 (23:20 -0500)]
[mlir] Add "memref::MemRefDialect" as dependentDialects for GpuToLLVMConversionPass

For https://github.com/llvm/llvm-project/issues/60070.
The issue is caused by memref.store is not registed.
Registe it by add "memref::MemRefDialect" as dependetDialects for GpuToLLVMConsersionPass.

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

21 months agoAdd Parse/Sema for iterator for map clause.
Doru Bercea [Fri, 6 Jan 2023 17:17:57 +0000 (11:17 -0600)]
Add Parse/Sema for iterator for map clause.

21 months ago[CVP] Expand bound `udiv`'s, symmetrically with `urem`'s
Roman Lebedev [Fri, 20 Jan 2023 17:56:40 +0000 (20:56 +0300)]
[CVP] Expand bound `udiv`'s, symmetrically with `urem`'s

Symmetrical with the `urem` case, added in 66efb986322b206834e7c9e1eb777fa053912c39.

Simple case: https://alive2.llvm.org/ce/z/gRumLd / https://alive2.llvm.org/ce/z/rxEeC5
Second variant of precondition: https://alive2.llvm.org/ce/z/cAm9TD

21 months ago[NFC][CVP] Add tests for udiv expansion
Roman Lebedev [Fri, 20 Jan 2023 17:45:24 +0000 (20:45 +0300)]
[NFC][CVP] Add tests for udiv expansion

21 months agoRevert "[llvm] Move bit counting functions to bit.h (NFC)"
Nico Weber [Fri, 20 Jan 2023 18:51:29 +0000 (13:51 -0500)]
Revert "[llvm] Move bit counting functions to bit.h (NFC)"

This reverts commit f37614b25ccaa9c0710cc8a4fc2ba2fb0fcb9159.
Doesn't build on Windows: https://reviews.llvm.org/D142078#4068417

21 months agoRevert "[RISCV][TableGen] Move XLen detection into getMArch in RISCVTargetDefEmitter...
Craig Topper [Fri, 20 Jan 2023 18:44:49 +0000 (10:44 -0800)]
Revert "[RISCV][TableGen] Move XLen detection into getMArch in RISCVTargetDefEmitter. NFC"

This reverts commit e58010f712ccac83194852fa95ed70ef76ba6a33.

Seems this is failing on the build bots.

21 months ago[PGO] incorrect classof in InstrProfIncrementInst
Ellis Hoag [Fri, 20 Jan 2023 18:00:21 +0000 (10:00 -0800)]
[PGO] incorrect classof in InstrProfIncrementInst

Class InstrProfIncrementInstStep inherits from InstrProfIncrementInst but cannot cast to InstrProfIncrementInst, because InstrProfIncrementInst::classof does not cover such circumstance。

Function InstrProfiling::run traverse all instruction in a module and try to cast them to InstrProfIncrementInst using dyn_cast, but it will return nullptr if the instruction is InstrProfIncrementInstStep(subclass of InstrProfIncrementInst).

Reviewed By: tejohnson, ellis

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

21 months ago[RISCV][TableGen] Move XLen detection into getMArch in RISCVTargetDefEmitter. NFC
Craig Topper [Fri, 20 Jan 2023 18:15:27 +0000 (10:15 -0800)]
[RISCV][TableGen] Move XLen detection into getMArch in RISCVTargetDefEmitter. NFC

We no longer need the XLen in two places. Fold it into the code
that determines the default march.

21 months ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Fri, 20 Jan 2023 18:10:56 +0000 (13:10 -0500)]
[InstCombine] regenerate test checks; NFC

We have better value name propagation now. Eliminates some noise
in case something in this set of tests has a real change.

21 months ago[RISCV] Remove Features from CPUInfo in RISCVTargetParser.
Craig Topper [Fri, 20 Jan 2023 18:03:37 +0000 (10:03 -0800)]
[RISCV] Remove Features from CPUInfo in RISCVTargetParser.

Instead of having separate feature bits, get information from march.
Invalid is now implied by empty march.
64-bit is now implied by march starting with "rv64".

Reviewed By: fpetrogalli

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

21 months ago[Sanitizers] intercept hexdump on FreeBSD.
David Carlier [Fri, 20 Jan 2023 17:59:00 +0000 (17:59 +0000)]
[Sanitizers] intercept hexdump on FreeBSD.

Reviewers: vitalybuka
Reviewed-By: vitalybuka
Differential Revision: https://reviews.llvm.org/D110471

21 months ago[gn] port a920ae3b8d1e9 (DWARFLinkerParallel)
Nico Weber [Fri, 20 Jan 2023 17:52:22 +0000 (12:52 -0500)]
[gn] port a920ae3b8d1e9 (DWARFLinkerParallel)

21 months ago[AArch64] Enable libm vectorized functions via SLEEF
Daniel Kiss [Fri, 20 Jan 2023 17:52:14 +0000 (18:52 +0100)]
[AArch64] Enable libm vectorized functions via SLEEF

It enables trigonometry functions vectorization via SLEEF: http://sleef.org/.

  - A new vectorization library enum is added to TargetLibraryInfo.h: SLEEF.
  - A new option is added to TargetLibraryInfoImpl - ClVectorLibrary: SLEEF.
  - A comprehensive test case is included in this changeset.
  - A new vectorization library argument is added to -fveclib: -fveclib=SLEEF.

Trigonometry functions that are vectorized by sleef:
acos
asin
atan
atanh
cos
cosh
exp
exp2
exp10
lgamma
log10
log2
log
sin
sinh
sqrt
tan
tanh
tgamma

Co-authored-by: Stefan Teleman
Reviewed By: paulwalker-arm

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

21 months ago[AArch64][SME2] Add multi-vector FP convert from Float to interleave Half/BFloat...
Caroline Concatto [Fri, 20 Jan 2023 17:14:16 +0000 (17:14 +0000)]
[AArch64][SME2] Add multi-vector FP convert from Float to interleave Half/BFloat intrinsic

Add the following intrinsic:
  FCVTN
  BFCVTN

NOTE: These intrinsics are still in development and are subject to future changes.

Reviewed By: david-arm

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

21 months ago[MachineCombiner] Use default latency model when no detailed model available
Philip Reames [Fri, 20 Jan 2023 16:59:24 +0000 (08:59 -0800)]
[MachineCombiner] Use default latency model when no detailed model available

This change adjusts the cost modeling used when the target does not have a schedule model with individual instruction latencies. After this change, we use the default latency information available from TargetSchedule. The default latency information essentially ends up treating most instructions as latency 1, with a few "expensive" ones getting a higher cost.

Previously, we unconditionally applied the first legal pattern - without any consideration of profitability. As a result, this change both prevents some patterns being applied, and changes which patterns are exercised. (i.e. previously the first pattern was applied, afterwards, maybe the second one is because the first wasn't profitable.)

The motivation here is two fold.

First, this brings the default behavior in line with the behavior when -mcpu or -mtune is specified. This improves test coverage, and generally makes it less likely we will have bad surprises when providing more information to the compiler.

Second, this enables some reassociation for ILP by default. Despite being unconditionally enabled, the prior code tended to "reassociate" repeatedly through an entire chain and simply moving the first operand to the end. The result was still a serial chain, just a different one. With this change, one of the intermediate transforms is unprofitable and we end up with a partially flattened tree.

Note that the resulting code diffs show significant room for improvement in the basic algorithm. I am intentionally excluding those from this patch.

For the test diffs, I don't seen any concerning regressions. I took a fairly close look at the RISCV ones, but only skimmed the x86 (particularly vector x86) changes.

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

21 months ago[X86] `LowerBUILD_VECTOR()`: fix all-UNDEF detection
Roman Lebedev [Fri, 20 Jan 2023 16:58:53 +0000 (19:58 +0300)]
[X86] `LowerBUILD_VECTOR()`: fix all-UNDEF detection

The original check was trying to avoid checking UndefMask itself,
and deduce it via simpler means, but checking `NonZeroMask`
does not, e.g., check `ZeroMask`.

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

21 months ago[ARM][AArch64] Switch to generic MEMBARRIER node
Philip Reames [Fri, 20 Jan 2023 16:50:14 +0000 (08:50 -0800)]
[ARM][AArch64] Switch to generic MEMBARRIER node

This change switches both targets from using target specific CompilerBarrier nodes to the recently introduced generic MEMBARRIER instruction.

A couple things to call out.

First, this changes the assembly comment printed. I'm not sure this matters, but if it does, we can simply drop this patch. This is a minor clean up at best.

Second, the ordering operand on the target instruction appears to be unused. We could easily add ordering to the generic instruction, but since we don't seem to have a motivating case in tree, I simply dropped the ordering when selecting to the generic instruction.

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

21 months ago[NFC][DWARFLinker] Refactor address emitting code.
Alexey Lapshin [Fri, 20 Jan 2023 15:48:13 +0000 (16:48 +0100)]
[NFC][DWARFLinker] Refactor address emitting code.

As a preparation for implementing DWARFv5 address ranges generation,
this patch refactors existing address ranges generation code:
Split emitUnitRangesEntries into two functions emitDwarfDebugArangesTable
and emitDwarfDebugRangesTableFragment. Use AddressRanges to prepare linked
address ranges. Refactor Unit.getLowPc(), to use std::nullopt as undefined value.

Reviewed By: JDevlieghere

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

21 months ago[NFC]Fix github identification.
Alexey Bataev [Fri, 20 Jan 2023 16:40:00 +0000 (08:40 -0800)]
[NFC]Fix github identification.

21 months ago[libc++][format] range-default-formatter for set.
Mark de Wever [Thu, 5 May 2022 16:57:32 +0000 (18:57 +0200)]
[libc++][format] range-default-formatter for set.

Implements the range-default-formatter specialization range_format::set.

Implements parts of
- P2286R8 Formatting Ranges
- P2585R0 Improving default container formatting

Depends on D140801

Reviewed By: ldionne, #libc

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

21 months agoRecommit "[LoopUnroll] Directly update DT instead of DTU."
Florian Hahn [Fri, 20 Jan 2023 16:33:39 +0000 (16:33 +0000)]
Recommit "[LoopUnroll] Directly update DT instead of DTU."

This reverts commit c5ea42bcf48c8f3d3e35a6bff620b06d2a499108.

Recommit the patch with a fix for loops where the exiting terminator is
not a branch instruction. In that case, ExitInfos may be empty. In
addition to checking if there's a single exiting block also check if
there's a single ExitInfo.

A test case has been added in f92b35392ed8e4631.

21 months ago[mlir] use stable_sort for OperationLegalizer::computeOpLegalizationDepth
Xiang Li [Thu, 19 Jan 2023 14:23:30 +0000 (09:23 -0500)]
[mlir] use stable_sort for OperationLegalizer::computeOpLegalizationDepth

For https://github.com/llvm/llvm-project/issues/60070.
llvm::array_pod_sort will cause non-determinism when select pattern.
It is exposed by difference between windows build and linux build.

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

21 months agoAdd support for clang-cl's option `-fexcess-precision`.
Zahira Ammarguellat [Tue, 17 Jan 2023 14:02:35 +0000 (09:02 -0500)]
Add support for clang-cl's option `-fexcess-precision`.

This option is useful for clang and clang-cl.

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

21 months ago[RISCV][LSR] Precommit test coverage for an upcoming change
Philip Reames [Fri, 20 Jan 2023 16:19:04 +0000 (08:19 -0800)]
[RISCV][LSR] Precommit test coverage for an upcoming change

Main point of these is to show the difference between a loop with and without a use outside the loop.

21 months agoFix unused variable warning.
Johannes Reifferscheid [Fri, 20 Jan 2023 16:20:12 +0000 (17:20 +0100)]
Fix unused variable warning.

21 months ago[NFC] Reformat isBuiltinSupported with early exit
serge-sans-paille [Fri, 20 Jan 2023 10:33:25 +0000 (11:33 +0100)]
[NFC] Reformat isBuiltinSupported with early exit

21 months ago[modules] Allow parsing a duplicate Obj-C interface if a previous one comes from...
Volodymyr Sapsai [Wed, 14 Dec 2022 05:25:47 +0000 (21:25 -0800)]
[modules] Allow parsing a duplicate Obj-C interface if a previous one comes from a hidden [sub]module.

Instead of emitting a redefinition error, check that definitions are
equivalent and allow such scenario.

A few non-obvious implementation details:
* to avoid multiple definitions in the redeclaration chain we just drop
  the new definition after checking for equivalence;
* for checking definition equivalence use ODR hash instead of
  ASTStructuralEquivalence because it avoids excessive recursive
  deserialization. Though after detecting a mismatch we do deserialize
  multiple entities to provide a better error message.

rdar://82908223

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

21 months ago[ODRHash] Hash `ObjCInterfaceDecl` and diagnose discovered mismatches.
Volodymyr Sapsai [Fri, 9 Dec 2022 02:35:07 +0000 (18:35 -0800)]
[ODRHash] Hash `ObjCInterfaceDecl` and diagnose discovered mismatches.

When two modules contain interfaces with the same name, check the
definitions are equivalent and diagnose if they are not.

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

21 months ago[Bitcode] Fix invalid !nonnull metadata in test (NFC)
Nikita Popov [Fri, 20 Jan 2023 16:12:13 +0000 (17:12 +0100)]
[Bitcode] Fix invalid !nonnull metadata in test (NFC)

21 months ago[libc++] Move iota_view::iterator and sentinel out of iota_view
Nikolas Klauser [Sun, 4 Dec 2022 15:13:53 +0000 (16:13 +0100)]
[libc++] Move iota_view::iterator and sentinel out of iota_view

This makes it a lot easier to specialize traits types for it, like __segmented_iterator_traits.

Reviewed By: var-const, #libc

Spies: libcxx-commits

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

21 months ago[libc++] Enable clang-tidy from the buildkite pipeline instead of hard-coding it...
Nikolas Klauser [Mon, 9 Jan 2023 16:45:45 +0000 (17:45 +0100)]
[libc++] Enable clang-tidy from the buildkite pipeline instead of hard-coding it in run-buildbot

Reviewed By: ldionne, #libc, Mordante, emaste

Spies: emaste, Mordante, libcxx-commits, arichardson

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

21 months ago[InstCombine] Fixup check lines in test (NFC)
Nikita Popov [Fri, 20 Jan 2023 16:08:24 +0000 (17:08 +0100)]
[InstCombine] Fixup check lines in test (NFC)

These were broken by dfb0581bfa7b5fb9061876bd1b9af814408aaf95.

21 months ago[LoopUnroll] Add test case exposing crash with d0907ce7ed9f.
Florian Hahn [Fri, 20 Jan 2023 16:08:25 +0000 (16:08 +0000)]
[LoopUnroll] Add test case exposing crash with d0907ce7ed9f.

21 months ago[mlir] fix python types
Alex Zinenko [Fri, 20 Jan 2023 16:02:31 +0000 (16:02 +0000)]
[mlir] fix python types

21 months ago[Assignment Tracking] Fix tests for buildbot failure (2)
OCHyams [Fri, 20 Jan 2023 15:43:27 +0000 (15:43 +0000)]
[Assignment Tracking] Fix tests for buildbot failure (2)

Follow-up for 4ece50737d5385fb80cfa23f5297d1111f8eed39 (D142027).

Assignment Tracking Analysis now always runs and is skipped internally if
assignment tracking is disabled. Update these tests to expect to see the
pass run.

Buildbot failure: https://lab.llvm.org/buildbot/#/builders/57/builds/24094

21 months agoFix !nonnull syntax in test [NFC]
Nuno Lopes [Fri, 20 Jan 2023 15:57:58 +0000 (15:57 +0000)]
Fix !nonnull syntax in test [NFC]

21 months ago[lldb][test] Skip TestRerunAndExprDylib on Ubuntu 18.04
Dave Lee [Thu, 19 Jan 2023 18:38:21 +0000 (10:38 -0800)]
[lldb][test] Skip TestRerunAndExprDylib on Ubuntu 18.04

Disable this test on Ubuntu 18.04, where it fails for yet to be determined reasons.

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

21 months ago[OpenMP] Only test kmp_atomic_float10_max_min.c on X86
Shilei Tian [Fri, 20 Jan 2023 15:52:47 +0000 (10:52 -0500)]
[OpenMP] Only test kmp_atomic_float10_max_min.c on X86

The test `openmp/runtime/test/atomic/kmp_atomic_float10_max_min.c` uses a compiler
flag `-mlong-double-80` that might not be supported by all targets. Currently it
requires `x86-registered-target`, but that requirement can be true when LLVM
supports X86 while the actual `libomp` arch is not X86. For example, when LLVM
is built on AArch64 with all targets enabled, `x86-registered-target` can be met.
If `libomp` is built with native target, aka. AArch64, the test will still be enabled,
causing test failure.

This patch only enables the test if the actual target is X86. The actual target
is determined by `LIBOMP_ARCH`.

Fix #53696.

Reviewed By: jlpeyton

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

21 months ago[MLIR] Remove scf.if builder with explicit result types and callbacks
Frederik Gossen [Fri, 20 Jan 2023 15:51:16 +0000 (10:51 -0500)]
[MLIR] Remove scf.if builder with explicit result types and callbacks

Instead, use the builder and infer the return type based on the inner `yield` ops.
Also, fix uses that do not create the terminator as required for the callback builders.

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

21 months ago[Mem2Reg] Only convert !nonnull to assume if !noundef present
Nikita Popov [Thu, 12 Jan 2023 13:57:34 +0000 (14:57 +0100)]
[Mem2Reg] Only convert !nonnull to assume if !noundef present

After D141386 !nonnull violation returns poison rather than
resulting in immediate undefined behavior. However, converting
it into an assume would result in IUB. As such, we can only
perform this transform if !noundef is also present.

21 months ago[MLIR] Address post-submit comments on scf.if's InferTypeOpInterface
Frederik Gossen [Fri, 20 Jan 2023 15:36:40 +0000 (10:36 -0500)]
[MLIR] Address post-submit comments on scf.if's InferTypeOpInterface

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

21 months ago[DWARF][dsymutil][llvm-dwarfutil] Create a placeholder library DWARFLinkerParallel.
Alexey Lapshin [Fri, 20 Jan 2023 14:43:11 +0000 (15:43 +0100)]
[DWARF][dsymutil][llvm-dwarfutil] Create a placeholder library DWARFLinkerParallel.

This patch is extracted from D96035. It creates an empty library DWARFLinkerParallel.

Reviewed By: JDevlieghere

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

21 months ago[mlir][LLVM] Add passthrough import support
Christian Ulmann [Fri, 20 Jan 2023 15:28:56 +0000 (16:28 +0100)]
[mlir][LLVM] Add passthrough import support

This commit extends the LLVMIR import to support function attributes by
adding them to the passthrough array attribute.

Depends on D142013

Reviewed By: gysit

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

21 months ago[MLIR][LLVM] Support inlining LLVM::CallOp to LLVM::FuncOp.
Johannes de Fine Licht [Fri, 20 Jan 2023 15:13:48 +0000 (16:13 +0100)]
[MLIR][LLVM] Support inlining LLVM::CallOp to LLVM::FuncOp.

Extend `LLVMInlinerInterface` to handle calls from an `LLVM::CallOp` to
an `LLVM::FuncOp` when there are no attributes present that require
special handling.

Depends on D141676

Reviewed By: gysit

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

21 months ago[clang][nfc] refactor Module::Header to use OptionalFileEntryRef
Richard Howell [Wed, 18 Jan 2023 22:58:15 +0000 (14:58 -0800)]
[clang][nfc] refactor Module::Header to use OptionalFileEntryRef

Refactor the `Module::Header` class to use an `OptionalFileEntryRef`
instead of a `FileEntry*`. This is preparation for refactoring the
`TopHeaderNames` to use `FileEntryRef` so that we preserve the
lookup path of the headers when serializing.

This is mostly based on https://reviews.llvm.org/D90497

Reviewed By: jansvoboda11

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

21 months agosanmd: refine selection of functions for UAR checking
Dmitry Vyukov [Fri, 20 Jan 2023 09:26:20 +0000 (10:26 +0100)]
sanmd: refine selection of functions for UAR checking

There are no intrinsic functions that leak arguments.
If the called function does not return, the current function
does not return as well, so no possibility of use-after-return.
Sanitizer function also don't leak or don't return.
It's safe to both pass pointers to local variables to them
and to tail-call them.

Reviewed By: melver

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

21 months ago[Assignment Tracking] Fix tests for buildbot failure
OCHyams [Fri, 20 Jan 2023 15:16:39 +0000 (15:16 +0000)]
[Assignment Tracking] Fix tests for buildbot failure

Follow-up for 4ece50737d5385fb80cfa23f5297d1111f8eed39 (D142027).

Assignment Tracking Analysis now always runs and is skipped internally if
assignment tracking is disabled. Update these tests to expect to see the
pass run.

Buildbot failure: https://lab.llvm.org/buildbot/#/builders/216/builds/16085

21 months ago[flang] Add lowering of move_alloc to IntrinsicCall
David Truby [Fri, 20 Jan 2023 14:32:14 +0000 (14:32 +0000)]
[flang] Add lowering of move_alloc to IntrinsicCall

This patch relies on D141286 for the runtime implementation of
move_alloc.

Reviewed By: jeanPerier

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

21 months ago[mlir][Linalg] fix comparison of integers with different signs
Tom Eccles [Fri, 20 Jan 2023 12:14:10 +0000 (12:14 +0000)]
[mlir][Linalg] fix comparison of integers with different signs

Since https://reviews.llvm.org/D142053, building mlir with clang using -Werror
fails reporting comparison of integers with different signs.

Fix this by using unsigned return types for
RelayoutOp::getSourceRank,getDestRank

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

21 months ago[mlgo] Stream the training data
Mircea Trofin [Fri, 20 Jan 2023 01:37:08 +0000 (17:37 -0800)]
[mlgo] Stream the training data

This leverages the new logging format in that we don't need to buffer
the training data, we can just write it out.

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

21 months ago[DAG] visitINSERT_VECTOR_ELT - move mergeInsertEltWithShuffle / combineInsertEltToShu...
Simon Pilgrim [Fri, 20 Jan 2023 14:25:55 +0000 (14:25 +0000)]
[DAG] visitINSERT_VECTOR_ELT - move mergeInsertEltWithShuffle / combineInsertEltToShuffle folds after canonicalization

Noticed while triaging D127115 regressions - there's no need to attempt these costly folds until after the easy canonicalization cases have been addressed

21 months ago[DirectX] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:40:49 +0000 (15:40 +0100)]
[DirectX] Fix i8 alignment in datalayout of lit test

An llc lit test used overaligned i8, apparently originating from the old DXIL data layout.
The new DXIL data layout uses naturally aligned i8.

llc ignores the data layout of a module and instead sets the data layout based
on the target. Change the data layout string in the test to match that target-derived
data layout.

21 months ago[Transforms] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:38:28 +0000 (15:38 +0100)]
[Transforms] Fix i8 alignment in datalayout of lit test

A lit test used overaligned i8, apparently due to an old copy-paste
error, intending to specify i16 alignment.

Change the datalayout string to use naturally aligned i8.

21 months ago[X86] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:37:25 +0000 (15:37 +0100)]
[X86] Fix i8 alignment in datalayout of lit test

A lit test used overaligned i8, apparently due to an old copy-paste
error, intending to specify i32 alignment.

Change the datalayout string to use naturally aligned i8.

21 months ago[polly] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:36:13 +0000 (15:36 +0100)]
[polly] Fix i8 alignment in datalayout of lit test

Two lit test used overaligned i8, without the test case actually
depending on i8 alignment.
Change the datalayout string to use naturally aligned i8,
preparing for the upcoming requirement of naturally aligned i8.

21 months ago[docs] Update release notes to mention that LoongArch supports JITLink
wanglei [Fri, 20 Jan 2023 14:49:23 +0000 (22:49 +0800)]
[docs] Update release notes to mention that LoongArch supports JITLink

21 months ago[DebugInfo] Store instr-ref mode of MachineFunction in member
Jeremy Morse [Fri, 20 Jan 2023 14:14:39 +0000 (14:14 +0000)]
[DebugInfo] Store instr-ref mode of MachineFunction in member

Add a flag state (and a MIR key) to MachineFunctions indicating whether they
contain instruction referencing debug-info or not. Whether DBG_VALUEs or
DBG_INSTR_REFs are used needs to be determined by LiveDebugValues at least, and
using the current optimisation level as a proxy is proving unreliable.

Test updates are purely adding the flag to tests, in a couple of cases it
involves separating out VarLocBasedLDV/InstrRefBasedLDV tests into separate
files, as they can no longer share the same input.

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

21 months ago[LLVM][OpenMP] Correct the function signature of `__kmpc_parallel_level`
Shilei Tian [Fri, 20 Jan 2023 14:46:24 +0000 (09:46 -0500)]
[LLVM][OpenMP] Correct the function signature of `__kmpc_parallel_level`

`__kmpc_parallel_level` used to be a function w/o any argument, but in the new
device runtime, it accepts two. This patch simply corrects it in `OMPKinds.def`.
```
uint16_t __kmpc_parallel_level(IdentTy *Loc, uint32_t);
```

Reviewed By: jhuber6

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

21 months ago[Mem2Reg] Add additional noundef variations to nonnull tests (NFC)
Nikita Popov [Fri, 20 Jan 2023 14:39:00 +0000 (15:39 +0100)]
[Mem2Reg] Add additional noundef variations to nonnull tests (NFC)

21 months ago[Assignment Tracking] Fix -fexperimental-assignment-tracking cc1 flag
OCHyams [Fri, 20 Jan 2023 14:30:58 +0000 (14:30 +0000)]
[Assignment Tracking] Fix -fexperimental-assignment-tracking cc1 flag

This change allows `-fexperimental-assignment-tracking` to be negated using the
negative equivalent `-fno-experimental-assignment-tracking`, and fixes the flag
so that the default behaviour can be changed (currently the default is still
false / disabled).

Reviewed By: StephenTozer

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

21 months ago[ARM] Fix condition in cmov to csinc combine.
David Green [Fri, 20 Jan 2023 14:35:23 +0000 (14:35 +0000)]
[ARM] Fix condition in cmov to csinc combine.

This fixes the cmov fold from 90f24bef47227d58f2ccdcc481ca22eff32248ca,
where the condition needs to be inverted between the cmov and the csinc.

21 months ago[Assignment Tracking] Fix invalidated iterator usage
OCHyams [Fri, 20 Jan 2023 14:24:57 +0000 (14:24 +0000)]
[Assignment Tracking] Fix invalidated iterator usage

The iterator `FirstOverlap` is invalidated after the call to `insert` - avoid
dereferencing the iterator after the call to `insert`.

Reviewed By: CarlosAlbertoEnciso

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

21 months ago[Local] Preserve range metadata if the type did not change
Nikita Popov [Fri, 20 Jan 2023 14:27:19 +0000 (15:27 +0100)]
[Local] Preserve range metadata if the type did not change

In copyRangeMetadata() and by extension copyLoadMetadata(),
handle the trivial case where the type did not change, in which
case we can simply preserve the range metadata as is.

21 months ago[Assignment Tracking][NFC] Replace LLVM command line option with a module flag
OCHyams [Fri, 20 Jan 2023 14:19:14 +0000 (14:19 +0000)]
[Assignment Tracking][NFC] Replace LLVM command line option with a module flag

Remove LLVM flag -experimental-assignment-tracking. Assignment tracking is
still enabled from Clang with the command line -Xclang
-fexperimental-assignment-tracking which tells Clang to ask LLVM to run the
pass declare-to-assign. That pass converts conventional debug intrinsics to
assignment tracking metadata. With this patch it now also sets a module flag
debug-info-assignment-tracking with the value `i1 true` (using the flag conflict
rule `Max` since enabling assignment tracking on IR that contains only
conventional debug intrinsics should cause no issues).

Update the docs and tests too.

Reviewed By: CarlosAlbertoEnciso

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

21 months ago[SROA] Use copyMetadataForLoad() helper
Nikita Popov [Thu, 19 Jan 2023 16:04:06 +0000 (17:04 +0100)]
[SROA] Use copyMetadataForLoad() helper

Instead of copying just nonnull metadata, use the generic helper
to copy metadata to the new load. This helper is specifically
designed for the case where the load type may change, so it's
safe to use in this context.

21 months ago[arith] Allow integer casts of 0-D vectors
Benjamin Kramer [Thu, 19 Jan 2023 17:44:31 +0000 (18:44 +0100)]
[arith] Allow integer casts of 0-D vectors

This just works, no reason to disallow it.

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

21 months ago[clang] Fix typos in member initializers
Kadir Cetinkaya [Fri, 20 Jan 2023 08:43:48 +0000 (09:43 +0100)]
[clang] Fix typos in member initializers

This was regressed in ca619613801233ef2def8c3cc7d311d5ed0033cb. As we
attached InitExprs as-is to the AST, without performing transformations.

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

21 months ago[SROA] Add additional metadata preservation tests (NFC)
Nikita Popov [Fri, 20 Jan 2023 14:07:18 +0000 (15:07 +0100)]
[SROA] Add additional metadata preservation tests (NFC)

21 months ago[clang] Use FP options from AST for emitting code for casts
Serge Pavlov [Tue, 17 Jan 2023 14:38:00 +0000 (21:38 +0700)]
[clang] Use FP options from AST for emitting code for casts

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

21 months ago[clang-format] SortUsingDeclarations support lexicographic order
Backl1ght [Fri, 20 Jan 2023 12:22:51 +0000 (20:22 +0800)]
[clang-format] SortUsingDeclarations support lexicographic order

fix https://github.com/llvm/llvm-project/issues/59930

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

21 months ago[Assignment Tracking] Update test to use opaque pointers
OCHyams [Fri, 20 Jan 2023 13:07:12 +0000 (13:07 +0000)]
[Assignment Tracking] Update test to use opaque pointers

21 months ago[NFC] Precommit tests
Samuel Parker [Fri, 20 Jan 2023 13:17:12 +0000 (13:17 +0000)]
[NFC] Precommit tests

For (trunc (fp-to-int)).

21 months ago[flang][hlfir] Enable allocate, deallocate, pointer assignment lowering
Jean Perier [Fri, 20 Jan 2023 13:05:42 +0000 (14:05 +0100)]
[flang][hlfir] Enable allocate, deallocate, pointer assignment lowering

The previous patches allowed lowering allocatable/and pointer designator
expressions with HLFIR.
This patch updates the bridge genExprMutableBox to use HLFIR lowering
when HLFIR flag is set. For allocate and deallocate lowering that use
genExprMutableBox, no other change is needed.

For pointer assignments, the code doing the pointer assignments in the
bridge can be reused and is simply moved so that it can be shared, and
the "explicit context" special cases of the previous lowering are
by-passed.

The code doing pointer assignment revealed that convertExprToAddress
did not match the previous genExprAddr behavior (that actually
does not create temps for "x" where x is not contiguous).
Instead of trying to copy the old behavior that is a bit weird (was
dictated by the implementation rather than design). Update
convertExprToAddress to do something sensible and that works with
the current genExprAddr usages (if anything, it should saves bogus
array section temps).

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

21 months ago[AArch64][SME2] Add LLVM IR intrinsics for the vertical dot products
David Sherwood [Wed, 18 Jan 2023 09:02:15 +0000 (09:02 +0000)]
[AArch64][SME2] Add LLVM IR intrinsics for the vertical dot products

Adds intrinsics for the following SME2 instructions:

* BFVDOT (32-bit)
* FVDOT (32-bit)
* SVDOT (2-way) (32-bit)
* SVDOT (4-way) (32-bit and 64-bit)
* UVDOT (2-way) (32-bit)
* UVDOT (4-way) (32-bit and 64-bit)
* SUVDOT (32-bit)
* USVDOT (32-bit)

NOTE: These intrinsics are still in development and are subject to future changes.

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

21 months ago[mlir] Introduce a pattern to lower `gpu.subgroup_reduce` to `nvvm.redux_op`
Guray Ozen [Fri, 20 Jan 2023 11:44:03 +0000 (12:44 +0100)]
[mlir] Introduce a pattern to lower `gpu.subgroup_reduce` to `nvvm.redux_op`

This revision introduces a pattern to lower `gpu.subgroup_reduce` op into to the `nvvm.redux_sync` op. The op must be run by the entire subgroup, otherwise it is undefined behaviour.

It also adds a flag and populate function, because the op is not avaiable for every gpu (sm80+), so it can be used when it is desired.

Depends on D142088

Reviewed By: nicolasvasilache

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

21 months ago[mlir][Linalg] Fix ignoring nodiscard return value
Tom Eccles [Fri, 20 Jan 2023 12:51:11 +0000 (04:51 -0800)]
[mlir][Linalg] Fix ignoring nodiscard return value

ff94419a287c changed the return value of appendMangledType() to
LogicalResult, which is marked as nodiscard. Ignoring the result
generates a warning when building with clang.

Reviewed By: nicolasvasilache, chelini

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

21 months ago[OpenMP][libomptarget] Fix deinit of NextGen AMDGPU plugin
Kevin Sala [Thu, 19 Jan 2023 18:47:57 +0000 (19:47 +0100)]
[OpenMP][libomptarget] Fix deinit of NextGen AMDGPU plugin

This patch fixes a segfault that was appearing when the plugin fails to
initialize and then is deinitialized. Also, do not call hsa_shut_down if
the hsa_init failed.

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

21 months ago[mlir][llvm] Drop cyclic dependencies during debug metadata import.
Tobias Gysi [Fri, 20 Jan 2023 12:03:36 +0000 (13:03 +0100)]
[mlir][llvm] Drop cyclic dependencies during debug metadata import.

This revision fixes the import of LLVM IR to handle debug metadata with
cyclic dependencies. It deletes the elements list of the composite type
if a cyclic dependency is detected. The revision is meant as a band aid
to avoid infinite recursion during the import of cyclic debug metadata.
Long term solutions are currently discussed here:
https://discourse.llvm.org/t/handling-cyclic-dependencies-in-debug-info/67526/4

Reviewed By: Dinistro

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

21 months ago[OpenCL] Always add nounwind attribute for OpenCL
Sven van Haastregt [Thu, 19 Jan 2023 13:42:43 +0000 (13:42 +0000)]
[OpenCL] Always add nounwind attribute for OpenCL

Neither OpenCL nor C++ for OpenCL support exceptions, so add the
`nounwind` attribute unconditionally for those languages.

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

21 months ago[InstCombine] Add multi-use tests for gep of gep fold (NFC)
Nikita Popov [Fri, 20 Jan 2023 11:46:31 +0000 (12:46 +0100)]
[InstCombine] Add multi-use tests for gep of gep fold (NFC)

21 months ago[AArch64][SME2] Add multi-vector multiply-add long intrinsics.
Kerry McLaughlin [Fri, 20 Jan 2023 11:17:17 +0000 (11:17 +0000)]
[AArch64][SME2] Add multi-vector multiply-add long intrinsics.

Adds (single, multi & indexed) intrinsics for the following:
 - bfmlal/bfmlsl
 - fmlal/fmlsl
 - smlal/smlsl
 - umlal/umlsl

This patch also extends SelectSMETileSlice to handle scaled vector select offsets.

NOTE: These intrinsics are still in development and are subject to future changes.

Reviewed By: CarolineConcatto

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

21 months ago[ValueTracking] Take poison-generating metadata into account (PR59888)
Nikita Popov [Thu, 19 Jan 2023 14:34:35 +0000 (15:34 +0100)]
[ValueTracking] Take poison-generating metadata into account (PR59888)

In canCreateUndefOrPoison(), take not only poison-generating flags,
but also poison-generating metadata into account. The helpers are
written generically, but I believe the only case that can actually
matter is !range on calls -- !nonnull and !align are only valid on
loads, and those can create undef/poison anyway.

Unfortunately, this negatively impacts logical to bitwise and/or
conversion: For ctpop/ctlz/cttz we always attach !range metadata,
which will now block the transform, because it might introduce
poison. It would be possible to recover this regression by supporting
a ConsiderFlagsAndMetadata=false mode in impliesPoison() and clearing
flags/metadata on visited instructions.

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

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

21 months ago[AArch64][SME2] Add multi-vector fused multiply-add/subtract intrinsics
Kerry McLaughlin [Fri, 20 Jan 2023 10:44:39 +0000 (10:44 +0000)]
[AArch64][SME2] Add multi-vector fused multiply-add/subtract intrinsics

Adds intrinsics for the following:
 - fmla (single, multi & indexed)
 - fmls (single, multi & indexed)

NOTE: These intrinsics are still in development and are subject
to future changes.

Reviewed By: CarolineConcatto

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

21 months ago[mlir][nvvm] Introduce redux op
Guray Ozen [Thu, 19 Jan 2023 09:09:02 +0000 (10:09 +0100)]
[mlir][nvvm] Introduce redux op

Ptx model has `redux.sync` that performs reduction operation on the data from each predicated active thread in the thread group. It only is available sm80+.

This revision adds redux as on op to nvvm dialect.

Reviewed By: nicolasvasilache

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

21 months ago[ReleaseNotes] Add mention of complex number support for ARM and AArch64 backends.
Nicholas Guy [Wed, 18 Jan 2023 14:03:56 +0000 (14:03 +0000)]
[ReleaseNotes] Add mention of complex number support for ARM and AArch64 backends.

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

21 months ago[InstCombine] Add tests for constant memcpy with select (NFC)
Anshil Gandhi [Fri, 20 Jan 2023 10:52:17 +0000 (11:52 +0100)]
[InstCombine] Add tests for constant memcpy with select (NFC)

Tests for D136524.

21 months agotsan: Consider SI_TIMER signals always asynchronous
Marco Elver [Fri, 20 Jan 2023 09:20:41 +0000 (10:20 +0100)]
tsan: Consider SI_TIMER signals always asynchronous

POSIX timer can be configured to send any kind of signal, however, it
fundamentally does not make sense to consider a timer a synchronous
signal. Teach TSan that timers are never synchronous.

The tricky bit here is correctly defining compiler-rt's siginfo
replacement, which is a rather complex struct. Extend it in a limited
way that is mostly cross-platform compatible and add offset tests in
sanitizer_platform_limits_posix.cpp.

Reviewed By: dvyukov

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

21 months ago[flang][hlfir] Lower pointer and allocatable sub-part references
Jean Perier [Fri, 20 Jan 2023 10:30:39 +0000 (11:30 +0100)]
[flang][hlfir] Lower pointer and allocatable sub-part references

The previous patches dealt with allocatable and pointer symbol
and component whole references.
This one deals with the remaining sub-part case where a dereference
must be created before applying the sub-part reference on the target.

With this patch the support to designate allocatable and pointer in
HLFIR is complete, but some use points will need to be updated to
use HLFIR designator lowering (at least allocate/deallocate statement
and whole allocatable assignment).

The partInfo.base had to be turned into an std::optional<hlfir::Entity>
because loads of allocatable/pointers do create a
fir::FortranVariableOpInterface (there is no need to). The optional part
comes from the fact that the partInfo.base is not set when creating the
partInfo, but later when visiting the designator parts.

They are three cases when dereferences must be inserted:
- The pointer/allocatable is a symbol followed by a sub-part that is not
a component ref. This is done in visit(Symbol).
- The pointer/allocatable is a component followed by a sub-part that is
not another component ref. This is done in visit(Component).
- The pointer/allocatable is followed by a component ref. This case is
special since it does not call the above "visit" but instead calls "gen"
to break the visit and generate an hlfir.designate for the component
base (since one hlfir.designate can only represent one Fortran part-ref,
and must be chained to implement a Fortran designator with several part
refs). This is done in visitComponentImpl().

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

21 months ago[bazel] Add missing dependencies for 790f237012
Benjamin Kramer [Fri, 20 Jan 2023 10:05:29 +0000 (11:05 +0100)]
[bazel] Add missing dependencies for 790f237012

21 months ago[gn build] Port 0e13ccc69cf2
LLVM GN Syncbot [Fri, 20 Jan 2023 09:52:08 +0000 (09:52 +0000)]
[gn build] Port 0e13ccc69cf2

21 months ago[VPlan] Add initial VPDT test. (NFC)
Florian Hahn [Fri, 20 Jan 2023 09:51:06 +0000 (09:51 +0000)]
[VPlan] Add initial VPDT test. (NFC)

21 months ago[libomp] Explicitly include <string> header (NFC)
Nikita Popov [Fri, 20 Jan 2023 09:11:01 +0000 (10:11 +0100)]
[libomp] Explicitly include <string> header (NFC)

This is required to build against libstdc++ 13. Debug.h uses
std::stoi() from <string> without explicitly including it.

21 months ago[clang] fix crash on generic lambda with lambda in decltype
v1nh1shungry [Mon, 2 Jan 2023 05:13:38 +0000 (13:13 +0800)]
[clang] fix crash on generic lambda with lambda in decltype

Relevant issue: https://github.com/llvm/llvm-project/issues/59771

During the instantiation of a generic lambda, a non-generic lambda in
the trailing `decltype` is a `DeclContext` but not a dependent context,
so we shouldn't call `PerformDependentDiagnostics` on it.

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

21 months ago[mlir] GreedyPatternRewriteDriver: Add new strict mode option
Matthias Springer [Fri, 20 Jan 2023 09:01:27 +0000 (10:01 +0100)]
[mlir] GreedyPatternRewriteDriver: Add new strict mode option

There are now three options:
* `AnyOp` (previously `false`)
* `ExistingAndNewOps` (previously `true`)
* `ExistingOps`: this one is new.

The last option corresponds to what the `applyOpPatternsAndFold(Operation*, ...)` overload is doing. It is now also supported on the `applyOpPatternsAndFold(ArrayRef<Operation *>, ...)` overload.

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

21 months ago[clang][Interp] Initialize remaining InlineDescriptor fields
Timm Bäder [Fri, 20 Jan 2023 08:09:55 +0000 (09:09 +0100)]
[clang][Interp] Initialize remaining InlineDescriptor fields

for local variables. Hoping this will please msan.

21 months ago[Flang] Explicitly include cstdint (NFC)
Nikita Popov [Thu, 19 Jan 2023 13:28:58 +0000 (14:28 +0100)]
[Flang] Explicitly include cstdint (NFC)

This header uses std::int8_t, but does not include cstdint.

This fixes the build against libstc++ 13, where some indirect
header includes have been removed.

21 months ago[GVN] Refactor findDominatingLoad function
Sergey Kachkov [Fri, 13 Jan 2023 13:02:21 +0000 (16:02 +0300)]
[GVN] Refactor findDominatingLoad function

Improve findDominatingLoad implementation:
1. Result is saved into gvn::AvailableValue struct
2. Search is done in extended BB (while there is a single predecessor or
   limit is reached)

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

21 months ago[include-mapping] Parse zombie_names.html into a removed symbols map.
Viktoriia Bakalova [Mon, 16 Jan 2023 16:17:47 +0000 (16:17 +0000)]
[include-mapping] Parse zombie_names.html into a removed symbols map.

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

21 months agoAdd security group 2022 transparency report.
Kristof Beyls [Fri, 20 Jan 2023 08:49:16 +0000 (09:49 +0100)]
Add security group 2022 transparency report.