platform/upstream/llvm.git
19 months ago[libc] Only add extra runtime dependencies if the target exists
Joseph Huber [Wed, 5 Apr 2023 20:30:48 +0000 (15:30 -0500)]
[libc] Only add extra runtime dependencies if the target exists

Summary:
If the target for these tools doesn't exist we should simply assume that
they will be provided externally. This allows building `libc` standalone
with an external installation of `clang`.

19 months agoUpdate clang :: Driver/debug-options.c to fix the buildbots
Matthew Voss [Wed, 5 Apr 2023 20:25:04 +0000 (13:25 -0700)]
Update clang :: Driver/debug-options.c to fix the buildbots

The format of the LTO debug options generated for orbis-ld changed,
breaking this test.

https://lab.llvm.org/buildbot/#/builders/230/builds/11367

19 months ago[ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD_LOCAL inside unit test.
Alexey Lapshin [Wed, 5 Apr 2023 18:45:00 +0000 (20:45 +0200)]
[ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD_LOCAL inside unit test.

Not all platform support C++11 thread_local. Use portable
LLVM_THREAD_LOCAL macro instead.

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

19 months ago[OpenMP] Add tool dependencies in runtimes mode
Joseph Huber [Wed, 5 Apr 2023 19:24:34 +0000 (14:24 -0500)]
[OpenMP] Add tool dependencies in runtimes mode

The OpenMP offloading device runtime depends on multiple tools. We
should ensure that these tools are build before invoking the OpenMP
build.

Reviewed By: tra

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

19 months ago[libc] Search for the CUDA patch explicitly when testing
Joseph Huber [Wed, 5 Apr 2023 19:16:53 +0000 (14:16 -0500)]
[libc] Search for the CUDA patch explicitly when testing

The packaged version of the `libc` library does not depend on the CUDA
installation because it only uses `clang` and emits LLVM-IR. However,
for testing we directly need the CUDA toolkit to emit and execute the
files. This patch explicitly passes `--cuda-path` to the relevant
compilations for NVPTX testing.

Reviewed By: tra

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

19 months ago[CMake] Support runtimes targets without specifying triple
Petr Hosek [Wed, 30 Jun 2021 06:34:18 +0000 (23:34 -0700)]
[CMake] Support runtimes targets without specifying triple

Currently, for BUILTIN_TARGETS and RUNTIME_TARGETS you can either use
the special "default" value, or a target triple.

For the "default" value, we don't set any target triple and passthrough
a subset of CMake variables into the subbuild. This is typically used
on Darwin where we build universal binaries and a single target triple
therefore isn't sufficient.

For the target triple value, you can set arbitrary CMake variables
through RUNTIMES_<target>_<variable>, but we always set target triple
to <target>. This gives more flexibility, because we can precisely
control what variables are set in the subbuild, but is unsuitable for
platforms like Darwin.

To address this, we would like to introduce a third option which is
similar to the second option, except we won't set target triple in
the subbuild (you can always do so yourself by setting the appropriate
CMake variable, e.g. RUNTIMES_<name>_CMAKE_C_COMPILER_TARGET=<triple>).

This change is a first step in that direction, by eliminating the support
of target triples from builtin_register_target and runtime_register_target
helper functions.

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

19 months ago[NFC][clang] Fix Coverity static analyzer tool concerns about auto_causes_copy
Manna, Soumi [Wed, 5 Apr 2023 19:41:54 +0000 (15:41 -0400)]
[NFC][clang] Fix Coverity static analyzer tool concerns about auto_causes_copy

    Reported by Coverity:

    AUTO_CAUSES_COPY
    Unnecessary object copies can affect performance

    Inside FrontendActions.cpp file,
    In clang::DumpModuleInfoAction::ExecuteAction(): Using the auto keyword without an & causes the copy of an object of type pair.

    Inside ComputeDependence.cpp file,
    In clang::computeDependence(clang::OverloadExpr *, bool, bool, bool): Using the auto keyword without an & causes the copy of an object of type TemplateArgumentLoc.

    Reviewed By: erichkeane, aaron.ballman

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

19 months ago[PS4][clang] Fix the format of the LTO debug options passed to orbis-ld
Matthew Voss [Wed, 5 Apr 2023 19:57:21 +0000 (12:57 -0700)]
[PS4][clang] Fix the format of the LTO debug options passed to orbis-ld

Currently, we pass multiple LTO debug options to orbis-ld like this:

orbis-ld --lto=thin --lto-thin-debug-options=<arg1> --lto-thin-debug-options=<arg2> ...

When it should be like this:

orbis-ld --lto=thin "--lto-thin-debug-options= <arg1> <arg2>" ...

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

19 months ago[clang][deps] NFC: Make PCH test more debuggable
Jan Svoboda [Wed, 5 Apr 2023 19:27:07 +0000 (12:27 -0700)]
[clang][deps] NFC: Make PCH test more debuggable

Overwriting CDB files made it difficult to debug earlier clang-scan-deps invocations. This commit creates separate files for each.

19 months ago[clang][deps] NFC: Don't collect PCH input files
Jan Svoboda [Wed, 5 Apr 2023 19:25:10 +0000 (12:25 -0700)]
[clang][deps] NFC: Don't collect PCH input files

Since b4c83a13, PCH input files are no longer necessary.

19 months agoRemove unintended __sanitizer_get_allocation_bounds declaration
Thurston Dang [Mon, 3 Apr 2023 23:44:29 +0000 (23:44 +0000)]
Remove unintended __sanitizer_get_allocation_bounds declaration

This removes an unintentional function declaration, that was accidentally
added in D147005 (from an incomplete refactoring of __sanitizer_get_allocation_bounds).

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

19 months agoRevert "[clang][lit] Make LIT aware of env CLANG_CRASH_DIAGNOSTICS_DIR."
Francesco Petrogalli [Wed, 5 Apr 2023 18:53:20 +0000 (20:53 +0200)]
Revert "[clang][lit] Make LIT aware of env CLANG_CRASH_DIAGNOSTICS_DIR."

This reverts commit 029212617ca8bdedd949d17bf2d33750605ea607.

Reverting because of failures when setting
`CLANG_CRASH_DIAGNOSTICS_DIR` before invoking `ninja check-clang`.

19 months ago[libc][NFC] Rework generic memory operations
Guillaume Chatelet [Wed, 5 Apr 2023 18:47:39 +0000 (18:47 +0000)]
[libc][NFC] Rework generic memory operations

19 months agoAdd release note for D147569.
Zequan Wu [Wed, 5 Apr 2023 18:43:52 +0000 (14:43 -0400)]
Add release note for D147569.

19 months ago[Coverage] Fix crash when visiting PseudoObjectExpr.
Zequan Wu [Tue, 4 Apr 2023 20:40:11 +0000 (16:40 -0400)]
[Coverage] Fix crash when visiting PseudoObjectExpr.

This is a split of D147073.

Fixes #45481

Reviewed By: aaron.ballman

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

19 months ago[mlir][sparse][gpu] a first prototype sparse GPU code generator
Aart Bik [Mon, 3 Apr 2023 22:46:23 +0000 (15:46 -0700)]
[mlir][sparse][gpu] a first prototype sparse GPU code generator

This implements a proof-of-concept GPU code generator
to the sparse compiler pipeline, currently only capable
of generating CUDA threads for outermost parallel loops.

The objective, obviously, is to grow this concept
to a full blown GPU code generator, capable of the
right combinaton of code generation as well as exploiting
idiomatic kernels or vector specific libraries (think cuSparse).

Reviewed By: ThomasRaoux

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

19 months ago[Object] Refactor build ID parsing into Object lib.
Daniel Thornburgh [Mon, 3 Apr 2023 18:15:31 +0000 (11:15 -0700)]
[Object] Refactor build ID parsing into Object lib.

This makes parsing for build IDs in the markup filter slightly more
permissive, in line with fromHex.

It also removes the distinction between missing build ID and empty build
ID; empty build IDs aren't a useful concept, since their purpose is to
uniquely identify a binary. This removes a layer of indirection wherever
build IDs are obtained.

Reviewed By: jhenderson

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

19 months ago[lldb] Remove unused functions from RegisterContextLinux_x86
Pavel Labath [Wed, 5 Apr 2023 18:10:31 +0000 (20:10 +0200)]
[lldb] Remove unused functions from RegisterContextLinux_x86

These should be overridden by individual subclasses, they ended up here
because of copy-pasta.

19 months ago[dsymutil] Remove empty reproducer directory on exit
Keith Smiley [Tue, 4 Apr 2023 04:43:36 +0000 (21:43 -0700)]
[dsymutil] Remove empty reproducer directory on exit

In the case the reproducer isn't generated, we don't want to leave
around an empty temporary directory.

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

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

19 months ago[OpenMP][MLIR][Flang][bbc][Driver] Add OpenMP RTL Flags to Flang and generate omp...
Andrew Gozillon [Wed, 5 Apr 2023 17:34:57 +0000 (12:34 -0500)]
[OpenMP][MLIR][Flang][bbc][Driver] Add OpenMP RTL Flags to Flang and generate omp.FlagsAttr from them

This patch ports OpenMP RTL flags from the shared Clang compiler
options to Flang. As well as adding a limited subset to bbc.

This patch enables the flags below (and any equals or inverse variants)
for Flang that exist in Clang:

-fopenmp-target-debug
-fopenmp-assume-threads-oversubscription
-fopenmp-assume-teams-oversubscription
-fopenmp-assume-no-nested-parallelism
-fopenmp-assume-no-thread-state

For the bbc tool it only utilises the primary variants to minimize
additional complexity in the tool.

The patch also provides FlagAttr generation from these flags. Which
will be lowered to LLVM-IR in a subsequent patch.

Reviewers: kiranchandramohan, awarzynski

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

19 months ago[MSVC] Allow declaration of multi-dim 'property' array fields
Mike Rice [Wed, 5 Apr 2023 15:10:57 +0000 (08:10 -0700)]
[MSVC] Allow declaration of multi-dim 'property' array fields

MSVC allows declaration of multi-dim arrays like this:

__declspec(property(get=GetX, put=PutX)) int x[][][];

This syntax can appear in generated typelib headers.

Currently clang errors on declarators like this since it forms an array
type of incomplete array. Rather than try to handle such a type, ignore
adjacent empty chunks so this is treated as if there was only one empty
array chunk (i.e. int x[]).

The functionality to handle multi-dim subscripts of property fields
already works, but only if declared as a single-dim array.

19 months agoFix LLVM sphinx build
Aaron Ballman [Wed, 5 Apr 2023 17:25:07 +0000 (13:25 -0400)]
Fix LLVM sphinx build

This addresses issues found by:
https://lab.llvm.org/buildbot/#/builders/30/builds/33698

19 months agoAdd some additional comments to this test; NFC
Aaron Ballman [Wed, 5 Apr 2023 17:13:42 +0000 (13:13 -0400)]
Add some additional comments to this test; NFC

It isn't immediately obvious why that code should be accepted given the
wording of C2x 6.7.10p4, so this adds a comment explaining that there
is an existing extension to support zero-sized arrays in C, and that
empty initialization of an unbounded array in C++ deduces the array
extent as zero, so C is exposing the same extension as in C++.

19 months ago[flang][runtime] Support L editing of Logical
Shao-Ce SUN [Tue, 28 Mar 2023 16:38:18 +0000 (00:38 +0800)]
[flang][runtime] Support L editing of Logical

I tested gfortran and flang(old). https://godbolt.org/z/c89foro4G

Reviewed By: klausler

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

19 months ago[sanitizers] Simplify Explainer about dyld and weak overrides on Darwin. (NFC)
Roy Sundahl [Tue, 4 Apr 2023 13:09:58 +0000 (06:09 -0700)]
[sanitizers] Simplify Explainer about dyld and weak overrides on Darwin. (NFC)

Presenting more than one way to satisfy the single-weak-ref requirement leads to
confusing messaging for the end user. Use the introduction of a single unused
weak variable as the preferred solution. This differential modifies D146745.

rdar://103453678

Reviewed By: yln, thetruestblue

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

19 months ago[libc] fix strtofloat on large exponents
Michael Jones [Mon, 3 Apr 2023 21:00:43 +0000 (14:00 -0700)]
[libc] fix strtofloat on large exponents

Previously if you specified an exponent of more than 10000 in string to
float (e.g. "1e10001") it would treat it as 10000. A bug was discovered
where by having more than 10000 zeroes after a decimal point and an
exponent of more than 10000 this would cause the code to return the
incorrect value.

Reviewed By: lntue

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

19 months ago[RISCV][TTI] Cost model for SK_ExtractSubvector
Philip Reames [Wed, 5 Apr 2023 16:33:10 +0000 (09:33 -0700)]
[RISCV][TTI] Cost model for SK_ExtractSubvector

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

19 months ago[LV] Cleanup and reformatting for some debug messages. NFC
David Green [Wed, 5 Apr 2023 16:50:01 +0000 (17:50 +0100)]
[LV] Cleanup and reformatting for some debug messages. NFC

This is just some cleanup of various debug messages, pulled out of another
patch to simplify it a little.

19 months ago[SLP]Find reused scalars in buildvector sequences, if any.
Alexey Bataev [Mon, 20 Mar 2023 14:26:33 +0000 (07:26 -0700)]
[SLP]Find reused scalars in buildvector sequences, if any.

Patch generalizes analysis of scalars. The main part is outlined into
lambda, which can be used to find reused inserted scalars and emit
shuffle for them instead of multiple insertelement instructions, if the
permutation is found alreadyi. I.e. some scalars are transformed by the
permutation of previously vectorized nodes, and some are inserted
directly.

Reworked part of D110978

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

19 months ago[IVDescriptors] Add pointer InductionDescriptors with non-constant strides (try 2)
Philip Reames [Wed, 5 Apr 2023 16:26:17 +0000 (09:26 -0700)]
[IVDescriptors] Add pointer InductionDescriptors with non-constant strides (try 2)

(JFYI - This has been heavily reframed since original attempt at landing.)

This change updates the InductionDescriptor logic to allow matching a pointer IV with a non-constant stride, but also updates the LoopVectorizer to bailout on such descriptors by default. This preserves the default vectorizer behavior.

In review, it was pointed out that there's multiple unfortunate performance implications which need to be addressed before this can be enabled. Having a flag allows us to exercise the behavior, and write test cases for logic which is otherwise unreachable (or hard to reach).

This will also enable non-constant stride pointer recurrences for other consumers. I've audited said code, and don't see any obvious issues.

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

19 months ago[libunwind] Fix a case of inconsistent indentation. NFC.
Martin Storsjö [Sat, 1 Apr 2023 22:02:37 +0000 (01:02 +0300)]
[libunwind] Fix a case of inconsistent indentation. NFC.

19 months ago[JITLink][AArch32] Implement ELF::R_ARM_ABS32 after we stopped skipping debug info...
Stefan Gränitz [Tue, 4 Apr 2023 17:06:10 +0000 (19:06 +0200)]
[JITLink][AArch32] Implement ELF::R_ARM_ABS32 after we stopped skipping debug info sections

We create LinkGraph sections with NoAlloc lifetime now since f05ac803ffe76c7f4299a4e1288cc6bb8b098410
This means we do process debug info sections now with all their relocations. That's ok for the moment.

19 months agoSkip tests under asan
Adrian Prantl [Wed, 5 Apr 2023 16:00:46 +0000 (09:00 -0700)]
Skip tests under asan

19 months ago [X86][mem-fold] Simplify code by using StringRef::drop_back, NFCI
Shengchen Kan [Wed, 5 Apr 2023 15:39:32 +0000 (23:39 +0800)]
 [X86][mem-fold] Simplify code by using StringRef::drop_back, NFCI

19 months ago[DebugInfo] Update test to use opaque ptrs
OCHyams [Wed, 5 Apr 2023 15:23:02 +0000 (16:23 +0100)]
[DebugInfo] Update test to use opaque ptrs

The test was added in D99169.

19 months ago[X86][mem-fold] Remove the logic for FoldGenData, NFCI
Shengchen Kan [Wed, 5 Apr 2023 15:22:18 +0000 (23:22 +0800)]
[X86][mem-fold] Remove the logic for FoldGenData, NFCI

19 months agoRevert "[SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating"
Nikita Popov [Wed, 5 Apr 2023 15:03:20 +0000 (17:03 +0200)]
Revert "[SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating"

This reverts commit 78b1fbc63f78660ef10e3ccf0e527c667a563bc8.

This causes or exposes miscompiles in Rust, revert until they
have been investigated.

19 months ago[Flang] Fix usage of uninitialized resolution variable
Paul Scoropan [Wed, 5 Apr 2023 14:31:16 +0000 (14:31 +0000)]
[Flang] Fix usage of uninitialized resolution variable

Recent Flang PowerPC intrinsics patch used resolution variable without checking if it exists first, causing segmentation faults in some scenarios. This patch checks that the resolution variable exists first before usage.

Reviewed By: DanielCChen

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

19 months ago[Coroutines] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 5 Apr 2023 14:59:04 +0000 (16:59 +0200)]
[Coroutines] Convert test to opaque pointers (NFC)

19 months ago[RISCV] Account for LMUL in memory op costs
Philip Reames [Wed, 5 Apr 2023 14:47:24 +0000 (07:47 -0700)]
[RISCV] Account for LMUL in memory op costs

Generally, the cost of a memory op will scale with the number of vector registers accessed. Machines might exist which have a narrow memory access than vector register width, but machines with a wider memory access width than vector register width seem unlikely.

I noticed this because we were preferring wide loads + deinterleaves on examples where the cost of a short gather (actually a strided load) would be better. Touching 8 vector registers instead of doing a 4 element gather is not a good tradeoff.

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

19 months ago[AggressiveInstCombine] Enable also for -O2
Dávid Bolvanský [Wed, 5 Apr 2023 10:52:30 +0000 (12:52 +0200)]
[AggressiveInstCombine] Enable also for -O2

Next step after https://reviews.llvm.org/D113179

Recently a set of patches by @anton-afanasyev improved many cases (better and cleaner vectorized code) thanks to improvements to AIC's TruncInstCombine (IC cannot handle it) motivated by real examples in bug reports. There was a discussion that -O2 could benefit from AIC as well, but discussion then stalled, so I would like restart it, with new numbers from LLVM compile time tracker.

As -O2 pipeline is not tracked by LLVM compile time tracker, I disabled AIC for -O3 to get an idea how expensive is it. Without AIC, I observed that geomean was cca -0.10%. Given that it seems like AIC is quite cheap, heavily tested by -O3 pipeline, I am proposing to enable it also with -O2 and similar to improve quality to vectorized code.

https://llvm-compile-time-tracker.com/compare.php?from=a1df5abef5f27646c809c7b85cf6170eb68f7735&to=e1ba6068f58c6ca862b920b8750faccb42a5843c&stat=instructions:u

Differential Revision: https://reviews.llvm.org/D147604
Reviewed-By: nikic
19 months ago[Matrix] Limit dot lowering to column major matrixes.
Florian Hahn [Wed, 5 Apr 2023 14:49:06 +0000 (15:49 +0100)]
[Matrix] Limit dot lowering to column major matrixes.

Limit to dot product lowering to column major matrixes for now. This
simplifies the code and reasoning for upcoming planned improvements.
Support for row-major matrixes can be added later as extension.

19 months ago[AArch64][SME] Disable ZA LDR/STR addressing optimisations
David Sherwood [Mon, 3 Apr 2023 10:19:19 +0000 (10:19 +0000)]
[AArch64][SME] Disable ZA LDR/STR addressing optimisations

Since the same encoded offset is used for both the vector
select offset and the address offset we have to spot two
patterns simulatenously in the ldr/str intrinsic inputs, i.e.

vector select = base + off
address = base + (off * VL)

whereas currently we only look for the address pattern. I
don't think this is possible in tablegen, so I suspect we'll
have to do this manually as part of lowering or as a target
DAG combine. For now, I've removed these tablegen patterns
so that we at least do the correct thing even if the code
quality isn't great.

I've also changed some of the ldr/str tests to pass in the
same vector select pattern (base + off) as the address
pattern.

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

19 months ago[InstCombine] Remove varargs cast transform (NFC)
Nikita Popov [Wed, 5 Apr 2023 14:22:56 +0000 (16:22 +0200)]
[InstCombine] Remove varargs cast transform (NFC)

This is no longer relevant with opaque pointers.

Also drop the CastInst::isLosslessCast() method, which was only
used here.

19 months ago[Transforms] Fix -Wunused-function for 'GetReplicateRegion' with -DLLVM_ENABLE_ASSERT...
Jie Fu [Wed, 5 Apr 2023 14:34:42 +0000 (22:34 +0800)]
[Transforms] Fix -Wunused-function for 'GetReplicateRegion' with -DLLVM_ENABLE_ASSERTIONS=OFF (NFC)

/Users/jiefu/llvm-project/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:614:23: error: unused function 'GetReplicateRegion' [-Werror,-Wunused-function]
static VPRegionBlock *GetReplicateRegion(VPRecipeBase *R) {
                      ^
1 error generated.

19 months ago[Hexagon] Remove -opaque-pointers=0 from tests
Krzysztof Parzyszek [Wed, 5 Apr 2023 13:54:31 +0000 (06:54 -0700)]
[Hexagon] Remove -opaque-pointers=0 from tests

Two tests still had opaque-pointers=0:
(1) llvm/test/CodeGen/Hexagon/addrmode.ll
(2) llvm/test/CodeGen/Hexagon/swp-epilog-phi7.ll

Deleted (1) since it no longer exercised the original scenario, modified
(2) to reflect codegen changes.

This fixes https://github.com/llvm/llvm-project/issues/61928

19 months ago[CodeGenCXX] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 5 Apr 2023 14:06:34 +0000 (16:06 +0200)]
[CodeGenCXX] Convert some tests to opaque pointers (NFC)

In particular also fixes fallout from instcombine changes.

19 months ago[InstCombine] Remove convertBitCastToGEP() fold (NFC)
Nikita Popov [Wed, 5 Apr 2023 13:59:29 +0000 (15:59 +0200)]
[InstCombine] Remove convertBitCastToGEP() fold (NFC)

This only applies to typed pointers, so the fold is no longer
necessary.

19 months ago[clang] don't serialize MODULE_DIRECTORY with ModuleFileHomeIsCwd
Richard Howell [Tue, 4 Apr 2023 19:35:45 +0000 (12:35 -0700)]
[clang] don't serialize MODULE_DIRECTORY with ModuleFileHomeIsCwd

Fix a bug in the MODULE_DIRECTORY serialization logic
that would cause MODULE_DIRECTORY to be serialized when
`-fmodule-file-home-is-cwd` is specified.

This matches the original logic added in:
https://github.com/apple/llvm-project/commit/f7b41371d9ede1aecf0930e5bd4a463519264633

Reviewed By: keith

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

19 months ago[Matrix] Add dotproduct tests with row-major default layout.
Florian Hahn [Wed, 5 Apr 2023 14:19:11 +0000 (15:19 +0100)]
[Matrix] Add dotproduct tests with row-major default layout.

19 months ago[InstCombine] Remove unneeded internal function 'decomposeSimpleLinearExpr' in InstCo...
Jie Fu [Wed, 5 Apr 2023 14:17:36 +0000 (22:17 +0800)]
[InstCombine] Remove unneeded internal function 'decomposeSimpleLinearExpr' in InstCombineCasts.cpp (NFC)

/data/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:32:15: error: function 'decomposeSimpleLinearExpr' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static Value *decomposeSimpleLinearExpr(Value *Val, unsigned &Scale,
              ^
1 error generated.

19 months ago[X86][mem-fold] Remove the logic for TB_NO_FORWARD | TB_NO_REVERSE, NFCI
Shengchen Kan [Wed, 5 Apr 2023 14:16:17 +0000 (22:16 +0800)]
[X86][mem-fold] Remove the logic for TB_NO_FORWARD | TB_NO_REVERSE, NFCI

19 months ago[InstCombine] Preserve nsw/nuw flags in canonicalization
Eric Gullufsen [Tue, 4 Apr 2023 19:33:37 +0000 (15:33 -0400)]
[InstCombine] Preserve nsw/nuw flags in canonicalization

canonicalizeLogicFirst reorders logic op / math op for suitable
constants, and this commit makes this function pass through
nsw/nuw flags on the Add.

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

19 months ago[InstCombine] Add baseline tests for nsw/nuw (NFC)
Eric Gullufsen [Tue, 4 Apr 2023 18:30:14 +0000 (14:30 -0400)]
[InstCombine] Add baseline tests for nsw/nuw (NFC)

nsw/nuw flags are currently not preserved when canonicalizing,
adding baseline tests here and subsequent patch will fix.

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

19 months ago[Matrix] Add test variants where 2nd operand of dotprod is add/sub.
Florian Hahn [Wed, 5 Apr 2023 14:04:05 +0000 (15:04 +0100)]
[Matrix] Add test variants where 2nd operand of dotprod is add/sub.

19 months ago[RuntimeDyld][ELF] Actually fix R_AARCH64_ABS{16,32} overflow check
Fangrui Song [Wed, 5 Apr 2023 13:59:09 +0000 (06:59 -0700)]
[RuntimeDyld][ELF] Actually fix R_AARCH64_ABS{16,32} overflow check

7b58259481417bb22d144a9c12ee8f4fb0a046e0 is incorrect.

19 months ago[InstCombine] Remove PromoteCastOfAllocation() fold (NFC)
Nikita Popov [Wed, 5 Apr 2023 13:41:53 +0000 (15:41 +0200)]
[InstCombine] Remove PromoteCastOfAllocation() fold (NFC)

This fold does not apply to opaque pointers, and as such is no
longer needed.

19 months ago[Coroutines] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 5 Apr 2023 13:53:15 +0000 (15:53 +0200)]
[Coroutines] Convert some tests to opaque pointers (NFC)

19 months ago[docs][RISCV] Remove outdated note about zfa implementation status
Alex Bradbury [Wed, 5 Apr 2023 13:52:08 +0000 (14:52 +0100)]
[docs][RISCV] Remove outdated note about zfa implementation status

MC layer and codegen support for fli.{h,s,d} has since been implemented.

19 months ago[RuntimeDyld][ELF] Fix off-by-1 issues in R_AARCH64_ABS{16,32} overflow checks
Fangrui Song [Wed, 5 Apr 2023 13:52:54 +0000 (06:52 -0700)]
[RuntimeDyld][ELF] Fix off-by-1 issues in R_AARCH64_ABS{16,32} overflow checks

19 months ago[AArch64] Add cost-model tests for fshr.
Florian Hahn [Wed, 5 Apr 2023 13:49:12 +0000 (14:49 +0100)]
[AArch64] Add cost-model tests for fshr.

19 months ago[RISCV][NFC] Use RISCVSubtarget method for predicate in RISCVFeatures.td when available
Alex Bradbury [Wed, 5 Apr 2023 13:46:44 +0000 (14:46 +0100)]
[RISCV][NFC] Use RISCVSubtarget method for predicate in RISCVFeatures.td when available

As RISCVSubtarget defines hasStdExtZfhOrZfhmin() and hasStdExtCOrZca(),
just use these for the matching Predicate definitions rather than
repeating the logic.

19 months ago[mlir] Fix a use after free when loading dependent dialects
Benjamin Kramer [Wed, 5 Apr 2023 13:35:02 +0000 (15:35 +0200)]
[mlir] Fix a use after free when loading dependent dialects

The way dependent dialects are implemented is by recursively calling
loadDialect in the constructor. This means we have to reload from the
dialect table because the constructor might have rehashed that table.

The steps for loading a dialect are
  1. Insert a nullptr into loadedDialects. This indicates the dialect is
     loading
  2. Call ctor(). This recursively loads dependent dialects
  3. Insert the new dialect into the table.

We had a conflict between steps 2 and 3 here. You have to be extremely
unlucky though as rehashing is rare and operator[] does no generation
checking on DenseMap. Changing that to an iterator would've uncovered
this issue immediately.

19 months ago[mlir] update Bazel bulid for 1ef51e0452a473f404edc635412685fce6f61004
Alex Zinenko [Wed, 5 Apr 2023 13:42:02 +0000 (15:42 +0200)]
[mlir] update Bazel bulid for 1ef51e0452a473f404edc635412685fce6f61004

19 months agoRevert "[dsymutil][NFC] Move ARM specific test into the ARM directory."
Alexey Lapshin [Wed, 5 Apr 2023 13:40:02 +0000 (15:40 +0200)]
Revert "[dsymutil][NFC] Move ARM specific test into the ARM directory."

This reverts commit adeb1fa7a34d097825f71dfdfe5c62a242353bb9.

19 months ago[VPlan] Replace check for replicate regions with assert (NFCI).
Florian Hahn [Wed, 5 Apr 2023 13:29:24 +0000 (14:29 +0100)]
[VPlan] Replace check for replicate regions with assert (NFCI).

After recent changes, replication regions only get introduced later, so
there's no need to check for them.

19 months ago[X86][mem-fold] Remove definition of NotMemoryFoldable and move code into a def file...
Shengchen Kan [Wed, 5 Apr 2023 13:23:12 +0000 (21:23 +0800)]
[X86][mem-fold] Remove definition of NotMemoryFoldable and move code into a def file, NFCI

The goal is to centralize the logic of the memory fold.

19 months ago[InstCombine] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 5 Apr 2023 13:17:15 +0000 (15:17 +0200)]
[InstCombine] Convert tests to opaque pointers (NFC)

