platform/upstream/llvm.git
4 years agoAMDGPU/GlobalISel: Add boilerplate for inline asm lowering
Matt Arsenault [Fri, 29 May 2020 20:28:22 +0000 (16:28 -0400)]
AMDGPU/GlobalISel: Add boilerplate for inline asm lowering

Test mostly from minor adjustments to the AArch64 one.

4 years ago[DebugInfo][DAG] Don't reuse debug location on COPY if width changes.
Tobias Bosch [Thu, 28 May 2020 22:40:43 +0000 (15:40 -0700)]
[DebugInfo][DAG] Don't reuse debug location on COPY if width changes.

Summary:
This caused incorrect debug information for parameters:
Previously, after a COPY of a parameter that changes the width,
we would emit a DBG_VALUE that continues to be associated to that
parameter, even though it now used a different width.
This made the LiveDebugValues pass assume the parameter value
got clobbered and it stopped tracking the parameter entry
value, leading to incorrect debug information.

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

Subscribers: aprantl, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoProcess gep (phi ptr1, ptr2) in SROA
Stanislav Mekhanoshin [Thu, 30 Apr 2020 23:53:13 +0000 (16:53 -0700)]
Process gep (phi ptr1, ptr2) in SROA

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

4 years ago[Matrix] Implement + and - operators for MatrixType.
Florian Hahn [Fri, 29 May 2020 19:42:22 +0000 (20:42 +0100)]
[Matrix] Implement + and - operators for MatrixType.

This patch implements the + and - binary operators for values of
MatrixType. It adds support for matrix +/- matrix, scalar +/- matrix and
matrix +/- scalar.

For the matrix, matrix case, the types must initially be structurally
equivalent. For the scalar,matrix variants, the element type of the
matrix must match the scalar type.

Reviewers: rjmccall, anemet, Bigcheese, rsmith, martong

Reviewed By: rjmccall

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

4 years ago[ASTMatchers] Matchers related to C++ inheritance
Jan Korous [Wed, 29 Apr 2020 03:00:49 +0000 (20:00 -0700)]
[ASTMatchers] Matchers related to C++ inheritance

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

4 years agoAdd NoMerge MIFlag to avoid MIR branch folding
Zequan Wu [Fri, 29 May 2020 19:15:07 +0000 (12:15 -0700)]
Add NoMerge MIFlag to avoid MIR branch folding

Let the codegen recognized the nomerge attribute and disable branch folding when the attribute is given

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

4 years ago[clang-format] Create a python documentation tool to generate a summary of the clang...
paul_hoad [Fri, 29 May 2020 19:25:12 +0000 (20:25 +0100)]
[clang-format] Create a python documentation tool to generate a summary of the clang-format status for the whole of the LLVM project

Summary:
Any change to clang-format is tested with the unit tests, However sometimes the better approach is to run it over a very large fully formatted source tree and then inspect the differences. This seems to be a source of many of the regressions found by @krasimir  and by @sylvestre.ledru and @Abpostelnicu who run it over the Mozilla sources, but often these regressions are only found after changes have been committed.

LLVM itself would be a good dog-fooding candidate for similar tests except such a large proportion of the tree is not 100% clang formatted, as such you are never aware if the change comes from a change to clang-format or  just because the tree has not been formatted first.

The following review is for a small python tool which scans the whole of the LLVM source tree and counts the number of files which have one or more clang-format violations.

This revision contains the tool and the output from the initial run of the tool and the generated documentation which looks like the following

Reviewers: krasimir, JakeMerdichAMD, sammccall, curdeius, bollu, alexshap, jdoerfert, DavidTruby, sscalpone

Reviewed By: curdeius

Subscribers: dschuff, aheejin, fedor.sergeev, ilya-biryukov, simoncook, cryptoad, arphaman, jfb, kadircet, mstorsjo, s.egerton, usaxena95, aartbik, phosek, sstefan1, cfe-commits, sylvestre.ledru, Abpostelnicu, krasimir

Tags: #clang, #clang-format

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

4 years ago[lldb/CMake] Set both the BUILD and INSTALL RPATH on macOS (2/2)
Jonas Devlieghere [Fri, 29 May 2020 17:26:38 +0000 (10:26 -0700)]
[lldb/CMake] Set both the BUILD and INSTALL RPATH on macOS (2/2)

This is also needed for lldb-test.

4 years agoAMDGPU: Remove fp-exceptions feature
Matt Arsenault [Fri, 29 May 2020 18:58:20 +0000 (14:58 -0400)]
AMDGPU: Remove fp-exceptions feature

This was never used, and the only thing it changed was removed in
284472be6da3353d81dfd25b1ac4218e852d1e5f. The floating point mode is
also not a property of the subtarget.

4 years ago[tests] Fix AMDGPU test
Ehud Katz [Fri, 29 May 2020 19:15:26 +0000 (22:15 +0300)]
[tests] Fix AMDGPU test

Fix naming issue in test due to change D80399.

4 years ago[AMDGPU] Regenrated urem/udiv global isel tests. NFC.
Stanislav Mekhanoshin [Fri, 29 May 2020 19:08:47 +0000 (12:08 -0700)]
[AMDGPU] Regenrated urem/udiv global isel tests. NFC.

4 years ago[mlir][Linalg] Make contraction vectorization use vector transfers
Nicolas Vasilache [Fri, 29 May 2020 17:09:55 +0000 (13:09 -0400)]
[mlir][Linalg] Make contraction vectorization use vector transfers

This revision replaces the load + vector.type_cast by appropriate vector transfer
operations. These play more nicely with other vector abstractions and canonicalization
patterns and lower to load/store with or without masks when appropriate.

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

4 years ago[DWARF5] Replace emission of strp with stx forms in debug_macro section
Sourabh Singh Tomar [Fri, 29 May 2020 18:52:40 +0000 (00:22 +0530)]
[DWARF5] Replace emission of strp with stx forms in debug_macro section

DW_MACRO_define_strx forms are supported now in llvm-dwarfdump and these
forms can be used in both debug_macro[.dwo] sections. An added advantage
for using strx forms over strp forms is that it uses indices
approach instead of a relocation to debug_str section.

This patch unify the emission for debug_macro section.

Reviewed by: dblaikie, ikudrin

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

4 years ago[DWARF5] Added support for .debug_macro.dwo section in llvm-dwarfdump
Sourabh Singh Tomar [Fri, 29 May 2020 18:27:35 +0000 (23:57 +0530)]
[DWARF5] Added support for .debug_macro.dwo section in llvm-dwarfdump

This patch extends the parsing and dumping support of llvm-dwarfdump
for debug_macro.dwo section.

