platform/upstream/llvm.git
4 years ago[x86] auto-generate complete test checks; NFC
Sanjay Patel [Thu, 16 Apr 2020 21:16:22 +0000 (17:16 -0400)]
[x86] auto-generate complete test checks; NFC

4 years ago[ARM] MVE postinc tests. NFC
David Green [Tue, 14 Apr 2020 17:49:15 +0000 (18:49 +0100)]
[ARM] MVE postinc tests. NFC

4 years ago[lldb/Utility] Fix a bug in stringify_append for printing addresses.
Jonas Devlieghere [Thu, 16 Apr 2020 21:02:05 +0000 (14:02 -0700)]
[lldb/Utility] Fix a bug in stringify_append for printing addresses.

The recent change in the API macros revealed that we were not printing
the pointer address for a bunch of methods, but rather the address of
the pointer. It's something I had already noticed while looking at some
reproducer traces, but hadn't made it to the top of my list yet. This
fixes the issue by providing a more specific overload.

4 years agotsan: fixes to ThreadClock::releaseStoreAcquire and tests
Daniel S Fava [Thu, 16 Apr 2020 20:53:26 +0000 (22:53 +0200)]
tsan: fixes to ThreadClock::releaseStoreAcquire and tests

Fixes:
1. Setting the number of entries in a thread's clock to max between
   the thread and the SyncClock the thread is acquiring from
2. Setting last_acquire_

Unit- and stress-test for releaseStoreAcquire added to
tests/unit/tsan_clock_test.cpp

4 years ago[MLIR] Complete refactoring of Affine dialect into sub-libraries.
Stephen Neuendorffer [Thu, 16 Apr 2020 18:11:13 +0000 (11:11 -0700)]
[MLIR] Complete refactoring of Affine dialect into sub-libraries.

There were some unused CMakeFiles for Affine/IR and Affine/EDSC.
This change builds separate MLIRAffineOps and MLIRAffineEDSC libraries
using those CMakeFiles.  This combination replaces the old MLIRAffine
library.

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

4 years ago[DWARF] Add instructions to regenerate this test, if needed.
Davide Italiano [Thu, 16 Apr 2020 20:31:32 +0000 (13:31 -0700)]
[DWARF] Add instructions to regenerate this test, if needed.

4 years ago[Shell] Remove incorrectly cargo-culted UNSUPPORTED.
Davide Italiano [Thu, 16 Apr 2020 20:22:06 +0000 (13:22 -0700)]
[Shell] Remove incorrectly cargo-culted UNSUPPORTED.

Let's see if this sticks on the bots.

4 years ago[ARM] Mir test for machine sinking multiple def instructions. NFC
David Green [Thu, 16 Apr 2020 19:53:32 +0000 (20:53 +0100)]
[ARM] Mir test for machine sinking multiple def instructions. NFC

4 years ago[clang-tools-extra] reimplement PreprocessorTracker in terms of StringSet.
Chris Lattner [Thu, 16 Apr 2020 05:27:19 +0000 (22:27 -0700)]
[clang-tools-extra] reimplement PreprocessorTracker in terms of StringSet.

Summary:
PreprocessorTracker is the last user of the old StringPool class, which
isn't super loved and isn't a great improvement over a plan StringSet.
Once this goes in we can remove StringPool entirely.

This is as discussed on cfe-dev.

Subscribers: cfe-commits

Tags: #clang

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

4 years agoReland: Don't expose unavailable cstdio functions.
Dan Albert [Thu, 12 Mar 2020 18:16:30 +0000 (11:16 -0700)]
Reland: Don't expose unavailable cstdio functions.

Marked unsupported for C++03 and C++11 since this test uses alias
declarations, and at least one C++03 bot was failing with
-Wc++11-extensions.

Change-Id: I8c3a579edd7eb83e0bc74e85d116b68f22400161

4 years ago[FileCheck] Fix --dump-input annotation sort per input line
Joel E. Denny [Thu, 16 Apr 2020 18:53:56 +0000 (14:53 -0400)]
[FileCheck] Fix --dump-input annotation sort per input line

Without this patch, `--dump-input` annotations on a single input line
are sorted by the associated directive's check-file line.  That seemed
fine because that's often identical to the order in which FileCheck
looks for matches for those directives.

The first problem is that an `--implicit-check-not` pattern has no
check-file line.  The logical equivalent is sorting in command-line
order, but that's not implemented.

The second problem is that, unlike a directive, an
`--implicit-check-not` pattern applies at many points, between many
different pairs of directives.  However, sorting in command-line order
gathers all its associated diagnostics together at one point in an
input line's list of annotations.

In general, it seems to be easier to understand FileCheck's logic when
annotations on a single input line are sorted in the order FileCheck
produced the associated diagnostics, so this patch makes that change.
As documented in the patch, the annotation sort order is also
especially relevant to `CHECK-LABEL`, `CHECK-NOT`, and `CHECK-DAG`, so
this patch updates or extends tests to check the sort makes sense for
them.  (However, the sort for `CHECK-DAG` annotations should not
actually be altered by this patch.)

Reviewed By: thopre

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

4 years ago[FileCheck] Fix --dump-input implicit pattern location
Joel E. Denny [Thu, 16 Apr 2020 18:53:44 +0000 (14:53 -0400)]
[FileCheck] Fix --dump-input implicit pattern location

Currently, `--dump-input` implies that all `--implicit-check-not`
patterns appear on line 1 by printing annotations like:

```
       1: foo bar baz
not:1         !~~     error: no match expected
```

This patch changes that to:

```
          1: foo bar baz
not:imp1         !~~     error: no match expected
```

`imp1` indicates the first `--implicit-check-not` pattern.

Reviewed By: thopre

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

4 years ago[MC][ELF] Put explicit section name symbols into entry size compatible sections
bd1976llvm [Thu, 16 Apr 2020 10:45:31 +0000 (10:45 +0000)]
[MC][ELF] Put explicit section name symbols into entry size compatible sections

Ensure that symbols explicitly* assigned a section name are placed into
a section with a compatible entry size.

This is done by creating multiple sections with the same name** if
incompatible symbols are explicitly given the name of an incompatible
section, whilst:

  - Avoiding using uniqued sections where possible (for readability and
    to maximize compatibly with assemblers).

  - Creating as few SHF_MERGE sections as possible (for efficiency).

Given that each symbol is assigned to a section in a single pass, we
must decide which section each symbol is assigned to without seeing the
properties of all symbols. A stable and easy to understand assignment is
desirable. The following rules facilitate this: The "generic" section
for a given section name will be mergeable if the name is a mergeable
"default" section name (such as .debug_str), a mergeable "implicit"
section name (such as .rodata.str2.2), or MC has already created a
mergeable "generic" section for the given section name (e.g. in response
to a section directive in inline assembly). Otherwise, the "generic"
section for a given name is non-mergeable; and, non-mergeable symbols
are assigned to the "generic" section, while mergeable symbols are
assigned to uniqued sections.

