platform/upstream/llvm.git
4 years ago[ARM][MVE] Refactor complex vector intrinsics [NFCI]
Mikhail Maltsev [Tue, 10 Dec 2019 16:21:52 +0000 (16:21 +0000)]
[ARM][MVE] Refactor complex vector intrinsics [NFCI]

Summary:
This patch refactors instruction selection of the complex vector
addition, multiplication and multiply-add intrinsics, so that it is
now based on TableGen patterns rather than C++ code.

It also changes the first parameter (halving vs non-halving) of the
arm_mve_vcaddq IR intrinsic to match the corresponding instruction
encoding, hence it requires some changes in the tests.

The patch addresses David's comment in https://reviews.llvm.org/D71190

Reviewers: dmgreen, ostannard, simon_tatham, MarkMurrayARM

Reviewed By: dmgreen

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

Tags: #clang, #llvm

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

4 years ago[BUG-FIX][XCOFF] fixed a bug of XCOFFObjectFile.cpp when there is padding at the...
diggerlin [Tue, 10 Dec 2019 16:14:49 +0000 (11:14 -0500)]
[BUG-FIX][XCOFF] fixed a bug of XCOFFObjectFile.cpp when there is padding at the last csect of a sections

SUMMARY:
  Fixed a bug of XCOFFObjectFile.cpp when there is padding at the last csect of a sections.
when there is a tail padding of a section, but the value of CurrentAddressLocation do not be increased by the padding size. it will hit assert assert(CurrentAddressLocation == Section->Address && "We should have no padding between sections.");

Reviewers: daltenty,hubert.reinterpretcast,

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

4 years ago[DebugInfo] Support to emit debugInfo for extern variables
Yonghong Song [Fri, 22 Nov 2019 16:45:37 +0000 (08:45 -0800)]
[DebugInfo] Support to emit debugInfo for extern variables

Extern variable usage in BPF is different from traditional
pure user space application. Recent discussion in linux bpf
mailing list has two use cases where debug info types are
required to use extern variables:
  - extern types are required to have a suitable interface
    in libbpf (bpf loader) to provide kernel config parameters
    to bpf programs.
    https://lore.kernel.org/bpf/CAEf4BzYCNo5GeVGMhp3fhysQ=_axAf=23PtwaZs-yAyafmXC9g@mail.gmail.com/T/#t
  - extern types are required so kernel bpf verifier can
    verify program which uses external functions more precisely.
    This will make later link with actual external function no
    need to reverify.
    https://lore.kernel.org/bpf/87eez4odqp.fsf@toke.dk/T/#m8d5c3e87ffe7f2764e02d722cb0d8cbc136880ed

This patch added clang support to emit debuginfo for extern variables
with a TargetInfo hook to enable it. The debuginfo for the
extern variable is emitted only if that extern variable is
referenced in the current compilation unit.

Currently, only BPF target enables to generate debug info for
extern variables. The emission of such debuginfo is disabled for C++
 at this moment since BPF only supports a subset of C language.
Emission with C++ can be enabled later if an appropriate use case
is identified.

-fstandalone-debug permits us to see more debuginfo with the cost
of bloated binary size. This patch did not add emission of extern
variable debug info with -fstandalone-debug. This can be
re-evaluated if there is a real need.

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

4 years ago[test][llvm-cxxfilt] Improve comment for clarity
James Henderson [Tue, 10 Dec 2019 16:06:36 +0000 (16:06 +0000)]
[test][llvm-cxxfilt] Improve comment for clarity

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

4 years ago[scudo][standalone] Define hasHardwareCRC32 for other archs
Kostya Kortchinsky [Mon, 9 Dec 2019 21:06:34 +0000 (13:06 -0800)]
[scudo][standalone] Define hasHardwareCRC32 for other archs

Summary:
The function was only defined for x86 and arm families, which ends
up being an issue for PPC in g3.

Define the function, simply returning `false` for "other"
architectures.

Reviewers: hctim, pcc, cferris, eugenis, vitalybuka

Subscribers: kristof.beyls, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[InstCombine] replace shuffle's insertelement operand if inserted scalar is not demanded
Sanjay Patel [Tue, 10 Dec 2019 15:10:05 +0000 (10:10 -0500)]
[InstCombine] replace shuffle's insertelement operand if inserted scalar is not demanded

This pattern is noted as a regression from:
D70246
...where we removed an over-aggressive shuffle simplification.

SimplifyDemandedVectorElts fails to catch this case when the insert has multiple uses,
so I'm proposing to pattern match the minimal sequence directly. This fold does not
conflict with any of our current shuffle undef/poison semantics.

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

4 years ago[Docs] Improve SLP code snippet
Sanjay Patel [Mon, 9 Dec 2019 22:07:30 +0000 (17:07 -0500)]
[Docs] Improve SLP code snippet

New C code snippet is more viable for SLP vectorization in most architectures.

Patch by: @lsandov1 (Leonardo Sandoval)

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

4 years ago[Alignment][NFC] CreateMemSet use MaybeAlign
Guillaume Chatelet [Mon, 9 Dec 2019 16:36:50 +0000 (17:36 +0100)]
[Alignment][NFC] CreateMemSet use MaybeAlign

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

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

Tags: #clang, #llvm

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

4 years ago[DWARF][RISCV] Test resolving of RISC-V relocations
Luís Marques [Tue, 10 Dec 2019 13:59:04 +0000 (13:59 +0000)]
[DWARF][RISCV] Test resolving of RISC-V relocations

Summary: This patch adds an object file (in yaml format) with a synthetic
.debug_info section which we use to test that the supported RISC-V relocations
are properly resolved.

Reviewers: asb, lenary, MaskRay
Reviewed By: MaskRay
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70541

4 years agoReapply: [DebugInfo] Recover debug intrinsics when killing duplicated/empty...
stozer [Thu, 5 Dec 2019 10:01:47 +0000 (10:01 +0000)]
Reapply: [DebugInfo] Recover debug intrinsics when killing duplicated/empty...

basic blocks

Originally applied in 72ce759928e6dfee6a9efa310b966c19722352ba.

Fixed a build failure caused by incorrect use of cast instead of
dyn_cast.

This reverts commit 8b0780f795eb58fca0a2456e308adaaa1a0b5013.

4 years ago[lldb] Actually enable wchar support in Editline when it is defined in the host config
Raphael Isemann [Tue, 10 Dec 2019 13:17:38 +0000 (14:17 +0100)]
[lldb] Actually enable wchar support in Editline when it is defined in the host config

Summary:
Our Editline implementation in LLDB supports using the wchar interface of Editline which
should improve handling of unicode input when using Editline. At the moment we essentially
just ignore unicode input and echo the escaped unicode code point (`\U1234`) to the command line
(which we then also incorrectly treat as multiple characters, so console navigation is also broken afterwards).

This patch just adds the include to the host config file which already contains the LLDB_EDITLINE_USE_WCHAR
define to enable the Editline support (we just never included it in the file before). With this we now actually
echo back unicode characters on macOS and we no longer ignore unicode input. On Linux this doesn't
seem to improve the echoing back of characters but at least it fixes that we ignore unicode input.

Reviewers: labath

Reviewed By: labath

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

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

4 years agoadd test for previous commit
Sam Parker [Tue, 10 Dec 2019 13:24:01 +0000 (13:24 +0000)]
add test for previous commit