The two debuginfo tests go away because the relevant transforms
no longer occur in this form, e.g. the "cast of alloca" transform
just doesn't exist with opaque pointers.

19 months ago[InstCombine] Regenerate test checks (NFC)
Nikita Popov [Wed, 5 Apr 2023 13:14:03 +0000 (15:14 +0200)]
[InstCombine] Regenerate test checks (NFC)

19 months ago[InstCombine] Name instructions in test (NFC)
Nikita Popov [Wed, 5 Apr 2023 13:07:26 +0000 (15:07 +0200)]
[InstCombine] Name instructions in test (NFC)

19 months ago[InstCombine] Regenerate test checks (NFC)
Nikita Popov [Wed, 5 Apr 2023 13:05:16 +0000 (15:05 +0200)]
[InstCombine] Regenerate test checks (NFC)

19 months ago[InstCombine] Use CreateGEP() API (NFC)
Nikita Popov [Wed, 5 Apr 2023 13:02:02 +0000 (15:02 +0200)]
[InstCombine] Use CreateGEP() API (NFC)

Use the IRBuilder API that accepts inbounds as a boolean parameter,
rather than using a ternary.

19 months ago[mlir][Analysis] Introduce LoopInfo in mlir
Christian Ulmann [Wed, 5 Apr 2023 12:55:22 +0000 (12:55 +0000)]
[mlir][Analysis] Introduce LoopInfo in mlir

