platform/upstream/llvm.git
2 years ago[TSan] Mark test unsupported on Darwin
Julian Lettner [Mon, 24 Jan 2022 06:01:48 +0000 (22:01 -0800)]
[TSan] Mark test unsupported on Darwin

2 years agoRough guess at fixing lldb tests to handle Clang defaulting to DWARFv5
David Blaikie [Mon, 24 Jan 2022 05:24:05 +0000 (21:24 -0800)]
Rough guess at fixing lldb tests to handle Clang defaulting to DWARFv5

2 years ago[GlobalISel] Fold or of shifts with constant amount to funnel shift.
Abinav Puthan Purayil [Mon, 3 Jan 2022 10:15:52 +0000 (15:45 +0530)]
[GlobalISel] Fold or of shifts with constant amount to funnel shift.

This change folds (or (shl x, C0), (lshr y, C1)) to funnel shift iff C0
and C1 are constants where C0 + C1 is the bit-width of the shift
instructions.

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

2 years agoAdd missing function implementation from DWARF default change
David Blaikie [Mon, 24 Jan 2022 05:10:16 +0000 (21:10 -0800)]
Add missing function implementation from DWARF default change

Fix for d3b26dea16108c427b19b5480c9edc76edf8f5b4

2 years agoClang: Change the default DWARF version to 5
David Blaikie [Mon, 24 Jan 2022 04:45:25 +0000 (20:45 -0800)]
Clang: Change the default DWARF version to 5

(except on platforms that already opt in to specific versions - SCE,
Android, and Darwin using DWARFv4 explicitly, for instance)

2 years ago[Analysis] Use default member initialization (NFC)
Kazu Hirata [Mon, 24 Jan 2022 04:32:56 +0000 (20:32 -0800)]
[Analysis] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.

2 years ago[Vectorize] Remove unused variables (NFC)
Kazu Hirata [Mon, 24 Jan 2022 04:32:54 +0000 (20:32 -0800)]
[Vectorize] Remove unused variables (NFC)

2 years agoAdd modernize-use-default-member-init.UseAssignment to .clang-tidy
Kazu Hirata [Mon, 24 Jan 2022 04:32:52 +0000 (20:32 -0800)]
Add modernize-use-default-member-init.UseAssignment to .clang-tidy

2 years ago[NFC] [Coroutines] Rename tests in coro-align
Chuanqi Xu [Mon, 24 Jan 2022 03:03:12 +0000 (11:03 +0800)]
[NFC] [Coroutines] Rename tests in coro-align

This is required by ychen. See https://reviews.llvm.org/D117542

2 years ago[RISCV][NFC] Remove tailing whitespaces in RISCVInstrInfoVSDPatterns.td and RISCVInst...
Jim Lin [Mon, 24 Jan 2022 02:20:16 +0000 (10:20 +0800)]
[RISCV][NFC] Remove tailing whitespaces in RISCVInstrInfoVSDPatterns.td and RISCVInstrInfoVVLPatterns.td

2 years ago[C++20] [Module] fix bug 47716 and implement [module.interface]/p6
Chuanqi Xu [Mon, 24 Jan 2022 02:22:33 +0000 (10:22 +0800)]
[C++20] [Module] fix bug 47716 and implement [module.interface]/p6

This fixes bug 47716.

According to [module.interface]p2, it is meaningless to export an entity
which is not in namespace scope.
The reason why the compiler crashes is that the compiler missed
ExportDecl when the compiler traverse the subclass of DeclContext. So
here is the crash.

Also, the patch implements [module.interface]p6 in
Sema::CheckRedeclaration* functions.

Reviewed By: aaron.ballman, urnathan

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

2 years agoDebugInfo: Include template parameters for simplified template decls in type units
David Blaikie [Mon, 24 Jan 2022 00:07:43 +0000 (16:07 -0800)]
DebugInfo: Include template parameters for simplified template decls in type units

LLVM DebugInfo CodeGen synthesizes type declarations in type units when
referencing types that are not in type units. When those synthesized
types are templates and simplified template names (or mangled simplified
template names) are in use, the template arguments must be attached to
those declarations.

A deeper fix (with a CU or DICompositeType flag) that would also support
other uses of clang's -debug-forward-template-args (such as Sony's
platform) could/should be implemented to fix this more broadly.

2 years ago[X86] Add some basic tests for PR46809
Simon Pilgrim [Sun, 23 Jan 2022 22:48:26 +0000 (22:48 +0000)]
[X86] Add some basic tests for PR46809

2 years agoDebugInfo: Don't put types in type units if they reference internal linkage types
David Blaikie [Sat, 22 Jan 2022 04:20:39 +0000 (20:20 -0800)]
DebugInfo: Don't put types in type units if they reference internal linkage types

Doing this causes a declaration of the internal linkage (anonymous
namespace) type to be emitted in the type unit, which would then be
ambiguous as to which internal linkage definition it refers to (since
the name is only valid internally).

