platform/upstream/llvm.git
19 months ago[NFC][bazel] Run buildifier on all bzl/BUILD.bazel files
Jordan Rupprecht [Tue, 13 Dec 2022 00:30:51 +0000 (16:30 -0800)]
[NFC][bazel] Run buildifier on all bzl/BUILD.bazel files

19 months ago[NFC] Replaces: BB->getInstList().erase(I) with I->eraseFromParent().
Vasileios Porpodas [Tue, 29 Nov 2022 01:35:34 +0000 (17:35 -0800)]
[NFC] Replaces: BB->getInstList().erase(I) with I->eraseFromParent().

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

19 months ago[scudo] Optimize scudo test string allocation
Dominic Chen [Sat, 10 Dec 2022 01:22:38 +0000 (17:22 -0800)]
[scudo] Optimize scudo test string allocation

When the underlying vector becomes full, it resizes, remaps, and then copies over the old data. To avoid thes excess allocations, allow reservation from the backing vector.

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

19 months ago[FuzzMutate] InstModificationStrategy, add FastMath flags and exact flags to instruct...
Peter Rong [Thu, 8 Dec 2022 01:27:10 +0000 (17:27 -0800)]
[FuzzMutate] InstModificationStrategy, add FastMath flags and exact flags to instructions.

I think there are more attributes, flags we can add to `call`, functions declarations and global variables. Let's start with these two flags.

Reviewed By: arsenm

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

19 months ago[FuzzMutate] New InsertCFGStrategy
Peter Rong [Thu, 1 Dec 2022 01:27:01 +0000 (17:27 -0800)]
[FuzzMutate] New InsertCFGStrategy

Mutating CFG is hard as we have to maintain dominator relations.
We avoid this problem by inserting a CFG into a splitted block.

switch, ret, and br instructions are generated.

Reviewed By: arsenm

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

19 months ago[OpenMP] Refactoring: Move teams forking and serial region forking to separate functions.
Terry Wilmarth [Thu, 1 Dec 2022 15:13:48 +0000 (09:13 -0600)]
[OpenMP] Refactoring: Move teams forking and serial region forking to separate functions.

Code for serial parallel regions and teams construct have been moved
out of __kmp_fork_call and into separate functions.  This is to reduce
the size of the __kmp_fork_call function, and aid in debugging.

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

19 months ago[InstSimplify] try harder to propagate existing NaN values through FP folds
Sanjay Patel [Mon, 12 Dec 2022 22:48:22 +0000 (17:48 -0500)]
[InstSimplify] try harder to propagate existing NaN values through FP folds

Any undef element in a vector would trigger the whole constant
to be replaced with a canonical NaN. This propagates each
element when possible.

issue #59122

19 months ago[InstSimplify] add tests for vectors with NaN + partial undef; NFC
Sanjay Patel [Mon, 12 Dec 2022 22:19:43 +0000 (17:19 -0500)]
[InstSimplify] add tests for vectors with NaN + partial undef; NFC

issue #59122

19 months ago[RISCV] Make DemandedFields::usedVTYPE() const. NFC
Craig Topper [Mon, 12 Dec 2022 22:49:26 +0000 (14:49 -0800)]
[RISCV] Make DemandedFields::usedVTYPE() const. NFC

Noticed while reviewing D139877.

Reviewed By: reames

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

19 months ago[llvm-stress] Minor code improvements around vector types [nfc]
Philip Reames [Mon, 12 Dec 2022 22:41:49 +0000 (14:41 -0800)]
[llvm-stress] Minor code improvements around vector types [nfc]

19 months ago[RISCV][InsertVSETVLI] Reorder code to reduce a future diff [nfc]
Philip Reames [Mon, 12 Dec 2022 21:48:05 +0000 (13:48 -0800)]
[RISCV][InsertVSETVLI] Reorder code to reduce a future diff [nfc]

19 months ago[mlir][tosa] Refactor tosa.resize
Rob Suderman [Mon, 12 Dec 2022 22:17:58 +0000 (14:17 -0800)]
[mlir][tosa] Refactor tosa.resize

Moved to using helper lambdas to avoid code repetition. IR needed to be reordered to
accommodate which should be the only changes to the existing tests.

This changes the quantized test to target `i48` types to guarantee types are extended
correctly when necessary.

Reviewed By: jpienaar

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

19 months agoReapply "DebugInfo: Add/support new DW_LANG codes for recent C and C++ versions""
David Blaikie [Thu, 8 Dec 2022 01:28:48 +0000 (01:28 +0000)]
Reapply "DebugInfo: Add/support new DW_LANG codes for recent C and C++ versions""

This may be a breaking change for consumers if they're trying to detect
if code is C or C++, since it'll start using new codes that they may not
be ready to recognize, in which case they may fall back to non-C
handling.

This caused regressions due to PS4 having a different default for C
language version than other targets. Those tests were adapted to be
relaxed about which C version is used.

This reapplies commit 3c312e48f325c1b1ee11404ee6cfa08ee00037b0
Which was reverted by commit 6ab6085c77ef9bcdabf842342f63fba4291791a4.

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

