platform/upstream/llvm.git
3 years ago[test] Fix unuses FileCheck prefixes in lld
Fangrui Song [Tue, 2 Feb 2021 04:52:33 +0000 (20:52 -0800)]
[test] Fix unuses FileCheck prefixes in lld

3 years ago[test] Fix unuses FileCheck prefixes in clang/test/Modules
Fangrui Song [Tue, 2 Feb 2021 03:46:23 +0000 (19:46 -0800)]
[test] Fix unuses FileCheck prefixes in clang/test/Modules

3 years ago[LoopVectorize] Relax a FCmpInst assert to dyn_cast after D95690
Fangrui Song [Tue, 2 Feb 2021 03:28:45 +0000 (19:28 -0800)]
[LoopVectorize] Relax a FCmpInst assert to dyn_cast after D95690

The instruction may be `icmp eq i32`. Noticed in an internal Halide+wasm JIT test.

3 years agoAMDGPU: Fix dbg_value handling when forming soft clause bundles
Matt Arsenault [Sat, 30 Jan 2021 22:10:51 +0000 (17:10 -0500)]
AMDGPU: Fix dbg_value handling when forming soft clause bundles

DBG_VALUES placed between memory instructions would change
codegen. Skip over these and re-insert them after the bundle instead
of giving up on bundling.

3 years ago[mlir] Add custom directive hooks for printing mixed integer or value operands.
MaheshRavishankar [Tue, 2 Feb 2021 03:03:12 +0000 (19:03 -0800)]
[mlir] Add custom directive hooks for printing mixed integer or value operands.

Add printer and parser hooks for a custom directive that allows
parsing and printing of idioms that can represent a list of values
each of which is either an integer or an SSA value. For example in

`subview %source[%offset_0, 1] [4, %size_1] [%stride_0, 3]`

each of the list (which represents offset, size and strides) is a mix
of either statically know integer values or dynamically computed SSA
values. Since this is used in many places adding a custom directive to
parse/print this idiom allows using assembly format on operations
which use this idiom.

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

3 years ago[Utils] Add a switch controlling prefix warnings in UpdateTestChecks
Mircea Trofin [Mon, 1 Feb 2021 23:21:55 +0000 (15:21 -0800)]
[Utils] Add a switch controlling prefix warnings in UpdateTestChecks

The switch controls both unused prefix warnings, and warnings about
functions which differ under different runs for a prefix, and, thus, end
up not having asserts for that prefix.

(If the latter case spans to all functions, then the former case kicks
in)

The switch is on by default, and can be disabled.

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

3 years ago[OpenMP][Libomptarget] Remove possible harmful copy constructor call for RTLsTy
Atmn Patel [Mon, 1 Feb 2021 00:18:41 +0000 (19:18 -0500)]
[OpenMP][Libomptarget] Remove possible harmful copy constructor call for RTLsTy

From https://bugs.llvm.org/show_bug.cgi?id=48973, we know that
`std::call_once(PM->RTLs.initFlag, &RTLsTy::LoadRTLs, PM->RTLs)` causes compile
time problems in libstdc++v3 5.3.1. This is because there was a defect in the
standard regarding the `call_once` (LWG 2442). This was fixed in libstdc++ soon
thereafter, but there are likely other standard libraries where this will fail.

By matching this function call with the other one, we fix this bug.

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

3 years ago[x86] introduce no_callee_saved_registers attribute
Philip Reames [Tue, 2 Feb 2021 00:07:01 +0000 (16:07 -0800)]
[x86] introduce no_callee_saved_registers attribute

This is directly analogous to the existing no_caller_saved_registers, but with the opposite intention.  A function or call so marked shifts the responsibility of spilling the usual CSRs to it's caller.

An indirect call site and callee which don't agree on the attribute is ill defined.

The motivation for this change is that being able to prune callee saves (without modifying other details of the calling convention) is sometimes useful when generating stubs and adapters.  There's no intention to expose this as a source language feature; this is expected to be used by frontends to implement adapters where warranted.

Some specific examples of use cases:
* GC compatible compiled code wants to call an externally defined library function without needing to track pointer values through CSRs.
* debug enabled code wants to call precompiled library which doesn't provide enough information to track CSRs while preserving debug quality in caller.
* adapter stub entering hand written assembler which doesn't follow normal calling conventions.

3 years ago[lldb] Use the host architecture in TestAppleSimulatorOSType.py
Jonas Devlieghere [Tue, 2 Feb 2021 00:12:48 +0000 (16:12 -0800)]
[lldb] Use the host architecture in TestAppleSimulatorOSType.py

3 years ago[obj2yaml, yaml2obj] Use Hex64 for BBAddressMap fields.
Rahman Lavaee [Sun, 31 Jan 2021 23:29:37 +0000 (15:29 -0800)]
[obj2yaml, yaml2obj] Use Hex64 for BBAddressMap fields.

This patch let the yaml encoding use Hex64 values for NumBlocks, BB AddressOffset, BB Size, and BB Metadata.
Additionally, it changes the decoded values in elf2yaml to uint64_t to match DataExtractor::getULEB128 return type.

Reviewed By: jhenderson

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

3 years ago[flang][NFC] Rename complex type.
Eric Schweitz [Sat, 30 Jan 2021 23:51:37 +0000 (15:51 -0800)]
[flang][NFC] Rename complex type.

This change renames the CplxType class to ComplexType.

3 years ago[NFC][X86] Use CallBase interface to simplify code
Philip Reames [Mon, 1 Feb 2021 22:02:30 +0000 (14:02 -0800)]
[NFC][X86] Use CallBase interface to simplify code

3 years ago[NFC][X86] Avoid redundant work inspecting callee
Philip Reames [Mon, 1 Feb 2021 21:51:10 +0000 (13:51 -0800)]
[NFC][X86] Avoid redundant work inspecting callee