Following forms are supported:

 - DW_MACRO_define
 - DW_MACRO_undef
 - DW_MACRO_start_file
 - DW_MACRO_end_file
 - DW_MACRO_define_strx
 - DW_MACRO_undef_strx
 - DW_MACRO_define_strp
 - DW_MACRO_undef_strp

Reviewed by: ikudrin, dblaikie

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

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from Vectorize
Christopher Tetreault [Fri, 29 May 2020 17:06:26 +0000 (10:06 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from Vectorize

Reviewers: efriedma, c-rhodes, david-arm, fhahn

Reviewed By: david-arm

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[Local] Prevent `invertCondition` from creating a redundant instruction
Ehud Katz [Fri, 29 May 2020 18:07:48 +0000 (21:07 +0300)]
[Local] Prevent `invertCondition` from creating a redundant instruction

Prevent `invertCondition` from creating the inversion instruction, in
case the given value is an argument which has already been inverted.
Note that this approach has already been taken in case the given value
is an instruction (and not an argument).

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

4 years agoAdd support for Overloaded Binary Operators in SyntaxTree
Eduardo Caldas [Fri, 29 May 2020 18:03:58 +0000 (20:03 +0200)]
Add support for Overloaded Binary Operators in SyntaxTree

Reviewers: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[WebAssembly] Add placeholders for R_WASM_TABLE_INDEX_REL_SLEB relocations
Sam Clegg [Fri, 29 May 2020 01:39:27 +0000 (18:39 -0700)]
[WebAssembly] Add placeholders for R_WASM_TABLE_INDEX_REL_SLEB relocations

Previously in the object format we punted on this and simply wrote
zeros (and didn't include the function in the elem segment).  With
this change we write a meaningful value which is the segment
relative table index of the associated function.

This matches the that wasm-ld produces in `-r` mode.  This inconsistency
between the output the MC object writer and the wasm-ld object
writer could cause warnings to be emitted when reading back in the
output of `wasm-ld -r`.  See:
https://github.com/emscripten-core/emscripten/issues/11217

This only applies to this one relocation type which is only generated
when compiling in PIC mode.

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

4 years ago[SLP] auto-generate complete test checks; NFC
Sanjay Patel [Fri, 29 May 2020 17:44:52 +0000 (13:44 -0400)]
[SLP] auto-generate complete test checks; NFC

4 years ago[X86] Ignore large code model in X86FastISel::X86MaterializeFP in 32-bit mode
Craig Topper [Fri, 29 May 2020 17:38:21 +0000 (10:38 -0700)]
[X86] Ignore large code model in X86FastISel::X86MaterializeFP in 32-bit mode

Large code model doesn't mean anything to 32-bit mode. But nothing
prevents it from being set. Ignore to avoid generating 64-bit mode
only instructions.

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

4 years ago[SVE] Replace deprecated call in changeVectorElementTypeToInteger
Anna Bulanova [Fri, 29 May 2020 17:09:52 +0000 (13:09 -0400)]
[SVE] Replace deprecated call in changeVectorElementTypeToInteger

Summary:
Replace getVectorNumElements with getVectorElementCount;
gets rid of the warnings in several tests

Reviewers: sdesmalen, kmclaughlin, dancgr, efriedma, each, andwar, rengolin

Reviewed By: efriedma

Subscribers: tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[X86] Remove isel pattern for MMX_X86movdq2q+simple_load. Replace with DAG combine...
Craig Topper [Fri, 29 May 2020 07:15:09 +0000 (00:15 -0700)]
[X86] Remove isel pattern for MMX_X86movdq2q+simple_load. Replace with DAG combine to to loadmmx.

Only 64-bit bits will be loaded, not the whole 128 bits. We can
just combine it to plain mmx load. This has the side effect of
enabling isel load folding for it.

This part of my desire to get rid of isel patterns that shrink loads.

4 years ago[MLIR][OpenMP] Defined master operation in OpenMP Dialect
Anchu Rajendran [Thu, 28 May 2020 05:46:04 +0000 (11:16 +0530)]
[MLIR][OpenMP] Defined master operation in OpenMP Dialect

Summary:
Implemented the basic changes for defining master operation in OpenMP.
It uses the generic parser and printer.

Reviewed By: kiranchandramohan, ftynse

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

4 years ago[PrintSCC] Fix printing a basic-block without a name
Ehud Katz [Fri, 29 May 2020 17:12:44 +0000 (20:12 +0300)]
[PrintSCC] Fix printing a basic-block without a name

Print a basic-block as an operand to handle the case where it has no
name.

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

4 years ago[LoopVectorize] auto-generate complete test checks; NFC
Sanjay Patel [Fri, 29 May 2020 17:13:27 +0000 (13:13 -0400)]
[LoopVectorize] auto-generate complete test checks; NFC

4 years ago[AIX] Emit AvailableExternally Linkage on AIX
Xiangling Liao [Fri, 29 May 2020 15:41:10 +0000 (11:41 -0400)]
[AIX] Emit AvailableExternally Linkage on AIX

Since on AIX, our strategy is to not use -u to suppress any undefined
symbols, we need to emit .extern for the symbols with AvailableExternally
linkage.

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

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from polly
Christopher Tetreault [Fri, 29 May 2020 16:47:43 +0000 (09:47 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from polly

Reviewers: bollu, efriedma, david-arm, fpetrogalli, gchatelet

Reviewed By: fpetrogalli

Subscribers: tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[LoopVectorize] regenerate test checks; NFC
Sanjay Patel [Fri, 29 May 2020 17:02:45 +0000 (13:02 -0400)]
[LoopVectorize] regenerate test checks; NFC

Align attributes are now visible.

4 years ago[LoopVectorize] auto-generate complete checks; NFC
Sanjay Patel [Fri, 29 May 2020 16:29:09 +0000 (12:29 -0400)]
[LoopVectorize] auto-generate complete checks; NFC

4 years ago[LoopVectorize] regenerate test checks; NFC
Sanjay Patel [Fri, 29 May 2020 16:19:46 +0000 (12:19 -0400)]
[LoopVectorize] regenerate test checks; NFC

Align attributes are now visible.

4 years ago[LoopVectorize] auto-generate complete test checks; NFC
Sanjay Patel [Fri, 29 May 2020 16:18:34 +0000 (12:18 -0400)]
[LoopVectorize] auto-generate complete test checks; NFC

4 years agoPreserve DbgLoc when DeadArgumentElimination rewrites a 'ret'.
Paul Robinson [Thu, 28 May 2020 20:19:52 +0000 (13:19 -0700)]
Preserve DbgLoc when DeadArgumentElimination rewrites a 'ret'.

Fixes PR46002.

4 years ago[ConstantFolding] Constant folding for integer vector reduce intrinsics
David Green [Fri, 29 May 2020 15:26:44 +0000 (16:26 +0100)]
[ConstantFolding] Constant folding for integer vector reduce intrinsics

This add constant folding for all the integer vector reduce intrinsics,
providing that the argument is a constant vector. zeroinitializer always
produces 0 for all intrinsics, and other values can be handled with
APInt operators.

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

4 years agoLet @skipUnlessUndefinedBehaviorSanitizer imply @skipIfAsan
Adrian Prantl [Fri, 29 May 2020 16:45:43 +0000 (09:45 -0700)]
Let @skipUnlessUndefinedBehaviorSanitizer imply @skipIfAsan

Don't run tests that use undefined behavior sanitizer inside an
address-sanitized LLDB. The tests don't support that
configuration. Incidentally they were skipped on green dragon for a
different reason, so this hasn't come up there before.

4 years agoLet @skipUnlessThreadSanitizer imply @skipIfAsan
Adrian Prantl [Fri, 29 May 2020 16:43:02 +0000 (09:43 -0700)]
Let @skipUnlessThreadSanitizer imply @skipIfAsan

Don't run tests that use thread sanitizer inside an address-sanitized
LLDB. The tests don't support that configuration. Incidentally they
were skipped on green dragon for a different reason, so this hasn't
come up there before.

4 years ago[DAGCombiner] Add command line options to guard store width reduction
Guozhi Wei [Fri, 29 May 2020 16:31:26 +0000 (09:31 -0700)]
[DAGCombiner] Add command line options to guard store width reduction
optimizations

As discussed in the thread http://lists.llvm.org/pipermail/llvm-dev/2020-May/141838.html,
some bit field access width can be reduced by ReduceLoadOpStoreWidth, some
can't. If two accesses are very close, and the first access width is reduced,
the second is not. Then the wide load of second access will be stalled for long
time.

This patch add command line options to guard ReduceLoadOpStoreWidth and
ShrinkLoadReplaceStoreWithStore, so users can use them to disable these
store width reduction optimizations.

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

4 years ago[X86] Fix errors in use of strictfp attribute.
Kevin P. Neal [Fri, 29 May 2020 16:19:33 +0000 (12:19 -0400)]
[X86] Fix errors in use of strictfp attribute.

Errors spotted with use of: https://reviews.llvm.org/D68233

4 years agoGlobalISel: fix CombinerHelper::matchEqualDefs()
Stanislav Mekhanoshin [Thu, 28 May 2020 22:30:23 +0000 (15:30 -0700)]
GlobalISel: fix CombinerHelper::matchEqualDefs()

This matcher was always returning true for the different
results of a same instruction.

Differential Revision:

4 years agoFix errors in use of strictfp attribute.
Kevin P. Neal [Fri, 29 May 2020 16:17:23 +0000 (12:17 -0400)]
Fix errors in use of strictfp attribute.

Errors spotted with use of: https://reviews.llvm.org/D68233

4 years agoFix errors in use of strictfp attribute.
Kevin P. Neal [Fri, 29 May 2020 16:15:54 +0000 (12:15 -0400)]
Fix errors in use of strictfp attribute.

Errors spotted with use of: https://reviews.llvm.org/D68233

4 years agoFix errors in use of strictfp attribute.
Kevin P. Neal [Fri, 29 May 2020 16:11:57 +0000 (12:11 -0400)]
Fix errors in use of strictfp attribute.

Errors spotted with use of: https://reviews.llvm.org/D68233

4 years ago[CodeGen] Fix warning in visitShuffleVector
David Sherwood [Wed, 27 May 2020 14:00:00 +0000 (15:00 +0100)]
[CodeGen] Fix warning in visitShuffleVector

Make sure we only ask for the number of elements after we've
bailed out for scalable vectors.

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

4 years ago[analyzer] StdLibraryFunctionsChecker: Add support to lookup types
Gabor Marton [Fri, 15 May 2020 09:25:40 +0000 (11:25 +0200)]
[analyzer] StdLibraryFunctionsChecker: Add support to lookup types

Summary:
In this patch I am trying to get rid of the `Irrelevant` types from the
signatures of the functions from the standard C library. For that I've
introduced `lookupType()` to be able to lookup arbitrary types in the global
scope. This makes it possible to define the signatures precisely.

Note 1) `fread`'s signature is now fixed to have the proper `FILE *restrict`
type when C99 is the language.
Note 2) There are still existing `Irrelevant` types, but they are all from
POSIX. I am planning to address those together with the missing POSIX functions
(in D79433).

Reviewers: xazax.hun, NoQ, Szelethus, balazske

Subscribers: whisperity, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, Charusso, steakhal, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years ago[AMDGPU] Remove duplicate test cases
Jay Foad [Fri, 29 May 2020 15:35:21 +0000 (16:35 +0100)]
[AMDGPU] Remove duplicate test cases

The two "2sin" test cases were identical to the "sin_2x" test cases just
above.

4 years ago[lldb/test] Fix TestAppleSimulatorOSType when multiple runtimes are installed
Fred Riss [Fri, 29 May 2020 15:29:11 +0000 (08:29 -0700)]
[lldb/test] Fix TestAppleSimulatorOSType when multiple runtimes are installed

One can have multiple simulator runtimes installed, supporting
various generations of OSs. The logic in TestAppleSimulatorOSType
might select a rnutime older than the one targeted by the current
tools, preventing the executable from running. This commit changes
the test to look for the most recent runtime available instead.

4 years agounwind: use a more portable endianness check in EHABI
Saleem Abdulrasool [Fri, 29 May 2020 15:25:35 +0000 (08:25 -0700)]
unwind: use a more portable endianness check in EHABI

The ARM specific code was trying to determine endianness using the
`__LITTLE_ENDIAN__` macro which is not guaranteed to be defined.
When not defined, it makes libunwind to build the big-endian code even
when the compiler builds for a little-endian target.

This change allows building libunwind with the `musl-gcc` toolchain
which does not define `__LITTLE_ENDIAN__`.  Use `__BYTE_ORDER__`
instead.

Patch by Idan Freiberg!

4 years ago[ARM] Extra MVE VMLAV reduction patterns
David Green [Fri, 29 May 2020 13:45:08 +0000 (14:45 +0100)]
[ARM] Extra MVE VMLAV reduction patterns

These patterns for i8 and i16 VMLA's were missing. They end up from
legalized vector.reduce.add.v8i16 and vector.reduce.add.v16i8, and
although the instruction works differently (the mul and add are
performed in a higher precision), I believe it is OK because only an
i8/i16 are demanded from them, and so the results will be the same. At
least, they pass any testing I can think to run on them.

There are some tests that end up looking worse, but are quite artificial
due to passing half vector types through a call boundary. I would not
expect the vmull to realistically come up like that, and a vmlava is
likely better a lot of the time.

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

4 years ago[AIX][XCOFF] add symbol priority for the llvm-objdump -D -symbol-description
diggerlin [Fri, 29 May 2020 15:08:51 +0000 (11:08 -0400)]
[AIX][XCOFF] add symbol priority for the llvm-objdump -D -symbol-description

SUMMARY:
when there are two symbol has the same address. llvm-objdump -D -symbol-description will select symbol based on the following rule:

1. using Label first if there is a Label symbol.
2. If there is not Label, using a symbol which has Storage Mapping class.
3. if more than one symbol has storage mapping class, put the TC0 has the low priority, for other storage mapping class , compare based on the value.

Reviewers: James Henderson ,hubert.reinterpretcast,

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

4 years agoRemove SVN logic from find_first_existing_vc_file
Pushpinder Singh [Fri, 29 May 2020 09:39:43 +0000 (05:39 -0400)]
Remove SVN logic from find_first_existing_vc_file

As LLVM has moved from SVN to git, there is no need to
keep SVN related code. Also, this code piece was never used.

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

4 years ago[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Mariya Podchishchaeva [Fri, 29 May 2020 12:41:37 +0000 (15:41 +0300)]
[OpenMP][SYCL] Improve diagnosing of unsupported types usage

Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.

The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.

Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman

Reviewed By: jdoerfert

Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits

Tags: #clang

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

4 years agoMove unittest helpers to a shared location
Dmitri Gribenko [Fri, 29 May 2020 14:47:23 +0000 (16:47 +0200)]
Move unittest helpers to a shared location

Summary:
unittests/AST/Language.h defines some helpers that we would like to
reuse in other tests, for example, in tests for syntax trees.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, martong, cfe-commits

Tags: #clang

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

4 years ago[analyzer] StdLibraryFunctionsChecker: Add sanity checks for constraints
Gabor Marton [Tue, 7 Apr 2020 15:57:50 +0000 (17:57 +0200)]
[analyzer] StdLibraryFunctionsChecker: Add sanity checks for constraints

Summary:
Once we found a matching FunctionDecl for the given summary then we
validate the given constraints against that FunctionDecl. E.g. we
validate that a NotNull constraint is applied only on arguments that
have pointer types.

This is needed because when we matched the signature of the summary we
were working with incomplete function types, i.e. some intricate type
could have been marked as `Irrelevant` in the signature.

Reviewers: NoQ, Szelethus, balazske

Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, Charusso, steakhal, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years agoFix build failure when source is read only
Pushpinder Singh [Fri, 29 May 2020 05:22:48 +0000 (01:22 -0400)]
Fix build failure when source is read only

cmake configure fails when it tries to setup target for llvm_vcsrevision_h
This happens only when source is checked out using repo in a read
only filesystem, because cmake tries to create `.git/logs/HEAD` file.

This patch:
  1. Recovers from failure gracefully.
  2. Ensures that VCSRevision.h is successfully created and updated
     in above scenarios.

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

4 years ago[SVE] Remove getNumElements() calls in visitGetElementPtrInst
David Sherwood [Thu, 28 May 2020 15:33:44 +0000 (16:33 +0100)]
[SVE] Remove getNumElements() calls in visitGetElementPtrInst

Replace calls to getNumElements() with getElementCount() in order
to avoid warnings for scalable vectors. The warnings were discovered
by this existing test:

  test/CodeGen/AArch64/sve-gep.ll

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

4 years ago[analyzer] ApiModeling: Add buffer size arg constraint with multiplier involved
Gabor Marton [Tue, 31 Mar 2020 15:41:10 +0000 (17:41 +0200)]
[analyzer] ApiModeling: Add buffer size arg constraint with multiplier involved

Summary:
Further develop the buffer size argumentum constraint so it can handle sizes
that we can get by multiplying two variables.

Reviewers: Szelethus, NoQ, steakhal

Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, Charusso, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years ago[CodeGen] Fix warnings in LowerToPredicatedOp
David Sherwood [Wed, 27 May 2020 10:41:25 +0000 (11:41 +0100)]
[CodeGen] Fix warnings in LowerToPredicatedOp

When creating a new vector type based on another vector type we
should pass in the element count instead of the number of elements
and scalable flag separately.

I encountered this warning whilst compiling this test:

  CodeGen/AArch64/sve-intrinsics-int-compares.ll

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

4 years ago[analyzer] ApiModeling: Add buffer size arg constraint
Gabor Marton [Mon, 30 Mar 2020 15:47:48 +0000 (17:47 +0200)]
[analyzer] ApiModeling: Add buffer size arg constraint

Summary:
Introducing a new argument constraint to confine buffer sizes. It is typical in
C APIs that a parameter represents a buffer and another param holds the size of
the buffer (or the size of the data we want to handle from the buffer).

Reviewers: NoQ, Szelethus, Charusso, steakhal

Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years ago[ModuloSchedule] Allow illegal phis to be moved across stages.
Hendrik Greving [Thu, 28 May 2020 00:12:58 +0000 (17:12 -0700)]
[ModuloSchedule] Allow illegal phis to be moved across stages.

Fixes a trivial but impactful bug where we did not move illegal phis across stages. This
led to incorrect mappings in certain cases.

4 years ago[llvm-readobj] - Cleanup the DwarfCFIEH::PrinterContext class. NFCI.
Georgii Rymar [Thu, 28 May 2020 14:42:42 +0000 (17:42 +0300)]
[llvm-readobj] - Cleanup the DwarfCFIEH::PrinterContext class. NFCI.

It would be nice to switch to `reportUniqueWarnings` from
`reportError` in this class, but first of all it needs a cleanup.

This patch:
1) Eliminates autos.
2) Removes code duplication.
3) Changes how the code works with `Expected<>`.
4) Introduces 2 new `using`s to make the code a bit shorter.

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