4 years ago[TypePromotion] Query target register width
Sam Parker [Tue, 10 Dec 2019 13:21:12 +0000 (13:21 +0000)]
[TypePromotion] Query target register width

TargetLoweringInfo may report that an integer should be promoted, but
it maybe provide a size that isn't natively supported by the target
register file... So check this before trying to perform a promotion.

This is to fix some chromium issues:
https://bugs.chromium.org/p/chromium/issues/detail?id=1031978
https://bugs.chromium.org/p/chromium/issues/detail?id=1031979

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

4 years ago[lldb] Centralize type "desugaring" logic in ClangASTContext
Pavel Labath [Mon, 9 Dec 2019 15:44:26 +0000 (16:44 +0100)]
[lldb] Centralize type "desugaring" logic in ClangASTContext

Summary:
A *lot* of ClangASTContext functions contained repetitive code for
"desugaring" certain kinds of clang types. This patch creates a utility
function for performing this task.

Right now it handles four types (auto, elaborated, paren and typedef),
as these are the types that were handled everywhere. There are probably
other kinds of types that could/should be added here too (TypeOf,
decltype, ...), but I'm leaving that for a separate patch as doing that
would not be NFC (though I'm pretty sure that adding them will not hurt,
and it may in fact fix some bugs).

In another patch I'd like to add "atomic" type to this list to properly
display atomic structs.

Since sometimes one may want to handle a certain kind of type specially
(right now we have code which does that with typedefs), the Desugar
function takes a "mask" argument, which can supress desugaring of
certain kinds of types.

Reviewers: teemperor, shafik

Subscribers: jfb, lldb-commits

Tags: #lldb

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

4 years ago[lldb][NFC] Make g_TotalSizeOfMetadata in ClangExternalASTSourceCommon.cpp static
Raphael Isemann [Tue, 10 Dec 2019 12:14:46 +0000 (13:14 +0100)]
[lldb][NFC] Make g_TotalSizeOfMetadata in ClangExternalASTSourceCommon.cpp static

Clang was warning that this global should be static (which makes sense).

4 years ago[LLDB] [PECOFF] Make sure to set the address byte size in m_data after parsing headers
Martin Storsjö [Fri, 6 Dec 2019 11:25:38 +0000 (13:25 +0200)]
[LLDB] [PECOFF] Make sure to set the address byte size in m_data after parsing headers

If not set, the address byte size was implied to be the one of the
host process.

This allows reverting the functional change from 31087b2ae9154, since
now PECOFF does the same as ELF and MachO wrt setting both byte order
and address size on m_data within ParseHeader.

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

4 years ago[AArch64] Fix issues with large arrays on stack
Kiran Chandramohan [Wed, 20 Nov 2019 12:45:26 +0000 (12:45 +0000)]
[AArch64] Fix issues with large arrays on stack

Summary:
This patch fixes a few issues when large arrays are allocated on the
stack. Currently, clang has inconsistent behaviour, for debug builds
there is an assertion failure when the array size on stack is around 2GB
but there is no assertion when the stack is around 8GB. For release
builds there is no assertion, the compilation succeeds but generates
incorrect code. The incorrect code generated is due to using
int/unsigned int instead of their 64-bit counterparts. This patch,
1) Removes the assertion in frame legality check.
2) Converts int/unsigned int in some places to the 64-bit variants. This
helps in generating correct code and removes the inconsistent behaviour.
3) Adds a test which runs without optimisations.

Reviewers: sdesmalen, efriedma, fhahn, aemerson

Reviewed By: efriedma

Subscribers: eli.friedman, fpetrogalli, kristof.beyls, hiraditya,
llvm-commits

Tags: #llvm

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

4 years agogn build: (manually) merge eb3e81f43
Nico Weber [Tue, 10 Dec 2019 11:39:13 +0000 (06:39 -0500)]
gn build: (manually) merge eb3e81f43

4 years agoOnly Remove implicit conversion for the target that support fp16
Jim Lin [Tue, 10 Dec 2019 11:06:28 +0000 (19:06 +0800)]
Only Remove implicit conversion for the target that support fp16

Remove implicit conversion that promotes half to double
for the target that support fp16. If the target doesn't
support fp16, fp16 will be converted to fp16 intrinsic.

4 years ago[TableGen] Permit dag operators to be unset.
Simon Tatham [Tue, 10 Dec 2019 10:34:40 +0000 (10:34 +0000)]
[TableGen] Permit dag operators to be unset.

This is not a new semantic feature. The syntax `(? 1, 2, 3)` was
disallowed by the parser in a dag //expression//, but there were
already ways to sneak a `?` into the operator field of a dag
//value//, e.g. by initializing it from a class template parameter
which is then set to `?` by the instantiating `def`.

This patch makes `?` in the operator slot syntactically legal, so it's
now easy to construct dags with an unset operator. Also, the semantics
of `!con` are relaxed so that it will allow a combination of set and
unset operator fields in the dag nodes it's concatenating, with the
restriction that all the operators that are //not// unset still have
to agree with each other.

Reviewers: hfinkel, nhaehnle

Reviewed By: hfinkel, nhaehnle

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AArch64][SVE] Add wide compare immediate patterns
Cullen Rhodes [Mon, 2 Dec 2019 11:20:28 +0000 (11:20 +0000)]
[AArch64][SVE] Add wide compare immediate patterns

Summary:
Recognize wide compares where the wide operand is a splat of a scalar
value in the appropriate range and convert to the immediate variant of
the instruction.

Patch by Graham Hunter

Reviewers: sdesmalen, efriedma, dancgr, rovka, rengolin

Reviewed By: efriedma

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

Tags: #llvm

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

4 years ago[LegalizeTypes] Bugfixes for big-endian targets when handling BITCASTs
Mikael Holmen [Tue, 10 Dec 2019 07:09:09 +0000 (08:09 +0100)]
[LegalizeTypes] Bugfixes for big-endian targets when handling BITCASTs

Summary:
This fixes PR44135.

The special case when we promote a bitcast from a vector to an int
needs special handling when we are on a big-endian target.

Prior to this fix, for the added vec_to_int we see the following in the
SelectionDAG printouts

Type-legalized selection DAG: %bb.1 'foo:bb.1'
SelectionDAG has 9 nodes:
  t0: ch = EntryToken
        t2: v8i16,ch = CopyFromReg t0, Register:v8i16 %0
      t17: v4i32 = bitcast t2
    t23: i32 = extract_vector_elt t17, Constant:i32<3>
  t8: ch,glue = CopyToReg t0, Register:i32 $r0, t23
  t9: ch = ARMISD::RET_FLAG t8, Register:i32 $r0, t8:1

and I think here the extract_vector_elt is wrong and extracts the value
from the wrong index.

The program program should return the 32 bits made up of the elements at
index 4 and 5 in the vec6 array, but with

    t23: i32 = extract_vector_elt t17, Constant:i32<3>

as far as I can tell, we will extract values that originally didn't even
exist in the vec6 vectore.

If we would instead extract the element at index 2 we would get the wanted
values.

With this fix we insert a right shift after the bitcast in
DAGTypeLegalizer::PromoteIntRes_BITCAST which then gives us

Type-legalized selection DAG: %bb.1 'vec_to_int:bb.1'
SelectionDAG has 9 nodes:
  t0: ch = EntryToken
        t2: v8i16,ch = CopyFromReg t0, Register:v8i16 %0
      t23: v4i32 = bitcast t2
    t27: i32 = extract_vector_elt t23, Constant:i32<2>
  t8: ch,glue = CopyToReg t0, Register:i32 $r0, t27
  t9: ch = ARMISD::RET_FLAG t8, Register:i32 $r0, t8:1

