platform/upstream/llvm.git
4 years ago[Concepts] Constraint Enforcement & Diagnostics
Saar Raz [Thu, 24 Oct 2019 21:09:37 +0000 (00:09 +0300)]
[Concepts] Constraint Enforcement & Diagnostics

Part of the C++20 concepts implementation effort.
- Associated constraints (requires clauses, currently) are now enforced when instantiating/specializing templates and when considering partial specializations and function overloads.
- Elaborated diagnostics give helpful insight as to why the constraints were not satisfied.
Phabricator: D41569

4 years agoFix cppcheck shadow variable warning. NFCI.
Simon Pilgrim [Thu, 24 Oct 2019 21:13:55 +0000 (22:13 +0100)]
Fix cppcheck shadow variable warning. NFCI.

4 years agoFollow up on D69112, fix build break for skipping field initialization
jasonliu [Thu, 24 Oct 2019 21:03:16 +0000 (21:03 +0000)]
Follow up on D69112, fix build break for skipping field initialization

Clang emit warning for skipping field initialization. Add {} to fix it.
This is a patch that fixes issue introduced in https://reviews.llvm.org/D69112

4 years agoFollow on to Namespace fixup for D68340
David Tenty [Thu, 24 Oct 2019 21:01:17 +0000 (17:01 -0400)]
Follow on to Namespace fixup for D68340

remove using directive that can make lookup ambiguous.

4 years agoFix MSVC "switch statement contains 'default' but no 'case' labels" warning. NFCI.
Simon Pilgrim [Thu, 24 Oct 2019 20:39:56 +0000 (13:39 -0700)]
Fix MSVC "switch statement contains 'default' but no 'case' labels" warning. NFCI.

4 years agoFix MSVC "not all control paths return a value" warnings. NFCI.
Simon Pilgrim [Thu, 24 Oct 2019 20:36:34 +0000 (13:36 -0700)]
Fix MSVC "not all control paths return a value" warnings. NFCI.

4 years ago[www] Change URLs to HTTPS.
Stephan T. Lavavej [Wed, 23 Oct 2019 23:42:47 +0000 (16:42 -0700)]
[www] Change URLs to HTTPS.

This changes most URLs in llvm's html files to HTTPS. Most changes were
search-and-replace with manual verification; some changes were manual.
For a few URLs, the websites were performing redirects or had changed
their anchors; I fixed those up manually. This consistently uses the
official https://wg21.link redirector. This also strips trailing
whitespace and fixes a couple of typos.

Fixes D69363.

There are a very small number of dead links for which I don't know any
replacements (they are equally dead as HTTP or HTTPS):

https://llvm.org/cmds/llvm2cpp.html
https://llvm.org/devmtg/2010-11/videos/Grosser_Polly-desktop.mp4
https://llvm.org/devmtg/2010-11/videos/Grosser_Polly-mobile.mp4
https://llvm.org/devmtg/2011-11/videos/Grosser_PollyOptimizations-desktop.mov
https://llvm.org/devmtg/2011-11/videos/Grosser_PollyOptimizations-mobile.mp4
https://llvm.org/perf/db_default/v4/nts/22463
https://polly.llvm.org/documentation/memaccess.html

4 years agoRevert "Disable exit-on-SIGPIPE in lldb"
Vedant Kumar [Thu, 24 Oct 2019 19:08:24 +0000 (12:08 -0700)]
Revert "Disable exit-on-SIGPIPE in lldb"

This reverts commit 32ce14e55e5a99dd99c3b4fd4bd0ccaaf2948c30.

In post-commit review, Pavel pointed out that there's a simpler way to
ignore SIGPIPE in lldb that doesn't rely on llvm's handlers.

4 years ago[clang-format] update documentation
paulhoad [Thu, 24 Oct 2019 20:08:57 +0000 (21:08 +0100)]
[clang-format] update documentation

Summary:
  - Added example code for BreakStringLiterals;

Reviewers: MyDeveloperDay

Reviewed By: MyDeveloperDay

Patch By: mrexodia

Subscribers: cfe-commits, MyDeveloperDay

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

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

4 years ago[ObjC][ARC] Check whether the return and parameter types of the old and
Akira Hatanaka [Wed, 23 Oct 2019 14:38:52 +0000 (07:38 -0700)]
[ObjC][ARC] Check whether the return and parameter types of the old and
new functions are compatible before upgrading a function call to an
intrinsic call.

Sometimes users insert calls to ARC runtime functions that are not
compatible with the corresponding intrinsic functions (for example,
'i8* @objc_storeStrong' instead of 'void @objc_storeStrong'). Don't
upgrade those calls.

rdar://problem/56447127

4 years ago[GlobalISel][AArch64][AMDGPU][X86] Teach LegalizationArtifactCombiner to combine...
Craig Topper [Thu, 24 Oct 2019 19:08:02 +0000 (12:08 -0700)]
[GlobalISel][AArch64][AMDGPU][X86] Teach LegalizationArtifactCombiner to combine trunc(g_constant).

This allows X86 to properly form shift by immediate instructions
since we require an 8-bit constant to match the imported
SelectionDAG patterns.

4 years agoNamespace fixup for D68340 build on MSVC
David Tenty [Thu, 24 Oct 2019 19:47:08 +0000 (15:47 -0400)]
Namespace fixup for D68340 build on MSVC

we seem to run into issues with nested namespace lookups in recently landed
D68340 so just make them explicit.

4 years ago[clang-format] Remove duplciate code from Invalid BOM detection
paulhoad [Thu, 24 Oct 2019 19:24:03 +0000 (20:24 +0100)]
[clang-format] Remove duplciate code from Invalid BOM detection

Summary:
Review comments on {D68767} asked that this duplicated code in clang-format was moved to one central location that being SourceManager (where it had originally be copied from I assume)

Moved function into static function  ContentCache::getInvalidBOM(...)  - (closest class to where it was defined before)
Updated clang-format to call this static function

Added unit tests for said new function in BasicTests

Sorry not my normal code area so may have the wrong reviewers. (but your names were on the recent history)

Reviewers: bruno, arphaman, klimek, owenpan, mitchell-stellar, dexonsmith

Reviewed By: owenpan

Subscribers: cfe-commits

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

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

4 years ago[ARM] Fixup MVE intrinsic tests with no assert builds
David Green [Thu, 24 Oct 2019 18:56:08 +0000 (19:56 +0100)]
[ARM] Fixup MVE intrinsic tests with no assert builds

The labels will be missing, so -fno-discard-value-names is added to the tests.

4 years agoAdd AIX toolchain and basic linker functionality
stevewan [Thu, 24 Oct 2019 18:47:32 +0000 (14:47 -0400)]
Add AIX toolchain and basic linker functionality

Summary:
This patch adds AIX toolchain infrastructure into driver, and enables AIX
system linker invocation with some basic functionality support

Reviewers: daltenty, hubert.reinterpretcast, jasonliu, Xiangling_L

Reviewed By: jasonliu

Subscribers: Xiangling_L, jasonliu, ormris, wuzish, nemanjai, mgorny, kbarton, jfb, jsji, cfe-commits

Tags: #clang

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

4 years ago[ARM] Attempt to fixup MveEmitter warnings
David Green [Thu, 24 Oct 2019 18:35:34 +0000 (19:35 +0100)]
[ARM] Attempt to fixup MveEmitter warnings