This commit introduces an instantiation of LLVM's LoopInfo for CFGs in
MLIR. To test the LoopInfo, a test pass is added the checks the analysis
results for a set of CFGs.

Reviewed By: ftynse

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

19 months ago[X86] combinePredicateReduction - reuse LowerVectorAllEqual for all_of/any_of(vXi1...
Simon Pilgrim [Wed, 5 Apr 2023 12:42:02 +0000 (13:42 +0100)]
[X86] combinePredicateReduction - reuse LowerVectorAllEqual for all_of/any_of(vXi1 eq/ne) reductions

19 months ago[ArgPromotion] Require noundef to copy poison-generating metadata
Nikita Popov [Wed, 5 Apr 2023 12:33:11 +0000 (14:33 +0200)]
[ArgPromotion] Require noundef to copy poison-generating metadata

For poison-generating (rather than IUB) metadata, only copy it
from the dominating must-exec load if it is combined with !noundef.
This could be further extended by additionall intersecting the
metadata from all loads, which does not require !noundef.

19 months ago[X86] LowerVectorAllEqual - split ALLOF(CMPEQ(X,Y)) -> AND(CMPEQ(X[0],Y[0]),CMPEQ...
Simon Pilgrim [Wed, 5 Apr 2023 11:28:26 +0000 (12:28 +0100)]
[X86] LowerVectorAllEqual - split ALLOF(CMPEQ(X,Y)) -> AND(CMPEQ(X[0],Y[0]),CMPEQ(X[1],Y[1]),....) on MOVMSK codegen

Fix minor regression on pre-PTEST targets, since these are always 128-bits we're better off reducing the comparison results (assuming we're not comparing against 0/-1).

19 months ago[GlobalISel] Improve stack slot tracking in dbg.values
Felipe de Azevedo Piovezan [Tue, 4 Apr 2023 13:35:23 +0000 (09:35 -0400)]
[GlobalISel] Improve stack slot tracking in dbg.values

For IR like:

```
%alloca = alloca ...
dbg.value(%alloca, !myvar, OP_deref(<other_ops>))
```

GlobalISel lowers it to MIR:

```
%some_reg = G_FRAME_INDEX <stack_slot>
DBG_VALUE %some_reg, !myvar, OP_deref(<other_ops>)
```

In other words, if the value of `!myvar` can be obtained by
dereferencing an alloca, in MIR we say that the _location_ of a variable
is obtained by dereferencing register %some_reg (plus some
`<other_ops>`).

We can instead remove the use of `%some_reg`: the location of `!myvar`
_is_ `<stack_slot>` (plus some `<other_ops>`). This patch implements
this transformation, which improves debug information handling in O0, as
these registers hardly ever survive register allocation.

A note about testing: similar to what was done in D76934
(f24e2e9eebde4b7a1d), this patch exposed a bug in the Builder class when
using `-debug`, where we tried to print an incomplete instruction. The
changes in `MachineIRBuilder.cpp` address that.

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

19 months ago[X86] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 5 Apr 2023 12:09:00 +0000 (14:09 +0200)]
[X86] Convert tests to opaque pointers (NFC)

