platform/upstream/llvm.git
2 years agoRevert "[mlir][tosa] Split tosa-to-linalg named ops out of pass"
Mehdi Amini [Fri, 24 Dec 2021 00:09:15 +0000 (00:09 +0000)]
Revert "[mlir][tosa] Split tosa-to-linalg named ops out of pass"

This reverts commit 313de31fbb757643db13bcb47f8fe515039e298a.

There is a missing CMake dependency, building with shared libraries is
broken:

55.509 [45/4/3061] Linking CXX shared library lib/libMLIRTosaToLinalg.so.14git
FAILED: lib/libMLIRTosaToLinalg.so.14git
...
TosaToLinalgPass.cpp: undefined reference to `mlir::createCanonicalizerPass()'

2 years agoLoad binary by UUID from qProcessInfo packet fields
Jason Molenda [Thu, 23 Dec 2021 23:18:03 +0000 (15:18 -0800)]
Load binary by UUID from qProcessInfo packet fields

Support three new keys in the qProcessInfo response from the remote
gdb stub to handle the case of attaching to a core running some type
of standalone/firmware code and the stub knows the UUID and load
address-or-slide for the binary.  There will be no proper DynamicLoader
plugin in this scenario, but we can try to locate and load the binary
into lldb at the correct offset.

Differential Revision: https://reviews.llvm.org/D116211
rdar://75191077

2 years ago[libc][obvious] Fix style of MPFRWrapper.
Siva Chandra Reddy [Thu, 23 Dec 2021 22:59:14 +0000 (22:59 +0000)]
[libc][obvious] Fix style of MPFRWrapper.

2 years ago[Hexagon] Revamp HVX flag verification in driver
Krzysztof Parzyszek [Thu, 23 Dec 2021 23:03:55 +0000 (15:03 -0800)]
[Hexagon] Revamp HVX flag verification in driver

Generalize warning/error messages (for reuse), refactor flag verification
code, rewrite HVX flag driver testcase.

2 years ago[ELF] Remove stale comment which was duplicated in MarkLive<ELFT>::run
Fangrui Song [Thu, 23 Dec 2021 23:13:46 +0000 (15:13 -0800)]
[ELF] Remove stale comment which was duplicated in MarkLive<ELFT>::run

Pointed out by thakis

2 years ago[gn build] (manually) port 7cd7b4d2f807 (sanitizer_symbolize_set_demangle)
Nico Weber [Thu, 23 Dec 2021 23:06:48 +0000 (18:06 -0500)]
[gn build] (manually) port 7cd7b4d2f807 (sanitizer_symbolize_set_demangle)

2 years agoRevert "[DwarfDebug] Support emitting function-local declaration for a lexical block...
Kristina Bessonova [Thu, 23 Dec 2021 16:10:52 +0000 (18:10 +0200)]
Revert "[DwarfDebug] Support emitting function-local declaration for a lexical block" & dependent patches

Try to revert D113741 once again.

This also reverts 0ac75e82fff93a80ca401d3db3541e8d1d9098f9 (D114705)
as it causes LLDB's lldb-api.lang/cpp/nsimport.TestCppNsImport.py test
failure w/o D113741.

This reverts commit f9607d45f399e2afc39ec16222ea68b4e0831564.

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

2 years ago[sanitizer] Add common "demangle" flag
Vitaly Buka [Thu, 23 Dec 2021 03:04:13 +0000 (19:04 -0800)]
[sanitizer] Add common "demangle" flag

Reviewed By: browneee

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

2 years ago[Verifier] Iteratively traverse all indirect users.
Florian Hahn [Thu, 23 Dec 2021 22:20:11 +0000 (23:20 +0100)]
[Verifier] Iteratively traverse all indirect users.

The recursive implementation can run into stack overflows, e.g. like in PR52844.

The order the users are visited changes, but for the current use case
this only impacts the order error messages are emitted.

2 years ago[gn build] (manually) port f103ee2e9e3fc (sanitizer_symbolize_set_inline_frames)
Nico Weber [Thu, 23 Dec 2021 21:40:07 +0000 (16:40 -0500)]
[gn build] (manually) port f103ee2e9e3fc (sanitizer_symbolize_set_inline_frames)

2 years ago[RISCV][VP] Lower mask vector VP AND/OR/XOR to RVV instructions
Victor Perez [Thu, 23 Dec 2021 20:33:47 +0000 (14:33 -0600)]
[RISCV][VP] Lower mask vector VP AND/OR/XOR to RVV instructions

For fixed and scalable vectors, each intrinsic x is lowered to vmx.mm,
dropping the mask, which is safe to do as masked-off elements are
undef anyway.

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

2 years ago[mlir][tosa] Split tosa-to-linalg named ops out of pass
Rob Suderman [Thu, 23 Dec 2021 20:09:20 +0000 (12:09 -0800)]
[mlir][tosa] Split tosa-to-linalg named ops out of pass

Linalg named ops lowering are moved to a separate pass. This allows TOSA
canonicalizers to run between named-ops lowerings and the general TOSA
lowerings. This allows the TOSA canonicalizers to run between lowerings.

Reviewed By: NatashaKnk

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

2 years ago[Polly][SchedOpt] Account for prevectorization of multiple statements.
Michael Kruse [Thu, 23 Dec 2021 19:45:42 +0000 (13:45 -0600)]
[Polly][SchedOpt] Account for prevectorization of multiple statements.

A prevectorized loop may contain multiple statements, in which case
isl_schedule_node_band_sink will sink the vector band to multiple
leaves. Instead of statically assuming a specific tree structure after
sinking, add a SIMD marker to all inner bands.

Fixes llvm.org/PR52637

2 years ago[libc++] [ranges] Whitespace and namespace-style adjustments. NFC.
Arthur O'Dwyer [Thu, 23 Dec 2021 19:51:24 +0000 (14:51 -0500)]
[libc++] [ranges] Whitespace and namespace-style adjustments. NFC.

Largely split out of D116199 to keep that PR smaller.

2 years ago[libc++] [test] Eliminate `== true` and `== false`. NFC.
Arthur O'Dwyer [Thu, 23 Dec 2021 19:25:18 +0000 (14:25 -0500)]
[libc++] [test] Eliminate `== true` and `== false`. NFC.

As suggested in D115312.

2 years ago[libc++] [ranges] Fix bugs in ranges::empty().
Arthur O'Dwyer [Wed, 22 Dec 2021 23:06:48 +0000 (18:06 -0500)]
[libc++] [ranges] Fix bugs in ranges::empty().

It was missing the cast to `bool` in `bool(__t.empty())`.
It was wrongly using `std::forward` in some places.

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

2 years ago[libc++] [test] Flatten the directory structure a bit. NFC.
Arthur O'Dwyer [Thu, 23 Dec 2021 01:25:17 +0000 (20:25 -0500)]
[libc++] [test] Flatten the directory structure a bit. NFC.

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

2 years ago[mlir] Remove spurious debug guard
Mogball [Thu, 23 Dec 2021 19:55:29 +0000 (11:55 -0800)]
[mlir] Remove spurious debug guard

2 years ago[clang][driver] Warn when '-mno-outline-atomics' is used with a non-AArch64 triple
Nathan Chancellor [Thu, 23 Dec 2021 18:43:26 +0000 (11:43 -0700)]
[clang][driver] Warn when '-mno-outline-atomics' is used with a non-AArch64 triple

The Linux kernel has a make macro called cc-option that invokes the
compiler with an option in isolation to see if it is supported before
adding it to CFLAGS. The exit code of the compiler is used to determine
if the flag is supported and should be added to the compiler invocation.

A call to cc-option with '-mno-outline-atomics' was added to prevent
linking errors with newer GCC versions but this call succeeds with a
non-AArch64 target because there is no warning from clang with
'-mno-outline-atomics', just '-moutline-atomics'. Because the call
succeeds and adds '-mno-outline-atomics' to the compiler invocation,
there is a warning from LLVM because the 'outline-atomics target
feature is only supported by the AArch64 backend.

$ echo | clang -target x86_64 -moutline-atomics -Werror -x c -c -o /dev/null -
clang-14: error: The 'x86_64' architecture does not support -moutline-atomics; flag ignored [-Werror,-Woption-ignored]

$ echo $?
1

$ echo | clang -target x86_64 -mno-outline-atomics -Werror -x c -c -o /dev/null -
'-outline-atomics' is not a recognized feature for this target (ignoring feature)

$ echo $?
0

This does not match GCC's behavior, which errors when the flag is added
to a non-AArch64 target.

$ echo | gcc -moutline-atomics -x c -c -o /dev/null -
gcc: error: unrecognized command-line option ‘-moutline-atomics’; did you mean ‘-finline-atomics’?

$ echo | gcc -mno-outline-atomics -x c -c -o /dev/null -
gcc: error: unrecognized command-line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?

$ echo | aarch64-linux-gnu-gcc -moutline-atomics -x c -c -o /dev/null -

$ echo | aarch64-linux-gnu-gcc -mno-outline-atomics -x c -c -o /dev/null -

To get closer to  GCC's behavior, issue a warning when
'-mno-outline-atomics' is used without an AArch64 triple and do not add
'{-,+}outline-atomic" to the list of target features in these cases.

Link: https://github.com/ClangBuiltLinux/linux/issues/1552
Reviewed By: melver, nickdesaulniers

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

2 years ago[ELF][PPC32] Support .got2 in an output section description
Fangrui Song [Thu, 23 Dec 2021 19:32:44 +0000 (11:32 -0800)]
[ELF][PPC32] Support .got2 in an output section description

I added `PPC32Got2Section` D62464 to support .got2 but did not implement .got2
in another output section.

PR52799 has a linker script placing .got2 in .rodata, which causes a null
pointer dereference because a MergeSyntheticSection's file is nullptr.
Add the support.

2 years ago[sanitizer] Move internal_symbolizer "inline" option
Vitaly Buka [Wed, 22 Dec 2021 23:25:16 +0000 (15:25 -0800)]
[sanitizer] Move internal_symbolizer "inline" option

This option is per process anyway. I'd like to add more options, but
having them as parameters of __sanitizer_symbolize_code looks
inconvenient.

Reviewed By: browneee

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

2 years ago[Driver][test] Remove unneeded -no-canonical-prefixes and use preferred --target=
Fangrui Song [Thu, 23 Dec 2021 19:25:13 +0000 (11:25 -0800)]
[Driver][test] Remove unneeded -no-canonical-prefixes and use preferred --target=

-no-canonical-prefixes is not needed if we omit "clang" from CHECK lines.
"-cc1" is sufficient to anchor the line we want to test.
--target= is preferred over Separate form -target.

2 years ago[NFC][sanitizer] Increase kArgVMax to 16
Vitaly Buka [Thu, 23 Dec 2021 19:11:47 +0000 (11:11 -0800)]
[NFC][sanitizer] Increase kArgVMax to 16

D116202 uses all availible slots.

2 years ago[sanitizer] Check kArgVMax in SymbolizerProcess::GetArgV
Vitaly Buka [Thu, 23 Dec 2021 19:02:56 +0000 (11:02 -0800)]
[sanitizer] Check kArgVMax in SymbolizerProcess::GetArgV

2 years ago[libc][NFC] fix variable name
Michael Jones [Thu, 23 Dec 2021 18:40:10 +0000 (10:40 -0800)]
[libc][NFC] fix variable name

A variable was named in a way that doesn't match the format. This patch
renames it to match the format.

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

2 years ago[Hexagon] Driver/preprocessor options for Hexagon v69
Krzysztof Parzyszek [Thu, 23 Dec 2021 18:02:24 +0000 (10:02 -0800)]
[Hexagon] Driver/preprocessor options for Hexagon v69

2 years ago[Bazel] Add target for llvm-tli-checker
Jakub Kuderski [Thu, 23 Dec 2021 18:13:25 +0000 (13:13 -0500)]
[Bazel] Add target for llvm-tli-checker

Reviewed By: vettoreldaniele, GMNGeoffrey

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

2 years ago[ELF] --gc-sections: combine two iterations over inputSections
Fangrui Song [Thu, 23 Dec 2021 17:53:08 +0000 (09:53 -0800)]
[ELF] --gc-sections: combine two iterations over inputSections

There is a slight speed-up.

2 years agoRevert "[ASan] Moved optimized callbacks into a separate library."
Kirill Stoimenov [Thu, 23 Dec 2021 17:11:25 +0000 (17:11 +0000)]
Revert "[ASan] Moved optimized callbacks into a separate library."

This reverts commit ab3640aa0e8361921a5d0cdc393a5b75e78ec22b.

Reviewed By: kstoimenov

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

2 years ago[AMDGPU] Don't remove VGPR to AGPR dead spills from frame info
Brendon Cahoon [Sat, 18 Dec 2021 21:01:50 +0000 (15:01 -0600)]
[AMDGPU] Don't remove VGPR to AGPR dead spills from frame info

Removing dead frame indices for VGPR to AGPR spills is incorrect
when the frame index is shared by multiple objects, which may
occur due to stack slot coloring. The problem is that subsequent
code that processes the other object will assert because the stack
frame index is marked dead.

Removing dead frame indices is needed prior to stack slot
coloring, which is what happens with SGPR to VGPR spills. These
spills are lowered prior to stack slot coloring, but the VGPR
to AGPR spills are processed afterwards during the Prolog/Epilog
Inserter pass. This patch marks the VGPR to AGPR spill slot as
dead if the slot is not used by another object.

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

2 years ago[Hexagon] Add Hexagon v69 builtins to clang
Krzysztof Parzyszek [Wed, 22 Dec 2021 15:46:14 +0000 (07:46 -0800)]
[Hexagon] Add Hexagon v69 builtins to clang

2 years ago[Hexagon] Introduce Hexagon v69 ISA
Krzysztof Parzyszek [Wed, 22 Dec 2021 15:46:14 +0000 (07:46 -0800)]
[Hexagon] Introduce Hexagon v69 ISA

2 years ago[ASan] Moved optimized callbacks into a separate library.
Kirill Stoimenov [Wed, 8 Dec 2021 18:42:29 +0000 (18:42 +0000)]
[ASan] Moved optimized callbacks into a separate library.

This will allow linking in the callbacks directly instead of using PLT.

Reviewed By: vitalybuka

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

2 years ago[libc++][format][NFC] Remove some unneeded headers.
Mark de Wever [Wed, 22 Dec 2021 17:46:23 +0000 (18:46 +0100)]
[libc++][format][NFC] Remove some unneeded headers.

Reviewed By: #libc, Quuxplusone, Mordante

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

2 years ago[RISCV] Use positive 0.0 for the neutral element in fadd reductions if nsz is present.
Craig Topper [Thu, 23 Dec 2021 16:24:37 +0000 (10:24 -0600)]
[RISCV] Use positive 0.0 for the neutral element in fadd reductions if nsz is present.

-0.0 requires a constant pool. +0.0 can be made with vmv.v.x x0.

Not doing this in getNeutralElement for fear of changing other targets.

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

2 years ago[libc++][format] Improve ABI stability.
Mark de Wever [Tue, 21 Dec 2021 18:12:54 +0000 (19:12 +0100)]
[libc++][format] Improve ABI stability.

During the review of D115991 @vitaut pointed out the enum shouldn't
depend on whether or not _LIBCPP_HAS_NO_INT128 is defined. The current
implementation lets the enum's ABI depend on this configuration option
without a good cause.

Reviewed By: ldionne, #libc

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

2 years ago[RISCV] Support strict FP conversion operations.
Craig Topper [Thu, 23 Dec 2021 14:57:51 +0000 (08:57 -0600)]
[RISCV] Support strict FP conversion operations.

This adds support for strict conversions between fp types and between
integer and fp.

NOTE: RISCV has static rounding mode instructions, but the constrainted
intrinsic metadata is not used to select static rounding modes. Dynamic
rounding mode is always used.

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

2 years ago[AArch64] Add a tablegen pattern for SQXTN2.
Alexandros Lamprineas [Thu, 23 Dec 2021 15:14:40 +0000 (15:14 +0000)]
[AArch64] Add a tablegen pattern for SQXTN2.

Converts concat_vectors(Vd, trunc(smin(smax Vm, -2^n), 2^n-1) to
sqxtn2(Vd, Vm). Deliberately not handling v2i64 ~> v2i32 as the
min/max nodes are not legal (same thing we did for the SQXTN
patterns in https://reviews.llvm.org/D103263).

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

2 years agoAMDGPU/GlobalISel: Fix attempt to select non-legal instr in mir test
Petar Avramovic [Thu, 23 Dec 2021 15:13:20 +0000 (16:13 +0100)]
AMDGPU/GlobalISel: Fix attempt to select non-legal instr in mir test

Delete inst-select-insert.xfail.mir.
G_INSERT instructions in inst-select-insert.xfail.mir are no longer
legal after D114198. This breaks build bots, since builds with
LLVM_ENABLE_ASSERTIONS=Off don't check for legality and report cannot
select while build with LLVM_ENABLE_ASSERTIONS=On reports instruction
is not legal.

2 years ago[SPIR-V] Add a toolchain for SPIR-V in clang
Anastasia Stulova [Thu, 23 Dec 2021 14:57:34 +0000 (14:57 +0000)]
[SPIR-V] Add a toolchain for SPIR-V in clang

This patch adds a toolchain (TC) for SPIR-V along with the
following changes in Driver and base ToolChain and Tool.
This is required to provide a mechanism in clang to bypass
SPIR-V backend in LLVM for SPIR-V until it lands in LLVM and
matures.

The SPIR-V code is generated by the SPIRV-LLVM translator tool
named 'llvm-spirv' that is sought in 'PATH'.

The compilation phases/actions should be bound for SPIR-V in
the meantime as following:

    compile -> tools::Clang
    backend -> tools::SPIRV::Translator
    assemble -> tools::SPIRV::Translator

However, Driver’s ToolSelector collapses compile-backend-assemble
and compile-backend sequences to tools::Clang. To prevent this,
added new {use,has}IntegratedBackend properties in ToolChain and
Tool to which the ToolSelector reacts on, and which SPIR-V TC
overrides.

Linking of multiple input files is currently not supported but
can be added separately.

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

Co-authored-by: Henry Linjamäki <henry.linjamaki@parmance.com>
2 years ago[X86][SSE] Add ISD::ROTR support
Simon Pilgrim [Thu, 23 Dec 2021 14:52:23 +0000 (14:52 +0000)]
[X86][SSE] Add ISD::ROTR support

Fix issue in TargetLowering::expandROT where we only attempt to flip a rotation if the other direction has better support - this matches TargetLowering::expandFunnelShift

This allows us to enable ISD::ROTR lowering on SSE targets, which particularly simplifies/improves codegen for splat amount and AVX2 per-element shifts.

2 years ago[InstSimplify] Fold logic AND to zero
Mehrnoosh Heidarpour [Tue, 14 Dec 2021 21:05:52 +0000 (16:05 -0500)]
[InstSimplify] Fold logic AND to zero

Adding following fold opportunity:
((A | B) ^ A) & ((A | B) ^ B) --> 0

Reviewed By: spatel, rampitec

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

2 years ago[RISCV] Disable interleaving scalar loops in the loop vectorizer.
Craig Topper [Thu, 23 Dec 2021 14:11:09 +0000 (08:11 -0600)]
[RISCV] Disable interleaving scalar loops in the loop vectorizer.

The loop vectorizer can interleave scalar loops even if it doesn't
vectorize them. I don't believe we intended to enable this when
we enabled interleaving for vector instructions.

Disable interleaving for VF=1 like X86 and AMDGPU already do. Test
lifted from AMDGPU.

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

2 years ago[X86] isVectorShiftByScalarCheap - vXi8 select(shift(x,splat0),shift(x,splat1)) is...
Simon Pilgrim [Thu, 23 Dec 2021 14:09:23 +0000 (14:09 +0000)]
[X86] isVectorShiftByScalarCheap - vXi8 select(shift(x,splat0),shift(x,splat1)) is better than shift(x,select(splat0,splat1))

Even though we don't have vXi8 vector shifts (apart from XOP), it is still better to prefer shift (or funnel-shift/rotate) by scalar where possible.

https://llvm.godbolt.org/z/6ss6ffTxv

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

2 years ago[OpenMP] Remove no-op cast (NFC)
Nikita Popov [Thu, 23 Dec 2021 14:15:26 +0000 (15:15 +0100)]
[OpenMP] Remove no-op cast (NFC)

This was casting the address to its own element type, which is
a no-op.

2 years ago[CodeGen] Use CreateConstInBoundsGEP() in one more place
Nikita Popov [Thu, 23 Dec 2021 13:58:47 +0000 (14:58 +0100)]
[CodeGen] Use CreateConstInBoundsGEP() in one more place

This does exactly what this code manually implemented.

2 years ago[CGBuilder] Add CreateGEP() overload that accepts an Address
Nikita Popov [Thu, 23 Dec 2021 13:41:03 +0000 (14:41 +0100)]
[CGBuilder] Add CreateGEP() overload that accepts an Address

Add an overload for an Address and a single non-constant offset.
This makes it easier to preserve the element type and adjust the
alignment appropriately.

2 years ago[GlobalISel] Rework more/fewer elements for vectors
Petar Avramovic [Thu, 23 Dec 2021 13:09:51 +0000 (14:09 +0100)]
[GlobalISel] Rework more/fewer elements for vectors

Artifact combiner is not able to access individual elements after using
LCMTy style merge/unmerge, extract and insert to change vector number of
elements (pad with undef or split to sub-vector instructions).
Use unmerge to individual elements instead and then merge elements into
requested types.
Change argument lowering for vectors and moreElementsVector to use
buildPadVectorWithUndefElements and buildDeleteTrailingVectorElements.
FewerElementsVector had a few helpers that had different behavior,
introduce new helper for most of the opcodes.
FewerElementsVector helper is more flexible since it can create leftover
instruction smaller then requested type (useful in case target wants to
avoid pad with undef and use fewer registers). If target does not want
leftover of different type it should call more elements first.
Some helpers were performing more elements first to have split without
leftover. Opcodes that used this helper use clampMaxNumElementsStrict
(does more elements first) in LegalizerInfo to avoid test changes.
Fixes failures caused by failing to combine artifacts created during
more/fewer elements vector.

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

2 years agoGlobalISel: Regen vector mir tests, add tests for vector arg lowering
Petar Avramovic [Thu, 23 Dec 2021 11:39:38 +0000 (12:39 +0100)]
GlobalISel: Regen vector mir tests, add tests for vector arg lowering

Precommit for D114198 (Rework more/fewer elements for vectors).
Regenerate auto-generated mir tests for vectors (use CHECK-NEXT instead
of CHECK). Remove -global-isel-abort=0 where it is no longer needed.
Add mir tests for different AMDGPU sub-targets and they way they lower
function vector arguments (tests for legalization artifact combiner).

2 years ago[VE] Add manuals to CompilerWriterInfo
Simon Moll [Thu, 23 Dec 2021 13:14:29 +0000 (14:14 +0100)]
[VE] Add manuals to CompilerWriterInfo

Reference VE manual and documentations in CompilerWriterInfo.

Reviewed By: kaz7

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

2 years ago[C++20] [Modules] Mark imported module as imported if not exported
Chuanqi Xu [Thu, 23 Dec 2021 13:12:28 +0000 (21:12 +0800)]
[C++20] [Modules] Mark imported module as imported if not exported

In C++20 Modules, imported module which doesn't get exported wouldn't be
recorded. This patch would record such modules to avoid possible
incorrect visibility problems.

Reviewed By: urnathan

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

2 years ago[VE] Add VE support to update_llc_test_checks
Simon Moll [Thu, 23 Dec 2021 13:12:34 +0000 (14:12 +0100)]
[VE] Add VE support to update_llc_test_checks

Add VE assembly scrubbing and triple support to update_llc_test_checks.

Reviewed By: kaz7

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

2 years agoRevert "[C++20] [Coroutines] Mark imported module as imported if not exported"
Chuanqi Xu [Thu, 23 Dec 2021 13:10:07 +0000 (21:10 +0800)]
Revert "[C++20] [Coroutines] Mark imported module as imported if not exported"

This reverts commit 368318bcce66d9fef420fc34cca361b79d80cee5.

The title is not right. It should be a patch about modules instead of
coroutines.

2 years ago[C++20] [Coroutines] Mark imported module as imported if not exported
Chuanqi Xu [Thu, 23 Dec 2021 12:47:28 +0000 (20:47 +0800)]
[C++20] [Coroutines] Mark imported module as imported if not exported

In C++20 Modules, imported module which doesn't get exported wouldn't be
recorded. This patch would record such modules to avoid possible
incorrect visibility problems.

Reviewed By: urnathan

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

2 years ago[libc++] Remove unused headers from <filesystem>
Nikolas Klauser [Thu, 23 Dec 2021 11:21:00 +0000 (12:21 +0100)]
[libc++] Remove unused headers from <filesystem>

Remove unused headers from `<filesystem>`

Reviewed By: Quuxplusone, #libc, Mordante

Spies: Mordante, libcxx-commits

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

2 years ago[CodeGen] Use correct element type for store to sret
Nikita Popov [Thu, 23 Dec 2021 12:00:46 +0000 (13:00 +0100)]
[CodeGen] Use correct element type for store to sret

sret is special in that it does not use the memory type
representation. Manually construct the LValue using ConvertType
instead of ConvertTypeForMem here.

This fixes matrix-lowering-opt-levels.c on s390x.

2 years ago[libc++] IWYU in <filesystem> tests
Nikolas Klauser [Thu, 23 Dec 2021 11:03:36 +0000 (12:03 +0100)]
[libc++] IWYU in <filesystem> tests

Add headers in `<filesystem>` tests that were transitively included
through `<filesystem>`

Reviewed as part of D116146

2 years agoRevert "[libc++] Remove unused headers from <filesystem>"
Nikolas Klauser [Thu, 23 Dec 2021 10:55:38 +0000 (11:55 +0100)]
Revert "[libc++] Remove unused headers from <filesystem>"

This reverts commit 352945dd36c64fd68b4c73fcc393ee5828da639a.

2 years ago[AMDGPU] Remove a TODO that was done by D98081
Jay Foad [Thu, 23 Dec 2021 10:19:27 +0000 (10:19 +0000)]
[AMDGPU] Remove a TODO that was done by D98081

2 years ago[CodeGen] Avoid pointer element type access when creating LValue
Nikita Popov [Tue, 21 Dec 2021 14:28:45 +0000 (15:28 +0100)]
[CodeGen] Avoid pointer element type access when creating LValue

This required fixing two places that were passing the pointer type
rather than the expected pointee type to the method.

2 years ago[ELF] LTO: skip expensive usedStartStop initialization if bitcodeFiles.empty()
Fangrui Song [Thu, 23 Dec 2021 09:52:54 +0000 (01:52 -0800)]
[ELF] LTO: skip expensive usedStartStop initialization if bitcodeFiles.empty()

This may cost 1.3+% of total link time.

2 years ago[ELF] sortSections: delete unneeded outSecOff assignment
Fangrui Song [Thu, 23 Dec 2021 09:24:32 +0000 (01:24 -0800)]
[ELF] sortSections: delete unneeded outSecOff assignment

Related to D45368 but outSecOff is unneeded because resolveShfLinkOrder uses
stable_sort.

2 years agoRevert "Revert "[DwarfDebug] Support emitting function-local declaration for a lexica...
Muhammad Omair Javaid [Thu, 23 Dec 2021 09:08:37 +0000 (14:08 +0500)]
Revert "Revert "[DwarfDebug] Support emitting function-local declaration for a lexical block" & dependent patches"

This has broke following LLDB buildbots:

https://lab.llvm.org/buildbot/#/builders/17/builds/14984
https://lab.llvm.org/buildbot/#/builders/96/builds/15928
https://lab.llvm.org/buildbot/#/builders/68/builds/23600

This reverts commit 62a6b9e9ab3eb778111e90a34fee1e6a7c64db8a.

2 years ago[ELF] Optimize copyLocalSymbols. NFC
Fangrui Song [Thu, 23 Dec 2021 08:59:29 +0000 (00:59 -0800)]
[ELF] Optimize copyLocalSymbols. NFC

2 years ago[DSE] Add test for matrix store (NFC)
Nikita Popov [Thu, 23 Dec 2021 08:44:01 +0000 (09:44 +0100)]
[DSE] Add test for matrix store (NFC)

2 years ago[DSE] Regenerate test checks (NFC)
Nikita Popov [Thu, 23 Dec 2021 08:31:44 +0000 (09:31 +0100)]
[DSE] Regenerate test checks (NFC)

2 years ago[IR] Use default attributes for trampoline intrinsics
Nikita Popov [Thu, 23 Dec 2021 08:25:26 +0000 (09:25 +0100)]
[IR] Use default attributes for trampoline intrinsics

These intrinsics do not free, synchronize or diverge.

2 years ago[IR] Add memory attributes for init.trampoline
Nikita Popov [Wed, 22 Dec 2021 10:27:44 +0000 (11:27 +0100)]
[IR] Add memory attributes for init.trampoline

Based on my reading of https://llvm.org/docs/LangRef.html#llvm-init-trampoline-intrinsic,
init.trampoline writes to the first argument, while the other two
are readnone. These two arguments are only captured and written
into the trampoline memory. This also matches what I see in the
X86TargetLowering::LowerINIT_TRAMPOLINE() implementation.

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

2 years ago[OpenMP] Fix incorrect type when casting from uintptr
Nikita Popov [Wed, 22 Dec 2021 15:30:22 +0000 (16:30 +0100)]
[OpenMP] Fix incorrect type when casting from uintptr

MakeNaturalAlignAddrLValue() expects the pointee type, but the
pointer type was passed. As a result, the natural alignment of
the pointer (usually 8) was always used in place of the natural
alignment of the value type.

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

2 years ago[JSONNodeDumper] Do not print mangled names for local variables (PR49111)
Nikita Popov [Wed, 22 Dec 2021 16:23:10 +0000 (17:23 +0100)]
[JSONNodeDumper] Do not print mangled names for local variables (PR49111)

Mangled names are not meaningful for variables with local storage,
and may not be well defined (getting the mangled name for VLA
crashes the mangler). As such, do not include them in the JSON
dump.

This allows running update_cc_test_checks on some OpenMP tests again.

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

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

2 years agoRevert "[ELF] Make Partition/InStruct members unique_ptr and remove associate make...
Fangrui Song [Thu, 23 Dec 2021 07:55:11 +0000 (23:55 -0800)]
Revert "[ELF] Make Partition/InStruct members unique_ptr and remove associate make<XXX>"

This reverts commit e48b1c8a27f0fbd791edc8e45756b268caadfa66.
This reverts commit d019de23a1d761225fdaf0c47394ba58143aea9a.

The changes caused memory leaks (non-final classes cannot use unique_ptr).

2 years ago[DFSan] Make dfsan_read_origin_of_first_taint public.
Andrew Browne [Thu, 23 Dec 2021 00:56:37 +0000 (16:56 -0800)]
[DFSan] Make dfsan_read_origin_of_first_taint public.

Makes origins easier to use with dfsan_read_label(addr, size).

Reviewed By: vitalybuka

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

2 years ago[clang-format] Fix wrong indentation after trailing requires clause.
Marek Kurdej [Wed, 22 Dec 2021 19:41:20 +0000 (20:41 +0100)]
[clang-format] Fix wrong indentation after trailing requires clause.

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

Before this patch, clang-format would wrongly parse top-level entities (e.g. namespaces) and format:
```
template<int I>
constexpr void foo requires(I == 42) {}
namespace ns {
void foo() {}
}  // namespace ns
```
into:
``````
template<int I>
constexpr void foo requires(I == 42) {}
namespace ns {
  void foo() {}
}  // namespace ns
```
with configuration:
```
NamespaceIndentation: None
````

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years ago[ELF] Use SmallVector for some global variables (*Files and *Sections). NFC
Fangrui Song [Thu, 23 Dec 2021 06:30:07 +0000 (22:30 -0800)]
[ELF] Use SmallVector for some global variables (*Files and *Sections). NFC

My lld executable is 26+KiB smaller.

2 years ago[Sanitizer] Fix setbuffer() interceptor (it accept size, not mode)
Azat Khuzhin [Thu, 23 Dec 2021 06:10:27 +0000 (22:10 -0800)]
[Sanitizer] Fix setbuffer() interceptor (it accept size, not mode)

Fixes: 0c81a62d9d76 ("[Sanitizer] Adding setvbuf in supported platforms and other stream buffer functions")

Reviewed By: vitalybuka

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

2 years ago[ELF] Change nonnull pointer parameters to references
Fangrui Song [Thu, 23 Dec 2021 06:02:29 +0000 (22:02 -0800)]
[ELF] Change nonnull pointer parameters to references

2 years ago[libc] Add performance tests for hypotf and hypot.
Tue Ly [Tue, 21 Dec 2021 19:19:03 +0000 (14:19 -0500)]
[libc] Add performance tests for hypotf and hypot.

Add performance tests for hypotf and hypot.

Reviewed By: sivachandra, michaelrj

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

2 years ago[ELF] Make Partition members unique_ptr and remove associate make<XXX>
Fangrui Song [Thu, 23 Dec 2021 05:34:25 +0000 (21:34 -0800)]
[ELF] Make Partition members unique_ptr and remove associate make<XXX>

See D116143 for benefits. My lld executable (x86-64) is 103+KiB smaller.

2 years ago[sanitizer] Support symbolize_inline_frames by addr2line
Vitaly Buka [Thu, 23 Dec 2021 05:28:38 +0000 (21:28 -0800)]
[sanitizer] Support symbolize_inline_frames by addr2line

2 years ago[NFC][sanitizer] Format the test
Vitaly Buka [Thu, 23 Dec 2021 04:06:35 +0000 (20:06 -0800)]
[NFC][sanitizer] Format the test

2 years ago[NFC][sanitizer] Format a part of the file
Vitaly Buka [Thu, 23 Dec 2021 03:34:04 +0000 (19:34 -0800)]
[NFC][sanitizer] Format a part of the file

2 years ago[DAGCombiner] Avoid combining adjacent stores at -O0 to improve debug experience
Shivam Gupta [Thu, 23 Dec 2021 05:17:16 +0000 (10:47 +0530)]
[DAGCombiner] Avoid combining adjacent stores at -O0 to improve debug experience

When the source has a series of assignments, users reasonably want to
have the debugger step through each one individually. Turn off the combine
for adjacent stores so we get this behavior at -O0.

Similar to D7181.

Reviewed By: spatel, xgupta

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

2 years ago[ELF] Make InStruct members unique_ptr and remove associate make<XXX>
Fangrui Song [Thu, 23 Dec 2021 05:11:25 +0000 (21:11 -0800)]
[ELF] Make InStruct members unique_ptr and remove associate make<XXX>

See D116143 for benefits. My lld executable (x86-64) is 24+KiB smaller.

2 years ago[ELF] Change nonnull pointer parameters to references. NFC
Fangrui Song [Thu, 23 Dec 2021 05:09:57 +0000 (21:09 -0800)]
[ELF] Change nonnull pointer parameters to references. NFC

2 years ago[ELF] Change some non-null pointer parameters to references. NFC
Fangrui Song [Thu, 23 Dec 2021 04:51:11 +0000 (20:51 -0800)]
[ELF] Change some non-null pointer parameters to references. NFC

2 years agoRevert "[X86][MS-InlineAsm] Use exact conditions to recognize MS global variables"
Phoebe Wang [Thu, 23 Dec 2021 04:44:33 +0000 (12:44 +0800)]
Revert "[X86][MS-InlineAsm] Use exact conditions to recognize MS global variables"

This reverts commit 682d01a1c1c52bd95d3d06267d6017395770256b.

Revert for buildbot fails.

2 years agoRevert "Fix warning: "unused variable 'attrClass'" (NFC)"
Mehdi Amini [Thu, 23 Dec 2021 03:59:25 +0000 (03:59 +0000)]
Revert "Fix warning: "unused variable 'attrClass'" (NFC)"

This reverts commit 724e6861b3d64eb74ecd98eff88955c91a200940.
This broke the build.

2 years agoFix warning: "unused variable 'attrClass'" (NFC)
Mehdi Amini [Wed, 22 Dec 2021 23:42:05 +0000 (23:42 +0000)]
Fix warning: "unused variable 'attrClass'" (NFC)

2 years ago[X86][MS-InlineAsm] Use exact conditions to recognize MS global variables
Phoebe Wang [Thu, 23 Dec 2021 02:35:46 +0000 (10:35 +0800)]
[X86][MS-InlineAsm] Use exact conditions to recognize MS global variables

D115225 tried to roll back the effects on symbols of MS inline asm
introduced by D113096. But the combination of the conditions cannot
match all the changes. As a result, there are still fails after the
patch.

This patch fixes the problem by checking the exact conditions for MS
global variables, i.e., variable (by FrontendSize != 0) + non rip/eip
(by DefaultBaseReg == 0), so that we can fully roll back for D113096.

Reviewed By: skan

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

2 years agoAdd test coverage for D109917 and variants
Philip Reames [Thu, 23 Dec 2021 03:35:42 +0000 (19:35 -0800)]
Add test coverage for D109917 and variants

2 years agoAutogen a test in advance of another change
Philip Reames [Thu, 23 Dec 2021 03:25:22 +0000 (19:25 -0800)]
Autogen a test in advance of another change

2 years ago[RISCV] Override hasAndNotCompare to use more andn when have Zbb extension.
jacquesguan [Fri, 17 Dec 2021 09:28:27 +0000 (17:28 +0800)]
[RISCV] Override hasAndNotCompare to use more andn when have Zbb extension.

Enable transform (X & Y) == Y ---> (~X & Y) == 0 and (X & Y) != Y ---> (~X & Y) != 0 when have Zbb extension to use more andn instruction.

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

2 years ago[funcattrs] Use callsite param attributes from indirect calls when inferring access...
Philip Reames [Thu, 23 Dec 2021 02:21:59 +0000 (18:21 -0800)]
[funcattrs] Use callsite param attributes from indirect calls when inferring access attributes

Arguments to an indirect call is by definition outside the SCC, but there's no reason we can't use locally defined facts on the call site. This also has the nice effect of further simplifying the code.

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

2 years ago[docs] Update new builder instructions to starting on the staging buildmaster
Philip Reames [Thu, 23 Dec 2021 02:19:37 +0000 (18:19 -0800)]
[docs] Update new builder instructions to starting on the staging buildmaster

This adds a step in the instructions to switch to the production buildmaster at the very end (after explicit approval), and updates the early instruction to start with the builder pointed at the staging buildmaster.

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

2 years ago[ELF] Replace LazyObjFile with lazy ObjFile/BitcodeFile
Fangrui Song [Thu, 23 Dec 2021 01:41:50 +0000 (17:41 -0800)]
[ELF] Replace LazyObjFile with lazy ObjFile/BitcodeFile

The new `lazy` state is the inverse of the previous `LazyObjFile::extracted`.
There are many advantages:

* previously when a LazyObjFile was extracted, a new ObjFile/BitcodeFile was created; now the file is reused, just with `lazy` cleared
* avoid the confusing transfer of `symbols` from LazyObjFile to the new file
* the `incompatible file:` diagnostic is unified with `is incompatible with`
* simpler code, smaller executable (6200+ bytes smaller on x86-64)
* make eager parsing feasible (for parallel section/symbol table initialization)

2 years ago[libc++] Remove unused headers from <filesystem>
Nikolas Klauser [Wed, 22 Dec 2021 10:00:37 +0000 (11:00 +0100)]
[libc++] Remove unused headers from <filesystem>

Remove unused headers from `<filesystem>`

Spies: libcxx-commits

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

2 years ago[DFSan] Add functions to print origin trace from origin id instead of address.
Andrew Browne [Wed, 22 Dec 2021 20:35:42 +0000 (12:35 -0800)]
[DFSan] Add functions to print origin trace from origin id instead of address.

dfsan_print_origin_id_trace
dfsan_sprint_origin_id_trace

Reviewed By: vitalybuka

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

2 years ago[libc] add modified Eisel-Lemire for long doubles
Michael Jones [Fri, 12 Nov 2021 23:45:56 +0000 (15:45 -0800)]
[libc] add modified Eisel-Lemire for long doubles

The Eisel-Lemire algorithm is an effecient way to handle converting to
floating point numbers from strings, but in its base form it only
supports up to 64 bit floating point numbers. This adds an
implementation to handle long doubles.

Reviewed By: lntue

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

2 years ago[LLDB][DWARF] Fix duplicate TypeSP in type list
Zequan Wu [Tue, 21 Dec 2021 00:18:25 +0000 (16:18 -0800)]
[LLDB][DWARF] Fix duplicate TypeSP in type list

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

2 years agoRevert "[DwarfDebug] Support emitting function-local declaration for a lexical block...
David Blaikie [Wed, 22 Dec 2021 22:29:41 +0000 (14:29 -0800)]
Revert "[DwarfDebug] Support emitting function-local declaration for a lexical block" & dependent patches

This patch causes invalid DWARF to be generated in some cases of LTO +
Split DWARF - follow-up on the original review thread (D113741) contains
further detail and test cases.

This reverts commit 75b622a7959479ccdb758ebe0973061b7b4fcacd.
This reverts commit b6ccca217c35a95b8c2a337a7801b37cb23dbae2.
This reverts commit 514d37441918dd04a2cd4f35c08959d7c3ff096d.