platform/upstream/llvm.git
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

3 years ago[WebAssembly] Finalize wasm_simd128.h intrinsics
Thomas Lively [Fri, 23 Apr 2021 20:37:27 +0000 (13:37 -0700)]
[WebAssembly] Finalize wasm_simd128.h intrinsics

Adds new intrinsics for instructions that are in the final SIMD spec but did not
previously have intrinsics. Also updates the names of existing intrinsics to
reflect the final names of the underlying instructions in the spec. Keeps the
old names as deprecated functions to ease the transition to the new names.

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

3 years ago[SCEV] Add loop guard tests for ugt/uge predicates (NFC)
Nikita Popov [Fri, 23 Apr 2021 20:05:52 +0000 (22:05 +0200)]
[SCEV] Add loop guard tests for ugt/uge predicates (NFC)

3 years ago[PowerPC] Provide XL-compatible builtins in altivec.h
Nemanja Ivanovic [Fri, 23 Apr 2021 16:50:13 +0000 (11:50 -0500)]
[PowerPC] Provide XL-compatible builtins in altivec.h

There are some interfaces in altivec.h that are not compatible
between Clang and XL (although Clang is compatible with GCC).
Currently, we have found 3 but there may be others.

Clang/GCC signatures:

vector double vec_ctf(vector signed long long)
vector double vec_ctf(vector unsigned long long)
vector signed long long vec_cts(vector double)
vector unsigned long long vec_ctu(vector double)

XL signatures:

vector float vec_ctf(vector signed long long)
vector float vec_ctf(vector unsigned long long)
vector signed int vec_cts(vector double)
vector unsigned int vec_ctu(vector double)

This patch provides the XL behaviour under the __XL_COMPAT_ALTIVEC__
macro for users that rely on XL behaviour.

Differential revision: https://reviews.llvm.org/D101130

3 years ago[mlir][tosa] Add tosa.resize lowering to linalg generic
Rob Suderman [Wed, 21 Apr 2021 07:53:50 +0000 (00:53 -0700)]
[mlir][tosa] Add tosa.resize lowering to linalg generic

Includes tests and implementation for both integer and floating point values.
Both nearest neighbor and bilinear interpolation is included.

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

3 years ago[libcxx][nfc] Add license to `pointer_comparison_test_helper.h`
zoecarver [Fri, 23 Apr 2021 19:37:47 +0000 (12:37 -0700)]
[libcxx][nfc] Add license to `pointer_comparison_test_helper.h`

3 years ago[clangd] Allow AST request without range
Christian Kandeler [Fri, 23 Apr 2021 19:17:43 +0000 (21:17 +0200)]
[clangd] Allow AST request without range

If no range is given, return the translation unit AST.
This is useful for tooling operations that require e.g. the full path to
a node.

Reviewed By: sammccall

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

3 years ago[InstCombine] X - usub.sat(X, Y) => umin(X, Y)
Dávid Bolvanský [Fri, 23 Apr 2021 19:12:51 +0000 (21:12 +0200)]
[InstCombine] X - usub.sat(X, Y) => umin(X, Y)

Pattern regressed in LLVM 9 with the introduction of usub.sat.

Fixes https://bugs.llvm.org/show_bug.cgi?id=42178#c2

Reviewed By: nikic

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

3 years ago[Docs] Updated LLVM_TARGETS_TO_BUILD section in GettingStarted.rst
Pooja Yadav [Fri, 23 Apr 2021 18:49:53 +0000 (00:19 +0530)]
[Docs] Updated LLVM_TARGETS_TO_BUILD section in GettingStarted.rst

Updated LLVM_TARGETS_TO_BUILD  under https://llvm.org/docs/GettingStarted.html#local-llvm-configuration.

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

3 years ago[mlir] Add block arguments for input/output operands of 'linalg.tiled_loop`.
Alexander Belyaev [Fri, 23 Apr 2021 17:47:51 +0000 (19:47 +0200)]
[mlir] Add block arguments for input/output operands of 'linalg.tiled_loop`.

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

