lldb.git
2 years ago[COFF] Use a global option table to avoid reconstructing it
Reid Kleckner [Sat, 2 May 2020 21:53:59 +0000 (14:53 -0700)]
[COFF] Use a global option table to avoid reconstructing it

Otherwise an ArgumentParser is constructed for every directive section,
and that involves copying the entire table of options into a vector.
There is no need for this, just have one option table.

2 years ago[test] Fix lld's ELF/linkerscript/thunk-gen-mips.s
Thomas Preud'homme [Fri, 1 May 2020 22:22:07 +0000 (23:22 +0100)]
[test] Fix lld's ELF/linkerscript/thunk-gen-mips.s

Summary:
Lld test ELF/linkerscript/thunk-gen-mips.s was accidentally disabled due
to the use of wrong FileCheck directives. As a result the test seems to
have bitrotted as it fails to pass if fixing the directive. To ease
updates to the test in case of change of the __start address the checks
have been changed to use numeric variables to express all the addresses
based on the __start address.

Reviewed By: atanasyan

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

2 years ago[libclang]: visit C++17 if init statements
Milian Wolff [Sat, 2 May 2020 20:18:09 +0000 (22:18 +0200)]
[libclang]: visit C++17 if init statements

This makes the previously unaccessible AST nodes for C++17 "if with
init statements" accessible to consumers of libclang.

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

2 years ago[libclang]: visit BindingDecl in DecompositionDecl
Milian Wolff [Sat, 2 May 2020 20:17:59 +0000 (22:17 +0200)]
[libclang]: visit BindingDecl in DecompositionDecl

This makes the BindingDecl accessible to consumers of libclang
as CXCursor_UnexposedDecl where previously these AST nodes were
not visited at all from the libclang API.

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

2 years ago[mlir] Add a new context flag for disabling/enabling multi-threading
River Riddle [Sat, 2 May 2020 19:28:57 +0000 (12:28 -0700)]
[mlir] Add a new context flag for disabling/enabling multi-threading

This is useful for several reasons:
* In some situations the user can guarantee that thread-safety isn't necessary and don't want to pay the cost of synchronization, e.g., when parsing a very large module.

* For things like logging threading is not desirable as the output is not guaranteed to be in stable order.

This flag also subsumes the pass manager flag for multi-threading.

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

2 years agoRevert rG8e05ac0a510c - "[DAGCombine] visitTRUNCATE - remove GetDemandedBits call"
Simon Pilgrim [Sat, 2 May 2020 19:08:33 +0000 (20:08 +0100)]
Revert rG8e05ac0a510c - "[DAGCombine] visitTRUNCATE - remove GetDemandedBits call"

Causing buildbot failures

2 years ago[DAGCombine] visitTRUNCATE - remove GetDemandedBits call
Simon Pilgrim [Sat, 2 May 2020 18:51:58 +0000 (19:51 +0100)]
[DAGCombine] visitTRUNCATE - remove GetDemandedBits call

rL368553 added SimplifyMultipleUseDemandedBits handling for ISD::TRUNCATE to SimplifyDemandedBits so we don't need to duplicate this (and it gets rid of another GetDemandedBits call which is slowly being replaced with SimplifyMultipleUseDemandedBits anyhow).

2 years ago[sema] NFC Unable to build Sema library with MSVC Debug target due to missing /bigobj
mydeveloperday [Sat, 2 May 2020 18:33:18 +0000 (19:33 +0100)]
[sema] NFC Unable to build Sema library with MSVC Debug target due to missing /bigobj

Summary:
Unable to build sema library on MSVC with Debug target

```
C:\clang\llvm-project\clang\lib\Sema\SemaOpenMP.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj
```

Reviewed By: aaron.ballman

Subscribers: mgorny, cfe-commits

Tags: #clang

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

2 years ago[MBP] tuple->pair. NFC.
Benjamin Kramer [Sat, 2 May 2020 18:18:09 +0000 (20:18 +0200)]
[MBP] tuple->pair. NFC.

std::pair has a trivial copy ctor, std::tuple doesn't.

2 years ago[gn build] Port 8f766e382b77e more and fix 2 llvm-config test failures.
Nico Weber [Sat, 2 May 2020 18:10:18 +0000 (14:10 -0400)]
[gn build] Port 8f766e382b77e more and fix 2 llvm-config test failures.

The failures only happened in fully clean builds.

Also put all current dependencies of LibraryDependencies.inc in the
build graph, so that this type of thing will cause a failure in
incremental builds next time as well.

2 years ago[COFF] Add and use a zero-copy tokenizer for .drectve
Reid Kleckner [Fri, 1 May 2020 14:34:12 +0000 (07:34 -0700)]
[COFF] Add and use a zero-copy tokenizer for .drectve

This generalizes the main Windows command line tokenizer to be able to
produce StringRef substrings as well as freshly copied C strings. The
implementation is still shared with the normal tokenizer, which is
important, because we have unit tests for that.

.drective sections can be very long. They can potentially list up to
every symbol in the object file by name. It is worth avoiding these
string copies.

This saves a lot of memory when linking chrome.dll with PGO
instrumentation:

             BEFORE      AFTER      % IMP
peak memory: 6657.76MB   4983.54MB  -25%
real:        4m30.875s   2m26.250s  -46%

The time improvement may not be real, my machine was noisy while running
this, but that the peak memory usage improvement should be real.

This change may also help apps that heavily use dllexport annotations,
because those also use linker directives in object files. Apps that do
not use many directives are unlikely to be affected.

Reviewed By: thakis

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

2 years ago[SmallVector] Weaken the predicate for the memcpy optimization
Benjamin Kramer [Sat, 2 May 2020 17:22:15 +0000 (19:22 +0200)]
[SmallVector] Weaken the predicate for the memcpy optimization