19 months ago[X86] Name instructions in test (NFC)
Nikita Popov [Wed, 5 Apr 2023 12:07:52 +0000 (14:07 +0200)]
[X86] Name instructions in test (NFC)

19 months ago[X86] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 5 Apr 2023 11:02:19 +0000 (13:02 +0200)]
[X86] Convert some tests to opaque pointers (NFC)

19 months ago[lldb] Remove unused private field 'm_orig_rax_info' in RegisterContextLinux_x86_64...
Jie Fu [Wed, 5 Apr 2023 11:54:23 +0000 (19:54 +0800)]
[lldb] Remove unused private field 'm_orig_rax_info' in RegisterContextLinux_x86_64.h (NFC)

/data/llvm-project/lldb/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h:32:30: error: private field 'm_orig_rax_info' is not used [-Werror,-Wunused-private-field]
  lldb_private::RegisterInfo m_orig_rax_info;
                             ^
1 error generated.

19 months ago[lld-macho][nfc] std::find_if -> llvm::find_if
Jez Ng [Wed, 5 Apr 2023 05:52:14 +0000 (01:52 -0400)]
[lld-macho][nfc] std::find_if -> llvm::find_if

19 months ago[lld-macho][nfc] Clean up a bunch of clang-tidy issues
Jez Ng [Wed, 5 Apr 2023 05:48:34 +0000 (01:48 -0400)]
[lld-macho][nfc] Clean up a bunch of clang-tidy issues