Change-Id: I3fb06de2202c3b7a9ce511a40e758d0971ef9fdb

4 years ago[ELF] -r: fix crash when processing a SHT_REL[A] that relocates a SHF_MERGE after...
Fangrui Song [Thu, 24 Oct 2019 17:52:19 +0000 (10:52 -0700)]
[ELF] -r: fix crash when processing a SHT_REL[A] that relocates a SHF_MERGE after D67504/r372734

Fix PR43767

In -r mode, when processing a SHT_REL[A] that relocates a SHF_MERGE, sec->getRelocatedSection() is a
MergeInputSection and its parent is an OutputSection but is asserted to
be a SyntheticSection (MergeSyntheticSection) in LinkerScript.cpp:addInputSec().
 ##
The code path is not exercised in non -r mode because the relocated
section changed from MergeInputSection to InputSection.

Reorder the code to make the non -r logic apply to -r as well, thus fix
the crash.

Reviewed By: peter.smith

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

4 years ago[lldb] [Python] Do not attempt to flush() a read-only fd
Michal Gorny [Wed, 23 Oct 2019 13:17:25 +0000 (06:17 -0700)]
[lldb] [Python] Do not attempt to flush() a read-only fd

Summary:
When creating a FileSP object, do not flush() the underlying file unless
it is open for writing.  Attempting to flush() a read-only fd results
in EBADF on NetBSD.

Reviewers: lawrence_danna, labath, krytarowski

Reviewed By: lawrence_danna, labath

Subscribers: lldb-commits

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

4 years ago[clang-format] Remove the dependency on frontend
paulhoad [Thu, 24 Oct 2019 18:01:47 +0000 (19:01 +0100)]
[clang-format] Remove the dependency on frontend

Summary:
Address review comments from {D68554} by trying to drop the dependency again on Frontend whilst keeping the same format diagnostic messages

Not completely happy with having to do a split in order to get the StringRef for the Line the error occurred on, but could see a way to use SourceManager and SourceLocation to give me a single line?

But this removes the dependency on frontend which should keep the binary size down.

Reviewers: thakis, klimek, mitchell-stellar

Reviewed By: klimek

Subscribers: mgorny, cfe-commits

Tags: #clang, #clang-format

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

4 years ago[AMDGPU] Fix mfma scheduling crash
Stanislav Mekhanoshin [Thu, 24 Oct 2019 17:34:47 +0000 (10:34 -0700)]
[AMDGPU] Fix mfma scheduling crash

An SUnit can be neither intruction not SDNode. It is all
null if represents a nop. Fixed a crash on using SU->getInstr().

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

4 years agoSpeculative build fix for GCC 5.3.0
Hans Wennborg [Thu, 24 Oct 2019 17:57:35 +0000 (19:57 +0200)]
Speculative build fix for GCC 5.3.0

It was failing with

llvm/lib/MC/XCOFFObjectWriter.cpp:168:53: error: array must be initialized with a brace-enclosed initializer
   std::array<Section *const, 2> Sections{&Text, &BSS};
                                                     ^

4 years ago[CMake] Split logic across test suite subdirectories (NFC)
Jonas Devlieghere [Thu, 24 Oct 2019 17:54:48 +0000 (10:54 -0700)]
[CMake] Split logic across test suite subdirectories (NFC)

The top-level CMake file in the test directory can be simplified by
moving relevant configuration options into the corresponding
subdirectories. Doing so makes it easier to understand what CMake
options are needed by the different test suites.

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

4 years ago[llvm-ifs][NFC] Adds TODO comment for dropping ObjectFileFormat on yaml format.
Puyan Lotfi [Tue, 22 Oct 2019 16:47:10 +0000 (09:47 -0700)]
[llvm-ifs][NFC] Adds TODO comment for dropping ObjectFileFormat on yaml format.

4 years ago[NFC] Remove redundant lines
dfukalov [Wed, 23 Oct 2019 17:01:14 +0000 (20:01 +0300)]
[NFC] Remove redundant lines

Reviewers: rampitec

Reviewed By: rampitec

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] Fold one-use variable into assert
Benjamin Kramer [Thu, 24 Oct 2019 15:57:24 +0000 (17:57 +0200)]
[InstCombine] Fold one-use variable into assert

Avoids warnings in Release builds. NFC.

4 years ago[NFC][XCOFF][AIX] Serialize object file writing for each CsectGroup
jasonliu [Thu, 24 Oct 2019 15:19:12 +0000 (15:19 +0000)]
[NFC][XCOFF][AIX] Serialize object file writing for each CsectGroup

Summary:

Right now we handle each CsectGroup(ProgramCodeCsects, BSSCsects)
individually when assigning indices, writing symbol table, and
writing section raw data. However, there is already a pattern there,
and we could common up those actions for every CsectGroup. This will
 make adding new CsectGroup(Read Write data, Read only data, TC/TOC,
 mergeable string) easier, and less error prone.

Reviewed by: sfertile, daltenty, DiggerLin

Approved by: daltenty

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

4 years ago[InstCombine] Known-bits optimization for ARM MVE VADC.
Simon Tatham [Wed, 11 Sep 2019 09:29:56 +0000 (10:29 +0100)]
[InstCombine] Known-bits optimization for ARM MVE VADC.

The MVE VADC instruction reads and writes the carry bit at bit 29 of
the FPSCR register. The corresponding ACLE intrinsic is specified to
work with an integer in which the carry bit is stored at bit 0. So if
a user writes a code sequence in C that passes the carry from one VADC
to the next, like this,

    s0 = vadcq_u32(a0, b0, &carry);
    s1 = vadcq_u32(a1, b1, &carry);

then clang will generate IR for each of those operations that shifts
the carry bit up into bit 29 before the VADC, and after it, shifts it
back down and masks off all but the low bit. But in this situation
what you really wanted was two consecutive VADC instructions, so that
the second one directly reads the value left in FPSCR by the first,
without wasting several instructions on pointlessly clearing the other
flag bits in between.

This commit explains to InstCombine that the other bits of the flags
operand don't matter, and adds a test that demonstrates that all the
code between the two VADC instructions can be optimized away as a
result.

Reviewers: dmgreen, miyuki, ostannard

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[clang,ARM] Initial ACLE intrinsics for MVE.
Simon Tatham [Mon, 2 Sep 2019 14:50:50 +0000 (15:50 +0100)]
[clang,ARM] Initial ACLE intrinsics for MVE.

This commit sets up the infrastructure for auto-generating <arm_mve.h>
and doing clang-side code generation for the builtins it relies on,
and demonstrates that it works by implementing a representative sample
of the ACLE intrinsics, more or less matching the ones introduced in
LLVM IR by D67158,D68699,D68700.

Like NEON, that header file will provide a set of vector types like
uint16x8_t and C functions with names like vaddq_u32(). Unlike NEON,
the ACLE spec for <arm_mve.h> includes a polymorphism system, so that
you can write plain vaddq() and disambiguate by the vector types you
pass to it.

Unlike the corresponding NEON code, I've arranged to make every user-
facing ACLE intrinsic into a clang builtin, and implement all the code
generation inside clang. So <arm_mve.h> itself contains nothing but
typedefs and function declarations, with the latter all using the new
`__attribute__((__clang_builtin))` system to arrange that the user-
facing function names correspond to the right internal BuiltinIDs.

