platform/upstream/llvm.git
3 years ago[AMDGPU][llvm-objdump] Fix memory leak in recent commit
Tim Renouf [Mon, 26 Apr 2021 17:49:33 +0000 (18:49 +0100)]
[AMDGPU][llvm-objdump] Fix memory leak in recent commit

Hopefully stops sanitizer fail in AMDGPU llvm-objdump test.

Change-Id: I7331151d1cb65292bd06b6ae283349fe7231cf6b

3 years ago[AST] Fix DeclarationNameInfo introspection
Stephen Kelly [Mon, 26 Apr 2021 17:28:50 +0000 (18:28 +0100)]
[AST] Fix DeclarationNameInfo introspection

Some AST classes return `const DeclarationNameInfo &` instead of
returning by value (eg CXXDependentScopeMemberExpr).

3 years ago[RuntimeDyld] Fixed buffer overflows with absolute symbols
Moritz Sichert [Fri, 30 Oct 2020 10:35:12 +0000 (11:35 +0100)]
[RuntimeDyld] Fixed buffer overflows with absolute symbols

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

3 years agoPreserve the lexical order for global variables during llvm-link merge
Jin Lin [Sat, 24 Apr 2021 05:37:08 +0000 (22:37 -0700)]
Preserve the lexical order for global variables during llvm-link merge

The order of global variables is generated in the order of recursively materializing variables if the global variable has the attribute of hasLocalLinkage or hasLinkOnceLinkage during the module merging. In practice, it is often the exact reverse of source order. This new order may cause performance regression.

The change is to preserve the original lexical order for global variables.

Reviewed By: jdoerfert, dexonsmith

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

3 years ago[AMDGPU] Fix autogenerated wwm-reserved-spill.ll
Sebastian Neubauer [Mon, 26 Apr 2021 17:04:46 +0000 (19:04 +0200)]
[AMDGPU] Fix autogenerated wwm-reserved-spill.ll

Due to a bug in update_llc_test_checks.py, the test is wrongly
coalesced between run lines. Remove common check prefix to fix that.
NFC.

3 years agoXFAIL thinlto testcases on AIX
Wael Yehia [Mon, 26 Apr 2021 14:18:51 +0000 (10:18 -0400)]
XFAIL thinlto testcases on AIX

In D100350, we switched off thinLTO on the AIX OS. So, XFAIL tests that
invoke clang with -flto=thin on AIX.

3 years ago[lldb] Skip TestPointerToMemberTypeDependingOnParentSize on Windows and GCC
Raphael Isemann [Mon, 26 Apr 2021 16:52:07 +0000 (18:52 +0200)]
[lldb] Skip TestPointerToMemberTypeDependingOnParentSize on Windows and GCC

The test added in D100977 is failing to compile on these platforms. This seems
to be caused by GCC, MSVC and Clang@Windows rejecting the code because
`ToLayout` isn't complete when pointer_to_member_member is declared (even though
that seems to be valid code).

This also reverts the test changes in the lazy-loading test from D100977 as
that failed for the same reason.

3 years ago[Lexer] Allow LLLexer to be used as an API
William S. Moses [Wed, 21 Apr 2021 01:59:45 +0000 (21:59 -0400)]
[Lexer] Allow LLLexer to be used as an API

Explose LLVM Lexer for usage externally as an API

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

3 years ago[MLIR] Remove empty shape operands from `cstr_broadcastable` ops
Frederik Gossen [Mon, 26 Apr 2021 16:33:36 +0000 (18:33 +0200)]
[MLIR] Remove empty shape operands from `cstr_broadcastable` ops

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

3 years ago[lldb] Don't use ::fork or ::vfork on watchOS or tvOS
Jonas Devlieghere [Mon, 26 Apr 2021 16:29:37 +0000 (09:29 -0700)]
[lldb] Don't use ::fork or ::vfork on watchOS or tvOS

Update lldb-server to not use fork or vfork on watchOS and tvOS as these
functions are explicitly marked unavailable there.

llvm-project/lldb/test/API/tools/lldb-server/main.cpp:304:11:
error: 'fork' is unavailable: not available on watchOS
      if (fork() == 0)
          ^
WatchSimulator6.2.sdk/usr/include/unistd.h:447:8: note: 'fork' has been
explicitly marked unavailable here
pid_t    fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
         ^
llvm-project/lldb/test/API/tools/lldb-server/main.cpp:307:11:
error: 'vfork' is unavailable: not available on watchOS
      if (vfork() == 0)
          ^