So now we get

    t27: i32 = extract_vector_elt t23, Constant:i32<2>

which is what we want.

Similarly, the new int_to_vec testcase exposes a bug where we cast the other
direction. Then we instead need to add a left shift before the bitcast on
big-endian targets for the bits in the input integer to end up at the exptected
place in the vector.

Reviewers: bogner, spatel, craig.topper, t.p.northover, dmgreen, efriedma, SjoerdMeijer, samparker

Reviewed By: efriedma

Subscribers: eli.friedman, bjope, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoAdd testcases exposing PR44135
Mikael Holmen [Fri, 6 Dec 2019 07:03:13 +0000 (08:03 +0100)]
Add testcases exposing PR44135

4 years ago[llvm-readelf/llvm-readobj] - Improved the error reporting in a few method related...
Georgii Rymar [Thu, 5 Dec 2019 14:59:34 +0000 (17:59 +0300)]
[llvm-readelf/llvm-readobj] - Improved the error reporting in a few method related to versioning.

I was investigating a change previously discussed that eliminates an excessive
empty lines from the output when we report warnings and errors
(https://reviews.llvm.org/D70826#inline-639055) and found
that we need this refactoring or alike to achieve that.

The problem is that some of our functions that finds symbol versions just
fail instead of returning errors or printing warnings. Another problem
is that they might print a warning on the same line with the regular output.
In this patch I've splitted getting of the version information and dumping of it
for GNU printVersionSymbolSection(). I had to change a few methods to return
Error or Expected<> to do that properly.

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

4 years agoAdd more diff -b to roundtrip-compress.test
Hans Wennborg [Tue, 10 Dec 2019 09:21:34 +0000 (10:21 +0100)]
Add more diff -b to roundtrip-compress.test

It was missing on the first test invocation. The flag is necessary to
ignore line-ending differences on Windows.

4 years ago[clangd] Simplify code using findName. NFC
Ilya Biryukov [Tue, 10 Dec 2019 09:08:39 +0000 (10:08 +0100)]
[clangd] Simplify code using findName. NFC

`findName` was always used in conjuction with `spellingLocIfSpelled`.
This patch replaces patterns of the form:
  spellingLocIfSpelled(findName(&ND), SM)

With a new helper function:
  nameLocation(ND, SM)

And removes `spellingLocIfSpelled` and `findName`. Both are never used
anywhere else and the latter is an equivalent of `Decl::getLocation` if
we ever need it again.

4 years ago[llvm-readobj][test] - Move platform specific test cases and their inputs to separate...
Georgii Rymar [Mon, 9 Dec 2019 14:01:29 +0000 (17:01 +0300)]
[llvm-readobj][test] - Move platform specific test cases and their inputs to separate folders.

This creates the next subfolders in the test directory:
"COFF", "ELF", "MachO", "wasm".

I've also removed platform specific prefixes, like "coff-*".
One unused binary was removed as well: `Inputs/relocs.obj.elf-mips`

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

4 years ago[OpenMP][NFCI] Introduce llvm/IR/OpenMPConstants.h
Johannes Doerfert [Tue, 5 Nov 2019 04:00:49 +0000 (22:00 -0600)]
[OpenMP][NFCI] Introduce llvm/IR/OpenMPConstants.h

Summary:
The new OpenMPConstants.h is a location for all OpenMP related constants
(and helpers) to live.

This patch moves the directives there (the enum OpenMPDirectiveKind) and
rewires Clang to use the new location.

Initially part of D69785.

Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim

Subscribers: jholewinski, ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny

Tags: #clang, #llvm

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

4 years ago[BPF] Support to emit debugInfo for extern variables
Yonghong Song [Fri, 22 Nov 2019 16:45:37 +0000 (08:45 -0800)]
[BPF] Support to emit debugInfo for extern variables

extern variable usage in BPF is different from traditional
pure user space application. Recent discussion in linux bpf
mailing list has two use cases where debug info types are
required to use extern variables:
  - extern types are required to have a suitable interface
    in libbpf (bpf loader) to provide kernel config parameters
    to bpf programs.
    https://lore.kernel.org/bpf/CAEf4BzYCNo5GeVGMhp3fhysQ=_axAf=23PtwaZs-yAyafmXC9g@mail.gmail.com/T/#t
  - extern types are required so kernel bpf verifier can
    verify program which uses external functions more precisely.
    This will make later link with actual external function no
    need to reverify.
    https://lore.kernel.org/bpf/87eez4odqp.fsf@toke.dk/T/#m8d5c3e87ffe7f2764e02d722cb0d8cbc136880ed

This patch added bpf support to consume such info into BTF,
which can then be used by bpf loader. Function processFuncPrototypes()
only adds extern function definitions into BTF. The functions
with actual definition have been added to BTF in some other places.

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

4 years agoRemove implicit conversion that promotes half to other larger precision types for...
Jim Lin [Tue, 10 Dec 2019 05:24:21 +0000 (13:24 +0800)]
Remove implicit conversion that promotes half to other larger precision types for fp classification builtins

Summary:
It shouldn't promote half to double or any larger precision types for fp classification builtins.
Because fp classification builtins would get incorrect result with promoted argument.
For example, __builtin_isnormal with a subnormal half value should return false, but it is not.
That the subnormal half value is promoted to a normal double value.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[Remarks][Driver] Error on -foptimization-record-file with multiple -arch options
Francis Visoiu Mistrih [Wed, 4 Dec 2019 17:56:12 +0000 (09:56 -0800)]
[Remarks][Driver] Error on -foptimization-record-file with multiple -arch options

This adds a check for the usage of -foptimization-record-file with
multiple -arch options. This is not permitted since it would require us
to rename the file requested by the user to avoid overwriting it for the
second cc1 invocation.

4 years ago[NFCi][llvm][MIRVRegNamerUtils] Making some code cleanup and stylistic changes.
Puyan Lotfi [Mon, 9 Dec 2019 19:54:09 +0000 (14:54 -0500)]
[NFCi][llvm][MIRVRegNamerUtils] Making some code cleanup and stylistic changes.

Making some changes to MIRVRegNamerUtils.cpp to use some more modern c++
features as well as some changes to generally make the code more concise
and more understandable.

I make this an NFCi because in one case I drop the whole
"if (!MO->isDef()) MO->setIsKill(false);" thing that was added in the
original implementation, generally because I don't think this is really
semantically sound. I also changed up the implementation of
VRegRenamer::createVirtualRegisterWithLowerName somewhat because I am
now lower-casing the name unconditionally because I confirmed that that
was in fact aditya_nandakumar@apple.com's intent.

In all other cases, behavior should not be changed.

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

4 years agoRevert "[compiler-rt] Add a critical section when flushing gcov counters"
Akira Hatanaka [Tue, 10 Dec 2019 03:57:26 +0000 (19:57 -0800)]
Revert "[compiler-rt] Add a critical section when flushing gcov counters"

This reverts commit 88f5bf77f92899b19fdafdffc7b060f930c1cb8b as it broke
green dragon bots.

http://lab.llvm.org:8080/green/job/clang-stage1-RA/4401/

4 years ago[MC] Delete MCCodePadder
Fangrui Song [Fri, 6 Dec 2019 02:18:55 +0000 (18:18 -0800)]
[MC] Delete MCCodePadder

D34393 added MCCodePadder as an infrastructure for padding code with
NOP instructions. It lacked tests and was not being worked on since
then.

Intel has now worked on an assembler patch to mitigate performance loss
after applying microcode update for the Jump Conditional Code Erratum.

https://www.intel.com/content/www/us/en/support/articles/000055650/processors.html

This new patch shares similarity with MCCodePadder, but has a concrete
use case in mind and is being actively developed. The infrastructure it
introduces can potentially be used for general performance improvement
via alignment. Delete the unused MCCodePadder so that people can develop
the new feature from a clean state.

Reviewed By: jyknight, skan

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

4 years agoTurn off unused variable checking here since we're explicitly adding
Eric Christopher [Tue, 10 Dec 2019 03:13:31 +0000 (19:13 -0800)]
Turn off unused variable checking here since we're explicitly adding
a command line for clang-tidy.

4 years ago[NFC][MacroFusion] Adding the assertion if someone want to fuse more than 2 instructions
QingShan Zhang [Tue, 10 Dec 2019 03:10:21 +0000 (03:10 +0000)]
[NFC][MacroFusion] Adding the assertion if someone want to fuse more than 2 instructions

As discussed in https://reviews.llvm.org/D69998, we miss to create some dependency edges
if chained more than 2 instructions. Adding an assertion here if someone want to chain
more than 2 instructions.

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

4 years agoRemove unused Unit test directory for xray.
Eric Christopher [Tue, 10 Dec 2019 02:40:05 +0000 (18:40 -0800)]
Remove unused Unit test directory for xray.

4 years ago[c++20] Fix handling of unqualified lookups from a defaulted comparison
Richard Smith [Thu, 5 Dec 2019 21:37:35 +0000 (13:37 -0800)]
[c++20] Fix handling of unqualified lookups from a defaulted comparison
function.

We need to perform unqualified lookups from the context of a defaulted
comparison, but not until we implicitly define the function, at which
point we can't do those lookups any more. So perform the lookup from the
end of the class containing the =default declaration and store the
lookup results on the defaulted function until we synthesize the body.

4 years ago[NFC] Add { } to silence compiler warning [-Wmissing-braces].
Huihui Zhang [Tue, 10 Dec 2019 01:19:34 +0000 (17:19 -0800)]
[NFC] Add { } to silence compiler warning [-Wmissing-braces].

../llvm/lib/Target/PowerPC/PPCISelLowering.cpp:5371:37: warning: suggest braces around initialization of subobject [-Wmissing-braces]
  std::array<EVT, 2> ReturnTypes = {MVT::Other, MVT::Glue};
                                    ^~~~~~~~~~~~~~~~~~~~~
                                    {                    }

4 years ago[llvm/dwarfdump] Use the architecture string to filter.
Jonas Devlieghere [Tue, 10 Dec 2019 01:14:10 +0000 (17:14 -0800)]
[llvm/dwarfdump] Use the architecture string to filter.

Currently dwarfdump uses the ArchType to filter out architectures, which
is problematic for architectures like arm64e and x86_64h that map back
to arm64 and x86_64 respectively. The result is that the filter doesn't
work for these architectures because it matches all the variants. This
is especially bad because usually these architectures are the reason to
use the filter in the first place.

Instead, we should match the architecture based on the string name. This
means the filter works for the values printed by dwarfdump. It has the
unfortunate side effect of not working for aliases, like AArch64, but I
think that's worth the trade-off.

rdar://53653014

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

4 years ago[FormatManager] GetCandidateLanguages shouldn't know about ValueObject.
Davide Italiano [Tue, 10 Dec 2019 01:04:46 +0000 (17:04 -0800)]
[FormatManager] GetCandidateLanguages shouldn't know about ValueObject.

Reviewers: jingham, teemperor, JDevlieghere, aprantl

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoadd support for strict operation fpextend/fpround/fsqrt on X86 backend
Liu, Chen3 [Tue, 10 Dec 2019 01:04:28 +0000 (09:04 +0800)]
add support for strict operation fpextend/fpround/fsqrt on X86 backend

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

4 years agoRevert "[ARM][MVE] Add intrinsics for immediate shifts."
Eric Christopher [Tue, 10 Dec 2019 00:47:38 +0000 (16:47 -0800)]
Revert "[ARM][MVE] Add intrinsics for immediate shifts."
and two follow-on commits: one warning fix and one functionality.

As it's breaking at least the lto bot:

http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/15132/steps/test-stage1-compiler/logs/stdio

This reverts commits:

 8d70f3c933a5b81a87a5ab1af0e3e98ee2cd7c67
 ff4dceef9201c5ae3924e92f6955977f243ac71d
 d97b3e3e65cd77a81b39732af84a1a4229e95091

4 years agoAvoid Attr.h includes, CodeGen edition
Reid Kleckner [Tue, 10 Dec 2019 00:11:56 +0000 (16:11 -0800)]
Avoid Attr.h includes, CodeGen edition

This saves around 20 includes of Attr.h. Not much.

4 years ago[ConstantFold][SVE] Fix constant folding for shufflevector.
Eli Friedman [Fri, 6 Dec 2019 20:33:46 +0000 (12:33 -0800)]
[ConstantFold][SVE] Fix constant folding for shufflevector.

Don't try to fold away shuffles which can't be folded.  Fix creation of
shufflevector constant expressions.

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

4 years ago[Codegen][X86] Modernize/regenerate old tests. NFCI.
Dávid Bolvanský [Mon, 9 Dec 2019 15:47:47 +0000 (16:47 +0100)]
[Codegen][X86] Modernize/regenerate old tests. NFCI.

Summary:
Switch to FileCheck where possible.
Adjust tests so they can be easily regenerated by update scripts.

Reviewers: craig.topper, spatel, RKSimon

Reviewed By: spatel

Subscribers: MatzeB, qcolombet, arphaman, jfb, llvm-commits

Tags: #llvm

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

4 years ago[AArch64][SVE] Implement SPLAT_VECTOR for i1 vectors.
Eli Friedman [Sat, 7 Dec 2019 02:05:41 +0000 (18:05 -0800)]
[AArch64][SVE] Implement SPLAT_VECTOR for i1 vectors.

The generated sequence with whilelo is unintuitive, but it's the best
I could come up with given the limited number of SVE instructions that
interact with scalar registers. The other sequence I was considering
was something like dup+cmpne, but an extra scalar instruction seems
better than an extra vector instruction.

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

4 years ago[c++20] Defaulted comparison support for array members.
Richard Smith [Fri, 6 Dec 2019 02:51:19 +0000 (18:51 -0800)]
[c++20] Defaulted comparison support for array members.

4 years ago[FormatManager] Provide a single entrypoint for GetCandidateLanguages().
Davide Italiano [Mon, 9 Dec 2019 22:48:36 +0000 (14:48 -0800)]
[FormatManager] Provide a single entrypoint for GetCandidateLanguages().

4 years agoAlso synthesize _cmd and self for properties
Pierre Habouzit [Mon, 9 Dec 2019 22:27:57 +0000 (14:27 -0800)]
Also synthesize _cmd and self for properties

Patch by: Pierre Habouzit

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

4 years agoImplement LWG#1203 for raw_ostream.
Christian Sigg [Mon, 9 Dec 2019 21:32:53 +0000 (13:32 -0800)]
Implement LWG#1203 for raw_ostream.

Implement LWG#1203 (https://cplusplus.github.io/LWG/issue1203) for raw_ostream
like libc++ does for std::basic_ostream<...>.

Add a operator<< overload that takes an rvalue reference of a typed derived from
raw_ostream, streams the value to it and returns the stream of the same type as
the argument.

This allows free operator<< to work with rvalue reference raw_ostreams:
raw_ostream& operator<<(raw_ostream&, const SomeType& Value);
raw_os_ostream(std::cout) << SomeType();

It also allows using the derived type like:
auto Foo = (raw_string_ostream(buffer) << "foo").str();

Author: Christian Sigg <csigg@google.com>
Differential Revision: https://reviews.llvm.org/D70686

4 years ago[hwasan] Offline symbolization script.
Evgenii Stepanov [Fri, 6 Dec 2019 21:43:44 +0000 (13:43 -0800)]
[hwasan] Offline symbolization script.

Summary:
A script to symbolize hwasan reports after the fact using unstripped
binaries. Supports stack-based reports. Requires llvm-symbolizer
(addr2line is not an option).

Reviewers: pcc, hctim

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[PowerPC] [NFC] Cleanup xxpermdi peephole optimization
Jinsong Ji [Mon, 9 Dec 2019 21:26:43 +0000 (21:26 +0000)]
[PowerPC] [NFC] Cleanup xxpermdi peephole optimization

Summary:
Following on from rG884351547da2, this patch cleans up the logic for `xxpermdi`
peephole optimizations by converting two layers of nested `if`s to early breaks
and simplifying the logic.

Reviewers: hfinkel, nemanjai, jsji, lkail, #powerpc, steven.zhang

Reviewed By: #powerpc, steven.zhang

Subscribers: wuzish, steven.zhang, hiraditya, kbarton, shchenz, llvm-commits

Tags: #llvm

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

Patch by vddvss (Colin Samples).

4 years ago[libc] Add implementation of errno and define the other macros of errno.h.
Siva Chandra Reddy [Thu, 5 Dec 2019 20:09:24 +0000 (12:09 -0800)]
[libc] Add implementation of errno and define the other macros of errno.h.

Reviewers: stanshebs, alexbrachet

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Tags: #libc-project

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

4 years ago[IPConstantProp][NFCI] Improve and modernize tests
Johannes Doerfert [Sat, 2 Nov 2019 04:36:41 +0000 (23:36 -0500)]
[IPConstantProp][NFCI] Improve and modernize tests

Summary:
This change is in preparation to reuse these test for the Attributor.
It mainly is to remove UB, make it clear what is tested, and use
"modern" run lines.

Reviewers: fhahn, efriedma, mssimpso, davide

Subscribers: bollu, llvm-commits

Tags: #llvm

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

4 years ago[ValueTracking] Allow context-sensitive nullness check for non-pointers
Johannes Doerfert [Mon, 9 Dec 2019 04:11:16 +0000 (22:11 -0600)]
[ValueTracking] Allow context-sensitive nullness check for non-pointers

Summary:
Same as D60846 and D69571 but with a fix for the problem encountered
after them. Both times it was a missing context adjustment in the
handling of PHI nodes.

The reproducers created from the bugs that caused the old commits to be
reverted are included.

Reviewers: nikic, nlopes, mkazantsev, spatel, dlrobertson, uabelho, hakzsam, hans

Subscribers: hiraditya, bollu, asbirlea, llvm-commits

Tags: #llvm

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

4 years agoInclude Stmt.h where it seems to be necessary for modules builds
Reid Kleckner [Mon, 9 Dec 2019 21:03:06 +0000 (13:03 -0800)]
Include Stmt.h where it seems to be necessary for modules builds

Summary:
After 60573ae6fe50 removed an include of Expr.h from ASTContext.h, this
header fails to compile in some modular build configurations. I have not
been able to reproduce the problem locally. The header compiles fine in
isolation. However, based on reading the code, it seems like it would
require Stmt to be complete. Based on that intuition, we decided to add the
include.

Reviewers: rdhindsa

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[PGO][PGSO] Instrument the code gen / target passes.
Hiroshi Yamauchi [Thu, 5 Dec 2019 17:39:37 +0000 (09:39 -0800)]
[PGO][PGSO] Instrument the code gen / target passes.

Summary:
Split off of D67120.

Add the profile guided size optimization instrumentation / queries in the code
gen or target passes. This doesn't enable the size optimizations in those passes
yet as they are currently disabled in shouldOptimizeForSize (for non-IR pass
queries).

A second try after reverted D71072.

Reviewers: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Attr] Move ParsedTargetAttr out of the TargetAttr class
Craig Topper [Mon, 9 Dec 2019 18:34:24 +0000 (10:34 -0800)]
[Attr] Move ParsedTargetAttr out of the TargetAttr class