19 months agoDelete sanitizer_common-based ('old') scudo: o7
Mitch Phillips [Mon, 12 Dec 2022 22:35:46 +0000 (14:35 -0800)]
Delete sanitizer_common-based ('old') scudo: o7

This has been on life support for a long time. Now that -fsanitize=scudo
is scudo_standalone, this can be removed.

Tests are sticking around for now to be reused for scudo_standalone
later on.

Reviewed By: vitalybuka

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

19 months agoDebugInfo: Test DW_AT_prototyped and generalize it to handle C11 and C17
David Blaikie [Mon, 12 Dec 2022 22:18:45 +0000 (22:18 +0000)]
DebugInfo: Test DW_AT_prototyped and generalize it to handle C11 and C17

19 months ago[flang] Preserve bound info for pointer assignments through derived types
Jonathon Penix [Thu, 1 Dec 2022 23:44:10 +0000 (15:44 -0800)]
[flang] Preserve bound info for pointer assignments through derived types

Doing a pointer assignment to another pointer which is a derived type component
could result in the bound information being lost, potentially leading to
incorrect array accesses. Fix this by trying to retain the bound info during
the assignment.

Fixes #57441

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

19 months ago[analyzer] Nullability: Enable analysis of non-inlined nullable objc properties.
Paul Pelzl [Mon, 12 Dec 2022 21:53:16 +0000 (13:53 -0800)]
[analyzer] Nullability: Enable analysis of non-inlined nullable objc properties.

The NullabilityChecker has a very early policy decision that non-inlined
property accesses will be inferred as returning nonnull, despite nullability
annotations to the contrary. This decision eliminates false positives related
to very common code patterns that look like this:

if (foo.prop) {
    [bar doStuffWithNonnull:foo.prop];
}

While this probably represents a correct nil-check, the analyzer can't
determine correctness without gaining visibility into the property
implementation.

Unfortunately, inferring nullable properties as nonnull comes at the cost of
significantly reduced code coverage. My goal here is to enable detection of
many property-related nullability violations without a large increase
in false positives.

The approach is to introduce a heuristic: after accessing the value of
a property, if the analyzer at any time proves that the property value is
nonnull (which would happen in particular due to a nil-check conditional),
then subsequent property accesses on that code path will be *inferred*
as nonnull. This captures the pattern described above, which I believe
to be the dominant source of false positives in real code.

https://reviews.llvm.org/D131655

19 months agoFix breakpoint-command.test when no script interpreter is compiled in.
Mitch Phillips [Mon, 12 Dec 2022 22:00:19 +0000 (14:00 -0800)]
Fix breakpoint-command.test when no script interpreter is compiled in.

My local build is with -DLLVM_ENABLE_PROJECTS=lldb, but I don't compile
with -DLLDB_ENABLE_PYTHON=True or -DLLDB_ENABLE_LUA=True. This results
in there being no script interpreter.

The test lldb/test/Shell/Breakpoint/breakpoint-command.test has an
implicit dependency on a script interpreter being available.

This patch makes that dependency clear. If you have a script
interpreter, the test gets run, otherwise it gets skipped. This means
that folks (like me) who naively use -DLLVM_ENABLE_PROJECTS=lldb can
continue to run check-all without breakages.

Reviewed By: JDevlieghere

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

19 months ago[NFC][Exegesis] Don't recompute opcode/reg names on each YAML write (-38% runtime)
Roman Lebedev [Mon, 12 Dec 2022 21:02:05 +0000 (00:02 +0300)]
[NFC][Exegesis] Don't recompute opcode/reg names on each YAML write (-38% runtime)

This reducer runtime of
```
$ ./bin/llvm-exegesis -mode=inverse_throughput --opcode-index=-1 --benchmarks-file=/dev/null --dump-object-to-disk=0 --measurements-print-progress --skip-measurements
```
from 3m44s to 2m17s, aka -38%.
But more importantly, we go from 400 *million* memory allocations
down to just 100 million, aka -75%.

But really, the big missing thing is doing everything in a single thread.
Sure, we can't do anything when measuring, but when we are not measuring,
we should just prepare (codegen) everything via all threads.
That should parallelize quite well.

19 months ago[NFC][InstCombine] fold-nested-selects: fix profitability check
Roman Lebedev [Mon, 12 Dec 2022 18:31:33 +0000 (21:31 +0300)]
[NFC][InstCombine] fold-nested-selects: fix profitability check

We'd check the cost of the wrong 'cond', after potentially skipping `not`.

19 months ago[GWP-ASan] Fix sanitizer backtrace util using wrong print.
Mitch Phillips [Mon, 12 Dec 2022 21:53:08 +0000 (13:53 -0800)]
[GWP-ASan] Fix sanitizer backtrace util using wrong print.

The sanitizer backtrace is used in tests, and calling StackTrace.Print()
means that it uses the sanitizer's Printf(), rather than GWP-ASan's
Printf(). In the current code, GWP-ASan's Printf() *is* the sanitizer
print, but this isn't guaranteed to be the case, and will change in an
upcoming patch.

Reviewed By: eugenis

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

19 months ago[OpenMP] Basic parse and sema support for modifiers in order clause
Chi Chun Chen [Mon, 12 Dec 2022 21:51:38 +0000 (15:51 -0600)]
[OpenMP] Basic parse and sema support for modifiers in order clause