So the new MveEmitter tablegen system specifies the full sequence of
IRBuilder operations that each user-facing ACLE intrinsic should
translate into. Where possible, the ACLE intrinsics map to standard IR
operations such as vector-typed `add` and `fadd`; where no standard
representation exists, I call down to the sample IR intrinsics
introduced in an earlier commit.

Doing it like this means that you get the polymorphism for free just
by using __attribute__((overloadable)): the clang overload resolution
decides which function declaration is the relevant one, and _then_ its
BuiltinID is looked up, so by the time we're doing code generation,
that's all been resolved by the standard system. It also means that
you get really nice error messages if the user passes the wrong
combination of types: clang will show the declarations from the header
file and explain why each one doesn't match.

(The obvious alternative approach would be to have wrapper functions
in <arm_mve.h> which pass their arguments to the underlying builtins.
But that doesn't work in the case where one of the arguments has to be
a constant integer: the wrapper function can't pass the constantness
through. So you'd have to do that case using a macro instead, and then
use C11 `_Generic` to handle the polymorphism. Then you have to add
horrible workarounds because `_Generic` requires even the untaken
branches to type-check successfully, and //then// if the user gets the
types wrong, the error message is totally unreadable!)

Reviewers: dmgreen, miyuki, ostannard

Subscribers: mgorny, javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

4 years ago[clang] New __attribute__((__clang_arm_mve_alias)).
Simon Tatham [Mon, 2 Sep 2019 14:35:09 +0000 (15:35 +0100)]
[clang] New __attribute__((__clang_arm_mve_alias)).

This allows you to declare a function with a name of your choice (say
`foo`), but have clang treat it as if it were a builtin function (say
`__builtin_foo`), by writing

  static __inline__ __attribute__((__clang_arm_mve_alias(__builtin_foo)))
  int foo(args);

I'm intending to use this for the ACLE intrinsics for MVE, which have
to be polymorphic on their argument types and also need to be
implemented by builtins. To avoid having to implement the polymorphism
with several layers of nested _Generic and make error reporting
hideous, I want to make all the user-facing intrinsics correspond
directly to clang builtins, so that after clang resolves
__attribute__((overloadable)) polymorphism it's already holding the
right BuiltinID for the intrinsic it selected.

However, this commit itself just introduces the new attribute, and
doesn't use it for anything.

To avoid unanticipated side effects if this attribute is used to make
aliases to other builtins, there's a restriction mechanism: only
(BuiltinID, alias) pairs that are approved by the function
ArmMveAliasValid() will be permitted. At present, that function
doesn't permit anything, because the Tablegen that will generate its
list of valid pairs isn't yet implemented. So the only test of this
facility is one that checks that an unapproved builtin _can't_ be
aliased.

Reviewers: dmgreen, miyuki, ostannard

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[ARM] Add IR intrinsics for MVE VLD[24] and VST[24].
Simon Tatham [Mon, 7 Oct 2019 16:03:46 +0000 (17:03 +0100)]
[ARM] Add IR intrinsics for MVE VLD[24] and VST[24].

The VST2 and VST4 instructions take two or four vector registers as
input, and store part of each register to memory in an interleaved
pattern. They come in variants indicating which part of each register
they store (VST20 and VST21; VST40 to VST43 inclusive); the intention
is that issuing each of those variants in turn has the combined effect
of loading or storing the whole set of registers to a memory block of
equal size. The corresponding VLD2 and VLD4 instructions load from
memory in the same interleaved format: each one overwrites only part
of its output register set, and again, the idea is that if you use
VLD4{0,1,2,3} or VLD2{0,1} together, you end up having written to the
whole of each register.

I've implemented the stores and loads quite differently. The loads
were easiest to implement as a single intrinsic that expands to all
four VLD4x instructions or both VLD2x, delivering four complete output
registers. (Implementing each individual load as a separate
instruction taking four input registers to partially overwrite is
possible in theory, but pointless, and when I tried it, I found it
would need extra work to get the register allocation not to be
horrible.) Since that intrinsic delivers multiple outputs, it has to
be instruction-selected in custom C++.

But the store instructions are easier to model individually, because
they don't overwrite any register at all and you can write a DAG Isel
pattern in Tablegen for each one.

Hence, my new intrinsic `int_arm_mve_vld4q` expands to four load
instructions, delivers four full output vectors, and is handled by C++
code, whereas `int_arm_mve_vst4q` expands to just one store
instruction, takes four input vectors and a constant indicating which
lanes to store, and is handled entirely in Tablegen. (And similarly
for vld2q/vst2q.) This is asymmetric, but it was the easiest way to do
each one.

Reviewers: dmgreen, miyuki, ostannard

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ARM] Add some sample IR MVE intrinsics with C++ isel.
Simon Tatham [Mon, 7 Oct 2019 16:05:48 +0000 (17:05 +0100)]
[ARM] Add some sample IR MVE intrinsics with C++ isel.

This adds some initial example IR intrinsics for MVE instructions that
deliver multiple output values, and hence, have to be instruction-
selected by custom C++ code instead of Tablegen patterns.

I've added the writeback gather load instructions (taking a vector of
base addresses and a single common offset, returning a vector of
loaded values and an updated vector of base addresses); one example
from the long shift family (taking and returning a 64-bit value in two
GPRs); and the VADC instruction (which propagates a carry bit from
each vector-lane addition to the next, taking an input carry flag in
FPSCR and outputting the final one in FPSCR as well).

To support the VPT-predicated forms of these instructions, I've
written some helper functions to add the cluster of MVE predicate
operands to the end of a MachineInstr. `AddMVEPredicateToOps` is used
when the instruction actually is predicated (so it takes a predicate
mask argument), and `AddEmptyMVEPredicateToOps` is for when the
instruction is unpredicated (so it fills in $noreg for the mask). Each
one comes in a form suitable for `vpred_n`, and one for `vpred_r`
which takes the extra 'inactive' parameter.

For VADC, the representation of the carry flag in the IR intrinsic is
a word intended to be moved directly to and from `FPSCR_nzcvqc`, i.e.
with the carry flag in bit 29 of the word. (The user-facing ACLE
intrinsic will want it to be in bit 0, but I'll do that on the clang
side.)

Reviewers: dmgreen, miyuki, ostannard

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ARM] Begin adding IR intrinsics for MVE instructions.
Simon Tatham [Mon, 7 Oct 2019 16:00:51 +0000 (17:00 +0100)]
[ARM] Begin adding IR intrinsics for MVE instructions.

This commit, together with the next few, will add a representative
sample of the kind of IR intrinsics that we'll need in order to
implement the user-facing ACLE intrinsics for MVE. Supporting all of
them will take more work; the intention of this initial series of
commits is to implement an intrinsic or two from lots of different
categories, as examples and proofs of concept.

This initial commit introduces a small number of IR intrinsics for
instructions simple enough that they can use Tablegen ISel patterns:
the predicated versions of the VADD and VSUB instructions (both
integer and FP), VMIN and VMAX, and the float->half VCVT instruction
(predicated and unpredicated).

When using VPT-predicated instructions in automatic code generation,
it will be convenient to specify the predicate value as a vector of
the appropriate number of i1. To make it easy to specify all sizes of
an instruction in one go and give each one the matching predicate
vector type, I've added a system of Tablegen informational records
describing MVE's vector types: each one gives the underlying LLVM IR
ValueType (which may not be the same if the MVE vector is of
explicitly signed or unsigned integers) and an appropriate vNi1 to use
as the predicate vector.

