platform/upstream/llvm.git
3 years ago[RISCV] Implement the pseudo compare builtin.
Hsiangkai Wang [Tue, 20 Apr 2021 06:50:42 +0000 (14:50 +0800)]
[RISCV] Implement the pseudo compare builtin.

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

3 years ago[RISCV] Implement the vfabs.v/vfneg.v builtin.
Hsiangkai Wang [Tue, 20 Apr 2021 05:17:40 +0000 (13:17 +0800)]
[RISCV] Implement the vfabs.v/vfneg.v builtin.

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

3 years ago[RISCV] Implement the vmmv.m/vmnot.m builtin.
Hsiangkai Wang [Tue, 20 Apr 2021 03:12:53 +0000 (11:12 +0800)]
[RISCV] Implement the vmmv.m/vmnot.m builtin.

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

3 years ago[RISCV] Cleanup setOperationAction calls for INTRINSIC_WO_CHAIN/INTRINSIC_W_CHAIN
Craig Topper [Mon, 26 Apr 2021 06:36:28 +0000 (23:36 -0700)]
[RISCV] Cleanup setOperationAction calls for INTRINSIC_WO_CHAIN/INTRINSIC_W_CHAIN

We have several extensions that need i32 to be Custom for
INTRINSIC_WO_CHAIN with RV64 so enable it for all RV64.

For V extension, make i32 Custom for RV64 and i64 Custom for RV32.
When the i32 or i64 is legal, the operation action doesn't matter.
LegalizeDAG checks MVT::Other rather than the real type.

3 years ago[RISCV] Optimize addition with immediate
Ben Shi [Mon, 26 Apr 2021 05:26:17 +0000 (13:26 +0800)]
[RISCV] Optimize addition with immediate

Reviewed by: craig.topper

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

3 years ago[RISCV] Teach DAG combine what bits Zbp instructions demanded from their inputs.
Craig Topper [Mon, 26 Apr 2021 03:17:13 +0000 (20:17 -0700)]
[RISCV] Teach DAG combine what bits Zbp instructions demanded from their inputs.

This teaches DAG combine that shift amount operands for grev, gorc
shfl, unshfl only read a few bits.

This also teaches DAG combine that grevw, gorcw, shflw, unshflw,
bcompressw, bdecompressw only consume the lower 32 bits of their
inputs.

In the future we can teach SimplifyDemandedBits to also propagate
demanded bits of the output to the inputs in some cases.

3 years ago[RISCV] [1/2] Add IR intrinsic for Zbe extension
Levy Hsu [Mon, 26 Apr 2021 01:49:40 +0000 (18:49 -0700)]
[RISCV] [1/2] Add IR intrinsic for Zbe extension

RV32/64:
bcompress
bdecompress

RV64 ONLY:
bcompressw
bdecompressw

Reviewed By: craig.topper

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

3 years ago[DebugInfo][AIX] Set target debugger-tune default to dbx
Jinsong Ji [Sun, 25 Apr 2021 21:59:24 +0000 (21:59 +0000)]
[DebugInfo][AIX] Set target debugger-tune default to dbx

https://reviews.llvm.org/D99400 set clang DefaultDebuggerTuning for AIX
to dbx. However, we still need to update the target default so that llc
and other tools will get the same default debuggertuning, and avoid
passing extra options in LTO.

Reviewed By: #powerpc, shchenz, dblaikie

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

3 years ago[ORC] Avoid invalidating iterators in EHFrameRegistrationPlugin.
Lang Hames [Sun, 25 Apr 2021 23:47:56 +0000 (16:47 -0700)]
[ORC] Avoid invalidating iterators in EHFrameRegistrationPlugin.

In EHFrameRegistrationPlugin::notifyTransferringResources if SrcKey had
eh-frames associated but DstKey did not we would create a new entry for DskKey,
invalidating the iterator for SrcKey in the process. This commit fixes that by
removing SrcKey first in this case.

3 years ago[clangd] Rename HeuristicResolver::resolveCallExpr() to resolveTypeOfCallExpr()
Nathan Ridge [Mon, 19 Apr 2021 06:57:16 +0000 (02:57 -0400)]
[clangd] Rename HeuristicResolver::resolveCallExpr() to resolveTypeOfCallExpr()

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

3 years ago[clangd] Omit parameter hint for setter functions
Nathan Ridge [Sun, 18 Apr 2021 19:26:04 +0000 (15:26 -0400)]
[clangd] Omit parameter hint for setter functions

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

3 years ago[clangd] Omit parameter hint if parameter name comment is present
Nathan Ridge [Sun, 18 Apr 2021 07:15:15 +0000 (03:15 -0400)]
[clangd] Omit parameter hint if parameter name comment is present

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

3 years ago[scudo][NFC] Fix cast warning
Vitaly Buka [Sun, 25 Apr 2021 07:22:26 +0000 (00:22 -0700)]
[scudo][NFC] Fix cast warning

3 years ago[scudo] Mark ARM64 as supported platform
Vitaly Buka [Sun, 25 Apr 2021 07:21:34 +0000 (00:21 -0700)]
[scudo] Mark ARM64 as supported platform

3 years ago[sanitizer] Use COMPILER_RT_EMULATOR with gtests
Vitaly Buka [Thu, 22 Apr 2021 18:16:21 +0000 (11:16 -0700)]
[sanitizer] Use COMPILER_RT_EMULATOR with gtests

