platform/upstream/llvm.git
4 years ago[ELF][test] Fix shuffle_sections.s
Fangrui Song [Thu, 20 Feb 2020 01:09:47 +0000 (17:09 -0800)]
[ELF][test] Fix shuffle_sections.s

C++ standard libraries have different random function implementations.
We cannot expect a particular order.

4 years ago[MS] Mark vectorcall FP and vector args inreg
Reid Kleckner [Wed, 12 Feb 2020 01:09:06 +0000 (17:09 -0800)]
[MS] Mark vectorcall FP and vector args inreg

This has no effect on how LLVM passes the arguments, but it prevents
rewriteWithInAlloca from thinking that these parameters should be part
of the inalloca pack.

Follow-up to D72114

Reviewed By: erichkeane

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

4 years ago[mlir][Linalg] Allow specifiying zero-rank shaped type operands to linalg.indexed_gen...
Hanhan Wang [Wed, 19 Feb 2020 23:03:01 +0000 (18:03 -0500)]
[mlir][Linalg] Allow specifiying zero-rank shaped type operands to linalg.indexed_generic ops.

Patch D74638 allows linalg.generic ops to use zero-rank shaped type operands,
this also can be applied to linalg.indexed_generic ops.

4 years agoAdd an Offset field to the SourceLocation for LookupResult objects.
Greg Clayton [Sun, 16 Feb 2020 05:28:36 +0000 (21:28 -0800)]
Add an Offset field to the SourceLocation for LookupResult objects.

Summary:
The Offset provides the offset within the function in a SourceLocation struct. This allows us to show the byte offset within a function. We also track offsets within inline functions as well. Updated the lookup tests to verify the offset for functions and inline functions.

0x1000: main + 32 @ /tmp/main.cpp:45

Reviewers: labath, aadsm, serhiy.redko, jankratochvil, xiaobai, wallace, aprantl, JDevlieghere

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoAdd a `%darwin_min_target_with_tls_support` lit substitution.
Dan Liew [Tue, 18 Feb 2020 23:43:25 +0000 (15:43 -0800)]
Add a `%darwin_min_target_with_tls_support` lit substitution.

Summary:
This substitution expands to the appropriate minimum deployment target
flag where thread local storage (TLS) was first introduced on Darwin
platforms. For all other platforms the substitution expands to an empty
string.

E.g. for macOS the substitution expands to `-mmacosx-version-min=10.12`

This patch adds support for the substitution (and future substitutions)
by doing a minor refactor and then uses the substitution in the relevant
TSan tests.

rdar://problem/59568956

Reviewers: yln, kubamracek, dvyukov, vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[NFC] Fix issues with clang-tidy checks list.rst
Nathan James [Wed, 19 Feb 2020 23:19:09 +0000 (23:19 +0000)]
[NFC] Fix issues with clang-tidy checks list.rst

Added FixItHint comments to ReservedIdentifierCheck and IdentifierNamingCheck to trick the python scripts into detecting a fix it is provided as it can't see the FixItHints in RenamerClangTidyCheck.cpp

4 years ago[WebAssembly] Fix memory bug introduced in 52861809994c
Thomas Lively [Wed, 19 Feb 2020 23:01:47 +0000 (15:01 -0800)]
[WebAssembly] Fix memory bug introduced in 52861809994c

Summary:
The instruction at `DefI` can sometimes be destroyed by
`rematerializeCheapDef`, so it should not be used after calling that
function. The fix is to use `Insert` instead when examining additional
multivalue stackifications. `Insert` is the address of the new
defining instruction after all moves and rematerializations have taken
place.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

4 years ago[clang-tidy] fix readability-redundant-member-init auto-fix of Function-try-block
Alexander Lanin [Wed, 19 Feb 2020 22:58:54 +0000 (22:58 +0000)]
[clang-tidy] fix readability-redundant-member-init auto-fix of Function-try-block

Summary: This fixes https://bugs.llvm.org/show_bug.cgi?id=39310

Reviewers: malcolm.parsons, ioeric

Reviewed By: malcolm.parsons

Subscribers: xazax.hun

Tags: #clang-format, #clang-tools-extra

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

4 years ago[gn build] Port 85fb997659b
LLVM GN Syncbot [Wed, 19 Feb 2020 22:58:29 +0000 (22:58 +0000)]
[gn build] Port 85fb997659b

4 years ago[JITLink] Fix testcase for main JITDylib rename in 85fb997659b.
Lang Hames [Wed, 19 Feb 2020 22:57:04 +0000 (14:57 -0800)]
[JITLink] Fix testcase for main JITDylib rename in 85fb997659b.

4 years agoAMDGPU: Enable integer division bypass
Matt Arsenault [Mon, 17 Feb 2020 23:16:59 +0000 (18:16 -0500)]
AMDGPU: Enable integer division bypass

We probably want this, and I've meant to turn this on for a long
time. SC actually emits a special case to early-out for a 1
denominator, which perhaps should also be considered.

4 years agoAdd cl_khr_mipmap_image_writes as supported to AMDGPU
Yaxun (Sam) Liu [Wed, 19 Feb 2020 00:34:15 +0000 (19:34 -0500)]
Add cl_khr_mipmap_image_writes as supported to AMDGPU

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

4 years agoAMDGPU/GlobalISel: Remove outdated comment
Matt Arsenault [Tue, 18 Feb 2020 13:53:44 +0000 (08:53 -0500)]
AMDGPU/GlobalISel: Remove outdated comment

4 years agoAMDGPU/GlobalISel: Cleanup min/max RegBankSelect tests
Matt Arsenault [Wed, 19 Feb 2020 20:03:15 +0000 (15:03 -0500)]
AMDGPU/GlobalISel: Cleanup min/max RegBankSelect tests

Use common check prefix, although update_mir_test_checks makes this
unnecessarily annoying. Also make sure to have uses in case that ever
ends up mattering.

4 years ago[ORC] Fix a missing move.
Lang Hames [Wed, 19 Feb 2020 22:27:31 +0000 (14:27 -0800)]
[ORC] Fix a missing move.

4 years ago[ORC] Qualify nullptr_t.
Lang Hames [Wed, 19 Feb 2020 22:25:38 +0000 (14:25 -0800)]
[ORC] Qualify nullptr_t.