3 years ago[InstrProfiling] Use !associated metadata for counters, data and values
Petr Hosek [Sat, 13 Jul 2019 21:02:07 +0000 (14:02 -0700)]
[InstrProfiling] Use !associated metadata for counters, data and values

C identifier name input sections such as __llvm_prf_* are GC roots so
they cannot be discarded. In LLD, the SHF_LINK_ORDER flag overrides the
C identifier name semantics.

The !associated metadata may be attached to a global object declaration
with a single argument that references another global object, and it
gets lowered to SHF_LINK_ORDER flag. When a function symbol is discarded
by the linker, setting up !associated metadata allows linker to discard
counters, data and values associated with that function symbol.

Note that !associated metadata is only supported by ELF, it does not have
any effect on non-ELF targets.

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

3 years ago[llvm-objcopy] -O binary: consider SHT_NOBITS sections to be empty
Patrick Oppenlander [Mon, 1 Feb 2021 23:01:25 +0000 (15:01 -0800)]
[llvm-objcopy] -O binary: consider SHT_NOBITS sections to be empty

This is consistent with BFD objcopy.

Previously llvm objcopy would allocate space for SHT_NOBITS sections
often resulting in enormous binary files.

New test case (binary-paddr.test %t6).

Reviewed By: jhenderson, MaskRay

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

3 years ago[AMDGPU] Set s-memtime-inst feature from clang
Stanislav Mekhanoshin [Sat, 30 Jan 2021 09:09:40 +0000 (01:09 -0800)]
[AMDGPU] Set s-memtime-inst feature from clang

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

3 years ago[CSSPGO] Tweaking inlining with pseudo probes.
Hongtao Yu [Mon, 1 Feb 2021 06:31:51 +0000 (22:31 -0800)]
[CSSPGO] Tweaking inlining with pseudo probes.

Fixing up a couple places where `getCallSiteIdentifier` is needed to support pseudo-probe-based callsites.

Also fixing an issue in the extbinary profile reader where the metadata section is not fully scanned based on the number of profiles loaded only for the current module.

Reviewed By: wmi, wenlei

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

3 years ago[clang-format] Add option to control the spaces in a line comment
Björn Schäpers [Fri, 29 Jan 2021 21:01:42 +0000 (22:01 +0100)]
[clang-format] Add option to control the spaces in a line comment

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

3 years ago[mlir][spirv] Add support for OpImageType
Weiwei Li [Mon, 1 Feb 2021 19:30:50 +0000 (14:30 -0500)]
[mlir][spirv] Add support for OpImageType

Support OpImageType in SPIRV Dialect.

This change doesn't support operand AccessQualifier since
it is optinal and only enables under Kernel capability.

co-authored-by: Alan Liu <alanliu.yf@gmail.com>

Reviewed By: antiagainst

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

3 years ago[tests] highlight cornercase w/deref hoisting from D95815
Philip Reames [Mon, 1 Feb 2021 21:25:42 +0000 (13:25 -0800)]
[tests] highlight cornercase w/deref hoisting from D95815

The main point of committing this early is to have a negative test in tree.  Nothing fails in the current tests if we implement this (currently unsound) optimization.

3 years agoNFC: Re-generate out-of-date matchers docs
Stephen Kelly [Mon, 1 Feb 2021 21:23:14 +0000 (21:23 +0000)]
NFC: Re-generate out-of-date matchers docs

3 years ago[LoopVectorize] improve IR fast-math-flags propagation in reductions
Sanjay Patel [Mon, 1 Feb 2021 19:21:24 +0000 (14:21 -0500)]
[LoopVectorize] improve IR fast-math-flags propagation in reductions

This is another step (see D95452) towards correcting fast-math-flags
bugs in vector reductions.

There are multiple bugs visible in the test diffs, and this is still
not working as it should. We still use function attributes (rather
than FMF) to drive part of the logic, but we are not checking for
the correct FP function attributes.