Reviewed By: morehouse

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

3 years ago[NFC][X86][AVX2] Add baseline CodeGen/CostModel tests for interleaved loads/stores...
Roman Lebedev [Sun, 25 Apr 2021 18:35:05 +0000 (21:35 +0300)]
[NFC][X86][AVX2] Add baseline CodeGen/CostModel tests for interleaved loads/stores of i16 w/ strides 2/3/4

`X86TTIImpl::getInterleavedMemoryOpCostAVX2()` currently contains data
only for a handful of tuples. For now, at least add tests for a few more.

I'm guessing that we care how well the patterns codegen since
we use their presumed cost for vectorization decisions,
so i've added codegen tests too.

There's one really easy caveat for these codegen tests:
for interleaved load tests, we really have to ensure that the
deinterleaved vectors are escaped separately. Similarly for stores.

3 years ago[clangd] Use HeuristicResolver to produce a better semantic token for name referring...
Nathan Ridge [Mon, 22 Mar 2021 06:43:41 +0000 (02:43 -0400)]
[clangd] Use HeuristicResolver to produce a better semantic token for name referring to UnresolvedUsingValueDecl

Fixes https://github.com/clangd/clangd/issues/686

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

3 years ago[clangd] Produce semantic token for name referring to UnresolvedUsingValueDecl
Nathan Ridge [Mon, 22 Mar 2021 06:13:53 +0000 (02:13 -0400)]
[clangd] Produce semantic token for name referring to UnresolvedUsingValueDecl

For now, use the token kind Unknown. We may be able to improve on this
using HeuristicResolver.

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

3 years ago[googlemock] Fix warnings about superfluous semicolons after 68ff493dfc950c05c102e09e...
Martin Storsjö [Sun, 25 Apr 2021 20:41:37 +0000 (23:41 +0300)]
[googlemock] Fix warnings about superfluous semicolons after 68ff493dfc950c05c102e09e14a16d06253ffa16. NFC.

3 years agoDisable deprecated-copy warnings on various LLVM code to bring the bot back to green
Nemanja Ivanovic [Sun, 25 Apr 2021 17:37:25 +0000 (10:37 -0700)]
Disable deprecated-copy warnings on various LLVM code to bring the bot back to green

Bootstrap with `-Werror` is currently broken due to D79714.
This patch is required to bring the bootstrap bot back to green. The
code will likely need to be fixed and the pragmas removed in due time,
but for now we need to bring the bot back up.

Bot that is currently failing:
https://lab.llvm.org/buildbot/#/builders/36/builds/7680

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

3 years ago[NFC] Fixed some D79714 warnings
Vitaly Buka [Sun, 25 Apr 2021 18:28:26 +0000 (11:28 -0700)]
[NFC] Fixed some D79714 warnings

3 years ago[ARM][disassembler] Fix incorrect number of MCOperands generated by the disassembler
Min-Yih Hsu [Thu, 15 Apr 2021 18:00:05 +0000 (11:00 -0700)]
[ARM][disassembler] Fix incorrect number of MCOperands generated by the disassembler

Try to fix bug 49974.

This patch fixes two issues:

 1. BL does not use predicate (BL_pred is the predicate version of BL),
    so we shouldn't add predicate operands in DecodeBranchImmInstruction.
 2. Inside DecodeT2AddSubSPImm, we shouldn't add predicate operands into
    the MCInst because ARMDisassembler::AddThumbPredicate will do that for us.
    However, we should handle CC-out operand for t2SUBspImm and t2AddspImm.

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

3 years ago[lldb] [Process/NetBSD] Report fork/vfork events to LLGS
Michał Górny [Thu, 15 Apr 2021 13:08:03 +0000 (15:08 +0200)]
[lldb] [Process/NetBSD] Report fork/vfork events to LLGS

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

3 years ago[lldb] [Process/FreeBSD] Report fork/vfork events to LLGS
Michał Górny [Thu, 15 Apr 2021 11:17:00 +0000 (13:17 +0200)]
[lldb] [Process/FreeBSD] Report fork/vfork events to LLGS

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

3 years ago[VPlan] Add VPBlockUtils::blocksOnly helper.
Florian Hahn [Sun, 25 Apr 2021 16:11:41 +0000 (17:11 +0100)]
[VPlan] Add VPBlockUtils::blocksOnly helper.

This patch adds a blocksOnly helpers which take an iterator range
over VPBlockBase * or const VPBlockBase * and returns an interator
range that only include BlockTy blocks. The accesses are casted to
BlockTy.

Reviewed By: a.elovikov

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

3 years ago[gn build] Port 1cea7ab4ba13
LLVM GN Syncbot [Sun, 25 Apr 2021 12:00:31 +0000 (12:00 +0000)]
[gn build] Port 1cea7ab4ba13

3 years ago[demangler] Use standard semantics for StringView::substr
Tomasz Miąsko [Sun, 25 Apr 2021 11:56:08 +0000 (13:56 +0200)]
[demangler] Use standard semantics for StringView::substr

The StringView::substr now accepts a substring starting position and its
length instead of previous non-standard `from` & `to` positions.

All uses of two argument StringView::substr are in MicrosoftDemangler
and have 0 as a starting position, so no changes are necessary.

This also fixes a bug where attempting to extract a suffix with substr
(a `to` position equal to size) would return a substring without the
last character.