19 months ago[MLIR] Clarify (test-scf-)parallel-loop-collapsing
Tres Popp [Tue, 4 Apr 2023 09:36:30 +0000 (11:36 +0200)]
[MLIR] Clarify (test-scf-)parallel-loop-collapsing

1. parallel-loop-collapsing is renamed to test-scf-parallel-loop-collapsing.
2. The pass adds various checks to provide error messages instead of
   hitting assert failures.
3. Testing is added to verify these error messages

This is roughly an NFC. The name changes, but all checked behavior
previously would have resulted in an assertion failure. Almost no new
support is added, so this pass is still limited in scope to testing the
transform behaves correctly with input arguments that perfectly match
the ParallelLoop's iterator arg set. The one new piece of functionality
is that invalid operations will now be skipped with an error messages
instead of producing an assertion failure, so the pass can be used with
expected failures for pieces of the IR not cared about with a specific
RUN command.

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

19 months ago[lldb] Detach the child process when stepping over a fork
Pavel Labath [Thu, 12 Jan 2023 13:04:57 +0000 (14:04 +0100)]
[lldb] Detach the child process when stepping over a fork

Step over thread plans were claiming to explain the fork stop reasons,
which prevented the default fork logic (detaching from the child
process) from kicking in. This patch changes that.

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

