platform/upstream/llvm.git
3 years ago[RISCV] Enable cross basic block aware vsetvli insertion
Craig Topper [Tue, 25 May 2021 23:28:34 +0000 (16:28 -0700)]
[RISCV] Enable cross basic block aware vsetvli insertion

This patch extends D102737 to allow VL/VTYPE changes to be taken
into account before adding an explicit vsetvli.

We do this by using a data flow analysis to propagate VL/VTYPE
information from predecessors until we've determined a value for
every value in the function.

We use this information to determine if a vsetvli needs to be
inserted before the first vector instruction the block.

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

3 years ago[AMDGPU][NFC] Remove non-existing function header
Sebastian Neubauer [Wed, 26 May 2021 16:20:33 +0000 (18:20 +0200)]
[AMDGPU][NFC] Remove non-existing function header

3 years ago[libomptarget][nfc][amdgpu] Remove atmi_status_t type
Jon Chesterfield [Wed, 26 May 2021 16:02:19 +0000 (17:02 +0100)]
[libomptarget][nfc][amdgpu] Remove atmi_status_t type

ATMI_STATUS_UNKNOWN was unused, deleted references to it.
Replaced ATMI_STATUS_{SUCCESS,ERROR} with HSA_STATUS_{SUCCESS,ERROR}
Replaced atmi_status_t with hsa_status_t

Otherwise no change. In particular, conversions between atmi_status_t and
hsa_status_t will now be conversions between hsa_status_t and itself.

Reviewed By: pdhaliwal

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

3 years ago[gn build] Port de9df3f5b952
LLVM GN Syncbot [Wed, 26 May 2021 15:57:01 +0000 (15:57 +0000)]
[gn build] Port de9df3f5b952

3 years ago[libc++][format] Adds availability macros for std::format.
Mark de Wever [Tue, 18 May 2021 18:00:22 +0000 (20:00 +0200)]
[libc++][format] Adds availability macros for std::format.

This prevents std::format to be available until there's an ABI stable
version. (This only impacts the Apple platform.)

Depends on D102703

Reviewed By: ldionne, #libc

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

3 years ago[mlir] Add `distributionTypes` to LinalgTilingOptions.
Alexander Belyaev [Wed, 26 May 2021 12:36:35 +0000 (14:36 +0200)]
[mlir] Add `distributionTypes` to LinalgTilingOptions.

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

3 years ago[libc++][NFC] Move basic_format_parse_context to its own header.
Mark de Wever [Sun, 25 Apr 2021 16:23:42 +0000 (18:23 +0200)]
[libc++][NFC] Move basic_format_parse_context to its own header.

This is a preparation to split the format header in smaller parts for the
upcoming patches.

Depends on D101723

Reviewed By: #libc, ldionne

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

3 years ago[gn build] Port 16342e39947b
LLVM GN Syncbot [Wed, 26 May 2021 15:45:57 +0000 (15:45 +0000)]
[gn build] Port 16342e39947b

3 years ago[libc++][NFC] Move format_error to its own header.
Mark de Wever [Sun, 25 Apr 2021 15:58:03 +0000 (17:58 +0200)]
[libc++][NFC] Move format_error to its own header.

Reviewed By: #libc, ldionne

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

3 years ago[mlir][openacc] Translate UpdateOp to LLVM IR
Valentin Clement [Wed, 26 May 2021 15:38:49 +0000 (11:38 -0400)]
[mlir][openacc] Translate UpdateOp to LLVM IR

Add translation to LLVM IR for the UpdateOp with host and device operands.
Translation is done with call using the runtime. This is done in a similar way as
D101504 and D102381.

Reviewed By: ftynse

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

3 years ago[unroll] Use value domain for symbolic execution based cost model
Philip Reames [Wed, 26 May 2021 15:40:01 +0000 (08:40 -0700)]
[unroll] Use value domain for symbolic execution based cost model

The current full unroll cost model does a symbolic evaluation of the loop up to a fixed limit. That symbolic evaluation currently simplifies to constants, but we can generalize to arbitrary Values using the InstructionSimplify infrastructure at very low cost.

By itself, this enables some simplifications, but it's mainly useful when combined with the branch simplification over in D102928.

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

3 years ago[libc++] Fix concepts tests with GCC
Louis Dionne [Wed, 26 May 2021 15:21:33 +0000 (11:21 -0400)]
[libc++] Fix concepts tests with GCC

3 years ago[SystemZ] Support i128 inline asm operands.
Jonas Paulsson [Mon, 19 Apr 2021 19:31:01 +0000 (21:31 +0200)]
[SystemZ] Support i128 inline asm operands.

Support virtual, physical and tied i128 register operands in inline assembly.

i128 is on SystemZ not really supported and is not a legal type and generally
such a value will be split into two i64 parts. There are however some
instructions that require a pair of two GPR64 registers contained in the GR128
bit reg class, which is untyped.

For inline assmebly operands, it proved to be very cumbersome to first follow
the general behavior of splitting an i128 operand into two parts and then
later rebuild the INLINEASM MI to have one GR128 register. Instead, some
minor common code changes were made to SelectionDAGBUilder to only create one
GR128 register part to begin with. In particular:

- getNumRegisters() now has an optional parameter "RegisterVT" which is
  passed by AddInlineAsmOperands() and GetRegistersForValue().

- The bitcasting in GetRegistersForValue is not performed if RegVT is
  Untyped.

- The RC for a tied use in AddInlineAsmOperands() is now computed either from
  the tied def (virtual register), or by getMinimalPhysRegClass() (physical
  register).

- InstrEmitter.cpp:EmitCopyFromReg() has been fixed so that the register
  class (DstRC) can also be computed for an illegal type.

In the SystemZ backend getNumRegisters(), splitValueIntoRegisterParts() and
joinRegisterPartsIntoValue() have been implemented to handle i128 operands.

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