Terminology:
"default" sections are those always created by MC initially, e.g. .text
or .debug_str.

"implicit" sections are those created normally by MC in response to the
symbols that it encounters, i.e. in the absence of an explicit section
name assignment on the symbol, e.g. a function foo might be placed into
a .text.foo section.

"generic" sections are those that are referred to when a unique section
ID is not supplied, e.g. if there are multiple unique .bob sections then
".quad .bob" will reference the generic .bob section. Typically, the
generic section is just the first section of a given name to be created.
Default sections are always generic.

* Typically, section names might be explicitly assigned in source code
using a language extension e.g. a section attribute: _attribute_
((section ("section-name"))) -
https://clang.llvm.org/docs/AttributeReference.html

** I refer to such sections as unique/uniqued sections. In assembly the
", unique," assembly syntax is used to express such sections.

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

See https://reviews.llvm.org/D68101 for previous discussions leading to
this patch.

Some minor fixes were required to LLVM's tests, for tests had been using
the old behavior - which allowed for explicitly assigning globals with
incompatible entry sizes to a section.

This fix relies on the ",unique ," assembly feature. This feature is not
available until bintuils version 2.35
(https://sourceware.org/bugzilla/show_bug.cgi?id=25380). If the
integrated assembler is not being used then we avoid using this feature
for compatibility and instead try to place mergeable symbols into
non-mergeable sections or issue an error otherwise.

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

4 years agoReland "[codeview] Reference types in type parent scopes"
Amy Huang [Mon, 13 Apr 2020 18:06:37 +0000 (11:06 -0700)]
Reland "[codeview] Reference types in type parent scopes"

Summary:
Original description (https://reviews.llvm/org/D69924)
Without this change, when a nested tag type of any kind (enum, class,
struct, union) is used as a variable type, it is emitted without
emitting the parent type. In CodeView, parent types point to their inner
types, and inner types do not point back to their parents. We already
walk over all of the parent scopes to build the fully qualified name.
This change simply requests their type indices as we go along to enusre
they are all emitted.

Now, while walking over the parent scopes, add the types to
DeferredCompleteTypes, since they might already be in the process of
being emitted.

Fixes PR43905

Reviewers: rnk, amccarth

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[libc++] NFC: Reindent impossible to read conditional in __config
Louis Dionne [Thu, 16 Apr 2020 19:01:09 +0000 (15:01 -0400)]
[libc++] NFC: Reindent impossible to read conditional in __config

4 years ago[LLVM] Remove wrong DBG_VALUE instruction with one operand in AArch64 test case
Jaydeep Chauhan [Thu, 16 Apr 2020 18:10:47 +0000 (11:10 -0700)]
[LLVM] Remove wrong DBG_VALUE instruction with one operand in AArch64  test case

Summary:
AArch64 test case llvm/test/CodeGen/AArch64/branch-target-enforcement.mir is checking for invalid  DBG_VALUE instruction with one operand(`DBG_VALUE $lr`). And this DBG_VALUE instruction is echoed from test case it self only.

Correct format of DBG_VALUE is given in below link:
https://llvm.org/docs/SourceLevelDebugging.html#variable-locations-in-instruction-selection-and-mir

Reviewers: dsanders, eli.friedman, jmorse, vsk

Reviewed By: dsanders

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

Tags: #llvm

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

4 years ago[CodeGen] fix inline builtin-related breakage from D78162
George Burgess IV [Thu, 16 Apr 2020 17:56:19 +0000 (10:56 -0700)]
[CodeGen] fix inline builtin-related breakage from D78162

In cases where we have multiple decls of an inline builtin, we may need
to go hunting for the one with a definition when setting function
attributes.

An additional test-case was provided on
https://github.com/ClangBuiltLinux/linux/issues/979

4 years ago[AArch64][SVE] Add DestructiveBinaryImm SQSHLU patterns.
Cameron McInally [Thu, 16 Apr 2020 18:41:14 +0000 (13:41 -0500)]
[AArch64][SVE] Add DestructiveBinaryImm SQSHLU patterns.

Add DestructiveBinaryImm SQSHLU patterns and tests. These patterns allow the SQSHLU instruction to match with a MOVPRFX.

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

4 years ago[CallSite removal][CodeGen] Drop some unneeded includes of CallSite.h. NFC
Craig Topper [Thu, 16 Apr 2020 18:05:31 +0000 (11:05 -0700)]
[CallSite removal][CodeGen] Drop some unneeded includes of CallSite.h. NFC

The uses of CallSite were removed in previous patches.

4 years ago[CallSite removal][CodeGen] Remove CallSite use from BasicTTIImpl.h. NFC
Craig Topper [Thu, 16 Apr 2020 17:54:30 +0000 (10:54 -0700)]
[CallSite removal][CodeGen] Remove CallSite use from BasicTTIImpl.h. NFC

While there convert iterator loops to range-based.

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

4 years ago[gn build] Port d9085f65db0
LLVM GN Syncbot [Thu, 16 Apr 2020 17:47:41 +0000 (17:47 +0000)]
[gn build] Port d9085f65db0

4 years ago[PowerPC][Future] Initial support for PC Relative addressing for global values
Stefan Pintilie [Thu, 16 Apr 2020 17:45:22 +0000 (12:45 -0500)]
[PowerPC][Future] Initial support for PC Relative addressing for global values

This patch adds PC Relative support for global values that are known at link
time. If a global value requires access through the global offset table (GOT)
it is not covered in this patch.

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

4 years ago[globalisel] Add lost debug locations verifier
Daniel Sanders [Wed, 1 Apr 2020 18:19:58 +0000 (11:19 -0700)]
[globalisel] Add lost debug locations verifier

Summary:
This verifier tries to ensure that DebugLoc's don't just disappear as
we transform the MIR. It observes the instructions created, erased, and
changed and at checkpoints chosen by the client algorithm verifies the
locations affected by those changes.

In particular, it verifies that:
* Every DebugLoc for an erased/changing instruction is still present on
  at least one new/changed instruction
* Failing that, that there is a line-0 location in the new/changed
  instructions. It's not possible to confirm which locations were merged so
  it conservatively assumes all unaccounted for locations are accounted
  for by any line-0 location to avoid false positives.
If that fails, it prints the lost locations in the debug output along with
the instructions that should have accounted for them.

In theory, this is usable by the legalizer, combiner, selector and any other
pass that performs incremental changes to the MIR. However, it has so far
only really been tested on the legalizer (not including the artifact
combiner) where it has caught lots of lost locations, particularly in Custom
legalizations. There's only one example here as my initial testing was on an
out-of-tree target and I haven't done a pass over the in-tree targets yet.

Depends on D77575, D77446

Reviewers: bogner, aprantl, vsk

Subscribers: jvesely, nhaehnle, mgorny, rovka, hiraditya, volkan, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[globalisel] Allow backends to report an issue without triggering fallback. NFC
Daniel Sanders [Thu, 16 Apr 2020 00:24:17 +0000 (17:24 -0700)]
[globalisel] Allow backends to report an issue without triggering fallback. NFC

Summary:
This will allow us to fix the issue where the lost locations
verifier causes CodeGen changes on lost locations because it
falls back on DAGISel

Reviewers: qcolombet, bogner, aprantl, vsk, paquette

Subscribers: rovka, hiraditya, volkan, llvm-commits

Tags: #llvm

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

4 years ago[MC][X86] Allow SHT_PROGBITS for .eh_frame on x86-64
Fangrui Song [Fri, 13 Mar 2020 18:20:13 +0000 (11:20 -0700)]
[MC][X86] Allow SHT_PROGBITS for .eh_frame on x86-64

GNU as emits SHT_PROGBITS .eh_frame by default for .cfi_* directives.
We follow x86-64 psABI and use SHT_X86_64_UNWIND for .eh_frame

Don't error for SHT_PROGBITS .eh_frame on x86-64.
This keeps compatibility with `.section .eh_frame,"a",@progbits` in existing assembly files.

See https://groups.google.com/d/msg/x86-64-abi/7sr4E6THl3g/zUU2UPHOAQAJ
for more discussions.

Reviewed By: joerg

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

4 years ago[AMDGPU] Define 16 bit SGPR subregs
Stanislav Mekhanoshin [Fri, 10 Apr 2020 22:54:54 +0000 (15:54 -0700)]
[AMDGPU] Define 16 bit SGPR subregs

These are needed as a counterpart for VGPR subregs even though
there are no scalar instructions which can operate 16 bit values.
When we are materializing a constant that is done into an SGPR
and that SGPR may/will be copied into a 16 bit VGPR subreg. Such
copy is illegal. There are also similar problems if a source
operand of a 16 bit VALU instruction is an SGPR. In addition
we need to get a register with a lo16 subregister of an SGPR
RC during selection and this fails as well.

All of that makes me believe we need these subregisters as a
syntactic glue.

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

4 years ago[lldb/Docs] Add some more info about the test suite structure
Jonas Devlieghere [Thu, 16 Apr 2020 17:02:26 +0000 (10:02 -0700)]
[lldb/Docs] Add some more info about the test suite structure

Expand on the structure of the LLDB test suite. So far this information
has been mostly "tribal knowledge". By writing it down I hope to make it
easier to understand our test suite for anyone that's new to the
project.

4 years ago[ARM][MVE] Fix location of optimized gather addresses
Anna Welker [Thu, 16 Apr 2020 17:09:24 +0000 (18:09 +0100)]
[ARM][MVE] Fix location of optimized gather addresses

Fix for the address optimization for gathers and scatters which would in
some complex cases push out instructions not to the vector loop preheader,
but to other locations as well which lead to a scrambled order and the
compilation failing.
This patch ensures that said instructions are always pushed to the end
of the vector loop preheader.

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

4 years ago[lldb/Reproducers] Simplify LLDB_RECORD macros
Jonas Devlieghere [Tue, 14 Apr 2020 20:28:27 +0000 (13:28 -0700)]
[lldb/Reproducers] Simplify LLDB_RECORD macros

Redefine the LLDB_RECORD macros in terms of a common uber-macro to
reduce code duplication across them.

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

4 years ago[OpenMPOpt] deduplicateRuntimeCalls(): avoid traditional map lookup pitfall
Roman Lebedev [Thu, 16 Apr 2020 16:53:17 +0000 (19:53 +0300)]
[OpenMPOpt] deduplicateRuntimeCalls(): avoid traditional map lookup pitfall

Summary:
This roughly halves time spent in that pass,
while unsurprisingly significantly reducing total memory usage.

This makes sense because most functions won't use any openmp functions..

old
```
   0.2329 (  0.5%)   0.0409 (  0.9%)   0.2738 (  0.5%)   0.2736 (  0.5%)  OpenMP specific optimizations
```
```
total runtime: 63.32s.
bytes allocated in total (ignoring deallocations): 8.34GB (131.70MB/s)
calls to allocation functions: 14526259 (229410/s)
temporary memory allocations: 3335760 (52680/s)
peak heap memory consumption: 324.36MB
peak RSS (including heaptrack overhead): 5.39GB
total memory leaked: 289.93MB
```

new
```
   0.1457 (  0.3%)   0.0276 (  0.6%)   0.1732 (  0.3%)   0.1731 (  0.3%)  OpenMP specific optimizations
```
```
total runtime: 55.01s.
bytes allocated in total (ignoring deallocations): 6.70GB (121.89MB/s)
calls to allocation functions: 14268205 (259398/s)
temporary memory allocations: 3225355 (58637/s)
peak heap memory consumption: 324.09MB
peak RSS (including heaptrack overhead): 5.39GB
total memory leaked: 289.87MB
```

diff
```
total runtime: -8.31s.
bytes allocated in total (ignoring deallocations): -1.63GB (196.58MB/s)
calls to allocation functions: -258054 (31034/s)
temporary memory allocations: -110405 (13277/s)
peak heap memory consumption: -262.36KB
peak RSS (including heaptrack overhead): 0B
total memory leaked: -61.45KB
```

Reviewers: jdoerfert, hfinkel

Reviewed By: jdoerfert

Subscribers: yaxunl, hiraditya, guansong, llvm-commits

Tags: #llvm

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

4 years ago[libc++] Simplify conditional in __config for _LIBCPP_NO_RTTI
Louis Dionne [Thu, 16 Apr 2020 16:44:32 +0000 (12:44 -0400)]
[libc++] Simplify conditional in __config for _LIBCPP_NO_RTTI

We don't support GCC's older than 5.x anymore.

4 years ago[PowerPC] Ignore implicit register operands for MCInst
Kang Zhang [Thu, 16 Apr 2020 16:22:43 +0000 (16:22 +0000)]
[PowerPC] Ignore implicit register operands for MCInst

Summary:
When doing the conversion: MachineInst -> MCInst, we should ignore the
implicit operands, it will expose more opportunity for InstiAlias.

Reviewed By: steven.zhang

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

4 years agoMCSchedule.h - replace ArrayRef.h include with forward declaration. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 16:09:30 +0000 (17:09 +0100)]
MCSchedule.h - replace ArrayRef.h include with forward declaration. NFC.

4 years agoMCInstrDesc.h - move MCSubtargetInfo forward declaration down to MCInstrInfo.h. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 16:08:57 +0000 (17:08 +0100)]
MCInstrDesc.h - move MCSubtargetInfo forward declaration down to MCInstrInfo.h. NFC.