Note that FMF may not be propagated optimally on selects (example
in https://llvm.org/PR35607 ). That's why I'm proposing to union the
FMF of a fcmp+select pair and avoid regressions on existing vectorizer
tests.

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

3 years agoRevert "[libc++][format] Add basic_format_parse_context."
Mehdi Amini [Mon, 1 Feb 2021 21:18:11 +0000 (21:18 +0000)]
Revert "[libc++][format] Add basic_format_parse_context."

This reverts commit 35a57f39b5d126646335183f1ff0f7adb52d63bc.

A build is broken during clang bootstrap with:

In file included from ../libcxx/src/format.cpp:9:
/tmp/ci-nGNyLRM9V3/include/c++/v1/format:153:16: error: no member named 'is_constant_evaluated' in namespace 'std::__1'
    if (_VSTD::is_constant_evaluated() && __id >= __num_args_)
        ~~~~~~~^
1 error generated.

3 years agoAvoid string comparisons on the fast path of MLIR Identifier lookup (NFC)
Mehdi Amini [Mon, 1 Feb 2021 02:57:21 +0000 (02:57 +0000)]
Avoid string comparisons on the fast path of MLIR Identifier lookup (NFC)

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

3 years ago[ConstraintElimination] Add support for EQ predicates.
Florian Hahn [Thu, 28 Jan 2021 10:37:50 +0000 (10:37 +0000)]
[ConstraintElimination] Add support for EQ predicates.

A == B map to A >= B && A <= B
(https://alive2.llvm.org/ce/z/_dwxKn).

This extends the constraint construction to return a list of
constraints, which can be used to properly de-compose nested AND & OR.

3 years agoRevert "[mlir][spirv] Add support for OpImageType"
Lei Zhang [Mon, 1 Feb 2021 20:02:34 +0000 (15:02 -0500)]
Revert "[mlir][spirv] Add support for OpImageType"

This reverts commit 21f1462106b9ee1e646bf409c85528828320b34e.

3 years ago[mlir][spirv] Add support for OpImageType
Lei Zhang [Mon, 1 Feb 2021 19:30:50 +0000 (14:30 -0500)]
[mlir][spirv] Add support for OpImageType

Support OpImageType in SPIRV Dialect.

This change doesn't support operand AccessQualifier since
it is optinal and only enables under Kernel capability.

co-authored-by: Alan Liu <alanliu.yf@gmail.com>

Reviewed By: antiagainst

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

3 years ago[OpenMP] libomp: implement nteams-var and teams-thread-limit-var ICVs
AndreyChurbanov [Mon, 1 Feb 2021 19:54:11 +0000 (22:54 +0300)]
[OpenMP] libomp: implement nteams-var and teams-thread-limit-var ICVs

The change includes OMP_NUM_TEAMS, OMP_TEAMS_THREAD_LIMIT env variables,
omp_set_num_teams, omp_get_max_teams, omp_set_teams_thread_limit,
omp_get_teams_thread_limit routines.

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

3 years ago[Loads] Plumb through TLI argument [NFC]
Philip Reames [Mon, 1 Feb 2021 19:44:12 +0000 (11:44 -0800)]
[Loads] Plumb through TLI argument [NFC]

This is a (rather delayed) follow up to commit 0129cd5.  This commit is entirely NFC, the semantic change to leverage the new information will be submitted separate with a test case.

3 years ago[mlir][Linalg] Replace SimplePad with PadTensor in hoist-padding
Hanhan Wang [Mon, 1 Feb 2021 19:38:35 +0000 (11:38 -0800)]
[mlir][Linalg] Replace SimplePad with PadTensor in hoist-padding

This is the last revision to migrate using SimplePadOp to PadTensorOp, and the
SimplePadOp is removed in the patch. Update a bit in SliceAnalysis because the
PadTensorOp takes a region different from SimplePadOp. This is not covered by
LinalgOp because it is not a structured op.

Also, remove a duplicated comment from cpp file, which is already described in a
header file. And update the pseudo-mlir in the comment.

This is as same as D95615 but fixing one dep in CMakeLists.txt

Different from D95671, the fix was applied to run target.

Reviewed By: mravishankar

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

3 years ago[WebAssembly] fixed wasm64 data segment init exp not 64-bit
Wouter van Oortmerssen [Fri, 29 Jan 2021 00:38:24 +0000 (16:38 -0800)]
[WebAssembly] fixed wasm64 data segment init exp not 64-bit

As defined in the spec:
https://github.com/WebAssembly/memory64/blob/master/proposals/memory64/Overview.md

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

3 years ago[ConstantHoisting] Fix bug where constant materialization could insert into EH pad
Michael Holman [Mon, 1 Feb 2021 18:51:29 +0000 (10:51 -0800)]
[ConstantHoisting] Fix bug where constant materialization could insert into EH pad

If the incoming block to a phi node is an EH pad, then we will
materialize into an EH pad, which is not supposed to happen. To fix
this, I added a check to see if incoming block of a phi node is an EH
pad before using it as the insertion point.

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

3 years ago[libc++][format] Add basic_format_parse_context.
Mark de Wever [Sat, 5 Dec 2020 15:45:33 +0000 (16:45 +0100)]
[libc++][format] Add basic_format_parse_context.

Implements parts of:
- P0645 Text Formatting

Depends on D92214

Reviewed By: ldionne, curdeius, #libc

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

3 years ago[libc][NFC] Add a death test API adaptation macro
Michael Jones [Fri, 29 Jan 2021 00:11:35 +0000 (00:11 +0000)]
[libc][NFC] Add a death test API adaptation macro

Fuchsia's zxtest has a slightly different death test definition, and
this macro makes our death test API work on Fuchsia.

Reviewed By: sivachandra

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

3 years ago[ARM] Flatten identity shuffles through vqdmulh nodes
David Green [Mon, 1 Feb 2021 19:14:20 +0000 (19:14 +0000)]
[ARM] Flatten identity shuffles through vqdmulh nodes

Given a shuffle(vqdmulh(shuffle, shuffle), we can flatter the shuffles
out if they become an identity mask. This can come up during lane
interleaving, when we do that better.

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

3 years ago[NewPM][Unswitch] Add option to disable -O3 non-trivial unswitching
Arthur Eubanks [Mon, 1 Feb 2021 17:47:22 +0000 (09:47 -0800)]
[NewPM][Unswitch] Add option to disable -O3 non-trivial unswitching

Some benchmarks regress with non-trivial unswitching, so add an option
to opt-out of performing non-trivial unswitching while investigating.

Reviewed By: asbirlea

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

3 years ago[X86] Accept 64-bit GPRs for vextractps when using a register that requires EVEX.
Craig Topper [Mon, 1 Feb 2021 18:56:09 +0000 (10:56 -0800)]
[X86] Accept 64-bit GPRs for vextractps when using a register that requires EVEX.

This is consistent with the VEX version. It also fixes a sorting
issue in the matching table that caused the EVEX version to be
prioritized over VEX in intel syntax.

Fixes issue [2] from PR48991.

3 years ago[elfabi] Fix tests which failed on different timezones
Haowei Wu [Thu, 28 Jan 2021 22:13:20 +0000 (14:13 -0800)]
[elfabi] Fix tests which failed on different timezones

This patch fixes elfabi tests on machines using a GMT+X timezone
settings.

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

3 years ago[clang][PATCH] Fix bug 48848 assertion related to recoverFromMSUnqualifiedLookup
Melanie Blower [Tue, 26 Jan 2021 22:15:30 +0000 (14:15 -0800)]
[clang][PATCH] Fix bug 48848 assertion related to recoverFromMSUnqualifiedLookup

Reviewed By: rnk

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

3 years ago[InstCombine] try to narrow min/max intrinsics with constant operand
Sanjay Patel [Mon, 1 Feb 2021 17:27:04 +0000 (12:27 -0500)]
[InstCombine] try to narrow min/max intrinsics with constant operand

The constant trunc/ext may not be the optimal pre-condition,
but I think that handles the common cases.

Example of Alive2 proof:
https://alive2.llvm.org/ce/z/sREeLC

This is another step towards canonicalizing to the intrinsics.
Narrowing was identified as source of potential regression for
abs(), so we need to handle this for min/max - see:
https://llvm.org/PR48816

If this is not enough, we could process intrinsics in
the trunc-driven matching in canEvaluateTruncated().

3 years ago[InstCombine] add tests for min/max with extend and constant operand; NFC
Sanjay Patel [Sun, 31 Jan 2021 20:43:40 +0000 (15:43 -0500)]
[InstCombine] add tests for min/max with extend and constant operand; NFC

3 years ago[libc] Small adjustments to fenv tests
Michael Jones [Fri, 29 Jan 2021 00:30:23 +0000 (00:30 +0000)]
[libc] Small adjustments to fenv tests

Some libcs define non-standard FE_* macros and include them in
FE_ALL_EXCEPT. This change adjusts the fenv tests so that the
non-standard FE_* macros do not interfere when compiled with
fenv.h from another libc.

Reviewed By: sivachandra

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

3 years ago[NFC] Disallow unused prefixes under clang/test/Driver
Mircea Trofin [Fri, 29 Jan 2021 03:57:17 +0000 (19:57 -0800)]
[NFC] Disallow unused prefixes under clang/test/Driver

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

3 years ago[flang][directive] Enforce basic semantic check for all clauses
Valentin Clement [Mon, 1 Feb 2021 18:33:07 +0000 (13:33 -0500)]
[flang][directive] Enforce basic semantic check for all clauses

This patch is a follow up to D94821 to ensure the correct behavior of the
general directive structure checker.
This patch add the generation of the Enter function declaration for clauses in
the TableGen backend.
This helps to ensure each clauses declared in the TableGen file has at least
a basic check.

Reviewed By: kiranchandramohan

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

3 years ago[X86][AVX] Add 'OK' tests cases for PR48877
Simon Pilgrim [Mon, 1 Feb 2021 18:17:25 +0000 (18:17 +0000)]
[X86][AVX] Add 'OK' tests cases for PR48877

3 years ago[X86][SSE] LowerScalarImmediateShift - use APInt::getLowBitsSet for vXi8 ISD::SRL...
Simon Pilgrim [Mon, 1 Feb 2021 17:23:02 +0000 (17:23 +0000)]
[X86][SSE] LowerScalarImmediateShift - use APInt::getLowBitsSet for vXi8 ISD::SRL mask generation. NFCI.

Match what we do for ISD::SHL

3 years ago[OpenMP] Disable tests if FileCheck is not available in in-tree building
Shilei Tian [Mon, 1 Feb 2021 18:14:48 +0000 (13:14 -0500)]
[OpenMP] Disable tests if FileCheck is not available in in-tree building

FileCheck is required for OpenMP tests. The current detection can fail
if building OpenMP in-tree when user sets `LLVM_INSTALL_TOOLCHAIN_ONLY=ON`. As a
result, CMake will raise an error and the compilation will be broken. This patch
fixed the issue. When `FileCheck` is not a target, tests will just be skipped.

Reviewed By: jdoerfert, JonChesterfield

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

3 years ago[libc++] Implements concept default_initializable.
Mark de Wever [Thu, 17 Dec 2020 06:48:26 +0000 (07:48 +0100)]
[libc++] Implements concept default_initializable.

Implements:
- LWG3149 DefaultConstructible should require default initialization

Implements parts of:
 - P0898R3 Standard Library Concepts
 - P1754 Rename concepts to standard_case for C++20, while we still can

Depends on D91986

Reviewed By: ldionne, #libc

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

3 years ago[AArch64][GlobalISel] Emit G_ASSERT_ZEXT in assignValueToReg
Jessica Paquette [Wed, 27 Jan 2021 22:14:35 +0000 (14:14 -0800)]
[AArch64][GlobalISel] Emit G_ASSERT_ZEXT in assignValueToReg

When we have a zeroext parameter, emit G_ASSERT_ZEXT.

Add a check that we actually emit it.

This is a 0.1% code size win on CTMark/7zip and CTMark/consumer-typeset at -Os.

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

3 years ago[LTO] Move part of gold devirt test to v1.16 directory
Teresa Johnson [Mon, 1 Feb 2021 17:51:17 +0000 (09:51 -0800)]
[LTO] Move part of gold devirt test to v1.16 directory

Part of the gold test added in 1487747e990ce9f8851f3d92c3006a74134d7518
relies on more recent fixes to gold that fix the plugin behavior with
--export-dynamic-symbol and --dynamic-list. Extract those parts of the
new test into a v1.16 test.

3 years ago[RISCV] Add scalable vector support for floating point FMA instructions
Craig Topper [Mon, 1 Feb 2021 17:40:52 +0000 (09:40 -0800)]
[RISCV] Add scalable vector support for floating point FMA instructions

A follow up patch will add support for commuting operands or
changing opcode to vfmacc and friends.

Reviewed By: frasercrmck

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

3 years ago[RISCV] Update comment text from D95774. NFC
Craig Topper [Mon, 1 Feb 2021 17:40:16 +0000 (09:40 -0800)]
[RISCV] Update comment text from D95774. NFC

3 years ago[GlobalISel] Make sure G_ASSERT_ZEXT's src ends up with the same rc as dst
Jessica Paquette [Fri, 29 Jan 2021 23:33:23 +0000 (15:33 -0800)]
[GlobalISel] Make sure G_ASSERT_ZEXT's src ends up with the same rc as dst

When replacing the dst reg with the src reg, we need to make sure that we
propagate the dst reg's register class through to the src.

Otherwise, we aren't meeting the requirements for G_ASSERT_ZEXT, and so the
verifier will fail.

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

3 years ago[RISCV] Optimize (srl (and X, 0xffff), C) -> (srli (slli X, 16), 16 + C).
Craig Topper [Mon, 1 Feb 2021 17:21:43 +0000 (09:21 -0800)]
[RISCV] Optimize (srl (and X, 0xffff), C) -> (srli (slli X, 16), 16 + C).

Rather than materializing the 0xffff immediate for the AND, use
a shift left to remove the upper bits and then shift in zeros
from the right.

This pattern occurs when type legalizing an i16 right shift.

I've implemented this with custom selection code for a number of
reasons. I've limited this to the AND having a single use. We need
to compensate for SimplifyDemandedBits altering the AND mask. I'm
using *W opcodes on RV64. We may want to generlize this in the
future. For all these reason it seemed easiest to do it this way.

Reviewed By: luismarques

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

3 years ago[ConstraintElimination] Negate IR condition directly.
Florian Hahn [Thu, 28 Jan 2021 13:41:21 +0000 (13:41 +0000)]
[ConstraintElimination] Negate IR condition directly.

Instead of using ConstraintSystem::negate when adding new constraints,
flip the condition in IR.

The main advantage is that EQ predicates can be represented by 2
constraints, which makes negating based on the constraint tricky. The IR
condition can easily negated.

3 years ago[flang] Fix parsing of WRITE(I+J) with more accurate look-ahead
peter klausler [Sat, 30 Jan 2021 18:10:52 +0000 (10:10 -0800)]
[flang] Fix parsing of WRITE(I+J) with more accurate look-ahead

The parsing of I/O units uses look-ahead to discriminate between
keywords, variables and expressions as part of distinguishing internal
from external I/O.  The look-ahead was inaccurate for variables that
appear as the initial parts of expressions.

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

3 years ago[AMDGPU] Fix release build after 0397dca0.
Austin Kerbow [Mon, 1 Feb 2021 16:55:14 +0000 (08:55 -0800)]
[AMDGPU] Fix release build after 0397dca0.

3 years ago[AMDGPU] Fix crash with sgpr spills to vgpr disabled
Austin Kerbow [Mon, 1 Feb 2021 16:34:57 +0000 (08:34 -0800)]
[AMDGPU] Fix crash with sgpr spills to vgpr disabled

This would assert with amdgpu-spill-sgpr-to-vgpr disabled when trying to
spill the FP.

Fixes: SWDEV-262704

Reviewed By: RamNalamothu

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

3 years ago[compiler-rt] Fix AArch64 out-of-line atomics visibility on mach-o
Erik Pilkington [Mon, 1 Feb 2021 15:35:06 +0000 (10:35 -0500)]
[compiler-rt] Fix AArch64 out-of-line atomics visibility on mach-o

This fixes an apparent oversight in D91156, where the symbol was defined
without the leading underscore, then the visibility was later declared with it.
rdar://73364185

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

3 years ago[clangd] Remove some obsolete options that are now always on
Sam McCall [Wed, 27 Jan 2021 23:42:16 +0000 (00:42 +0100)]
[clangd] Remove some obsolete options that are now always on

 - always collect main-file refs when indexing
 - always build preambles asynchronously
 - always use dex for fast preamble index

Retire associated flags

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

3 years ago[OpenMP] Fix seg fault in libomptarget when using Info with multiple threads
Joseph Huber [Mon, 1 Feb 2021 15:31:09 +0000 (10:31 -0500)]
[OpenMP] Fix seg fault in libomptarget when using Info with multiple threads

Summary:
One option for the LIBOMPTARGET_INFO environment variable is to print the current status of the device's data mappings. These are a shared resource among threads so this needs to be protected when using multiple streams.

Reviewed By: jdoerfert

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

3 years ago[clangd] references: decls of overrides of x are refs to x, not decls
Sam McCall [Tue, 26 Jan 2021 16:57:22 +0000 (17:57 +0100)]
[clangd] references: decls of overrides of x are refs to x, not decls

This requires a second index query for refs to overrides, as the refs
call doesn't tell you which ref points at which symbol.

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

3 years agoRevert rGce587529ad8b5 - "[APFloat] multiplySignificand - pass IEEEFloat as const...
Simon Pilgrim [Mon, 1 Feb 2021 16:15:08 +0000 (16:15 +0000)]
Revert rGce587529ad8b5 - "[APFloat] multiplySignificand - pass IEEEFloat as const reference. NFCI."

Breaks on some buildbots

3 years agoNFC: Migrate SimplifyCFG to work on InstructionCost
Sander de Smalen [Mon, 1 Feb 2021 12:16:16 +0000 (12:16 +0000)]
NFC: Migrate SimplifyCFG to work on InstructionCost

This patch migrates cost values and arithmetic to work on InstructionCost.
When the interfaces to TargetTransformInfo are changed, any InstructionCost
state will propagate naturally.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: spatel

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

3 years ago[SimplifyCFG] NFC: Rename static methods to clang-tidy standards.
Sander de Smalen [Fri, 29 Jan 2021 17:31:42 +0000 (17:31 +0000)]
[SimplifyCFG] NFC: Rename static methods to clang-tidy standards.

This patch is a precursor to D95351, which changes the signature
of these methods.

3 years ago[ARM] Simplify VMOVRRD from extracts of buildvectors
David Green [Mon, 1 Feb 2021 16:09:25 +0000 (16:09 +0000)]
[ARM] Simplify VMOVRRD from extracts of buildvectors

Under the softfp calling convention, we are often left with
VMOVRRD(extract(bitcast(build_vector(a, b, c, d)))) for the return value
of the function. These can be simplified to a,b or c,d directly,
depending on the value of the extract.

Big endian is a little different because the bitcast switches the lanes
around, meaning we end up with b,a or d,c.

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

3 years ago[clangd] Respect ReferencesParams.context.includeDeclarations
Sam McCall [Tue, 26 Jan 2021 16:16:57 +0000 (17:16 +0100)]
[clangd] Respect ReferencesParams.context.includeDeclarations

Unfortunately this treats overrides declarations as declarations, not as
references. I don't plan to land this until I have a fix for that issue.

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

3 years ago[TableGen] Fix anonymous record self-reference in foreach and multiclass
J-Y You [Mon, 1 Feb 2021 15:59:07 +0000 (10:59 -0500)]
[TableGen] Fix anonymous record self-reference in foreach and multiclass

If we instantiate self-referenced anonymous records in foreach and
multiclass, the NAME value will point to incorrect record. It's because
anonymous name is resolved too early.

This patch adds AnonymousNameInit to represent an anonymous record name.
When instantiating an anonymous record, it will update the referred name.

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

3 years ago[APFloat] multiplySignificand - pass IEEEFloat as const reference. NFCI.
Simon Pilgrim [Mon, 1 Feb 2021 15:41:03 +0000 (15:41 +0000)]
[APFloat] multiplySignificand - pass IEEEFloat as const reference. NFCI.

Avoids unnecessary IEEEFloat copies.

3 years ago[libc++] Fix for the Bug 41784
Ruslan Arutyunyan [Mon, 1 Feb 2021 15:12:09 +0000 (10:12 -0500)]
[libc++] Fix for the Bug 41784

Add deleted volatile copy-assignment operator in the most derived atomic
to fix the Bug 41784. The root cause: there is an `operator=(T) volatile`
that has better match than the deleted copy-assignment operator of the base
class when `this` is `volatile`. The compiler sees that right operand of
the assignment operator can be converted to `T` and chooses that path
without taking into account the deleted copy-assignment operator of the
base class.

The current behavior on libstdc++ is different from what we have in libc++.
On the same test compilation fails with libstdc++. Proof: https://godbolt.org/z/nebPYd
(everything is the same except the -stdlib option).

I choose the way with explicit definition of copy-assignment for atomic
in the most derived class. But probably we can fix that by moving
`operator=(T)` overloads to the base class from both specializations.
At first glance, it shouldn't break anything.

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

3 years ago[clangd] Don't rely on builtin headers for document-link.test.
Haojian Wu [Mon, 1 Feb 2021 14:35:19 +0000 (15:35 +0100)]
[clangd] Don't rely on builtin headers for document-link.test.

This test seems to be failing at HEAD.

Reviewed By: kadircet, sammccall

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

3 years ago[gn build] Port b63cd4db915c
LLVM GN Syncbot [Mon, 1 Feb 2021 14:24:45 +0000 (14:24 +0000)]
[gn build] Port b63cd4db915c

3 years ago[clangd] Rename: merge index/AST refs path-insensitively where needed
Sam McCall [Sun, 31 Jan 2021 12:53:22 +0000 (13:53 +0100)]
[clangd] Rename: merge index/AST refs path-insensitively where needed

If you have c:\foo open, and C:\foo indexed (case difference) then these
need to be considered the same file. Otherwise we emit edits to both,
and editors do... something that isn't pretty.

Maybe more centralized normalization is called for, but it's not trivial
to do this while also being case-preserving. see
https://github.com/clangd/clangd/issues/108

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

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

3 years ago[SVE][CodeGen] Remove performMaskedGatherScatterCombine
Kerry McLaughlin [Mon, 1 Feb 2021 11:04:36 +0000 (11:04 +0000)]
[SVE][CodeGen] Remove performMaskedGatherScatterCombine

The AArch64 DAG combine added by D90945 & D91433 extends the index
of a scalable masked gather or scatter to i32 if necessary.

This patch removes the combine and instead adds shouldExtendGSIndex, which
is used by visitMaskedGather/Scatter in SelectionDAGBuilder to query whether
the index should be extended before calling getMaskedGather/Scatter.

Reviewed By: david-arm

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

3 years ago[SCEV] Bail out if URem operand cannot be zero-extended.
Florian Hahn [Mon, 1 Feb 2021 13:08:25 +0000 (13:08 +0000)]
[SCEV] Bail out if URem operand cannot be zero-extended.

In some cases, LHS is larger than the target expression type. Bail out
in that case for now, to avoid crashing

3 years agoRevert "[Verifier] enable llvm.experimental.noalias.scope.decl dominance check."
Jeroen Dobbelaere [Mon, 1 Feb 2021 13:38:33 +0000 (14:38 +0100)]
Revert "[Verifier] enable llvm.experimental.noalias.scope.decl dominance check."

the 'clang-with-lto-ubuntu' buildbot triggers the assertion.

This reverts commit b43c395e60d2636ab5afc9b60a2046978c71e366.

3 years ago[ConstraintElimination] Add tests for signed predicates.
Florian Hahn [Fri, 29 Jan 2021 11:24:10 +0000 (11:24 +0000)]
[ConstraintElimination] Add tests for signed predicates.

Add test coverage for conditions with signed predicates.

3 years ago[lldb/test] Skip `SBTarget::IsLoaded` test on windows (NFC)
Med Ismail Bennani [Mon, 1 Feb 2021 13:04:10 +0000 (14:04 +0100)]
[lldb/test] Skip `SBTarget::IsLoaded` test on windows (NFC)

This patch skips the test for the SBTarget::IsLoaded method on windows
since the logic is different.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years agoGlobalISel: check type size before getZExtValue()ing it.
Tim Northover [Mon, 1 Feb 2021 12:43:33 +0000 (12:43 +0000)]
GlobalISel: check type size before getZExtValue()ing it.

Otherwise getZExtValue() asserts.

3 years ago[LV] Fix crash when computing max VF too early
Cullen Rhodes [Sat, 16 Jan 2021 16:08:40 +0000 (16:08 +0000)]
[LV] Fix crash when computing max VF too early

D90687 introduced a crash:

  llvm::LoopVectorizationCostModel::computeMaxVF(llvm::ElementCount, unsigned int):
    Assertion `WideningDecisions.empty() && Uniforms.empty() && Scalars.empty() &&
    "No decisions should have been taken at this point"' failed.

when compiling the following C code:

  typedef struct {
  char a;
  } b;

  b *c;
  int d, e;

  int f() {
    int g = 0;
    for (; d; d++) {
      e = 0;
      for (; e < c[d].a; e++)
        g++;
    }
    return g;
  }

with:

  clang -Os -target hexagon -mhvx -fvectorize -mv67 testcase.c -S -o -

This occurred since prior to D90687 computeFeasibleMaxVF would only be
called in computeMaxVF when a scalar epilogue was allowed, but now it's
always called. This causes the assert above since computeFeasibleMaxVF
collects all viable VFs larger than the default MaxVF, and for each VF
calculates the register usage which results in analysis being done the
assert above guards against. This can occur in computeFeasibleMaxVF if
TTI.shouldMaximizeVectorBandwidth and this target hook is implemented in
the hexagon backend to always return true.

Reported by @iajbar.

Reviewed By: fhahn

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

3 years agoNFC: Migrate SpeculativeExecution to work on InstructionCost
Sander de Smalen [Tue, 26 Jan 2021 14:39:01 +0000 (14:39 +0000)]
NFC: Migrate SpeculativeExecution to work on InstructionCost

This patch migrates cost values and arithmetic to work on InstructionCost.
When the interfaces to TargetTransformInfo are changed, any InstructionCost
state will propagate naturally.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: david-arm

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

3 years ago[lldb] Use current execution context in SBDebugger
Andy Yankovsky [Mon, 1 Feb 2021 11:25:53 +0000 (12:25 +0100)]
[lldb] Use current execution context in SBDebugger

Use `GetSelectedExecutionContext()` instead of
`GetCommandInterpreter().GetExecutionContext()` in
`SBDebugger::GetInternalVariableValue/SBDebugger::SetInternalVariable`. The
execution context in the command interpreter might be empty, if no commands has
been executed yet (it is updated only when handling commands or completions --
e.g.
https://github.com/llvm/llvm-project/blob/main/lldb/source/Interpreter/CommandInterpreter.cpp#L1855).

Reviewed By: teemperor

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

3 years agoRevert "[clang][cli] Port OpenMP-related LangOpts to marshalling system"
Jan Svoboda [Mon, 1 Feb 2021 11:36:43 +0000 (12:36 +0100)]
Revert "[clang][cli] Port OpenMP-related LangOpts to marshalling system"

This reverts commit 9ad94c12

It turns out that to correctly generate command line flags for LangOptions::OpenMP and LangOptions::OpenMPSimd, we need the flexibility of C++.

3 years ago[lldb] Remove a stray semicolon, fixing GCC warnings. NFC.
Martin Storsjö [Mon, 1 Feb 2021 11:45:07 +0000 (13:45 +0200)]
[lldb] Remove a stray semicolon, fixing GCC warnings. NFC.

3 years ago[AMDGPU][MC] Corrected error position for invalid operands
Dmitry Preobrazhensky [Mon, 1 Feb 2021 11:22:44 +0000 (14:22 +0300)]
[AMDGPU][MC] Corrected error position for invalid operands

Generic parser may report an incorrect error position when an offending operand is followed by a comma.
See bug 48884 for details: https://bugs.llvm.org/show_bug.cgi?id=48884.

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

3 years ago[lldb/API] Expose Module::IsLoadedInTarget() to SB API (NFC)
Med Ismail Bennani [Mon, 1 Feb 2021 11:14:10 +0000 (11:14 +0000)]
[lldb/API] Expose Module::IsLoadedInTarget() to SB API (NFC)

This patch adds an `SBTarget::IsLoaded(const SBModule&) const` endpoint
to lldb's Scripting Bridge API. As the name suggests, it will allow the
user to know if the module is loaded in a specific target.

rdar://37957625

Differential Review: https://reviews.llvm.org/D95686

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[Branch-Rename] Fix some links
xgupta [Mon, 1 Feb 2021 07:24:21 +0000 (12:54 +0530)]
[Branch-Rename] Fix some links

According to the [[ https://foundation.llvm.org/docs/branch-rename/ | status of branch rename ]], the master branch of the LLVM repository is removed on 28 Jan 2021.

Reviewed By: mehdi_amini

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

3 years ago[ARM] Turn sext_inreg(VGetLaneu) into VGetLaneu
David Green [Mon, 1 Feb 2021 11:10:35 +0000 (11:10 +0000)]
[ARM] Turn sext_inreg(VGetLaneu) into VGetLaneu

This adds a DAG combine for converting sext_inreg of VGetLaneu into
VGetLanes, providing the types match correctly.

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

3 years ago[Verifier] enable llvm.experimental.noalias.scope.decl dominance check.
Jeroen Dobbelaere [Mon, 1 Feb 2021 10:13:14 +0000 (11:13 +0100)]
[Verifier] enable llvm.experimental.noalias.scope.decl dominance check.

Now that Loop Peeling has been fixed (80cdd30eb90c3509bf315f1fa1369483e2448bbd),
enable the dominance check by default.

This reverts commit 3b5d36ece21f9baf96d82944b0165cb352443bee.

3 years ago[X86][AVX] combineExtractWithShuffle - combine extracts from 256/512-bit vector shuffles.
Simon Pilgrim [Mon, 1 Feb 2021 10:31:28 +0000 (10:31 +0000)]
[X86][AVX] combineExtractWithShuffle - combine extracts from 256/512-bit vector shuffles.

We can only legally extract from the lowest 128-bit subvector, so extract the correct subvector to allow us to handle 256/512-bit vector element extracts.

3 years ago[ARM] Simplify extract of VMOVDRR
David Green [Mon, 1 Feb 2021 10:24:57 +0000 (10:24 +0000)]
[ARM] Simplify extract of VMOVDRR

Under SoftFP calling conventions, we can be left with
extract(bitcast(BUILD_VECTOR(VMOVDRR(a, b), ..))) patterns that can
simplify to a or b, depending on the extract lane.

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

3 years ago[VE] Change inetger constants 32-bit friendly
Kazushi (Jam) Marukawa [Sat, 30 Jan 2021 03:34:06 +0000 (12:34 +0900)]
[VE] Change inetger constants 32-bit friendly

Correct integer constants like `1UL << 63` to `UINT64_C(1) << 63` in
order to make them work on 32-bit machines.  Tested on both an i386
and x86_64 machines.

Reviewed By: mgorny

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

3 years ago[LoopUnswitch] Pacify compiler warnings.
Florian Hahn [Mon, 1 Feb 2021 09:12:19 +0000 (09:12 +0000)]
[LoopUnswitch] Pacify compiler warnings.

Attempt to fix some compiler warnings on some bots after
b8c81fa5c7f77a7a1267e42ddbbc9bffb10b0817.

3 years ago[LoopUnswitch] Add shortcut if unswitched path is a no-op.
Florian Hahn [Mon, 1 Feb 2021 08:51:22 +0000 (08:51 +0000)]
[LoopUnswitch] Add shortcut if unswitched path is a no-op.

If we determine that the invariant path through the loop has no effects,
we can directly branch to the exit block, instead to unswitching first.

Besides avoiding some extra work (unswitching first, then deleting the
loop again) this allows to be more aggressive than regular unswitching
with respect to cost-modeling. This approach should always be be
desirable.

This is similar in spirit to D93734, just that it uses the previously
added checks for loop-unswitching.

I tried to add the required no-op checks from scratch, as we only check
a subset of the loop. There is potential to unify the checks with
LoopDeletion, at the cost of adding a predicate whether a block should
be considered.

Reviewed By: jdoerfert

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

3 years ago[LoopPeel] Use llvm.experimental.noalias.scope.decl for duplicating noalias metadata...
Jeroen Dobbelaere [Mon, 1 Feb 2021 08:23:33 +0000 (09:23 +0100)]
[LoopPeel] Use llvm.experimental.noalias.scope.decl for duplicating noalias metadata as needed.

The reduction of a sanitizer build failure when enabling the dominance check (D95335) showed that loop peeling also needs to take care of scope duplication, just like loop unrolling (D92887).

Reviewed By: nikic

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

3 years ago[lldb][docs] Attempt to disable the generated GitHub button on the LLDB website
Raphael Isemann [Mon, 1 Feb 2021 08:42:14 +0000 (09:42 +0100)]
[lldb][docs] Attempt to disable the generated GitHub button on the LLDB website

For unknown reasons the alabaster theme on the docs server is always generating
a GitHub link in the side bar. Beside the privacy problems of having an iframe
to some third-party service, we never configured any GitHub integration so
this button just links to the GitHub main site.

The button generation should be disabled by default, but as that's apparently
not true in the alabaster theme on the server, this patch tries working around
the issue by just explicitly turning off the GitHub integration.

3 years agoRevert "[mlir][Linalg] Replace SimplePad with PadTensor in hoist-padding"
Tres Popp [Mon, 1 Feb 2021 08:43:03 +0000 (09:43 +0100)]
Revert "[mlir][Linalg] Replace SimplePad with PadTensor in hoist-padding"

This reverts commit d9b953d84b332a8c4751fcbf8178e32818dc718b.

This commit resulted in build bot failures and the author is away from a
computer, so I am reverting on their behalf until they have a chance to
look into this.

3 years ago[mlir] Fix missing null termination in cuLinkAddData argument.
Christian Sigg [Fri, 29 Jan 2021 13:55:34 +0000 (14:55 +0100)]
[mlir] Fix missing null termination in cuLinkAddData argument.

Reviewed By: ftynse

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

3 years ago[mlir][Linalg] Replace SimplePad with PadTensor in hoist-padding
Hanhan Wang [Mon, 1 Feb 2021 08:02:26 +0000 (00:02 -0800)]
[mlir][Linalg] Replace SimplePad with PadTensor in hoist-padding

This is the last revision to migrate using SimplePadOp to PadTensorOp, and the
SimplePadOp is removed in the patch. Update a bit in SliceAnalysis because the
PadTensorOp takes a region different from SimplePadOp. This is not covered by
LinalgOp because it is not a structured op.

Also, remove a duplicated comment from cpp file, which is already described in a
header file. And update the pseudo-mlir in the comment.

Reviewed By: nicolasvasilache

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

3 years ago[OpenMP] Fix python3 compatibility in openmp's lit.cfg
Tobias Hieta [Fri, 29 Jan 2021 07:44:56 +0000 (08:44 +0100)]
[OpenMP] Fix python3 compatibility in openmp's lit.cfg

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