WatchSimulator6.2.sdk/usr/include/unistd.h:602:8: note: 'vfork' has been
explicitly marked unavailable here
pid_t    vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
         ^

3 years ago[flang] Check for attributes specific to dummy arguments
Peter Steinfeld [Fri, 23 Apr 2021 02:29:14 +0000 (19:29 -0700)]
[flang] Check for attributes specific to dummy arguments

We were not checking that attributes that are supposed to be specific to
dummy arguments were not being used for local entities.  I added the checks
along with tests for them.

After implementing these new checks, I found that one of the tests in
separate-mp02.f90 was erroneous, and I fixed it.

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

3 years ago[Doc] Add SYCLSupport.rst to index toctree.
Alexey Bader [Mon, 26 Apr 2021 13:15:03 +0000 (16:15 +0300)]
[Doc] Add SYCLSupport.rst to index toctree.

3 years ago[CSSPGO] Explicitly disallow Binary and Compact Binary profile format for CSSPGO
Wenlei He [Sat, 24 Apr 2021 17:37:55 +0000 (10:37 -0700)]
[CSSPGO] Explicitly disallow Binary and Compact Binary profile format for CSSPGO

CSSPGO only supports text and extended binary profile now. Raw binary does not have the metadata section CSSPGO needs, and Compact binary profile needs special handling for GUID based context names, which is not yet implemented.

Disasslow these two format for CSSPGO profile writing to avoid silently generating invalid profiles.

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

3 years ago[SimplifyCFG] Preserve metadata when unconditionalizing branches (constant condition).
Michael Kruse [Mon, 26 Apr 2021 15:52:06 +0000 (10:52 -0500)]
[SimplifyCFG] Preserve metadata when unconditionalizing branches (constant condition).

When replacing a conditional branch by an unconditional one because the condition is a constant, transfer the metadata to the new branch instruction.

Part of fix for llvm.org/PR50060

Reviewed By: lebedev.ri

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

3 years ago[MLIR][Shape] Ensure to preserve op type of `shape.broadcast`
Frederik Gossen [Mon, 26 Apr 2021 15:52:37 +0000 (17:52 +0200)]
[MLIR][Shape] Ensure to preserve op type of `shape.broadcast`

Ensure to preserve the correct type during when folding and canonicalization.
`shape.broadcast` of of a single operand can only be folded away if the argument
type is correct.

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

3 years ago[libc++][NFC] Remove non-ASCII from comment.
Mark de Wever [Mon, 26 Apr 2021 15:53:20 +0000 (17:53 +0200)]
[libc++][NFC] Remove non-ASCII from comment.

Seems our check-generated-output doesn't work as intended. Will
investigate it further.

3 years ago[AMDGPU] Use MapVector for WWMReservedRegs
Sebastian Neubauer [Mon, 26 Apr 2021 15:43:00 +0000 (17:43 +0200)]
[AMDGPU] Use MapVector for WWMReservedRegs

Use MapVector instead of SmallDenseMap because it has a deterministic
iteration order.

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

3 years ago[dexter] Update failing regression test
OCHyams [Mon, 26 Apr 2021 15:33:10 +0000 (16:33 +0100)]
[dexter] Update failing regression test

Commit 7deb970ef added REQUIRES and UNSUPPORTED lines to a test which is
sensitive to line number changes. Update the line number reference in the test.

3 years ago[SYCL][Doc] Add design document for SYCL mode
Alexey Bader [Wed, 24 Mar 2021 13:25:20 +0000 (16:25 +0300)]
[SYCL][Doc] Add design document for SYCL mode

Initial version of the document covers address space handling

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

3 years ago[X86] Rename multiclass ATOMIC_LOAD_BINOP -> ATOMIC_RMW_BINOP. NFCI.
Simon Pilgrim [Mon, 26 Apr 2021 14:10:20 +0000 (15:10 +0100)]
[X86] Rename multiclass ATOMIC_LOAD_BINOP -> ATOMIC_RMW_BINOP. NFCI.

Noticed while triaging the rG2149aa73f640c96 regressions - the LXADD ops are load+store RMW instructions, not just loads.

3 years ago[lld-macho] Add option --error-limit=N
Greg McGary [Mon, 26 Apr 2021 00:28:49 +0000 (17:28 -0700)]
[lld-macho] Add option --error-limit=N

Add option to limit (or remove limits) on the number of errors printed before exiting. This option exists in the other lld ports: COFF & ELF.

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