Review: Ulrich Weigand

3 years ago[clangd] New ParsingCallback for semantics changes
Kadir Cetinkaya [Wed, 19 May 2021 11:45:44 +0000 (13:45 +0200)]
[clangd] New ParsingCallback for semantics changes

Previously notification of the Server about semantic happened strictly
before notification of the AST thread.
Hence a racy Server could make a request (like semantic tokens) after
the notification, with the assumption that it'll be served fresh
content. But it wasn't true if AST thread wasn't notified about the
change yet.

This change reverses the order of those notifications to prevent racy
interactions.

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

3 years ago[MCA] Add a test for PR50483. NFC
Andrea Di Biagio [Wed, 26 May 2021 14:38:45 +0000 (15:38 +0100)]
[MCA] Add a test for PR50483. NFC

3 years ago[SystemZ][z/OS] Enable the AllowAtInName attribute for the HLASM dialect
Anirudh Prasad [Wed, 26 May 2021 14:49:39 +0000 (10:49 -0400)]
[SystemZ][z/OS] Enable the AllowAtInName attribute for the HLASM dialect

- Currently, LLVM supports symbols of the name "token1@token2".
- "token2" is used to identify whether an appropriate symbol reference can be used for the symbol.
- Now, if the symbol reference couldn't be found, the AsmParser usually emits an error, unless the backend is configured to accept the "@" in a symbol name
- Thus, this patch aims to do that. It sets the `AllowAtInName` attribute in the SystemZ backend for the HLASM dialect.
- Setting this attribute ensures that, if a particular symbol reference is found, it uses that. If it doesn't, and there exists an "@" in the symbol name, it will use that instead of explicitly erroring out.

Reviewed By: uweigand

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

3 years ago[AMDGPU] Fix function pointer argument bug in AMDGPU Propagate Attributes pass.
jweightma [Wed, 26 May 2021 14:33:33 +0000 (16:33 +0200)]
[AMDGPU] Fix function pointer argument bug in AMDGPU Propagate Attributes pass.

This patch fixes a bug in the AMDGPU Propagate Attributes pass where a call
instruction with a function pointer argument is identified as a user of the
passed function, and illegally replaces the called function of the
instruction with the function argument.

For example, given functions f and g with appropriate types, the following
illegal transformation could occur without this fix:
call void @f(void ()* @g)
-->
call void @g(void ()* @g.1)

The solution introduced in this patch is to prevent the cloning and
substitution if the instruction's called function and the function which
might be cloned do not match.

Reviewed By: arsenm, madhur13490

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

3 years ago[SystemZ][z/OS] Validate symbol names for z/OS for printing without quotes
Anirudh Prasad [Wed, 26 May 2021 14:36:50 +0000 (10:36 -0400)]
[SystemZ][z/OS] Validate symbol names for z/OS for printing without quotes

- Currently, before printing a label in MCSymbol.cpp (MCSymbol::print), the current code "validates" the label that is to be printed.
- If it fails the validation step, then it prints the label within double quotes.
- However, the validation is provided as a virtual function in MCAsmInfo.h (i.e. isAcceptableChar() function). So we can override this for the AD_HLASM dialect in SystemZMCAsmInfo.cpp.

Reviewed By: uweigand

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

3 years ago[clang-cl] Add driver support for /std:c++20 and bump /std:c++latest (PR50465)
Hans Wennborg [Wed, 26 May 2021 09:30:03 +0000 (11:30 +0200)]
[clang-cl] Add driver support for /std:c++20 and bump /std:c++latest (PR50465)

VS 2019 16.11 (just released in Preview) is adding support for the
/std:c++20 option and bumping /std:c++latest to "post-c++20". This
updates clang-cl to match.

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

3 years ago[X86][AMX] Fix a bug on tile config.
Luo, Yuanke [Wed, 26 May 2021 09:41:49 +0000 (17:41 +0800)]
[X86][AMX] Fix a bug on tile config.

The previous code detect if a MBB is bottom block to determine if it is
a backedge of a loop. We should check latch block instead of bottom
block and we should check the header and the bottom block are in the
same loop.

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

3 years ago[CostModel][AArch64] Add tests for bitreverse. NFC.
Sjoerd Meijer [Wed, 26 May 2021 13:33:40 +0000 (14:33 +0100)]
[CostModel][AArch64] Add tests for bitreverse. NFC.

3 years ago[ARM] Extra test for reverted WLS memset. NFC
David Green [Wed, 26 May 2021 13:54:36 +0000 (14:54 +0100)]
[ARM] Extra test for reverted WLS memset. NFC

3 years ago[X86][SSE] Regenerate some tests to expose the rip relative vector/broadcast loads
Simon Pilgrim [Wed, 26 May 2021 13:50:47 +0000 (14:50 +0100)]
[X86][SSE] Regenerate some tests to expose the rip relative vector/broadcast loads

3 years ago[MCA][InOrderIssueStage] Fix LastWriteBackCycle computation.
Andrea Di Biagio [Wed, 26 May 2021 12:58:49 +0000 (13:58 +0100)]
[MCA][InOrderIssueStage] Fix LastWriteBackCycle computation.

Conservatively use the instruction latency to compute the last write-back cycle.
Before this patch, the last write cycle computation was incorrect for store
instructions that didn't declare any register writes.

3 years ago[SLP][NFC]Add a test for multiple uses of insertelement instruction,
Alexey Bataev [Wed, 26 May 2021 13:14:59 +0000 (06:14 -0700)]
[SLP][NFC]Add a test for multiple uses of insertelement instruction,
NFC.

3 years ago[LoopVectorize] Enable strict reductions when allowReordering() returns false
Kerry McLaughlin [Wed, 26 May 2021 10:59:04 +0000 (11:59 +0100)]
[LoopVectorize] Enable strict reductions when allowReordering() returns false

