platform/upstream/llvm.git
3 years ago[RISCV] Fix handling of nxvXi64 vmsgt(u).vx intrinsics on RV32.
Craig Topper [Thu, 1 Apr 2021 17:17:53 +0000 (10:17 -0700)]
[RISCV] Fix handling of nxvXi64 vmsgt(u).vx intrinsics on RV32.

We need to splat the scalar separately and use .vv, but there is
no vmsgt(u).vv. So add isel patterns to select vmslt(u).vv with
swapped operands.

We also need to get VT to use for the splat from an operand rather
than the result since the result VT is nxvXi1.

Reviewed By: HsiangKai

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

3 years ago[MC][ARM] add .w suffixes for ORN/ORNS T1
Nick Desaulniers [Thu, 1 Apr 2021 17:27:03 +0000 (10:27 -0700)]
[MC][ARM] add .w suffixes for ORN/ORNS T1

See also:
F5.1.128 ORN, ORNS (register) T1 shift or rotate by value variant
of the Arm ARM.

Link: https://github.com/ClangBuiltLinux/linux/issues/1309
Reviewed By: DavidSpickett

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

3 years ago[gn build] Port fdc4f19e2f80
LLVM GN Syncbot [Thu, 1 Apr 2021 17:18:32 +0000 (17:18 +0000)]
[gn build] Port fdc4f19e2f80

3 years ago[RISCV] Add custom type legalization to form MULHSU when possible.
Craig Topper [Thu, 1 Apr 2021 16:41:36 +0000 (09:41 -0700)]
[RISCV] Add custom type legalization to form MULHSU when possible.

There's no target independent ISD opcode for MULHSU, so custom
legalize 2*XLen multiplies ourselves. We have to be a little
careful to prefer MULHU or MULHSU.

I thought about doing this in isel by pattern matching the
(add (mul X, (srai Y, XLen-1)), (mulhu X, Y)) pattern. I decided
against this because the add might become part of a chain of adds.
I don't trust DAG combine not to reassociate with other adds making
it difficult to find both pieces again.

Reviewed By: asb

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

3 years ago[RISCV] Add MULHU and MULHS tests with a constant operand.
Craig Topper [Thu, 1 Apr 2021 16:37:44 +0000 (09:37 -0700)]
[RISCV] Add MULHU and MULHS tests with a constant operand.

3 years ago[lldb/test] Respect --apple-sdk path when querying SDK info
Vedant Kumar [Thu, 1 Apr 2021 17:00:52 +0000 (10:00 -0700)]
[lldb/test] Respect --apple-sdk path when querying SDK info

Respect --apple-sdk <path> if it's specified. If the SDK is simply
mounted from some disk image, and not actually installed, this is the
only way to use it.

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

3 years ago[AMDGPU] Remove SIAddIMGInit pass which is now unused
Jay Foad [Thu, 1 Apr 2021 16:20:14 +0000 (17:20 +0100)]
[AMDGPU] Remove SIAddIMGInit pass which is now unused

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

3 years ago[AMDGPU][GlobalISel] Add IMG init in selectImageIntrinsic
Jay Foad [Wed, 31 Mar 2021 15:45:21 +0000 (16:45 +0100)]
[AMDGPU][GlobalISel] Add IMG init in selectImageIntrinsic

Doing this during instruction selection avoids the cost of running
SIAddIMGInit which is yet another pass over the MIR.

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

3 years ago[AMDGPU][SDag] Add IMG init in AdjustInstrPostInstrSelection
Jay Foad [Thu, 1 Apr 2021 16:13:12 +0000 (17:13 +0100)]
[AMDGPU][SDag] Add IMG init in AdjustInstrPostInstrSelection

Doing this in a post-isel hook avoids the cost of running SIAddIMGInit
which is yet another pass over the MIR.

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

3 years ago[CMake] Remove {LIBCXX,LIBCXXABI,LIBUNWIND}_INSTALL_PREFIX
Petr Hosek [Thu, 1 Apr 2021 00:34:05 +0000 (17:34 -0700)]
[CMake] Remove {LIBCXX,LIBCXXABI,LIBUNWIND}_INSTALL_PREFIX

These variables were introduced during early work on the runtimes build
but were obsoleted by {LIBCXX,LIBCXXABI,LIBUNWIND}_INSTALL_LIBRARY_DIR.

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

3 years ago[PPC] Regenerate PR27078 test checks
Simon Pilgrim [Thu, 1 Apr 2021 14:58:44 +0000 (15:58 +0100)]
[PPC] Regenerate PR27078 test checks

3 years ago[llvm-reduce] Move tests to tools folder
Samuel [Thu, 1 Apr 2021 17:04:04 +0000 (10:04 -0700)]
[llvm-reduce] Move tests to tools folder

Move tests for llvm-reduce to tools folder

Reviewed By: fhahn, lebedev.ri

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

3 years ago[lldb] Update test.rst with a paragraph about pdb
Dave Lee [Thu, 1 Apr 2021 16:26:26 +0000 (09:26 -0700)]
[lldb] Update test.rst with a paragraph about pdb

Debugging tests sometimes involves debugging the Python source. This adds a paragraph to
the "Debugging Test Failures" section about using `pdb`, and also describes how to run
lldb commands from pdb.

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

3 years ago[OpenMP][NFC] Fix typo in libomptarget error message
Joseph Huber [Thu, 1 Apr 2021 13:55:14 +0000 (09:55 -0400)]
[OpenMP][NFC] Fix typo in libomptarget error message

Summary:
There was a typo suggesting the user to use `LIBOMPTARGET_DEBUG` instead of
`LIBOMPTARGET_INFO`

3 years ago[HIP] remove overloaded abs in header
Yaxun (Sam) Liu [Wed, 31 Mar 2021 21:33:11 +0000 (17:33 -0400)]
[HIP] remove overloaded abs in header