This patch gives basic parsing and semantic support for "modifiers" of order clause introduced in OpenMP 5.1 ( section 2.11.3 )

Reviewed By: ABataev

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

19 months ago[flang] skip fast_math linker test on powerpc #3
Tom Eccles [Mon, 12 Dec 2022 21:46:35 +0000 (21:46 +0000)]
[flang] skip fast_math linker test on powerpc #3

Another attempt to skip the fast-math linker test on powerpc. The test
has to be skipped because there is no crtfastmath.o on powerpc.

Change recommended by Amy Kwan <amyk>.

See https://reviews.llvm.org/D138675

19 months ago[NFC] Cleanup: Replaces BB->getInstList().insert() with I->insertAt().
Vasileios Porpodas [Mon, 28 Nov 2022 22:43:11 +0000 (14:43 -0800)]
[NFC] Cleanup: Replaces BB->getInstList().insert() with I->insertAt().

This is part of a series of cleanup patches towards making BasicBlock::getInstList() private.

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

19 months ago[libc] remove use after free in tests.
Michael Jones [Mon, 12 Dec 2022 21:21:41 +0000 (13:21 -0800)]
[libc] remove use after free in tests.

There were some tests added that attempted to access files after they
were closed to test errno behavior, this caused sanitizer issues. Those
portions of the tests have been disabled.

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

19 months agoRevert "[reland][Alignment][NFC] Remove access to deprecated GlobalObject::getAlignme...
Guillaume Chatelet [Mon, 12 Dec 2022 21:18:15 +0000 (21:18 +0000)]
Revert "[reland][Alignment][NFC] Remove access to deprecated GlobalObject::getAlignment from llvm"

This reverts commit 3bbfaee23d41c099547c652f87b252ab6e1f6c46.

19 months ago[mlir][CAPI] Add a simple MlirOpOperand API for MlirValue uses.
Mike Urbach [Tue, 6 Dec 2022 22:56:08 +0000 (15:56 -0700)]
[mlir][CAPI] Add a simple MlirOpOperand API for MlirValue uses.

This allows basic IR traversal via the C API, which is useful for
analyses in languages other than C++.

This starts by defining an MlirOpOperand struct to encapsulate a pair
of an owner operation and an operand number.

A new API is added for MlirValue, to return the first use of the Value
as an MlirOpOperand, or a "null" MlirOpOperand if there are no uses.

A couple APIs are added for MlirOpOperand. The first checks if an
MlirOpOperand is "null", by checking if its owner's pointer is
null. The second supports iteration along the use-def lists by
accepting an MlirOpOperand and returning the next use of the Value as
another MlirOpOperand, or a "null" MlirOpOperand if there are no more
uses.

Reviewed By: mehdi_amini

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

19 months ago[libc] move errno out of file internals
Michael Jones [Wed, 7 Dec 2022 21:25:22 +0000 (13:25 -0800)]
[libc] move errno out of file internals

Now errno is only set by the terminal entrypoints, and not the internal
implementations. This patch is part of the larger effort to not set
errno in libc internal code: https://github.com/llvm/llvm-project/issues/59278

Reviewed By: sivachandra

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

19 months ago[mlir][Transform] Make FuseIntoContainingOp support rank-reducing extract slices
Nicolas Vasilache [Mon, 12 Dec 2022 14:31:43 +0000 (06:31 -0800)]
[mlir][Transform] Make FuseIntoContainingOp support rank-reducing extract slices

This fixes an issue where rank-reducing + fusion would not interop properly.

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

19 months ago[CodeExtractor] Use scope reparenting helper to update loop dbg loc
Felipe de Azevedo Piovezan [Mon, 12 Dec 2022 17:00:49 +0000 (12:00 -0500)]
[CodeExtractor] Use scope reparenting helper to update loop dbg loc

Apply the same strategy from D139217 to loop debug locations.

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

19 months ago[CodeExtractor] Preserve entire scope of labels when moving them
Felipe de Azevedo Piovezan [Mon, 12 Dec 2022 16:23:37 +0000 (11:23 -0500)]
[CodeExtractor] Preserve entire scope of labels when moving them

When a dbg.label is moved into a new function, its corresponding scope
should be preserved, with the exception of the subprogram at the end of
the scope chain, which should now be the subprogram of the destination
function. See D139671.

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

19 months ago[CodeExtractor] Only rewrite scope of labels that were not inlined
Felipe de Azevedo Piovezan [Mon, 12 Dec 2022 15:22:44 +0000 (10:22 -0500)]
[CodeExtractor] Only rewrite scope of labels that were not inlined

dbg.labels that were inlined from other functions should have their
scope preserved upon outlining for the same reasons described in
D139669.

19 months ago[clangd] Add a missing header guard for InsertionPoint.h
Haojian Wu [Mon, 12 Dec 2022 20:25:04 +0000 (21:25 +0100)]
[clangd] Add a missing header guard for InsertionPoint.h

19 months ago[flang] disable fast_math test on powerpc
Tom Eccles [Mon, 12 Dec 2022 20:02:37 +0000 (20:02 +0000)]
[flang] disable fast_math test on powerpc