19 months ago[lldb] Drop RegisterInfoInterface::GetDynamicRegisterInfo
Pavel Labath [Tue, 28 Mar 2023 12:50:16 +0000 (14:50 +0200)]
[lldb] Drop RegisterInfoInterface::GetDynamicRegisterInfo

"Dynamic register info" is a very overloaded term, and this particular
instance of it was only used for passing the information about the
"orig_[re]ax" pseudo-register on x86 through some generic code. Since
both sides of the code are x86-specific, I have replaced this with a
more direct route.

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

19 months ago[AArch64][GlobalISel] Add support for some across-vector NEON intrinsics
Vladislav Dzhidzhoev [Tue, 28 Mar 2023 13:57:35 +0000 (15:57 +0200)]
[AArch64][GlobalISel] Add support for some across-vector NEON intrinsics

Support uaddv, saddv, umaxv, smaxv, uminv, sminv, fmaxv, fminv,
fmaxnmv, fminnmv intrinsics in GlobalISel.

GlobalISelEmitter couldn't import SelectionDAG patterns containing nodes
with 8-bit result type, since they had untyped values. Therefore,
register type for FPR8 is set to i8 to eliminate untyped nodes in these
patterns.

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

19 months ago[NFC][InstCombine] Add tests that show bogus combine of SVE intrinsics when using...
Paul Walker [Tue, 4 Apr 2023 12:49:44 +0000 (12:49 +0000)]
[NFC][InstCombine] Add tests that show bogus combine of SVE intrinsics when using strictfp.