Fixing the issue should not introduce observable changes in the
demangler, since as currently used, a second argument to
StringView::substr is either: 1) a result of a successful call to
StringView::find and so necessarily smaller than size., or 2) in the
case of Demangler::demangleCharLiteral potentially equal to size, but
with demangler expecting more data to follow later on and failing either
way.

Reviewed By: #libc_abi, ldionne, erik.pilkington

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

3 years agoRevert rG2149aa73f640c96 "[X86] Add support for reusing ZF etc. from locked XADD...
Simon Pilgrim [Sun, 25 Apr 2021 11:45:07 +0000 (12:45 +0100)]
Revert rG2149aa73f640c96 "[X86] Add support for reusing ZF etc. from locked XADD instructions (PR20841)"

This might be the cause of some msan build failures - I don't have access to a msan build right now, so this is a speculative revert.

3 years ago[gn build] Port a354fd56c504
LLVM GN Syncbot [Sun, 25 Apr 2021 11:27:54 +0000 (11:27 +0000)]
[gn build] Port a354fd56c504

3 years ago[libc++] Adds __utility/to_underlying.h.
Mark de Wever [Sat, 24 Apr 2021 15:28:35 +0000 (17:28 +0200)]
[libc++] Adds __utility/to_underlying.h.

During the review of D97115 it was mentioned adding the `<utility>`
header for `__to_underlying` was a bit unfortunate. Nowadays we tend to
implement smaller headers, so a good reason to move `std::to_underlying`
to its own header and adjust `<charconv>` to use the new header.

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

3 years agoAdd srcloc output to clang-query
Stephen Kelly [Sat, 12 Dec 2020 18:39:49 +0000 (18:39 +0000)]
Add srcloc output to clang-query

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

3 years ago[AST] Add DeclarationNameInfo to node introspection
Stephen Kelly [Tue, 20 Apr 2021 21:46:08 +0000 (22:46 +0100)]
[AST] Add DeclarationNameInfo to node introspection

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

3 years ago[X86] Add support for reusing ZF etc. from locked XADD instructions (PR20841)
Simon Pilgrim [Sun, 25 Apr 2021 11:02:33 +0000 (12:02 +0100)]
[X86] Add support for reusing ZF etc. from locked XADD instructions (PR20841)

XADD has the same EFLAGS behaviour as ADD

3 years ago[X86] Add PR20841 test cases showing failure to reuse ZF from XADD ops
Simon Pilgrim [Sun, 25 Apr 2021 10:45:51 +0000 (11:45 +0100)]
[X86] Add PR20841 test cases showing failure to reuse ZF from XADD ops

3 years ago[X86] Regenerate atomic-flags.ll test file
Simon Pilgrim [Sun, 25 Apr 2021 10:36:36 +0000 (11:36 +0100)]
[X86] Regenerate atomic-flags.ll test file

3 years ago[NewGVN] Properly transfer PredDep in move constructor.
Florian Hahn [Sun, 25 Apr 2021 10:22:59 +0000 (11:22 +0100)]
[NewGVN] Properly transfer PredDep in move constructor.

3 years ago[NewGVN] Use ExprResult to add extra predicate users.
Florian Hahn [Sun, 25 Apr 2021 09:34:39 +0000 (10:34 +0100)]
[NewGVN] Use ExprResult to add extra predicate users.

This patch updates performSymbolicPredicateInfoEvaluation to manage
registering additional dependencies using ExprResult. Similar to D99987,
this fixes an issues where we failed to track the correct dependency for
a phi-of-ops value, which is marked as temporary.

Fixes PR49873.

Reviewed By: asbirlea, ruiling

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

3 years ago[RISCV] Apply clang_builtin_alias to overloaded builtins.
Hsiangkai Wang [Fri, 16 Apr 2021 15:39:08 +0000 (23:39 +0800)]
[RISCV] Apply clang_builtin_alias to overloaded builtins.

We only apply `clang_builtin_alias` to non-masked builtins.
Masked builtins could not use `clang_builtin_alias` because the
operand order is different between overloaded intrinsics and builtins.

A bunch of test cases need to be updated.

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

3 years ago[PhaseOrdering] Add PR32544 test coverage
Simon Pilgrim [Sun, 25 Apr 2021 10:05:32 +0000 (11:05 +0100)]
[PhaseOrdering] Add PR32544 test coverage

3 years ago[X86] Refine AMX fast register allocation
Xiang1 Zhang [Sun, 25 Apr 2021 06:20:23 +0000 (14:20 +0800)]
[X86] Refine AMX fast register allocation

3 years ago[X86] Support AMX fast register allocation
Xiang1 Zhang [Wed, 7 Apr 2021 00:10:31 +0000 (08:10 +0800)]
[X86] Support AMX fast register allocation

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

3 years ago[Clang] Fixup for D100611
Hsiangkai Wang [Sun, 25 Apr 2021 01:29:15 +0000 (09:29 +0800)]
[Clang] Fixup for D100611

3 years ago[ORC][C-bindings] Fix missing ')' in comments.
Lang Hames [Sun, 25 Apr 2021 01:01:56 +0000 (18:01 -0700)]
[ORC][C-bindings] Fix missing ')' in comments.