Remove unused FeatureBitset forward declaration

4 years agoWasm.h - remove unnecessary StringMap.h include. NFC
Simon Pilgrim [Thu, 16 Apr 2020 15:09:43 +0000 (16:09 +0100)]
Wasm.h - remove unnecessary StringMap.h include. NFC

4 years agoMCAsmBackend.h - cleanup includes and forward declarations. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 15:08:22 +0000 (16:08 +0100)]
MCAsmBackend.h - cleanup includes and forward declarations. NFC.
Replace StringRef.h include to forward declaration
Remove MCFragment/MCRelaxableFragment forward declarations - these are included in MCFragment.h

4 years agoRevert "[clang][AST] Support AST files larger than 512M"
Dmitry Polukhin [Thu, 16 Apr 2020 16:05:40 +0000 (09:05 -0700)]
Revert "[clang][AST] Support AST files larger than 512M"

Bitcode file alignment is only 32-bit so 64-bit offsets need
special handling.
/b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Serialization/ASTReader.cpp:6327:28: runtime error: load of misaligned address 0x7fca2bcfe54c for type 'const uint64_t' (aka 'const unsigned long'), which requires 8 byte alignment
0x7fca2bcfe54c: note: pointer points here
  00 00 00 00 5a a6 01 00  00 00 00 00 19 a7 01 00  00 00 00 00 48 a7 01 00  00 00 00 00 7d a7 01 00
              ^
    #0 0x3be2fe4 in clang::ASTReader::TypeCursorForIndex(unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Serialization/ASTReader.cpp:6327:28
    #1 0x3be30a0 in clang::ASTReader::readTypeRecord(unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Serialization/ASTReader.cpp:6348:24
    #2 0x3bd3d4a in clang::ASTReader::GetType(unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Serialization/ASTReader.cpp:6985:26
    #3 0x3c5d9ae in clang::ASTDeclReader::Visit(clang::Decl*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp:533:31
    #4 0x3c91cac in clang::ASTReader::ReadDeclRecord(unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp:4045:10
    #5 0x3bd4fb1 in clang::ASTReader::GetDecl(unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Serialization/ASTReader.cpp:7352:5
    #6 0x3bce2f9 in clang::ASTReader::ReadASTBlock(clang::serialization::ModuleFile&, unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Serialization/ASTReader.cpp:3625:22
    #7 0x3bd6d75 in clang::ASTReader::ReadAST(llvm::StringRef, clang::serialization::ModuleKind, clang::SourceLocation, unsigned int, llvm::SmallVectorImpl<clang::ASTReader::ImportedSubmodule>*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Serialization/ASTReader.cpp:4230:32
    #8 0x3a6b415 in clang::CompilerInstance::createPCHExternalASTSource(llvm::StringRef, llvm::StringRef, bool, bool, clang::Preprocessor&, clang::InMemoryModuleCache&, clang::ASTContext&, clang::PCHContainerReader const&, llvm::ArrayRef<std::shared_ptr<clang::ModuleFileExtension> >, llvm::ArrayRef<std::shared_ptr<clang::DependencyCollector> >, void*, bool, bool, bool) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:539:19
    #9 0x3a6b00e in clang::CompilerInstance::createPCHExternalASTSource(llvm::StringRef, bool, bool, void*, bool) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:501:18
    #10 0x3abac80 in clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, clang::FrontendInputFile const&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Frontend/FrontendAction.cpp:865:12
    #11 0x3a6e61c in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:972:13
    #12 0x3ba74bf in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:282:25
    #13 0xa3f753 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/tools/driver/cc1_main.cpp:240:15
    #14 0xa3a68a in ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/tools/driver/driver.cpp:330:12
    #15 0xa37f31 in main /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/tools/driver/driver.cpp:407:12
    #16 0x7fca2a7032e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #17 0xa21029 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/clang-11+0xa21029)