4 years ago[DAGCombiner] avoid unnecessary indirection from SDNode/SDValue; NFCI
Sanjay Patel [Fri, 29 May 2020 13:31:11 +0000 (09:31 -0400)]
[DAGCombiner] avoid unnecessary indirection from SDNode/SDValue; NFCI

4 years ago[llvm-objcopy][ELF] Fix removing a group member.
Igor Kudrin [Fri, 29 May 2020 12:28:37 +0000 (19:28 +0700)]
[llvm-objcopy][ELF] Fix removing a group member.

When a group member is removed, the corresponding record in the
SHT_GROUP section has to be deleted.

This fixes PR46064.

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

4 years ago[llvm-objcopy][ELF] Fix removing SHT_GROUP sections.
Igor Kudrin [Fri, 29 May 2020 12:27:28 +0000 (19:27 +0700)]
[llvm-objcopy][ELF] Fix removing SHT_GROUP sections.

When a SHT_GROUP section is removed, but other sections of the group are
kept, the SHF_GROUP flag of these sections should be dropped, otherwise
the resulting ELF file will be malformed.

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

4 years agoTextStubCommon.h - move StringSwitch.h include to TextStubCommon.cpp. NFC.
Simon Pilgrim [Fri, 29 May 2020 12:56:45 +0000 (13:56 +0100)]
TextStubCommon.h - move StringSwitch.h include to TextStubCommon.cpp. NFC.