We don't require the type to be trivially assignable. While the standard
says that only is_trivially_copyable types may be memcpy'd, this seems
overly strict. We never assign the type, so there's no way for the type
to observe that the copy/move construction got elided. This is important
for std::pair<POD, POD>, which is not trivially assignable and probably
never will be because changing that would break ABI.

As a side-effect this no longer allows types with deleted copy/move
constructors in SmallVector. That's an unintended side-effect of
is_trivially_copyable anyways.

Shrinks Release+Asserts clang by 20k.

2 years agoDon't stash types that aren't copyable or moveable into a SmallVector
Benjamin Kramer [Sun, 26 Apr 2020 20:44:31 +0000 (22:44 +0200)]
Don't stash types that aren't copyable or moveable into a SmallVector

This seems to be working by accident.

2 years agoUse realloc for NestedNameSpecifierLocBuilder
Benjamin Kramer [Sat, 2 May 2020 15:04:52 +0000 (17:04 +0200)]
Use realloc for NestedNameSpecifierLocBuilder

These allocations are so tiny that the buffer can be grown in-place most
of the time.

2 years ago[clang-format] NFC - clang-format the FormatTests
mydeveloperday [Sat, 2 May 2020 14:42:20 +0000 (15:42 +0100)]
[clang-format] NFC - clang-format the FormatTests

Summary:
Ensure the clang-format unit tests are themselves clang-formatted

Having areas of the llvm code which are clang-format clean, give us more areas to run new clang-format binaries on ensuring we haven't broken anything.

It seems to me we SHOULD have this clang-formatted at a minimum, otherwise how can we expect others to use clang-format if we "don't eat our own dogfood", also if the tests are dependent on the formatting of the code then that would also be bad!

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

2 years ago[Allocator] Make Deallocate() pass alignment and make it use (de)allocate_buffer
Benjamin Kramer [Sat, 2 May 2020 13:59:10 +0000 (15:59 +0200)]
[Allocator] Make Deallocate() pass alignment and make it use (de)allocate_buffer

This lets it use sized deallocation and make more efficient alignment
decisions. Also adjust BumpPtrAllocator to always allocate at
alignof(std::max_align_t).

2 years ago[RISCV] Implement convertSelectOfConstantsToMath
Sam Elliott [Sat, 2 May 2020 14:05:12 +0000 (15:05 +0100)]
[RISCV] Implement convertSelectOfConstantsToMath

Summary:
The current lowering of `select` on RISC-V uses a branch instruction to load a
register with one or other value. This is inefficient, especially in the case of
small constants that can be computed easily.

By implementing the TargetLowering::convertSelectOfConstantsToMath hook, some of
the simpler cases are covered that let us avoid introducing a branch in these
cases.

Reviewed By: luismarques

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

2 years ago[RISCV][NFC] Tests for (select (const), (const))
Sam Elliott [Sat, 2 May 2020 14:05:02 +0000 (15:05 +0100)]
[RISCV][NFC] Tests for (select (const), (const))

Summary:
This just adds some simple cases for testing select of constants. There will be
a follow-up patch that improves code generation in some of these cases.

Reviewed By: luismarques

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

2 years ago[RISCV] Add patterns for checking isnan
Sam Elliott [Sat, 2 May 2020 14:00:38 +0000 (15:00 +0100)]
[RISCV] Add patterns for checking isnan

Summary:
This patch addresses some weird assembly sequences we were seeing during
comparing floats. In particular, comparing a float to itself tells you whether
it is NaN or not, which we were doing correctly, but with an extra unneeded
`and` instruction.

This patch specialises the existing patterns to remove the `and` instructions
when both their operands are the same.

Reviewed By: luismarques, asb

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

2 years ago[RISCV][NFC] Add tests for checking isnan patterns
Sam Elliott [Sat, 2 May 2020 13:56:35 +0000 (14:56 +0100)]
[RISCV][NFC] Add tests for checking isnan patterns

Summary:
I worked on adding some SelectionDag patterns to address code generated by these
examples, which came out of some differential testing against GCC. The pattern
additions will be in a follow-up patch.

Reviewers: luismarques, asb

Reviewed By: luismarques, asb

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

2 years agostd::isspace -> llvm::isSpace (where locale should be ignored)
Sam McCall [Sat, 2 May 2020 13:34:53 +0000 (15:34 +0200)]
std::isspace -> llvm::isSpace (where locale should be ignored)

I've left out some cases where I wasn't totally sure this was right or
whether the include was ok (compiler-rt) or idiomatic (flang).

2 years ago[ADT] Add locale-independent isSpace() to StringExtras. NFC
Sam McCall [Sat, 2 May 2020 13:18:35 +0000 (15:18 +0200)]
[ADT] Add locale-independent isSpace() to StringExtras. NFC

Use this in clangd, will follow up with replacements for isspace where
locale-dependent is clearly not intended.

2 years ago[gn build] Port fa1f4cf8432
LLVM GN Syncbot [Sat, 2 May 2020 12:54:28 +0000 (12:54 +0000)]
[gn build] Port fa1f4cf8432

2 years ago[clangd] Rename FormattedString -> Markup, move to support. NFC
Sam McCall [Sat, 2 May 2020 12:53:47 +0000 (14:53 +0200)]
[clangd] Rename FormattedString -> Markup, move to support. NFC

2 years ago[clangd] Fix whitespace between chunks in markdown paragraphs.
Sam McCall [Wed, 29 Apr 2020 23:03:59 +0000 (01:03 +0200)]
[clangd] Fix whitespace between chunks in markdown paragraphs.