This function seems to be introduced by accident by
https://github.com/llvm/llvm-project/commit/aa2b593f1495a972a4a592952760ec9d5f7c01f1

Such overloaded abs function did not exist before
the refactoring, and does not exist in
https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/__clang_cuda_cmath.h

Conceptually it also does not make sense, since it adds something like

double abs(int x) {
  return ::abs((double)x);
}

It caused regressions in CuPy.

Reviewed by: Aaron Enye Shi, Artem Belevich

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

3 years ago[RISCV] Improve 64-bit integer materialization for some cases.
Craig Topper [Thu, 1 Apr 2021 15:51:28 +0000 (08:51 -0700)]
[RISCV] Improve 64-bit integer materialization for some cases.

This adds a new integer materialization strategy mainly targeted
at 64-bit constants like 0xffffffff where there are 32 or more trailing
ones with leading zeros. We can materialize these by using an addi -1
and srli to restore the leading zeros. This matches what gcc does.

I haven't limited to just these cases though. The implementation
here takes the constant, shifts out all the leading zeros and
shifts ones into the LSBs, creates the new sequence, adds an srli,
and checks if this is shorter than our original strategy.

I've separated the recursive portion into a standalone function
so I could append the new strategy outside of the recursion. Since
external users are no longer using the recursive function, I've
cleaned up the external interface to return the sequence instead of
taking a vector by reference.

Reviewed By: asb

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

3 years ago[tests] Cover the most basic cases of nosync inference
Philip Reames [Thu, 1 Apr 2021 16:03:13 +0000 (09:03 -0700)]
[tests] Cover the most basic cases of nosync inference

3 years ago[OpenMP51][DOCS] Mark "add present modifier in defaultmap clause" as
cchen [Thu, 1 Apr 2021 16:02:23 +0000 (11:02 -0500)]
[OpenMP51][DOCS] Mark "add present modifier in defaultmap clause" as
done, NFC.

3 years ago[LoopVectorize] auto-generate complete checks; NFC
Sanjay Patel [Thu, 1 Apr 2021 14:37:06 +0000 (10:37 -0400)]
[LoopVectorize] auto-generate complete checks; NFC

We can't see how much overhead/redundancy is being
created with the partial checks.

To make it smaller and easier to read, I reduced the
vectorization factor because that does not add new
information - it just duplicates things.

3 years ago[lldb] Un-XFAIL TestAutoInstallMainExecutable on Windows
Stella Stamenova [Thu, 1 Apr 2021 15:45:36 +0000 (08:45 -0700)]
[lldb] Un-XFAIL TestAutoInstallMainExecutable on Windows

3 years ago[AMDGPU] Small cleanup to constructRetValue and its caller. NFC.
Jay Foad [Thu, 1 Apr 2021 15:31:22 +0000 (16:31 +0100)]
[AMDGPU] Small cleanup to constructRetValue and its caller. NFC.

3 years ago[deref-at-point] restrict inference of dereferenceability based on allocsize attribute
Philip Reames [Thu, 1 Apr 2021 15:29:47 +0000 (08:29 -0700)]
[deref-at-point] restrict inference of dereferenceability based on allocsize attribute

Support deriving dereferenceability facts from allocation sites with known object sizes while correctly accounting for any possibly frees between allocation and use site. (At the moment, we're conservative and only allowing it in functions where we know we can't free.)

This is part of the work on deref-at-point semantics. I'm making the change unconditional as the miscompile in this case is way too easy to trip by accident, and the optimization was only recently added (by me).

There will be a follow up patch wiring through TLI since that should now be doable without introducing widespread miscompiles.

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

3 years ago[regalloc] Ensure Query::collectInterferringVregs is called before interval iteration
Mircea Trofin [Tue, 9 Mar 2021 04:55:53 +0000 (20:55 -0800)]
[regalloc] Ensure Query::collectInterferringVregs is called before interval iteration

The main part of the patch is the change in RegAllocGreedy.cpp: Q.collectInterferringVregs()
needs to be called before iterating the interfering live ranges.

The rest of the patch offers support that is the case: instead of  clearing the query's
InterferingVRegs field, we invalidate it. The clearing happens when the live reg matrix
is invalidated (existing triggering mechanism).

Without the change in RegAllocGreedy.cpp, the compiler ices.

This patch should make it more easily discoverable by developers that
collectInterferringVregs needs to be called before iterating.

I will follow up with a subsequent patch to improve the usability and maintainability of Query.

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

3 years agoRevert "[clang][parser] Set source ranges for GNU-style attributes"
Timm Bäder [Thu, 1 Apr 2021 15:32:40 +0000 (17:32 +0200)]
Revert "[clang][parser] Set source ranges for GNU-style attributes"

This reverts commit 1ea9fa8c507ec360cf43faf46d13b149e37c950d.

3 years ago[clang][parser] Set source ranges for GNU-style attributes
Timm Bäder [Thu, 25 Mar 2021 12:32:42 +0000 (13:32 +0100)]
[clang][parser] Set source ranges for GNU-style attributes

Set the source ranges for parsed GNU-style attributes in
ParseGNUAttributes(), the same way that ParseCXX11Attributes() does it.

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

3 years ago[AsmParser][SystemZ][z/OS] Add in support to accept "#" as part of an Identifier...
Anirudh Prasad [Thu, 1 Apr 2021 14:38:42 +0000 (10:38 -0400)]
[AsmParser][SystemZ][z/OS] Add in support to accept "#" as part of an Identifier token

- This patch adds in support to accept the "#" character as part of an Identifier.
- This support is needed especially for the HLASM dialect since "#" is treated as part of the valid "Alphabet" range
- The way this is done is by making use of the previous precedent set by the `AllowAtInIdentifier` field in `MCAsmLexer.h`. A new field called `AllowHashInIdentifier` is introduced.
- The static function `IsIdentifierChar` is also updated to accept the `#` character if the `AllowHashInIdentifier` field is set to true.
Note: The field introduced in `MCAsmLexer.h` could very well be moved to `MCAsmInfo.h`. I'm not opposed to it. I decided to put it in `MCAsmLexer` since there seems to be some sort of precedent already with `AllowAtInIdentifier`.