4 years agoAnother fix for 7d91633a2b9b1f563dc14c632cc0c461c3651f76
David Goldman [Wed, 19 Feb 2020 22:12:12 +0000 (17:12 -0500)]
Another fix for 7d91633a2b9b1f563dc14c632cc0c461c3651f76

Forgot to update lines for RUNs

4 years agoAdd benchmarks for basic_string::erase
Martijn Vels [Thu, 30 Jan 2020 21:02:22 +0000 (16:02 -0500)]
Add benchmarks for basic_string::erase

Reviewers: EricWF

Subscribers: christof, libcxx-commits

Tags: #libc

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

4 years agolibclang: Add static build support for Windows
Cristian Adam [Wed, 19 Feb 2020 21:42:31 +0000 (23:42 +0200)]
libclang: Add static build support for Windows

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

4 years ago[ORC] Add generic initializer/deinitializer support.
Lang Hames [Mon, 16 Dec 2019 10:50:40 +0000 (02:50 -0800)]
[ORC] Add generic initializer/deinitializer support.

Initializers and deinitializers are used to implement C++ static constructors
and destructors, runtime registration for some languages (e.g. with the
Objective-C runtime for Objective-C/C++ code) and other tasks that would
typically be performed when a shared-object/dylib is loaded or unloaded by a
statically compiled program.