19 months ago[ARM] Fold fadd of vcmul into vcmla
David Green [Wed, 5 Apr 2023 10:52:05 +0000 (11:52 +0100)]
[ARM] Fold fadd of vcmul into vcmla

This adds an extra tablegen combine for folding fadd(a, vcmul(b, c)) into
vcmla(a, b, c), so long as the fadd is allowed to contract.

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

19 months agoUpdate mentions of reduction intrinsics; NFC
Sven van Haastregt [Wed, 5 Apr 2023 10:49:41 +0000 (11:49 +0100)]
Update mentions of reduction intrinsics; NFC

The intrinsics have been out of experimental since 322d0afd875d
("[llvm][mlir] Promote the experimental reduction intrinsics to be
first class intrinsics.", 2020-10-07); update some places that still
referred to them as experimental.

19 months ago[clang-tidy] Fix init-list handling in readability-implicit-bool-conversion
Piotr Zegar [Wed, 5 Apr 2023 09:44:36 +0000 (09:44 +0000)]
[clang-tidy] Fix init-list handling in readability-implicit-bool-conversion

Adds support for explicit casts using initListExpr,
for example: int{boolValue} constructions.

Fixes: #47000

Reviewed By: ccotter

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

19 months ago[dsymutil][NFC] Move ARM specific test into the ARM directory.
Alexey Lapshin [Wed, 5 Apr 2023 10:01:10 +0000 (12:01 +0200)]
[dsymutil][NFC] Move ARM specific test into the ARM directory.

This patch moves fat-header.test -> ARM/fat-header.test

19 months ago[Assignment Tracking][SROA] Handle createFragmentExpression failure
OCHyams [Wed, 5 Apr 2023 10:00:26 +0000 (11:00 +0100)]
[Assignment Tracking][SROA] Handle createFragmentExpression failure

createFragmentExpression will fail if it determines that the expression cannot
be split over fragments. Handle this case in SROA. Similarly to D147312 this
should be a rare occurrence as the `dbg.assign` will usually reference the
`Value` being stored without modifying it with a `DIExpression`.

Reviewed By: jmorse

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

19 months ago[LV] Use available masked vector function variants when required
Graham Hunter [Fri, 16 Sep 2022 14:23:18 +0000 (15:23 +0100)]
[LV] Use available masked vector function variants when required

LLVM has the ability to vectorize using function variants that require
a mask by creating an all-true mask, and to vectorize a conditional
call via scalarization, now we want to join the two parts together
and use a masked variant when a mask is required.

Reviewed By: david-arm

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

19 months ago[AArch64][SME] Fix an infinite loop in DAGCombine related to adding -force-streaming...
Dinar Temirbulatov [Wed, 5 Apr 2023 10:10:55 +0000 (10:10 +0000)]
[AArch64][SME] Fix an infinite loop in DAGCombine related to adding -force-streaming-compatible-sve flag.

Compiler hits infinite loop in DAGCombine. For force-streaming-compatible-sve
mode we have custom lowering for 128-bit vector splats and later in
DAGCombiner::SimplifyVCastOp() we scalarized SPLAT because we have custom
lowering for SME. Later, we restored SPLAT opertion via performMulCombine().

19 months ago[Support] Improve Windows performance of buffered raw_ostream
Andrew Ng [Fri, 31 Mar 2023 16:50:22 +0000 (17:50 +0100)]
[Support] Improve Windows performance of buffered raw_ostream

The "preferred" buffer size for raw_ostream is set to BUFSIZ which on
Windows is only 512. This results in more calls to write and this
overhead can have a significant negative impact on performance,
especially when Anti-Virus is also involved.

Therefore increase the "preferred" buffer size to 16KB for Windows.

One example of where this helps is the LLD --Map option which dumps out
the symbol map for a link. In a link of UE4, this change has been seen
to improve the performance of the symbol map writing by more than a
factor of 6.

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

19 months ago[X86][mem-fold][NFC] Refine code
Shengchen Kan [Wed, 5 Apr 2023 09:42:12 +0000 (17:42 +0800)]
[X86][mem-fold][NFC] Refine code

1. Use `unsigned` for `KeyOp` and `DstOp` b/c `Opcode` is of type `unsigned`.
2. Align the comparator used in X86FoldTablesEmitter.cpp with the one in
   CodeGenTarget::ComputeInstrsByEnum.

19 months ago[gn build] Port 628f11f78d33
LLVM GN Syncbot [Wed, 5 Apr 2023 09:49:30 +0000 (09:49 +0000)]
[gn build] Port 628f11f78d33

19 months ago[DWARFLinkerParallel] Add StringTable class.
Alexey Lapshin [Tue, 4 Apr 2023 12:23:34 +0000 (14:23 +0200)]
[DWARFLinkerParallel] Add StringTable class.

This patch adds StringTable class which is used to prepare
strings for emission into the .debug_str table. Specifically,
this class translates strings if necessary, keeps them in order,
assigns index and offset.

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

19 months ago[AMDGPU] Add machine verifier to a test
Jay Foad [Wed, 5 Apr 2023 09:36:32 +0000 (10:36 +0100)]
[AMDGPU] Add machine verifier to a test