3 years ago[Clang] Add clang attribute `clang_builtin_alias`.
Hsiangkai Wang [Fri, 16 Apr 2021 01:21:01 +0000 (09:21 +0800)]
[Clang] Add clang attribute `clang_builtin_alias`.

In some cases, we want to provide the alias name for the clang builtins.
For example, the arguments must be constant integers for some RISC-V builtins.
If we use wrapper functions, we could not constrain the arguments be constant
integer. This attribute is used to achieve the purpose.

Besides this, use `clang_builtin_alias` is more efficient than using
wrapper functions. We use this attribute to deal with test time issue
reported in https://bugs.llvm.org/show_bug.cgi?id=49962.

In our downstream testing, it could decrease the testing time from 6.3
seconds to 3.7 seconds for vloxei.c test.

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

3 years ago[ORC-RT] Re-apply "Initial ORC Runtime directories and build..." with fixes.
Lang Hames [Sat, 24 Apr 2021 04:14:56 +0000 (21:14 -0700)]
[ORC-RT] Re-apply "Initial ORC Runtime directories and build..." with fixes.

This reapplies 1e1d75b190c, which was reverted in ce1a4d53231 due to build
failures.

The unconditional dependencies on clang and llvm-jitlink in
compiler-rt/test/orc/CMakeLists.txt have been removed -- they don't appear to
be necessary, and I suspect they're the cause of the build failures seen
earlier.

3 years agoSimplify the breakpoint setting in DynamicLoaderMacOS::SetNotificationBreakpoint
Jason Molenda [Sat, 24 Apr 2021 21:03:41 +0000 (14:03 -0700)]
Simplify the breakpoint setting in DynamicLoaderMacOS::SetNotificationBreakpoint

Instead of looking up a symbol and reducing it to an addr_t to set
a breakpoint, set the breakpoint on the function name directly.
The old Mac OS X dynamic loader plugin worked in terms of addresses
and I incorrectly emulated that here when I wrote this newer one.

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

3 years ago[SCEV] Fix applyLoopGuards() chaining for ne predicates
Nikita Popov [Sat, 24 Apr 2021 19:43:46 +0000 (21:43 +0200)]
[SCEV] Fix applyLoopGuards() chaining for ne predicates

ICMP_NE predicates directly overwrote the rewritten result,
instead of chaining it with previous rewrites, as was done for
ICMP_ULT and ICMP_ULE. This means that some guards were effectively
discarded, depending on their order.

3 years ago[SCEV] Add additional NE applyLoopGuards() test (NFC)
Nikita Popov [Sat, 24 Apr 2021 19:36:23 +0000 (21:36 +0200)]
[SCEV] Add additional NE applyLoopGuards() test (NFC)

This is the same as @test_guard_ult_ne, just with the order of
the conditions swapped.

3 years ago[PatternMatch] Improve m_Deferred() documentation (NFC)
Nikita Popov [Sat, 24 Apr 2021 18:58:33 +0000 (20:58 +0200)]
[PatternMatch] Improve m_Deferred() documentation (NFC)

m_Deferred() has nothing to do with commutative matchers, it needs
to be used whenever the value to match is determinde as part of
the same match expression.

3 years ago[NFC] Refactor how CFI section types are represented in AsmPrinter
RamNalamothu [Sat, 24 Apr 2021 17:56:52 +0000 (23:26 +0530)]
[NFC] Refactor how CFI section types are represented in AsmPrinter

In terms of readability, the `enum CFIMoveType` didn't better document what it
intends to convey i.e. the type of CFI section that gets emitted.

Reviewed By: dblaikie, MaskRay

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

3 years ago[Analysis] Attribute alignment should not prevent tail call optimization
Dávid Bolvanský [Sat, 24 Apr 2021 17:55:04 +0000 (19:55 +0200)]
[Analysis] Attribute alignment should not prevent tail call optimization
Fixes tail folding issue mentioned in D100879.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D101230

3 years ago[flang] Fix crash from -DMACRO= with empty replacement
peter klausler [Fri, 23 Apr 2021 23:26:49 +0000 (16:26 -0700)]
[flang] Fix crash from -DMACRO= with empty replacement

Such macros were exposing some edge cases in the preprocessor
regarding empty tokens.

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

3 years ago[NewGVN] Use performSymbolicEvaluation instead of createExpression.
Florian Hahn [Sat, 24 Apr 2021 14:06:17 +0000 (15:06 +0100)]
[NewGVN] Use performSymbolicEvaluation instead of createExpression.

performSymbolicEvaluation is used to obtain the symbolic expression when
visiting instructions and this is used to determine their congruence
class.

performSymbolicEvaluation only creates expressions for certain
instructions (via createExpression). For unsupported instructions,
'unknown' expression are created.

The use of createExpression in processOutgoingEdges means we may
simplify the condition in processOutgoingEdges to a constant in the
initial round of processing, but we use Unknown(I) for the congruence
class. If an operand of I changes the expression Unknown(I) stays the
same, so there is no update of the congruence class of I. Hence it
won't get re-visited. So if an operand of I changes in a way that causes
createExpression to return different result, this update is missed.

This patch updates the code to use performSymbolicEvaluation, to be
symmetric with the congruence class updating code.

Reviewed By: asbirlea

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

3 years ago[InstCombine] Fixed UB in foldCtpop
Dávid Bolvanský [Sat, 24 Apr 2021 17:43:20 +0000 (19:43 +0200)]
[InstCombine] Fixed UB in foldCtpop