Summary:
Old model: chunks are always separated by one space.
           This makes it impossible to render "Foo `bar`." correctly.

New model: chunks are separated by space if the left had trailing space, or
           the right had leading space, or space was explicitly requested.
           (Only leading/trailing space in plaintext chunks count, not code)

Reviewers: kadircet

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

Tags: #clang

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

2 years ago[clang-tidy] extend bugprone-signed-char-misuse check with array subscript case.
Tamás Zolnai [Sat, 2 May 2020 12:04:17 +0000 (14:04 +0200)]
[clang-tidy] extend bugprone-signed-char-misuse check with array subscript case.

Summary:
To cover STR34-C rule's second use case, where ``signed char`` is
used for array subscript after an integer conversion. In the case
of non-ASCII character this conversion will result in a value
in excess of UCHAR_MAX.

There is another clang-tidy check which catches these cases.
cppcoreguidelines-pro-bounds-constant-array-index catches any
indexing which is not integer constant. I think this check is
very strict about the index (e.g. constant), so it's still useful
to cover the ``signed char`` use case in this check, so we
can provide a way to catch the SEI cert rule's use cases on a
codebase, where this CPP guideline is not used.

Reviewers: aaron.ballman, njames93

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang, #clang-tools-extra

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

2 years ago[libc++][P1115][C++20] Improving the Return Value of Erase-Like Algorithms II: Free...
Marek Kurdej [Sat, 2 May 2020 11:58:03 +0000 (13:58 +0200)]
[libc++][P1115][C++20] Improving the Return Value of Erase-Like Algorithms II: Free erase/erase if.

Summary:
This patch adds return type to std::erase and std::erase_if functions.

Also:
* Update __cpp_lib_erase_if to 202002L.
* Fix synopsis in unordered_map.
* Fix generate_feature_test_macro_components.py script.

Reviewers: EricWF, mclow.lists, ldionne, #libc

Reviewed By: ldionne, #libc

Subscribers: broadwaylamb, zoecarver, dexonsmith, ldionne, libcxx-commits

Tags: #libc

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

2 years ago[ValueTracking] Short-circuit GEP known bits calculation (NFC)
Nikita Popov [Sat, 2 May 2020 09:47:04 +0000 (11:47 +0200)]
[ValueTracking] Short-circuit GEP known bits calculation (NFC)

Don't compute known bits of all GEP operands, if we already know
that we don't know anything.

2 years agoRemove getNumUses() comparisons (NFC)
Nikita Popov [Sat, 2 May 2020 09:03:36 +0000 (11:03 +0200)]
Remove getNumUses() comparisons (NFC)

getNumUses() scans the full use list. Don't use it is we only want
to check if there's zero or one uses.

2 years ago[MergeFuncs] Don't merge shufflevectors with different masks
Nikita Popov [Fri, 1 May 2020 20:28:59 +0000 (22:28 +0200)]
[MergeFuncs] Don't merge shufflevectors with different masks

When the shufflevector mask operand was converted into special
instruction data, the FunctionComparator was not updated to
account for this. As such, MergeFuncs will happily merge
shufflevectors with different masks.

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

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

2 years ago[Object] Change ObjectFile::getSymbolValue() return type to Expected<uint64_t>
Xing GUO [Sat, 2 May 2020 06:04:04 +0000 (14:04 +0800)]
[Object] Change ObjectFile::getSymbolValue() return type to Expected<uint64_t>

Summary:
In D77860, we have changed `getSymbolFlags()` return type to `Expected<uint32_t>`.
This change helps bubble the error further up the stack.

Reviewers: jhenderson, grimar, JDevlieghere, MaskRay

Reviewed By: jhenderson

Subscribers: hiraditya, MaskRay, rupprecht, llvm-commits

Tags: #llvm

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

2 years ago[MLIR] Ensure that out-of-tree users have an mlir-generic-headers target
Stephen Neuendorffer [Sat, 2 May 2020 05:12:40 +0000 (22:12 -0700)]
[MLIR] Ensure that out-of-tree users have an mlir-generic-headers target

Prior change introduces this target, but we need it for out-of-tree users
too

2 years agoAdd the missing '='. NFC.
Michael Liao [Sat, 2 May 2020 05:07:44 +0000 (01:07 -0400)]
Add the missing '='. NFC.

2 years ago[MLIR] add dependencies for all tablegen targets on 'mlir-headers'
Stephen Neuendorffer [Fri, 24 Apr 2020 23:42:07 +0000 (16:42 -0700)]
[MLIR] add dependencies for all tablegen targets on 'mlir-headers'

In cmake, dependencies on generated files require some sophistication in the build system.  At build time, files are parsed to determine which headers they depend on and these dependencies are injected into the build system.  This works well with ninja, but has some constraints with the makefile generator.  According to the cmake documentation, this only works reliably within the same directory.

This patch expands the usage of mlir-headers to include all generated headers and adds an mlir-generic-headers target which triggers generation of dialect-independent headers.  These targets are used to express dependencies on generated headers.  This is mostly handled in AddMLIR.cmake and only a few CMakeLists.txt files need to change.

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

2 years ago[MLIR] Move Verifier and Dominance Analysis from /Analysis to /IR
Stephen Neuendorffer [Thu, 30 Apr 2020 20:09:13 +0000 (13:09 -0700)]
[MLIR] Move Verifier and Dominance Analysis from /Analysis to /IR

These libraries are distinct from other things in Analysis in that they
operate only on core IR concepts.  This also simplifies dependencies
so that Dialect -> Analysis -> Parser -> IR.  Previously, the parser depended
on portions of the the Analysis directory as well, which sometimes
caused issues with the way the cmake makefile generator discovers
dependencies on generated files during compilation.

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