There seems not be any crtfastmath.o on powerpc.

See https://reviews.llvm.org/D138675

19 months ago[mlir][LLVMIR target] Fix llvm.freeze builder to prevent crashes
Krzysztof Drewniak [Wed, 7 Dec 2022 21:05:58 +0000 (21:05 +0000)]
[mlir][LLVMIR target] Fix llvm.freeze builder to prevent crashes

The freeze builder did not assign the result of creating the freeze
operation to $res, which meant that when subsequent translations (such
as a sext) tried to use that result or query its type, mlir-translate
would crash.

This fixes the issue and adds a test for it.

Reviewed By: ftynse

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

19 months ago[mlir][arith][tosa] Use extended mul in 32-bit `tosa.apply_scale`
Jakub Kuderski [Mon, 12 Dec 2022 19:39:57 +0000 (14:39 -0500)]
[mlir][arith][tosa] Use extended mul in 32-bit `tosa.apply_scale`

To not introduce 64-bit types that may be difficult to handle for some
targets.

Reviewed By: rsuderman, antiagainst

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

19 months ago[Clang] Try to fix test on Windows (NFC)
Nikita Popov [Mon, 12 Dec 2022 19:35:29 +0000 (20:35 +0100)]
[Clang] Try to fix test on Windows (NFC)

Try to fix failure reported in
https://reviews.llvm.org/rG9466b49171dc#1154213 by making the
match more specific, as there are multiple dbg.declares that
could be matched.

19 months ago[mlgo] Use LLVM_HAVE_TFLITE instead of LLVM_HAVE_TF_API in C++ code (NFC)
Kazu Hirata [Mon, 12 Dec 2022 19:28:40 +0000 (11:28 -0800)]
[mlgo] Use LLVM_HAVE_TFLITE instead of LLVM_HAVE_TF_API in C++ code (NFC)

We use LLVM_HAVE_TFLITE as the key to enable the mlgo work these days,
and LLVM_HAVE_TF_API is defined whenever LLVM_HAVE_TF_API is defined.

I'm posting this patch because it's purely mechanical.

I'll post a follow-up patch to remove LLVM_HAVE_TF_API in non-C++
files, and that will not be as mechanical as this one.

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

19 months ago[mlgo] Remove TENSORFLOW_C_LIB_PATH
Kazu Hirata [Mon, 12 Dec 2022 19:28:38 +0000 (11:28 -0800)]
[mlgo] Remove TENSORFLOW_C_LIB_PATH

We use LLVM_HAVE_TFLITE as the key to enable the MLGO bits.  We do not
use the "else" clause.

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

19 months ago[ZOS] Convert tests to check 'target={{.*}}-zos{{.*}}'
Paul Robinson [Mon, 12 Dec 2022 19:24:02 +0000 (11:24 -0800)]
[ZOS] Convert tests to check 'target={{.*}}-zos{{.*}}'

Also add 'system-zos' as a lit feature and use it where needed.

Part of the project to eliminate special handling for triples in lit
expressions.

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

19 months ago[HWASAN][NFC] Renamed [g|s]et_requested_size to [G|S]etRequestedSize.
Kirill Stoimenov [Fri, 9 Dec 2022 18:53:54 +0000 (18:53 +0000)]
[HWASAN][NFC] Renamed [g|s]et_requested_size to [G|S]etRequestedSize.

Reviewed By: kda

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

19 months ago[COFF] Respect weak externals for mangled symbol searching
Shoaib Meenai [Sat, 10 Dec 2022 04:09:56 +0000 (20:09 -0800)]
[COFF] Respect weak externals for mangled symbol searching

We were previously ignoring weak externals during these searches (which
are used for the entry point, exports, and subsystem inference), which
differed from link.exe behavior. It also meant that we could get
different behavior when linking an object file directly vs. packaging it
into a static library, because static library symbol name directories
include weak externals.

Reviewed By: mstorsjo, yozhu

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

19 months ago[gn] port 988ab0048daf
Nico Weber [Mon, 12 Dec 2022 18:52:03 +0000 (13:52 -0500)]
[gn] port 988ab0048daf

19 months ago[lldb] Make ParseTemplateParameterInfos return false if there are no template params
Arthur Eubanks [Thu, 8 Dec 2022 18:01:01 +0000 (10:01 -0800)]
[lldb] Make ParseTemplateParameterInfos return false if there are no template params

This factors out the check from various callers.

Reviewed By: Michael137

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

19 months ago[ORC] Extract hasInitializerSection for testing (NFC)
Keith Smiley [Mon, 5 Dec 2022 18:21:46 +0000 (10:21 -0800)]
[ORC] Extract hasInitializerSection for testing (NFC)

Based on the discussion in https://reviews.llvm.org/D130221 and https://reviews.llvm.org/D139223

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

19 months ago[NFC][SROA] `rewriteMemOpOfSelect()`: play nice with typed pointers for now
Roman Lebedev [Mon, 12 Dec 2022 18:15:33 +0000 (21:15 +0300)]
[NFC][SROA] `rewriteMemOpOfSelect()`: play nice with typed pointers for now