Only TextStubCommon.cpp actually uses StringSwitch

4 years agoTextAPIContext.h - remove unused MemoryBuffer.h include. NFC.
Simon Pilgrim [Fri, 29 May 2020 12:44:06 +0000 (13:44 +0100)]
TextAPIContext.h - remove unused MemoryBuffer.h include. NFC.

4 years ago[AArch64][x86] add tests for FMA combines; NFC
Sanjay Patel [Fri, 29 May 2020 12:57:08 +0000 (08:57 -0400)]
[AArch64][x86] add tests for FMA combines; NFC

4 years agoRename APIs in unittests/AST/Language.h in preparation to share them
Dmitri Gribenko [Fri, 29 May 2020 12:12:51 +0000 (14:12 +0200)]
Rename APIs in unittests/AST/Language.h in preparation to share them

Summary:
Declaring these helpers in the ast_matcher namespace in the clangAST
unit test seems inappropriate -- neither these helpers, nor clangAST have
anything to do with AST matchers. Therefore, I moved these helpers to
the clang namespace.

Declaring another typedef called "ArgVector" is not a good idea -- we
already have both "ArgVector", "ArgsVector", and "ArgList". I expanded
it into the underlying type.

Declaring another enum called "Language" is not a good idea because we
arleady have the "clang::Language" enum. I renamed it to
"TestLanguage".