(Also, those info records include the usual encoding for the types, so
that as we add associations between each instruction encoding and one
of the new `MVEVectorVTInfo` records, we can remove some of the
existing template parameters and replace them with references to the
vector type info's fields.)

The user-facing ACLE intrinsics will receive a predicate mask as a
16-bit integer, so I've also provided a pair of intrinsics i2v and
v2i, to convert between an integer and a vector of i1 by just changing
the register class.

Reviewers: dmgreen, miyuki, ostannard

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU] Skip additional folding on the same operand.
Michael Liao [Wed, 23 Oct 2019 19:19:06 +0000 (15:19 -0400)]
[AMDGPU] Skip additional folding on the same operand.

Reviewers: rampitec, arsenm

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

Tags: #llvm

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

4 years agoFix compilation warning on the trailing whitespace. NFC.
Michael Liao [Thu, 24 Oct 2019 13:54:08 +0000 (09:54 -0400)]
Fix compilation warning on the trailing whitespace. NFC.

4 years ago[clangd] Fix case of variables and functions in code complete tests. NFC
Ilya Biryukov [Thu, 24 Oct 2019 13:40:23 +0000 (15:40 +0200)]
[clangd] Fix case of variables and functions in code complete tests. NFC

4 years ago[docs] Add Mips as a supported architecture in GettingStarted.rst
Simon Atanasyan [Thu, 24 Oct 2019 12:54:58 +0000 (15:54 +0300)]
[docs] Add Mips as a supported architecture in GettingStarted.rst

Patch by MiloÅ¡ Stojanović

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

4 years ago[docs] Update link to the MIPS 64-bit ELF object file specification
Simon Atanasyan [Thu, 24 Oct 2019 12:52:19 +0000 (15:52 +0300)]
[docs] Update link to the MIPS 64-bit ELF object file specification

Patch by MiloÅ¡ Stojanović

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

4 years ago[MIPS GlobalISel] Select MSA vector generic and builtin fabs
Petar Avramovic [Thu, 24 Oct 2019 11:45:26 +0000 (13:45 +0200)]
[MIPS GlobalISel] Select MSA vector generic and builtin fabs

selectImpl is able to select G_FABS when we set bank for vector
operands to fprb. Add detailed tests.
Note: G_FABS is generated from llvm-ir intrinsics llvm.fabs.*,
and at the moment MIPS is not able to generate this intrinsic for
vector type (some targets generate vector llvm.fabs.* from calls
to a builtin function).
We can handle fabs using __builtin_msa_fmax_a_<format> and passing
same vector as both arguments. __builtin_msa_fmax_a_<format> will
be directly selected into FMAX_A_<format> in legalizeIntrinsic.

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

4 years agoDon't add -fsplit-lto-unit for thin LTO builds with PS4 and Darwin toolchains
evgeny [Thu, 24 Oct 2019 11:10:03 +0000 (14:10 +0300)]
Don't add -fsplit-lto-unit for thin LTO builds with PS4 and Darwin toolchains

These toolchains use legacy thin LTO API, which is not capable of unit splitting
Differential revision: https://reviews.llvm.org/D69173

4 years ago[compiler-rt] Expose __hwasan_tag_mismatch_stub
David Tellenbach [Thu, 24 Oct 2019 10:16:06 +0000 (11:16 +0100)]
[compiler-rt] Expose __hwasan_tag_mismatch_stub

Summary:
GCC would like to emit a function call to report a tag mismatch
rather than hard-code the `brk` instruction directly.

__hwasan_tag_mismatch_stub contains most of the functionality to do
this already, but requires exposure in the dynamic library.

This patch moves __hwasan_tag_mismatch_stub outside of the anonymous
namespace that it was defined in and declares it in
hwasan_interface_internal.h.

We also add the ability to pass sizes larger than 16 bytes to this
reporting function by providing a fourth parameter that is only looked
at when the size provided is not in the original accepted range.

This does not change the behaviour where it is already being called,
since the previous definition only accepted sizes up to 16 bytes and
hence the change in behaviour is not seen by existing users.
The change in declaration does not matter, since the only existing use
is in the __hwasan_tag_mismatch function written in assembly.

Reviewers: eugenis, kcc, pcc, #sanitizers

Reviewed By: eugenis, #sanitizers

Subscribers: kristof.beyls, llvm-commits

Tags: #sanitizers, #llvm

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

Patch by Matthew Malcomson <matthew.malcomson@arm.com>

4 years agoRevert "Expose __hwasan_tag_mismatch_stub"
David Tellenbach [Thu, 24 Oct 2019 10:11:05 +0000 (11:11 +0100)]
Revert "Expose __hwasan_tag_mismatch_stub"

Attribution to author of patch got lost.

This reverts commit 612eadb7bc06b8f1a094976e06155f46ebd70d7c.

4 years agoExpose __hwasan_tag_mismatch_stub
David Tellenbach [Thu, 24 Oct 2019 10:04:21 +0000 (11:04 +0100)]
Expose __hwasan_tag_mismatch_stub

Summary:
GCC would like to emit a function call to report a tag mismatch
rather than hard-code the `brk` instruction directly.

__hwasan_tag_mismatch_stub contains most of the functionality to do
this already, but requires exposure in the dynamic library.

This patch moves __hwasan_tag_mismatch_stub outside of the anonymous
namespace that it was defined in and declares it in
hwasan_interface_internal.h.

We also add the ability to pass sizes larger than 16 bytes to this
reporting function by providing a fourth parameter that is only looked
at when the size provided is not in the original accepted range.

This does not change the behaviour where it is already being called,
since the previous definition only accepted sizes up to 16 bytes and
hence the change in behaviour is not seen by existing users.
The change in declaration does not matter, since the only existing use
is in the __hwasan_tag_mismatch function written in assembly.

Tested with gcc and clang on an AArch64 vm.

Reviewers: eugenis, kcc, pcc, #sanitizers

Reviewed By: eugenis, #sanitizers

Subscribers: kristof.beyls, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[libFuzzer] docs: update note to include REDUCE event.
Marek Kurdej [Thu, 24 Oct 2019 10:04:12 +0000 (12:04 +0200)]
[libFuzzer] docs: update note to include REDUCE event.

4 years agoHide implementation details in anonymous namespaces. NFC.
Benjamin Kramer [Thu, 24 Oct 2019 08:43:37 +0000 (10:43 +0200)]
Hide implementation details in anonymous namespaces. NFC.

4 years ago[clangd] Handle the missing constructor initializers in findExplicitReferences.
Haojian Wu [Mon, 21 Oct 2019 08:11:30 +0000 (10:11 +0200)]
[clangd] Handle the missing constructor initializers in findExplicitReferences.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[clangd] Collect name references in the index.
Haojian Wu [Wed, 23 Oct 2019 10:35:33 +0000 (12:35 +0200)]
[clangd] Collect name references in the index.

Summary:
This is used for cross-file rename. When renaming a class, we expect to
rename all related constructors/destructors.

Reviewers: kadircet, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[MIPS GlobalISel] MSA vector generic and builtin fadd, fsub, fmul, fdiv
Petar Avramovic [Thu, 24 Oct 2019 08:15:07 +0000 (10:15 +0200)]
[MIPS GlobalISel] MSA vector generic and builtin fadd, fsub, fmul, fdiv