This reverts commit 30d5946db95fa465d7ee6caceb2b1ff191e3727c.

4 years ago[MLIR] NFC use Operation::getParentWithTrait in alloca verifier
Uday Bondhugula [Thu, 16 Apr 2020 13:27:32 +0000 (18:57 +0530)]
[MLIR] NFC use Operation::getParentWithTrait in alloca verifier

Use recently added accessor Operation::getParentWithTrait in alloca
verifier.

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

4 years ago[NFC] Rename Sema.FPFeatures to CurFPFeatures and accessor to getCurFPFeatures
Melanie Blower [Thu, 16 Apr 2020 15:45:26 +0000 (08:45 -0700)]
[NFC] Rename Sema.FPFeatures to CurFPFeatures and accessor to getCurFPFeatures

4 years ago[libc] Move implementations of cosf, sinf, sincosf to src/math directory.
Siva Chandra Reddy [Mon, 23 Mar 2020 19:00:35 +0000 (12:00 -0700)]
[libc] Move implementations of cosf, sinf, sincosf to src/math directory.

NFC intended in the implementaton. Only mechanical changes to fit the LLVM
libc implementation standard have been done.

Math testing infrastructure has been added. This infrastructure compares the
results produced by the libc with the high precision results from MPFR.
Tests making use of this infrastructure have been added for cosf, sinf and
sincosf.

Reviewers: abrachet, phosek

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

4 years ago[MachineSink] Fix for breaking phi edges with instructions with multiple defs
David Green [Thu, 16 Apr 2020 14:23:49 +0000 (15:23 +0100)]
[MachineSink] Fix for breaking phi edges with instructions with multiple defs

BreakPHIEdge would be set based on whether the instruction needs to
insert a new critical edge to allow sinking into a block where the uses
are PHI nodes. But for instructions with multiple defs it would be reset
on the second def, allowing the instruciton to sink where it should not.

Fixes PR44981

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

4 years ago[MLIR] Fix MLIR build - add missing CMake dependency
Uday Bondhugula [Thu, 16 Apr 2020 15:10:38 +0000 (20:40 +0530)]
[MLIR] Fix MLIR build - add missing CMake dependency

This will fix a failure when using a linker sensitive to the order in
which libraries are passed.

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

4 years ago[flang] Use the Flang cmake-functions to add targets.
Mehdi Chinoune [Thu, 16 Apr 2020 12:34:17 +0000 (13:34 +0100)]
[flang] Use the Flang cmake-functions to add targets.

Summary: It also removes the cycle-dependency between FortranSemantics and FortranEvaluate.

Reviewers: #flang, jdoerfert, sscalpone

Reviewed By: #flang, sscalpone

Subscribers: DavidTruby, schweitz, tskeith, mgorny, aartbik, llvm-commits

Tags: #flang, #llvm

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

4 years ago[clang][AST] Support AST files larger than 512M
Dmitry Polukhin [Sat, 21 Mar 2020 20:52:51 +0000 (13:52 -0700)]
[clang][AST] Support AST files larger than 512M

Summary:
Clang uses 32-bit integers for storing bit offsets from the beginning of
the file that results in 512M limit on AST file. This diff replaces
absolute offsets with relative offsets from the beginning of
corresponding data structure when it is possible. And uses 64-bit
offsets for DeclOffests and TypeOffssts because these coder AST
section may easily exceeds 512M alone.

This diff breaks AST file format compatibility so VERSION_MAJOR bumped.