It's possible these internal linkage types could be resolved relative to
the unit the TU is referred to from - but that doesn't seem ideal, and
there's no reason to put the type in a type unit since it can only be
defined in one CU anyway (since otherwise it'd be an ODR violation) & so
avoiding the type unit should be a smaller DWARF encoding anyway.

This also addresses an issue with Simplified Template Names where the
template parameter could not be rebuilt from the declaration emitted
into the TU (specifically for an enum non-type template parameter, where
looking up the enumerators is necessary to rebuild the full template
name)

2 years ago[Analysis] Remove a redundant const from a return type (NFC)
Kazu Hirata [Sun, 23 Jan 2022 22:00:03 +0000 (14:00 -0800)]
[Analysis] Remove a redundant const from a return type (NFC)

Identified with readability-const-return-type.

2 years ago[Sema] Fix a bugprone argument comment (NFC)
Kazu Hirata [Sun, 23 Jan 2022 22:00:01 +0000 (14:00 -0800)]
[Sema] Fix a bugprone argument comment (NFC)

Identified with bugprone-argument-comment.

2 years ago[mlir] Ensure a newline at the end of a file (NFC)
Kazu Hirata [Sun, 23 Jan 2022 21:59:59 +0000 (13:59 -0800)]
[mlir] Ensure a newline at the end of a file (NFC)

2 years ago[RISCV] Add tests that do a bitreverse before or after a bswap. NFC
Craig Topper [Sun, 23 Jan 2022 21:37:33 +0000 (13:37 -0800)]
[RISCV] Add tests that do a bitreverse before or after a bswap. NFC

We don't optimize this as well as we could. Bitreverse is always
expanded to bswap and a shift/and/or sequence to swap bits within a
byte. The newly created bswap will either becomes a shift/and/or
sequence or rev8 instruction. We don't always realize the bswap is
redundant with another bswap before or after the bitreverse.

Found while thinking about the brev8 instruction from the
Cryptography extension. It's equivalent to bswap(bitreverse(x)) or
bitreverse(bswap(x)).

2 years ago[RISCV] Add bitreverse tests to bswap-ctlz-cttz-ctpop.ll. Add Zbb command lines. NFC
Craig Topper [Sun, 23 Jan 2022 17:42:18 +0000 (09:42 -0800)]
[RISCV] Add bitreverse tests to bswap-ctlz-cttz-ctpop.ll. Add Zbb command lines. NFC

Rename to include bitreverse. Add additional tests and Zbb command lines.

There's some overlapping tests with rv32zbb.ll and rv64zbb.ll. Maybe
I'll clean that up in a future patch.

2 years ago[X86] LowerFunnelShift - always lower vXi8 fshl by constant amounts as unpack(y,x...
Simon Pilgrim [Sun, 23 Jan 2022 21:34:55 +0000 (21:34 +0000)]
[X86] LowerFunnelShift - always lower vXi8 fshl by constant amounts as unpack(y,x) << zext(z)

This can always be lowered as PMULLW+PSRLWI+PACKUSWB

2 years ago[clang] Remove unused forward declarations (NFC)
Kazu Hirata [Sun, 23 Jan 2022 21:28:06 +0000 (13:28 -0800)]
[clang] Remove unused forward declarations (NFC)

2 years ago[clang] Forward-declare DynTypedNode (NFC)
Kazu Hirata [Sun, 23 Jan 2022 21:28:04 +0000 (13:28 -0800)]
[clang] Forward-declare DynTypedNode (NFC)

This patch adds a forward declaraiton of DynTypedNode.

DumpAST.h is relying on the forward declaration of DynTypedNode in
ASTContext.h, which is undesirable.

2 years ago[clang] Move the definition of ASTDiff (NFC)
Kazu Hirata [Sun, 23 Jan 2022 21:28:02 +0000 (13:28 -0800)]
[clang] Move the definition of ASTDiff (NFC)

This patch moves the definition of ASTDiff later within the header
file.

Without this patch, the header depends on the forward decalrations of
SyntaxTree and ComparisonOptions from another header file, which is
not desirable.  Since SyntaxTree and ComparisonOptions are defined in
ASTDiff.h, we can move the definition of ASTDiff later and stop
relying on the forward declarations from another header file.

2 years ago[X86] LowerFunnelShift - use supportedVectorShiftWithBaseAmnt to check for supported...
Simon Pilgrim [Sun, 23 Jan 2022 21:13:58 +0000 (21:13 +0000)]
[X86] LowerFunnelShift - use supportedVectorShiftWithBaseAmnt to check for supported scalar shifts

Allows us to reuse the ISD shift opcode instead of a mixture of ISD/X86ISD variants

2 years ago[RISCV] Adjust the header comment in RISCVInstrInfoZb.td to better integrate Zbk...
Craig Topper [Sun, 23 Jan 2022 17:42:18 +0000 (09:42 -0800)]
[RISCV] Adjust the header comment in RISCVInstrInfoZb.td to better integrate Zbk* extensions.

The Zbk* extensions have some overlap with Zb so have been placed in this file.

Reviewed By: VincentWu

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

2 years ago[MLIR][Presburger] Clean PresburgerSet identifier interface to match IntegerPolyhedro...
Groverkss [Sun, 23 Jan 2022 19:38:54 +0000 (01:08 +0530)]
[MLIR][Presburger] Clean PresburgerSet identifier interface to match IntegerPolyhedron's interface

This patch changes names of identifiers and their corresponding getters in
PresburgerSet to match those of IntegerPolyhedron.

Reviewed By: arjunp

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

2 years ago[Object] Remove a redundant return statement (NFC)
Kazu Hirata [Sun, 23 Jan 2022 19:07:16 +0000 (11:07 -0800)]
[Object] Remove a redundant return statement (NFC)

Identified with readability-redundant-control-flow.

2 years ago[Commands] Remove redundant member initialization (NFC)
Kazu Hirata [Sun, 23 Jan 2022 19:07:14 +0000 (11:07 -0800)]
[Commands] Remove redundant member initialization (NFC)

Identified with readability-redundant-member-init.

2 years ago[llvm] Fix header guards (NFC)
Kazu Hirata [Sun, 23 Jan 2022 19:07:12 +0000 (11:07 -0800)]
[llvm] Fix header guards (NFC)

Identified with llvm-header-guard.

2 years ago[NewGVN][NFC] precommit tests for PR53277
Nuno Lopes [Sun, 23 Jan 2022 19:06:21 +0000 (19:06 +0000)]
[NewGVN][NFC] precommit tests for PR53277

2 years ago[Support] Simplify parallelForEach{,N}
Fangrui Song [Sun, 23 Jan 2022 18:35:44 +0000 (10:35 -0800)]
[Support] Simplify parallelForEach{,N}

* Merge parallel_for_each into parallelForEach (this removes 1 `Fn(...)` call)
* Change parallelForEach to use parallelForEachN
* Move parallelForEachN into Parallel.cpp

My x86-64 `lld` executable is 100KiB smaller.
No noticeable difference in performance.

Reviewed By: lattner

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

2 years ago[libcxx][test] Make MSVC `<charconv>` test compile when testing MSVC
Casey Carter [Thu, 30 Dec 2021 00:02:00 +0000 (16:02 -0800)]
[libcxx][test] Make MSVC `<charconv>` test compile when testing MSVC

<meme>How many layers of irony are you on?</meme>

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

2 years ago[InstCombine] Add test coverage for PR48683
Simon Pilgrim [Sun, 23 Jan 2022 18:03:12 +0000 (18:03 +0000)]
[InstCombine] Add test coverage for PR48683

D108992 added self-multiply handling to KnownBits::mul but we don't use it yet..

2 years ago[RISCV] Merge some rvv intrinsic test cases that only differ by XLen type.
Craig Topper [Sun, 23 Jan 2022 07:05:19 +0000 (23:05 -0800)]
[RISCV] Merge some rvv intrinsic test cases that only differ by XLen type.

Instead of having a test for i32 XLen and i64 XLen, use sed to
replace iXLen with i32/i64 before running llc.

This change covers all of the floating point tests.

2 years ago[DAG] Fold (X & Y) != 0 --> zextOrTrunc(X & Y) iff everything but LSB is known zero...
Simon Pilgrim [Sun, 23 Jan 2022 16:36:18 +0000 (16:36 +0000)]
[DAG] Fold (X & Y) != 0 --> zextOrTrunc(X & Y) iff everything but LSB is known zero (PR51312)

Fixes parity codegen issue where we know all but the lowest bit is zero, we can replace the ICMPNE with 0 comparison with a ext/trunc

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

2 years ago[gn build] Port d2e8fb331835
LLVM GN Syncbot [Sun, 23 Jan 2022 16:30:34 +0000 (16:30 +0000)]
[gn build] Port d2e8fb331835

2 years agoRevert rG7c66aaddb128dc0f342830c1efaeb7a278bfc48c "[DAG] Fold (X & Y) != 0 --> zextOr...
Simon Pilgrim [Sun, 23 Jan 2022 16:28:38 +0000 (16:28 +0000)]
Revert rG7c66aaddb128dc0f342830c1efaeb7a278bfc48c "[DAG] Fold (X & Y) != 0 --> zextOrTrunc(X & Y) iff everything but LSB is known zero (PR51312)"

Noticed a typo in the getBooleanContents call just after I pressed commit :(

2 years ago[clang-tidy] Add readability-duplicate-include check
Richard [Sun, 2 Jan 2022 05:47:22 +0000 (22:47 -0700)]
[clang-tidy] Add readability-duplicate-include check

Looks for duplicate includes and removes them.

Every time an include directive is processed, check a vector of filenames
to see if the included file has already been included.  If so, it issues
a warning and a replacement to remove the entire line containing the
duplicated include directive.

When a macro is defined or undefined, the vector of filenames is cleared.
This enables including the same file multiple times, but getting
different expansions based on the set of active macros at the time of
inclusion.  For example:

  #undef NDEBUG
  #include "assertion.h"
  // ...code with assertions enabled

  #define NDEBUG
  #include "assertion.h"
  // ...code with assertions disabled

Since macros are redefined between the inclusion of assertion.h,
they are not flagged as redundant.

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

2 years ago[IR] document and update ctlz/cttz intrinsics to optionally return poison rather...
Sanjay Patel [Sun, 23 Jan 2022 16:11:26 +0000 (11:11 -0500)]
[IR] document and update ctlz/cttz intrinsics to optionally return poison rather than undef

The behavior in Analysis (knownbits) implements poison semantics already,
and we expect the transforms (for example, in instcombine) derived from
those semantics, so this patch changes the LangRef and remaining code to
be consistent. This is one more step in removing "undef" from LLVM.

Without this, I think https://github.com/llvm/llvm-project/issues/53330
has a legitimate complaint because that report wants to allow subsequent
code to mask off bits, and that is allowed with undef values. The clang
builtins are not actually documented anywhere AFAICT, but we might want
to add that to remove more uncertainty.

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

2 years ago[DAG] Fold (X & Y) != 0 --> zextOrTrunc(X & Y) iff everything but LSB is known zero...
Simon Pilgrim [Sun, 23 Jan 2022 16:20:34 +0000 (16:20 +0000)]
[DAG] Fold (X & Y) != 0 --> zextOrTrunc(X & Y) iff everything but LSB is known zero (PR51312)

Fixes parity codegen issue where we know all but the lowest bit is zero, we can replace the ICMPNE with 0 comparison with a ext/trunc

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

2 years ago[AVR] Make use of the constant value 0 in R1
Ayke van Laethem [Sun, 16 Jan 2022 07:42:48 +0000 (08:42 +0100)]
[AVR] Make use of the constant value 0 in R1

The register R1 is defined to have the constant value 0 in the avr-gcc
calling convention (which we follow). Unfortunately, we don't really
make use of it. This patch replaces `LDI 0` instructions with a copy
from R1.

This reduces code size: my AVR build of compiler-rt goes from 50660 to
50240 bytes of code size, which is a 0.8% reduction. Presumably it will
also improve execution speed, although I didn't measure this.

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

2 years ago[AVR] Remove regalloc workaround for LDDWRdPtrQ
Ayke van Laethem [Thu, 20 Jan 2022 20:50:26 +0000 (21:50 +0100)]
[AVR] Remove regalloc workaround for LDDWRdPtrQ

Background: https://github.com/avr-rust/rust-legacy-fork/issues/126

In short, this workaround was introduced to fix a "ran out of registers
during regalloc" issue. The root cause has since been fixed in
https://reviews.llvm.org/D54218 so this workaround can be removed.

There is one test that changes a little bit, removing a single
instruction. I also compiled compiler-rt before and after this patch but
didn't see a difference. So presumably the impact is very low. Still,
it's nice to be able to remove such a workaround.

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

2 years ago[clang-tidy] Remove gsl::at suggestion from cppcoreguidelines-pro-bounds-constant...
Carlos Galvez [Fri, 21 Jan 2022 07:59:27 +0000 (07:59 +0000)]
[clang-tidy] Remove gsl::at suggestion from cppcoreguidelines-pro-bounds-constant-array-index

Currently the fix hint is hardcoded to gsl::at(). This poses
a problem for people who, for a number of reasons, don't want
or cannot use the GSL library (introducing a new third-party
dependency into a project is not a minor task).

In these situations, the fix hint does more harm than good
as it creates confusion as to what the fix should be. People
can even misinterpret the fix "gsl::at" as e.g. "std::array::at",
which can lead to even more trouble (e.g. when having guidelines
that disallow exceptions).

Furthermore, this is not a requirement from the C++ Core Guidelines.
simply that array indexing needs to be safe. Each project should
be able to decide upon a strategy for safe indexing.

The fix-it is kept for people who want to use the GSL library.

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

2 years ago[X86] Add vector signbit parity checks for non-popcnt targets
Simon Pilgrim [Sun, 23 Jan 2022 15:34:41 +0000 (15:34 +0000)]
[X86] Add vector signbit parity checks for non-popcnt targets

Noticed while looking at D117983 - we miss some parity patterns with/without popcnt

2 years ago[libc++] Fix LWG3437 "__cpp_lib_polymorphic_allocator is in the wrong header"
Arthur O'Dwyer [Sat, 22 Jan 2022 20:24:53 +0000 (15:24 -0500)]
[libc++] Fix LWG3437 "__cpp_lib_polymorphic_allocator is in the wrong header"

https://cplusplus.github.io/LWG/issue3437

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

2 years ago[libc++] Mark LWG3541 as "Complete". NFC.
Arthur O'Dwyer [Sat, 22 Jan 2022 18:06:05 +0000 (13:06 -0500)]
[libc++] Mark LWG3541 as "Complete". NFC.

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

2 years agoFix "not all control paths return a value" warning. NFC.
Simon Pilgrim [Sun, 23 Jan 2022 15:14:10 +0000 (15:14 +0000)]
Fix "not all control paths return a value" warning. NFC.

2 years ago[lldb] TerminalState::Save - fix unused variable warning
Simon Pilgrim [Sun, 23 Jan 2022 15:12:44 +0000 (15:12 +0000)]
[lldb] TerminalState::Save - fix unused variable warning

Non-POSIX target builds don't use the file descriptor

2 years ago[lldb] PdbAstBuilder - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
Simon Pilgrim [Sun, 23 Jan 2022 15:11:08 +0000 (15:11 +0000)]
[lldb] PdbAstBuilder - use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[lldb] CxxModuleHandler - use cast<> instead of dyn_cast<> to avoid dereference of...
Simon Pilgrim [Sun, 23 Jan 2022 15:10:33 +0000 (15:10 +0000)]
[lldb] CxxModuleHandler - use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[clangd] Use castAs<> instead of getAs<> to avoid dereference of nullptr
Simon Pilgrim [Sun, 23 Jan 2022 13:24:36 +0000 (13:24 +0000)]
[clangd] Use castAs<> instead of getAs<> to avoid dereference of nullptr

The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[clang-tidy] Use cast<>/castAs<> instead of dyn_cast<>/getAs<> to avoid dereference...
Simon Pilgrim [Sun, 23 Jan 2022 12:57:12 +0000 (12:57 +0000)]
[clang-tidy] Use cast<>/castAs<> instead of dyn_cast<>/getAs<> to avoid dereference of nullptr

The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[llvm-objdump] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
Simon Pilgrim [Sun, 23 Jan 2022 12:50:12 +0000 (12:50 +0000)]
[llvm-objdump] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[CodeGenPrepare] Use dyn_cast result to check for null pointers
Simon Pilgrim [Sun, 23 Jan 2022 12:47:52 +0000 (12:47 +0000)]
[CodeGenPrepare] Use dyn_cast result to check for null pointers

Simplifies logic and helps the static analyzer correctly check for nullptr dereferences

2 years ago[llvm-objdump] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
Simon Pilgrim [Sun, 23 Jan 2022 12:45:12 +0000 (12:45 +0000)]
[llvm-objdump] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointers are always dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[X86] Regenerate avx512-mask-op.ll
Simon Pilgrim [Sun, 23 Jan 2022 11:34:25 +0000 (11:34 +0000)]
[X86] Regenerate avx512-mask-op.ll

Noticed on D86578 - several of the test cases were missing checks as they didn't start on a newline so the update script couldn't see them

2 years ago[llvm-objcopy][MachO] Implement --update-section
Alex Brachet [Sun, 23 Jan 2022 09:44:09 +0000 (09:44 +0000)]
[llvm-objcopy][MachO] Implement --update-section

Implements `--update-section` which is currently supported for ELF for Mach-O as well

Reviewed By: alexander-shaposhnikov

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

2 years ago[RISCV] Use FP ABI for some RVV intrinsic tests. NFC
Craig Topper [Sat, 22 Jan 2022 21:41:30 +0000 (13:41 -0800)]
[RISCV] Use FP ABI for some RVV intrinsic tests. NFC

Removes moves from GPR to FPR and improves f64 tests on RV32.

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

2 years ago[RISCV] Merge some rvv intrinsic test cases that only differ by XLen type.
Craig Topper [Sat, 22 Jan 2022 20:10:57 +0000 (12:10 -0800)]
[RISCV] Merge some rvv intrinsic test cases that only differ by XLen type.

Instead of having a test for i32 XLen and i64 XLen, use sed to
replace iXLen with i32/i64 before running llc.

This change updates tests for intrinsics that operate exclusively
on mask values. It removes over 4000 lines worth of test content.
More merging will come in future changes.

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

2 years ago[RISCV] Remove experimental prefix from rvv-related extensions.
eopXD [Fri, 21 Jan 2022 08:39:23 +0000 (00:39 -0800)]
[RISCV] Remove experimental prefix from rvv-related extensions.

Extensions affected: +v, +zve*, +zvl*

Reviewed By: craig.topper

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

2 years ago[libc++] Implement LWG3549: view_interface need not inherit from view_base
Joe Loser [Wed, 19 Jan 2022 20:16:15 +0000 (15:16 -0500)]
[libc++] Implement LWG3549: view_interface need not inherit from view_base

Implement LWG3549 by making `view_interface` not inherit from `view_base`. Types
are still views if they have a public and unambiguous derivation from
`view_interface`, so adjust the `enable_view` machinery as such to account for
that.

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

2 years ago[X86][MS] Change the alignment of f80 to 16 bytes on Windows 32bits to match with ICC
Phoebe Wang [Sun, 23 Jan 2022 01:14:58 +0000 (09:14 +0800)]
[X86][MS] Change the alignment of f80 to 16 bytes on Windows 32bits to match with ICC

MSVC currently doesn't support 80 bits long double. ICC supports it when
the option `/Qlong-double` is specified. Changing the alignment of f80
to 16 bytes so that we can be compatible with ICC's option.

Reviewed By: rnk, craig.topper

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

2 years ago[docs] [clang] Small documentation change for compilation databases
Dave [Sun, 23 Jan 2022 01:30:27 +0000 (17:30 -0800)]
[docs] [clang] Small documentation change for compilation databases

We have an page dedicated to compliation databases including
various ways to generate them, but we don't mention that clang
has a built in method to do this.  This addresses that.

Reviewed By: joerg

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

2 years ago[openmp] Allow x87 fp functions only in Openmp runtime for x86.
Malhar Jajoo [Sat, 22 Jan 2022 22:05:38 +0000 (22:05 +0000)]
[openmp] Allow x87 fp functions only in Openmp runtime for x86.

This patch allows Openmp runtime atomic functions operating on x87 high-precision
to be present only in Openmp runtime for x86 architectures

The functions affected are:

__kmpc_atomic_10
__kmpc_atomic_20
__kmpc_atomic_cmplx10_add
__kmpc_atomic_cmplx10_div
__kmpc_atomic_cmplx10_mul
__kmpc_atomic_cmplx10_sub
__kmpc_atomic_float10_add
__kmpc_atomic_float10_div
__kmpc_atomic_float10_mul
__kmpc_atomic_float10_sub

__kmpc_atomic_float10_add_fp
__kmpc_atomic_float10_div_fp
__kmpc_atomic_float10_mul_fp
__kmpc_atomic_float10_sub_fp
__kmpc_atomic_float10_max
__kmpc_atomic_float10_min

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

2 years ago[clang-tools-extra][cmake] Use `GNUInstallDirs` to support custom installation dirs.
John Ericson [Sun, 16 Jan 2022 05:52:22 +0000 (05:52 +0000)]
[clang-tools-extra][cmake] Use `GNUInstallDirs` to support custom installation dirs.

This is the original patch in my GNUInstallDirs series, now last to merge as the final piece!

It arose as a new draft of D28234. I initially did the unorthodox thing of pushing to that when I wasn't the original author, but since I ended up

 - Using `GNUInstallDirs`, rather than mimicking it, as the original author was hesitant to do but others requested.

 - Converting all the packages, not just LLVM, effecting many more projects than LLVM itself.

I figured it was time to make a new revision.

I have used this patch series (and many back-ports) as the basis of https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS), which was merged last spring (2021). It looked like people were generally on board in D28234, but I make note of this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM already has some partial support for these sorts of things. Variables like `COMPILER_RT_INSTALL_PATH` have already been dealt with. Variables like `LLVM_LIBDIR_SUFFIX` however, will require further work, so that we may use `CMAKE_INSTALL_LIBDIR`.

These remaining items will be addressed in further patches. What is here is now rote and so we should get it out of the way before dealing more intricately with the remainder.

Reviewed By: #libunwind, #libc, #libc_abi, compnerd

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

2 years ago[InstCombine] try to fold binop with phi operands
Sanjay Patel [Sat, 22 Jan 2022 17:36:12 +0000 (12:36 -0500)]
[InstCombine] try to fold binop with phi operands

This is an alternate version of D115914 that handles/tests all binary opcodes.

I suspect that we don't see these patterns too often because -simplifycfg
would convert the minimal cases into selects rather than leave them in phi form
(note: instcombine has logic holes for combining the select patterns too though,
so that's another potential patch).

We only create a new binop in a predecessor that unconditionally branches to
the final block.
https://alive2.llvm.org/ce/z/C57M2F
https://alive2.llvm.org/ce/z/WHwAoU (not safe to speculate an sdiv for example)
https://alive2.llvm.org/ce/z/rdVUvW (but it is ok on this path)

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

2 years ago[RISCV] Don't Custom legalize f16/f32/f64 bitcasts if those types aren't Legal.
Craig Topper [Sat, 22 Jan 2022 19:55:13 +0000 (11:55 -0800)]
[RISCV] Don't Custom legalize f16/f32/f64 bitcasts if those types aren't Legal.

2 years ago[openmp][cmake] Use `GNUInstallDirs` to support custom installation dirs
John Ericson [Sat, 22 Jan 2022 06:33:49 +0000 (01:33 -0500)]
[openmp][cmake] Use `GNUInstallDirs` to support custom installation dirs

I am breaking apart D99484 so the cause of build failures is easier to
understand.

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

2 years ago[flang] Support DECIMAL='COMMA' mode in namelist I/O
Peter Klausler [Thu, 20 Jan 2022 00:25:41 +0000 (16:25 -0800)]
[flang] Support DECIMAL='COMMA' mode in namelist I/O

DECIMAL='COMMA' mode affects item separators, real editing, and
complex editing.

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

2 years ago[flang] Don't drop format string for external child I/O
Peter Klausler [Fri, 14 Jan 2022 21:34:10 +0000 (13:34 -0800)]
[flang] Don't drop format string for external child I/O

In user-defined derived type I/O to an external unit, don't
omit the format string from the constructor of ChildFormattedIoStatement.
And include any user IOMSG text in the crash message of the
parent, if it doesn't catch errors.

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

2 years ago[libc++] [test] {cpo,niebloid}.compile.pass.cpp: Also test their constness.
Arthur O'Dwyer [Sat, 22 Jan 2022 16:53:00 +0000 (11:53 -0500)]
[libc++] [test] {cpo,niebloid}.compile.pass.cpp: Also test their constness.

This will detect if someone writes `inline auto cpo =` instead of
`inline constexpr auto cpo =`. I don't know how that'd be possible,
but it's easy to test, so let's test it.

2 years ago[LV] Always create VPWidenCanonicalIVRecipe, optimize away later.
Florian Hahn [Sat, 22 Jan 2022 15:34:10 +0000 (15:34 +0000)]
[LV] Always create VPWidenCanonicalIVRecipe, optimize away later.

This patch updates createBlockInMask to always generate
VPWidenCanonicalIVRecipe and adds a transform to optimize it away later,
if it is not needed.

This is a step towards breaking up VPWidenIntOrFpInductionRecipe and
explicitly distinguishing between vector phis and scalarizing.

Split off from D116123.

Reviewed By: Ayal

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

2 years ago[PowerPC] Support parsing GNU attributes in MC
Qiu Chaofan [Sat, 22 Jan 2022 15:29:34 +0000 (23:29 +0800)]
[PowerPC] Support parsing GNU attributes in MC

This patch is the first step to enable support of GNU attribute in LLVM
PowerPC, enabling it for PowerPC targets, otherwise llvm-mc raises error
when seeing the attribute section.

Reviewed By: jsji

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

2 years ago[PowerPC] Change CTR clobber estimation for 128-bit floating types
Qiu Chaofan [Sat, 22 Jan 2022 15:20:14 +0000 (23:20 +0800)]
[PowerPC] Change CTR clobber estimation for 128-bit floating types

Reviewed By: shchenz

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

2 years ago[DAG] Convert truncstore(extend(x)) back to store(x)
David Green [Sat, 22 Jan 2022 13:20:36 +0000 (13:20 +0000)]
[DAG] Convert truncstore(extend(x)) back to store(x)

Pulled out of D106237, this folds truncstore(extend(x)) back to store(x)
if the original store was legal. This can come up due to the order we
fold nodes. A fold from X86 needs to be adjusted to prevent infinite
loops, to have it pick the operand of a trunc more directly.

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

2 years agoreapply de872382951 "[JITLink] Add anonymous symbols in LinkGraph..."
luxufan [Sat, 22 Jan 2022 08:07:17 +0000 (16:07 +0800)]
reapply de872382951 "[JITLink] Add anonymous symbols in LinkGraph..."
with fixes

This reapply `de872382951572b70dfaefe8d77eb98d15586115`, which was
reverted in `fdb6578514dd3799ad23c8bbb7699577c0fb414d`

Add `# REQUIRES: asserts` in test file `anonymous_symbol.s` to disable
this test for non-debug build

2 years ago[AArch64] Optimize add/sub with immediate through MIPeepholeOpt
Micah Weston [Sat, 22 Jan 2022 12:39:22 +0000 (12:39 +0000)]
[AArch64] Optimize add/sub with immediate through MIPeepholeOpt

Fixes the build issue with D111034, whose goal was to optimize
add/sub with long immediates.

Optimize ([add|sub] r, imm) -> ([ADD|SUB] ([ADD|SUB] r, #imm0, lsl #12), #imm1),
if imm == (imm0<<12)+imm1. and both imm0 and imm1 are non-zero 12-bit unsigned
integers.

Optimize ([add|sub] r, imm) -> ([SUB|ADD] ([SUB|ADD] r, #imm0, lsl #12), #imm1),
if imm == -(imm0<<12)-imm1, and both imm0 and imm1 are non-zero 12-bit unsigned
integers.

The change which fixed the build issue in D111034 was the use of new virtual
registers so that SSA form is maintained until deleting MI.

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

2 years ago[mlir] Add SingleBlockImplicitTerminator<"tensor::YieldOp"> to PadOp.
Alexander Belyaev [Sat, 22 Jan 2022 10:42:47 +0000 (11:42 +0100)]
[mlir] Add SingleBlockImplicitTerminator<"tensor::YieldOp"> to PadOp.

2 years ago[libc++] Use addressof in unordered_set.
Mark de Wever [Fri, 21 Jan 2022 19:08:57 +0000 (20:08 +0100)]
[libc++] Use addressof in unordered_set.

This addresses the usage of `operator&` in `<unordered_set>`.

(Note there are still more headers with the same issue.)

Reviewed By: #libc, philnik, Quuxplusone

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

2 years ago[JITLink][RISCV] Support R_RISCV_SET* and R_RISCV_32_PCREL relocations
fourdim [Fri, 21 Jan 2022 19:34:13 +0000 (03:34 +0800)]
[JITLink][RISCV] Support R_RISCV_SET* and R_RISCV_32_PCREL relocations

This patch supports R_RISCV_SET* and R_RISCV_32_PCREL relocations in JITLink.

Reviewed By: StephenFan

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

2 years agoRevert "[JITLink] Add anonymous symbols in LinkGraph for unnamed temporary symbols"
luxufan [Sat, 22 Jan 2022 09:26:54 +0000 (17:26 +0800)]
Revert "[JITLink] Add anonymous symbols in LinkGraph for unnamed temporary symbols"

This reverts commit de872382951572b70dfaefe8d77eb98d15586115.

Buildbot check error

2 years ago[JITLink] Add anonymous symbols in LinkGraph for unnamed temporary symbols
luxufan [Sat, 22 Jan 2022 08:07:17 +0000 (16:07 +0800)]
[JITLink] Add anonymous symbols in LinkGraph for unnamed temporary symbols

In RISCV, temporary symbols will be used to generate dwarf, eh_frame sections..., and will be placed in object code's symbol table. However, LLVM does not use names on these temporary symbols. This patch add anonymous symbols in LinkGraph for these temporary symbols.

Reviewed By: lhames

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

2 years ago[MLIR] Fix negative gcd in `normalizeDivisionByGCD` function.
Prashant Kumar [Fri, 21 Jan 2022 18:23:22 +0000 (23:53 +0530)]
[MLIR] Fix negative gcd in `normalizeDivisionByGCD` function.

When the coefficients of dividend are negative, the gcd may be negative
which will change the sign of dividend and overflow denominator.

Reviewed By: Groverkss

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

2 years ago[time-trace] Add optimizer and codegen regions to NPM
Wei Wang [Tue, 18 Jan 2022 22:08:48 +0000 (14:08 -0800)]
[time-trace] Add optimizer and codegen regions to NPM

Optimizer and codegen regions were only added to legacy PM. Add
them to NPM as well.

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

2 years ago[flang] Allow INQUIRE() on a child unit in user-defined I/O procedure
Peter Klausler [Tue, 18 Jan 2022 18:40:10 +0000 (10:40 -0800)]
[flang] Allow INQUIRE() on a child unit in user-defined I/O procedure

A procedure that implements a user-defined derived type I/O operation
is allowed to perform an INQUIRE statement on its unit.

Differential Revision: https://reviews.llvm.org/D117905https://reviews.llvm.org/D117905

2 years ago[RISCV][RFC] add MC support for zbkc subextension
Alex Fan [Fri, 21 Jan 2022 11:51:09 +0000 (19:51 +0800)]
[RISCV][RFC] add MC support for zbkc subextension

Reviewed By: craig.topper

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

2 years ago[lldb] Allow aliases to aliases of raw input commands
Dave Lee [Fri, 14 Jan 2022 00:02:45 +0000 (16:02 -0800)]
[lldb] Allow aliases to aliases of raw input commands

Allow users to create aliases for aliases to raw input commands. That probably
sounds convoluted, so here's an example:

```
command alias some-setup env SOMEVAR=SOMEVALUE
```

This an alias based on `env`, which itself is an alias for `_regex-env`.
`_regex-env` is a `command regex` command, which takes raw input.

The above `some-setup` alias fails with:

```
error: Unable to create requested alias.
```

This change allows such aliases to be created. lldb already supports aliases to
aliases for parsed commands.

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

2 years ago[flang] Fix crash from USE-associated defined I/O subprograms
Peter Klausler [Tue, 18 Jan 2022 23:17:15 +0000 (15:17 -0800)]
[flang] Fix crash from USE-associated defined I/O subprograms

User-defined derived type I/O implementation subroutines and
generic interfaces may be USE-associated, but the code that builds
the type description table wasn't allowing for that possibility.
Add a call to GetUltimate() to cope.

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

2 years ago[TSan] Omit vfork interceptor iOS simulator runtime
Julian Lettner [Sat, 22 Jan 2022 00:58:06 +0000 (16:58 -0800)]
[TSan] Omit vfork interceptor iOS simulator runtime

`_vfork` moved from libsystem_kernel.dylib to libsystem_c.dylib as part
of the below changes.  The iOS simulator does not actually have
libsystem_kernel.dylib of its own, it only has the host Mac's.  The
umbrella-nature of Libsystem makes this movement transparent to
everyone; except the simulator! So when we "back deploy", i.e., use the
current version of TSan with an older simulator runtime then this symbol
is now missing, when we run on the latest OS (but an older simulator
runtime).

Note we use `SANITIZER_IOS` because usage of vfork is forbidden on iOS
and the API is completely unavailable on watchOS and tvOS, even if this
problem is specific to the iOS simulator.

Caused by:
rdar://74818691 (Shim vfork() to fork syscall on iOS)
rdar://76762076 (Shim vfork() to fork syscall on macOS)

Radar-Id: rdar://8634734

2 years ago[flang] Fix repeated "DT" editing
Peter Klausler [Wed, 19 Jan 2022 17:16:07 +0000 (09:16 -0800)]
[flang] Fix repeated "DT" editing

User-defined derived type editing in formatted I/O wasn't
working with repeat counts; e.g., "2DT(10)".  The solution required
some code to be moved from GetNextDataEdit() to CueUpNextDataEdit() so
that a stack entry for a nonparenthesized repeated data edit
descriptor would work correctly -- all other data edit descriptors
are capable of dealing with repetition in their callees, so the bug
hadn't been exposed before.

Debugging this problem led to some improvements in error messages
for bad format strings, and those changes have been retained; also,
a dead member function was discovered and expunged.

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

2 years ago[XRay][test] Clean up llc RUN lines
Fangrui Song [Sat, 22 Jan 2022 01:00:03 +0000 (17:00 -0800)]
[XRay][test] Clean up llc RUN lines

2 years ago[CMake] Passthrough OSX CMake options to builtins and runtimes
Petr Hosek [Mon, 10 Jan 2022 22:51:37 +0000 (14:51 -0800)]
[CMake] Passthrough OSX CMake options to builtins and runtimes

When using the default target, there's no other way to pass these
into the builtins and runtimes subbuilds.

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

2 years ago[libc++][test] Add const and reference tests for enable_view. NFC.
Joe Loser [Fri, 21 Jan 2022 20:01:34 +0000 (15:01 -0500)]
[libc++][test] Add const and reference tests for enable_view. NFC.

As discussed in https://reviews.llvm.org/D117714, there is missing test coverage
for the behavior of `enable_view` when given a const or reference qualified
type. Add such tests showing the current behavior.

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

2 years ago[split-file] Respect input file's line endings
Chris Bieneman [Fri, 21 Jan 2022 16:47:15 +0000 (10:47 -0600)]
[split-file] Respect input file's line endings

This change adds support for split-file to respect the line ending style
of the input file. This enables split-file to work as expected on
Windows with input files containing CRLF line endings.

The test files added along with this change mirror the existing basic
tests, but are forced to contain CRLF line endings via git attributes.
This will result in the tests always containing CRLF line endings when
checked out regardless of the user's OS.

Reviewed By: MaskRay

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

2 years ago[mlir][tosa] Add clamp + clamp as single clamp canonicalization
not-jenni [Sat, 22 Jan 2022 00:16:29 +0000 (16:16 -0800)]
[mlir][tosa] Add clamp + clamp as single clamp canonicalization

When 2 clamp ops are in a row, they can be canonicalized into a single clamp
that uses the most constrained range

Reviewed By: rsuderman

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

2 years agoNFC (build fix): Add header for llvm::errs().
Mitch Phillips [Sat, 22 Jan 2022 00:22:29 +0000 (16:22 -0800)]
NFC (build fix): Add header for llvm::errs().

Looks like e9211e039377 unfortunately broke the sanitizer build bots,
because those bots compile the symbolizer with DLLVM_ENABLE_THREADS=Off.
Likely, before the patch, this header was transitively included.

2 years ago[clang][cmake] Use `GNUInstallDirs` to support custom installation dirs
John Ericson [Sun, 16 Jan 2022 06:14:24 +0000 (06:14 +0000)]
[clang][cmake] Use `GNUInstallDirs` to support custom installation dirs

I am breaking apart D99484 so the cause of build failures is easier to
understand.

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

2 years ago[mlir][sparse] add ability for sparse tensor output
Aart Bik [Fri, 21 Jan 2022 01:27:23 +0000 (17:27 -0800)]
[mlir][sparse] add ability for sparse tensor output

Rationale:
Although file I/O is a bit alien to MLIR itself, we provide two convenient ways
for sparse tensor I/O. The input part was already there (behind the swiss army
knife sparse_tensor.new). Now we have a sparse_tensor.out to write out data. As
before, the ops are kept vague and may change in the future. For now this
allows us to compare TACO vs MLIR very easily.

Reviewed By: bixia

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

2 years ago[lldb] Fix timer logging inverted quiet condition
Dave Lee [Thu, 20 Jan 2022 22:18:20 +0000 (14:18 -0800)]
[lldb] Fix timer logging inverted quiet condition

The logic of `g_quiet` was inverted in D26243. This corrects the issue.

Without this, running `log timers enable` produces a high volume of incremental
timer output.

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

2 years ago[llvm-pdbutil] Fix gaps ouput.
Zequan Wu [Fri, 21 Jan 2022 23:09:42 +0000 (15:09 -0800)]
[llvm-pdbutil] Fix gaps ouput.