Select vector G_FADD, G_FSUB, G_FMUL and G_FDIV for MIPS32 with MSA. We
have to set bank for vector operands to fprb and selectImpl will do the
rest. __builtin_msa_fadd_<format>, __builtin_msa_fsub_<format>,
__builtin_msa_fmul_<format> and __builtin_msa_fdiv_<format> will be
transformed into G_FADD, G_FSUB, G_FMUL and G_FDIV in legalizeIntrinsic
respectively and selected in the same way.

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

4 years ago[MIPS GlobalISel] MSA vector generic and builtin sdiv, srem, udiv, urem
Petar Avramovic [Thu, 24 Oct 2019 08:03:36 +0000 (10:03 +0200)]
[MIPS GlobalISel] MSA vector generic and builtin sdiv, srem, udiv, urem

Select vector G_SDIV, G_SREM, G_UDIV and G_UREM for MIPS32 with MSA. We
have to set bank for vector operands to fprb and selectImpl will do the
rest. __builtin_msa_div_s_<format>, __builtin_msa_mod_s_<format>,
__builtin_msa_div_u_<format> and __builtin_msa_mod_u_<format> will be
transformed into G_SDIV, G_SREM, G_UDIV and G_UREM in legalizeIntrinsic
respectively and selected in the same way.

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

4 years ago[X86] Replace some regular expressions in xray tests with explicit checks to show...
Craig Topper [Thu, 24 Oct 2019 06:04:35 +0000 (23:04 -0700)]
[X86] Replace some regular expressions in xray tests with explicit checks to show bad assembly.

We're print 16-bit or 32-bit registers in copy instructions to
64-bit registers. This code will not assemble if it were to be
parsed back in. Emitting to binary works because we'll encode
the register the same way no matter what the size is.

4 years ago[AMDGPU] Allow folding of sgpr to vgpr copy
Stanislav Mekhanoshin [Mon, 21 Oct 2019 20:43:01 +0000 (13:43 -0700)]
[AMDGPU] Allow folding of sgpr to vgpr copy

Potentially sgpr to sgpr copy should also be possible.
That is however trickier because we may end up with a
wrong register class at use because of xm0/xexec permutations.

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

4 years ago[Hexagon] Fix typo. NFC
Shoaib Meenai [Thu, 24 Oct 2019 01:06:28 +0000 (18:06 -0700)]
[Hexagon] Fix typo. NFC

Testing git push access.

4 years agoAdd beginning of LLVM's GettingStarted to GitHub readme
Meike Baumgärtner [Thu, 24 Oct 2019 01:03:37 +0000 (18:03 -0700)]
Add beginning of LLVM's GettingStarted to GitHub readme

Reviewed and approved by chandlerc.

As GitHub is the canonical LLVM repository now, embrace GitHub's way of displaying basic build instructions in the top-level readme.md.

4 years agoImprove Clang's getting involved document and make it more inclusive in wording.
Chandler Carruth [Wed, 23 Oct 2019 19:14:04 +0000 (12:14 -0700)]
Improve Clang's getting involved document and make it more inclusive in wording.

Summary: Working with Meike and others to improve the wording in this document.

Reviewers: klimek

Subscribers: mcrosier, cfe-commits

Tags: #clang

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

4 years agoUse portable flag with nm in extract_symbols.py
David Tenty [Wed, 23 Oct 2019 20:48:02 +0000 (16:48 -0400)]
Use portable flag with nm in extract_symbols.py

Summary:
nm is one of the tools that extract_symbols.py can use to extract
symbols from llvm libraries as part of the build process. This patch
updates the invocation of nm to use the -P POSIX option for "portable
output" so we get a consistently parsable output format on all
platforms.

A link to the relevant nm format: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/nm.html

Reviewers: hubert.reinterpretcast, stevewan, sfertile

Reviewed By: stevewan

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoImprove language in GettingStarted.rst
Meike Baumgärtner [Wed, 23 Oct 2019 19:32:57 +0000 (12:32 -0700)]
Improve language in GettingStarted.rst

This patch was reviewed and approved by chandlerc.

"Getting Started with the LLVM System" is the first point of contact for many newcomers in the LLVM community.
 * Make the first two paragraphs more welcoming
 * Use more inclusive language

4 years ago[libcxx][NFC] Strip trailing whitespace, fix typo.
Stephan T. Lavavej [Wed, 23 Oct 2019 18:45:36 +0000 (11:45 -0700)]
[libcxx][NFC] Strip trailing whitespace, fix typo.

4 years agoRemove a no longer accurate sentence from the coding standards.
Chandler Carruth [Wed, 23 Oct 2019 18:40:45 +0000 (11:40 -0700)]
Remove a no longer accurate sentence from the coding standards.