Need to forward declare it in ASTContext.h for D68627, so it can't be a nested struct.

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

4 years ago[c++20] Fix incorrect assumptions in checks for comparison category types.
Richard Smith [Mon, 9 Dec 2019 20:08:59 +0000 (12:08 -0800)]
[c++20] Fix incorrect assumptions in checks for comparison category types.

In the presence of modules, we can have multiple lookup results for the
same entity, and we need to re-check for completeness each time we
consider a type.

4 years ago[clang][IFS] Allow 2 output files when using -o and -c with clang IFS stubs.
Puyan Lotfi [Wed, 27 Nov 2019 04:23:49 +0000 (23:23 -0500)]
[clang][IFS] Allow 2 output files when using -o and -c with clang IFS stubs.

This patch allows for -o to be used with -c when compiling with clang
interface stubs enabled. This is because the second file will be an
intermediate ifs stubs file that is the text stub analog of the .o file.
Both get produces in this case, so two files.

Why are we doing this? Because we want to support the case where
interface stubs are used bu first invoking clang like so:

clang -c <other flags> -emit-interface-stubs foo.c -o foo.o
...
clang -emit-interface-stubs <.o files> -o libfoo.so

This should generate N .ifs files, and one .ifso file. Prior to this
patch, using -o with the -c invocation was not possible. Currently the
clang driver supports generating a a.out/.so file at the same time as a
merged ifs file / ifso file, but this is done by checking that the final
job is the IfsMerge job. When -c is used, the final job is a Compile job
so what this patch does is check to figure out of the job type is
TY_IFS_CPP.

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