Similarly, I renamed "getBasicRunOptionsForLanguage" to
"getCommandLineArgsForTesting" to explain the semantics better (what are
"run options"?) and not repeat types in the function name
("ForLanguage").

Reviewers: shafik, rengolin, sammccall

Reviewed By: sammccall

Subscribers: gribozavr2, sammccall, martong, cfe-commits

Tags: #clang

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

4 years ago[clang] [MinGW] Fix libunwind extension
Mateusz Mikuła [Fri, 29 May 2020 12:09:44 +0000 (15:09 +0300)]
[clang] [MinGW] Fix libunwind extension

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

4 years ago[clang] [Darwin] Add reverse mappings for aarch64/aarch64_32 to darwin arch names
Martin Storsjö [Wed, 29 Apr 2020 19:19:48 +0000 (22:19 +0300)]
[clang] [Darwin] Add reverse mappings for aarch64/aarch64_32 to darwin arch names

These are mapped in MachO::getMachOArchName already, but were missing
in ToolChain::getDefaultUniversalArchName.

Having these reverse mapped here fixes weird inconsistencies like
-dumpmachine showing a target triple like "aarch64-apple-darwin",
while "clang -target aarch64-apple-darwin" didn't use to work (ended
up mapped as unknown-apple-ios).

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

4 years ago[DAGComb] Do not turn insert_elt into shuffle for single elt vectors.
Florian Hahn [Fri, 29 May 2020 11:53:30 +0000 (12:53 +0100)]
[DAGComb] Do not turn insert_elt into shuffle for single elt vectors.

Currently combineInsertEltToShuffle turns insert_vector_elt into a
vector_shuffle, even if the inserted element is a vector with a single
element. In this case, it should be unlikely that the additional shuffle
would be more efficient than a insert_vector_elt.

Additionally, this fixes a infinite cycle in DAGCombine, where
combineInsertEltToShuffle turns a insert_vector_elt into a shuffle,
which gets turned back into a insert_vector_elt/extract_vector_elt by
a custom AArch64 lowering (in visitVECTOR_SHUFFLE).

Such insert_vector_elt and extract_vector_elt combinations can be
lowered efficiently using mov on AArch64.