Reviewed By: abhina.sreeskantharajan, nickdesaulniers, MaskRay

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

3 years ago[AArch64][SVE] Improve codegen for select nodes with fixed types
Bradley Smith [Thu, 25 Mar 2021 15:07:43 +0000 (15:07 +0000)]
[AArch64][SVE] Improve codegen for select nodes with fixed types

Additionally, move the existing fixed vselect tests to *-vselect.ll.

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

3 years ago[AArch64][SVE] SVE functions should use the SVE calling convention for fast calls
Bradley Smith [Tue, 30 Mar 2021 14:46:03 +0000 (15:46 +0100)]
[AArch64][SVE] SVE functions should use the SVE calling convention for fast calls

When an SVE function calls another SVE function using the C calling
convention we use the more efficient SVE VectorCall PCS.  However,
for the Fast calling convention we're incorrectly falling back to
the generic AArch64 PCS.

This patch adds the same "can use SVE vector calling convention"
detection used by CallingConv::C to CallingConv::Fast.

Co-authored-by: Paul Walker <paul.walker@arm.com>
Differential Revision: https://reviews.llvm.org/D99657

3 years ago[AMDGPU] Enable output modifiers for double precision instructions
Brendon Cahoon [Thu, 25 Mar 2021 20:26:33 +0000 (16:26 -0400)]
[AMDGPU] Enable output modifiers for double precision instructions

Update SIFoldOperands pass to recognize v_add_f64 and v_mul_f64
instructions for folding output modifiers.

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

3 years ago[SLP]Improve and fix getVectorElementSize.
Alexey Bataev [Tue, 30 Mar 2021 13:47:55 +0000 (06:47 -0700)]
[SLP]Improve and fix getVectorElementSize.

1. Need to cleanup InstrElementSize map for each new tree, otherwise might
use sizes from the previous run of the vectorization attempt.
2. No need to include into analysis the instructions from the different basic
   blocks to save compile time.

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

3 years ago[DAG] MergeInnerShuffle with BinOps - sometimes accept undef mask elements
Simon Pilgrim [Thu, 1 Apr 2021 13:27:32 +0000 (14:27 +0100)]
[DAG] MergeInnerShuffle with BinOps - sometimes accept undef mask elements

If the inner shuffle already contains undef elements, then accept them in the merged shuffle as well.

This helps some X86 HADD/SUB patterns where slow targets were ending up with HADD/SUB because the (un)merged shuffles were stuck either side of the ADD/SUB - meaning we ended up with a total cost much higher than the "2*shuffle+add" that a slow target usually expands a HADD/SUB to.

3 years ago[flang] Move .f77 to the list of fixed-form file extensions
Andrzej Warzynski [Mon, 29 Mar 2021 10:36:57 +0000 (11:36 +0100)]
[flang] Move .f77 to the list of fixed-form file extensions

The free form was introduced in Fortran 90, so treating .f77 as
free-form was a bug.

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

3 years ago[OpenCL][Docs] Added a label for C++ libs section and example link
Anastasia Stulova [Thu, 1 Apr 2021 12:54:54 +0000 (13:54 +0100)]
[OpenCL][Docs] Added a label for C++ libs section and example link

3 years ago[lldb] Make TestLoadUsingLazyBind work on linux
Pavel Labath [Thu, 1 Apr 2021 12:44:01 +0000 (14:44 +0200)]
[lldb] Make TestLoadUsingLazyBind work on linux

and probably other posix oses. Use extra_images to ensure
LD_LIBRARY_PATH is set correctly.

Also take the opportunity to remove hand-rolled library extension
management code in favor of the existing one.

3 years ago[SLP]Remove `else` after `return`, NFC.`
Alexey Bataev [Thu, 1 Apr 2021 12:32:18 +0000 (05:32 -0700)]
[SLP]Remove `else` after `return`, NFC.`

3 years ago[lldb] Rewrite TestAutoInstallMainExecutable logic
Pavel Labath [Thu, 1 Apr 2021 09:58:45 +0000 (11:58 +0200)]
[lldb] Rewrite TestAutoInstallMainExecutable logic

The test uses debug info from one binary to debug a different one. This
does not work on macos, and its pure luck that it works elsewhere (the
variable that it inspects happens to have the same address in both).

The purpose of this test is to verify that lldb has not overwritten the
target executable. That can be more easily achieved by checking the exit
code of the binary, so change the test to do that.

Also remove the llgs_test decorator, as it's preventing the test from
running on macos. All the test needs is the platform functionality of
lldb-server, which is available everywhere.

3 years ago[lldb] [test] Mark lldb-server multiprocess tests as LLGS cat
Michał Górny [Thu, 1 Apr 2021 12:17:47 +0000 (14:17 +0200)]
[lldb] [test] Mark lldb-server multiprocess tests as LLGS cat

3 years ago[AMDGPU][MC][GFX10][GFX90A] Corrected _e32/_e64 suffices
Dmitry Preobrazhensky [Thu, 1 Apr 2021 11:21:00 +0000 (14:21 +0300)]
[AMDGPU][MC][GFX10][GFX90A] Corrected _e32/_e64 suffices

Fixed bugs https://bugs.llvm.org//show_bug.cgi?id=49643, https://bugs.llvm.org//show_bug.cgi?id=49644, https://bugs.llvm.org//show_bug.cgi?id=49645.

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