3 years ago[AArch64] Enable UseAA globally in the AArch64 backend
David Green [Sat, 24 Apr 2021 16:51:50 +0000 (17:51 +0100)]
[AArch64] Enable UseAA globally in the AArch64 backend

This is similar to D69796 from the ARM backend. We remove the UseAA
feature, enabling it globally in the AArch64 backend. This should in
general be an improvement allowing the backend to reorder more
instructions in scheduling and codegen, and enabling it by default helps
to improve the testing of the feature, not making it cpu-specific. A
debugging option is added instead for testing.

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

3 years ago[Tests] Rename variable to fix broken buildbots
Dávid Bolvanský [Sat, 24 Apr 2021 16:45:36 +0000 (18:45 +0200)]
[Tests] Rename variable to fix broken buildbots

3 years agoFix null ptr crash dumping TemplateTemplateParmDecl
David Tolnay [Sat, 24 Apr 2021 16:26:33 +0000 (12:26 -0400)]
Fix null ptr crash dumping TemplateTemplateParmDecl

The following program winds up with
D->getDefaultArgStorage().getInheritedFrom() == nullptr
during dumping the TemplateTemplateParmDecl corresponding to the
template parameter of i.

  template <typename>
  struct R;
  template <template <typename> class = R>
  void i();

This patch fixes the null pointer dereference.

3 years ago[InstCombine] ctpop(rot(X)) -> ctpop(X)
Dávid Bolvanský [Sat, 24 Apr 2021 16:24:54 +0000 (18:24 +0200)]
[InstCombine] ctpop(rot(X)) -> ctpop(X)

Proof:
https://alive2.llvm.org/ce/z/ss2zyt - rotl
https://alive2.llvm.org/ce/z/ZM7Aue - rotr

Reviewed By: nikic

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

3 years ago[InstCombine] ctpop(X) + ctpop(Y) => ctpop(X | Y) if X and Y have no common bits...
Dávid Bolvanský [Sat, 24 Apr 2021 15:44:20 +0000 (17:44 +0200)]
[InstCombine] ctpop(X) + ctpop(Y) => ctpop(X | Y) if X and Y have no common bits (PR48999)

For example:

```
int src(unsigned int a, unsigned int b)
{
    return __builtin_popcount(a << 16) + __builtin_popcount(b >> 16);
}

int tgt(unsigned int a, unsigned int b)
{
    return __builtin_popcount((a << 16)  | (b >> 16));
}
```

Reviewed By: nikic

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

3 years ago[libcxx][iterator] adds `std::input_or_output_iterator` and `std::sentinel_for`
Christopher Di Bella [Fri, 9 Apr 2021 02:10:32 +0000 (02:10 +0000)]
[libcxx][iterator] adds `std::input_or_output_iterator` and `std::sentinel_for`