https://github.com/llvm/llvm-project/commit/89a6106ce50689c733be13aaef4be5f3f73708a2#commitcomment-92824429

19 months ago[test] Fix dr324.c again for non-writeable source directories
Jordan Rupprecht [Mon, 12 Dec 2022 18:11:19 +0000 (10:11 -0800)]
[test] Fix dr324.c again for non-writeable source directories

In general, the source tree is not assumed to be writeable, so modifying `%s` does not work for all CI systems. Instead of touching `%s`, copy it to a writeable dir using `%t`, and touch it there.
Actually, `dr0xx.c` isn't really needed at all, so just create a new `dep.c` file in the build tree.

This was recently added in cb088e8c3abf30456e2891f90b5194d0070c387a, fixed in 1481fcf780bde7b115aa395064d71749b1a40889, and fixed again in d16c59013056f1bf8844ded8faeb0cf01b1c3613.

19 months ago[lit] Use 'target=' in a few more places
Paul Robinson [Mon, 12 Dec 2022 17:58:14 +0000 (09:58 -0800)]
[lit] Use 'target=' in a few more places

Missed these on the first pass.

Part of the project to eliminate special handling for triples in lit
expressions.

19 months ago[OpenMP] add offload tests with reduction on complex data types
Ye Luo [Mon, 12 Dec 2022 17:35:26 +0000 (11:35 -0600)]
[OpenMP] add offload tests with reduction on complex data types

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

19 months agoEmit CAS loop for min/max atomics.
Doru Bercea [Wed, 7 Dec 2022 16:37:11 +0000 (10:37 -0600)]
Emit CAS loop for min/max atomics.

19 months ago[NFC][SCEV][LoopUnroll] Add tests where treating `or` as `add` raises expansion cost
Roman Lebedev [Mon, 12 Dec 2022 16:30:42 +0000 (19:30 +0300)]
[NFC][SCEV][LoopUnroll] Add tests where treating `or` as `add` raises expansion cost

From https://reviews.llvm.org/rG46db90cc71d1#1154128

19 months ago[mlir][runner] Add more printMemref functions.
bixia1 [Mon, 12 Dec 2022 16:26:23 +0000 (08:26 -0800)]
[mlir][runner] Add more printMemref functions.

Add printMemref for complex data types and index type. Add printMemref for 1d
type beyond f32.

Reviewed By: aartbik

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

19 months ago[InstrProf] Fix bug when merging empty profile with multiple threads
Ellis Hoag [Sat, 10 Dec 2022 01:12:30 +0000 (17:12 -0800)]
[InstrProf] Fix bug when merging empty profile with multiple threads

When merging profiles with multiple threads, the `mergeWriterContexts()` function is used to merge profile data between writers. This must be in sync with `loadInput()` which merges profiles to a single writer. This diff merges the profile kind correctly in `mergeWriterContexts()` to fix a subtle bug.

Reviewed By: phosek

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

19 months ago[libc][bazel] Mark all libc public functions to have "default" visibility.
Siva Chandra Reddy [Thu, 8 Dec 2022 23:26:21 +0000 (23:26 +0000)]
[libc][bazel] Mark all libc public functions to have "default" visibility.

For the bazel build, we also build all source files with
-fvisibility=hidden.

Reviewed By: gchatelet

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

19 months ago[RISCV] Allow fractional LMUL for reduction start value
Philip Reames [Mon, 12 Dec 2022 16:53:35 +0000 (08:53 -0800)]
[RISCV] Allow fractional LMUL for reduction start value

For reductions, we need to put the start value into a source vector. For fractional LMULs, we can perform the operation at the original LMUL.  For LMUL > 1, we eventually want to use a scalar insert, but that's outside the scope of this patch.

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

19 months ago[AMDGPU] Make use of !listremove. NFCI.
Jay Foad [Mon, 12 Dec 2022 11:31:20 +0000 (11:31 +0000)]
[AMDGPU] Make use of !listremove. NFCI.

This only affects the order of implicit operands in some MIR tests.

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

19 months agoFix module build after removing None.h from STLExtras.h
Steven Wu [Mon, 12 Dec 2022 16:57:53 +0000 (08:57 -0800)]
Fix module build after removing None.h from STLExtras.h

Add declaration for NoneType in BitcodeConvenience.h.

19 months ago[Clang] Update compiler-rt sanitizer test to use opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 16:26:52 +0000 (17:26 +0100)]
[Clang] Update compiler-rt sanitizer test to use opaque pointers (NFC)

19 months ago[opt] Clean up code related to parsing legacy passes for new PM driver. NFC
Bjorn Pettersson [Mon, 12 Dec 2022 16:11:40 +0000 (17:11 +0100)]
[opt] Clean up code related to parsing legacy passes for new PM driver. NFC

Just some minor cleanups given that `opt -passname` syntax is dead
for the new pass manager driver.

19 months ago[Analysis] Remove TFUtils.cpp
Kazu Hirata [Mon, 12 Dec 2022 16:38:55 +0000 (08:38 -0800)]
[Analysis] Remove TFUtils.cpp

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