When loop hints are passed via metadata, the allowReordering function
in LoopVectorizationLegality will allow the order of floating point
operations to be changed:

  bool allowReordering() const {
    // When enabling loop hints are provided we allow the vectorizer to change
    // the order of operations that is given by the scalar loop. This is not
    // enabled by default because can be unsafe or inefficient.

The -enable-strict-reductions flag introduced in D98435 will currently only
vectorize reductions in-loop if hints are used, since canVectorizeFPMath()
will return false if reordering is not allowed.

This patch changes canVectorizeFPMath() to query whether it is safe to
vectorize the loop with ordered reductions if no hints are used. For
testing purposes, an additional flag (-hints-allow-reordering) has been
added to disable the reordering behaviour described above.

Reviewed By: sdesmalen

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

3 years agoReturn "[LoopDeletion] Break backedge if we can prove that the loop is exited on...
Max Kazantsev [Wed, 26 May 2021 12:39:19 +0000 (19:39 +0700)]
Return "[LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration" (try 2)

The patch was reverted due to compile time impact of contextual SCEV
queries. It also appeared that it introduced a miscompile on irreducible CFG.

Changes made:
1. isKnownPredicateAt is replaced with more lightweight isKnownPredicate;
2. Irreducible CFG in live code is now detected and excluded from processing.

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

3 years ago[InstCombine] add fmul tests with shared operand; NFC
Sanjay Patel [Wed, 26 May 2021 12:19:44 +0000 (08:19 -0400)]
[InstCombine] add fmul tests with shared operand; NFC

Baseline tests for:
D102698

3 years ago[InstCombine] avoid 'tmp' usage in test files; NFC
Sanjay Patel [Wed, 26 May 2021 12:15:22 +0000 (08:15 -0400)]
[InstCombine] avoid 'tmp' usage in test files; NFC

The update script ( utils/update_test_checks.py ) warns against this.

3 years ago[InstCombine] avoid 'tmp' usage in test file; NFC
Sanjay Patel [Wed, 26 May 2021 12:11:17 +0000 (08:11 -0400)]
[InstCombine] avoid 'tmp' usage in test file; NFC

The update script ( utils/update_test_checks.py ) warns against this.

3 years agoRevert "Return "[LoopDeletion] Break backedge if we can prove that the loop is exited...
Max Kazantsev [Wed, 26 May 2021 12:29:07 +0000 (19:29 +0700)]
Revert "Return "[LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration""

This reverts commit 43d2e51c2e86788b9e2a582fdd3d8ffa7829328a.

Commited wrong version.

3 years agoReturn "[LoopDeletion] Break backedge if we can prove that the loop is exited on...
Max Kazantsev [Wed, 26 May 2021 09:52:57 +0000 (16:52 +0700)]
Return "[LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration"

The patch was reverted due to compile time impact of contextual SCEV
queries. It also appeared that it introduced a miscompile on irreducible CFG.

Changes made:
1. isKnownPredicateAt is replaced with more lightweight isKnownPredicate;
2. Irreducible CFG in live code is now detected and excluded from processing.

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

3 years ago[mlir] Fold complex.create(complex.re(op), complex.im(op))
Adrian Kuegel [Wed, 26 May 2021 10:28:14 +0000 (12:28 +0200)]
[mlir] Fold complex.create(complex.re(op), complex.im(op))

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

3 years ago[AArch64] Generate LD1 for anyext i8 or i16 vector load
Andrew Savonichev [Wed, 5 May 2021 19:18:02 +0000 (22:18 +0300)]
[AArch64] Generate LD1 for anyext i8 or i16 vector load

The existing LD1 patterns do not cover cases where result type does
not match the memory type. This happens when illegal vector types are
extended and scalarized, for example:

  load <2 x i16>* %v2i16

is lowered into:

  // first element
  (v4i32 (insert_subvector (v2i32 (scalar_to_vector (load anyext from i16)))))
  // other elements
  (v4i32 (insert_vector_elt (i32 (load anyext from i16)) idx))

Before this patch these patterns were compiled into LDR + INS.
Now they are compiled into LD1.

The problem was reported in
PR24820: LLVM Generates abysmal code in simple situation.

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

3 years ago[Test] Add Loop Deletion test with irreducible CFG
Max Kazantsev [Wed, 26 May 2021 11:35:30 +0000 (18:35 +0700)]
[Test] Add Loop Deletion test with irreducible CFG

Authored by Mikael Holmén. It demonstrated miscompile on irreducible
CFG with patch "[LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration".
The patch is reverted. Checking in the test to make sure this bug
does not return.

3 years ago[OpenCL] Include header for atomic-ops test
Sven van Haastregt [Wed, 26 May 2021 11:32:07 +0000 (12:32 +0100)]
[OpenCL] Include header for atomic-ops test

Avoid duplicating the memory_order and memory_scope enum definitions.

3 years ago[MC] Move elf-unique-sections-by-flags.ll to X86/
Tomas Matheson [Wed, 26 May 2021 11:27:25 +0000 (12:27 +0100)]
[MC] Move elf-unique-sections-by-flags.ll to X86/

3 years ago[Docs] Updated the content of getting started documentation under llvm/lib/MC
pooja2299 [Wed, 26 May 2021 10:39:36 +0000 (16:09 +0530)]
[Docs] Updated the content of getting started documentation under llvm/lib/MC

Wrote about llvm/lib/MC subproject on https://llvm.org/docs/GettingStarted.html page.

Reviewed By: arsenm

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

3 years ago[MC][ELF] Emit unique sections for different flags
Tomas Matheson [Wed, 12 May 2021 17:56:43 +0000 (18:56 +0100)]
[MC][ELF] Emit unique sections for different flags

Global values imply flags such as readable, writable, executable for the
sections that they will be placed in. Currently MC places all such
entries into the same section, using the first set of flags seen. This
can lead to situations in LTO where a writable global is placed in the
same named section as a readable global from another file, and the
section may not be marked writable.

D72194 ensures that mergeable globals with explicit sections are placed
in separate sections with compatible entry size, by emitting the
`unique` assembly syntax where appropriate. This change extends that
approach to include section flags, so that globals with different
section flags are emitted in separate unique sections.

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

3 years ago[MC][NFCI] Factor out ELF section unique ID calculation
Tomas Matheson [Thu, 22 Apr 2021 14:41:33 +0000 (15:41 +0100)]
[MC][NFCI] Factor out ELF section unique ID calculation

Precursor to D100944. The logic for determining the unique ID had become
quite difficult to reason about, so I have factored this out into a
separate function.

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

3 years ago[AMDGPU][Libomptarget] Inline atmi_init/atmi_finalize
Pushpinder Singh [Tue, 25 May 2021 07:57:10 +0000 (07:57 +0000)]
[AMDGPU][Libomptarget] Inline atmi_init/atmi_finalize

After D102847, these functions can be inlined.

Reviewed By: JonChesterfield

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

3 years ago[AMDGPU][Libomptarget] Delete g_atmi_initialized
Pushpinder Singh [Tue, 25 May 2021 07:29:09 +0000 (07:29 +0000)]
[AMDGPU][Libomptarget] Delete g_atmi_initialized

This patch drops g_atmi_initialized and inlines the Initialize &
Finalize methods from Runtime class.

Reviewed By: JonChesterfield

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

3 years ago[lldb][NFC] Use C++ versions of the deprecated C standard library headers
Raphael Isemann [Wed, 26 May 2021 10:19:37 +0000 (12:19 +0200)]
[lldb][NFC] Use C++ versions of the deprecated C standard library headers

The C headers are deprecated so as requested in D102845, this is replacing them
all with their (not deprecated) C++ equivalent.

Reviewed By: shafik

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

3 years ago[X86][SLM] Fix vector PSHUFB + variable shift resource/throughputs
Simon Pilgrim [Wed, 26 May 2021 10:07:22 +0000 (11:07 +0100)]
[X86][SLM] Fix vector PSHUFB + variable shift resource/throughputs

Match whats documented in the Intel AOM (+Agner) - PSHUFB xmm is really slow, and mmx/xmm vector shifts are half rate.

Noticed while working to get the cost tables to more closely match llvm-mca analysis, in this case for shifts and truncations.

3 years ago[SCEV] Add tests with signed predicates for applyLoopGuards.
Florian Hahn [Tue, 25 May 2021 16:34:53 +0000 (17:34 +0100)]
[SCEV] Add tests with signed predicates for applyLoopGuards.

3 years ago[AMDGPU][Libomptarget] Move Kernel/Symbol info tables to RTLDeviceInfoTy
Pushpinder Singh [Tue, 25 May 2021 07:08:53 +0000 (07:08 +0000)]
[AMDGPU][Libomptarget] Move Kernel/Symbol info tables to RTLDeviceInfoTy

Two globals KernelInfoTable & SymbolInfoTable are moved
into RTLDeviceInfoTy class.
This builds on the top of D102691.
[2/2]

Reviewed By: JonChesterfield

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

3 years ago[NFC] Add CHECK lines for unordered FP reductions
Kerry McLaughlin [Wed, 26 May 2021 09:27:32 +0000 (10:27 +0100)]
[NFC] Add CHECK lines for unordered FP reductions

An additional RUN line has been added to both strict-fadd.ll &
scalable-strict-fadd.ll to ensure the correct behaviour of these
tests where `-enable-strict-reductions` is false.

Reviewed By: david-arm

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

3 years ago[AMDGPU][GlobalISel] Stop foldInsertEltToCmpSelect from changing reg banks
Mirko Brkusanin [Wed, 26 May 2021 09:49:05 +0000 (11:49 +0200)]
[AMDGPU][GlobalISel] Stop foldInsertEltToCmpSelect from changing reg banks

This function can change regbank for registers which already have a selected
bank. Depending on the instruction where these registers were used it can
cause instruction selection to fail.

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

3 years agoRevert "[AMDGPU][GlobalISel] Stop foldInsertEltToCmpSelect from changing reg banks"
Mirko Brkusanin [Wed, 26 May 2021 09:47:21 +0000 (11:47 +0200)]
Revert "[AMDGPU][GlobalISel] Stop foldInsertEltToCmpSelect from changing reg banks"

This reverts commit 18c5444702893fd63b0a99ec7133dd714284f9d2.

3 years ago[RISCV] Pre-commit fixed-length mask vselect tests
Fraser Cormack [Wed, 26 May 2021 09:30:13 +0000 (10:30 +0100)]
[RISCV] Pre-commit fixed-length mask vselect tests

These are default-expanded but later unrolled due to RISC-V's vector
boolean content policy. A patch to improve this codegen will follow
shortly.

3 years ago[Test] Add simplified versions of tests for loop deletion that don't need context
Max Kazantsev [Wed, 26 May 2021 09:38:10 +0000 (16:38 +0700)]
[Test] Add simplified versions of tests for loop deletion that don't need context

3 years agoAArch64: support post-indexed stores to bfloat types.
Tim Northover [Wed, 26 May 2021 08:10:40 +0000 (09:10 +0100)]
AArch64: support post-indexed stores to bfloat types.

3 years ago[CostModel][X86] Remove old testshift* tests
Simon Pilgrim [Tue, 25 May 2021 17:42:01 +0000 (18:42 +0100)]
[CostModel][X86] Remove old testshift* tests

The vector shift cost tests are better covered (more cpu/sse levels) by the vshift-*-*cost files, and we're trying to avoid codegen tests in here as it makes it harder to maintain the test files.

3 years ago[X86][Atom] Fix vector variable shift resource/throughputs
Simon Pilgrim [Tue, 25 May 2021 17:00:53 +0000 (18:00 +0100)]
[X86][Atom] Fix vector variable shift resource/throughputs

Match whats documented in the Intel AOM - the non-immediate variants of the PSLL*/PSRA*/PSRL* shift instructions requires BOTH ports - this was being incorrectly modelled as EITHER port.

Now that we can use in-order models in llvm-mca, the atom model is a good "worst case scenario" analysis for x86.

3 years ago[Test] Add test on unrolling to make sure it won't fail
Max Kazantsev [Wed, 26 May 2021 09:25:08 +0000 (16:25 +0700)]
[Test] Add test on unrolling to make sure it won't fail

Initially it failed an assertion with "Do actual DCE in LoopUnroll (try 2)"
which was later reverted. Make sure that when this patch is returned, the
test works fine.

3 years ago[NFC][X86] clang-format X86TTIImpl::getInterleavedMemoryOpCostAVX2()
Roman Lebedev [Wed, 26 May 2021 09:17:44 +0000 (12:17 +0300)]
[NFC][X86] clang-format X86TTIImpl::getInterleavedMemoryOpCostAVX2()

I plan to make changes to it, and undoing formatting each time is not going to be fun.

3 years agoFix warning introduced by 9c766f4090d19e3e2f56e87164177f8c3eba4b96
David Sherwood [Wed, 26 May 2021 08:59:45 +0000 (09:59 +0100)]
Fix warning introduced by 9c766f4090d19e3e2f56e87164177f8c3eba4b96

3 years ago[HIP] Adjust check in hip-include-path.hip test case
Bjorn Pettersson [Wed, 26 May 2021 09:07:45 +0000 (11:07 +0200)]
[HIP] Adjust check in hip-include-path.hip test case

The changes in commit 722c39fef5ab6 caused the test case to fail
when building with -DLLVM_LIBDIR_SUFFIX=64. This patch makes the
checks a bit more relaxed to support libdir suffixes again.

Also adjusting the regular expressions to avoid mathes including
double quotes.

3 years ago[mlir] LocalAliasAnalysis: Assume allocation scope to function scope if cannot determ...
Butygin [Sat, 10 Apr 2021 16:38:11 +0000 (19:38 +0300)]
[mlir] LocalAliasAnalysis: Assume allocation scope to function scope if cannot determine better

It helps when checking aliasing between AllocOp result and function arguments.

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

3 years ago[mlir] Simplify folding code (NFC)
Adrian Kuegel [Wed, 26 May 2021 08:59:09 +0000 (10:59 +0200)]
[mlir] Simplify folding code (NFC)

3 years ago[InstCombine] Fold extractelement + vector GEP with one use
David Sherwood [Tue, 4 May 2021 12:58:02 +0000 (13:58 +0100)]
[InstCombine] Fold extractelement + vector GEP with one use

We sometimes see code like this:

Case 1:
  %gep = getelementptr i32, i32* %a, <2 x i64> %splat
  %ext = extractelement <2 x i32*> %gep, i32 0

or this:

Case 2:
  %gep = getelementptr i32, <4 x i32*> %a, i64 1
  %ext = extractelement <4 x i32*> %gep, i32 0

where there is only one use of the GEP. In such cases it makes
sense to fold the two together such that we create a scalar GEP:

Case 1:
  %ext = extractelement <2 x i64> %splat, i32 0
  %gep = getelementptr i32, i32* %a, i64 %ext

Case 2:
  %ext = extractelement <2 x i32*> %a, i32 0
  %gep = getelementptr i32, i32* %ext, i64 1

This may create further folding opportunities as a result, i.e.
the extract of a splat vector can be completely eliminated. Also,
even for the general case where the vector operand is not a splat
it seems beneficial to create a scalar GEP and extract the scalar
element from the operand. Therefore, in this patch I've assumed
that a scalar GEP is always preferrable to a vector GEP and have
added code to unconditionally fold the extract + GEP.

I haven't added folds for the case when we have both a vector of
pointers and a vector of indices, since this would require
generating an additional extractelement operation.

Tests have been added here:

  Transforms/InstCombine/gep-vector-indices.ll

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

3 years ago[mlir] Fold complex.re(complex.create) and complex.im(complex.create)
Adrian Kuegel [Wed, 26 May 2021 07:43:26 +0000 (09:43 +0200)]
[mlir] Fold complex.re(complex.create) and complex.im(complex.create)

This extends the folding we already have. A test needs to be adjusted.

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

3 years ago[NFC][object] Change the input parameter of the method isDebugSection.
Esme-Yi [Wed, 26 May 2021 08:47:53 +0000 (08:47 +0000)]
[NFC][object] Change the input parameter of the method isDebugSection.

Summary: This is a NFC patch to change the input parameter of the method SectionRef::isDebugSection(), by replacing the StringRef SectionName with DataRefImpl Sec. This allows us to determine if a section is debug type in more ways than just by section name.

Reviewed By: jhenderson

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

3 years ago[ARM] Add patterns for vmulh
David Green [Wed, 26 May 2021 08:22:12 +0000 (09:22 +0100)]
[ARM] Add patterns for vmulh

Now that vmulh can be selected, this adds the MVE patterns to make it
legal and generate instructions.

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

3 years ago[clang-format][NFC] correctly sort StatementAttributeLike-macros' IO.map
Björn Schäpers [Tue, 25 May 2021 15:55:12 +0000 (17:55 +0200)]
[clang-format][NFC] correctly sort StatementAttributeLike-macros' IO.map

3 years ago[gn build] Port 36d0fdf9ac3b
LLVM GN Syncbot [Wed, 26 May 2021 04:31:12 +0000 (04:31 +0000)]
[gn build] Port 36d0fdf9ac3b

3 years ago[libcxx][iterator] adds `std::ranges::advance`
Christopher Di Bella [Wed, 5 May 2021 07:14:08 +0000 (07:14 +0000)]
[libcxx][iterator] adds `std::ranges::advance`

Implements part of P0896 'The One Ranges Proposal'.
Implements [range.iter.op.advance].

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

3 years ago[OpaquePtr] Make atomicrmw work with opaque pointers
Arthur Eubanks [Tue, 25 May 2021 19:36:25 +0000 (12:36 -0700)]
[OpaquePtr] Make atomicrmw work with opaque pointers

FullTy is only necessary when we need to figure out what type an
instruction works with given a pointer's pointee type. However, we just
end up using the value operand's type, so FullTy isn't necessary.

Reviewed By: dblaikie

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

3 years agoRevert "[lldb] Avoid format string in LLDB_SCOPED_TIMER"
Jonas Devlieghere [Wed, 26 May 2021 00:21:01 +0000 (17:21 -0700)]
Revert "[lldb] Avoid format string in LLDB_SCOPED_TIMER"

Right after pushing, I remembered that this was added to silence a GCC
warning (https://reviews.llvm.org/D99120). This reverts my patch and
adds a comment.

3 years ago[lldb] Avoid format string in LLDB_SCOPED_TIMER
Jonas Devlieghere [Wed, 26 May 2021 00:12:28 +0000 (17:12 -0700)]
[lldb] Avoid format string in LLDB_SCOPED_TIMER

Pass LLVM_PRETTY_FUNCTION directly for the no-argument macro.

3 years ago[LTT] Handle merged llvm.assume when dropping type tests
Teresa Johnson [Tue, 25 May 2021 05:02:44 +0000 (22:02 -0700)]
[LTT] Handle merged llvm.assume when dropping type tests

When the lower type test pass is invoked a second time with
DropTypeTests set to true, it expects that all remaining type tests feed
assume instructions, which are removed along with the type tests.

In some cases the llvm.assume might have been merged with another one,
i.e. from a builtin_assume instruction, in which case the type test
would actually feed a phi that in turn feeds the merged assume
instruction. In this case we can simply replace that operand of the phi
with "true" before removing the type test.

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

3 years ago[OpaquePtr] Create new bitcode encoding for atomicrmw
Arthur Eubanks [Tue, 25 May 2021 22:31:38 +0000 (15:31 -0700)]
[OpaquePtr] Create new bitcode encoding for atomicrmw

Since the opaque pointer type won't contain the pointee type, we need to
separately encode the value type for an atomicrmw.

Emit this new code for atomicrmw.

Handle this new code and the old one in the bitcode reader.

Reviewed By: dblaikie

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

3 years ago[sanitizer] Let glibc aarch64 use O(1) GetTls
Fangrui Song [Tue, 25 May 2021 23:28:17 +0000 (16:28 -0700)]
[sanitizer] Let glibc aarch64 use O(1) GetTls

The generic approach can still be used by musl and FreeBSD. Note: on glibc
2.31, TLS_PRE_TCB_SIZE is 0x700, larger than ThreadDescriptorSize() by 16, but
this is benign: as long as the range includes pthread::{specific_1stblock,specific}
pthread_setspecific will not cause false positives.

Note: the state before afec953857ffd682cb4119e7950f3593efbaaa81 underestimated
the TLS size a lot (nearly ThreadDescriptorSize() = 1776).
That may explain why afec953857ffd682cb4119e7950f3593efbaaa81 actually made some
tests pass.

3 years agoLLVM Detailed IR tests for introduction of flag -fsanitize-address-detect-stack-use...
Kevin Athey [Thu, 13 May 2021 18:41:43 +0000 (11:41 -0700)]
LLVM Detailed IR tests for introduction of flag -fsanitize-address-detect-stack-use-after-return-mode.

Rework all tests that interact with use after return to correctly handle the case where the mode has been explicitly set to Never or Always.

for issue: https://github.com/google/sanitizers/issues/1394

Reviewed By: vitalybuka

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

3 years ago[benchmark] Silence 'suggest override' and 'missing override' warnings
Alexandre Ganea [Tue, 25 May 2021 22:03:55 +0000 (18:03 -0400)]
[benchmark] Silence 'suggest override' and 'missing override' warnings

When building with Clang 11 on Windows, silence the following:

F:\aganea\llvm-project\llvm\utils\benchmark\include\benchmark/benchmark.h(955,8): warning: 'Run' overrides a member function but is not marked 'override' [-Wsuggest-override]
  void Run(State& st);
       ^
F:\aganea\llvm-project\llvm\utils\benchmark\include\benchmark/benchmark.h(895,16): note: overridden virtual function is here
  virtual void Run(State& state) = 0;
               ^
1 warning generated.

3 years ago[gcov] Silence warning: comparison of integers of different signs
Alexandre Ganea [Tue, 25 May 2021 21:22:08 +0000 (17:22 -0400)]
[gcov] Silence warning: comparison of integers of different signs

When building with Clang 11 on Windows, silence the following:

[432/5643] Building C object projects\compiler-rt\lib\profile\CMakeFiles\clang_rt.profile-x86_64.dir\GCDAProfiling.c.obj
F:\aganea\llvm-project\compiler-rt\lib\profile\GCDAProfiling.c(464,13): warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]
    if (val != (gcov_version >= 90 ? GCOV_TAG_OBJECT_SUMMARY
        ~~~ ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

3 years ago[NFC][MLIR][TOSA] Replaced tosa linalg.indexed_generic lowerings with linalg.index
Rob Suderman [Tue, 25 May 2021 22:27:11 +0000 (15:27 -0700)]
[NFC][MLIR][TOSA] Replaced tosa linalg.indexed_generic lowerings with linalg.index

Indexed Generic should be going away in the future. Migrate to linalg.index.

Reviewed By: NatashaKnk, nicolasvasilache

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

3 years ago[NFC][SCUDO] Fix unittest for -gtest_repeat=10
Vitaly Buka [Tue, 25 May 2021 22:25:05 +0000 (15:25 -0700)]
[NFC][SCUDO] Fix unittest for -gtest_repeat=10

Reviewed By: cryptoad

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

3 years ago[MLIR Core] Cache the empty StringAttr like we do for empty dictionaries. NFC.
Chris Lattner [Tue, 25 May 2021 21:38:01 +0000 (14:38 -0700)]
[MLIR Core] Cache the empty StringAttr like we do for empty dictionaries. NFC.

MLIRContext holds a few special case values that occur frequently like empty
dictionary and NoneType, which allow us to avoid taking locks to get an instance
of them.  Give the empty StringAttr this treatment as well.  This cuts several
percent off compile time for CIRCT.

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

3 years ago[Toy] Update tests to pass with top-down canonicalize pass. NFC
Chris Lattner [Tue, 25 May 2021 21:50:35 +0000 (14:50 -0700)]
[Toy] Update tests to pass with top-down canonicalize pass. NFC

3 years ago[libomptarget][nfc] Move hostcall required test to rtl
Jon Chesterfield [Tue, 25 May 2021 21:43:16 +0000 (22:43 +0100)]
[libomptarget][nfc] Move hostcall required test to rtl

[libomptarget][nfc] Move hostcall required test to rtl

Remove a global, fix minor race. First of N patches to bring up hostcall.

Reviewed By: JonChesterfield

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

3 years ago[libc++] Install GCC 11 on CI builders
Louis Dionne [Tue, 25 May 2021 21:34:57 +0000 (17:34 -0400)]
[libc++] Install GCC 11 on CI builders

3 years ago[ARM] Extra predicated tests for VMULH. NFC
David Green [Tue, 25 May 2021 21:24:06 +0000 (22:24 +0100)]
[ARM] Extra predicated tests for VMULH. NFC

3 years ago[Internalize] Rename instead of removal if a to-be-internalized comdat has more than...
Fangrui Song [Tue, 25 May 2021 21:15:27 +0000 (14:15 -0700)]
[Internalize] Rename instead of removal if a to-be-internalized comdat has more than one member

Beside the `comdat any` deduplication feature, instrumentations use comdat to
establish dependencies among a group of sections, to prevent section based
linker garbage collection from discarding some members without discarding all.
LangRef acknowledges this usage with the following wording:

> All global objects that specify this key will only end up in the final object file if the linker chooses that key over some other key.

On ELF, for PGO instrumentation, a `__llvm_prf_cnts` section and its associated
`__llvm_prf_data` section are placed in the same GRP_COMDAT group.  A
`__llvm_prf_data` is usually not referenced and expects the liveness of its
associated `__llvm_prf_cnts` to retain it.

The `setComdat(nullptr)` code (added by D10679) in InternalizePass can break the
use case (a `__llvm_prf_data` may be dropped with its associated `__llvm_prf_cnts` retained).
The main goal of this patch is to fix the dependency relationship.

I think it makes sense for InternalizePass to internalize a comdat and thus
suppress the deduplication feature, e.g. a relocatable link of a regular LTO can
create an object file affected by InternalizePass.
If a non-internal comdat in a.o is prevailed by an internal comdat in b.o, the
a.o references to the comdat definitions will be non-resolvable (references
cannot bind to STB_LOCAL definitions in b.o).

On PE-COFF, for a non-external selection symbol, deduplication is naturally
suppressed with link.exe and lld-link. However, this is fuzzy on ELF and I tend
to believe the spec creator has not thought about this use case (see D102973).

GNU ld and gold are still using the "signature is name based" interpretation.
So even if D102973 for ld.lld is accepted, for portability, a better approach is
to rename the comdat. A comdat with one single member is the common case,
leaving the comdat can waste (sizeof(Elf64_Shdr)+4*2) bytes, so we optimize by
deleting the comdat; otherwise we rename the comdat.

Reviewed By: tejohnson

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

3 years agoRevert "[LoopDeletion] Break backedge if we can prove that the loop is exited on...
Matt Morehouse [Tue, 25 May 2021 20:58:13 +0000 (13:58 -0700)]
Revert "[LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration"

This reverts commit 2531fd70d19aa5d61feb533bbdeee7717a4129eb due to
performance regression on the PPC buildbot.

3 years ago[libc++] [P0619] Hide not1 and not2 under _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS.
Arthur O'Dwyer [Mon, 24 May 2021 22:36:17 +0000 (18:36 -0400)]
[libc++] [P0619] Hide not1 and not2 under _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS.

This also provides some of the scaffolding needed by D102992 and D101729, and mops up after D101730 etc.

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

3 years ago[libcxx] Fix the function name in exceptions from create_directories
Martin Storsjö [Mon, 9 Nov 2020 09:48:21 +0000 (11:48 +0200)]
[libcxx] Fix the function name in exceptions from create_directories

If the nested create_directory call fails, we'd still want to
re-report the errors with the create_directories function name,
which is what the caller called.

This fixes one aspect from MS STL's tests for std::filesystem.

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

3 years ago[Canonicalize] Switch the default setting to "top down".
Chris Lattner [Mon, 24 May 2021 22:45:58 +0000 (15:45 -0700)]
[Canonicalize] Switch the default setting to "top down".

This provides a sizable compile time improvement by seeding
the worklist in an order that leads to less iterations of the
worklist.

This patch only changes the behavior of the Canonicalize pass
itself, it does not affect other passes that use the
GreedyPatternRewrite driver

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

3 years ago[flang] Implement checks for defined input/output procedures
Peter Steinfeld [Mon, 24 May 2021 20:12:19 +0000 (13:12 -0700)]
[flang] Implement checks for defined input/output procedures

Defined input/output procedures are specified in 12.6.4.8.  There are different
versions for read versus write and formatted versus unformatted, but they all
share the same basic set of dummy arguments.

I added several checking functions to check-declarations.cpp along with a test.

In the process of implementing this, I noticed and fixed a typo in
.../lib/Evaluate/characteristics.cpp.

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

3 years ago[Canonicalize] Fully parameterize the pass based on config options. NFC.
Chris Lattner [Tue, 25 May 2021 04:23:16 +0000 (21:23 -0700)]
[Canonicalize] Fully parameterize the pass based on config options. NFC.

This allows C++ clients of the Canonicalize pass to specify their own
Config option struct to control how Canonicalize works, increasing reusability.

This also allows controlling these settings for the default Canonicalize pass
using command line options.  This is useful for testing and for playing with
things on the command line.

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

3 years ago[libcxxabi] Use ASan interface header for declaration. NFC
Shoaib Meenai [Mon, 24 May 2021 04:03:12 +0000 (21:03 -0700)]
[libcxxabi] Use ASan interface header for declaration. NFC

This was changed from using the header to using a forward declaration in
c4600ccf891c, since older versions of the header didn't declare the
function. At this point, it's been declared for ~3.5 years, and it
should be pretty safe to assume that we can rely on the ASan interface
header to provide a declaration instead of needing to write our own.

Reviewed By: #libc_abi, ldionne

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

3 years ago[libcxx] [test] Explain an XFAIL LIBCXX-WINDOWS-FIXME and convert into UNSUPPORTED
Martin Storsjö [Wed, 12 May 2021 19:43:13 +0000 (22:43 +0300)]
[libcxx] [test] Explain an XFAIL LIBCXX-WINDOWS-FIXME and convert into UNSUPPORTED

This particular test relies on internal details from the libc++
filesystem implementation header, and those details are structured
differently in the implementation for Windows.

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

3 years ago[libcxx] Make the visibility attributes consistent for __narrow_to_utf8/__widen_from_utf8
Martin Storsjö [Tue, 18 May 2021 14:45:08 +0000 (14:45 +0000)]
[libcxx] Make the visibility attributes consistent for __narrow_to_utf8/__widen_from_utf8

Use the same visiblity attributes as for all other template
specializations in the same file; declare the specialization itself
using _LIBCPP_TYPE_VIS, and don't use _LIBCPP_EXPORTED_FROM_ABI on
the destructor. Methods that are excluded from the ABI are marked
with _LIBCPP_INLINE_VISIBILITY.

This makes the vtable exported from DLL builds of libc++. Practically,
it doesn't make any difference for the CI configuration, but it
can make a difference in mingw setups.

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

3 years ago[docs] [CMake] Change recommendations for how to use LLVM_DEFINITIONS
Martin Storsjö [Mon, 24 May 2021 20:16:10 +0000 (23:16 +0300)]
[docs] [CMake] Change recommendations for how to use LLVM_DEFINITIONS

LLVM_DEFINITIONS is a string variable containing a list of arguments
to pass to the compiler. When CMake's add_definitions is passed a
string variable, this is interpreted as one argument. To make it
behave properly, the string variable needs to be split into a list.

Despite the fact that add_definitions isn't supposed to be used like
the LLVM docs recommended, it worked fine in practice in many cases.
If the first argument in LLVM_DEFINITIONS is of the form -DFOO=42
instead of plain -DFOO, the rest of the string is treated as value
to this define. I.e. if LLVM_DEFINITIONS consists of `-DFOO=42 -DBAR`,
CMake ended up passing `-DFOO="42 -DBAR"` to the compiler.

See https://gitlab.kitware.com/cmake/cmakissues/22162
for discussion on the matter.

Changing LLVM_DEFINITIONS to be a list variable would possibly be
more disruptive; instead keep the variable defined as before but
change the recommendation for how to use it. Then projects using it
can gradually be updated to follow the new recommendation.

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

3 years ago[Hexagon] Remove unused function from HexagonISelDAGToDAGHVX.cpp
Krzysztof Parzyszek [Tue, 25 May 2021 19:27:02 +0000 (14:27 -0500)]
[Hexagon] Remove unused function from HexagonISelDAGToDAGHVX.cpp

It will be reintroduced shortly with an actual use.  This change is
simply to eliminate a compilation warning.

3 years ago[sanitizer][test] s/A<10>/A<7>/ to fix "WARNING: Symbolizer buffer too small" which...
Fangrui Song [Tue, 25 May 2021 19:41:07 +0000 (12:41 -0700)]
[sanitizer][test] s/A<10>/A<7>/ to fix "WARNING: Symbolizer buffer too small" which is somehow a hard error on s390x

https://reviews.llvm.org/D102046#2766553

3 years ago[docs] Explain address spaces a bit more in opaque pointers doc
Arthur Eubanks [Fri, 14 May 2021 19:13:53 +0000 (12:13 -0700)]
[docs] Explain address spaces a bit more in opaque pointers doc

Reviewed By: theraven

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

3 years ago[TSAN][CMake] Add support to run lit on individual tests
Bruno Cardoso Lopes [Mon, 24 May 2021 22:43:56 +0000 (15:43 -0700)]
[TSAN][CMake] Add support to run lit on individual tests

Handy when testing specific files, already supported in other components.

Example:
cd build; ./bin/llvm-lit ../compiler-rt/test/tsan/ignore_free.cpp

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

3 years ago[AMDGPU] Fix unused variable warning. NFC.
Stanislav Mekhanoshin [Tue, 25 May 2021 19:25:19 +0000 (12:25 -0700)]
[AMDGPU] Fix unused variable warning. NFC.

3 years ago[NFC] Fix 'unused' warning
Vitaly Buka [Tue, 25 May 2021 19:17:33 +0000 (12:17 -0700)]
[NFC] Fix 'unused' warning