(And test my commit access. We're working on larger changes here.)

4 years ago[NFC] Strip trailing whitespace from libc++
Louis Dionne [Wed, 23 Oct 2019 17:40:15 +0000 (10:40 -0700)]
[NFC] Strip trailing whitespace from libc++

4 years agoRevert 4334892e7b "[DAGCombine][ARM] x ==/!= c -> (x - c) ==/!= 0 iff '-c' can...
Hans Wennborg [Wed, 23 Oct 2019 17:44:16 +0000 (19:44 +0200)]
Revert 4334892e7b "[DAGCombine][ARM] x ==/!= c  ->  (x - c) ==/!= 0  iff '-c' can be folded into the x node."

This broke various Windows builds, see comments on the Phabricator
review.

This also reverts the follow-up 20bf0cf.

> Summary:
> This fold, helps recover from the rest of the D62266 ARM regressions.
> https://rise4fun.com/Alive/TvpC
>
> Note that while the fold is quite flexible, i've restricted it
> to the single interesting pattern at the moment.
>
> Reviewers: efriedma, craig.topper, spatel, RKSimon, deadalnix
>
> Reviewed By: deadalnix
>
> Subscribers: javed.absar, kristof.beyls, llvm-commits
>
> Tags: #llvm
>
> Differential Revision: https://reviews.llvm.org/D62450

4 years ago[lldb] Add nodebug attribute to import-std-module/sysroot test
Raphael Isemann [Wed, 23 Oct 2019 15:32:53 +0000 (08:32 -0700)]
[lldb] Add nodebug attribute to import-std-module/sysroot test

Summary:
So far we rely on the default argument and the fact that we don't call this
inline function in our actual `main.cpp` to make sure that this function can only
be called if LLDB loads this header as a C++ module. This patch just adds
the nodebug attribute as yet another measure to make sure LLDB can't call this
function without the standard module loaded. Note that the test is already
requiring clang for the sysroot setup, so its fine that this is a Clang specific attribute.

Reviewers: friss, labath

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

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

4 years agoMinor movement of one function with now-correct strictfp attribute to pass
Kevin P. Neal [Wed, 23 Oct 2019 16:12:56 +0000 (12:12 -0400)]
Minor movement of one function with now-correct strictfp attribute to pass
against the latest version of D68233.

4 years ago[clangd] abort if shutdown takes more than a minute.
Sam McCall [Wed, 23 Oct 2019 09:11:18 +0000 (11:11 +0200)]
[clangd] abort if shutdown takes more than a minute.

Summary:
A certain class of bug (e.g. infloop on an AST worker thread) currently means
clangd never terminates, even if the editor shuts down the protocol and closes
our stdin, and the main thread recognizes that.

Instead, let's wait 60 seconds for threads to finish cleanly, and then crash
if they haven't.

(Obviously, we should still fix these bugs).

Reviewers: kadircet

Subscribers: MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits, ilya-biryukov

Tags: #clang

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

4 years ago[Analysis] Update Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll
Roman Lebedev [Wed, 23 Oct 2019 15:38:34 +0000 (18:38 +0300)]
[Analysis] Update Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll

I should have updated it in 1f665046fbf3b9d47a229714f689cd941f6f1216
but i didn't even realize those tests were there.

4 years agoFix non-portable GNU diff option
stevewan [Wed, 23 Oct 2019 15:11:37 +0000 (11:11 -0400)]
Fix non-portable GNU diff option

Summary: This is a fix to revision D68839 and rL375023. This patch substitutes POSIX option "-b" for the non-portable GNU option "--strip-trailing-cr".

Reviewers: daltenty, hubert.reinterpretcast

Reviewed By: daltenty

Subscribers: mehdi_amini, hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[LVI][NFC] Factor solveBlockValueSaturatingIntrinsic() out of solveBlockValueIntrinsic()
Roman Lebedev [Wed, 23 Oct 2019 15:05:05 +0000 (18:05 +0300)]
[LVI][NFC] Factor solveBlockValueSaturatingIntrinsic() out of solveBlockValueIntrinsic()

Now that there's SaturatingInst class, this is cleaner.

4 years ago[LVI][CVP] LazyValueInfoImpl::solveBlockValueBinaryOp(): use no-wrap flags from ...
Roman Lebedev [Wed, 23 Oct 2019 13:56:04 +0000 (16:56 +0300)]
[LVI][CVP] LazyValueInfoImpl::solveBlockValueBinaryOp(): use no-wrap flags from `add` op

Summary:
This was suggested in https://reviews.llvm.org/D69277#1717210
In this form (this is what was suggested, right?), the results aren't staggering
(especially since given LVI cross-block focus)
this does catch some things (as per test-suite), but not too much:

| statistic                                        |       old |       new | delta | % change |
| correlated-value-propagation.NumAddNSW           |      4981 |      4982 |     1 |  0.0201% |
| correlated-value-propagation.NumAddNW            |     12125 |     12126 |     1 |  0.0082% |
| correlated-value-propagation.NumCmps             |      1199 |      1202 |     3 |  0.2502% |
| correlated-value-propagation.NumDeadCases        |       112 |       111 |    -1 | -0.8929% |
| correlated-value-propagation.NumMulNSW           |       275 |       278 |     3 |  1.0909% |
| correlated-value-propagation.NumMulNUW           |      1323 |      1326 |     3 |  0.2268% |
| correlated-value-propagation.NumMulNW            |      1598 |      1604 |     6 |  0.3755% |
| correlated-value-propagation.NumNSW              |      7158 |      7167 |     9 |  0.1257% |
| correlated-value-propagation.NumNUW              |     13304 |     13310 |     6 |  0.0451% |
| correlated-value-propagation.NumNW               |     20462 |     20477 |    15 |  0.0733% |
| correlated-value-propagation.NumOverflows        |         4 |         7 |     3 | 75.0000% |
| correlated-value-propagation.NumPhis             |     15366 |     15381 |    15 |  0.0976% |
| correlated-value-propagation.NumSExt             |      6273 |      6277 |     4 |  0.0638% |
| correlated-value-propagation.NumShlNSW           |      1172 |      1171 |    -1 | -0.0853% |
| correlated-value-propagation.NumShlNUW           |      2793 |      2794 |     1 |  0.0358% |
| correlated-value-propagation.NumSubNSW           |       730 |       736 |     6 |  0.8219% |
| correlated-value-propagation.NumSubNUW           |      2044 |      2046 |     2 |  0.0978% |
| correlated-value-propagation.NumSubNW            |      2774 |      2782 |     8 |  0.2884% |
| instcount.NumAddInst                             |    277586 |    277569 |   -17 | -0.0061% |
| instcount.NumAndInst                             |     66056 |     66054 |    -2 | -0.0030% |
| instcount.NumBrInst                              |    709147 |    709146 |    -1 | -0.0001% |
| instcount.NumCallInst                            |    528579 |    528576 |    -3 | -0.0006% |
| instcount.NumExtractValueInst                    |     18307 |     18301 |    -6 | -0.0328% |
| instcount.NumOrInst                              |    102660 |    102665 |     5 |  0.0049% |
| instcount.NumPHIInst                             |    318008 |    318007 |    -1 | -0.0003% |
| instcount.NumSelectInst                          |     46373 |     46370 |    -3 | -0.0065% |
| instcount.NumSExtInst                            |     79496 |     79488 |    -8 | -0.0101% |
| instcount.NumShlInst                             |     40654 |     40657 |     3 |  0.0074% |
| instcount.NumTruncInst                           |     62251 |     62249 |    -2 | -0.0032% |
| instcount.NumZExtInst                            |     68211 |     68221 |    10 |  0.0147% |
| instcount.TotalBlocks                            |    843910 |    843909 |    -1 | -0.0001% |
| instcount.TotalInsts                             |   7387448 |   7387423 |   -25 | -0.0003% |

Reviewers: nikic, reames

Reviewed By: nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[analyzer] Fix off-by-one in operator call parameter binding.
Artem Dergachev [Wed, 23 Oct 2019 15:10:19 +0000 (08:10 -0700)]
[analyzer] Fix off-by-one in operator call parameter binding.

Member operator declarations and member operator expressions
have different numbering of parameters and arguments respectively:
one of them includes "this", the other does not.

Account for this inconsistency when figuring out whether
the parameter needs to be manually rebound from the Environment
to the Store when entering a stack frame of an operator call,
as opposed to being constructed with a constructor and as such
already having the necessary Store bindings.

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

4 years ago[libc++][NFC] Remove excess trailing newlines from most files
Casey Carter [Wed, 23 Oct 2019 15:08:18 +0000 (08:08 -0700)]
[libc++][NFC] Remove excess trailing newlines from most files

Testing git commit access.

4 years ago[mips] Use `expandLoadAddress` for JAL expansion
Simon Atanasyan [Tue, 22 Oct 2019 18:20:52 +0000 (21:20 +0300)]
[mips] Use `expandLoadAddress` for JAL expansion

- Reduce code duplication
- Get partial support of JAL expansion for XGOT.

4 years ago[mips] Implement `la` macro expansion for N32 ABI
Simon Atanasyan [Fri, 18 Oct 2019 20:00:08 +0000 (23:00 +0300)]
[mips] Implement `la` macro expansion for N32 ABI

4 years ago[mips] Add tests to check `la / dla` expansion in XGOT cases. NFC
Simon Atanasyan [Wed, 16 Oct 2019 17:17:12 +0000 (20:17 +0300)]
[mips] Add tests to check `la / dla` expansion in XGOT cases. NFC

4 years ago[mips] Reformat `la / dla` expansion test cases. NFC
Simon Atanasyan [Wed, 16 Oct 2019 16:41:04 +0000 (19:41 +0300)]
[mips] Reformat `la / dla` expansion test cases. NFC

4 years ago[X86] combineX86ShufflesRecursively - assert the root mask is legal. NFCI.
Simon Pilgrim [Wed, 23 Oct 2019 14:33:29 +0000 (07:33 -0700)]
[X86] combineX86ShufflesRecursively - assert the root mask is legal. NFCI.

4 years agoReland "[Support] Add a way to run a function on a detached thread""
Sam McCall [Wed, 23 Oct 2019 13:34:48 +0000 (15:34 +0200)]
Reland "[Support] Add a way to run a function on a detached thread""

This reverts commit 7bc7fe6b789d25d48d6dc71d533a411e9e981237.
The immediate callers have been fixed to pass nullopt where appropriate.

4 years ago[clangd] Propogate context in TUScheduler::run
Kadir Cetinkaya [Wed, 23 Oct 2019 08:18:09 +0000 (10:18 +0200)]
[clangd] Propogate context in TUScheduler::run

Reviewers: sammccall

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[Sanitizers] Add support for RISC-V 64-bit
Sam Elliott [Wed, 23 Oct 2019 13:10:43 +0000 (14:10 +0100)]
[Sanitizers] Add support for RISC-V 64-bit

Summary:
This has been tested with gcc trunk on openSUSE Tumbleweed on the HiFive Unleashed.

Patch by Andreas Schwab (schwab)

Reviewers: luismarques

Reviewed By: luismarques

Subscribers: mhorne, emaste, luismarques, asb, mgorny, fedor.sergeev, simoncook, kito-cheng, shiva0217, rogfer01, rkruppe, lenary, s.egerton, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

4 years agoRevert "[Support] Add a way to run a function on a detached thread"
Sam McCall [Wed, 23 Oct 2019 13:10:35 +0000 (15:10 +0200)]
Revert "[Support] Add a way to run a function on a detached thread"

This reverts commit 40668abca4d307e02b33345cfdb7271549ff48d0.
This causes clang tests to fail, as stacksize=0 is being explicitly passed and
is no longer a no-op.

4 years ago[Support] Add a way to run a function on a detached thread
Sam McCall [Wed, 23 Oct 2019 10:36:36 +0000 (12:36 +0200)]
[Support] Add a way to run a function on a detached thread

This roughly mimics `std::thread(...).detach()` except it allows to
customize the stack size. Required for https://reviews.llvm.org/D50993.

I've decided against reusing the existing `llvm_execute_on_thread` because
it's not obvious what to do with the ownership of the passed
function/arguments:

1. If we pass possibly owning functions data to `llvm_execute_on_thread`,
   we'll lose the ability to pass small non-owning non-allocating functions
   for the joining case (as it's used now). Is it important enough?
2. If we use the non-owning interface in the new use case, we'll force
   clients to transfer ownership to the spawned thread manually, but
   similar code would still have to exist inside
   `llvm_execute_on_thread(_async)` anyway (as we can't just pass the same
   non-owning pointer to pthreads and Windows implementations, and would be
   forced to wrap it in some structure, and deal with its ownership.

Patch by Dmitry Kozhevnikov!

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

4 years ago[Mips] Use appropriate private label prefix based on Mips ABI
Mirko Brkusanin [Wed, 23 Oct 2019 10:24:35 +0000 (12:24 +0200)]
[Mips] Use appropriate private label prefix based on Mips ABI

MipsMCAsmInfo was using '$' prefix for Mips32 and '.L' for Mips64
regardless of -target-abi option. By passing MCTargetOptions to MCAsmInfo
we can find out Mips ABI and pick appropriate prefix.

Tags: #llvm, #clang, #lldb

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

4 years ago[DebugInfo] Stop describing imms in TargetInstrInfo's describeLoadedValue() impl
David Stenberg [Wed, 23 Oct 2019 09:35:32 +0000 (11:35 +0200)]
[DebugInfo] Stop describing imms in TargetInstrInfo's describeLoadedValue() impl

Summary:
The default implementation of the describeLoadedValue() hook uses the
MoveImm property to determine if an instruction moves an immediate. If
an instruction has that property the function returns the second
operand, assuming that that is the immediate value the instruction
moves. As far as I can tell, the MoveImm property does not imply that
the second operand is the immediate value, nor that any other operand
necessarily holds the immediate value; it just means that the
instruction moves some immediate value.

One example where the second operand is not the immediate is SystemZ's
LZER instruction, which moves a zero immediate implicitly: $f0S = LZER.

That case triggered an out-of-bound assertion when getting the operand.
I have added a test case for that instruction.

Another example is ARM's MVN instruction, which holds the logical
bitwise NOT'd value of the immediate that is moved. For the following
reproducer:

  extern void foo(int);
  int main() { foo(-11); }

an incorrect call site value would be emitted:

  $ clang --target=arm foo.c -O1 -g -Xclang -femit-debug-entry-values \
      -c -o - | ./build/bin/llvm-dwarfdump  - | \
      grep -A2 call_site_parameter

  0x00000058:       DW_TAG_GNU_call_site_parameter
                      DW_AT_location (DW_OP_reg0 R0)
                      DW_AT_GNU_call_site_value (DW_OP_lit10)

Another example is the A2_combineii instruction on Hexagon which moves
two immediates to a super-register: $d0 = A2_combineii 20, 10.

Perhaps these are rare exceptions, and most MoveImm instructions hold
the immediate in the second operand, but in my opinion the default
implementation of the hook should only describe values that it can, by
some contract, guarantee are safe to describe, rather than leaving it up
to the targets to override the exceptions, as that can silently result
in incorrect call site values.

This patch adds X86's relevant move immediate instructions to the
target's hook implementation, so this commit should be a NFC for that
target. We need to do the same for ARM and AArch64.

Reviewers: djtodoro, NikolaPrica, aprantl, vsk

Reviewed By: vsk

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #debug-info, #llvm

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

4 years ago[lib/ObjectYAML] - Add a full stop to the comment. NFC.
georgerim [Wed, 23 Oct 2019 09:22:52 +0000 (12:22 +0300)]
[lib/ObjectYAML] - Add a full stop to the comment. NFC.

A test commit.

4 years ago[MIPS GlobalISel] Select MSA vector generic and builtin mul
Petar Avramovic [Wed, 23 Oct 2019 09:22:07 +0000 (11:22 +0200)]
[MIPS GlobalISel] Select MSA vector generic and builtin mul

Select vector G_MUL for MIPS32 with MSA. We have to set bank
for vector operands to fprb and selectImpl will do the rest.
Manual selection of G_MUL is now done for gprb only.
__builtin_msa_mulv_<format> will be transformed into G_MUL
in legalizeIntrinsic and selected in the same way.

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

4 years ago[MIPS GlobalISel] Select MSA vector generic and builtin sub
Petar Avramovic [Wed, 23 Oct 2019 09:15:25 +0000 (11:15 +0200)]
[MIPS GlobalISel] Select MSA vector generic and builtin sub

Select vector G_SUB for MIPS32 with MSA. We have to set bank
for vector operands to fprb and selectImpl will do the rest.
__builtin_msa_subv_<format> will be transformed into G_SUB
in legalizeIntrinsic and selected in the same way.
__builtin_msa_subvi_<format> will be directly selected into
SUBVI_<format> in legalizeIntrinsic.

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

4 years ago[TargetLowering] optimizeSetCCToComparisonWithZero(): add extra sanity checks (PR43769)
Roman Lebedev [Wed, 23 Oct 2019 08:58:50 +0000 (11:58 +0300)]
[TargetLowering] optimizeSetCCToComparisonWithZero(): add extra sanity checks (PR43769)

We should do the fold only if both constants are plain,
non-opaque constants, at least that is the DAG.FoldConstantArithmetic()
requirement.
And if the constant we are comparing with is zero - we shouldn't be
trying to do this fold in the first place.

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

4 years ago[c++2a] Allow comparison functions to be explicitly defaulted.
Richard Smith [Wed, 23 Oct 2019 00:44:08 +0000 (17:44 -0700)]
[c++2a] Allow comparison functions to be explicitly defaulted.

This adds some initial syntactic checking that only the appropriate
function signatures can be defaulted. No implicit definitions are
generated yet.

4 years ago[libcxx][test][NFC] Fix comment typos.
Stephan T. Lavavej [Tue, 22 Oct 2019 22:19:40 +0000 (15:19 -0700)]
[libcxx][test][NFC] Fix comment typos.

(Testing git commit access.)

4 years ago[NFC] Strip trailing whitespace in test to test Github committing
Louis Dionne [Tue, 22 Oct 2019 21:58:41 +0000 (14:58 -0700)]
[NFC] Strip trailing whitespace in test to test Github committing

4 years ago[PowerPC][NFC] Remove deprecated Function Attrs comments #2
Jinsong Ji [Tue, 22 Oct 2019 21:44:21 +0000 (21:44 +0000)]
[PowerPC][NFC] Remove deprecated Function Attrs comments #2

4 years agoFix broken sphinx link in CMake.rst.
Kit Barton [Tue, 22 Oct 2019 21:45:28 +0000 (14:45 -0700)]
Fix broken sphinx link in CMake.rst.

Reviewers: delcypher, beanz

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

4 years ago[PowerPC][NFC] Remove deprecated Function Attrs comments
Jinsong Ji [Tue, 22 Oct 2019 21:28:15 +0000 (21:28 +0000)]
[PowerPC][NFC] Remove deprecated Function Attrs comments

4 years agotypo fix test commit
LLVM GN Syncbot [Tue, 22 Oct 2019 21:32:11 +0000 (21:32 +0000)]
typo fix test commit

4 years agoRevert r374202"[ObjC generics] Fix not inheriting type bounds in categories/extensions."
Hans Wennborg [Tue, 22 Oct 2019 20:39:01 +0000 (22:39 +0200)]
Revert r374202"[ObjC generics] Fix not inheriting type bounds in categories/extensions."

This introduced new errors, see below. Reverting until that can be investigated
properly.

  #import <AVFoundation/AVFoundation.h>

  void f(int width, int height) {
    FourCharCode best_fourcc = kCMPixelFormat_422YpCbCr8_yuvs;
    NSDictionary* videoSettingsDictionary = @{
      (id)kCVPixelBufferPixelFormatTypeKey : @(best_fourcc),
    };
  }

  $ clang++ -c /tmp/a.mm

  /tmp/a.mm:6:5: error: cannot initialize a parameter of type
  'KeyType<NSCopying>  _Nonnull const' (aka 'const id') with an rvalue
  of type 'id'
      (id)kCVPixelBufferPixelFormatTypeKey : @(best_fourcc),
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.

> When a category/extension doesn't repeat a type bound, corresponding
> type parameter is substituted with `id` when used as a type argument. As
> a result, in the added test case it was causing errors like
>
> > type argument 'T' (aka 'id') does not satisfy the bound ('id<NSCopying>') of type parameter 'T'
>
> We are already checking that type parameters should be consistent
> everywhere (see `checkTypeParamListConsistency`) and update
> `ObjCTypeParamDecl` to have correct underlying type. And when we use the
> type parameter as a method return type or a method parameter type, it is
> substituted to the bounded type. But when we use the type parameter as a
> type argument, we check `ObjCTypeParamType` that ignores the updated
> underlying type and remains `id`.
>
> Fix by desugaring `ObjCTypeParamType` to the underlying type, the same
> way we are doing with `TypedefType`.
>
> rdar://problem/54329242
>
> Reviewers: erik.pilkington, ahatanak
>
> Reviewed By: erik.pilkington
>
> Subscribers: jkorous, dexonsmith, ributzka, cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D66696

4 years agoFix name of warn_ignored_hip_only_option
Yaxun (Sam) Liu [Tue, 22 Oct 2019 20:15:04 +0000 (16:15 -0400)]
Fix name of warn_ignored_hip_only_option

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

4 years agoRevert "Fix lld detection in standalone compiler-rt."
Evgenii Stepanov [Tue, 22 Oct 2019 20:29:57 +0000 (13:29 -0700)]
Revert "Fix lld detection in standalone compiler-rt."

Breaks sanitizer-android buildbot.

This reverts commit d56203201f8a1f11abb913c4dfc0bf9c61432d1a.

4 years agofix a few typos to test git committing
Nico Weber [Tue, 22 Oct 2019 20:34:00 +0000 (16:34 -0400)]
fix a few typos to test git committing

4 years ago[RISCV] Add support for -ffixed-xX flags
Simon Cook [Tue, 22 Oct 2019 20:25:01 +0000 (21:25 +0100)]
[RISCV] Add support for -ffixed-xX flags

This adds support for reserving GPRs such that the compiler will not
choose a register for register allocation. The implementation follows
the same design as for AArch64; each reserved register becomes a target
feature and used for getting the reserved registers for a given
MachineFunction. The backend checks that it does not need to write to
any reserved register; if it does a relevant error is generated.

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

4 years ago[HIP] Add option -fgpu-allow-device-init
Yaxun (Sam) Liu [Tue, 22 Oct 2019 17:41:25 +0000 (13:41 -0400)]
[HIP] Add option -fgpu-allow-device-init

Add this option to allow device side class type global variables
with non-trivial ctor/dtor. device side init/fini functions will
be emitted, which will be executed by HIP runtime when
the fat binary is loaded/unloaded.

This feature is to facilitate implementation of device side
sanitizer which requires global vars with non-trival ctors.

By default this option is disabled.

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

4 years ago[DAGCombine][ARM] x ==/!= c -> (x - c) ==/!= 0 iff '-c' can be folded into the...
Roman Lebedev [Tue, 22 Oct 2019 19:51:10 +0000 (22:51 +0300)]
[DAGCombine][ARM] x ==/!= c  ->  (x - c) ==/!= 0  iff '-c' can be folded into the x node.

Summary:
This fold, helps recover from the rest of the D62266 ARM regressions.
https://rise4fun.com/Alive/TvpC

Note that while the fold is quite flexible, i've restricted it
to the single interesting pattern at the moment.

Reviewers: efriedma, craig.topper, spatel, RKSimon, deadalnix

Reviewed By: deadalnix

Subscribers: javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

4 years ago[NFC][LVI][CVP] Tests where pre-specified `add` no-wrap flags could be used by LVI
Roman Lebedev [Tue, 22 Oct 2019 19:16:46 +0000 (22:16 +0300)]
[NFC][LVI][CVP] Tests where pre-specified `add` no-wrap flags could be used by LVI

There's `ConstantRange::addWithNoWrap()`, LVI could use it to further
constrain the range, if an `add` already has some no-wrap flags specified.

4 years ago[AMDGPU] Updated fold-vgpr-copy.mir test. NFC.
Stanislav Mekhanoshin [Tue, 22 Oct 2019 19:43:23 +0000 (12:43 -0700)]
[AMDGPU] Updated fold-vgpr-copy.mir test. NFC.