4 years agoFix clang -Wcovered-switch-default after llvmorg-10-init-11484-g6626e5a06a9
Fangrui Song [Mon, 9 Dec 2019 19:31:01 +0000 (11:31 -0800)]
Fix clang -Wcovered-switch-default after llvmorg-10-init-11484-g6626e5a06a9

We need to place llvm_unreachable after switch to work around the GCC
warning.

4 years ago[InstCombine] add tests for shuffle with insertelement operand; NFC
Sanjay Patel [Mon, 9 Dec 2019 18:59:50 +0000 (13:59 -0500)]
[InstCombine] add tests for shuffle with insertelement operand; NFC

4 years ago[PowerPC][NFC] Rename ANDI(S)o8 to ANDI(S)8o
Jinsong Ji [Thu, 5 Dec 2019 03:17:48 +0000 (03:17 +0000)]
[PowerPC][NFC] Rename ANDI(S)o8 to ANDI(S)8o

Summary:
This is found during https://reviews.llvm.org/D70758
All the other record forms are having suffix o at the end.
ANDIo8 and ANDISo8 are the only two that put o before 8.

This patch rename them to be consistent with others.

Reviewers: #powerpc, hfinkel, nemanjai, lei, steven.zhang, echristo, jhibbits, joerg

Reviewed By: jhibbits