19 months ago[reland][Alignment][NFC] Remove access to deprecated GlobalObject::getAlignment from...
Guillaume Chatelet [Mon, 12 Dec 2022 16:37:51 +0000 (16:37 +0000)]
[reland][Alignment][NFC] Remove access to deprecated GlobalObject::getAlignment from llvm

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

19 months ago[AArch64][GlobalISel] Lower formal arguments of AAPCS & ms_abi variadic functions.
Vladislav Dzhidzhoev [Mon, 1 Aug 2022 14:02:25 +0000 (17:02 +0300)]
[AArch64][GlobalISel] Lower formal arguments of AAPCS & ms_abi variadic functions.

Reimplemented SelectionDAG code for GlobalISel.

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

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

19 months ago[CodeGen] Fix a warning
Kazu Hirata [Mon, 12 Dec 2022 16:27:12 +0000 (08:27 -0800)]
[CodeGen] Fix a warning

This patch fixes:

  clang/lib/CodeGen/CGOpenMPRuntime.cpp:6098:8: error: lambda capture
  'this' is not used [-Werror,-Wunused-lambda-capture]

19 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 16:13:39 +0000 (17:13 +0100)]
[Clang] Convert some tests to opaque pointers (NFC)

These were tests where update_cc_test_checks.py was rerun after
the conversion.

19 months ago[Clang] Convert various tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 16:01:34 +0000 (17:01 +0100)]
[Clang] Convert various tests to opaque pointers (NFC)

These were all tests where no manual fixup was required.

19 months ago[lldb] Remove redundant XFAIL
Paul Robinson [Fri, 9 Dec 2022 19:39:20 +0000 (11:39 -0800)]
[lldb] Remove redundant XFAIL

The test is `UNSUPPORTED: system-linux` so the XFAIL for linux is
redundant.

Part of the project to eliminate special handling for triples in lit
expressions.

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

19 months ago[mlir][arith] Simplify muli emulation with mului_extended
Jakub Kuderski [Mon, 12 Dec 2022 15:54:20 +0000 (10:54 -0500)]
[mlir][arith] Simplify muli emulation with mului_extended

Using `arith.mului_extended` makes it much simpler to emulate wide
integer multiplication.

Reviewed By: antiagainst

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

19 months ago[InstCombine] try to fold a pair of insertelements into one insertelement
Sanjay Patel [Mon, 12 Dec 2022 15:02:56 +0000 (10:02 -0500)]
[InstCombine] try to fold a pair of insertelements into one insertelement

This replaces patches that tried to convert related patterns to shuffles
(D138872, D138873, D138874 - reverted/abandoned) but caused codegen
problems and were questionable as a canonicalization because an
insertelement is a simpler op than a shuffle.

This detects a larger pattern -- insert-of-insert -- and replaces with
another insert, so this hopefully does not cause any problems.

As noted by TODO items in the code and tests, this could go a lot further.
But this is enough to reduce the motivating test from issue #17113.

Example proofs:
https://alive2.llvm.org/ce/z/NnUv3a

I drafted a version of this for AggressiveInstCombine, but it seems that
would uncover yet another phase ordering gap. If we do generalize this to
handle the full range of potential patterns, that may be worth looking at
again.

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

19 months ago[clang] Allow using BareMetal toolchain with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR compi...
Michael Platings [Mon, 12 Dec 2022 15:36:06 +0000 (15:36 +0000)]
[clang] Allow using BareMetal toolchain with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR compiler-rt

If you build compiler-rt with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR then
the library filename will be "libclang_rt.builtins.a" instead of
"libclang_rt.builtins-<ARCH>.a"

The ToolChain::getCompilerRT method uses the "libclang_rt.builtins.a"
name if it can find the file in the library directories. If it can't
then it falls back to using "libclang_rt.builtins-<ARCH>.a". This
change adds the library directory such that "libclang_rt.builtins.a"
can be found.

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

19 months ago[X86] X86TTIImpl::getIntImmCost - use APInt::isInt/isSignedInt directly
Simon Pilgrim [Mon, 12 Dec 2022 15:20:18 +0000 (15:20 +0000)]
[X86] X86TTIImpl::getIntImmCost - use APInt::isInt/isSignedInt directly

Avoid some getSExtValue()/getZExtValue() calls

Hopefully we can remove some of the getBitWidth() constraints as well, as many are just there as a proxy for legal types (albeit assuming x86_64).

19 months ago[OpenMP][OMPIRBuilder] Migrate code to emit target region functions from clang to...
Jan Sjodin [Tue, 6 Dec 2022 19:26:50 +0000 (14:26 -0500)]
[OpenMP][OMPIRBuilder] Migrate code to emit target region functions from clang to OMPIRBuilder

This patch moves some of the logic on how to emit target region functions and
adds emitTargetRegionFunction to the OpenMPIRBuilder. Also the
OpenMPOffloadMandatory flag is added to the config.

Reviewed By: jdoerfert

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

19 months ago[Clang] Update Profile tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 15:24:14 +0000 (16:24 +0100)]
[Clang] Update Profile tests to opaque pointers (NFC)

19 months ago[clang-tidy] Fix a couple additional cases in misc-use-anonymous-namespace only
Carlos Galvez [Thu, 1 Dec 2022 13:15:32 +0000 (13:15 +0000)]
[clang-tidy] Fix a couple additional cases in misc-use-anonymous-namespace only