3 years agoRevert "Only ignore -Wdeprecated-copy if the used compiler supports the warning"
Dávid Bolvanský [Mon, 26 Apr 2021 14:08:18 +0000 (16:08 +0200)]
Revert "Only ignore -Wdeprecated-copy if the used compiler supports the warning"

This reverts commit b125c034af89e32d5258d593080ff0c4810776a0.

Some bots say " missing binary operator before token "(" "

3 years ago[clang][XCore] Define __xcore__ for XCore target.
Nigel Perks [Wed, 21 Apr 2021 17:41:19 +0000 (18:41 +0100)]
[clang][XCore] Define __xcore__ for XCore target.

The headers shipped with the XMOS XCore compiler expect __xcore__ to be defined.
The __XS1B__ macro, already defined, is for the default subtarget.

No other targets affected.

3 years ago[TableGen] Remove a TODO comment that is no longer relevant [NFC]
Paul C. Anagnostopoulos [Mon, 26 Apr 2021 14:00:19 +0000 (10:00 -0400)]
[TableGen] Remove a TODO comment that is no longer relevant [NFC]

3 years agoOnly ignore -Wdeprecated-copy if the used compiler supports the warning
Dávid Bolvanský [Mon, 26 Apr 2021 13:44:52 +0000 (15:44 +0200)]
Only ignore -Wdeprecated-copy if the used compiler supports the warning

This is needed after
  https://reviews.llvm.org/rG9658d045926545e62cc3f963fe611d7c5d0c9d98
which introduced code that at least didn't compile clean with clang 8.

Reviewed By: xbolva00

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

3 years ago[TableGen] Change assertion information from a tuple to a struct [NFC]
Paul C. Anagnostopoulos [Tue, 20 Apr 2021 14:00:24 +0000 (10:00 -0400)]
[TableGen] Change assertion information from a tuple to a struct [NFC]

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

3 years ago[SYCL] Implement SYCL address space attributes handling
Alexey Bader [Fri, 20 Dec 2019 09:05:42 +0000 (12:05 +0300)]
[SYCL] Implement SYCL address space attributes handling

Default address space (applies when no explicit address space was
specified) maps to generic (4) address space.

Added SYCL named address spaces `sycl_global`, `sycl_local` and
`sycl_private` defined as sub-sets of the default address space.

Static variables without address space now reside in global address
space when compile for SPIR target, unless they have an explicit address
space qualifier in source code.

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

3 years ago[InstCombine] C - ctpop(a) - > ctpop(~a)) if C is bitwidth (PR50104)
Dávid Bolvanský [Mon, 26 Apr 2021 12:22:14 +0000 (14:22 +0200)]
[InstCombine] C - ctpop(a) - > ctpop(~a)) if C is bitwidth (PR50104)

Proof: https://alive2.llvm.org/ce/z/mncA9K
Solves https://bugs.llvm.org/show_bug.cgi?id=50104

Reviewed By: spatel

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

3 years agoAArch64: support atomics in GISel
Tim Northover [Thu, 22 Apr 2021 12:30:30 +0000 (13:30 +0100)]
AArch64: support atomics in GISel

3 years ago[lldb] Use forward type in pointer-to-member
Emre Kultursay [Mon, 26 Apr 2021 13:20:33 +0000 (15:20 +0200)]
[lldb] Use forward type in pointer-to-member

This change is similar in spirit to the change at:
https://reviews.llvm.org/rG34c697c85e9d0af11a72ac4df5578aac94a627b3

It fixes the problem where the layout of a type was being accessed
while its base classes were not populated yet; which caused an
incorrect layout to be produced and cached.

This fixes PR50054

Reviewed By: teemperor

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

3 years ago[AMDGPU][llvm-objdump] Add lit.local.cfg missing from recent commit
Tim Renouf [Mon, 26 Apr 2021 13:06:56 +0000 (14:06 +0100)]
[AMDGPU][llvm-objdump] Add lit.local.cfg missing from recent commit

Stops llvm-objdump tests failing when AMDGPU target is not supported.

Change-Id: Ic4ae443958c41c303ff6bee0966e5f21ab7a1851

3 years ago[MC][AMDGPU][llvm-objdump] Synthesized local labels in disassembly
Tim Renouf [Fri, 23 Apr 2021 07:59:24 +0000 (08:59 +0100)]
[MC][AMDGPU][llvm-objdump] Synthesized local labels in disassembly