Subscribers: wuzish, hiraditya, kbarton, shchenz, llvm-commits

Tags: #llvm

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

4 years agoThe field ‘totalFrames’ which is total number of frames available, is mandatory in...
Serhiy Redko [Sun, 8 Dec 2019 04:11:35 +0000 (20:11 -0800)]
The field ‘totalFrames’ which is total number of frames available, is mandatory in StackTraces response for VSCode extension that implements DAP and declares capability 'supportsDelayedStackTraceLoading':

"The debug adapter supports the delayed loading of parts of the stack,
which requires that both the 'startFrame' and 'levels' arguments and the
'totalFrames' result of the 'StackTrace' request are supported."

Lack of this field makes VSCode incorrectly display stack traces information

D71034

4 years ago[clangd] also filter out another possible diag from MS ASM syntax
Sam McCall [Mon, 9 Dec 2019 18:21:58 +0000 (19:21 +0100)]
[clangd] also filter out another possible diag from MS ASM syntax

4 years agoMagic number checker shouldn't warn on user defined string literals
Tibor Brunner [Mon, 9 Dec 2019 18:12:14 +0000 (13:12 -0500)]
Magic number checker shouldn't warn on user defined string literals

Fixes a false positive brought up by PR40633.

4 years agoscudo: Add a basic malloc/free benchmark.
Peter Collingbourne [Fri, 6 Dec 2019 00:44:07 +0000 (16:44 -0800)]
scudo: Add a basic malloc/free benchmark.

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

4 years agoReland 198fbcb8, "Driver: Don't look for libc++ headers in the install directory...
Peter Collingbourne [Fri, 6 Dec 2019 23:54:47 +0000 (15:54 -0800)]
Reland 198fbcb8, "Driver: Don't look for libc++ headers in the install directory on Android.", which was reverted in b3249027.

Fixed the test case to set --sysroot, which lets it succeed in the case where
a directory named "/usr/include/c++/v1" or "/usr/local/include/c++/v1" exists.

Original commit message:
> The NDK uses a separate set of libc++ headers in the sysroot. Any headers
> in the installation directory are not going to work on Android, not least
> because they use a different name for the inline namespace (std::__1 instead
> of std::__ndk1).
>
> This effectively makes it impossible to produce a single toolchain that is
> capable of targeting both Android and another platform that expects libc++
> headers to be installed in the installation directory, such as Mac.
>
> In order to allow this scenario to work, stop looking for headers in the
> install directory on Android.

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

4 years ago[lldb] Clean up accidentally passing TestDeadStrip.py
Pavel Labath [Mon, 9 Dec 2019 17:52:49 +0000 (18:52 +0100)]
[lldb] Clean up accidentally passing TestDeadStrip.py

This test was accidentally passing on non-darwin OS because it was
explicitly setting the CFLAGS make variable. This meant that (in the
default config) it was building with absolutely no debug info, and so
setting a breakpoint on a stripped symbol failed, because there was
really no trace of it remaining. In other configurations, we were
generating the debug info (-gsplit-dwarf implies -g) and the test failed
because we did not treat the zeroed out debug info address specially.
The test was also xfailed in pretty much every non-standard
configuration.

This patch fixes the makefile to avoid messing with CFLAGS (use
CFLAGS_EXTRAS instead). This causes it to fail in all configurations
(except darwin), and so I replace the various decorators with a simple
os!=darwin check.

4 years ago[clangd] Delete ctor initializers while moving functions out-of-line
Kadir Cetinkaya [Mon, 9 Dec 2019 10:54:21 +0000 (11:54 +0100)]
[clangd] Delete ctor initializers while moving functions out-of-line

Summary:
Currently we only delete function body from declaration, in addition to
that we should also drop ctor initializers.

Unfortunately CXXConstructorDecl doesn't store the location of `:` before
initializers, therefore we make use of token buffer to figure out where to start
deletion.

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

Reviewers: hokein, ilya-biryukov

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

Tags: #clang

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

4 years ago[clangd] Delete default arguments while moving functions out-of-line
Kadir Cetinkaya [Mon, 9 Dec 2019 09:38:36 +0000 (10:38 +0100)]
[clangd] Delete default arguments while moving functions out-of-line

Summary:
Only function declarations should have the default arguments.

This patch makes sure we don't propogate those arguments to out-of-line
definitions.

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

Reviewers: hokein

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

Tags: #clang

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

4 years ago[ARM][MVE][Intrinsics] Add VQADDQ, VHADDQ, VRHADDQ, VQSUBQ, VHSUBQ, VQDMULHQ, VQRDMUL...
Mark Murray [Fri, 6 Dec 2019 17:39:15 +0000 (17:39 +0000)]
[ARM][MVE][Intrinsics] Add VQADDQ, VHADDQ, VRHADDQ, VQSUBQ, VHSUBQ, VQDMULHQ, VQRDMULHQ intrinsics.

Summary: Add VQADDQ, VHADDQ, VRHADDQ, VQSUBQ, VHSUBQ, VQDMULHQ, VQRDMULHQ intrinsics and unit tests.

Reviewers: simon_tatham, ostannard, dmgreen, miyuki

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

Tags: #clang, #llvm

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

4 years ago[ARM][MVE][Intrinsics] Add VMULL[BT]Q_(INT|POLY) intrinsics.
Mark Murray [Wed, 4 Dec 2019 14:28:22 +0000 (14:28 +0000)]
[ARM][MVE][Intrinsics] Add VMULL[BT]Q_(INT|POLY) intrinsics.

Summary: Add VMULL[BT]Q_(INT|POLY) intrinsics and unit tests.

Reviewers: simon_tatham, ostannard, dmgreen

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

Tags: #clang, #llvm

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

4 years ago[PowerPC] Refactor FinishCall. [NFC]
Sean Fertile [Mon, 9 Dec 2019 17:26:16 +0000 (12:26 -0500)]
[PowerPC] Refactor FinishCall. [NFC]

Refactor FinishCall to be more easily understandable as a precursor to
implementing indirect calls for AIX. The refactor tries to group similar
code together at the cost of some code duplication. The high level
overview of the refactor:

- Adds a number of helper functions for things like:
  * Determining if a call is indirect.
  * What the Opcode for a call is.
  * Transforming the callee for a direct function call.
  * Extracting the Chain operand from a CallSeqStart node.
  * Building the operands of the call.

- Adds helpers for building the indirect call DAG nodes
  (excluding the call instruction itself which is created in
  `FinishCall`).

- Removes PrepareCall, which has been subsumed by the
  helpers.

- Rename 'InFlag' to 'Glue'.

- FinishCall has been refactored to:
  1) Set TOC pointer usage on the DAG for the TOC based
     subtargets.
  2) Calculate if a call is indirect.
  3) Determine the Opcode to use for the call
     instruction.
  4) Transform the Callee for direct calls, or build
     the DAG nodes for indirect calls.
  5) Buildup the call operands.
  6) Emit the call instruction.
  7) If needed, emit the callSeqEnd Node and
     finish lowering by calling `LowerCallResult`

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

4 years ago[lldb/SWIG] Guard Python type map in SWIG interface by SWIGPYTHON
Jonas Devlieghere [Mon, 9 Dec 2019 17:33:32 +0000 (09:33 -0800)]
[lldb/SWIG] Guard Python type map in SWIG interface by SWIGPYTHON