There are 2 test changes in arm64-neon-copy.ll: we now use one or two
mov instructions instead of a single zip1. The reason that we need a
second mov in ins1f2 is that we have to move the result to the result
register and is not really related to the DAGCombine fold I think.
But in any case, on most uarchs, mov should be cheaper than zip1. On a
Cortex-A75 for example, zip1 is twice as expensive as mov
(https://developer.arm.com/docs/101398/latest/arm-cortex-a75-software-optimization-guide-v20)

Reviewers: spatel, efriedma, dmgreen, RKSimon

Reviewed By: RKSimon

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

4 years ago[mlir][Linalg][Vector] Add forwarding patterns between linalg.copy and vector.transfer
Nicolas Vasilache [Fri, 29 May 2020 12:01:15 +0000 (08:01 -0400)]
[mlir][Linalg][Vector] Add forwarding patterns between linalg.copy and vector.transfer

This revision adds custom rewrites for patterns that arise during linalg structured
ops vectorization. These patterns allow the composition of linalg promotion,
vectorization and removal of redundant copies.

The patterns are voluntarily limited and restrictive atm.
More robust behavior will be implemented once more powerful side effect modeling and analyses are available on view/subview.

On the transfer_read side, the following pattern is rewritten:
```
   %alloc = ...
   [optional] %view = std.view %alloc ...
   %subView = subview %allocOrView ...
   [optional] linalg.fill(%allocOrView, %cst) ...
   ...
   linalg.copy(%in, %subView) ...
   vector.transfer_read %allocOrView[...], %cst ...
```
into
```
   [unchanged] %alloc = ...
   [unchanged] [optional] %view = std.view %alloc ...
   [unchanged] [unchanged] %subView = subview %allocOrView ...
   ...
   vector.transfer_read %in[...], %cst ...
```

On the transfer_write side, the following pattern is rewriten:
```
   %alloc = ...
   [optional] %view = std.view %alloc ...
   %subView = subview %allocOrView...
   ...
   vector.transfer_write %..., %allocOrView[...]
   linalg.copy(%subView, %out)
```

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

4 years ago[ObjectYAML][DWARF] Make the `PubSection` optional.
Xing GUO [Fri, 29 May 2020 11:56:32 +0000 (19:56 +0800)]
[ObjectYAML][DWARF] Make the `PubSection` optional.

This patch helps make the `PubSection` optional in the DWARF structure.

Reviewed By: jhenderson, aprantl

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

4 years ago[clangd][NFC] Add traces for PreamblePatch::create
Kadir Cetinkaya [Fri, 29 May 2020 10:31:35 +0000 (12:31 +0200)]
[clangd][NFC] Add traces for PreamblePatch::create

4 years ago[mlir][SCF] Add utility to clone an scf.ForOp while appending new yield values.
Nicolas Vasilache [Fri, 29 May 2020 10:42:35 +0000 (06:42 -0400)]
[mlir][SCF] Add utility to clone an scf.ForOp while appending new yield values.

This utility factors out the machinery required to add iterArgs and yield values to an scf.ForOp.

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

4 years ago[CGP] Ensure address scaled offset is representable as int64_t
Simon Pilgrim [Fri, 29 May 2020 11:25:27 +0000 (12:25 +0100)]
[CGP] Ensure address scaled offset is representable as int64_t

AddressingModeMatcher::matchScaledValue was calling getSExtValue for a constant before ensuring that we can actually represent the value as int64_t

Fixes OSSFuzz#22723 which is a followup to rGc479052a74b2 (PR46004 / OSSFuzz#22357)

4 years ago[clangd] Run PreambleThread in async mode behind a flag
Kadir Cetinkaya [Tue, 7 Apr 2020 19:18:00 +0000 (21:18 +0200)]
[clangd] Run PreambleThread in async mode behind a flag

Summary: Depends on D80198.

This patch implies ASTs might be built with stale preambles without
blocking for a fresh one. It also drops any guarantees on every preamble
version being built. In case of multiple preamble build requests, in
addition to being debounced.

Any preamble requested with a WantDiags::Yes will always be built, this
is ensured by blocking enqueueing of any subsequent reqest.

AST worker will still block for initial preamble to reduce duplicate
work.

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

Tags: #clang

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

4 years ago[SelectionDAG] Update getNode asserts for EXTRACT/INSERT_SUBVECTOR.
Paul Walker [Thu, 28 May 2020 10:21:27 +0000 (10:21 +0000)]
[SelectionDAG] Update getNode asserts for EXTRACT/INSERT_SUBVECTOR.

Summary:
The description of EXTACT_SUBVECTOR and INSERT_SUBVECTOR has been
changed to accommodate scalable vectors (see ISDOpcodes.h). This
patch updates the asserts used to verify these requirements when
using SelectionDAG's getNode interface.

This patch introduces the MVT function getVectorMinNumElements
that can be used against fixed-length and scalable vectors when
only the known minimum vector length is required.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lit] Add an option to print all features used in tests
Louis Dionne [Fri, 10 Apr 2020 21:41:45 +0000 (17:41 -0400)]
[lit] Add an option to print all features used in tests

Lit test suites can tend to accumulate annotations that are not necessarily
relevant as time goes by, for example XFAILS on old compilers or platforms.
To help spot old annotations that can be cleaned up, it can be useful to
look at all features used inside a test suite.

This commit adds a new Lit option '--show-used-features' that prints all
the features used in XFAIL, REQUIRES and UNSUPPORTED of all tests that
are discovered.

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

4 years ago[SCCP] Switch to widen at PHIs, stores and call edges.
Florian Hahn [Fri, 29 May 2020 08:29:39 +0000 (09:29 +0100)]
[SCCP] Switch to widen at PHIs, stores and call edges.

Currently SCCP does not widen PHIs, stores or along call edges
(arguments/return values), but on operations that directly extend ranges
(like binary operators).