1. Add an accessor function to MCSymbolizer to retrieve addresses
   referenced by a symbolizable operand, but not resolved to a symbol.
   That way, the caller can synthesize labels at those addresses and
   then retry disassembling the section.

2. Implement that in AMDGPU -- a failed symbol lookup results in the
   address being added to a vector returned by the new function.

3. Use that in llvm-objdump when using MCSymbolizer (which only happens
   on AMDGPU) and SymbolizeOperands is on.

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

Change-Id: I19087c3bbfece64bad5a56ee88bcc9110d83989e

3 years ago[IndVars] avoid 'tmp' names in test file with auto-generated CHECK lines; NFC
Sanjay Patel [Mon, 26 Apr 2021 12:30:27 +0000 (08:30 -0400)]
[IndVars] avoid 'tmp' names in test file with auto-generated CHECK lines; NFC

The script warns that this could be buggy when updating.

3 years ago[LSR][DebugInfo] Don't unnecessarily drop DebugLocs
Yuanbo Li [Mon, 26 Apr 2021 12:07:18 +0000 (13:07 +0100)]
[LSR][DebugInfo] Don't unnecessarily drop DebugLocs

When transforming a loop terminating condition into a "max" comparison,
the DebugLoc from the old condition should be set on the newly created
comparison. They are the same operation, just optimized. Fixes PR48067.

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

3 years ago[AArch64][SVE] Add missing patterns for scalar versions of SQSHL/UQSHL
Bradley Smith [Thu, 22 Apr 2021 11:15:43 +0000 (12:15 +0100)]
[AArch64][SVE] Add missing patterns for scalar versions of SQSHL/UQSHL

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

3 years ago[InstCombine] Added testcases for PR50104, NFC
Dávid Bolvanský [Sun, 25 Apr 2021 14:33:57 +0000 (16:33 +0200)]
[InstCombine] Added testcases for PR50104, NFC

3 years ago[ARM] Expand VMOVRRD simplification pattern
David Green [Mon, 26 Apr 2021 11:27:38 +0000 (12:27 +0100)]
[ARM] Expand VMOVRRD simplification pattern

This expands the VMOVRRD(extract(..(build_vector(a, b, c, d)))) pattern,
to also handle insert_vectors. Providing we can find the correct insert,
this helps further simplify patterns by removing the redundant VMOVRRD.

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

3 years ago[ARM] Additional soft float BE test. NFC
David Green [Mon, 26 Apr 2021 09:06:28 +0000 (10:06 +0100)]
[ARM] Additional soft float BE test. NFC

3 years ago[NFC] Add scalable vectorisation tests for int/FP <> int/FP conversions
David Sherwood [Tue, 6 Apr 2021 12:23:44 +0000 (13:23 +0100)]
[NFC] Add scalable vectorisation tests for int/FP <> int/FP conversions

We can already vectorize loops that involve int<>int, fp<>fp, int<>fp
and fp<>int conversions, however we didn't previously have any tests
for them. This patch adds some tests for each conversion type.

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

3 years ago[AArch64] Add AArch64TTIImpl::getMaskedMemoryOpCost function
David Sherwood [Fri, 16 Apr 2021 15:08:38 +0000 (16:08 +0100)]
[AArch64] Add AArch64TTIImpl::getMaskedMemoryOpCost function

When vectorising for AArch64 targets if you specify the SVE attribute
we automatically then treat masked loads and stores as legal. Also,
since we have no cost model for masked memory ops we believe it's
cheap to use the masked load/store intrinsics even for fixed width
vectors. This can lead to poor code quality as the intrinsics will
currently be scalarised in the backend. This patch adds a basic
cost model that marks fixed-width masked memory ops as significantly
more expensive than for scalable vectors.

Tests for the cost model are added here:

  Transforms/LoopVectorize/AArch64/masked-op-cost.ll

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

3 years ago[VPlan] Make blocksOnly work properly with ranges over const pointers.
Florian Hahn [Mon, 26 Apr 2021 09:16:25 +0000 (10:16 +0100)]
[VPlan] Make blocksOnly work properly with ranges over const pointers.

When iterating over const blocks, the base type in the lambdas needs
to use const VPBlockBase *, otherwise it cannot be used with input
iterators over const VPBlockBase.

Also adjust the type of the input iterator range to const &, as it
does not take ownership of the input range.