2 years ago[mlir][NFC] Cleanup StandardTypes and reorder the type classes
River Riddle [Sat, 2 May 2020 02:25:32 +0000 (19:25 -0700)]
[mlir][NFC] Cleanup StandardTypes and reorder the type classes

2 years ago[CostModel][X86][ARM] Teach default implementation of getCastInstrCost to not add...
Craig Topper [Sat, 2 May 2020 01:35:42 +0000 (18:35 -0700)]
[CostModel][X86][ARM] Teach default implementation of getCastInstrCost to not add a split/join cost if source type and the destination type both have a SplitVector action

If both the source and the destination need to be split then the two halves of the split operation are completely independent and don't need to be split or joined. So we don't need to assess a cost for the split or join.

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

2 years ago[X86] Use more accurate increments for the induction variables in sad.ll. NFC
Craig Topper [Sat, 2 May 2020 00:30:41 +0000 (17:30 -0700)]
[X86] Use more accurate increments for the induction variables in sad.ll. NFC

I think some copy/pasting was used to create loops of different
VFs. But the increment of the induction variable wasn't updated
to match the VF.

This has no effect on the pattern matching we're testing, it just
helps the test make sense to the reader.

2 years ago[llvm-objcopy][MachO] Fix isExternalSymbol method
Alexander Shaposhnikov [Sat, 2 May 2020 01:22:35 +0000 (18:22 -0700)]
[llvm-objcopy][MachO] Fix isExternalSymbol method

N_PEXT bit should not affect whether a symbol is considered to be external or not.
This also fixes the construction of the symbol table since it relies on the correct
ordering of symbols.

Test plan: make check-all

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

2 years ago[lit] Don't use Python3 yet
Julian Lettner [Sat, 2 May 2020 00:35:40 +0000 (17:35 -0700)]
[lit] Don't use Python3 yet

String interpolation is a Python3 feature, we can't use it yet.

2 years ago[WebAssembly] Renumber SIMD opcodes
Thomas Lively [Fri, 1 May 2020 01:11:15 +0000 (18:11 -0700)]
[WebAssembly] Renumber SIMD opcodes

Summary:
As described in https://github.com/WebAssembly/simd/pull/209. This is
the final reorganization of the SIMD opcode space before
standardization. It has been landed in concert with corresponding
changes in other projects in the WebAssembly SIMD ecosystem.

Reviewers: aheejin

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

Tags: #llvm

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

2 years ago[PowerPC] Refactor PPCInstrVSX.td
Nemanja Ivanovic [Sat, 2 May 2020 00:17:30 +0000 (19:17 -0500)]
[PowerPC] Refactor PPCInstrVSX.td

Over time, we have made many additions to this file and it has frankly become a
bit of a mess. This has led to at least one issue - we have a number of
instructions where the side effects flag should be set to false and we neglected
to do this. This patch suggests a refactoring that should make the file much
more maintainable. The file is split up into major sections and the nesting
level is reduced, predicate blocks merged, etc.

Sections:
  - Custom PPCISD node definitions
  - Predicate definitions
  - Instruction formats
  - Instruction definitions
  - Helper DAG definitions
  - Anonymous patterns
  - Instruction aliases

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

2 years ago[lit] Extract by_suite_and_test_path sort key function
Julian Lettner [Fri, 1 May 2020 23:27:59 +0000 (16:27 -0700)]
[lit] Extract by_suite_and_test_path sort key function

2 years ago[lit] Create report generators during argument parsing
Julian Lettner [Fri, 1 May 2020 22:52:44 +0000 (15:52 -0700)]
[lit] Create report generators during argument parsing

2 years ago[lit] Small refinements for xunit report output
Julian Lettner [Fri, 1 May 2020 22:20:18 +0000 (15:20 -0700)]
[lit] Small refinements for xunit report output

2 years ago[lit] Factor out report generators into separate file
Julian Lettner [Fri, 1 May 2020 16:35:46 +0000 (09:35 -0700)]
[lit] Factor out report generators into separate file

Factor out the report generators from main.py into reports.py.

I verified that we generate the exact same output by running `check-all`
and comparing the new and old output for both report flavors.

2 years ago[lit] Only update specific fields from remote test object
Julian Lettner [Fri, 1 May 2020 16:51:46 +0000 (09:51 -0700)]
[lit] Only update specific fields from remote test object

Don't update whole test object from the remote (pickled) finished test
object.  Doing so also changes the config and suite members, which we
want to avoid.

2 years ago[gn build] Port 6cb073133c5
LLVM GN Syncbot [Sat, 2 May 2020 00:00:04 +0000 (00:00 +0000)]
[gn build] Port 6cb073133c5

2 years ago[lld] Merge Mach-O input sections
Kellie Medlin [Fri, 1 May 2020 23:29:06 +0000 (16:29 -0700)]
[lld] Merge Mach-O input sections

Summary: Similar to other formats, input sections in the MachO
implementation are now grouped under output sections. This is primarily
a refactor, although there's some new logic (like resolving the output
section's flags based on its inputs).

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

2 years ago[mlir][DenseStringElementsAttr] Add support for the Attribute based get* methods.
River Riddle [Fri, 1 May 2020 23:26:45 +0000 (16:26 -0700)]
[mlir][DenseStringElementsAttr] Add support for the Attribute based get* methods.

This was missed in the original revision. This allows for using the opaque Attribute accessors when the elements are strings.

2 years ago[llvm][NFC] Rename variable as per https://reviews.llvm.org/D79215
Mircea Trofin [Fri, 1 May 2020 23:30:41 +0000 (16:30 -0700)]
[llvm][NFC] Rename variable as per https://reviews.llvm.org/D79215

Operator error - performed the rename and didn't save.