Implements parts of:
    * P0896R4 The One Ranges Proposal`

Depends on D100080

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

3 years ago[libc++][doc] Adds a Format library status page.
Mark de Wever [Sat, 17 Apr 2021 16:49:37 +0000 (18:49 +0200)]
[libc++][doc] Adds a Format library status page.

A status page for libc++'s Format library. The page is inspired by
@zoecarver's Ranges status page.

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

3 years ago[InstCombine] Add tests for comparison of integer parts (NFC)
Nikita Popov [Sat, 24 Apr 2021 14:20:15 +0000 (16:20 +0200)]
[InstCombine] Add tests for comparison of integer parts (NFC)

3 years ago[lld/mac] Don't assert when using -exported_symbol with private symbol
Nico Weber [Sat, 24 Apr 2021 02:55:05 +0000 (22:55 -0400)]
[lld/mac] Don't assert when using -exported_symbol with private symbol

When I added this assert in D93609, it asserted that a symbol that
is privateExtern is also isExternal().

In D98381 the privateExtern check moved into shouldExportSymbol()
but the assert didn't -- now it checked that _every_ non-exported
symbol is isExternal(), which isn't true. Move the assert into the
privateExtern check where it used to be.

Fixes PR50098.

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

3 years ago[libc++] Remove if-else to make branch predictor happy
Shu Tian [Sat, 24 Apr 2021 14:08:55 +0000 (16:08 +0200)]
[libc++] Remove if-else to make branch predictor happy

Reviewed By: #libc, ldionne, Quuxplusone, Mordante

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

3 years ago[ARM] Format ARMISD node definitions. NFC
David Green [Sat, 24 Apr 2021 13:50:32 +0000 (14:50 +0100)]
[ARM] Format ARMISD node definitions. NFC

This clang-formats the list of ARMISD nodes. Usually this is something I
would avoid, but these cause problems with formatting every time new
nodes are added.

The list in getTargetNodeName also makes use of MAKE_CASE macros, as
other backends do.

3 years ago[Clang] Added heading to doc for malloc attribute
Dávid Bolvanský [Sat, 24 Apr 2021 13:35:16 +0000 (15:35 +0200)]
[Clang] Added heading to doc for malloc attribute

3 years ago[Clang] Added doc for malloc attribute
Dávid Bolvanský [Sat, 24 Apr 2021 13:27:29 +0000 (15:27 +0200)]
[Clang] Added doc for malloc attribute

Taken mostly from LLVM langref.

3 years ago[lld/mac] simplify export-options.s test a bit
Nico Weber [Sat, 24 Apr 2021 02:47:13 +0000 (22:47 -0400)]
[lld/mac] simplify export-options.s test a bit

- the macro seems needlessly clever -- shorter and imho clearer without it
- give all filenames an extension so they look like filenames
- rename .private_extern symbol from _private to _private_extern
  to prepare for follow-up that adds a truly private symbol

No behavior change.

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

3 years ago[lld/mac] add test coverage for -sectcreate and -order_file with --reproduce
Nico Weber [Sat, 24 Apr 2021 02:03:42 +0000 (22:03 -0400)]
[lld/mac] add test coverage for -sectcreate and -order_file with --reproduce

Would've caught the (since fixed) regression in D97610.

No behavior change.

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

3 years ago[GVN] Clobber partially aliased loads.
dfukalov [Fri, 9 Apr 2021 10:37:13 +0000 (13:37 +0300)]
[GVN] Clobber partially aliased loads.

Use offsets stored in `AliasResult` implemented in D98718.

Reviewed By: nikic

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

3 years ago[InstCombine] Added testcases from PR48999, NFC
Dávid Bolvanský [Fri, 23 Apr 2021 23:20:15 +0000 (01:20 +0200)]
[InstCombine] Added testcases from PR48999, NFC

3 years ago[Polly][ManualOpt] Match interpretation of unroll metadata to LoopUnrolls's.
Michael Kruse [Sat, 24 Apr 2021 09:10:55 +0000 (04:10 -0500)]
[Polly][ManualOpt] Match interpretation of unroll metadata to LoopUnrolls's.

We previously had a different interpretation of unroll transformation
attributes than how LoopUnroll interpreted it. In particular,
llvm.loop.unroll.enable was needed explicitly to enable it and disabling
metadata was ignored.
Additionally, it required that either full unrolling or an unroll factor
to be specified or fail otherwise. An unroll factor is still required,
but the transformation is ignored with the hope that LoopUnroll is going
to apply the unrolling, since Polly currently does not implement an
heuristic.

Fixes llvm.org/PR50109

3 years ago[lldb] [Process/Linux] Report fork/vfork stop reason
Michał Górny [Fri, 9 Apr 2021 15:00:12 +0000 (17:00 +0200)]
[lldb] [Process/Linux] Report fork/vfork stop reason

Enable reporting fork/vfork events to the server when supported.
At this moment, this is used only to test the server code, as real
client does not report fork-events and vfork-events as supported.

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

3 years ago[lldb] [llgs] Support owning and detaching extra processes
Michał Górny [Tue, 13 Apr 2021 15:32:23 +0000 (17:32 +0200)]
[lldb] [llgs] Support owning and detaching extra processes

Add a NativeDelegate API to pass new processes (forks) to LLGS,
and support detaching them via the 'D' packet.  A 'D' packet without
a specific PID detaches all processes, otherwise it detaches either
the specified subprocess or the main process, depending on the passed
PID.

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

3 years ago[lldb] [gdb-remote server] Introduce new stop reasons for fork and vfork
Michał Górny [Mon, 29 Mar 2021 15:05:30 +0000 (17:05 +0200)]
[lldb] [gdb-remote server] Introduce new stop reasons for fork and vfork

Introduce three new stop reasons for fork, vfork and vforkdone events.
This includes server support for serializing fork/vfork events into
gdb-remote protocol.  The stop infos for the two base events take a pair
of PID and TID for the newly forked process.

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

3 years ago[lldb] [Process] Introduce protocol extension support API
Michał Górny [Thu, 8 Apr 2021 22:59:22 +0000 (00:59 +0200)]
[lldb] [Process] Introduce protocol extension support API

Introduce a NativeProcessProtocol API for indicating support for
protocol extensions and enabling them.  LLGS calls
GetSupportedExtensions() method on the process factory to determine
which extensions are supported by the plugin.  If the future is both
supported by the plugin and reported as supported by the client, LLGS
enables it and reports to the client as supported by the server.

The extension is enabled on the process instance by calling
SetEnabledExtensions() method.  This is done after qSupported exchange
(if the debugger is attached to any process), as well as after launching
or attaching to a new inferior.

The patch adds 'fork' extension corresponding to 'fork-events+'
qSupported feature and 'vfork' extension for 'vfork-events+'.  Both
features rely on 'multiprocess+' being supported as well.

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

3 years ago[Polly] Fix stage 2 clang -Wdeprecated-copy after D79714
Fangrui Song [Sat, 24 Apr 2021 07:56:22 +0000 (00:56 -0700)]
[Polly] Fix stage 2 clang -Wdeprecated-copy after D79714

3 years ago[mlir] Canonicalize AllocOp's with only store and dealloc uses
Butygin [Sat, 10 Apr 2021 16:38:11 +0000 (19:38 +0300)]
[mlir] Canonicalize AllocOp's with only store and dealloc uses

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

3 years ago[mlir][tosa] Add tosa.gather lowering to linalg.indexed_generic
natashaknk [Sat, 24 Apr 2021 05:30:08 +0000 (22:30 -0700)]
[mlir][tosa] Add tosa.gather lowering to linalg.indexed_generic

Lowering gather operation to linalg dialect.

Reviewed By: rsuderman

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

3 years ago[libcxx][iterator] adds `std::weakly_incrementable` and `std::incrementable`
Christopher Di Bella [Sat, 24 Apr 2021 01:22:55 +0000 (18:22 -0700)]
[libcxx][iterator] adds `std::weakly_incrementable` and `std::incrementable`

Implements parts of:
    * P0896R4 The One Ranges Proposal`