3 years ago[X86][SSE] Fold HOP(HOP(X,X),HOP(Y,Y)) -> HOP(PERMUTE(HOP(X,Y)),PERMUTE(HOP(X,Y))
Simon Pilgrim [Thu, 1 Apr 2021 09:08:08 +0000 (10:08 +0100)]
[X86][SSE] Fold HOP(HOP(X,X),HOP(Y,Y)) -> HOP(PERMUTE(HOP(X,Y)),PERMUTE(HOP(X,Y))

For slow-hop targets, attempt to merge HADD/SUB pairs used in chains.

3 years ago[X86][SSE] Enable (F)HADD/SUB handling to SimplifyMultipleUseDemandedVectorElts
Simon Pilgrim [Wed, 31 Mar 2021 16:36:34 +0000 (17:36 +0100)]
[X86][SSE] Enable (F)HADD/SUB handling to SimplifyMultipleUseDemandedVectorElts

Attempt to bypass unused horiz-op operands.

This is very similar to the PACKSS/PACKUS handling - we should try to merge these.

3 years ago[X86][SSE] Add isHorizOp helper function. NFCI.
Simon Pilgrim [Wed, 31 Mar 2021 13:13:08 +0000 (14:13 +0100)]
[X86][SSE] Add isHorizOp helper function. NFCI.

3 years ago[AMDGPU][MC] Added flag to identify VOP instructions which have a single variant
Dmitry Preobrazhensky [Thu, 1 Apr 2021 10:41:09 +0000 (13:41 +0300)]
[AMDGPU][MC] Added flag to identify VOP instructions which have a single variant

By convention, VOP1/2/C instructions which can be promoted to VOP3 have _e32 suffix while promoted instructions have _e64 suffix. Instructions which have a single variant should have no _e32/_e64 suffix. Unfortunately there was no simple way to identify single variant instructions - it was implemented by a hack. See bug https://bugs.llvm.org/show_bug.cgi?id=39086.

This fix simplifies handling of single VOP instructions by adding a dedicated flag.

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

3 years ago[SLP] Add test cases for missing SLP vectorization on AArch64.
Florian Hahn [Thu, 1 Apr 2021 10:11:58 +0000 (11:11 +0100)]
[SLP] Add test cases for missing SLP vectorization on AArch64.

3 years ago[clang][Checkers] Extend PthreadLockChecker state dump (NFC).
Balázs Kéri [Thu, 1 Apr 2021 09:10:07 +0000 (11:10 +0200)]
[clang][Checkers] Extend PthreadLockChecker state dump (NFC).

Add printing of map 'DestroyRetVal'.

Reviewed By: steakhal

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

3 years ago[NFC] Add tests for scalable vectorization of loops with large stride acesses
David Sherwood [Tue, 23 Mar 2021 14:35:03 +0000 (14:35 +0000)]
[NFC] Add tests for scalable vectorization of loops with large stride acesses

This patch just adds tests that we can vectorize loop such as these:

  for (i = 0; i < n; i++)
    dst[i * 7] += 1;

and

  for (i = 0; i < n; i++)
    if (cond[i])
      dst[i * 7] += 1;

using scalable vectors, where we expect to use gathers and scatters in the
vectorized loop. The vector of pointers used for the gather is identical
to those used for the scatter so there should be no memory dependences.

Tests are added here:

  Transforms/LoopVectorize/AArch64/sve-large-strides.ll

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

3 years ago[MLIR][Affine] Add utility to check if the slice is valid
Vinayaka Bandishti [Thu, 1 Apr 2021 09:08:24 +0000 (14:38 +0530)]
[MLIR][Affine] Add utility to check if the slice is valid

Fixes a bug in affine fusion pipeline where an incorrect slice is computed.
After the slice computation is done, original domain of the the source is
compared with the new domain that will result if the fusion succeeds. If the
new domain must be a subset of the original domain for the slice to be
valid. If the slice computed is incorrect, fusion based on such a slice is
avoided.

Relevant test cases are added/edited.

Fixes https://bugs.llvm.org/show_bug.cgi?id=49203

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

3 years ago[LLDB] Fix sync issue in TestVSCode_launch.test_progress_events
Muhammad Omair Javaid [Thu, 1 Apr 2021 09:15:00 +0000 (14:15 +0500)]
[LLDB] Fix sync issue in TestVSCode_launch.test_progress_events

This fixes flakiness in TestVSCode_launch.test_progress_events
vscode.progress_events some times failed to populate in time for
follow up iterations.

Adding a minor delay before the the for the loop fixes the issue.

Reviewed By: clayborg

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

3 years agoRevert "Revert "[LLDB] Arm64/Linux test case for MTE and Pointer Authentication regset""
Muhammad Omair Javaid [Thu, 1 Apr 2021 09:10:14 +0000 (14:10 +0500)]
Revert "Revert "[LLDB] Arm64/Linux test case for MTE and Pointer Authentication regset""

This reverts commit feb6f2c78fa9474e7329c4a809f175b1675d0975.

3 years agoRevert "Revert "[LLDB] Arm64/Linux Add MTE and Pointer Authentication registers""
Muhammad Omair Javaid [Wed, 31 Mar 2021 18:01:38 +0000 (23:01 +0500)]
Revert "Revert "[LLDB] Arm64/Linux Add MTE and Pointer Authentication registers""

This reverts commit 71b648f7158c7a0b4918eaa3e94d307e4bbfce97.

There was a typo in the last commit which was causing LLDB AArch64 Linux
buildbot testsuite failures. Now fixed in current version.

3 years ago[LoopFlatten] Do not report CFG analyses as up-to-date
Yevgeny Rouban [Thu, 1 Apr 2021 08:33:00 +0000 (15:33 +0700)]
[LoopFlatten] Do not report CFG analyses as up-to-date

Removes CFGAnalyses from the preserved analyses set
returned by LoopFlattenPass::run().

Reviewed By: Dave Green, Ta-Wei Tu

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

3 years ago[Driver] Fix architecture triplets and search paths for Linux x32
Harald van Dijk [Thu, 1 Apr 2021 08:47:56 +0000 (09:47 +0100)]
[Driver] Fix architecture triplets and search paths for Linux x32

Currently, support for the x32 ABI is handled as a multilib to the
x86_64 target only. However, full self-hosting x32 systems treating it
as a separate architecture with its own architecture triplets as well as
search paths exist as well, in Debian's x32 port and elsewhere.

This adds the missing architecture triplets and search paths so that
clang can work as a native compiler on x32, and updates the tests so
that they pass when using an x32 libdir suffix.

Additionally, we would previously also assume that objects from any
x86_64-linux-gnu GCC installation could be used to target x32. This
changes the logic so that only GCC installations that include x32
support are used when targetting x32, meaning x86_64-linux-gnux32 GCC
installations, and x86_64-linux-gnu and i686-linux-gnu GCC installations
that include x32 multilib support.

Reviewed By: MaskRay

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

3 years ago[WebAssembly] Invert branch condition on xor input
Sam Parker [Wed, 31 Mar 2021 08:25:18 +0000 (09:25 +0100)]
[WebAssembly] Invert branch condition on xor input

A frequent pattern for floating point conditional branches use an xor
to invert the input for the branch. Instead we can fold away the xor
by swapping the branch target instead.

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

3 years ago[mlir][Python][Linalg] Add missing attributes to linalg ops
Nicolas Vasilache [Wed, 31 Mar 2021 09:33:08 +0000 (09:33 +0000)]
[mlir][Python][Linalg] Add missing attributes to linalg ops

This revision tightens up the handling of attributes for both named
and generic linalg ops.
To demonstrate the IR validity, a working e2e Linalg example is added.

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

3 years ago[lldb] Fix build errors from 3bea7306e8
Pavel Labath [Thu, 1 Apr 2021 07:01:35 +0000 (09:01 +0200)]
[lldb] Fix build errors from 3bea7306e8

The addition of the dummy constructors requires matching changes in os-
and arch-specific files, which I forgot about.

3 years ago[lldb] Fix compilation with gcc-6.5
Pavel Labath [Thu, 1 Apr 2021 06:13:50 +0000 (08:13 +0200)]
[lldb] Fix compilation with gcc-6.5

This fixes (works around) two errors with gcc-6.5.
- in the RegisterContext_x86 files, gcc is unable to synthesize a
  default constructor -- it thinks it needs to initialize the virtual
  base class, even though said classes are abstract. I fix that by
  providing a dummy constructor.
- In ReproducerInstrumentationTest, it is not able to deduce that the
  TestingRegistry class is movable (it contains a map of unique
  pointers). I change the type from Optional<TestingRegistry> to
  unique_ptr<TestingRegistry), so that moving is not required
  (copying/moving a polymorphic type is not a very good idea in any
  case).

3 years ago[libc++] Build and test with -Wundef warning. NFC.
Marek Kurdej [Thu, 1 Apr 2021 06:29:55 +0000 (08:29 +0200)]
[libc++] Build and test with -Wundef warning. NFC.

This will avoid typos like `_LIBCPP_STD_VERS` (<future>) or using `#if TEST_STD_VER > 17` without including "test_macros.h".

Reviewed By: ldionne, #libc

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

3 years ago[NFC] Undo some erroneous renamings
Max Kazantsev [Thu, 1 Apr 2021 06:10:10 +0000 (13:10 +0700)]
[NFC] Undo some erroneous renamings

Some vars renamed by mistake during auto-replacements. Undoing them.

3 years ago[NFC] Disambiguate LI in GVN
Max Kazantsev [Thu, 1 Apr 2021 05:31:57 +0000 (12:31 +0700)]
[NFC] Disambiguate LI in GVN

Name GVN uses name 'LI' for two different unrelated things:
LoadInst and LoopInfo. This patch relates the variables with
former meaning into 'Load' to disambiguate the code.

3 years ago[lldb] Remove references to LLDB_CAPTURE_REPRODUCER
Jonas Devlieghere [Thu, 1 Apr 2021 04:40:26 +0000 (21:40 -0700)]
[lldb] Remove references to LLDB_CAPTURE_REPRODUCER

Remove the remaining references to LLDB_CAPTURE_REPRODUCER. I removed
the functionality in an earlier commit but forgot that there was a
corresponding test and logic to unset it in our test suite.

3 years ago[lldb-vscode] Use LLVM's ScopeExit to ensure we always terminate the debugger
Jonas Devlieghere [Thu, 1 Apr 2021 04:34:47 +0000 (21:34 -0700)]
[lldb-vscode] Use LLVM's ScopeExit to ensure we always terminate the debugger

Make sure we always terminate the debugger by using a RAII object.

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

3 years ago[lldb-vscode] Consistently use return EXIT_SUCCESS and EXIT_FAILURE (NFC)
Jonas Devlieghere [Thu, 1 Apr 2021 04:35:45 +0000 (21:35 -0700)]
[lldb-vscode] Consistently use return EXIT_SUCCESS and EXIT_FAILURE (NFC)

Consistently use return with EXIT_SUCCESS or EXIT_FAILURE instead of
mix-and-matching return, exit 0, 1 etc.

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

3 years ago[debug-info] support new tuning debugger type DBX for XCOFF DWARF
Chen Zheng [Fri, 26 Mar 2021 07:21:46 +0000 (03:21 -0400)]
[debug-info] support new tuning debugger type DBX for XCOFF DWARF

Based on this debugger type, for now, we plan to:
1: use inline string by default for XCOFF DWARF
2: generate no column info for debug line table.

Reviewed By: aprantl

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

3 years ago[lldb] Remove LLDB_CAPTURE_REPRODUCER override
Jonas Devlieghere [Thu, 1 Apr 2021 04:08:55 +0000 (21:08 -0700)]
[lldb] Remove LLDB_CAPTURE_REPRODUCER override

Remove the LLDB_CAPTURE_REPRODUCER as it is inherently dangerous. The
reproducers require careful initialization which cannot be guaranteed by
overwriting the reproducer mode at this level.

If we want to provide this functionality, we should do it in the driver
instead. It was originally added to enable capture in CI, but we now
have a dedicated CI job that captures and replays the test suite.

3 years ago[clang][APINotes] Fix -Wunused-function warning (NFC)
Yang Fan [Thu, 1 Apr 2021 01:16:51 +0000 (09:16 +0800)]
[clang][APINotes] Fix -Wunused-function warning (NFC)

GCC warning:
```
/llvm-project/clang/lib/APINotes/APINotesYAMLCompiler.cpp:574:23: warning: ‘void {anonymous}::Module::dump()’ defined but not used [-Wunused-function]
  574 | LLVM_DUMP_METHOD void Module::dump() {
      |                       ^~~~~~
```

3 years ago[GVN] Propagate llvm.access.group metadata of loads
KAWASHIMA Takahiro [Wed, 31 Mar 2021 11:41:05 +0000 (20:41 +0900)]
[GVN] Propagate llvm.access.group metadata of loads

Before this change, the `llvm.access.group` metadata was dropped
when moving a load instruction in GVN. This prevents vectorizing
a C/C++ loop with `#pragma clang loop vectorize(assume_safety)`.
This change propagates the metadata as well as other metadata if
it is safe (the move-destination basic block and source basic
block belong to the same loop).

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

3 years ago[GVN][NFC] Pre-commit test for D93503
KAWASHIMA Takahiro [Wed, 31 Mar 2021 11:39:44 +0000 (20:39 +0900)]
[GVN][NFC] Pre-commit test for D93503

3 years ago[GVN][NFC] Refactor analyzeLoadFromClobberingWrite
qixingxue [Wed, 31 Mar 2021 23:08:23 +0000 (07:08 +0800)]
[GVN][NFC] Refactor analyzeLoadFromClobberingWrite

This commit adjusts the order of two swappable if statements to
make code cleaner.

Reviewed By: lattner, nikic
Differential Revision: https://reviews.llvm.org/D99648

3 years agoRevert "Add support to -Wa,--version in clang"
Nick Desaulniers [Thu, 1 Apr 2021 00:02:13 +0000 (17:02 -0700)]
Revert "Add support to -Wa,--version in clang"

This reverts commit 3cc3c0f8352ec33ca2f2636f94cb1d85fc57ac16.

Breaks non-linux platforms.

https://reviews.llvm.org/D99556#2662706
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
3 years ago[lld][MachO] Refactor handling of subsections
Alexander Shaposhnikov [Wed, 31 Mar 2021 22:23:19 +0000 (15:23 -0700)]
[lld][MachO] Refactor handling of subsections

This diff is a preparation for fixing FunStabs (incorrect size calculation).
std::map<uint32_t, InputSection*> (SubsectionMap) is replaced with
a sorted vector + binary search. If .subsections_via_symbols is set
this vector will contain the list of subsections, otherwise,
the offsets will be used for calculating the symbols sizes.

Test plan: make check-all

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

3 years ago[ValueTracking] Handle non-zero ashr/lshr recurrences
Philip Reames [Wed, 31 Mar 2021 23:47:32 +0000 (16:47 -0700)]
[ValueTracking] Handle non-zero ashr/lshr recurrences

If we know we don't shift out bits (e.g. exact), all we need to know is that input is non-zero.

3 years ago[tests] Add tests for ashr/lshr recurrences in isKnownNonZero
Philip Reames [Wed, 31 Mar 2021 23:36:19 +0000 (16:36 -0700)]
[tests] Add tests for ashr/lshr recurrences in isKnownNonZero

3 years agoAdd support to -Wa,--version in clang
Jian Cai [Wed, 31 Mar 2021 22:37:19 +0000 (15:37 -0700)]
Add support to -Wa,--version in clang

Clang currently only supports -Wa,--version when -no-integrated-as is
used. This adds support to -Wa,--version with -integrated-as.

Link:
https://github.com/ClangBuiltLinux/linux/issues/1320

Reviewed By: nickdesaulniers, MaskRay

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

3 years agoAdd debug printers for KnownBits [nfc]
Philip Reames [Wed, 31 Mar 2021 22:34:57 +0000 (15:34 -0700)]
Add debug printers for KnownBits [nfc]

3 years agoSupport {S,U}REMEqFold before legalization
Simonas Kazlauskas [Sat, 3 Oct 2020 17:25:02 +0000 (20:25 +0300)]
Support {S,U}REMEqFold before legalization

This allows these optimisations to apply to e.g. `urem i16` directly
before `urem` is promoted to i32 on architectures where i16 operations
are not intrinsically legal (such as on Aarch64). The legalization then
later can happen more directly and generated code gets a chance to avoid
wasting time on computing results in types wider than necessary, in the end.

Seems like mostly an improvement in terms of results at least as far as x86_64 and aarch64 are concerned, with a few regressions here and there. It also helps in preventing regressions in changes like {D87976}.

Reviewed By: lebedev.ri

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

3 years ago[RISCV] Add UnsupportedSchedZfh multiclass to reduce duplicate lines from RISCVSchedR...
Craig Topper [Wed, 31 Mar 2021 22:06:07 +0000 (15:06 -0700)]
[RISCV] Add UnsupportedSchedZfh multiclass to reduce duplicate lines from RISCVSchedRocket.td and RISCVSchedSiFive7.td. NFC

3 years ago[X86] add dwarf annotation for inline stack probe
YangKeao [Wed, 31 Mar 2021 20:44:54 +0000 (23:44 +0300)]
[X86] add dwarf annotation for inline stack probe

While probing stack, the stack register is moved without dwarf
information, which could cause panic if unwind the backtrace.
This commit only add annotation for the inline stack probe case.
Dwarf information for the loop case should be done in another
patch and need further discussion.

Reviewed By: nagisa

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

3 years ago[mlir][tosa] Add tosa.reciprocal and tosa.sigmoid lowerings
natashaknk [Wed, 31 Mar 2021 21:10:18 +0000 (14:10 -0700)]
[mlir][tosa] Add tosa.reciprocal and tosa.sigmoid lowerings

Lowering reciprocal and sigmoid elementwise operations to linalg dialect.

Reviewed By: rsuderman

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

3 years ago [dfsan] Set sigemptyset's return label to be 0
Jianzhou Zhao [Wed, 31 Mar 2021 19:44:25 +0000 (19:44 +0000)]
 [dfsan] Set sigemptyset's return label to be 0

This was not set from when the wrapper was introduced.

Reviewed By: gbalats

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

3 years ago[test, InferFunctionAttrs] Fix use of var defined in CHECK-NOT
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[test, InferFunctionAttrs] Fix use of var defined in CHECK-NOT

LLVM test Transforms/InferFunctionAttrs/annotate contains two RUN
invokation (UNKNOWN and NVPTX lines) which involve a CHECK-NOT directive
with a variable not defined by the enabled CHECK prefixes. This commit
fixes that by:

- enabling CHECK prefix for unknown target with specialisation when it
  differs from other targets
- checking for absence of bcmp with any attribute for NVPTX

Reviewed By: tra

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

3 years ago[NFC][LoopRotation] Count the number of instructions hoisted/cloned into preheader
Roman Lebedev [Wed, 31 Mar 2021 20:23:57 +0000 (23:23 +0300)]
[NFC][LoopRotation] Count the number of instructions hoisted/cloned into preheader

3 years agoRevert "Make TableGenGlobalISel an object library"
Philip Reames [Wed, 31 Mar 2021 20:26:19 +0000 (13:26 -0700)]
Revert "Make TableGenGlobalISel an object library"

This reverts commit 2c3cf62d4a26de85aab180bb43a579c913b17f3e.

Causes build failures on x86_64, will respond to commit thread with link errors.

3 years agoMake TableGenGlobalISel an object library
Aaron Puchert [Wed, 31 Mar 2021 20:14:22 +0000 (22:14 +0200)]
Make TableGenGlobalISel an object library

That's how it was originally intended but that wasn't possible because
we still needed to support older CMake versions.

The problem here is that the sources in TableGenGlobalISel are meant to
be linked into both llvm-tblgen and TableGenTests (a unit test), but not
be part of LLVM proper. So they shouldn't be an ordinary LLVM component.
Because they are used in llvm-tblgen, they can't draw in the LLVM dylib
dependency, but then we'd have to do the same thing in TableGenTests to
make sure we don't link both a static Support library and another copy
through the LLVM dylib.

With an object library we're just reusing the object files and don't
have to care about dependencies at all.

Reviewed By: beanz

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

3 years ago[OPENMP]Fix PR48885: Crash in passing firstprivate args to tasks on Apple M1.
Alexey Bataev [Mon, 29 Mar 2021 17:26:42 +0000 (10:26 -0700)]
[OPENMP]Fix PR48885: Crash in passing firstprivate args to tasks on Apple M1.

Need to bitcast the function pointer passed as a parameter to the real
type to avoid possible problem with calling conventions.

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

3 years ago[OPENMP]Fix PR48658: [OpenMP 5.0] Compiler crash when OpenMP atomic sync hints used.
Alexey Bataev [Tue, 30 Mar 2021 17:36:23 +0000 (10:36 -0700)]
[OPENMP]Fix PR48658: [OpenMP 5.0] Compiler crash when OpenMP atomic sync hints used.

No need to consider hint clause kind as the main atomic clause kind at the
codegen.

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

3 years ago[tests] Exercise cases where SCEV can use trip counts to refine ashr/lshr recurrences
Philip Reames [Wed, 31 Mar 2021 19:48:14 +0000 (12:48 -0700)]
[tests] Exercise cases where SCEV can use trip counts to refine ashr/lshr recurrences

3 years ago[lld-macho] Parallelize UUID hash computation
Jez Ng [Wed, 31 Mar 2021 19:48:18 +0000 (15:48 -0400)]
[lld-macho] Parallelize UUID hash computation

This reuses the approach (and some code) from LLD-ELF.

It's a decent win when linking chromium_framework on a Mac Pro (3.2 GHz 16-Core Intel Xeon W):

      N           Min           Max        Median           Avg        Stddev
  x  20          4.58          4.83          4.66        4.6685   0.066591844
  +  20          4.42          4.61           4.5         4.505    0.04751731
  Difference at 95.0% confidence
          -0.1635 +/- 0.0370242
          -3.5022% +/- 0.793064%
          (Student's t, pooled s = 0.0578462)

The output binary is 381MB.

Reviewed By: #lld-macho, oontvoo

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

3 years ago[lld-macho][nfc] Test that -ObjC will import bitcode with category sections
Jez Ng [Wed, 31 Mar 2021 19:48:14 +0000 (15:48 -0400)]
[lld-macho][nfc] Test that -ObjC will import bitcode with category sections

The functionality was originally added in {D95265}, but the test in that
diff only checked if `-ObjC` would cause bitcode containing ObjC class
symbols to be loaded. It neglected to test for bitcode containing
categories but no class symbols.

This diff also changes the lto-archive.ll test to use `-why_load`
instead of inspecting the output binary's symbol table. This is
motivated by the stacked diff {D99105}, which will hide irrelevant
bitcode symbols.

Reviewed By: #lld-macho, oontvoo

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

3 years ago[SLP]Update test checks, NFC
Alexey Bataev [Wed, 31 Mar 2021 19:35:38 +0000 (12:35 -0700)]
[SLP]Update test checks, NFC

3 years ago[SelectionDAG] Remove unneeded vector resize from the end of FoldConstantArithmetic...
Craig Topper [Wed, 31 Mar 2021 19:25:42 +0000 (12:25 -0700)]
[SelectionDAG] Remove unneeded vector resize from the end of FoldConstantArithmetic. NFC

There's an assert right before that makes sure the size already matches.
Earlier in this function's life, scalars and vectors shared more
code.

3 years ago[mlir][cse] do not replace operands in previously simplified operations
Andrew Young [Mon, 29 Mar 2021 02:25:32 +0000 (19:25 -0700)]
[mlir][cse] do not replace operands in previously simplified operations

If an operation has been inserted as a key in to the known values
hashtable, then it can not be modified in a way which changes its hash.
This change avoids modifying the operands of any previously recorded
operation, which prevents their hash from changing.

In an SSACFG region, it is impossible to visit an operation before
visiting its operands, so this is not a problem. This situation can only
happen in regions without strict dominance, such as graph regions.

Reviewed By: rriddle

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

3 years ago[ConstantFolding] Fixing addo/subo with undef
George Mitenkov [Wed, 31 Mar 2021 18:46:28 +0000 (21:46 +0300)]
[ConstantFolding] Fixing addo/subo with undef

When folding addo/subo with undef, the current
convention is to use { -1, false } for addo and
{ 0, false } for subo. This was fixed for InstSimplify in
https://reviews.llvm.org/rGf094d65beaa492e845b03561eddd75b5be653a01,
but not in ConstantFolding.

Reviewed By: nikic, lebedev.ri

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

3 years ago[SLP]Add a test for the bug in `getVectorElementSize()`, NFC.
Alexey Bataev [Wed, 31 Mar 2021 18:21:54 +0000 (11:21 -0700)]
[SLP]Add a test for the bug in `getVectorElementSize()`, NFC.

3 years ago[flang] Refine checks for pointer initialization targets
peter klausler [Wed, 31 Mar 2021 16:12:28 +0000 (09:12 -0700)]
[flang] Refine checks for pointer initialization targets

f18 was emitting a bogus error message about the lack of a TARGET
attribute when a pointer was initialized with a component of a
variable that was a legitimate TARGET.

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

3 years ago[LoopVectorize] Use SetVector to track uniform uses to prevent non-determinism.
Huihui Zhang [Wed, 31 Mar 2021 17:58:36 +0000 (10:58 -0700)]
[LoopVectorize] Use SetVector to track uniform uses to prevent non-determinism.

Use SetVector instead of SmallPtrSet to track values with uniform use. Doing this
can help avoid non-determinism caused by iterating over unordered containers.

This bug was found with reverse iteration turning on,
--extra-llvm-cmake-variables="-DLLVM_REVERSE_ITERATION=ON".
Failing LLVM test consecutive-ptr-uniforms.ll .

Reviewed By: MaskRay

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

3 years agoMove non-spec TOSA operators into TosaUtilOps.td
Suraj Sudhir [Wed, 31 Mar 2021 17:48:21 +0000 (10:48 -0700)]
Move non-spec TOSA operators into TosaUtilOps.td

Reviewed By: stellaraccident

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

3 years ago[Driver] Move detectLibcxxIncludePath to ToolChain
Petr Hosek [Tue, 22 Sep 2020 08:01:16 +0000 (01:01 -0700)]
[Driver] Move detectLibcxxIncludePath to ToolChain

This helper method is useful even outside of Gnu toolchains, so move
it to ToolChain so it can be reused in other toolchains such as Fuchsia.

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

3 years ago[WebAssembly] Implement i64x2 comparisons
Thomas Lively [Wed, 31 Mar 2021 17:46:17 +0000 (10:46 -0700)]
[WebAssembly] Implement i64x2 comparisons

Removes the prototype builtin and intrinsic for i64x2.eq and implements that
instruction as well as the other i64x2 comparison instructions in the final SIMD
spec. Unsigned comparisons were not included in the final spec, so they still
need to be scalarized via a custom lowering.

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

3 years ago[ValueTracking] Add with.overflow intrinsics to poison analysis functions
Juneyoung Lee [Wed, 31 Mar 2021 17:01:17 +0000 (02:01 +0900)]
[ValueTracking] Add with.overflow intrinsics to poison analysis functions

This is a patch teaching ValueTracking that `s/u*.with.overflow` intrinsics do not
create undef/poison and they propagate poison.
I couldn't write a nice example like the one with ctpop; ValueTrackingTest.cpp were simply updated
to check these instead.
This patch helps reducing regression while fixing https://llvm.org/pr49688 .

Reviewed By: nikic

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

3 years ago[SCEV] Handle unreachable binop when matching shift recurrence
Philip Reames [Wed, 31 Mar 2021 17:29:21 +0000 (10:29 -0700)]
[SCEV] Handle unreachable binop when matching shift recurrence

This fixes an issue introduced with my change d4648e, and reported in pr49768.

The root problem is that dominance collapses in unreachable code, and that LoopInfo explicitly only models reachable code.  Since the recurrence matcher doesn't filter by reachability (and can't easily because not all consumers have domtree), we need to bailout before assuming that finding a recurrence implies we found a loop.

3 years ago[X86] Improve SMULO/UMULO codegen for vXi8 vectors.
Craig Topper [Wed, 31 Mar 2021 16:49:16 +0000 (09:49 -0700)]
[X86] Improve SMULO/UMULO codegen for vXi8 vectors.

The default expansion creates a MUL and either a MULHS/MULHU. Each
of those separately expand to sequences that use one or more
PMULLW instructions as well as additional instructions to
extend the types to vXi16. The MULHS/MULHU expansion computes the
whole 16-bit product, but only keeps the high part.

We can improve the lowering of SMULO/UMULO for some cases by using the MULHS/MULHU
expansion, but keep both the high and low parts. And we can use
those parts to calculate the overflow.

For AVX512 we might have vXi1 overflow outputs. We can improve those by using
vpcmpeqw to produce a k register if AVX512BW is enabled. This is a little better
than truncating the high result to use vpcmpeqb. If we don't have avx512bw we
can extend up to v16i32 to use vpcmpeqd to produce a k register.

Reviewed By: RKSimon

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