2 years ago[llvm][NFC] Inliner: simplify inlining decision logic
Mircea Trofin [Thu, 30 Apr 2020 23:22:31 +0000 (16:22 -0700)]
[llvm][NFC] Inliner: simplify inlining decision logic

Summary:
shouldInline makes a decision based on the InlineCost of a call site, as
well as an evaluation on whether the site should be deferred. This means
it's possible for the decision to be not to inline, even for an
InlineCost that would otherwise allow it.

Both uses of shouldInline performed the exact same logic after calling
it. In addition, the decision on whether to inline or not was
communicated through two values of the Option<InlineCost> return value:
None, or an InlineCost evaluating to false.

Simplified by:
- encapsulating the decision in the return object. The bool it evaluates
to communicates unambiguously the decision. The InlineCost is also
available.
- encapsulated the common post-shouldInline code into shouldInline.

Reviewers: davidxl, echristo, eraman

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

2 years ago[mlir][GPUOpsLowering] Add missing include for FormatVariadic
River Riddle [Fri, 1 May 2020 22:57:42 +0000 (15:57 -0700)]
[mlir][GPUOpsLowering] Add missing include for FormatVariadic

2 years ago[ARM64] Remove more dead code. NFC.
Davide Italiano [Fri, 1 May 2020 22:05:42 +0000 (15:05 -0700)]
[ARM64] Remove more dead code. NFC.

2 years ago[ARM64] Remove dead code.
Davide Italiano [Fri, 1 May 2020 22:04:44 +0000 (15:04 -0700)]
[ARM64] Remove dead code.

2 years ago[SveEmitter] Add builtins for shifts.
Sander de Smalen [Fri, 1 May 2020 20:39:16 +0000 (21:39 +0100)]
[SveEmitter] Add builtins for shifts.

This patch adds builtins for:
- svasrd
- svlsl
- svlsr

2 years ago[llvm-objcopy] -O binary: skip empty sections
Fangrui Song [Fri, 1 May 2020 05:15:05 +0000 (22:15 -0700)]
[llvm-objcopy] -O binary: skip empty sections

After SHF_ALLOC sections are ordered by LMA:

* If initial sections are empty, GNU objcopy skips their contents while we
  emit leading zeros. (binary-paddr.test %t4)
* If trailing sections are empty, GNU objcopy skips their contents while we
  emit trailing zeros. (binary-paddr.test %t5)

This patch matches GNU objcopy's behavior. Linkers don't keep p_memsz
PT_LOAD segments. Such empty sections would not have a containing
PT_LOAD and `Section::ParentSegment` might be null if linkers fail to
optimize the file offsets (lld D79254).

In particular, without D79254, the arm Linux kernel's multi_v5_defconfig
depends on this behavior: in `vmlinux`, an empty .text_itcm is mapped at
a very high address (0xfffe0000) but the kernel does not expect
`objcopy -O binary` to create a very large `arch/arm/boot/Image`
(0xfffe0000-0xc0000000 ~= 1GiB). See https://bugs.llvm.org/show_bug.cgi?id=45632

Reviewed By: jhenderson

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

2 years ago[clang][OpenMP] Fix mangling of linear parameters.
Francesco Petrogalli [Mon, 27 Apr 2020 19:39:42 +0000 (19:39 +0000)]
[clang][OpenMP] Fix mangling of linear parameters.

Summary:
The linear parameter token in the mangling function must be multiplied
by the pointee size in bytes when the parameter is a pointer.

Reviewers: ABataev, andwar, jdoerfert

Subscribers: yaxunl, guansong, cfe-commits

Tags: #clang

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

2 years ago[AIX] Skip unsupported ORC JIT RemoteObjectLayerTest on AIX
David Tenty [Fri, 1 May 2020 19:48:21 +0000 (15:48 -0400)]
[AIX] Skip unsupported ORC JIT RemoteObjectLayerTest on AIX

Summary:
Currently the XCOFF backend does not support writing 64-bit object
files, which the ORC JIT tests will try to exercise if we are on AIX. This patch
selectively disables the tests on AIX for now.

Reviewers: hubert.reinterpretcast, jasonliu, DiggerLin, stevewan, lhames

Reviewed By: hubert.reinterpretcast, lhames

Subscribers: llvm-commits

Tags: #llvm

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

2 years ago[lldb/API] Add SBCommandInterpreterRunResult
Jonas Devlieghere [Fri, 1 May 2020 20:23:51 +0000 (13:23 -0700)]
[lldb/API] Add SBCommandInterpreterRunResult

This adds an RunCommandInterpreter overload that returns an instance of
SBCommandInterpreterRunResults. The goal is to avoid having to add more
and more overloads when we need more output arguments.

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

2 years ago[SVE] Fix invalid use of VectorType::getNumElements() in PatternMatch
Christopher Tetreault [Fri, 1 May 2020 17:58:50 +0000 (10:58 -0700)]
[SVE] Fix invalid use of VectorType::getNumElements() in PatternMatch

Summary:
Update cst_pred_ty to only work on FixedVectorType. It operates on
integers and integer vectors, and returns true if the predicate returns
true for all elements of the vector. This operation is not possible on
scalable vectors. Make this behavior explicit in the code and document
the fact that it only tests fixed width vectors.

Identified by test LLVM.Transforms/InstCombine::nsw.ll

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

Reviewed By: david-arm

Subscribers: tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

2 years ago[libc++abi] Add -Wno-unreachable-code when building test for throwing incomplete...
Louis Dionne [Fri, 1 May 2020 19:27:54 +0000 (15:27 -0400)]
[libc++abi] Add -Wno-unreachable-code when building test for throwing incomplete types