Test Plan:
Existing clang AST serialization tests
Tested on clangd with ~700M and ~900M preamble files

Reviewers: rsmith, dexonsmith

Subscribers: ilya-biryukov, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years agoMCValue.h - cleanup include and forward declaration. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 14:18:10 +0000 (15:18 +0100)]
MCValue.h - cleanup include and forward declaration. NFC.
Remove MCSymbol.h include
Remove unused MCAsmInfo forward declaration

4 years ago[ASTImporter] Fix bug introduced in 2ba4e3a4598b
Gabor Marton [Thu, 16 Apr 2020 13:48:13 +0000 (15:48 +0200)]
[ASTImporter] Fix bug introduced in 2ba4e3a4598b

2ba4e3a4598b (Move FPFeatures from BinaryOperator bitfields to Trailing
storage, D76384) introduced an assertion failure during CTU analysis.
The reason is that in ASTNodeImporter::VisitCompoundAssignOperator the
LHSType and the ResultType have been imported twice.

Details:
clang: ../../git/llvm-project/clang/lib/Basic/SourceManager.cpp:918: clang::FileID clang::SourceManager::getFileIDLoaded(unsigned int) const: Assertion `0 && "Invalid SLocOffset or bad function choice"' failed.
clang::SourceManager::getDecomposedExpansionLoc(clang::SourceLocation) const
clang::SourceManager::getPresumedLoc(clang::SourceLocation, bool) const
clang::ASTImporter::Import(clang::SourceLocation)
llvm::Error clang::ASTImporter::importInto<clang::SourceLocation>(clang::SourceLocation&, clang::SourceLocation const&)
clang::ASTNodeImporter::ImportDeclParts(clang::NamedDecl*, clang::DeclContext*&, clang::DeclContext*&, clang::DeclarationName&, clang::NamedDecl*&, clang::SourceLocation&)
clang::ASTNodeImporter::VisitRecordDecl(clang::RecordDecl*)
clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*)
clang::ASTImporter::Import(clang::Decl*)
clang::ASTNodeImporter::VisitRecordType(clang::RecordType const*)
clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*)
clang::ASTImporter::Import(clang::QualType)
clang::ASTNodeImporter::VisitElaboratedType(clang::ElaboratedType const*)
clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*)
clang::ASTImporter::Import(clang::QualType)
clang::ASTNodeImporter::VisitPointerType(clang::PointerType const*)
clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*)
clang::ASTImporter::Import(clang::QualType)
clang::QualType clang::ASTNodeImporter::importChecked<clang::QualType>(llvm::Error&, clang::QualType const&)
clang::ASTNodeImporter::VisitCompoundAssignOperator(clang::CompoundAssignOperator*)

4 years agoAntiDepBreaker.h - remove unused MachineOperand.h include. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 13:59:31 +0000 (14:59 +0100)]
AntiDepBreaker.h - remove unused MachineOperand.h include. NFC.

4 years agoMCObjectWriter.h - remove unnecessary includes. NFC
Simon Pilgrim [Thu, 16 Apr 2020 13:55:39 +0000 (14:55 +0100)]
MCObjectWriter.h - remove unnecessary includes. NFC

The EndianStream.h/raw_ostream.h headers should be removed as well but we have a lot of other files that are implicitly relying on them being present.

4 years agoWasmEHFuncInfo.h - reduce BasicBlock.h/MachineBasicBlock.h includes to just forward...
Simon Pilgrim [Thu, 16 Apr 2020 13:09:20 +0000 (14:09 +0100)]
WasmEHFuncInfo.h - reduce BasicBlock.h/MachineBasicBlock.h includes to just forward declarations. NFC.

4 years ago[libc++] Support arbitrary .sh.X extensions in the new format
Louis Dionne [Thu, 16 Apr 2020 13:52:44 +0000 (09:52 -0400)]
[libc++] Support arbitrary .sh.X extensions in the new format

This allows writing all kinds of ShTests, for example .sh.py tests for
testing Python code.

4 years ago[mlir][Linalg] Drop function attribute from generic ops.
Nicolas Vasilache [Thu, 16 Apr 2020 13:46:00 +0000 (09:46 -0400)]
[mlir][Linalg] Drop function attribute from generic ops.

The function attribute in generic ops is not paying for itself.
A region is the more standardized way of specifying a custom computation.
If needed this region can call a function directly.
This is deemed more natural than managing a dedicated function attribute.

This also simplifies named ops generation by trimming unnecessary complexity.

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

4 years agoDisallow [[nodiscard]] on a function pointer declaration.
Aaron Ballman [Thu, 16 Apr 2020 13:27:37 +0000 (09:27 -0400)]
Disallow [[nodiscard]] on a function pointer declaration.

This is not allowed by [dcl.attr.nodiscard]p1 for the standard attribute, but
is still supported for the [[clang::warn_unused_result]] spelling.

4 years ago[Float2Int] Stop passing around a reference to the class member Roots. NFC
Bjorn Pettersson [Wed, 15 Apr 2020 11:32:31 +0000 (13:32 +0200)]
[Float2Int] Stop passing around a reference to the class member Roots. NFC

The Float2IntPass got a class member called Roots, but Roots
was also passed around to member function as a reference. This
patch simply remove those references.

4 years ago[clang-format] Do not interpret C# deconstruction in a foreach as a cast
Jonathan Coe [Thu, 16 Apr 2020 13:20:51 +0000 (14:20 +0100)]
[clang-format] Do not interpret C# deconstruction in a foreach as a cast

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits, MyDeveloperDay

Tags: #clang-format, #clang

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

4 years ago[MLIR] Add IndexAttr to primitive attributes kinds in tablegen.
Ulysse Beaugnon [Thu, 16 Apr 2020 08:28:02 +0000 (10:28 +0200)]
[MLIR] Add IndexAttr to primitive attributes kinds in tablegen.

OpBase.td defined attributes kind for all integer types expect index. This
commit fixes that by adding an IndexAttr attribute kind. Update the
respective tests.

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

4 years ago[VE] Update logical operation instructions
Kazushi (Jam) Marukawa [Thu, 16 Apr 2020 12:34:53 +0000 (14:34 +0200)]
[VE] Update logical operation instructions

Summary:
Changing all mnemonic to match assembly instructions to simplify mnemonic
naming rules. This time update all fixed-point arithmetic instructions.
This also corrects bswp operand type.

Reviewed By: simoll

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

4 years agoRevert "[MLIR] Add IndexAttr to primitive attributes kinds in tablegen."
Benjamin Kramer [Thu, 16 Apr 2020 12:28:18 +0000 (14:28 +0200)]
Revert "[MLIR] Add IndexAttr to primitive attributes kinds in tablegen."

This reverts commit 997f33cfeec9cd8c5bc913cf862794e986a4bd39. Breaks check-mlir

******************** TEST 'MLIR :: IR/attribute.mlir' FAILED ********************
Script:
--
: 'RUN: at line 1';   mlir-opt llvm-project/mlir/test/IR/attribute.mlir -split-input-file -verify-diagnostics | /FileCheck llvm-project/mlir/test/IR/attribute.mlir
--
Exit Code: 1

Command Output (stderr):
--
llvm-project/mlir/test/IR/attribute.mlir split at line #1:19:3: error: unexpected error: 'test.int_attrs' op requires attribute 'index_attr'
  "test.int_attrs"() {
  ^
llvm-project/mlir/test/IR/attribute.mlir split at line #120:6:3: error: unexpected error: 'test.int_attrs' op requires attribute 'index_attr'
  "test.int_attrs"() {
  ^
llvm-project/mlir/test/IR/attribute.mlir split at line #120:5:6: error: expected error "'si32_attr' failed to satisfy constraint: 32-bit signed integer attribute" was not produced
  // expected-error @+1 {{'si32_attr' failed to satisfy constraint: 32-bit signed integer attribute}}
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
llvm-project/mlir/test/IR/attribute.mlir split at line #133:5:3: error: unexpected error: 'test.int_attrs' op requires attribute 'index_attr'
  "test.int_attrs"() {
  ^
llvm-project/mlir/test/IR/attribute.mlir split at line #133:4:6: error: expected error "'ui32_attr' failed to satisfy constraint: 32-bit unsigned integer attribute" was not produced
  // expected-error @+1 {{'ui32_attr' failed to satisfy constraint: 32-bit unsigned integer attribute}}
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
llvm-project/mlir/test/IR/attribute.mlir:9:12: error: CHECK: expected string not found in input
 // CHECK: any_i32_attr = 5 : ui32
           ^
<stdin>:3:1: note: scanning from here
module {
^
<stdin>:21:28: note: possible intended match here
 "test.non_negative_int_attr"() {i32attr = 5 : i32, i64attr = 10 : i64} : () -> ()

4 years ago[MLIR] Allow for multiple gpu modules during translation.
Stephan Herhut [Thu, 16 Apr 2020 11:14:43 +0000 (13:14 +0200)]
[MLIR] Allow for multiple gpu modules during translation.

This change makes the ModuleTranslation threadsafe by locking on the
LLVMContext. Furthermore, we now clone the llvm module into a new
context when compiling to PTX similar to what the OrcJit does.

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

4 years agoyaml2obj.h - cleanup includes and forward declaration. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 11:58:44 +0000 (12:58 +0100)]
yaml2obj.h - cleanup includes and forward declaration. NFC.
Reduce StringRef.h/Error.h includes to just the necessary STLExtras.h include and StringRef/Twine forward declarations
Remove unused Expected<> forward declaration

4 years agoParser.h/cpp - cleanup includes and forward declaration. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 11:37:46 +0000 (12:37 +0100)]
Parser.h/cpp - cleanup includes and forward declaration. NFC.
Parser.h - Reduce MemoryBuffer.h include to just the necessary StringRef.h include and MemoryBufferRef forward declaration
Parser.cpp - Remove unused raw_ostream.h include

4 years agoPass.h/cpp - cleanup includes and forward declaration. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 11:08:10 +0000 (12:08 +0100)]
Pass.h/cpp - cleanup includes and forward declaration. NFC.

Remove unused BasicBlock forward declaration from Pass.h and Attributes/BasicBlock includes from Pass.cpp
Add BasicBlock forward declaration to UnifyFunctionExitNodes.h which was relying on Pass.h

4 years agoRevert "Revert "[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef""
Matthias Gehre [Thu, 16 Apr 2020 12:10:06 +0000 (14:10 +0200)]
Revert "Revert "[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef""

This reverts commit bac85ab3b55d02f0a1e824712f185af42cd1ea04.

4 years agoExpose AtomicType in the libclang C API.
Henry Jen [Thu, 16 Apr 2020 11:58:02 +0000 (07:58 -0400)]
Expose AtomicType in the libclang C API.

4 years agoRevert "[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef"
Benjamin Kramer [Thu, 16 Apr 2020 12:05:29 +0000 (14:05 +0200)]
Revert "[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef"

This reverts commit 83d5131d87a6f929b21b54e3fc0f9636ff64c808. Spams
llvm/ADT/StringRef.h:57:11: warning: unknown attribute 'Pointer' ignored [-Wunknown-attributes]

4 years agoIntroduce llvm::sys::Process::getProcessId() and adopt it
Sergej Jaskiewicz [Mon, 13 Apr 2020 11:26:35 +0000 (14:26 +0300)]
Introduce llvm::sys::Process::getProcessId() and adopt it

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

4 years ago[FileCheck] - Fix the false positive when -implicit-check-not is used with an unknown...
Georgii Rymar [Mon, 13 Apr 2020 15:10:53 +0000 (18:10 +0300)]
[FileCheck] - Fix the false positive when -implicit-check-not is used with an unknown -check-prefix.

Imagine we have the following invocation:

`FileCheck -check-prefix=UNKNOWN-PREFIX -implicit-check-not=something`

When the check prefix does not exist it does not fail.
This patch fixes the issue.

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

4 years ago[clangd] Pull installed gRPC and introduce clangd-remote-(server|client)
Kirill Bobyrev [Thu, 16 Apr 2020 09:10:03 +0000 (11:10 +0200)]
[clangd] Pull installed gRPC and introduce clangd-remote-(server|client)

Summary:
This patch allows using installed gRPC to build two simple tools which
currently provide the functionality of looking up the symbol by name.
remote-index-client is a simplified version of dexp which connects to
remote-index-server passes lookup requests.

I also significantly reduced the scope of this patch to prevent large changelist
and more bugs. The next steps would be:

* Extending Protocol for deep copies of Symbol and inherit RemoteIndex from
  Index to unify the interfaces
* Make remote-index-server more generic and merge the remote index client with
  dexp
* Modify Clangd to allow using remote index instead of the local one for all
  global index requests

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

4 years ago[MIR] Add comments to INLINEASM immediate flag MachineOperands
Konstantin Schwarz [Tue, 14 Apr 2020 07:24:40 +0000 (09:24 +0200)]
[MIR] Add comments to INLINEASM immediate flag MachineOperands

Summary:
The INLINEASM MIR instructions use immediate operands to encode the values of some operands.
The MachineInstr pretty printer function already handles those operands and prints human readable annotations instead of the immediates. This patch adds similar annotations to the output of the MIRPrinter, however uses the new MIROperandComment feature.

Reviewers: SjoerdMeijer, arsenm, efriedma

Reviewed By: arsenm

Subscribers: qcolombet, sdardis, jvesely, wdng, nhaehnle, hiraditya, jrtc27, atanasyan, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[LiveIntervals] Replace handleMoveIntoBundle
Carl Ritson [Thu, 16 Apr 2020 10:57:55 +0000 (19:57 +0900)]
[LiveIntervals] Replace handleMoveIntoBundle

Summary:
The current handleMoveIntoBundle implementation is unusable,
it attempts to access the slot indexes of bundled instructions.
It also leaves bundled instructions with slot indexes assigned.

Replace handleMoveIntoBundle this with a more explicit
handleMoveIntoNewBundle function which recalculates the live
intervals for all instructions moved into a newly formed bundle,
and removes slot indexes from these instructions.

Reviewers: arsenm, MaskRay, kariddi, tpr, qcolombet

Reviewed By: qcolombet

Subscribers: MatzeB, wdng, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

4 years ago[AST] Fix an undefine behavior when creating an empty recovery expr.
Haojian Wu [Thu, 16 Apr 2020 08:38:54 +0000 (10:38 +0200)]
[AST] Fix an undefine behavior when creating an empty recovery expr.

Summary:
We forgot to initialize the NumExpr member in one of the constructors,
which leads crashes in preamble serialization.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years agoFix -Wdocumentation-html warning
David Zarzycki [Thu, 16 Apr 2020 10:32:17 +0000 (06:32 -0400)]
Fix -Wdocumentation-html warning

4 years ago[CGExprAgg] Fix infinite loop in `findPeephole`
Ehud Katz [Thu, 16 Apr 2020 10:26:23 +0000 (13:26 +0300)]
[CGExprAgg] Fix infinite loop in `findPeephole`

Simplify the function using IgnoreParenNoopCasts.

Fix PR45476

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

4 years ago[MSan] Enable for SystemZ
Ilya Leoshkevich [Wed, 15 Apr 2020 23:01:11 +0000 (01:01 +0200)]
[MSan] Enable for SystemZ

Summary:
This patch adds runtime support, adjusts tests and enables MSan.

Like for ASan and UBSan, compile the tests with -mbackchain.

Reviewers: eugenis, uweigand, jonpa, vitalybuka

Reviewed By: eugenis, vitalybuka

Subscribers: vitalybuka, mgorny, hiraditya, #sanitizers, stefansf, Andreas-Krebbel

Tags: #sanitizers

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

4 years ago[clang] Const correct ComputePreambleBounds
Kadir Cetinkaya [Thu, 16 Apr 2020 09:54:48 +0000 (11:54 +0200)]
[clang] Const correct ComputePreambleBounds

4 years ago[lldb/unittests] Better error messages when creating sockets fails
Pavel Labath [Thu, 16 Apr 2020 09:57:40 +0000 (11:57 +0200)]
[lldb/unittests] Better error messages when creating sockets fails

We get failures in SocketTestUtilities on the pre-merge bots. This
might give us a clue as to what's wrong.

4 years agoLangOptions cannot depend on ASTContext, make it not use ASTContext directly
Benjamin Kramer [Thu, 16 Apr 2020 09:45:02 +0000 (11:45 +0200)]
LangOptions cannot depend on ASTContext, make it not use ASTContext directly

Fixes a layering violation introduced in 2ba4e3a4598b165245c581c506a813cd4a7dce33.

4 years ago[LiveDebugValues] Terminate open ranges on DBG_VALUE $noreg
Jeremy Morse [Thu, 16 Apr 2020 09:24:47 +0000 (10:24 +0100)]
[LiveDebugValues] Terminate open ranges on DBG_VALUE $noreg

In D68209, LiveDebugValues::transferDebugValue had a call to
OpenRanges.erase shifted, and by accident this led to a code path where
DBG_VALUEs of $noreg would not have their open range terminated, allowing
variable locations to extend past blocks where they were terminated.

This patch correctly terminates the open range, if present, when such a
DBG_VAUE is encountered, and adds a test for this behaviour.

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

4 years agoAlso look for devtoolset-9 gcc toolchain
Stephan Dollberg [Thu, 16 Apr 2020 09:17:10 +0000 (11:17 +0200)]
Also look for devtoolset-9 gcc toolchain

devtoolset-9 has been out for a while so also look for it.

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

4 years ago[MLIR] Fix fusion of linalg.indexed_generic producer into tiled (Indexed)GenericOp.
Alexander Belyaev [Thu, 16 Apr 2020 08:39:42 +0000 (10:39 +0200)]
[MLIR] Fix fusion of linalg.indexed_generic producer into tiled (Indexed)GenericOp.

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

4 years ago[MLIR] NFC after commit D77478.
Lorenzo Chelini [Thu, 16 Apr 2020 08:30:11 +0000 (10:30 +0200)]
[MLIR] NFC after commit D77478.

Remove leftovers 'applyPatternsGreedily' from the codebase.

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

4 years ago[MLIR] Add IndexAttr to primitive attributes kinds in tablegen.
Ulysse Beaugnon [Thu, 16 Apr 2020 08:28:02 +0000 (10:28 +0200)]
[MLIR] Add IndexAttr to primitive attributes kinds in tablegen.

Summary:
OpBase.td defined attributes kind for all integer types expect index. This
commit fixes that by adding an IndexAttr attribute kind.

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

4 years ago[MLIR] [EDSC] Add folded_xxxx handles for common std instructions.
Pierre Oechsel [Thu, 16 Apr 2020 08:24:48 +0000 (10:24 +0200)]
[MLIR] [EDSC] Add folded_xxxx handles for common std instructions.

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

4 years ago[Attributor][NFC] Reduce indention for call site attribute seeding
Johannes Doerfert [Wed, 15 Apr 2020 16:59:50 +0000 (11:59 -0500)]
[Attributor][NFC] Reduce indention for call site attribute seeding

Also added a TODO to remind us that indirect calls could be optimized as
well.

4 years ago[Attributor][NFC] Do not create temporary maps during lookup
Johannes Doerfert [Wed, 15 Apr 2020 07:14:56 +0000 (02:14 -0500)]
[Attributor][NFC] Do not create temporary maps during lookup

The AAMap.lookup() call created a temporary value if the key was not
present. Since the value was another map it was not free to create it.
Instead of a lookup we now use find and compare the result against the
end iterator explicitly. The result is the same but we never need to
create a temporary map.

4 years agoRevert "Revert "[GlobalISel] Fix invalid combine of unmerge(merge) with intermediate...
Dominik Montada [Thu, 16 Apr 2020 07:02:46 +0000 (09:02 +0200)]
Revert "Revert "[GlobalISel] Fix invalid combine of unmerge(merge) with intermediate cast""

This reverts commit 1265899c5f7d34034a8c1f67e69a5ab6087310e7.

4 years ago[CallSite removal][TargetLowering] Remove ArgListEntry::setAttributes signature that...
Craig Topper [Thu, 16 Apr 2020 06:28:03 +0000 (23:28 -0700)]
[CallSite removal][TargetLowering] Remove ArgListEntry::setAttributes signature that took an ImmutableCallSite. NFC

There's another signature that takes a CallBase. The uses of the
ImmutableCallSite version were removed in previous patches.

4 years ago[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef
Matthias Gehre [Mon, 19 Aug 2019 21:28:04 +0000 (23:28 +0200)]
[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef

Summary:
This detected the bugs fixed in
  https://reviews.llvm.org/D66442
and
  https://reviews.llvm.org/D66440

The warning itself was implemented in
  https://reviews.llvm.org/D63954
  https://reviews.llvm.org/D64256
  https://reviews.llvm.org/D65120
  https://reviews.llvm.org/D65127
  https://reviews.llvm.org/D66152

Reviewers: zturner, mehdi_amini, gribozavr

Subscribers: dexonsmith, Szelethus, xazax.hun, llvm-commits

Tags: #llvm

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

4 years ago[Attributor][FIX] Handle droppable uses when replacing values
Johannes Doerfert [Sat, 11 Apr 2020 04:41:59 +0000 (23:41 -0500)]
[Attributor][FIX] Handle droppable uses when replacing values

Since we use the fact that some uses are droppable in the Attributor we
need to handle them explicitly when we replace uses. As an example, an
assumed dead value can have live droppable users. In those we cannot
replace the value simply by an undef. Instead, we either drop the uses
(via `dropDroppableUses`) or keep them as they are. In this patch we do
both, depending on the situation. For values that are dead but not
necessarily removed we keep droppable uses around because they contain
information we might be able to use later. For values that are removed
we drop droppable uses explicitly to avoid replacement with undef.

4 years ago[InstCombine] Simplify calls with casted `returned` attribute
Johannes Doerfert [Sun, 12 Apr 2020 17:41:56 +0000 (12:41 -0500)]
[InstCombine] Simplify calls with casted `returned` attribute

The handling of the `returned` attribute in D75815 did miss the case
where the argument is (bit)casted to a different type. This is
explicitly allowed by the language reference and exposed by the
Attributor.

Reviewed By: lebedev.ri

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

4 years ago[MustExecute][NFC] Copy function_ref instead of passing a reference
Johannes Doerfert [Sat, 11 Apr 2020 17:36:24 +0000 (12:36 -0500)]
[MustExecute][NFC] Copy function_ref instead of passing a reference

4 years ago[Attributor][FIX] Properly check for accesses to globals
Johannes Doerfert [Tue, 14 Apr 2020 23:49:59 +0000 (18:49 -0500)]
[Attributor][FIX] Properly check for accesses to globals

The check if globals were accessed was not always working because two
bits are set for NO_GLOBAL_MEM. The new check works also if only on kind
of globals (internal/external) is accessed.

4 years ago[Attributor][NFC] Run the verifier only on functions and under EXPENSIVE_CHECKS
Johannes Doerfert [Mon, 13 Apr 2020 17:24:09 +0000 (12:24 -0500)]
[Attributor][NFC] Run the verifier only on functions and under EXPENSIVE_CHECKS

Running the verifier is expensive so we want to avoid it even in runs
that enable assertions. As we move closer to enabling the Attributor
this code will be executed by some buildbots but not cause overhead for
most people.

4 years ago[CallSite removal][TargetLibraryInfo] Replace ImmutableCallSite with CallBase in...
Craig Topper [Thu, 16 Apr 2020 05:02:35 +0000 (22:02 -0700)]
[CallSite removal][TargetLibraryInfo] Replace ImmutableCallSite with CallBase in one of the getLibFunc signatures. NFC

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

4 years ago[llvm][NFC][CallSite] Removed CallSite from some implementation details.
Mircea Trofin [Wed, 15 Apr 2020 23:50:57 +0000 (16:50 -0700)]
[llvm][NFC][CallSite] Removed CallSite from some implementation details.

Reviewers: craig.topper, dblaikie

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

4 years ago[X86] Add interface X86II::isPseudo
Shengchen Kan [Thu, 16 Apr 2020 04:37:24 +0000 (12:37 +0800)]
[X86] Add interface X86II::isPseudo

Avoid duplicate code in X86MCCodeEmitter, NFCI.

4 years ago[MC][COFF][ELF] Reject instructions in IMAGE_SCN_CNT_UNINITIALIZED_DATA/SHT_NOBITS...
Fangrui Song [Tue, 14 Apr 2020 18:05:21 +0000 (11:05 -0700)]
[MC][COFF][ELF] Reject instructions in IMAGE_SCN_CNT_UNINITIALIZED_DATA/SHT_NOBITS sections

For `.bss; nop`, MC inappropriately calls abort() (via report_fatal_error()) with a message
`cannot have fixups in virtual section!`
It is a bug to crash for invalid user input. Fix it by erroring out early in EmitInstToData().

Similarly, emitIntValue() in a virtual section (SHT_NOBITS in ELF) can crash with the mssage
`non-zero initializer found in section '.bss'` (see D4199)
It'd be nice to report the location but so many directives can call emitIntValue()
and it is difficult to track every location.
Note, COFF does not crash because MCAssembler::writeSectionData() is not
called for an IMAGE_SCN_CNT_UNINITIALIZED_DATA section.

Note, GNU as' arm64 backend reports ``Error: attempt to store non-zero value in section `.bss'``
for a non-zero .inst but fails to do so for other instructions.
We simply reject all instructions, even if the encoding is all zeros.

