platform/upstream/llvm.git
19 months ago[LoopVectorize] Don't tail-fold for scalable VFs when there is no scalar tail
David Sherwood [Wed, 15 Mar 2023 14:25:21 +0000 (14:25 +0000)]
[LoopVectorize] Don't tail-fold for scalable VFs when there is no scalar tail

Currently in LoopVectorize we avoid tail-folding if we can
prove the trip count is always a multiple of the maximum
fixed-width VF. This works because we know the vectoriser
only ever chooses a VF that is a power of 2. However, if
we are also considering scalable VFs then we conservatively
bail out of the optimisation because we don't know the value
of vscale, which could be an odd or prime number, etc.

This patch tries to enable the same optimisation for scalable
VFs by asking if vscale is known to be a power of 2. If so,
we can then query the maximum value of vscale and use the same
logic as we do for fixed-width VFs. I've also added a new TTI
hook called isVScaleKnownToBeAPowerOfTwo that does the same
thing as the existing TargetLowering hook.

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

19 months ago[Docs][llvm-exegesis] Refactor snippet annotations in documentation
Aiden Grossman [Mon, 27 Mar 2023 08:19:06 +0000 (08:19 +0000)]
[Docs][llvm-exegesis] Refactor snippet annotations in documentation

Currently, the llvm-exegesis documentation page has all
snippet annotation information under an example. This patch refactors
the annotation documentation to a separate section to make things more
clear and to make adding future annotations easier. This patch also
significantly expands the documentation on the memory scratch space to
which a pointer can be passed through a register as the documentation on
this was quite sparse previously.

Reviewed By: courbet

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

19 months ago[llvm-exegesis] Refactor InstructionBenchmark to Benchmark
Aiden Grossman [Mon, 27 Mar 2023 08:14:18 +0000 (08:14 +0000)]
[llvm-exegesis] Refactor InstructionBenchmark to Benchmark

When llvm-exegesis was first introduced, it only supported benchmarking
individual instructions, hence the name for the data structure storing
the data corresponding to a benchmark being called InstructionBenchmark
made sense. However, now that benchmarking arbitrary snippets is
supported, InstructionBenchmark doesn't correspond to a single
instruction. This patch refactors InstructionBenchmark to be called
Benchmark to clean up this little bit of technical debt.

Reviewed By: courbet

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

19 months ago[clang] Test for AST Dumping of the template variables
Tomasz Kamiński [Fri, 24 Mar 2023 15:17:50 +0000 (16:17 +0100)]
[clang] Test for AST Dumping of the template variables

They illustrate unstable behavior of the https://reviews.llvm.org/D139705 after serialization.
(`#61680 <https://github.com/llvm/llvm-project/issues/61680>`).

Reviewed By: aaron.ballman

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

19 months ago[AMDGPU][printf] Run AMDGPUPrintfRuntimeBindingPass in -O0
Juan Manuel MARTINEZ CAAMAÑO [Fri, 24 Mar 2023 08:28:52 +0000 (09:28 +0100)]
[AMDGPU][printf] Run AMDGPUPrintfRuntimeBindingPass in -O0

AMDGPUPrintfRuntimeBindingPass is not run in the IR optimization
pipeline with -O0.

This means that with OpenCL the printf definition coming from
device_libs gets linked with the user's code, which blocks
AMDGPUPrintfRuntimeBindingPass from working after the linkage is done.

Reviewed By: arsenm

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

19 months ago[clang] Remove legacy -m(no)-code-object-v3 options
pvanhout [Thu, 9 Mar 2023 09:04:50 +0000 (10:04 +0100)]
[clang] Remove legacy -m(no)-code-object-v3 options

Code object V2 and V3 have been deprecated for a long time.
They're now scheduled to be removed completely from LLVM in the coming weeks/months.

There is no reason to support those legacy options anymore as they've
also been deprecated for a long time.

Reviewed By: #amdgpu, yaxunl, artem.tamazov

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

19 months ago[dataflow] Delete legacy aliases
Sam McCall [Sat, 25 Mar 2023 03:45:35 +0000 (04:45 +0100)]
[dataflow] Delete legacy aliases

I can't find any trace of use anymore.
I'm not sure renaming the header is worth the break, but leave the FIXME.

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

19 months ago[mlir][bufferize] Fix tracking of erased ops
Matthias Springer [Mon, 27 Mar 2023 06:57:46 +0000 (08:57 +0200)]
[mlir][bufferize] Fix tracking of erased ops

This is a workaround until D144193 has landed.

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

19 months ago[Target] Use isNullConstant (NFC)
Kazu Hirata [Mon, 27 Mar 2023 06:34:13 +0000 (23:34 -0700)]
[Target] Use isNullConstant (NFC)

19 months ago[RISCV] Support vector type strict_fsqrt.
Yeting Kuo [Sun, 26 Mar 2023 09:01:47 +0000 (17:01 +0800)]
[RISCV] Support vector type strict_fsqrt.

Reviewed By: craig.topper

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

19 months ago[Target] Use isAllOnesConstant (NFC)
Kazu Hirata [Mon, 27 Mar 2023 05:57:39 +0000 (22:57 -0700)]
[Target] Use isAllOnesConstant (NFC)

19 months ago[AArch64][CodeGen] Add few more tests for fused operations (NFC)
sgokhale [Mon, 27 Mar 2023 05:12:10 +0000 (10:42 +0530)]
[AArch64][CodeGen] Add few more tests for fused operations (NFC)

Add more tests to show oppurtunity for generating fused mul+add/sub ops.

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

19 months ago[LLJIT] Allow multiple loadPlatformDynamicLibrary calls with the same path.
Lang Hames [Mon, 27 Mar 2023 04:19:25 +0000 (21:19 -0700)]
[LLJIT] Allow multiple loadPlatformDynamicLibrary calls with the same path.