Slightly older Clangs seem to think they are more clever than they really
are, and they think the code can never be executed. The code can actually
be executed in case the exception runtime is mis-implemented, which is
exactly what this test is testing. This commit just disables the spurious
warning.

2 years ago[clang] [unittest/AST] Fix linking to LLVMTestingSupport
Michał Górny [Fri, 1 May 2020 19:22:33 +0000 (21:22 +0200)]
[clang] [unittest/AST] Fix linking to LLVMTestingSupport

Link to LLVMTestingSupport via target_link_libraries() instead of
clang_target_link_libraries().  The latter is ineffective if tests
are linked to libclang.so.  This solution is consistent with what other
tests do.

2 years ago[lldb/CommandInterpreter] Fix typo in CommandInterpreterResult::IsResult
Jonas Devlieghere [Fri, 1 May 2020 19:03:56 +0000 (12:03 -0700)]
[lldb/CommandInterpreter] Fix typo in CommandInterpreterResult::IsResult

A missing `=` turned a comparison into an assignment.

2 years ago[IndexedAccessorRange] Only offset the base if the index is non-zero.
River Riddle [Fri, 1 May 2020 18:56:21 +0000 (11:56 -0700)]
[IndexedAccessorRange] Only offset the base if the index is non-zero.

This is more efficient and removes the need for derived ranges to handle the degenerate empty case.

2 years ago[CMake] Provide a proper default location for llvm-lit for out-of-tree users on Windo...
Vladimir Vereschaka [Wed, 29 Apr 2020 23:15:16 +0000 (16:15 -0700)]
[CMake] Provide a proper default location for llvm-lit for out-of-tree users on Windows host.

llvm-lit gets '.py' extension on Windows host during its configuration.
We need to provide a correct name for llvm-lit including file extension
within LLVM_CONFIG_DEFAULT_EXTERNAL_LIT variable.

Update for commit 45526d29a5b2cf126b83ada3991921970007d16f.

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

2 years ago[DebugInfo] Update loop metadata in stripNonLineTableDebugInfo
Vedant Kumar [Thu, 30 Apr 2020 20:22:22 +0000 (13:22 -0700)]
[DebugInfo] Update loop metadata in stripNonLineTableDebugInfo

Summary:
Have stripNonLineTableDebugInfo() attach updated !llvm.loop metadata to
an instruction (instead of updating and then discarding the metadata).

This fixes "!dbg attachment points at wrong subprogram for function"
errors seen while archiving an iOS app.

It would be nice -- as a follow-up -- to catch this issue earlier,
perhaps by modifying the verifier to constrain where DILocations are
allowed. Any alternative suggestions appreciated.

rdar://61982466

Reviewers: aprantl, dsanders

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

2 years ago[libc++] Try re-enabling DSL test on Windows
Louis Dionne [Wed, 29 Apr 2020 15:30:37 +0000 (11:30 -0400)]
[libc++] Try re-enabling DSL test on Windows

The issues we were seeing before should have been fixed, but it's hard
to say for sure without running through the bots again.

2 years ago[lldb/CommandInterpreter] Add CommandInterpreterRunResult (NFC)
Jonas Devlieghere [Fri, 1 May 2020 18:29:07 +0000 (11:29 -0700)]
[lldb/CommandInterpreter] Add CommandInterpreterRunResult (NFC)

This patch adds a new class CommandInterpreterRunResult which will be
backing the SBCommandInterpreterRunResult. It keeps track of the number
of errors as well as the result which is an enum, as proposed by Pavel
in D79120. The command interpreter now populates the results directly,
instead of its own member variables.

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

2 years ago[ELF][test] Improve tests
Fangrui Song [Fri, 1 May 2020 18:04:20 +0000 (11:04 -0700)]
[ELF][test] Improve tests

Prepare for the upcomong change that removes unneeded sh_offset
advancement for empty sections whose PT_LOAD are removed.

2 years ago[MLIR][docs] Update tutorial language around Op and Operation* and 'opaque'
Stephen Neuendorffer [Wed, 29 Apr 2020 23:27:36 +0000 (16:27 -0700)]
[MLIR][docs] Update tutorial language around Op and Operation* and 'opaque'

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

2 years agoFix pr31836 on Windows too, and correctly handle repeated separators.
Nico Weber [Fri, 1 May 2020 00:39:19 +0000 (20:39 -0400)]
Fix pr31836 on Windows too, and correctly handle repeated separators.

The approach in D30000 assumes that the '/' returned by path::begin()
is the first element for absolute paths, but that's not true on
Windows.

Also, on Windows backslashes in include lines often end up escaped
so that there are two of them. Having backslashes in include lines
is undefined behavior in most cases and implementation-defined
behavior in C++20, but since clang treats it as normal repeated
path separators, the diagnostic should too.

Unbreaks -Wnonportable-include-path for absolute paths on Windows,
and unbreaks it on non-Windows in the case of absolute paths with
repeated directory separators.

This affects e.g. the `#include __FILE__` technique if the file
passed to clang has the wrong case for the drive letter. Before:

C:\src\llvm-project>bin\clang-cl.exe c:\src\llvm-project\test.cc
c:\\src\\llvm-project\\test.cc(4,10): warning: non-portable path to file
    '"c\\srccllvm-projectctest.cc.'; specified path differs in case from
    file name on disk [-Wnonportable-include-path]
         ^

Now:

C:\src\llvm-project> out\gn\bin\clang-cl c:\src\llvm-project\test.cc
c:\\src\\llvm-project\\test.cc(4,10): warning: non-portable path to file
    '"C:\\src\\llvm-project\\test.cc"'; specified path differs in case from
    file name on disk [-Wnonportable-include-path]
         ^

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