The Mach-O counterpart is D48517 (see `test/MC/MachO/zerofill-text.s`)

Reviewed By: rnk, skan

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

4 years agoFix build by adding missing CMake link dependency
Mehdi Amini [Thu, 16 Apr 2020 03:47:02 +0000 (03:47 +0000)]
Fix build by adding missing CMake link dependency

This would only fail when using a linker that is sensitive to the order
in which the libraries are passed on the command line (like bfd).

4 years ago[X86][MC][NFC] Code cleanup in X86MCCodeEmitter
Shengchen Kan [Thu, 16 Apr 2020 03:24:35 +0000 (11:24 +0800)]
[X86][MC][NFC] Code cleanup in X86MCCodeEmitter

Make some function static, move the definitions of functions to a better
place and use C++ style cast, etc.

4 years ago[Attributor] Lazily collect function information
Johannes Doerfert [Sat, 11 Apr 2020 17:37:09 +0000 (12:37 -0500)]
[Attributor] Lazily collect function information

Before, we eagerly analyzed all the functions to collect information
about them, e.g. what instructions may read/write memory. This had
multiple drawbacks:
  - In CGSCC-mode we can end up looking at a callee which is not in the
    SCC but for which we need an initialized cache.
  - We end up looking at functions that we deem dead and never need to
    analyze in the first place.
  - We have a implicit dependence which is easy to break.

This patch moves the function analysis into the information cache and
makes it lazy. There is no real functional change expected except due to
the first reason above.

4 years ago[Attributor] Replace call graph call sites after function replacement
Johannes Doerfert [Thu, 16 Apr 2020 03:21:17 +0000 (22:21 -0500)]
[Attributor] Replace call graph call sites after function replacement

The CallGraphUpdater allows to directly alter call site information and
we should do so. This might appease the windows buildbot that crashes
during the SCC traversal.