Depends on D100073.

Reviewed By: ldionne, zoecarver, #libc

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

3 years ago[ELF] Simplify a condition in addGotEntry. NFC
Fangrui Song [Sat, 24 Apr 2021 05:11:14 +0000 (22:11 -0700)]
[ELF] Simplify a condition in addGotEntry. NFC

3 years agoRevert "[ORC-RT] Initial ORC Runtime directories and build system files."
Lang Hames [Sat, 24 Apr 2021 03:36:59 +0000 (20:36 -0700)]
Revert "[ORC-RT] Initial ORC Runtime directories and build system files."

Some builders failed with a missing clang dependency. E.g.

CMake Error at /Users/buildslave/jenkins/workspace/clang-stage1-RA/clang-build \
  /lib/cmake/llvm/AddLLVM.cmake:1786 (add_dependencies):
The dependency target "clang" of target "check-compiler-rt" does not exist.

Reverting while I investigate.

This reverts commit 1e1d75b190c266cb11e0a6bbb4f11b810d690cc7.

3 years ago[ORC-RT] Initial ORC Runtime directories and build system files.
Lang Hames [Sat, 17 Apr 2021 19:00:42 +0000 (12:00 -0700)]
[ORC-RT] Initial ORC Runtime directories and build system files.

This patch contains initial directories and build files for the ORC runtime.

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

3 years ago[libomptarget] Enable AMDGPU devicertl
Jon Chesterfield [Sat, 24 Apr 2021 01:24:44 +0000 (02:24 +0100)]
[libomptarget] Enable AMDGPU devicertl

[libomptarget] Enable AMDGPU devicertl

The amdgpu devicertl is written in freestanding openmp and compiles to a
bitcode library (per listed gfx arch) with no unresolved symbols. It requires
a recent clang, preferably the one from the same monorepo checkout.

This is D98658, with printf explicitly stubbed out, after patching clang to no
longer require an llvm with the amdgpu target enabled.

Reviewed By: tianshilei1992

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

3 years ago[libcxx] disables ranges for clang-cl
Christopher Di Bella [Fri, 23 Apr 2021 23:08:58 +0000 (16:08 -0700)]
[libcxx] disables ranges for clang-cl

clang-cl doesn't properly handle concepts right now and is failing CI.

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

3 years ago[NFC] Delete the redundant member 'shouldEmitMoves' from DwarfCFIException class
RamNalamothu [Sat, 24 Apr 2021 00:12:40 +0000 (05:42 +0530)]
[NFC] Delete the redundant member 'shouldEmitMoves' from DwarfCFIException class

The data member 'shouldEmitMoves' is only used in DwarfCFIException::beginFunction()
and 'shouldEmitCFI' in DwarfCFIExceptionBase serves its purpose.

Reviewed By: MaskRay

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

3 years ago[RISCV] Removed getLMULForFixedLengthVector.
Craig Topper [Fri, 23 Apr 2021 23:18:50 +0000 (16:18 -0700)]
[RISCV] Removed getLMULForFixedLengthVector.

Use getContainerForFixedLengthVector and getRegClassIDForVecVT to
get the register class to use when making a fixed vector type legal.

Inline it into the other two call sites.

I'm looking into using fractional lmul for fixed length vectors
and getLMULForFixedLengthVector returned an integer making it
unable to express this. I considered returning the LMUL
enum, but that seemed like it would introduce more complexity to
convert it for use.

3 years ago[MachineCSE] Prevent CSE of non-local convergent instrs
Michael Kitzan [Fri, 23 Apr 2021 22:03:57 +0000 (15:03 -0700)]
[MachineCSE] Prevent CSE of non-local convergent instrs

At the moment, MachineCSE allows CSE-ing convergent instrs which are
non-local to each other. This can cause illegal codegen as convergent
instrs are control flow dependent. The patch prevents non-local CSE of
convergent instrs by adding a check in isProfitableToCSE and rejecting
CSE-ing if we're considering CSE-ing non-local convergent instrs. We
can still CSE convergent instrs which are in the same control flow
scope, so the patch purposely does not make all convergent instrs
non-CSE candidates in isCSECandidate.

https://reviews.llvm.org/D101187

3 years ago[clang][amdgpu] Use implicit code object version
Jon Chesterfield [Fri, 23 Apr 2021 22:52:49 +0000 (23:52 +0100)]
[clang][amdgpu] Use implicit code object version

[clang][amdgpu] Use implicit code object version

At present, clang always passes amdhsa-code-object-version on to -cc1. That is
great for certainty over what object version is being used when debugging.

Unfortunately, the command line argument is in AMDGPUBaseInfo.cpp in the amdgpu
target. If clang is used with an llvm compiled with DLLVM_TARGETS_TO_BUILD
that excludes amdgpu, this will be diagnosed (as discovered via D98658):

- Unknown command line argument '--amdhsa-code-object-version=4'

This means that clang, built only for X86, can be used to compile the nvptx
devicertl for openmp but not the amdgpu one. That would shortly spawn fragile
logic in the devicertl cmake to try to guess whether the clang used will work.