Guard the Python type map in SBTarget by the SWIGPYTHON define to
ensures the rest of the interface can be reused for other languages
supported by SWIG.

4 years ago[lldb][CMake] Fix build for the case of custom libedit installation
Tatyana Krasnukha [Mon, 9 Dec 2019 16:31:29 +0000 (19:31 +0300)]
[lldb][CMake] Fix build for the case of custom libedit installation

4 years ago[ARM] Fix NEON failure introduced by D71065.
Simon Tatham [Mon, 9 Dec 2019 16:51:18 +0000 (16:51 +0000)]
[ARM] Fix NEON failure introduced by D71065.

I rewrote the isel tablegen for MVE immediate shifts, and accidentally
removed the `let Predicates=[HasMVEInt]` that was wrapping the old
version, which seems to have allowed those rules to cause trouble on
non-MVE targets. That's what I get for only re-running the MVE tests.

4 years ago[GWP-ASan] 32-bit test pointers, allow multi-init for test.
Mitch Phillips [Mon, 9 Dec 2019 16:19:39 +0000 (08:19 -0800)]
[GWP-ASan] 32-bit test pointers, allow multi-init for test.

Summary:
GWP-ASan test currently fail on 32-bit platforms, as some of the pointers are
larger than `uintptr_t` on 32-bit platforms. Fix up all those instances.

Also add an uncompress varint test where the result is an underflow.

Furthermore, allow multi-init for testing. Each gtest when running
`check-gwp_asan` apparently runs in its own instance, but when integrating
these tests into Android, this behaviour isn't the same. We remove the
global multi-init check here, to allow for testing to work elsewhere, and we're
not really worried about multi-init anyway as it's part of our contract with
the allocator.

Reviewers: eugenis, vlad.tsyrklevich

Reviewed By: eugenis

Subscribers: #sanitizers, llvm-commits, pcc

Tags: #sanitizers, #llvm

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

4 years agoFix the compiler warnings: "-Winconsistent-missing-override", "-Wunused-variable"
Haojian Wu [Mon, 9 Dec 2019 16:07:52 +0000 (17:07 +0100)]
Fix the compiler warnings: "-Winconsistent-missing-override", "-Wunused-variable"

for d97b3e3e65cd77a81b39732af84a1a4229e95091

4 years ago[clangd] Implement range patching heuristics for cross-file rename.
Haojian Wu [Mon, 9 Dec 2019 16:00:51 +0000 (17:00 +0100)]
[clangd] Implement range patching heuristics for cross-file rename.

Reviewers: sammccall, ilya-biryukov

Reviewed By: sammccall

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

Tags: #clang

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

4 years ago[llvm][VFABI] Add more testing for LLVM internal mangling.
Francesco Petrogalli [Fri, 6 Dec 2019 20:32:18 +0000 (20:32 +0000)]
[llvm][VFABI] Add more testing for LLVM internal mangling.

Summary:
The tests cover the internal mangling for:

1. Masked signatures.
2. Scalable signatures.
3. Masked scalable signatures with linear.

Reviewers: andwar

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[ARM][MVE] Add intrinsics for immediate shifts.
Simon Tatham [Mon, 9 Dec 2019 15:43:50 +0000 (15:43 +0000)]
[ARM][MVE] Add intrinsics for immediate shifts.

Summary:
This adds the family of `vshlq_n` and `vshrq_n` ACLE intrinsics, which
shift every lane of a vector left or right by a compile-time
immediate. They mostly work by expanding to the IR `shl`, `lshr` and
`ashr` operations, with their second operand being a vector splat of
the immediate.

There's a fiddly special case, though. ACLE specifies that the
immediate in `vshrq_n` can take values up to //and including// the bit
size of the vector lane. But LLVM IR thinks that shifting right by the
full size of the lane is UB, and feels free to replace the `lshr` with
an `undef` half way through the optimization pipeline. Hence, to keep
this legal in source code, I have to detect it at codegen time.
Logical (unsigned) right shifts by the element size are handled by
simply emitting the zero vector; arithmetic ones are converted into a
shift of one bit less, which will always give the same output.

In order to do that check, I also had to enhance the tablegen
MveEmitter so that it can cope with converting a builtin function's
operand into a bare integer to pass to a code-generating subfunction.
Previously the only bare integers it knew how to handle were flags
generated from within `arm_mve.td`.

Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard

Reviewed By: MarkMurrayARM

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

Tags: #clang, #llvm

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

4 years ago[ModuloSchedule] Fix data types in ModuloScheduleExpander::isLoopCarried
Thomas Raoux [Mon, 9 Dec 2019 15:24:18 +0000 (07:24 -0800)]
[ModuloSchedule] Fix data types in ModuloScheduleExpander::isLoopCarried

The cycle values in modulo scheduling results can be negative.
The result of ModuloSchedule::getCycle() must be received as an int type.

Patch by Masaki Arai!

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

4 years ago[clangd] Use expansion location when the ref is inside macros.
Haojian Wu [Mon, 9 Dec 2019 11:00:42 +0000 (12:00 +0100)]
[clangd] Use expansion location when the ref is inside macros.

Summary:
Previously, xrefs has inconsistent behavior when the reference is inside
macro body:
- AST-based xrefs (for main file) uses the expansion location;
- our index uses the spelling location;

This patch makes our index use file locations for references, which is
consistent with AST-based xrefs, and kythe as well.

After this patch, memory usage of static index on LLVM increases ~5%.

Reviewers: ilya-biryukov

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

Tags: #clang

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

4 years agoFix compilation warning from GCC7. NFC.
Michael Liao [Mon, 9 Dec 2019 15:09:28 +0000 (10:09 -0500)]
Fix compilation warning from GCC7. NFC.

4 years ago[test][llvm-cxxfilt] Add missing '-n'
James Henderson [Mon, 9 Dec 2019 15:06:00 +0000 (15:06 +0000)]
[test][llvm-cxxfilt] Add missing '-n'

See also e84468c1f.

4 years agoFix build bot fails due to the patch here:
Zahira Ammarguellat [Mon, 9 Dec 2019 14:24:47 +0000 (09:24 -0500)]
Fix build bot fails due to the patch here:
https://reviews.llvm.org/D70691
Fixed the LIT test case. Added the REQUIRES instruction.

4 years ago[lldb] Remove Xfail decorators from steadily passing tests
Muhammad Omair Javaid [Mon, 9 Dec 2019 14:07:14 +0000 (19:07 +0500)]
[lldb] Remove Xfail decorators from steadily passing tests

This patch removes xfail decorator from some lldb testcases which are
passing steadily now for past few week/months on aarch64/linux buildbot.

4 years ago[test][llvm-cxxfilt] Fix darwin build bot
James Henderson [Mon, 9 Dec 2019 13:58:40 +0000 (13:58 +0000)]
[test][llvm-cxxfilt] Fix darwin build bot

When committing dba420bc05ae, I missed that a darwin-specific change had
been recently introduced into llvm-cxxfilt, which my change ignored and
consequently broke the darwin build bot. This change fixes this issue as
well as improving naming/commenting of things related to this point so
that people are less likely to run into the same issue as I did.

4 years ago[clangd] Allow extract-to-function on regions that always return.
Sam McCall [Thu, 21 Nov 2019 22:14:01 +0000 (23:14 +0100)]
[clangd] Allow extract-to-function on regions that always return.