3 years ago[flang][driver] Fine-tune `-fdebug-dump-symbols`
Andrzej Warzynski [Fri, 16 Apr 2021 14:07:09 +0000 (14:07 +0000)]
[flang][driver] Fine-tune `-fdebug-dump-symbols`

When generating output for `-fdebug-dump-symbols`, make sure that
BuildRuntimeDerivedTypeTables is also run. This change is needed in
order to make the implementation of `-fdebug-dump-symbols` in
`flang-new` consistent with `f18`. It also allows us to port more tests
to use the new driver whenever it is enabled.

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

3 years ago[Clang][Coroutine][DebugInfo] Relax test ordering requirement
Jeremy Morse [Mon, 26 Apr 2021 08:48:36 +0000 (09:48 +0100)]
[Clang][Coroutine][DebugInfo] Relax test ordering requirement

The test added in D97533 (and modified by this patch) has some overly
strict printed metadata ordering requirements, specifically the
interleaving of DILocalVariable nodes and DILocation nodes. Slight changes
in metadata emission can easily break this unfortunately.

This patch stops after clang codegen rather than allowing the coro splitter
to run,  and reduces the need for ordering: it picks out the
DILocalVariable nodes being sought, in any order (CHECK-DAG), and doesn't
examine any DILocations. The implicit CHECK-NOT is what's important: the
test seeks to ensure a duplicate set of DILocalVariables aren't emitted in
the same scope.

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

3 years ago[clang-format] fix indent in alignChainedConditionals
Krasimir Georgiev [Thu, 22 Apr 2021 08:56:15 +0000 (10:56 +0200)]
[clang-format] fix indent in alignChainedConditionals

Clang-format was indenting the lines following the `?` in the added test
case by +5 instead of +4. This only happens in a very specific
situation, where the `?` is followed by a multiline block comment, as in
the example. This fix addresses this without regressing any of the
existing tests.

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

3 years ago[ARM] Ensure loop invariant active.lane.mask operands
David Green [Mon, 26 Apr 2021 09:04:33 +0000 (10:04 +0100)]
[ARM] Ensure loop invariant active.lane.mask operands

CGP can move instructions like a ptrtoint into a loop, but the
MVETailPredication when converting them will currently assume invariant
trip counts. This tries to ensure the operands are loop invariant, and
bails if not.

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

3 years ago[RISCV] Add REQUIRES: riscv-registered-target for RISC-V test cases.
Hsiangkai Wang [Mon, 26 Apr 2021 09:01:49 +0000 (17:01 +0800)]
[RISCV] Add REQUIRES: riscv-registered-target for RISC-V test cases.

3 years ago[llvm-dwarfdump] Fix split-dwarf bug in stats for inlined var loc cov
Djordje Todorovic [Mon, 26 Apr 2021 08:14:12 +0000 (01:14 -0700)]
[llvm-dwarfdump] Fix split-dwarf bug in stats for inlined var loc cov

Initial (D96045) patch didn't handle split dwarf cases,
so this fixes that bug.

In addition, before applying this patch, we had a slowdown
that happened after the D96045. With this patch,
the slowdown will be fixed as well.

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

3 years ago[clang][deps] NFC: Fix typo
Jan Svoboda [Mon, 26 Apr 2021 08:55:24 +0000 (10:55 +0200)]
[clang][deps] NFC: Fix typo

3 years ago[clang][deps] Only generate absolute paths when asked to
Jan Svoboda [Thu, 22 Apr 2021 11:49:25 +0000 (13:49 +0200)]
[clang][deps] Only generate absolute paths when asked to

Add option to `clang-scan-deps` to enable/disable generation of command-line arguments with absolute paths. This is essentially a revert of D100533, but with improved naming and added test.

Reviewed By: dexonsmith

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

3 years ago[OpenCL] Add inc/dec/cmpxchg C++ legacy atomics with generic
Sven van Haastregt [Mon, 26 Apr 2021 08:46:11 +0000 (09:46 +0100)]
[OpenCL] Add inc/dec/cmpxchg C++ legacy atomics with generic

Mirror the remaining C++ for OpenCL specific builtins from opencl-c.h
to the TableGen builtin functions.

Fixes PR50041 (part 2).

3 years ago[RISCV] Implement the vwcvt{u}.x.x.v/vncvt.x.x.w builtin.
Hsiangkai Wang [Tue, 20 Apr 2021 07:31:13 +0000 (15:31 +0800)]
[RISCV] Implement the vwcvt{u}.x.x.v/vncvt.x.x.w builtin.

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

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.