3 years ago[lld/mac] Support more flags for --reproduce
Nico Weber [Fri, 23 Apr 2021 16:49:14 +0000 (12:49 -0400)]
[lld/mac] Support more flags for --reproduce

I went through the callers of `readFile()` and `addFile()` in Driver.cpp
and checked that the options that use them all get rewritten in the
--reproduce response file. -(un)exported_symbols_list and -bundle_loader
weren't, so add them.

Also spruce up the test for reproduce a bit and actually try linking
with the exptracted repro archive.

Motivated by the response file in PR50098 complaining abou the
-exported_symbols_list path being wrong :)

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

3 years agoscudo: Work around gcc 8 conversion warning.
Peter Collingbourne [Fri, 23 Apr 2021 18:25:20 +0000 (11:25 -0700)]
scudo: Work around gcc 8 conversion warning.

Should fix:
https://lab.llvm.org/buildbot#builders/99/builds/2953

3 years ago[CSSPGO] Fix incorrect prorating indirect call distribution factor that leads to...
Hongtao Yu [Fri, 23 Apr 2021 07:26:11 +0000 (00:26 -0700)]
[CSSPGO]  Fix incorrect prorating indirect call distribution factor that leads to target count loss.

Pseudo probe distribution factor is used to scale down profile samples to avoid misleading the counts inference due to the usage of "maximum" in `getBlockWeight`. For callsites, the scaling down can come from code duplication prior to the sample profile loader (prelink or postlink), or due to the indirect call promotion in sample loader inliner. This patch fixes an issue in sample loader ICP where the leftover indirect callsite scaling down causes the loss of non-promoted call target samples unexpectedly. While the scaling down is to favor BFI/BPI with accurate an callsite count, it doesn't fit in the current distribution factor that represents code duplication changes. Ideally,  we would need two factors, one is for code duplication, the other is for ICP. However this seems over complicated. I'm going to trade one usage (callsite counts) for the other (call target counts).

Seeing perf win on one benchmark (mcf) of SPEC2017 with others unchanged.

Reviewed By: wenlei

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

3 years ago[hwasan] Remove untagging of kernel-consumed memory
Mitch Phillips [Fri, 23 Apr 2021 17:45:44 +0000 (10:45 -0700)]
[hwasan] Remove untagging of kernel-consumed memory

Now that page aliasing for x64 has landed, we don't need to worry about
passing tagged pointers to libc, and thus D98875 removed it.
Unfortunately, we still test on aarch64 devices that don't have the
kernel tagged address ABI (https://reviews.llvm.org/D98875#2649269).

All the memory that we pass to the kernel in these tests is from global
variables. Instead of having architecture-specific untagging mechanisms
for this memory, let's just not tag the globals.

Reviewed By: eugenis, morehouse

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

3 years ago[OpenMP] Fix -Wdeprecated-copy
Fangrui Song [Fri, 23 Apr 2021 17:49:19 +0000 (10:49 -0700)]
[OpenMP] Fix -Wdeprecated-copy

3 years agoRevert "[X86][AMX] Try to hoist AMX shapes' def"
Mitch Phillips [Fri, 23 Apr 2021 17:36:56 +0000 (10:36 -0700)]
Revert "[X86][AMX] Try to hoist AMX shapes' def"

This reverts commit 90118563ad0f133c696e070ad72761fa0daa4517.

Reason: Broke the MSan buildbots.
https://lab.llvm.org/buildbot/#/builders/5/builds/6967/steps/9/logs/stdio

More details can be found in the original phabricator review:
https://reviews.llvm.org/D101067

3 years ago[InstCombine] fold 'not' of ctpop in parity pattern
Sanjay Patel [Fri, 23 Apr 2021 17:19:46 +0000 (13:19 -0400)]
[InstCombine] fold 'not' of ctpop in parity pattern

As discussed in https://llvm.org/PR50096 , we could
convert the 'not' into a 'sub' and see the same
fold. That's because we already have another demanded
bits optimization for 'sub'.

We could add a related transform for
odd-number-of-type-bits, but that seems unlikely
to be practical.

https://alive2.llvm.org/ce/z/TWJZXr