2 years ago[X86] Lower the cost of v4i64->v4i32 truncate with avx512.
Craig Topper [Fri, 1 May 2020 17:38:33 +0000 (10:38 -0700)]
[X86] Lower the cost of v4i64->v4i32 truncate with avx512.

We use the vpmovqd instruction which is a single uop. So
the cost should be 1.

2 years ago[examples] Fix an incomplete comment.
Lang Hames [Fri, 1 May 2020 18:01:48 +0000 (11:01 -0700)]
[examples] Fix an incomplete comment.

2 years ago[examples] Call setProcessAllSections to ensure debug sections aren't droppped.
Lang Hames [Thu, 30 Apr 2020 23:08:25 +0000 (16:08 -0700)]
[examples] Call setProcessAllSections to ensure debug sections aren't droppped.

Calling setProcessAllSections(true) is required to make sure that all sections,
even those not marked as necessary for execution, are passed to the memory
manager.

2 years ago[libc++] Re-enable some tests under ASAN and MSAN
Louis Dionne [Fri, 1 May 2020 17:25:40 +0000 (13:25 -0400)]
[libc++] Re-enable some tests under ASAN and MSAN

The tests were disabled under ASAN/MSAN because old Clangs were very
slow to build the test cases. However, I checked with the Clang used
on our build bots and the tests are not slow to build anymore, so the
tests can be re-enabled.

2 years ago[SVE] Fix invalid usage of VectorType::getNumElements() in InstCombine
Christopher Tetreault [Fri, 1 May 2020 17:17:54 +0000 (10:17 -0700)]
[SVE] Fix invalid usage of VectorType::getNumElements() in InstCombine

Summary:
Make foldVectorBinop return null if the instruction type is a scalable
vector. It is unclear what, if any, of this function works with scalable
vectors.

Identified by test LLVM.Transforms/InstCombine::nsw.ll

Reviewers: efriedma, david-arm, fpetrogalli, spatel

Reviewed By: efriedma

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

Tags: #llvm

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

2 years ago[InstCombine] fix miscompile from multi-use cttz/ctlz transform
Sanjay Patel [Fri, 1 May 2020 17:51:21 +0000 (13:51 -0400)]
[InstCombine] fix miscompile from multi-use cttz/ctlz transform

PR45762:
https://bugs.llvm.org/show_bug.cgi?id=45762

2 years ago[InstCombine] add test for faulty cttz fold (PR45762); NFC
Sanjay Patel [Fri, 1 May 2020 16:53:57 +0000 (12:53 -0400)]
[InstCombine] add test for faulty cttz fold (PR45762); NFC

2 years ago[libc++] Turn on warnings in the test suite in C++03 for Clang-based compilers
Louis Dionne [Fri, 1 May 2020 17:14:04 +0000 (13:14 -0400)]
[libc++] Turn on warnings in the test suite in C++03 for Clang-based compilers

2 years agoRevert "Reapply "Add support for #pragma float_control" with improvements to"
Melanie Blower [Fri, 1 May 2020 17:31:09 +0000 (10:31 -0700)]
Revert "Reapply "Add support for #pragma float_control" with improvements to"

This reverts commit 69aacaf699922ffe0450f567e21208c10c84731f.

2 years ago[libc++] Disable test that we use -Werror in C++03
Louis Dionne [Fri, 1 May 2020 17:11:55 +0000 (13:11 -0400)]
[libc++] Disable test that we use -Werror in C++03

2 years ago[ADT] Add DenseSetImpl(begin, end)
Fangrui Song [Fri, 1 May 2020 16:57:18 +0000 (09:57 -0700)]
[ADT] Add DenseSetImpl(begin, end)

2 years ago[libc++] NFC: fix typos
Louis Dionne [Fri, 1 May 2020 17:10:06 +0000 (13:10 -0400)]
[libc++] NFC: fix typos

2 years ago[InstCombine] Additional 'concat of ORs' BSWAP/BITREVERSE tests for D79041
Simon Pilgrim [Fri, 1 May 2020 16:57:28 +0000 (17:57 +0100)]
[InstCombine] Additional 'concat of ORs' BSWAP/BITREVERSE tests for D79041

2 years agoReapply "Add support for #pragma float_control" with improvements to
Melanie Blower [Fri, 1 May 2020 16:26:15 +0000 (09:26 -0700)]
Reapply "Add support for #pragma float_control" with improvements to
test cases
Add support for #pragma float_control

Reviewers: rjmccall, erichkeane, sepavloff

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

This reverts commit 85dc033caccaa6ab919d57f9759290be41240146, and makes
corrections to the test cases that failed on buildbots.

2 years ago[mlir][rocdl] fix shared lib build. NFC.
Wen-Heng (Jack) Chung [Fri, 1 May 2020 16:49:15 +0000 (09:49 -0700)]
[mlir][rocdl] fix shared lib build. NFC.

Summary: - Add missing dependency to MLIRVectorToLLVM to get shared libs built.

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

2 years ago[SveEmitter] Add builtins for various FP operations
Sander de Smalen [Fri, 1 May 2020 16:34:42 +0000 (17:34 +0100)]
[SveEmitter] Add builtins for various FP operations

Unary:
- svexpa, svtmad, svtsmul, svtssel,
  svscale, svrecpe, svrecps, svrsqrte,
  svrsqrts,

Binary:
- svabd, svadd, svdiv, svdivr,
  svmin, svmax, svminnm, svmaxnm,
  svmul, svmulx, svsub, svsubr,
  svmul_lane

Complex:
- svcadd, svcmla

2 years agoscudo: Exclude previous tag when retagging freed memory.
Peter Collingbourne [Thu, 30 Apr 2020 23:42:17 +0000 (16:42 -0700)]
scudo: Exclude previous tag when retagging freed memory.