This means PHIs, stores and call edges are not pessimized by widening
currently, while binary operators are. The main reason for widening
operators initially was that opting-out for certain operations was
more straight-forward in the initial implementation (and it did not
matter too much, as range support initially was only implemented for a
very limited set of operations.

During the discussion in D78391, it was suggested to consider flipping
widening to PHIs, stores and along call edges. After adding support for
tracking the number of range extensions in ValueLattice, limiting the
number of range extensions per value is straight forward.

This patch introduces a MaxWidenSteps option to the MergeOptions,
limiting the number of range extensions per value. For PHIs, it seems
natural allow an extension for each (active) incoming value plus 1. For
the other cases, a arbitrary limit of 10 has been chosen initially. It would
potentially make sense to set it depending on the users of a
function/global, but that still needs investigating. This potentially
leads to more state-changes and longer compile-times.

The results look quite promising (MultiSource, SPEC):

Same hash: 179 (filtered out)
Remaining: 58
Metric: sccp.IPNumInstRemoved

Program                                        base    widen-phi diff
 test-suite...ks/Prolangs-C/agrep/agrep.test    58.00   82.00    41.4%
 test-suite...marks/SciMark2-C/scimark2.test    32.00   43.00    34.4%
 test-suite...rks/FreeBench/mason/mason.test     6.00    8.00    33.3%
 test-suite...langs-C/football/football.test   104.00  128.00    23.1%
 test-suite...cations/hexxagon/hexxagon.test    36.00   42.00    16.7%
 test-suite...CFP2000/177.mesa/177.mesa.test   214.00  249.00    16.4%
 test-suite...ngs-C/assembler/assembler.test    14.00   16.00    14.3%
 test-suite...arks/VersaBench/dbms/dbms.test    10.00   11.00    10.0%
 test-suite...oxyApps-C++/miniFE/miniFE.test    43.00   47.00     9.3%
 test-suite...ications/JM/ldecod/ldecod.test   179.00  195.00     8.9%
 test-suite...CFP2006/433.milc/433.milc.test   249.00  265.00     6.4%
 test-suite.../CINT2000/175.vpr/175.vpr.test    98.00  104.00     6.1%
 test-suite...peg2/mpeg2dec/mpeg2decode.test    70.00   74.00     5.7%
 test-suite...CFP2000/188.ammp/188.ammp.test    71.00   75.00     5.6%
 test-suite...ce/Benchmarks/PAQ8p/paq8p.test   111.00  117.00     5.4%
 test-suite...ce/Applications/Burg/burg.test    41.00   43.00     4.9%
 test-suite...000/197.parser/197.parser.test    66.00   69.00     4.5%
 test-suite...tions/lambda-0.1.3/lambda.test    23.00   24.00     4.3%
 test-suite...urce/Applications/lua/lua.test   301.00  313.00     4.0%
 test-suite...TimberWolfMC/timberwolfmc.test    76.00   79.00     3.9%
 test-suite...lications/ClamAV/clamscan.test   991.00  1030.00    3.9%
 test-suite...plications/d/make_dparser.test    53.00   55.00     3.8%
 test-suite...fice-ispell/office-ispell.test    83.00   86.00     3.6%
 test-suite...lications/obsequi/Obsequi.test    28.00   29.00     3.6%
 test-suite.../Prolangs-C/bison/mybison.test    56.00   58.00     3.6%
 test-suite.../CINT2000/254.gap/254.gap.test   170.00  176.00     3.5%
 test-suite.../Applications/lemon/lemon.test    30.00   31.00     3.3%
 test-suite.../CINT2000/176.gcc/176.gcc.test   1202.00 1240.00    3.2%
 test-suite...pplications/treecc/treecc.test    79.00   81.00     2.5%
 test-suite...chmarks/MallocBench/gs/gs.test   357.00  366.00     2.5%
 test-suite...eeBench/analyzer/analyzer.test   103.00  105.00     1.9%
 test-suite...T2006/445.gobmk/445.gobmk.test   1697.00 1724.00    1.6%
 test-suite...006/453.povray/453.povray.test   1812.00 1839.00    1.5%
 test-suite.../Benchmarks/Bullet/bullet.test   337.00  342.00     1.5%
 test-suite.../CINT2000/252.eon/252.eon.test   426.00  432.00     1.4%
 test-suite...T2000/300.twolf/300.twolf.test   214.00  217.00     1.4%
 test-suite...pplications/oggenc/oggenc.test   244.00  247.00     1.2%
 test-suite.../CINT2006/403.gcc/403.gcc.test   4008.00 4055.00    1.2%
 test-suite...T2006/456.hmmer/456.hmmer.test   175.00  177.00     1.1%
 test-suite...nal/skidmarks10/skidmarks.test   430.00  434.00     0.9%
 test-suite.../Applications/sgefa/sgefa.test   115.00  116.00     0.9%
 test-suite...006/447.dealII/447.dealII.test   1082.00 1091.00    0.8%
 test-suite...6/482.sphinx3/482.sphinx3.test   141.00  142.00     0.7%
 test-suite...ocBench/espresso/espresso.test   152.00  153.00     0.7%
 test-suite...3.xalancbmk/483.xalancbmk.test   4003.00 4025.00    0.5%
 test-suite...lications/sqlite3/sqlite3.test   548.00  551.00     0.5%
 test-suite...marks/7zip/7zip-benchmark.test   5522.00 5551.00    0.5%
 test-suite...nsumer-lame/consumer-lame.test   208.00  209.00     0.5%
 test-suite...:: External/Povray/povray.test   1556.00 1563.00    0.4%
 test-suite...000/186.crafty/186.crafty.test   298.00  299.00     0.3%
 test-suite.../Applications/SPASS/SPASS.test   2019.00 2025.00    0.3%
 test-suite...ications/JM/lencod/lencod.test   8427.00 8449.00    0.3%
 test-suite...6/464.h264ref/464.h264ref.test   6797.00 6813.00    0.2%
 test-suite...6/471.omnetpp/471.omnetpp.test   431.00  430.00    -0.2%
 test-suite...006/450.soplex/450.soplex.test   446.00  447.00     0.2%
 test-suite...0.perlbench/400.perlbench.test   1729.00 1727.00   -0.1%
 test-suite...000/255.vortex/255.vortex.test   3815.00 3819.00    0.1%

Reviewers: efriedma, nikic, davide

Reviewed By: efriedma

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

4 years ago[readobj] Fix dangling else warning
Kadir Cetinkaya [Fri, 29 May 2020 10:55:11 +0000 (12:55 +0200)]
[readobj] Fix dangling else warning

4 years ago[CodeGen] Fix warnings in getZeroExtendInReg
David Sherwood [Wed, 27 May 2020 09:36:25 +0000 (10:36 +0100)]
[CodeGen] Fix warnings in getZeroExtendInReg

We should be using getVectorElementCount() to assert that two types
have the same numbers of elements. I encountered the warnings while
compiling this test:

  CodeGen/AArch64/sve-intrinsics-ld1.ll

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

4 years agoFix broken include
Kadir Cetinkaya [Fri, 29 May 2020 10:49:11 +0000 (12:49 +0200)]
Fix broken include

4 years ago[clangd] locateMacroAt handles patched macros
Kadir Cetinkaya [Thu, 14 May 2020 10:26:47 +0000 (12:26 +0200)]
[clangd] locateMacroAt handles patched macros

Summary: Depends on D79992.

This patch changes locateMacroAt to perform #line directive substitution
for macro identifier locations.

We first check whether a location is inside a file included through
built-in header. If so we check whether line directive maps it back to
the main file, and afterwards use TokenBuffers to find exact location of
the identifier on the line.

Instead of performing the mapping in locateMacroAt, we could also store
a mapping inside the ParsedAST whenever we use a patched preamble. But
that would imply adding more responsibility to ParsedAST and paying for
the mapping even when it is not going to be used.

====

Go-To-Definition:

Later on these locations are used for serving go-to-definition requests,
this enables jumping to definition inside the preamble section in
presence of patched macros.

=====

Go-To-Refs:

Macro references in main file are collected separetely and stored as a
map from macro's symbol id to reference ranges. Those ranges are
computed inside PPCallbacks, hence we don't have access to TokenBuffer.

In presence of preamble patch, any reference to a macro inside the
preamble section will unfortunately have the wrong range. They'll point
into the patch rather than the main file. Hence during findReferences,
we won't get any ranges reported for those.

Fixing those requires:
- Lexing the preamble section to figure out "real range" of a patched
  macro definition
- Postponing range/location calculations until a later step in which we
  have access to tokenbuffers.

This patch trades some accuracy in favor of code complexity. We don't do
any patching for references inside the preamble patch but get any
reference inside the main file for free.

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

Tags: #clang

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

4 years ago[clangd] Patch PP directives to use stale preambles while building ASTs
Kadir Cetinkaya [Thu, 14 May 2020 10:20:33 +0000 (12:20 +0200)]
[clangd] Patch PP directives to use stale preambles while building ASTs

Summary:
Depends on D79930.

This enables more accurate parsing of the AST, by making new macro
definitions in preamble section visible. This is handled by injecting
define directives into preamble patch.

This patch doesn't handle any location mappings yet, so features like go-to-def,
go-to-refs and hover might not work as expected. These will be addressed in a
follow-up patch.

Reviewers: sammccall

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

Tags: #clang

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

4 years agoIPDBLineNumber.h - remove unused includes. NFC.
Simon Pilgrim [Fri, 29 May 2020 10:23:40 +0000 (11:23 +0100)]
IPDBLineNumber.h - remove unused includes. NFC.

4 years agoIPDBInjectedSource.h - remove unused includes and forward declarations. NFC.
Simon Pilgrim [Fri, 29 May 2020 10:17:55 +0000 (11:17 +0100)]
IPDBInjectedSource.h - remove unused includes and forward declarations. NFC.

4 years agoVirtualFileSystem.h - reduce Twine.h include to forward declaration. NFC.
Simon Pilgrim [Thu, 28 May 2020 14:50:13 +0000 (15:50 +0100)]
VirtualFileSystem.h - reduce Twine.h include to forward declaration. NFC.

4 years ago[clangd] Preserve extra args in PreambleTests::IncludeParsing to fix windows build...
Kadir Cetinkaya [Fri, 29 May 2020 10:35:16 +0000 (12:35 +0200)]
[clangd] Preserve extra args in PreambleTests::IncludeParsing to fix windows build bots

4 years ago[llvm-readelf] - --elf-hash-histogram: do not crash when the .gnu.hash goes past...
Georgii Rymar [Tue, 19 May 2020 14:29:45 +0000 (17:29 +0300)]
[llvm-readelf] - --elf-hash-histogram: do not crash when the .gnu.hash goes past the EOF.

llvm-readelf might crash when the .gnu.hash table goes past the EOF.

This patch splits and updates the code of a helper function `checkGNUHashTable`,
which is similar to `checkHashTable` and fixes the issue.

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

4 years ago[clangd] Add buildPreamble to TestTU
Kadir Cetinkaya [Thu, 14 May 2020 10:23:21 +0000 (12:23 +0200)]
[clangd] Add buildPreamble to TestTU

Summary: Depends on D77644.

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

Tags: #clang

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

4 years ago[clangd] Handle additional includes while parsing ASTs
Kadir Cetinkaya [Thu, 2 Apr 2020 08:53:45 +0000 (10:53 +0200)]
[clangd] Handle additional includes while parsing ASTs

Summary:
Enables building ASTs with stale preambles by handling additional preamble
includes. Sets the correct location information for those imaginary includes so
that features like gotodef/documentlink keeps functioning propoerly.

Reviewers: sammccall

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

Tags: #clang

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

4 years agoUnbreak the build of mlir-cuda-runner
Benjamin Kramer [Fri, 29 May 2020 10:18:25 +0000 (12:18 +0200)]
Unbreak the build of mlir-cuda-runner

4 years ago[libc++] Fix the LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT setting
Louis Dionne [Fri, 15 May 2020 19:58:19 +0000 (15:58 -0400)]
[libc++] Fix the LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT setting

When the __config_site header is generated, but LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
wasn't specified, _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT would be defined
to 0, which was the NonUnique RTTI comparison implementation. The intent
was to use the Unique RTTI comparison implementation in that case, which
caused https://llvm.org/PR45549.

Instead, use a proper "switch" to select the RTTI comparison implementation.
Note that 0 can't be used as a value, because that is treated the same
by CMake as a variable that is just not defined.

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

4 years ago[llvm-readobj][test] - unwind.test: add comments, document the current behavior.
Georgii Rymar [Wed, 27 May 2020 14:56:25 +0000 (17:56 +0300)]
[llvm-readobj][test] - unwind.test: add comments, document the current behavior.

Here I've added comments, added testing for llvm-readelf and documented
the behavior that we already have.

It was discussed in the D80380 thread that we want to improve the
"p_memsz does not match p_filesz for GNU_EH_FRAME" message reported
(and probably convert error to a warning). This patch is a preparation
for that.

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

4 years agoDo not list adb devices when a device id is given
Emre Kultursay [Fri, 29 May 2020 09:18:26 +0000 (11:18 +0200)]
Do not list adb devices when a device id is given

Summary:
On Android, this method gets called twice: first when establishing
a host-server connection, then when attaching to a process id.

Each call takes several seconds to finish (especially slower on Windows)
and eliminating the call for the typical case improves latency significantly.

Reviewed By: labath

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

4 years ago[lldb] Make "inline" tests more configurable
Pavel Labath [Mon, 25 May 2020 12:37:04 +0000 (14:37 +0200)]
[lldb] Make "inline" tests more configurable

Summary:
This patch adds two new arguments to the MakeInlineTest function. The
main motivation is a follow-up patch I'm preparing, but they seem
generally useful.

The first argument allows the user to specify the "build dictionary".
With this argument one can avoid the need to provide a custom Makefile
if all he needs is to override a couple of make variables. This hooks in
neatly into the existing dictionary support for non-inline tests.

The second argument specifies the name of the test. This could be used
to provide better names to the generated test classes, but it's mainly
useful in conjuction with the first argument: now that we can specify a
custom build dictionary, it may sometimes make sense to run the same
test twice with different build configurations. To achieve that, we need
to give the two tests different names, and this argument achieves that.

The usage of the arguments is demonstrated via TestBasicEntryValues.py.

Reviewers: vsk, JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[lldb][NFC] Remove a std::string->C string->StringRef conversion in ClangUserExpression
Raphael Isemann [Fri, 29 May 2020 09:19:14 +0000 (11:19 +0200)]
[lldb][NFC] Remove a std::string->C string->StringRef conversion in ClangUserExpression

4 years agoAvoid O_CLOEXEC to allow building on older Linux (RHEL5)
Vitaly Buka [Fri, 29 May 2020 08:02:36 +0000 (01:02 -0700)]
Avoid O_CLOEXEC to allow building on older Linux (RHEL5)

Summary:
See https://github.com/google/sanitizers/issues/1253.

Small patch to enable compilation on (ancient) Red Hat Enterprise Linux 5.

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Tags: #sanitizers

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

4 years ago[MLIR][BufferPlacement] Support functions that return Memref typed results
Ehsan Toosi [Wed, 20 May 2020 16:23:43 +0000 (18:23 +0200)]
[MLIR][BufferPlacement] Support functions that return Memref typed results

Buffer placement can now operates on functions that return buffers. These
buffers escape from the deallocation phase of buffer placement.

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

4 years ago[AMDGPU] Better use of llvm::numbers
Jay Foad [Fri, 29 May 2020 08:42:00 +0000 (09:42 +0100)]
[AMDGPU] Better use of llvm::numbers

Tweak a few constant expressions involving numbers::pi etc to avoid
rounding errors. NFCI though it's possible some of these will now be
more accurate in the last bit.

4 years ago[AMDGPU] Use numbers::pi instead of M_PI. NFC.
Jay Foad [Fri, 29 May 2020 08:34:29 +0000 (09:34 +0100)]
[AMDGPU] Use numbers::pi instead of M_PI. NFC.