- Do not analyze header files, since we don't want to promote
  using anonymous namespaces there.

- Do not warn about const/constexpr variables, those are implicitly
  static in C++ and they don't need to be moved to an anonymous
  namespace. Warning about redundant static in general could be
  implemented as a standalone check, moving away some of the
  functionality from this check.

This check has been introduced in the current release, thus
no mention of this change is needed in the Release Notes.

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

19 months agoRevert "[scudo] Enable more warnings for standalone build"
Lei Huang [Mon, 12 Dec 2022 15:02:01 +0000 (10:02 -0500)]
Revert "[scudo] Enable more warnings for standalone build"

This reverts commit a2b0673dbe5d5d24194fbc33a9b0e21a414fa50b.
Broke ppc sanitizer bot: https://lab.llvm.org/buildbot/#/builders/19/builds/14037

19 months ago[Clang] Convert PCH tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 15:17:28 +0000 (16:17 +0100)]
[Clang] Convert PCH tests to opaque pointers (NFC)

19 months ago[CodeExtractor] Preserve entire scope of !DIVariables when moving them
Felipe de Azevedo Piovezan [Thu, 8 Dec 2022 20:08:20 +0000 (15:08 -0500)]
[CodeExtractor] Preserve entire scope of !DIVariables when moving them

When a dbg.value is moved into a new function, the corresponding
variable should have its entire scope chain reparented with the new
function. The current implementation drops the scope chain and replaces
it with a subprogram for the new function.

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

19 months ago[opt] NewPM: `opt -passname` syntax is dead, long live `opt -passes=<pipeline>`!
Roman Lebedev [Mon, 12 Dec 2022 15:17:39 +0000 (18:17 +0300)]
[opt] NewPM: `opt -passname` syntax is dead, long live `opt -passes=<pipeline>`!

I've done final pass, and there are no more tests to update.
All other tests (=codegen tests) are using old pass manager.

Reviewed By: nikic

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

19 months ago[SimplifyCFG] `FoldBranchToCommonDest()`: deal with mismatched IV's in PHI's in commo...
Roman Lebedev [Mon, 12 Dec 2022 15:01:57 +0000 (18:01 +0300)]
[SimplifyCFG] `FoldBranchToCommonDest()`: deal with mismatched IV's in PHI's in common successor block

This tries to approach the problem noted by @arsenm:
terrible codegen for `__builtin_fpclassify()`:
https://godbolt.org/z/388zqdE37

Just because the PHI in the common successor happens to have different
incoming values for these two blocks, doesn't mean we have to give up.
It's quite easy to deal with this, we just need to produce a select:
https://alive2.llvm.org/ce/z/000srb

Now, the cost model for this transform is rather overly strict,
so this will basically never fire. We tally all (over all preds)
the selects needed to the NumBonusInsts

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

19 months ago[clangd] Add support for semantic token type "operator"
Christian Kandeler [Wed, 20 Jul 2022 16:05:44 +0000 (18:05 +0200)]
[clangd] Add support for semantic token type "operator"

Also add new modifier for differentiating between built-in and user-
provided operators.

Reviewed By: sammccall

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

19 months ago[Clang] Convert some OpenMP tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 14:53:31 +0000 (15:53 +0100)]
[Clang] Convert some OpenMP tests to opaque pointers (NFC)

19 months agoRevert D139836 "[Alignment][NFC] Remove deprecated GlobalObject::getAlignment"
Guillaume Chatelet [Mon, 12 Dec 2022 15:04:03 +0000 (15:04 +0000)]
Revert D139836 "[Alignment][NFC] Remove deprecated GlobalObject::getAlignment"

This breaks lldb.

This reverts commit f3f15ca27fbb433ad5a65b1a1e0a071d2e9af505.

19 months agoUse std::optional in Tooling/Inclusions.
Haojian Wu [Mon, 12 Dec 2022 15:00:51 +0000 (16:00 +0100)]
Use std::optional in Tooling/Inclusions.

19 months ago[clang-cl] Ignore #pragma managed/unmanaged
Sylvain Audi [Thu, 8 Dec 2022 15:42:11 +0000 (10:42 -0500)]
[clang-cl] Ignore #pragma managed/unmanaged

Those 2 pragmas are ignored by MSVC when not compiling with /CLR, which clang doesn't support.
Ignore them in clang -fms-extensions, to avoid -Wunknown-pragma warnings

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

19 months ago[Alignment][NFC] Remove deprecated GlobalObject::getAlignment
Guillaume Chatelet [Mon, 12 Dec 2022 13:06:56 +0000 (13:06 +0000)]
[Alignment][NFC] Remove deprecated GlobalObject::getAlignment

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

19 months ago[clang-tidy][NFC] Fix compiler warning in GlobListTest.cpp
Carlos Galvez [Mon, 12 Dec 2022 14:42:06 +0000 (14:42 +0000)]
[clang-tidy][NFC] Fix compiler warning in GlobListTest.cpp