Where the same dylib is loaded more than once we should just return the
JITDylib created by the first call rather than error out. This matches the
behavior of dlopen / LoadLibrary.

19 months ago[Driver][NetBSD] Simplify NetBSD version handling
Brad Smith [Mon, 27 Mar 2023 03:58:16 +0000 (23:58 -0400)]
[Driver][NetBSD] Simplify NetBSD version handling

NetBSD 6.x and older is ancient. Remove now unnecessary version check.

Reviewed By: mgorny

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

19 months ago[RISCV] Allow llvm-objdump to disassemble objects with unrecognised versions of known...
Alex Bradbury [Mon, 27 Mar 2023 03:38:16 +0000 (04:38 +0100)]
[RISCV] Allow llvm-objdump to disassemble objects with unrecognised versions of known extensions

This Moves ELFObjectFile to using
RISCVISAInfo::parseNormalizedArchString which is not an NFC, as the test
changes show. D144353 transitioned LLD to using this function, which is
specialised to parsing arch strings in the normalised format specified
in the psABI rather than user-authored strings accepted in `-march`,
which has greater flexibility.

parseNormalizedArchString does not ignore or produce an error for ISA
extensions with a version that isn't recognised/supported by LLVM. As
current GCC is marking its objects with a higher version of the A, F,
and D extensions than LLVM (see [extension versioning
discussion](https://discourse.llvm.org/t/rfc-resolving-issues-related-to-extension-versioning-in-risc-v/68472)
this massively improves the usability of llvm-objdump with such
binaries.

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

19 months ago[RISCV] Enable tools such as llvm-objdump to process objects with unrecognised base...
Alex Bradbury [Mon, 27 Mar 2023 03:32:58 +0000 (04:32 +0100)]
[RISCV] Enable tools such as llvm-objdump to process objects with unrecognised base ISA versions

Tools such as llvm-objdump will currently inputs when the base ISA has
an unrecognised version. I addressed a similar issue in LLD in D144353,
introducing parseArchStringNormalized. While it would make sense to
migrate `llvm/lib/Object/ELFObjectFile.cpp` to using
`parseArchStringNormalized` as well, this patch takes a less ambitious
initial step. By tweaking the behaviour of `parseArchString` when
`IgnoreUnknown` is true (which only has one in-tree user), we use the
default supported ISA version when a base ISA with unrecognised version
is encountered.

This means that llvm-objdump and related tools will function better for
objects produced from a recent GCC. This isn't a full fix, as
IgnoreUnknown means that an imafd object with attributes specifying
newer A/F/D versions will have those extensions ignored.

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

19 months ago[TableGen] Format document
wangpc [Mon, 27 Mar 2023 03:24:41 +0000 (11:24 +0800)]
[TableGen] Format document

Add missing bang operators and reorder them in alphabetical order.

Reviewed By: craig.topper

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

19 months ago[clangd] Fix a hover crash on unsigned 64bit value
Younan Zhang [Sat, 25 Mar 2023 15:15:54 +0000 (23:15 +0800)]
[clangd] Fix a hover crash on unsigned 64bit value

This patch adapts to D140059, which makes an assumption that the
caller of `APSInt::getExtValue` promises no narrowing conversion
happens, i.e., from unsigned int64 to signed int64.

It also fixes clangd/clangd#1557.

Reviewed By: nridge

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

19 months ago[X86][NFC]Remove dead code in X86ISelLowering.cpp
Wang, Xin10 [Mon, 27 Mar 2023 01:29:50 +0000 (21:29 -0400)]
[X86][NFC]Remove dead code in X86ISelLowering.cpp

Look at the code in X86ISelLowering.cpp line 15579, when NumV2Elements == 0,
it has been handled in that scope, and will not move to the line 15612.

Reviewed By: RKSimon

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

19 months ago[LLJIT] Add convenience methods for loading dylibs and linking static libs.
Lang Hames [Mon, 27 Mar 2023 01:13:15 +0000 (18:13 -0700)]
[LLJIT] Add convenience methods for loading dylibs and linking static libs.

LLJIT::loadPlatformDynamicLibrary loads a dynamic library at a given path
(interpreted in the executor process -- the process containing the JIT'd code),
and returns a JITDylib (whose name is the given path) that reflects the symbols
in that library. LLJIT clients wishing to make the given symbols visible to
their JIT'd code can add this JITDylib to the link order of their JITDylib(s)
using JITDylib::addToLinkOrder.

The LLJIT::linkStaticLibraryInto overloads load a static library (or universal
binary) at a given path (interpreted in the controller process -- the process
containing the LLJIT instance) and adds its symbols to the given JITDylib.

The lli tool is updated to use LLJIT::linkStaticLibraryInto to implement the
extra-archive option.

LLJIT::loadPlatformDynamicLibrary is not tested in this patch as we don't have
a good way to produce dylibs in LLVM's regression test suite.

19 months ago[clang-format] Don't squash Verilog escaped identifiers
sstwcw [Sun, 26 Mar 2023 22:42:36 +0000 (22:42 +0000)]
[clang-format] Don't squash Verilog escaped identifiers

An escaped identifier always needs a space following it so the parser
can tell it apart from the next token.

The unit tests are changed to use `FormatTestBase.h` because we need the
2-argument version of `verifyFormat`.  We also added the `messUp`
virtual function because Verilog needs a different version of it.

Reviewed By: HazardyKnusperkeks

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

19 months ago[clang-format] Don't format already formatted integer literals
Owen Pan [Tue, 21 Mar 2023 07:02:56 +0000 (00:02 -0700)]
[clang-format] Don't format already formatted integer literals

Fixes a bug in IntegerLiteralSeparatorFixer::checkSeparator() so that
only unformatted integer literals will be formatted.

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

19 months ago[examples] Add export_executable_symbols to HowToUseLLJIT example.
Lang Hames [Sun, 26 Mar 2023 18:27:54 +0000 (18:27 +0000)]
[examples] Add export_executable_symbols to HowToUseLLJIT example.

LLJIT needs access to symbols (e.g. llvm_orc_registerEHFrameSectionWrapper)
that will be defined in the executable when LLVM is linked statically.

Should fix https://github.com/llvm/llvm-project/issues/61712.

19 months ago[clang-tidy] Add option to ignore user-defined literals in readability-magic-numbers
Carlos Galvez [Sun, 26 Mar 2023 13:06:37 +0000 (13:06 +0000)]
[clang-tidy] Add option to ignore user-defined literals in readability-magic-numbers

Some user-defined literals operate on implementation-defined types, like
"unsigned long long" and "long double", which are not well supported by
this check. Currently, the check gives warnings when using UDLs, without
giving possiblity to the user to whitelist common UDLs. A good compromise
until a proper fix is found (if any) is to allow the user to disable
warnings on UDLs.

Partially fixes #61656

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

19 months ago[clang][RISCV] Fix ABI lowering for _Float16 for FP ABIs
Alex Bradbury [Sun, 26 Mar 2023 15:18:47 +0000 (16:18 +0100)]
[clang][RISCV] Fix ABI lowering for _Float16 for FP ABIs

For trivial cases (`_Float16` as a standalone argument), it was
previously correctly lowered to half. But the logic for catching cases
involving structs was gated off, as at the time that logic was written
the ABI for half was unclear.

This patch fixes that and adds a release note.

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

19 months ago[clang][RISCV][test] Add test cases for empty structs and the FP calling conventions
Alex Bradbury [Sun, 26 Mar 2023 15:11:18 +0000 (16:11 +0100)]
[clang][RISCV][test] Add test cases for empty structs and the FP calling conventions

As reported in https://github.com/llvm/llvm-project/issues/58929, Clang
currently differs from GCC in the handling of empty structs. This commit
adds some test coverage for the handling of such structs.

A follow-up patch implements a fix to match g++.

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

19 months ago[RISCV] Make RISCVISAInfo::toFeatureVector ignore unsupported extensions
Alex Bradbury [Sun, 26 Mar 2023 14:50:13 +0000 (15:50 +0100)]
[RISCV] Make RISCVISAInfo::toFeatureVector ignore unsupported extensions

parseNormalizedArchString adds a code path that creates a RISCVISAInfo
including extensions that may not be supported by LLVM (rather than
erroring or just ignoring them). Therefore, toFeatureVector needs to
check the extension is supported in order to avoid creating unrecognised
feature strings.

This change shouldn't impact any code paths used outside of test code,
but this will be relied upon by the next patch which moves llvm-objdump
and related tools over to using parseNormalizedArchString.

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

19 months ago[include-cleaner] Fix crash on unresolved headers
Kadir Cetinkaya [Sun, 26 Mar 2023 14:27:52 +0000 (16:27 +0200)]
[include-cleaner] Fix crash on unresolved headers

Make sure unresolved headers are not analyzed as part of unused
includes.

Also introduces a testing fixture for analyze tests

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

19 months ago[Local] Preserve !nonnull only when K dominate J and K has a !noundef
luxufan [Sun, 26 Mar 2023 14:25:21 +0000 (22:25 +0800)]
[Local] Preserve !nonnull only when K dominate J and K has a !noundef

Similar to D142687

Reviewed By: nikic

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

19 months ago[gn build] Port 52296f5ed88b
LLVM GN Syncbot [Sun, 26 Mar 2023 13:35:12 +0000 (13:35 +0000)]
[gn build] Port 52296f5ed88b

19 months agoAMDGPU: Add baseline test for SWDEV-380865
Matt Arsenault [Mon, 6 Mar 2023 14:40:25 +0000 (10:40 -0400)]
AMDGPU: Add baseline test for SWDEV-380865

This demonstrates really bad rematerialization support
for 64-bit constants which need to be split into 32-bit pieces.

19 months agoAMDGPU: Convert test to generated checks
Matt Arsenault [Fri, 24 Mar 2023 11:21:56 +0000 (07:21 -0400)]
AMDGPU: Convert test to generated checks

19 months agoInstCombine: Introduce new is.fpclass from logic of fcmp
Matt Arsenault [Fri, 3 Feb 2023 20:47:50 +0000 (16:47 -0400)]
InstCombine: Introduce new is.fpclass from logic of fcmp

Fixes regressions from patch to turn more classes into fcmp.

19 months ago[clang-tidy] Correct union & macros handling in modernize-use-equals-default
Piotr Zegar [Sun, 26 Mar 2023 13:22:43 +0000 (13:22 +0000)]
[clang-tidy] Correct union & macros handling in modernize-use-equals-default

To this moment this check were ignoring only inline
union special members, From now also out-of-line
special members going to be ignored. Also extended
support for IgnoreMacros to cover also macros used
inside a body, or used preprocesor directives.

Fixes:
 - https://github.com/llvm/llvm-project/issues/28300
 - https://github.com/llvm/llvm-project/issues/40554

Reviewed By: alexander-shaposhnikov

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

19 months ago[clang-tidy] Add readability-avoid-unconditional-preprocessor-if check
Piotr Zegar [Sun, 26 Mar 2023 13:18:47 +0000 (13:18 +0000)]
[clang-tidy] Add readability-avoid-unconditional-preprocessor-if check

Check flags always enabled or disabled code blocks in preprocessor '#if'
conditions, such as '#if 0' and '#if 1' etc.

Reviewed By: carlosgalvezp

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

19 months ago[flang][nfc] Remove unused codes in idioms.h
Shao-Ce SUN [Thu, 23 Mar 2023 10:23:54 +0000 (18:23 +0800)]
[flang][nfc] Remove unused codes in idioms.h

Since D137859, these have not been used.

Reviewed By: Renaud-K

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

19 months ago[ThinLTO] Only import for non-prevailing interposable global variables
Shoaib Meenai [Sat, 25 Mar 2023 00:34:14 +0000 (17:34 -0700)]
[ThinLTO] Only import for non-prevailing interposable global variables

This logic was added in https://reviews.llvm.org/D95943 specifically to
handle an issue for non-prevailing global variables. It turns out that
it adds a new issue for prevailing glboal variables, since those could
be replaced by an available_externally definition and hence incorrectly
omitted from the output object file. Limit the import to non-prevailing
global variables to fix this, as suggested by @tejohnson.

The bulk of the diff is mechanical changes to thread isPrevailing
through to where it's needed and ensure it's available before the
relevant calls; the actual logic change itself is straightforward.

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

Reviewed By: tejohnson

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

19 months ago[RISCV] Move PseudoRVVInitUndef pseudos to RISCVInstrInfoVPseudos.td. NFC
Craig Topper [Sun, 26 Mar 2023 02:18:15 +0000 (19:18 -0700)]
[RISCV] Move PseudoRVVInitUndef pseudos to RISCVInstrInfoVPseudos.td. NFC

19 months agoRevert "[llvm] Teach GlobalDCE about dso_local_equivalent"
Leonard Chan [Sun, 26 Mar 2023 01:47:10 +0000 (01:47 +0000)]
Revert "[llvm] Teach GlobalDCE about dso_local_equivalent"

This reverts commit 86dbcafd0cdc88ae85896c6f12ecaa6006aeba54.

Reverting since this depends on db288184765c0b4010060ebea1f6de3ac1f66445
which broke our lto builders reported by fxbug.dev/12380.

19 months agoRevert "[llvm] Teach whole program devirtualization about relative vtables"
Leonard Chan [Sun, 26 Mar 2023 01:38:08 +0000 (01:38 +0000)]
Revert "[llvm] Teach whole program devirtualization about relative vtables"

This reverts commit db288184765c0b4010060ebea1f6de3ac1f66445.

Reverting since it broke our lto builders reported by fxbug.dev/123807.

19 months ago[clang-format] Treat NTTP default values as expressions
Emilia Dreamer [Sun, 26 Mar 2023 01:39:03 +0000 (04:39 +0300)]
[clang-format] Treat NTTP default values as expressions

clang-format already has logic to threat the right-hand side of an
equals sign. This patch applies that logic to template defaults,
which are likely to be non-template type parameters in which case the
default value should be annotated as an expression.
This should mostly only ever apply to bool and &&.

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

Reviewed By: MyDeveloperDay, owenpan

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

19 months ago[clang-format] Don't wrap struct return types as structs
Emilia Dreamer [Sun, 26 Mar 2023 01:38:42 +0000 (04:38 +0300)]
[clang-format] Don't wrap struct return types as structs

When using BraceWrapping.AfterClass or BraceWrapping.AfterStruct, the
token annotator relies on the first token of the line to determine if
we're dealing with a struct or class, however, this check is faulty if
it's actually a function with an elaborated struct/class return type, as
is common in C.

This patch skips the check if the brace is already annotated as
FunctionLBrace, in which case we already know it's a function and should
be treated as such.

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

Reviewed By: HazardyKnusperkeks, owenpan

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

19 months ago[clang-format] Annotate lambdas with requires clauses.
Emilia Dreamer [Sun, 26 Mar 2023 01:37:59 +0000 (04:37 +0300)]
[clang-format] Annotate lambdas with requires clauses.

The C++ grammar allows lambdas to have a *requires-clause* in two
places, either directly after the *template-parameter-list*, such as:

`[] <typename T> requires foo<T> (T t) { ... };`

Or, at the end of the *lambda-declarator* (before the lambda's body):

`[] <typename T> (T t) requires foo<T> { ... };`

Previously, these cases weren't handled at all, resulting in weird
results.

Note that this commit only handles token annotation, so the actual
formatting still ends up suboptimal. This is mostly because I do not yet
know how to approach making the requires clause formatting of lambdas
match the formatting for functions.

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

Reviewed By: HazardyKnusperkeks, owenpan

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

19 months ago[MLIR][Affine] add memory effect traits for dmaOp
lipracer [Sun, 26 Mar 2023 01:07:27 +0000 (06:37 +0530)]
[MLIR][Affine] add memory effect traits for dmaOp

DmaOp will read the source buffer and write the destination buffer so need to add some traits for it.

Reviewed By: bondhugula

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

19 months ago[MachineCopyPropagation] Pass DestSourcePair to isBackwardPropagatableCopy. NFC
Craig Topper [Sun, 26 Mar 2023 00:20:08 +0000 (17:20 -0700)]
[MachineCopyPropagation] Pass DestSourcePair to isBackwardPropagatableCopy. NFC

Instead of calling isCopyInstr again, just pass the DestSourcePair
from the isCopyInstr call from the caller.

19 months ago[ARM] Add some tests for non-zero VCTP generation. NFC
David Green [Sat, 25 Mar 2023 23:33:25 +0000 (23:33 +0000)]
[ARM] Add some tests for non-zero VCTP generation. NFC

See D146517.

19 months ago[libc] Add missing cast in fputil sqrt code
Roland McGrath [Sat, 25 Mar 2023 21:30:02 +0000 (14:30 -0700)]
[libc] Add missing cast in fputil sqrt code

A cast is necessary to avoid implicit narrowing warnings
when those are enabled.

Reviewed By: abrachet

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

19 months ago[MLIR][Affine] Fix/improve affine sibling fusion
Uday Bondhugula [Sat, 25 Mar 2023 22:05:03 +0000 (03:35 +0530)]
[MLIR][Affine] Fix/improve affine sibling fusion

The sibling fusion profitability checks shouldn't rely on the presence
of a store op in the sibling. The reuse is between the loads.

Fixes issues raised at https://discourse.llvm.org/t/understanding-the-affine-loop-fusion-pass/69452

Reviewed By: dcaballe

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

19 months ago[Matrix] Extend test coverage for dot product lowering.
Florian Hahn [Sat, 25 Mar 2023 21:30:20 +0000 (21:30 +0000)]
[Matrix] Extend test coverage for dot product lowering.

Extra tests:
* result is used by instruction
* constant vector operands
* multiply fed by other math instructions
* extra test with larger stride

19 months ago[Matrix] Split up dot product tests into integer and float variants.
Florian Hahn [Sat, 25 Mar 2023 21:23:00 +0000 (21:23 +0000)]
[Matrix] Split up dot product tests into integer and float variants.

To avoid the individual files getting too big with further additions.

19 months ago[clang-format] Handle Verilog assign statements
sstwcw [Sat, 25 Mar 2023 21:12:49 +0000 (21:12 +0000)]
[clang-format] Handle Verilog assign statements

Reviewed By: MyDeveloperDay

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

19 months ago[clang-format] More work on space around operators in Verilog
sstwcw [Sat, 25 Mar 2023 21:12:13 +0000 (21:12 +0000)]
[clang-format] More work on space around operators in Verilog

before:
```
(opcode *>o1) = 6.1;
a inside{b, c};
x = { >> {j}};
```

after:
```
(opcode *> o1) = 6.1;
a inside {b, c};
x = {>>{j}};
```

Reviewed By: MyDeveloperDay

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

19 months ago[AMDGPUUnifyDivergentExitNodes] Add NewPM support
Anshil Gandhi [Sat, 25 Mar 2023 19:42:31 +0000 (13:42 -0600)]
[AMDGPUUnifyDivergentExitNodes] Add NewPM support

Meanwhile, use UniformityAnalysis instead of LegacyDivergenceAnalysis to collect divergence info.

Reviewed By: arsenm, sameerds

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

19 months ago[clang][NFC] Fix location of 2>&1 in a few -print tests
Louis Dionne [Wed, 15 Mar 2023 17:46:51 +0000 (13:46 -0400)]
[clang][NFC] Fix location of 2>&1 in a few -print tests

While it's apparently valid to place Bash redirections anywhere in a
command-line, it is by far most frequently placed last. This changes
a few tests that did not conform to this convention and which I
originally thought were wrong.

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

19 months ago[libc++] Add UNSUPPORTED annotations to more <format> tests on GCC 12
Louis Dionne [Sat, 25 Mar 2023 18:36:40 +0000 (14:36 -0400)]
[libc++] Add UNSUPPORTED annotations to more <format> tests on GCC 12

Those seem to have been failing for a while but we might not have noticed
because of the recent CI instability issues. I'm marking them as unsupported
to try to get the CI functional again, especially since the majority of
<format> tests are already not working on GCC 12.

19 months ago[libc] Define LLVM_LIBC_FUNCTION with a layer of macro expansion
Roland McGrath [Sat, 25 Mar 2023 03:29:08 +0000 (20:29 -0700)]
[libc] Define LLVM_LIBC_FUNCTION with a layer of macro expansion

Move the real LLVM_LIBC_FUNCTION macro definitions to
LLVM_LIBC_FUNCTION_IMPL and make LLVM_LIBC_FUNCTION a wrapper to
expand macros in its arguments.  This makes it possible to
compile libc implementation and test files with -Dfunc=othername.

Reviewed By: sivachandra

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

19 months ago[libc++][NFC] Improve documentation for running BuildKite agent locally
Louis Dionne [Sat, 25 Mar 2023 17:55:04 +0000 (13:55 -0400)]
[libc++][NFC] Improve documentation for running BuildKite agent locally

19 months ago[Docs][llvm-mc] Add documentation on --filetype flag
Aiden Grossman [Sat, 25 Mar 2023 17:15:01 +0000 (17:15 +0000)]
[Docs][llvm-mc] Add documentation on --filetype flag

Currently the filetype flag is not documented, and knowing the behavior
of this flag is fairly important for doing anything other than
disassembling to text assembly.

Reviewed By: lattner

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

19 months ago[lldb] Move #include out of namespace lldb. NFC.
Benjamin Kramer [Sat, 25 Mar 2023 12:33:17 +0000 (13:33 +0100)]
[lldb] Move #include out of namespace lldb. NFC.

Including system headers in a namespace is not safe.

19 months ago[Clang] Update DR status page to reflect Core Issues List 111.
Corentin Jabot [Sat, 25 Mar 2023 12:15:08 +0000 (13:15 +0100)]
[Clang] Update DR status page to reflect Core Issues List 111.

19 months ago[RISCV] Support vector crypto extension ISA string and assembly
4vtomat [Wed, 26 Oct 2022 02:09:21 +0000 (19:09 -0700)]
[RISCV] Support vector crypto extension ISA string and assembly

LLVM implements the 0.3 draft specification:
https://github.com/riscv/riscv-crypto/releases/download/v20230206/riscv-crypto-spec-vector.pdf
, and current vector crypto extension version can be found in:
https://github.com/riscv/riscv-crypto.

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

19 months ago[mlir][Analysis] Fix assertion in FlatLinearConstraints
Matthias Springer [Sat, 25 Mar 2023 11:17:45 +0000 (12:17 +0100)]
[mlir][Analysis] Fix assertion in FlatLinearConstraints

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

19 months ago[RISCV][RISCVISelLowering] Add tail agnostic policy operand to VECREDUCE instructions
Nitin John Raj [Thu, 23 Mar 2023 19:55:58 +0000 (12:55 -0700)]
[RISCV][RISCVISelLowering] Add tail agnostic policy operand to VECREDUCE instructions

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

19 months ago[mlir][Vector] Use a RewriterBase for IR rewrites in VectorTransferOpTransforms
Nicolas Vasilache [Sat, 25 Mar 2023 07:25:28 +0000 (00:25 -0700)]
[mlir][Vector] Use a RewriterBase for IR rewrites in VectorTransferOpTransforms

19 months ago[X86] Fix the incorrect displacement for prolog/epilog
Luo, Yuanke [Sat, 25 Mar 2023 01:59:31 +0000 (09:59 +0800)]
[X86] Fix the incorrect displacement for prolog/epilog

The bug is introduced in rGe4ceb5a7bb9b which set the wrong offset from
the stack base. This patch is to fix the bug.

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

19 months ago[libc] Remove unused aarch64 sqrt and sqrtf implementations
Roland McGrath [Sat, 25 Mar 2023 03:59:17 +0000 (20:59 -0700)]
[libc] Remove unused aarch64 sqrt and sqrtf implementations

These files are not used because the generic sqrt and sqrtf
functions already go through internal layers that reach the
machine-specific internal implemenations.

Reviewed By: sivachandra

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

19 months ago[RISCV] Make RISCVMergeBaseOffsetOpt a class instead of a struct. NFC
Craig Topper [Sat, 25 Mar 2023 02:59:12 +0000 (19:59 -0700)]
[RISCV] Make RISCVMergeBaseOffsetOpt a class instead of a struct. NFC

This lets us remove 'private:' from the top of the class.
While there collect the other private member variable at the top
of the class.

19 months ago[Analysis] Fix use-after-scope in CFGElement dump
Sam McCall [Sat, 25 Mar 2023 03:32:52 +0000 (04:32 +0100)]
[Analysis] Fix use-after-scope in CFGElement dump

19 months ago[dataflow] handle missing case in value debug strings
Sam McCall [Wed, 22 Mar 2023 12:16:17 +0000 (13:16 +0100)]
[dataflow] handle missing case in value debug strings

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

19 months agoRevert "[OpenMP] Ensure memory fences are created with barriers for AMDGPUs"
Ye Luo [Sat, 25 Mar 2023 02:10:03 +0000 (21:10 -0500)]
Revert "[OpenMP] Ensure memory fences are created with barriers for AMDGPUs"

This reverts commit 36d6217c4eb02c15168bf74c9f7ef44ea4fb7e41.

19 months ago[OpenMP] Ensure memory fences are created with barriers for AMDGPUs
Ye Luo [Sat, 25 Mar 2023 01:36:51 +0000 (20:36 -0500)]
[OpenMP] Ensure memory fences are created with barriers for AMDGPUs

It turns out that the `__builtin_amdgcn_s_barrier()` alone does not emit
a fence. We somehow got away with this and assumed it would work as it
(hopefully) is correct on the NVIDIA path where we just emit a
`__syncthreads`. After talking to @arsenm we now (mostly) align with the
OpenCL barrier implementation [1] and emit explicit fences for AMDGPUs.

It seems this was the underlying cause for #59759, but I am not 100%
certain. There is a chance this simply hides the problem.

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

[1] https://github.com/RadeonOpenCompute/ROCm-Device-Libs/blob/07b347366eb2c6ebc3414af323c623cbbbafc854/opencl/src/workgroup/wgbarrier.cl#L21

Reviewed By: ye-luo

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

19 months ago[libc] Implement the RPC client / server for NVPTX
Joseph Huber [Fri, 24 Mar 2023 20:53:05 +0000 (15:53 -0500)]
[libc] Implement the RPC client / server for NVPTX

This patch adds the necessary code to impelement the existing RPC client
/ server interface when targeting NVPTX GPUs. This follows closely to
the implementation in the AMDGPU version. This does not yet enable unit
testing as the `nvlink` linker does not support static libraries. So
that will need to be worked around.

I am ignoring the RPC duplication between the AMDGPU and NVPTX loaders. This
will be changed completely later so there's no point unifying the code at this
stage. The implementation was tested manually with the following file and
compilation flags.

```
namespace __llvm_libc {
void write_to_stderr(const char *msg);
void quick_exit(int);
} // namespace __llvm_libc

using namespace __llvm_libc;

int main(int argc, char **argv, char **envp) {
  for (int i = 0; i < argc; ++i) {
    write_to_stderr(argv[i]);
    write_to_stderr("\n");
  }
  quick_exit(255);
}
```

```
$ clang++ crt1.o rpc_client.o quick_exit.o io.o main.cpp --target=nvptx64-nvidia-cuda -march=sm_70 -o image
$ ./nvptx_loader image 1 2 3
image
1
2
3
$ echo $?
255
```

Depends on D146681

Reviewed By: jdoerfert

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

19 months ago[libc] Add a loader utility for NVPTX architectures for testing
Joseph Huber [Thu, 23 Mar 2023 01:00:13 +0000 (20:00 -0500)]
[libc] Add a loader utility for NVPTX architectures for testing

This patch adds a loader utility targeting the CUDA driver API to launch
NVPTX images called `nvptx_loader`. This takes a GPU image on the
command line and launches the `_start` kernel with the appropriate
arguments. The `_start` kernel is provided by the already implemented
`nvptx/start.cpp`. So, an application with a `main` function can be
compiled and run as follows.

```
clang++ --target=nvptx64-nvidia-cuda main.cpp crt1.o -march=sm_70 -o image
./nvptx_loader image args to kernel
```

This implementation is not tested and does not yet support RPC. This
requires further development to work around NVIDIA specific limitations
in atomics and linking.

Reviewed By: jdoerfert

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

19 months ago[lldb][NFC] Remove outdated TODO in Log.h
Alex Langford [Sat, 25 Mar 2023 00:53:52 +0000 (17:53 -0700)]
[lldb][NFC] Remove outdated TODO in Log.h

The code this TODO was referring to was removed in
c34698a811b137b705738b7f8d193bc896027fb8.

19 months ago[lldb][NFC] Update and re-organize lldb-types.h
Alex Langford [Sat, 25 Mar 2023 00:28:13 +0000 (17:28 -0700)]
[lldb][NFC] Update and re-organize lldb-types.h

- Address the TODO by identifying and documenting all types needed by a
  host system in order for lldb to work correctly
- Reformatted the comments to be easier to read
- Put everything inside of one namespace declaration instead of having
  multiple of the same
- Move the macros up to be right under the accompanying definitions

19 months ago[lldb] Remove errant call to SBReproducer.SetWorkingDirectory
Jonas Devlieghere [Sat, 25 Mar 2023 00:31:39 +0000 (17:31 -0700)]
[lldb] Remove errant call to SBReproducer.SetWorkingDirectory

The old reproducer functionality has been removed. Remove this call as
it's now just a NO-OP.

19 months ago[RISCV] Made fsqrtv pseudoinstruction SEW-aware
Nitin John Raj [Fri, 24 Feb 2023 21:45:31 +0000 (13:45 -0800)]
[RISCV] Made fsqrtv pseudoinstruction SEW-aware

19 months ago[RISCV] Made division pseudoinstructions SEW-aware
Nitin John Raj [Fri, 24 Feb 2023 21:26:00 +0000 (13:26 -0800)]
[RISCV] Made division pseudoinstructions SEW-aware

19 months ago[RISCV] Made vrgather.vv and vrgatherei16 pseudoinstructions SEW-aware
Nitin John Raj [Fri, 24 Feb 2023 21:31:15 +0000 (13:31 -0800)]
[RISCV] Made vrgather.vv and vrgatherei16 pseudoinstructions SEW-aware

19 months ago[RISCV] Made vcompress pseudoinstruction SEW-aware
Nitin John Raj [Fri, 24 Feb 2023 19:40:38 +0000 (11:40 -0800)]
[RISCV] Made vcompress pseudoinstruction SEW-aware

19 months ago[RISCV][NFC] Remove SEW suffix from pseudoinstructions
Nitin John Raj [Fri, 24 Feb 2023 19:18:55 +0000 (11:18 -0800)]
[RISCV][NFC] Remove SEW suffix from pseudoinstructions

19 months ago[RISCV][NFC] Added possible SEWs associated with a given LMUL
Nitin John Raj [Fri, 24 Feb 2023 19:17:29 +0000 (11:17 -0800)]
[RISCV][NFC] Added possible SEWs associated with a given LMUL

19 months ago[RISCV][NFC] Broke ReadVRGatherVV into ReadVRGatherVV_data and ReadVRGatherVV_index...
Nitin John Raj [Mon, 6 Mar 2023 19:09:02 +0000 (11:09 -0800)]
[RISCV][NFC] Broke ReadVRGatherVV into ReadVRGatherVV_data and ReadVRGatherVV_index to separate the reads for VRGatherVV

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

19 months ago[RISCV][NFC] Renamed [Read/Write]VGather* -> [Read/Write]VRGatherV*
Nitin John Raj [Mon, 6 Mar 2023 18:37:11 +0000 (10:37 -0800)]
[RISCV][NFC] Renamed [Read/Write]VGather* -> [Read/Write]VRGatherV*

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

19 months ago[llvm-jitlink] Remove unnecessary header include left in 01bdd8cffca.
Lang Hames [Fri, 24 Mar 2023 23:14:58 +0000 (16:14 -0700)]
[llvm-jitlink] Remove unnecessary header include left in 01bdd8cffca.

19 months ago[llvm-jitlink] Rename -show-graph option to -show-graphs, make it a regex.
Lang Hames [Fri, 24 Mar 2023 21:43:32 +0000 (14:43 -0700)]
[llvm-jitlink] Rename -show-graph option to -show-graphs, make it a regex.

The original -show-graph option dumped the LinkGraph for all graphs loaded into
the session, but can make it difficult to see small graphs (e.g. reduced test
cases) among the surrounding larger files (especially the ORC runtime).

The new -show-graphs option takes a regex and dumps only those graphs matching
the regex. This allows testcases to specify exactly which graphs to dump.

19 months ago[Fuchsia] Add FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS.
Daniel Thornburgh [Wed, 22 Mar 2023 18:02:41 +0000 (11:02 -0700)]
[Fuchsia] Add FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS.

This flag causes the toolchain distribution to be built using LLVM
CMake's multiple distribution feature. The distribution* family of CMake
targets would be replaced with the toolchain-distribution* family.

This shouldn't otherwise affect the semantics of the build, but it sets
up the ability to split out the LLDB build from the main distribution
used by Fuchsia.

Reviewed By: phosek

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

19 months ago[mlir][sparse] Factoring out LoopEmitter::isValidLevel
wren romano [Fri, 24 Mar 2023 22:24:02 +0000 (15:24 -0700)]
[mlir][sparse] Factoring out LoopEmitter::isValidLevel

Depends On D146674

Reviewed By: aartbik

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

19 months ago[lldb][NFC] Remove outdated TODOs from API headers
Alex Langford [Fri, 24 Mar 2023 22:47:27 +0000 (15:47 -0700)]
[lldb][NFC] Remove outdated TODOs from API headers

There were added when I removed the swig interface files in
662548c82683bd8657a3179afee693c4965a3dfd. However, they mostly meant for
me to better track the differences between the existing API headers and
bindings interfaces. There's nothing actionable about these so I remove
them.

19 months ago[mlir][linalg] Convert input type to accumulator type in im2col patterns
Quinn Dawkins [Sun, 19 Mar 2023 00:14:57 +0000 (20:14 -0400)]
[mlir][linalg] Convert input type to accumulator type in im2col patterns

When the input types don't match the accumulator type in named
convolution ops there is supposed to be a conversion to the accumulator
type before the multiply and accumulate.

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

19 months ago[mlir][vector] Hoist redundant singleton vector transfer reads
harsh-nod [Fri, 24 Mar 2023 17:34:17 +0000 (10:34 -0700)]
[mlir][vector] Hoist redundant singleton vector transfer reads

For singleton transfer reads, we allow hoisting them out
of the enclosing loop if its users are either transfer reads
or memory effect free.

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

19 months ago[mlir][sparse] moving kInvalidId into "detail" namespace
wren romano [Fri, 24 Mar 2023 21:46:07 +0000 (14:46 -0700)]
[mlir][sparse] moving kInvalidId into "detail" namespace

In the next few commits I will be converting the various Merger identifier typedefs into newtypes; and once that's done, the `kInvalidId` constant will only be used internally and therefore does not need to be part of the public `mlir::sparse_tensor` namespace.

Depends On D146673

Reviewed By: aartbik

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

19 months ago[mlir][sparse] Updating TensorExp ctor to catch unknown TensorExp::Kind
wren romano [Fri, 24 Mar 2023 21:34:20 +0000 (14:34 -0700)]
[mlir][sparse] Updating TensorExp ctor to catch unknown TensorExp::Kind

Depends On D146562

Reviewed By: aartbik

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

19 months ago[mlir][sparse] Misc cleanup in Merger.h
wren romano [Fri, 24 Mar 2023 21:24:27 +0000 (14:24 -0700)]
[mlir][sparse] Misc cleanup in Merger.h

* Moving the `Children` class to be nested under `TensorExp`.
* Marking `TensorExp`, `TensorExp::Children`, and `LatPoint` as final.

Depends On D146083

Reviewed By: aartbik

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

19 months ago[mlir][sparse] Updating the `Merger::{exp,lat,set}` methods to return const
wren romano [Fri, 24 Mar 2023 21:17:11 +0000 (14:17 -0700)]
[mlir][sparse] Updating the `Merger::{exp,lat,set}` methods to return const

This helps the `Merger` maintain invariants, as well as clarifying the immutability of the underlying objects (with the one exception of `TensorExp::val`).

Depends On: D146559

Reviewed By: aartbik

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

19 months ago[lldb] Add ability to hide the root name of a value
Dave Lee [Fri, 24 Mar 2023 04:43:32 +0000 (21:43 -0700)]
[lldb] Add ability to hide the root name of a value

When printing a value, allow the root value's name to be elided, without omiting the
names of child values.

At the API level, this adds `SetHideRootName()`, which joins the existing
`SetHideName()` function.

This functionality is used by `dwim-print` and `expression`.

Fixes an issue identified by @jgorbe in https://reviews.llvm.org/D145609.

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

19 months ago[libc][Obvious] Remove a compile opt to x86_64 longjmp in a previous commit.
Siva Chandra Reddy [Fri, 24 Mar 2023 20:24:57 +0000 (20:24 +0000)]
[libc][Obvious] Remove a compile opt to x86_64 longjmp in a previous commit.

The option -fno-omit-frame-pointer was accidentally added to the x86_64
longjmp target. This change not only removes it, but makes it
-fomit-frame-pointer.

19 months agoFix mlir/lib/Bindings/Python/IRTypes.cpp for Float8E4M3B11FNUZType
David Majnemer [Fri, 24 Mar 2023 20:42:47 +0000 (20:42 +0000)]
Fix mlir/lib/Bindings/Python/IRTypes.cpp for Float8E4M3B11FNUZType

19 months ago[APFloat] Add E4M3B11FNUZ
David Majnemer [Thu, 9 Mar 2023 23:10:57 +0000 (23:10 +0000)]
[APFloat] Add E4M3B11FNUZ

X. Sun et al. (https://dl.acm.org/doi/10.5555/3454287.3454728) published
a paper showing that an FP format with 4 bits of exponent, 3 bits of
significand and an exponent bias of 11 would work quite well for ML
applications.

Google hardware supports a variant of this format where 0x80 is used to
represent NaN, as in the Float8E4M3FNUZ format. Just like the
Float8E4M3FNUZ format, this format does not support -0 and values which
would map to it will become +0.

This format is proposed for inclusion in OpenXLA's StableHLO dialect: https://github.com/openxla/stablehlo/pull/1308

As part of inclusion in that dialect, APFloat needs to know how to
handle this format.

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

19 months ago[Support] Fix warnings
Kazu Hirata [Fri, 24 Mar 2023 20:01:52 +0000 (13:01 -0700)]
[Support] Fix warnings

This patch fixes:

  llvm/unittests/Support/ScopedPrinterTest.cpp:519:20: error: unused
  variable 'InfDouble' [-Werror,-Wunused-variable]

  llvm/unittests/Support/ScopedPrinterTest.cpp:520:16: error: unused
  variable 'NaNDouble' [-Werror,-Wunused-variable]

  llvm/unittests/Support/ScopedPrinterTest.cpp:516:15: error: unused
  variable 'NaNFloat' [-Werror,-Wunused-variable]

  llvm/unittests/Support/ScopedPrinterTest.cpp:515:19: error: unused
  variable 'InfFloat' [-Werror,-Wunused-variable]

Since commit fa56e362af475e0758cfb41c42f78db50da7235c has temporarily
disabled tests involving these constants, this patch simply comments
them out instead of removing them.