MCJIT and ORC have historically provided limited support for discovering and
running initializers/deinitializers by scanning the llvm.global_ctors and
llvm.global_dtors variables and recording the functions to be run. This approach
suffers from several drawbacks: (1) It only works for IR inputs, not for object
files (including cached JIT'd objects). (2) It only works for initializers
described by llvm.global_ctors and llvm.global_dtors, however not all
initializers are described in this way (Objective-C, for example, describes
initializers via specially named metadata sections). (3) To make the
initializer/deinitializer functions described by llvm.global_ctors and
llvm.global_dtors searchable they must be promoted to extern linkage, polluting
the JIT symbol table (extra care must be taken to ensure this promotion does
not result in symbol name clashes).

This patch introduces several interdependent changes to ORCv2 to support the
construction of new initialization schemes, and includes an implementation of a
backwards-compatible llvm.global_ctor/llvm.global_dtor scanning scheme, and a
MachO specific scheme that handles Objective-C runtime registration (if the
Objective-C runtime is available) enabling execution of LLVM IR compiled from
Objective-C and Swift.

The major changes included in this patch are:

(1) The MaterializationUnit and MaterializationResponsibility classes are
extended to describe an optional "initializer" symbol for the module (see the
getInitializerSymbol method on each class). The presence or absence of this
symbol indicates whether the module contains any initializers or
deinitializers. The initializer symbol otherwise behaves like any other:
searching for it triggers materialization.

(2) A new Platform interface is introduced in llvm/ExecutionEngine/Orc/Core.h
which provides the following callback interface:

  - Error setupJITDylib(JITDylib &JD): Can be used to install standard symbols
    in JITDylibs upon creation. E.g. __dso_handle.

  - Error notifyAdding(JITDylib &JD, const MaterializationUnit &MU): Generally
    used to record initializer symbols.

  - Error notifyRemoving(JITDylib &JD, VModuleKey K): Used to notify a platform
    that a module is being removed.

  Platform implementations can use these callbacks to track outstanding
initializers and implement a platform-specific approach for executing them. For
example, the MachOPlatform installs a plugin in the JIT linker to scan for both
__mod_inits sections (for C++ static constructors) and ObjC metadata sections.
If discovered, these are processed in the usual platform order: Objective-C
registration is carried out first, then static initializers are executed,
ensuring that calls to Objective-C from static initializers will be safe.

This patch updates LLJIT to use the new scheme for initialization. Two
LLJIT::PlatformSupport classes are implemented: A GenericIR platform and a MachO
platform. The GenericIR platform implements a modified version of the previous
llvm.global-ctor scraping scheme to provide support for Windows and
Linux. LLJIT's MachO platform uses the MachOPlatform class to provide MachO
specific initialization as described above.

Reviewers: sgraenitz, dblaikie

Subscribers: mgorny, hiraditya, mgrang, ributzka, llvm-commits

Tags: #llvm

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

4 years agoFix broken test on Windows caused by D74790
David Goldman [Wed, 19 Feb 2020 21:58:22 +0000 (16:58 -0500)]
Fix broken test on Windows caused by D74790

4 years ago[lld][ELF] Add --shuffle-sections=seed to shuffle input sections
Rafael Ávila de Espíndola [Wed, 19 Feb 2020 21:19:58 +0000 (13:19 -0800)]
[lld][ELF] Add --shuffle-sections=seed to shuffle input sections

Summary:
This option causes lld to shuffle sections by assigning different
priorities in each run.

The use case for this is to introduce randomization in benchmarks. The
idea is inspired by the paper "Producing Wrong Data Without Doing
Anything Obviously Wrong!"
(https://www.inf.usi.ch/faculty/hauswirth/publications/asplos09.pdf). Unlike
the paper, we shuffle individual sections, not just input files.

Doing this in lld is particularly convenient as the --reproduce option
makes it easy to collect all the necessary bits for relinking the
program being benchmarked. Once that it is done, all that is needed is
to add --shuffle-sections=0 to the response file and relink before each
run of the benchmark.

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

4 years ago[AMDGPU] Fix DS_WRITE_B32 patterns
Stanislav Mekhanoshin [Wed, 19 Feb 2020 21:25:37 +0000 (13:25 -0800)]
[AMDGPU] Fix DS_WRITE_B32 patterns

It uses VGPR_32.RegTypes which includes 16 bit types. As a
result DS_WRITE_B32 may be generated for "store i16" which
is a bug. The only reason we do not hit it now is relative
patterns complexity and sorting. Should DS_WRITE_B16 pattern
complexity become higher and the bug appears.

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

4 years ago[TSan] Fix incorrect expansion of `%deflake` lit substitution.
Dan Liew [Wed, 19 Feb 2020 21:23:26 +0000 (13:23 -0800)]
[TSan] Fix incorrect expansion of `%deflake` lit substitution.

dadc214e4d9d09a8a7a9f15780c1201c18f93e05 introduced a change to
`%deflake` to support a configurable threshold but the patch forgot
to add a trailing space.

4 years ago[libc++] reduce <complex> parsing time
Louis Dionne [Wed, 19 Feb 2020 21:09:41 +0000 (16:09 -0500)]
[libc++] reduce <complex> parsing time

Instead of including <ios> for ios_base::failbit, simply get failbit
member of the template argument. Print directly to a stream instead
of using intermediate ostringstream.

    Parsing time: 874ms -> 164ms (-81%)

Thanks to Nikita Kniazev for the patch!

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

4 years ago[libc++] Fixes backreferences for extended grammar.
Louis Dionne [Wed, 19 Feb 2020 20:56:15 +0000 (15:56 -0500)]
[libc++] Fixes backreferences for extended grammar.

The regex backreferences were not properly parsed and used when using
the extended grammar. This change parses them. The issue was found while
working on PR34297.

Thanks to Mark de Wever for the patch!

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

4 years ago[AMDGPU] AMDGPUUsage define call convention ABI
Tony [Thu, 13 Feb 2020 06:19:25 +0000 (01:19 -0500)]
[AMDGPU] AMDGPUUsage define call convention ABI

Reviewers: scott.linder, arsenm, b-sumner

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[IndVarSimply] Fix assert/release build difference.
Michael Kruse [Wed, 19 Feb 2020 20:20:55 +0000 (14:20 -0600)]
[IndVarSimply] Fix assert/release build difference.

In builds with assertions enabled (!NDEBUG), IndVarSimplify does an
additional query to ScalarEvolution which may change future SCEV queries
since it fills the internal cache differently. The result is actually
only used with the -verify-indvars command line option. We fix the issue
by only calling SE->getBackedgeTakenCount(L) if -verify-indvars is
enabled such that only -verify-indvars shows the behavior, but not debug
builds themselves. Also add a remark to the description of
-verify-indvars about this behavior.

Fixes llvm.org/PR44815

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

4 years ago[AMDGPU] Update AMDGPUUsage with DWARF proposal
Tony [Wed, 19 Feb 2020 04:02:02 +0000 (23:02 -0500)]
[AMDGPU] Update AMDGPUUsage with DWARF proposal

Summary:
- Add AMDGPU DWARF proposal.
- Add references for gfx10 ISA and SemVer.

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, aprantl, dstuttard, tpr, jfb, dmgreen, llvm-commits

Tags: #llvm

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

4 years ago[x86] add test for uint->fp with unsafe-fp-math (PR43609); NFC
Sanjay Patel [Tue, 18 Feb 2020 22:02:50 +0000 (17:02 -0500)]
[x86] add test for uint->fp with unsafe-fp-math (PR43609); NFC

4 years ago[Hexagon] Change HVX vector predicate types from v512/1024i1 to v64/128i1
Krzysztof Parzyszek [Fri, 7 Feb 2020 15:33:18 +0000 (09:33 -0600)]
[Hexagon] Change HVX vector predicate types from v512/1024i1 to v64/128i1

This commit removes the artificial types <512 x i1> and <1024 x i1>
from HVX intrinsics, and makes v512i1 and v1024i1 no longer legal on
Hexagon.

It may cause existing bitcode files to become invalid.

* Converting between vector predicates and vector registers must be
  done explicitly via vandvrt/vandqrt instructions (their intrinsics),
  i.e. (for 64-byte mode):
    %Q = call <64 x i1> @llvm.hexagon.V6.vandvrt(<16 x i32> %V, i32 -1)
    %V = call <16 x i32> @llvm.hexagon.V6.vandqrt(<64 x i1> %Q, i32 -1)

  The conversion intrinsics are:
    declare  <64 x i1> @llvm.hexagon.V6.vandvrt(<16 x i32>, i32)
    declare <128 x i1> @llvm.hexagon.V6.vandvrt.128B(<32 x i32>, i32)
    declare <16 x i32> @llvm.hexagon.V6.vandqrt(<64 x i1>, i32)
    declare <32 x i32> @llvm.hexagon.V6.vandqrt.128B(<128 x i1>, i32)
  They are all pure.

* Vector predicate values cannot be loaded/stored directly. This directly
  reflects the architecture restriction. Loading and storing or vector
  predicates must be done indirectly via vector registers and explicit
  conversions via vandvrt/vandqrt instructions.

4 years ago[OpenMP][OMPIRBuilder] Introducing the `OMPBuilderCBHelpers` helper class
Fady Ghanim [Wed, 19 Feb 2020 19:50:26 +0000 (13:50 -0600)]
[OpenMP][OMPIRBuilder] Introducing the `OMPBuilderCBHelpers` helper class

This patch introduces a new helper class `OMPBuilderCBHelpers`,
which will contain all reusable C/C++ language specific function-
alities required by the `OMPIRBuilder`.

Initially, this helper class contains the body and finalization
codegen functionalities implemented using callbacks which were
moved here for reusability among the different directives
implemented in the `OMPIRBuilder`, along with RAIIs for preserving
state prior to emitting outlined and/or inlined OpenMP regions.

In the future this helper class will also contain all the different
call backs required by OpenMP clauses/variable privatization.

Reviewed By: jdoerfert

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

4 years agoReapply [IRBuilder] Always respect inserter/folder
Nikita Popov [Tue, 18 Feb 2020 19:35:16 +0000 (20:35 +0100)]
Reapply [IRBuilder] Always respect inserter/folder

Some IRBuilder methods that were originally defined on
IRBuilderBase do not respect custom IRBuilder inserters/folders,
because those were not accessible prior to D73835. Fix this by
making use of existing (and now accessible) IRBuilder methods,
which will handle inserters/folders correctly.

There are some changes in OpenMP and Instrumentation tests, where
bitcasts now get constant folded. I've also highlighted one
InstCombine test which now finishes in two rather than three
iterations, thanks to new instructions being inserted into the
worklist.

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

4 years ago[mlir] [VectorOps] Framework for progressive lowering of vector.contract
aartbik [Wed, 19 Feb 2020 19:26:42 +0000 (11:26 -0800)]
[mlir] [VectorOps] Framework for progressive lowering of vector.contract

Summary:
Lowers all free/batch dimensions in a vector.contract progressively
into simpler vector.contract operations until a direct vector.reduction
operation is reached. Then lowers 1-D reductions into vector.reduce.

Still TBD:
multi-dimensional contractions that remain after removing all the parallel dims

Reviewers: nicolasvasilache, andydavis1, rriddle

Reviewed By: andydavis1

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years agoInclude static prof data when collecting loop BBs
Bill Wendling [Wed, 19 Feb 2020 01:13:21 +0000 (17:13 -0800)]
Include static prof data when collecting loop BBs

Summary:
If the programmer adds static profile data to a branch---i.e. uses
"__builtin_expect()" or similar---then we should honor it. Otherwise,
"__builtin_expect()" is ignored in crucial situations. So we trust that
the programmer knows what they're doing until proven wrong.

Subscribers: hiraditya, JDevlieghere, llvm-commits

Tags: #llvm

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

4 years ago[libFuzzer] Fix denominator in the "inputs have DFT" log line.
Max Moroz [Tue, 18 Feb 2020 17:57:16 +0000 (09:57 -0800)]
[libFuzzer] Fix denominator in the "inputs have DFT" log line.

Summary:
The number of "inputs have the Data Flow Trace" cannot be greater than
the number of inputs touching the focus function. The existing message is rather
confusing as the same log would mention a greater total number of traces a few
lines above.

Reviewers: kcc, metzman

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[AMDGPU] Regenerate immediate constant tests
Simon Pilgrim [Wed, 19 Feb 2020 18:44:59 +0000 (18:44 +0000)]
[AMDGPU] Regenerate immediate constant tests

4 years ago[UpdateTestChecks] Add support for '.' in ir function names
Simon Pilgrim [Wed, 19 Feb 2020 18:44:28 +0000 (18:44 +0000)]
[UpdateTestChecks] Add support for '.' in ir function names

Will let us regenerate from amdgpu float constant tests

4 years ago[CMake] Only detect the linker once in AddLLVM.cmake
Louis Dionne [Tue, 8 Oct 2019 15:05:59 +0000 (11:05 -0400)]
[CMake] Only detect the linker once in AddLLVM.cmake

Summary:
Otherwise, the build output contains a bunch of "Linker detection: <xxx>"
lines that are really redundant. We also make redundant calls to the
linker, although that is a smaller concern.

Reviewers: smeenai

Subscribers: mgorny, fedor.sergeev, jkorous, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[mlir][NFC] Fix 'gatherLoops' utility
Diego Caballero [Wed, 19 Feb 2020 18:06:45 +0000 (10:06 -0800)]
[mlir][NFC] Fix 'gatherLoops' utility

It replaces DenseMap output with a SmallVector and it
removes empty loop levels from the output.

Reviewed By: andydavis1, mehdi_amini

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

4 years ago[DDG] Data Dependence Graph - Graph Simplification
Bardia Mahjour [Tue, 18 Feb 2020 21:38:10 +0000 (16:38 -0500)]
[DDG] Data Dependence Graph - Graph Simplification

Summary:
This is the last functional patch affecting the representation of DDG.
Here we try to simplify the DDG to reduce the number of nodes and edges by
iteratively merging pairs of nodes that satisfy the following conditions,
until no such pair can be identified. A pair of nodes consisting of a and b
can be merged if:

    1. the only edge from a is a def-use edge to b and
    2. the only edge to b is a def-use edge from a and
    3. there is no cyclic edge from b to a and
    4. all instructions in a and b belong to the same basic block and
    5. both a and b are simple (single or multi instruction) nodes.

These criteria allow us to fold many uninteresting def-use edges that
commonly exist in the graph while avoiding the risk of introducing
dependencies that didn't exist before.

Authored By: bmahjour

Reviewer: Meinersbur, fhahn, myhsu, xtian, dmgreen, kbarton, jdoerfert

Reviewed By: Meinersbur

Subscribers: ychen, arphaman, simoll, a.elovikov, mgorny, hiraditya, jfb, wuzish, llvm-commits, jsji, Whitney, etiotto, ppc-slack

Tags: #llvm

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

4 years ago[mlir][NFC] Fix warning for mismatched sign comparison.
River Riddle [Wed, 19 Feb 2020 18:39:40 +0000 (10:39 -0800)]
[mlir][NFC] Fix warning for mismatched sign comparison.

4 years agoRevert "[PatternMatch] Match XOR variant of unsigned-add overflow check."
Florian Hahn [Wed, 19 Feb 2020 18:35:32 +0000 (19:35 +0100)]
Revert "[PatternMatch] Match XOR variant of unsigned-add overflow check."

This reverts commit e01a3d49c224d6f8a7afc01205b05b9deaa07afa.
and commit a6a585b8030b6e8d4c50c71f54a6addb21995fe0.

This causes a failure on GreenDragon:
http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/9597

4 years ago[mlir][Parser] Use APFloat instead of FloatAttr when parsing DenseElementsAttrs.
River Riddle [Wed, 19 Feb 2020 18:28:53 +0000 (10:28 -0800)]
[mlir][Parser] Use APFloat instead of FloatAttr when parsing DenseElementsAttrs.

Summary: DenseElementsAttr stores float values as raw bits internally, so creating attributes just to have them unwrapped is extremely inefficient.

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

4 years ago[mlir][ODS] Add a new trait `TypesMatchWith`
River Riddle [Wed, 19 Feb 2020 18:18:28 +0000 (10:18 -0800)]
[mlir][ODS] Add a new trait `TypesMatchWith`

Summary:
This trait takes three arguments: lhs, rhs, transformer. It verifies that the type of 'rhs' matches the type of 'lhs' when the given 'transformer' is applied to 'lhs'. This allows for adding constraints like: "the type of 'a' must match the element type of 'b'". A followup revision will add support in the declarative parser for using these equality constraints to port more c++ parsers to the declarative form.

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

4 years ago[lldb/Core] Remove locking in the PluginManager
Jonas Devlieghere [Wed, 19 Feb 2020 18:00:05 +0000 (10:00 -0800)]
[lldb/Core] Remove locking in the PluginManager

Remove locking as all the plugin registration takes place from a single
thread. Addresses Pavel's feedback in D74816.

4 years ago[AssumeBundle] Add documentation for the operand bundles of an llvm.assume
Tyker [Wed, 19 Feb 2020 17:52:20 +0000 (18:52 +0100)]
[AssumeBundle] Add documentation for the operand bundles of an llvm.assume

Summary:
Operand bundles on an llvm.assume allows representing
assumptions that an attribute holds for a certain value at a certain position.
Operand bundles enable assumptions that are either hard or impossible to
represent as a boolean argument of an llvm.assume.

Reviewers: jdoerfert, fhahn, nlopes, reames, regehr, efriedma

Reviewed By: jdoerfert

Subscribers: lebedev.ri, llvm-commits

Tags: #llvm

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

4 years ago[ValueTracking] Improve isKnownNonNaN() to recognize zero splats.
Jonas Paulsson [Thu, 6 Feb 2020 18:27:50 +0000 (19:27 +0100)]
[ValueTracking]  Improve isKnownNonNaN() to recognize zero splats.

isKnownNonNaN() could not recognize a zero splat because that is a
ConstantAggregateZero which is-a ConstantData but not a ConstantDataVector.

Patch makes a ConstantAggregateZero return true.

Review: Thomas Lively

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

4 years ago[gn build] use \bfoo\b instead of \<foo\> in sync script
Nico Weber [Wed, 19 Feb 2020 17:30:46 +0000 (12:30 -0500)]
[gn build] use \bfoo\b instead of \<foo\> in sync script

\<foo\> is more correct, but since we use shell=True on Windows,
the < and > get interpreted as redirection operators.

Rather than adding cmd escaping, just use \bfoo\b, which is Good
Enough Often Enough.

4 years ago[gn build] Port a54d81f5979
LLVM GN Syncbot [Wed, 19 Feb 2020 17:28:29 +0000 (17:28 +0000)]
[gn build] Port a54d81f5979

4 years agoFix Block::eraseArgument when block arg is also a successor operand.
Sean Silva [Fri, 14 Feb 2020 00:29:10 +0000 (16:29 -0800)]
Fix Block::eraseArgument when block arg is also a successor operand.

Summary:
This could trigger an assertion due to the block argument being used by
this block's own successor operands.

Reviewers: rriddle!

Subscribers: mehdi_amini, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[gn build] Set up include_dirs for a54d81f597 (first checker in a subdir)
Nico Weber [Wed, 19 Feb 2020 17:24:01 +0000 (12:24 -0500)]
[gn build] Set up include_dirs for a54d81f597 (first checker in a subdir)

4 years ago[X86] Add DCI.isBeforeLegalize() check to the v64i1 constant splitting code in combin...
Craig Topper [Wed, 19 Feb 2020 17:02:56 +0000 (09:02 -0800)]
[X86] Add DCI.isBeforeLegalize() check to the v64i1 constant splitting code in combineStore.

We only need to split after type legalization. If we're before
we can just use a wide store and type legalization will split it.

Add a v128i1 test to exercise it post type legalization.

4 years ago[analyzer] CERT: POS34-C
Zurab Tsinadze [Wed, 19 Feb 2020 17:10:31 +0000 (18:10 +0100)]
[analyzer] CERT: POS34-C

Summary:
This patch introduces a new checker:
`alpha.security.cert.pos.34c`

This checker is implemented based on the following rule:
https://wiki.sei.cmu.edu/confluence/x/6NYxBQ
The check warns if  `putenv` function is
called with automatic storage variable as an argument.

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

4 years ago[AMDGPU] Fix assumption about LaneBitmask content
Stanislav Mekhanoshin [Wed, 19 Feb 2020 00:14:20 +0000 (16:14 -0800)]
[AMDGPU] Fix assumption about LaneBitmask content

Yet another assumption about an actual LaneBitmask content
is fixed.

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

4 years ago[libc++] Fix ABI break in __bit_reference.
Eric Fiselier [Wed, 19 Feb 2020 16:59:37 +0000 (11:59 -0500)]
[libc++] Fix ABI break in __bit_reference.

The libc++ __bit_iterator type has weird ABI calling conventions as a
quirk
of the implementation. The const bit iterator is trivial, but the
non-const
bit iterator is not because it declares a user-defined copy constructor.

Changing this now is an ABI break, so this test ensures that each type
is trivial/non-trivial as expected.

The definition of 'non-trivial for the purposes of calls':
  A type is considered non-trivial for the purposes of calls if:
      * it has a non-trivial copy constructor, move constructor, or
            destructor, or
        * all of its copy and move constructors are deleted.

4 years ago[NFC][compiler-rt][test] Fully qualify string -> std::string
Jordan Rupprecht [Wed, 19 Feb 2020 16:58:55 +0000 (08:58 -0800)]
[NFC][compiler-rt][test] Fully qualify string -> std::string

4 years agoRevert "[IRBuilder] Always respect inserter/folder"
Nikita Popov [Wed, 19 Feb 2020 16:51:26 +0000 (17:51 +0100)]
Revert "[IRBuilder] Always respect inserter/folder"

This reverts commit f12fb2d99b8dd0dbef1c79f1d401200150f2d0bd.

I missed some changes in instrumentation test cases.

4 years ago[mlir][ods] Adding attribute setters generation
Alexandre Eichenberger [Wed, 19 Feb 2020 16:39:28 +0000 (11:39 -0500)]
[mlir][ods] Adding attribute setters generation

In some dialects, attributes may have default values that may be
determined only after shape inference. For example, attributes that
are dependent on the rank of the input cannot be assigned a default
value until the rank of the tensor is inferred.

While we can set attributes without explicit setters, referring to
the attributes via accessors instead of having to use the string
interface is better for compile time verification.

The proposed patch add one method per operation attribute that let us
set its value. The code is a very small modification of the existing
getter methods.

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

4 years ago[InstCombine] Fix removal from deferred instructions
Nikita Popov [Tue, 18 Feb 2020 21:19:39 +0000 (22:19 +0100)]
[InstCombine] Fix removal from deferred instructions

Make sure we don't skip the Deferred.remove() call if the
instruction is not in the worklist. Both of those are separate.

We don't have any cases where deferred instructions get removed
right now, but may cause problems in the future.

4 years ago[Sema][CodeComplete] Handle symlinks for include code completion
David Goldman [Tue, 18 Feb 2020 21:21:12 +0000 (16:21 -0500)]
[Sema][CodeComplete] Handle symlinks for include code completion

Summary:
Previously any symlinks would be ignored since the directory
traversal doesn't follow them.

With this change we now follow symlinks (via a `stat` call
in order to figure out the target type of the symlink if it
is valid).

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[IRBuilder] Always respect inserter/folder
Nikita Popov [Tue, 18 Feb 2020 19:35:16 +0000 (20:35 +0100)]
[IRBuilder] Always respect inserter/folder

Some IRBuilder methods that were originally defined on
IRBuilderBase do not respect custom IRBuilder inserters/folders,
because those were not accessible prior to D73835. Fix this by
making use of existing (and now accessible) IRBuilder methods,
which will handle inserters/folders correctly.

There are some changes in OpenMP tests, where bitcasts now get
constant folded. I've also highlighted one InstCombine test which
now finishes in two rather than three iterations, thanks to new
instructions being inserted into the worklist.

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

4 years ago[SystemZ] Regenerate risbg tests. NFCI.
Simon Pilgrim [Wed, 19 Feb 2020 16:15:23 +0000 (16:15 +0000)]
[SystemZ] Regenerate risbg tests. NFCI.

Pre-commit for some upcoming SimplifyDemandedBits bitrotate handling.

4 years ago[mlir][spirv] Add mlir-vulkan-runner
Denis Khalikov [Wed, 19 Feb 2020 14:11:22 +0000 (09:11 -0500)]
[mlir][spirv] Add mlir-vulkan-runner

Add an initial version of mlir-vulkan-runner execution driver.
A command line utility that executes a MLIR file on the Vulkan by
translating MLIR GPU module to SPIR-V and host part to LLVM IR before
JIT-compiling and executing the latter.

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

4 years ago[lldb][NFC] Remove giant do{...}while(false); in ClangASTSource::FindExternalVisibleDecls
Raphael Isemann [Wed, 19 Feb 2020 16:22:31 +0000 (17:22 +0100)]
[lldb][NFC] Remove giant do{...}while(false); in ClangASTSource::FindExternalVisibleDecls

4 years agotsan: removing redundant loop in ThreadClock::release()
Daniel Fava [Wed, 19 Feb 2020 16:09:18 +0000 (17:09 +0100)]
tsan: removing redundant loop in ThreadClock::release()

The removed loop clears reused for entries at the tail of a SyncClock.
The loop is redundant since those entries were already cleared by the
immediately preceding loop, which iterates over all entries in the
SyncClock (including the tail entries).

4 years ago[mlir] NFC: use ValueRange for BlockArgument in ConvertStandardToLLVM
Alex Zinenko [Wed, 19 Feb 2020 16:15:44 +0000 (17:15 +0100)]
[mlir] NFC: use ValueRange for BlockArgument in ConvertStandardToLLVM

When the conversion was implemented, ValueRange did not support
BlockArguments the code materialized a vector. This is no longer
necessary.

4 years ago[ARM,MVE] Fix predicate types of some intrinsics
Mikhail Maltsev [Wed, 19 Feb 2020 16:24:54 +0000 (16:24 +0000)]
[ARM,MVE] Fix predicate types of some intrinsics

Summary:
Some predicated MVE intrinsics return a vector with element size
different from the input vector element size. In this case the
predicate must type correspond to the output vector type.

The following intrinsics use the incorrect predicate type:
* llvm.arm.mve.mull.int.predicated
* llvm.arm.mve.mull.poly.predicated
* llvm.arm.mve.vshll.imm.predicated

This patch fixes the issue.

Reviewers: simon_tatham, dmgreen, ostannard, MarkMurrayARM

Reviewed By: MarkMurrayARM

Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[AArch64][SVE] Add initial backend support for FP splat_vector
Cameron McInally [Wed, 19 Feb 2020 15:30:44 +0000 (09:30 -0600)]
[AArch64][SVE] Add initial backend support for FP splat_vector

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

4 years ago[gn build] revert e8e078c8bf7987
Nico Weber [Wed, 19 Feb 2020 16:10:19 +0000 (11:10 -0500)]
[gn build] revert e8e078c8bf7987

Now that I've updated ancient goma clients on the bots, this should
work. (Internal goma bug: b/139410332, fixed months ago.)

4 years ago[AMDGPU][ConstantFolding] Fold llvm.amdgcn.fmul.legacy intrinsic
Jay Foad [Mon, 17 Feb 2020 10:32:57 +0000 (10:32 +0000)]
[AMDGPU][ConstantFolding] Fold llvm.amdgcn.fmul.legacy intrinsic

Reviewers: arsenm, rampitec, nhaehnle

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[Hexagon][NFC] Rename VK_Hexagon_PCREL to VK_PCREL
Stefan Pintilie [Wed, 19 Feb 2020 15:47:14 +0000 (09:47 -0600)]
[Hexagon][NFC] Rename VK_Hexagon_PCREL to VK_PCREL

On PowerPC we will soon need to use pcrel to indicate PC Relative addressing.
Renamed the Hexagon specific variant kind to a non target specific VK so that
it can be used on both Hexagon and PowerPC.

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

4 years agoAdd <128 x i1> as an intrinsic type
Krzysztof Parzyszek [Fri, 7 Feb 2020 15:30:31 +0000 (09:30 -0600)]
Add <128 x i1> as an intrinsic type

4 years ago[CGP] Adjust CodeGen tests after e01a3d49c22
Florian Hahn [Wed, 19 Feb 2020 15:05:00 +0000 (16:05 +0100)]
[CGP] Adjust CodeGen tests after e01a3d49c22

4 years ago[PatternMatch] Match XOR variant of unsigned-add overflow check.
Florian Hahn [Wed, 19 Feb 2020 13:37:30 +0000 (14:37 +0100)]
[PatternMatch] Match XOR variant of unsigned-add overflow check.

Instcombine folds (a + b <u a) to (a ^ -1 <u b) and that does not match
the expected pattern in CodeGenPerpare via UAddWithOverflow.

This causes a regression over Clang 7 on both X86 and AArch64:
https://gcc.godbolt.org/z/juhXYV

This patch extends UAddWithOverflow to also catch the XOR case, if the
XOR is only used in the ICMP. This covers just a single case, but I'd
like to make sure I am not missing anything before tackling the other
cases.

Reviewers: nikic, RKSimon, lebedev.ri, spatel

Reviewed By: nikic, lebedev.ri

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

4 years agoAMDGPU/GlobalISel: Select MUBUF path for global atomic cmpxchg
Matt Arsenault [Mon, 10 Feb 2020 03:32:44 +0000 (22:32 -0500)]
AMDGPU/GlobalISel: Select MUBUF path for global atomic cmpxchg

I'm not sure why this isn't a pattern, but the DAG manually selects
this.

4 years ago[AArch64][ASMParser] Refuse equal source/destination for LDRAA/LDRAB
Pierre-vh [Wed, 19 Feb 2020 09:46:50 +0000 (09:46 +0000)]
[AArch64][ASMParser] Refuse equal source/destination for LDRAA/LDRAB

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

4 years ago[lldb][NFC] Modernize test setup code in several lang/cpp tests
Raphael Isemann [Wed, 19 Feb 2020 13:29:37 +0000 (14:29 +0100)]
[lldb][NFC] Modernize test setup code in several lang/cpp tests

All these tests can just call lldbutil.run_to_source_breakpoint
instead of reimplementing it.

4 years ago[lldb] Remove Windows X-fail for TestCPPAuto and TestStepTarget
Raphael Isemann [Wed, 19 Feb 2020 14:03:40 +0000 (15:03 +0100)]
[lldb] Remove Windows X-fail for TestCPPAuto and TestStepTarget

TestCPPAuto was only failing on windows due to the std::string
copying (which was not related at all to 'auto' functionality).

TestStepTarget is now also passing but that seems more that we
now have by accident the right behavior in Windows. I'll remove
the x-fail just to make the bot green again.

4 years ago[TableGen] Diagnose undefined fields when generating searchable tables
Jay Foad [Fri, 7 Feb 2020 11:13:51 +0000 (11:13 +0000)]
[TableGen] Diagnose undefined fields when generating searchable tables

Summary:
Previously TableGen would crash trying to print the undefined value as
an integer.

Change-Id: I3900071ceaa07c26acafb33bc49966d7d7a02828

Reviewers: nhaehnle

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[OpenCL] Only declare _sat conversions for integer types
Sven van Haastregt [Wed, 19 Feb 2020 13:52:58 +0000 (13:52 +0000)]
[OpenCL] Only declare _sat conversions for integer types

The `-fdeclare-opencl-builtins` option was accepting saturated
conversions for non-integer types, which contradicts both the OpenCL
specification (v2.0 s6.2.3) and Clang's opencl-c.h file.

4 years ago[MLIR] Add naive fusion of parallel loops.
Alexander Belyaev [Wed, 19 Feb 2020 12:39:57 +0000 (13:39 +0100)]
[MLIR] Add naive fusion of parallel loops.

4 years ago[lldb][NFC] Pointer to reference conversion for CompilerDeclContext params in ClangEx...
Raphael Isemann [Wed, 19 Feb 2020 13:14:56 +0000 (14:14 +0100)]
[lldb][NFC] Pointer to reference conversion for CompilerDeclContext params in ClangExpressionDeclMap.

Follow up for f9568a95493aea3ea813bd37cb8c084ec4294e38.

4 years agoRecommit: "[llvm-exegesis] Improve error reporting in Assembler.cpp"
Miloš Stojanović [Wed, 19 Feb 2020 13:34:12 +0000 (14:34 +0100)]
Recommit: "[llvm-exegesis] Improve error reporting in Assembler.cpp"

Summary: Commit 63bb9fee525f8f29fd9c2174fa7f15573c3d1fd7 was reverted in
7603bfb4b0a6a90137d47f0182a490fe54bf7ca3 because it broke builds that treat
warnings as errors.
This commit updates the calls to `assembleToStream()` in tests to check that
the return value is valid.

Original commit message:

Followup to D74084.
Replace the use of `report_fatal_error()` with returning the error to
`llvm-exegesis.cpp` and handling it there.

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

4 years ago[lldb/DWARF] Add support for location lists in package files
Pavel Labath [Tue, 18 Feb 2020 12:33:59 +0000 (13:33 +0100)]
[lldb/DWARF] Add support for location lists in package files

The only thing needed was to account for the offset from the
debug_cu_index section when searching for the location list.

This patch also fixes a bug in the Module::ParseAllDebugSymbols
function, which meant that we would only parse the variables of the
first compile unit in the module. This function is only used from
lldb-test, so this does not fix any real issue, besides preventing me
from writing a test for this patch.

4 years agoErrorTest: Break up "ErrorMatchers" test
Pavel Labath [Tue, 18 Feb 2020 17:59:16 +0000 (18:59 +0100)]
ErrorTest: Break up "ErrorMatchers" test

This test was getting a bit long. Before adding more checks, group the
existing checks according to the matcher used, and break it up into
smaller tests.

4 years ago[lldb] Remove some unnecessary includes from test sources
Raphael Isemann [Wed, 19 Feb 2020 13:00:25 +0000 (14:00 +0100)]
[lldb] Remove some unnecessary includes from test sources

4 years ago[ARM][LowOverheadLoops] Check loop liveouts
Sam Parker [Tue, 18 Feb 2020 14:05:39 +0000 (14:05 +0000)]
[ARM][LowOverheadLoops] Check loop liveouts

Check that no Q-regs are live out of the loop, unless the instruction
within the loop is predicated on the vctp.

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

4 years agoSupport OptionalAttr inside a StructAttr
Tamas Berghammer [Tue, 18 Feb 2020 18:04:26 +0000 (18:04 +0000)]
Support OptionalAttr inside a StructAttr

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

4 years ago[ARM] VMLAVA reduction patterns
David Green [Mon, 17 Feb 2020 12:00:17 +0000 (12:00 +0000)]
[ARM] VMLAVA reduction patterns

Similar to VADDV and VADDLV that have been added recently, this adds
lowering and patterns for VMLAV, VMLAVA, VMLALV and VMLALVA. They
perform the same roles as the add's, just folding a mul into the same
instruction (and so taking two inputs). As such, they need to be lowered
in the same way as the types are often not legal.

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

4 years ago[lldb] Skip failing parts of TestCppConstructors that use 'new' on Windows
Raphael Isemann [Wed, 19 Feb 2020 12:21:51 +0000 (13:21 +0100)]
[lldb] Skip failing parts of TestCppConstructors that use 'new' on Windows

4 years ago[lldb] Make comparing RegisterInfo::[alt_]name's pointer value less footy-shooty
Raphael Isemann [Wed, 19 Feb 2020 10:27:10 +0000 (11:27 +0100)]
[lldb] Make comparing RegisterInfo::[alt_]name's pointer value less footy-shooty

Comparing those two `const char *` values relies on the assumption that both
strings were created by a ConstString. Let's check that assumption with an
assert as otherwise this code silently does nothing and that's not great.

4 years ago[AArch64][SVE] CodeGen of ACLE Builtin Types
Sander de Smalen [Wed, 19 Feb 2020 10:44:56 +0000 (10:44 +0000)]
[AArch64][SVE] CodeGen of ACLE Builtin Types

Summary:
This patch adds codegen support for the ACLE builtin types added in:

  https://reviews.llvm.org/D62960

so that the ACLE builtin types are emitted as corresponding scalable
vector types in LLVM.

Reviewers: rsandifo-arm, rovka, rjmccall, efriedma

Reviewed By: efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits, cfe-commits

Tags: #clang, #llvm

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

4 years ago[yaml2obj] - Change the order of implicitly created sections.
Georgii Rymar [Mon, 17 Feb 2020 17:27:43 +0000 (20:27 +0300)]
[yaml2obj] - Change the order of implicitly created sections.

.dynsym and .dynstr are allocatable and therefore normally are placed
before non-allocatable .strtab, .shstrtab, .symtab sections.
But we are placing them after currently what creates a mix of
alloc/non-alloc sections and does not look normal.

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

4 years agoRevert "Reland D74436 "Change clang option -ffp-model=precise to select ffp-contract...
Oliver Stannard [Wed, 19 Feb 2020 12:03:27 +0000 (12:03 +0000)]
Revert "Reland D74436 "Change clang option -ffp-model=precise to select ffp-contract=on"""

Reverting because this patch is causing ~20 llvm-test-suite failures on
a number of different bots:
* http://lab.llvm.org:8011/builders/clang-cmake-armv8-lld/builds/3366
* http://lab.llvm.org:8011/builders/clang-cmake-aarch64-lld/builds/8222
* http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/13275
* http://lab.llvm.org:8011/builders/clang-s390x-linux-lnt/builds/17213

This reverts commit cd2c5af6dfd6e32ee7043894bcb42981ce99e8ac.

4 years ago[AMDGPU] performCvtF32UByteNCombine - add SHL and SimplifyMultipleUseDemandedBits...
Simon Pilgrim [Wed, 19 Feb 2020 11:45:45 +0000 (11:45 +0000)]
[AMDGPU] performCvtF32UByteNCombine - add SHL and SimplifyMultipleUseDemandedBits support

This is part of the work to remove SelectionDAG::GetDemandedBits and just use SimplifyMultipleUseDemandedBits.

Recent experiments raised some v_cvt_f32_ubyte*_e32 regressions, so I've added some additional abilities to performCvtF32UByteNCombine to help unpack byte data more aggressively.

We still don't remove all OR(SHL,SRL) patterns as some of the regenerated nodes don't get combined again, but we are getting closer.

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

4 years ago[ARM] MVE VADDLV lowering
David Green [Mon, 17 Feb 2020 11:35:22 +0000 (11:35 +0000)]
[ARM] MVE VADDLV lowering

Following on from the extra VADDV lowering, this extends things to
handle VADDLV which allows summing values into a pair of i32 registers,
together treated as a i64. This needs to be done in DAGCombine too as
the types are otherwise illegal, which is a fairly simple addition on
top of the existing code.

There is also a VADDLVA instruction handled here, that adds the incoming
values from the two general purpose registers. As opposed to the
non-long version where we could just add patterns for add(x, VADDV), the
long version needs to handle this early before the i64 has being split
into too many pieces.

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

4 years ago[MIPS GlobalISel] Legalize non-power-of-2 and unaligned load and store
Petar Avramovic [Wed, 19 Feb 2020 11:01:48 +0000 (12:01 +0100)]
[MIPS GlobalISel] Legalize non-power-of-2 and unaligned load and store

Custom legalize non-power-of-2 and unaligned load and store for MIPS32r5
and older, custom legalize non-power-of-2 load and store for MIPS32r6.

Don't attempt to combine non power of 2 loads or unaligned loads when
subtarget doesn't support them (MIPS32r5 and older).

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

4 years ago[MIPS GlobalISel] Select 4 byte unaligned load and store
Petar Avramovic [Wed, 19 Feb 2020 10:35:43 +0000 (11:35 +0100)]
[MIPS GlobalISel] Select 4 byte unaligned load and store

Improve legality checks for load and store, 4 byte scalar
load and store are now legal for all subtargets.
During regbank selection 4 byte unaligned loads and stores
for MIPS32r5 and older get mapped to gprb.
Select 4 byte unaligned loads and stores for MIPS32r5.
Fix tests that unintentionally had unaligned load or store.

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

4 years ago[TargetLower] Update shouldFormOverflowOp check if math is used.
Florian Hahn [Wed, 19 Feb 2020 09:00:59 +0000 (10:00 +0100)]
[TargetLower] Update shouldFormOverflowOp check if math is used.

On some targets, like SPARC, forming overflow ops is only profitable if
the math result is used: https://godbolt.org/z/DxSmdB
This patch adds a new MathUsed parameter to allow the targets
to make the decision and defaults to only allowing it
if the math result is used. That is the conservative choice.

This patch also updates AArch64ISelLowering, X86ISelLowering,
ARMISelLowering.h, SystemZISelLowering.h to allow forming overflow
ops if the math result is not used. On those targets using the
overflow intrinsic for the overflow check only generates better code.

Reviewers: nikic, RKSimon, lebedev.ri, spatel

Reviewed By: lebedev.ri

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