This means that immediate use after free will be detected 100% of
the time.

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

2 years ago[NFC] Try to fix test due asan failure
Diogo Sampaio [Fri, 1 May 2020 16:16:58 +0000 (17:16 +0100)]
[NFC] Try to fix test due asan failure

2 years ago[llvm-readobj] - Simplify conditions used for printing segment mappings. NFCI.
Georgii Rymar [Thu, 23 Apr 2020 12:54:25 +0000 (15:54 +0300)]
[llvm-readobj] - Simplify conditions used for printing segment mappings. NFCI.

This patch is a NFC refactoring.

Currently the logic is overcomplicated, contains dead conditions and is very hard to read.
This patch performs a very straightforward simplification. Probably it can be
simplified and improved more, but we need to land test cases documenting/testing
all the current functionality first.

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

2 years ago[llvm-readelf] - Do not crash when the PT_INTERP has a broken offset.
Georgii Rymar [Tue, 28 Apr 2020 15:16:00 +0000 (18:16 +0300)]
[llvm-readelf] - Do not crash when the PT_INTERP has a broken offset.

We do not verify the p_offset of the PT_INTERP header and tool may
crash when a program interpreter name string goes past the end of the file.

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

2 years ago[OPENMP50]Codegen for reduction clauses with 'task' modifier.
Alexey Bataev [Fri, 24 Apr 2020 13:56:29 +0000 (09:56 -0400)]
[OPENMP50]Codegen for reduction clauses with 'task' modifier.

Summary:
Added codegen for reduction clause with task modifier.
```
  #pragma omp ... reduction(task, +: a)
  {
  #pragma omp ... in_reduction(+: a)
  }
```
is translated into something like this:
```
  #pragma omp ... reduction(+:a)
  {
    struct red_input_t {
      void *reduce_shar;
      void *reduce_orig;
      size_t reduce_size;
      void *reduce_init;
      void *reduce_fini;
      void *reduce_comb;
      unsigned flags;
    } r_var;
    r_var.reduce_shar = &a;
    r_var.reduce_orig = &original a;
    r_var.reduce_size = sizeof(a);
    r_var.reduce_init = [](void* l,void*){return *(int*)l=0;};
    r_var.reduce_fini = nullptr;
    r_var.reduce_comb = [](void* l,void* r){return *(int*)l += *(int)r;};
    void *tg = __kmpc_taskred_modifier_init(<loc_addr>,<gtid>,
      <flag - 0 for parallel, 1 for worksharing>,
      <1 - number of reduction elements>,
      &r_var);
    {
    #pragma omp ... in_reduction(+: a) firstprivate(tg)
    ...
    }
    __kmpc_task_reduction_modifier_fini(<loc_addr>,<gtid>,
      <flag - 0 for parallel, 1 for worksharing>);
  }
```

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, jfb, cfe-commits, caomhin

Tags: #clang

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

2 years ago[llvm-readobj][test] - Stop using binaries in gnu-phdrs.test, split and refine it.
Georgii Rymar [Thu, 23 Apr 2020 08:09:38 +0000 (11:09 +0300)]
[llvm-readobj][test] - Stop using binaries in gnu-phdrs.test, split and refine it.

gnu-phdrs.test uses 2 precompiled objects and has issues:

* It does not test all possible program headers.
* It does not test target-specific headers (arm, mips).
* It does not use --strict-whitespace --match-full-line to check the format of the output.
* It is possible to check things better/nicer.
* It also tests --section-mapping.

This patch makes gnu-phdrs.test to stop using binaries and addresses issues above.
It splits --section-mapping testing to gnu-section-mapping.test

I am going to use it as a base for a follow-up patch that should also test
section to segment mapping conditions that we currently have
(see the discussion in D78709)

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

2 years ago[DAG] SimplifyDemandedVectorElts - add INSERT_SUBVECTOR SimplifyMultipleUseDemandedBi...
Simon Pilgrim [Fri, 1 May 2020 15:08:30 +0000 (16:08 +0100)]
[DAG] SimplifyDemandedVectorElts - add INSERT_SUBVECTOR SimplifyMultipleUseDemandedBits handling

2 years ago[DAG] SimplifyDemandedVectorElts - remove INSERT_SUBVECTOR if we don't demand the...
Simon Pilgrim [Fri, 1 May 2020 14:38:20 +0000 (15:38 +0100)]
[DAG] SimplifyDemandedVectorElts - remove INSERT_SUBVECTOR if we don't demand the subvector

2 years ago[libc++] Avoid using GNU extension in test, which triggers a warning
Louis Dionne [Fri, 1 May 2020 15:04:34 +0000 (11:04 -0400)]
[libc++] Avoid using GNU extension in test, which triggers a warning

2 years ago[libc++] Make sure -Werror is enabled all the time, except in verify tests
Louis Dionne [Thu, 30 Apr 2020 22:11:07 +0000 (18:11 -0400)]
[libc++] Make sure -Werror is enabled all the time, except in verify tests

2 years ago[InstSimplify] allow insertelement-with-undef fold if poison-safe
Sanjay Patel [Fri, 1 May 2020 14:34:29 +0000 (10:34 -0400)]
[InstSimplify] allow insertelement-with-undef fold if poison-safe

The more general fold was not poison-safe, so it was removed:
rG5486e00
...but it is ok to have this transform if analysis can determine
the vector contains no poison. The test shows a simple example
of that: constant integer elements are not poison.

2 years ago[InstSimplify] update test; NFC
Sanjay Patel [Fri, 1 May 2020 14:06:02 +0000 (10:06 -0400)]
[InstSimplify] update test; NFC

Missed this test diff when committing:
rG5486e00dc3