Summary:
We only do a trivial check whether the region always returns - it has to end
with a return statement.

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[RISCV] Fix mir-target-flags.ll
Sam Elliott [Mon, 9 Dec 2019 13:51:08 +0000 (13:51 +0000)]
[RISCV] Fix mir-target-flags.ll

4 years ago[Parser] Don't crash on MS assembly if target desc/asm parser isn't linked in.
Sam McCall [Mon, 9 Dec 2019 10:57:23 +0000 (11:57 +0100)]
[Parser] Don't crash on MS assembly if target desc/asm parser isn't linked in.

Summary:
Instead, emit a diagnostic and return an empty ASM node, as we do if the target
is missing.

Filter this diagnostic out in clangd, where it's not meaningful.

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

Reviewers: kadircet

Subscribers: mgorny, ilya-biryukov, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[RISCV] Machine Operand Flag Serialization
Sam Elliott [Mon, 9 Dec 2019 13:16:28 +0000 (13:16 +0000)]
[RISCV] Machine Operand Flag Serialization

Summary:
These hooks ensure that the RISC-V backend can serialize and parse MIR
correctly.

Reviewers: jrtc27, luismarques

Reviewed By: luismarques

Subscribers: hiraditya, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, sameer.abuasal, apazos, llvm-commits

Tags: #llvm

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

4 years ago[DebugInfo][EarlyCSE] Use the salvageDebugInfoOrMarkUndef(); NFC
Djordje Todorovic [Thu, 5 Dec 2019 13:28:55 +0000 (14:28 +0100)]
[DebugInfo][EarlyCSE] Use the salvageDebugInfoOrMarkUndef(); NFC

Use the newest API.

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

4 years ago[DebugInfo] Nerf placeDbgValues, with prejudice
Jeremy Morse [Mon, 9 Dec 2019 11:26:44 +0000 (11:26 +0000)]
[DebugInfo] Nerf placeDbgValues, with prejudice

CodeGenPrepare::placeDebugValues moves variable location intrinsics to be
immediately after the Value they refer to. This makes tracking of locations
very easy; but it changes the order in which assignments appear to the
debugger, from the source programs order to the order in which the
optimised program computes values. This then leads to PR43986 and PR38754,
where variable locations that were in a conditional block are made
unconditional, which is highly misleading.

This patch adjusts placeDbgValues to only re-order variable location
intrinsics if they use a Value before it is defined, significantly reducing
the damage that it does. This is still not 100% safe, but the rest of
CodeGenPrepare needs polishing to correctly update debug info when
optimisations are performed to fully fix this.

This will probably break downstream debuginfo tests -- if the
instruction-stream position of variable location changes isn't the focus of
the test, an easy fix should be to manually apply placeDbgValues' behaviour
to the failing tests, moving dbg.value intrinsics next to SSA variable
definitions thus:

  %foo = inst1
  %bar = ...
  %baz = ...
  void call @llvm.dbg.value(metadata i32 %foo, ...

to

  %foo = inst1
  void call @llvm.dbg.value(metadata i32 %foo, ...
  %bar = ...
  %baz = ...

This should return your test to exercising whatever it was testing before.

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

4 years ago[Attr] Add missing header for clang example.
David Green [Mon, 9 Dec 2019 12:43:37 +0000 (12:43 +0000)]
[Attr] Add missing header for clang example.

The examples are easy to miss.

4 years ago[lldb/DWARF] Switch to llvm location list parser
Pavel Labath [Fri, 22 Nov 2019 11:02:55 +0000 (12:02 +0100)]
[lldb/DWARF] Switch to llvm location list parser

Summary:
This patch deletes the lldb location list parser and teaches the
DWARFExpression class to use the parser in llvm instead. I have
centralized all the places doing the parsing into a single
GetLocationExpression function.

In theory the the actual location list parsing should be covered by llvm
tests, and this glue code by our existing location list tests, but since
we don't have that many location list tests, I've tried to extend the
coverage a bit by adding some explicit dwarf5 loclist handling and a
test of the dumping code.

For DWARF4 location lists this should be NFC (modulo small differences
in error handling which should only show up on invalid inputs). In case
of DWARF5, this fixes various missing bits of functionality, most
notably, the lack of support for DW_LLE_offset_pair.

Reviewers: JDevlieghere, aprantl, clayborg

Subscribers: lldb-commits, dblaikie

Tags: #lldb

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

4 years ago[lldb] Improve/fix base address selection in location lists
Pavel Labath [Wed, 20 Nov 2019 15:25:55 +0000 (16:25 +0100)]
[lldb] Improve/fix base address selection in location lists

Summary:
Lldb support base address selection entries in location lists was broken
for a long time. This wasn't noticed until llvm started producing these
kinds of entries more frequently with r374600.

In r374769, I made a quick patch which added sufficient support for them
to get the test suite to pass. However, I did not fully understand how
this code operates, and so the fix was not complete. Specifically, what
was lacking was the ability to handle modules which were not loaded at
their preferred load address (for instance, due to ASLR).

Now that I better understand how this code works, I've come to the
conclusion that the current setup does not provide enough information
to correctly process these entries. In the current setup the location
lists were parameterized by two addresses:
- the distance of the function start from the start of the compile unit.
  The purpose of this was to make the location ranges relative to the
  start of the function.
- the actual address where the function was loaded at. With this the
  function-start-relative ranges can be translated to actual memory
  locations.

The reason for the two values, instead of just one (the load bias) is (I
think) MachO, where the debug info in the object files will appear to be
relative to the address zero, but the actual code it refers to
can be moved and reordered by the linker. This means that the location
lists need to be "linked" to reflect the locations in the actual linked
file.

These two bits of information were enough to correctly process location
lists which do not contain base address selection entries (and so all
entries are relative to the CU base). However, they don't work with
them because, in theory two base address can be completely unrelated (as
can happen for instace with hot/cold function splitting, where the
linker can reorder the two pars arbitrarily).

To fix that, I split the first parameter into two:
- the compile unit base address
- the function start address, as is known in the object file

The new algorithm becomes:
- the location lists are processed as they were meant to be processed.
  The CU base address is used as the initial base address value. Base
  address selection entries can set a new base.
- the difference between the "file" and "load" function start addresses
  is used to compute the load bias. This value is added to the final
  ranges to get the actual memory location.

This algorithm is correct for non-MachO debug info, as there the
location lists correctly describe the code in the final executable, and
the dynamic linker can just move the entire module, not pieces of it. It
will also be correct for MachO if the static linker preserves relative
positions of the various parts of the location lists -- I don't know
whether it actually does that, but judging by the lack of base address
selection support in dsymutil and lldb, this isn't something that has
come up in the past.

I add a test case which simulates the ASLR scenario and demonstrates
that base address selection entries now work correctly here.

Reviewers: JDevlieghere, aprantl, clayborg

Subscribers: dblaikie, lldb-commits

Tags: #lldb

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

4 years ago[test][tools] Add missing and improve testing
James Henderson [Mon, 9 Dec 2019 11:43:47 +0000 (11:43 +0000)]
[test][tools] Add missing and improve testing

Mostly this adds testing for certain aliases in more explicit ways.
There are also a few tidy-ups, and additions of missing testing, where
the feature was either not tested at all, or not tested explicitly and
sufficiently.

Reviewed by: MaskRay, rupprecht, grimar

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