19 months agoRecommit "[AArch64] Select SMULL for zero extended vectors when top bit is zero"
Zain Jaffal [Thu, 8 Dec 2022 06:21:53 +0000 (08:21 +0200)]
Recommit "[AArch64] Select SMULL for zero extended vectors when top bit is zero"

This is a recommit of f9e0390751cb5eefbbbc191f851c52422acacab1
The previous commit failed to handle cases where the zero extended operand is an extended `BUILD_VECTOR`.
We don't replace zext with a sext operand to select smull if any operand is `BUILD_VECTOR`

Original commit message:

we can safely replace a `zext` instruction with `sext` if the top bit is zero. This is useful because we can select `smull` when both operands are sign extended.

Reviewed By: fhahn, dmgreen

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

19 months agoRevert "Revert "[AArch64] Select SMULL for zero extended vectors when top bit is...
Zain Jaffal [Mon, 12 Dec 2022 13:56:14 +0000 (13:56 +0000)]
Revert "Revert "[AArch64] Select SMULL for zero extended vectors when top bit is zero""

This reverts commit c07a01c2bb0d1f95689f809fd5be23829e364393.

19 months ago[Alignment][NFC] Use Align in Hexagon emit(local)?CommonSymbolSorted
Guillaume Chatelet [Mon, 12 Dec 2022 14:39:21 +0000 (14:39 +0000)]
[Alignment][NFC] Use Align in Hexagon emit(local)?CommonSymbolSorted

19 months ago[AArch64][SVE] Add some hadd sve codegen tests. NFC
David Green [Mon, 12 Dec 2022 14:35:01 +0000 (14:35 +0000)]
[AArch64][SVE] Add some hadd sve codegen tests. NFC

19 months ago[Clang] Convert PowerPC tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 13:50:54 +0000 (14:50 +0100)]
[Clang] Convert PowerPC tests to opaque pointers (NFC)

19 months ago[include-cleaner] Add a newline at end of the file, NFC
Haojian Wu [Mon, 12 Dec 2022 14:28:34 +0000 (15:28 +0100)]
[include-cleaner] Add a newline at end of the file, NFC

19 months ago[Alignment][NFC] Use Align in MCSymbol::declareCommon
Guillaume Chatelet [Mon, 12 Dec 2022 14:27:55 +0000 (14:27 +0000)]
[Alignment][NFC] Use Align in MCSymbol::declareCommon

19 months ago[nfc][DebugInfo] Move subprogram rewriting utility to header
Felipe de Azevedo Piovezan [Thu, 8 Dec 2022 18:33:55 +0000 (13:33 -0500)]
[nfc][DebugInfo] Move subprogram rewriting utility to header

This utility will be useful in subsequent patches, as such we expose it
in the DebugInfoMetadata header.

Depends on D139669

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

19 months ago[Alignment][NFC] MCSymbol::getCommonAlignment returns MaybeAlign, improve documentation.
Guillaume Chatelet [Mon, 12 Dec 2022 13:56:18 +0000 (13:56 +0000)]
[Alignment][NFC] MCSymbol::getCommonAlignment returns MaybeAlign, improve documentation.

This one goes hand in hand with D139819

Reviewed By: courbet

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

19 months ago[clang-tidy][NFC] Simply match processing in misc-use-anonymous-namespace
Carlos Galvez [Mon, 12 Dec 2022 13:36:29 +0000 (13:36 +0000)]
[clang-tidy][NFC] Simply match processing in misc-use-anonymous-namespace

No need for the templated function "processMatch", since
we can infer the type with llvm:isa.

19 months ago[include-cleaner] Include the reference type when printing the SymbolReference.
Haojian Wu [Mon, 12 Dec 2022 12:47:46 +0000 (13:47 +0100)]
[include-cleaner] Include the reference type when printing the SymbolReference.

This information is useful when printing the reference for debugging
purposes.

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

19 months ago[Clang] Convert CXX tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 13:49:32 +0000 (14:49 +0100)]
[Clang] Convert CXX tests to opaque pointers (NFC)

19 months agoRevert "[Clang][NFC] Prevent lit tests from matching substrings in current path"
Nikita Popov [Mon, 12 Dec 2022 13:43:14 +0000 (14:43 +0100)]
Revert "[Clang][NFC] Prevent lit tests from matching substrings in current path"

This reverts commit bb48aa20e761e26226c6f909a07246781d68ba41.

Using placeholders inside CHECK-LABEL is not legal.

19 months ago[flang] Match alternative names for crtend in fastmath test
Tom Eccles [Mon, 12 Dec 2022 13:31:06 +0000 (13:31 +0000)]
[flang] Match alternative names for crtend in fastmath test

The fastmath test checks that crtfastmath.o is added between crtbeginS.o
and crtendS.o. On some systems, crtend is called crtend.o - match these
too.

Related to https://reviews.llvm.org/D138675

19 months ago[mlir][bufferize] Fix typo in EmptyTensorElimination
Matthias Springer [Mon, 12 Dec 2022 13:16:41 +0000 (14:16 +0100)]
[mlir][bufferize] Fix typo in EmptyTensorElimination

The structure of the code has changed a while ago and the code was not updated properly.

There is no test case for this because we do currently not have an op
that could trigger this bug.

Reviewed By: nicolasvasilache

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