This change omits the amdhsa-code-object-version parameter when it matches the
default that AMDGPUBaseInfo.cpp specifies, with a comment to indicate why. As
this is the only part of clang's codegen for amdgpu that depends on the target
in the back end it suffices to build the openmp runtime on most (all?) systems.

It is a non-functional change, though observable in the updated tests and when
compiling with -###. It may cause minor disruption to the amd-stg-open branch.

Revision of D98746, builds on refactor in D101077

Reviewed By: yaxunl

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

3 years agoRevert "[Scudo] Use GWP-ASan's aligned allocations and fixup postalloc hooks."
Mitch Phillips [Fri, 23 Apr 2021 22:33:54 +0000 (15:33 -0700)]
Revert "[Scudo] Use GWP-ASan's aligned allocations and fixup postalloc hooks."

This reverts commit a683abe5c026cffff12a943564f4cb1b20972abf.

Broke the upstream buildbots:
https://lab.llvm.org/buildbot/#/builders/37/builds/3731/steps/16/logs/stdio

3 years agoRequire asserts for test that uses debug flag
Teresa Johnson [Fri, 23 Apr 2021 22:22:35 +0000 (15:22 -0700)]
Require asserts for test that uses debug flag

In 10b781fb033ee8d8a02e1050976b3832ad50542a this test was changed to use
the -debug-only flag, which means it now requires asserts aka a
non-release compiler.

3 years agoImplement N3644 "Null Forward Pointers" in _LIBCPP_DEBUG mode.
Arthur O'Dwyer [Tue, 20 Apr 2021 15:25:37 +0000 (11:25 -0400)]
Implement N3644 "Null Forward Pointers" in _LIBCPP_DEBUG mode.

This functionality is tested in std/containers/sequences/vector/iterators.pass.cpp
(and similarly for all containers, but vector is the only one to be tested that
uses debug iterators).

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

3 years ago[RISCV] Move getLMULForFixedLengthVector out of RISCVSubtarget.
Craig Topper [Fri, 23 Apr 2021 21:26:32 +0000 (14:26 -0700)]
[RISCV] Move getLMULForFixedLengthVector out of RISCVSubtarget.

Make it a static function RISCVISelLowering, the only place it
is used.

I think I'm going to make this return a fractional LMULs in some
cases so I'm sorting out where it should live before I start
making changes.

3 years ago[RISCV] Only expose one interface for getContainerForFixedLengthVector in the RISCVTa...
Craig Topper [Fri, 23 Apr 2021 20:05:23 +0000 (13:05 -0700)]
[RISCV] Only expose one interface for getContainerForFixedLengthVector in the RISCVTargetLowering class

We can have RISCVISelDAGToDAG.cpp call the VT only version by
finding the RISCVTargetLowering object via the Subtarget.

Make the static versions just global static functions in
RISCVISelLowering that can be called by static functions in that
file.

3 years ago[lld-macho] Fix use-after-free in loadDylib()
Jez Ng [Fri, 23 Apr 2021 22:05:34 +0000 (18:05 -0400)]
[lld-macho] Fix use-after-free in loadDylib()

We were taking a reference to a value in `loadedDylibs`, which in turn
called `make<DylibFile>()`, which could then recursively call
`loadDylibs`, which would then potentially resize `loadedDylibs` and
invalidate that reference.

Fixes PR50101.

Reviewed By: #lld-macho, oontvoo

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

3 years ago[lld-macho]][nfc] Fix some typos + rephrase a comment
Jez Ng [Fri, 23 Apr 2021 22:05:48 +0000 (18:05 -0400)]
[lld-macho]][nfc] Fix some typos + rephrase a comment

I was a bit confused by the comment because I thought that "Tests
that..." was describing the tests contained within the same file.

Reviewed By: #lld-macho, thakis

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

3 years ago[utils] Disable -Wdeprecated-copy for googlemock/gtest
Dávid Bolvanský [Fri, 23 Apr 2021 21:45:50 +0000 (23:45 +0200)]
[utils] Disable -Wdeprecated-copy for googlemock/gtest

Simple fix for build breakage. Feel free to fix all places (quite a lot).

3 years ago[CSSPGO] Fix missing debug info of dangling pseudo probe
wlei [Fri, 23 Apr 2021 19:35:12 +0000 (12:35 -0700)]
[CSSPGO] Fix missing debug info of dangling pseudo probe

While doing speculative execution opt, it conservatively drops all insn's debug info in the merged `ThenBB`(see the loop at line 2384) including the dangling probe. The missing debug info of the dangling probe will cause the wrong inference computation.

So we should avoid dropping the debug info from pseudo probe, this change try to fix this by moving the to-be dangling probe to the merging target BB before the debug info is dropped.

Reviewed By: hoy, wenlei

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

3 years agoThread safety analysis: Simplify intersectAndWarn (NFC)
Aaron Puchert [Wed, 21 Apr 2021 15:21:22 +0000 (17:21 +0200)]
Thread safety analysis: Simplify intersectAndWarn (NFC)

Instead of conditionally overwriting a nullptr and then branching on its
nullness, just branch directly on the original condition. Then we can
make both pointers (non-null) references instead.

3 years agoEnable AST introspection on non-X86
Stephen Kelly [Fri, 23 Apr 2021 12:30:19 +0000 (13:30 +0100)]
Enable AST introspection on non-X86