platform/upstream/llvm.git
3 years ago[DFSan] Add custom wrapper for recvmsg.
Matt Morehouse [Wed, 9 Dec 2020 21:07:38 +0000 (13:07 -0800)]
[DFSan] Add custom wrapper for recvmsg.

The wrapper clears shadow for anything written by recvmsg.

Reviewed By: stephan.yichao.zhao

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

3 years ago[WebAssembly] Add support for named data sections in wasm binaries
Sam Clegg [Wed, 9 Dec 2020 05:47:19 +0000 (21:47 -0800)]
[WebAssembly] Add support for named data sections in wasm binaries

Followup to https://reviews.llvm.org/D91769 which added support
for names globals.

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

3 years ago[NFC] Removed unused prefixes in llvm/test/CodeGen/AArch64
Mircea Trofin [Wed, 9 Dec 2020 17:23:38 +0000 (09:23 -0800)]
[NFC] Removed unused prefixes in llvm/test/CodeGen/AArch64

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

3 years ago[clangd] NFC: Add client-side logging for remote index requests
Kirill Bobyrev [Wed, 9 Dec 2020 20:40:10 +0000 (21:40 +0100)]
[clangd] NFC: Add client-side logging for remote index requests

Figuring out whether the server is responding and debugging issues with remote
index setup is no easy task: add verbose logging for client side RPC requests
to relieve some pain.

Reviewed By: sammccall

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

3 years ago[mlir][Affine] Fix vectorizability check for multiple load/stores
Sergei Grechanik [Wed, 9 Dec 2020 19:03:56 +0000 (11:03 -0800)]
[mlir][Affine] Fix vectorizability check for multiple load/stores

This patch fixes a bug that allowed vectorizing of loops with loads and
stores having indexing functions varying along different memory
dimensions.

Reviewed By: aartbik, dcaballe

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

3 years ago[OpenMP] Fix norespect affinity bug for Windows
Peyton, Jonathan L [Thu, 3 Dec 2020 18:07:33 +0000 (12:07 -0600)]
[OpenMP] Fix norespect affinity bug for Windows

KMP_AFFINITY=norespect was triggering an error because the underlying
process affinity mask was not updated to include the entire machine.
The Windows documentation states that the thread affinities must be
subsets of the process affinity. This patch also moves the printing
(for KMP_AFFINITY=verbose) of whether the initial mask was respected
out of each topology detection function and to one location where the
initial affinity mask is read.

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

3 years ago[OpenMP] Fix too long name for shm segment on macOS
Peyton, Jonathan L [Fri, 4 Dec 2020 16:30:10 +0000 (10:30 -0600)]
[OpenMP] Fix too long name for shm segment on macOS

Remove the user id component to the shm segment name and just use
the pid like before.

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

3 years ago[ASTImporter] Support CXXDeductionGuideDecl with local typedef
Gabor Marton [Fri, 27 Nov 2020 07:32:51 +0000 (08:32 +0100)]
[ASTImporter] Support CXXDeductionGuideDecl with local typedef

CXXDeductionGuideDecl with a local typedef has its own copy of the
TypedefDecl with the CXXDeductionGuideDecl as the DeclContext of that
TypedefDecl.
```
      template <typename T> struct A {
        typedef T U;
        A(U, T);
      };
      A a{(int)0, (int)0};
```
Related discussion on cfe-dev:
http://lists.llvm.org/pipermail/cfe-dev/2020-November/067252.html

Without this fix, when we import the CXXDeductionGuideDecl (via
VisitFunctionDecl) then before creating the Decl we must import the
FunctionType. However, the first parameter's type is the afore mentioned
local typedef. So, we then start importing the TypedefDecl whose
DeclContext is the CXXDeductionGuideDecl itself. The infinite loop is
formed.
```
 #0 clang::ASTNodeImporter::VisitCXXDeductionGuideDecl(clang::CXXDeductionGuideDecl*) clang/lib/AST/ASTImporter.cpp:3543:0
 #1 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/DeclNodes.inc:405:0
 #2 clang::ASTImporter::ImportImpl(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8038:0
 #3 clang::ASTImporter::Import(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8200:0
 #4 clang::ASTImporter::ImportContext(clang::DeclContext*) clang/lib/AST/ASTImporter.cpp:8297:0
 #5 clang::ASTNodeImporter::ImportDeclContext(clang::Decl*, clang::DeclContext*&, clang::DeclContext*&) clang/lib/AST/ASTImporter.cpp:1852:0
 #6 clang::ASTNodeImporter::ImportDeclParts(clang::NamedDecl*, clang::DeclContext*&, clang::DeclContext*&, clang::DeclarationName&, clang::NamedDecl*&, clang::SourceLocation&) clang/lib/AST/ASTImporter.cpp:1628:0
 #7 clang::ASTNodeImporter::VisitTypedefNameDecl(clang::TypedefNameDecl*, bool) clang/lib/AST/ASTImporter.cpp:2419:0
 #8 clang::ASTNodeImporter::VisitTypedefDecl(clang::TypedefDecl*) clang/lib/AST/ASTImporter.cpp:2500:0
 #9 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/DeclNodes.inc:315:0
 #10 clang::ASTImporter::ImportImpl(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8038:0
 #11 clang::ASTImporter::Import(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8200:0
 #12 llvm::Expected<clang::TypedefNameDecl*> clang::ASTNodeImporter::import<clang::TypedefNameDecl>(clang::TypedefNameDecl*) clang/lib/AST/ASTImporter.cpp:165:0
 #13 clang::ASTNodeImporter::VisitTypedefType(clang::TypedefType const*) clang/lib/AST/ASTImporter.cpp:1304:0
 #14 clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/TypeNodes.inc:74:0
 #15 clang::ASTImporter::Import(clang::QualType) clang/lib/AST/ASTImporter.cpp:8071:0
 #16 llvm::Expected<clang::QualType> clang::ASTNodeImporter::import<clang::QualType>(clang::QualType const&) clang/lib/AST/ASTImporter.cpp:179:0
 #17 clang::ASTNodeImporter::VisitFunctionProtoType(clang::FunctionProtoType const*) clang/lib/AST/ASTImporter.cpp:1244:0
 #18 clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/TypeNodes.inc:47:0
 #19 clang::ASTImporter::Import(clang::QualType) clang/lib/AST/ASTImporter.cpp:8071:0
 #20 llvm::Expected<clang::QualType> clang::ASTNodeImporter::import<clang::QualType>(clang::QualType const&) clang/lib/AST/ASTImporter.cpp:179:0
 #21 clang::QualType clang::ASTNodeImporter::importChecked<clang::QualType>(llvm::Error&, clang::QualType const&) clang/lib/AST/ASTImporter.cpp:198:0
 #22 clang::ASTNodeImporter::VisitFunctionDecl(clang::FunctionDecl*) clang/lib/AST/ASTImporter.cpp:3313:0
 #23 clang::ASTNodeImporter::VisitCXXDeductionGuideDecl(clang::CXXDeductionGuideDecl*) clang/lib/AST/ASTImporter.cpp:3543:0
```

The fix is to first create the TypedefDecl and only then start to import
the DeclContext.
Basically, we could do this during the import of all other Decls (not
just for typedefs). But it seems, there is only one another AST
construct that has a similar cycle: a struct defined as a function
parameter:
```
int struct_in_proto(struct data_t{int a;int b;} *d);

```
In that case, however, we had decided to return simply with an error
back then because that seemed to be a very rare construct.

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

3 years agoAdd another test for PR48434.
Richard Smith [Wed, 9 Dec 2020 20:13:29 +0000 (12:13 -0800)]
Add another test for PR48434.

3 years agoAdd new 'preferred_name' attribute.
Richard Smith [Thu, 12 Nov 2020 01:12:18 +0000 (17:12 -0800)]
Add new 'preferred_name' attribute.

This attribute permits a typedef to be associated with a class template
specialization as a preferred way of naming that class template
specialization. This permits us to specify that (for example) the
preferred way to express 'std::basic_string<char>' is as 'std::string'.

The attribute is applied to the various class templates in libc++ that have
corresponding well-known typedef names.

This is a re-commit. The previous commit was reverted because it exposed
a pre-existing bug that has since been fixed / worked around; see
PR48434.

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

3 years agoPR48434: Work around crashes due to deserialization cycles via typedefs.
Richard Smith [Wed, 9 Dec 2020 20:04:03 +0000 (12:04 -0800)]
PR48434: Work around crashes due to deserialization cycles via typedefs.

Ensure that we can deserialize a TypedefType even while in the middle of
deserializing its TypedefDecl, by removing the need to look at the
TypedefDecl while constructing the TypedefType.

This fixes all the currently-known failures for PR48434, but it's not a
complete fix, because we can still trigger deserialization cycles, which
are not supposed to happen.

3 years ago[ELF] Reorganize "is only supported on" tests and fix some diagnostics
Fangrui Song [Wed, 9 Dec 2020 20:14:00 +0000 (12:14 -0800)]
[ELF] Reorganize "is only supported on" tests and fix some diagnostics

3 years agoFrontend: Migrate to FileEntryRef in VerifyDiagnosticConsumer.cpp, NFC
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 22:41:52 +0000 (14:41 -0800)]
Frontend: Migrate to FileEntryRef in VerifyDiagnosticConsumer.cpp, NFC

Add a `FileEntryRef` overload of `SourceManager::translateFile`, and
migrate `ParseDirective` in VerifyDiagnosticConsumer.cpp to use it and
the corresponding overload of `createFileID`.

No functionality change here.

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

3 years agoscudo: Fix quarantine allocation when MTE enabled.
Peter Collingbourne [Sat, 5 Dec 2020 08:22:33 +0000 (00:22 -0800)]
scudo: Fix quarantine allocation when MTE enabled.

Quarantines have always been broken when MTE is enabled because the
quarantine batch allocator fails to reset tags that may have been
left behind by a user allocation.

This was only noticed when running the Scudo unit tests with Scudo
as the system allocator because quarantines are turned off by
default on Android and the test binary turns them on by defining
__scudo_default_options, which affects the system allocator as well.

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

3 years agoscudo: Split setRandomTag in two. NFCI.
Peter Collingbourne [Fri, 4 Dec 2020 23:03:49 +0000 (15:03 -0800)]
scudo: Split setRandomTag in two. NFCI.

Separate the IRG part from the STZG part since we will need to use
the latter on its own for some upcoming changes.

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

3 years ago[AArch64] Add aarch64_neon_vcmla{_rot{90,180,270}} intrinsics.
Florian Hahn [Wed, 9 Dec 2020 19:39:44 +0000 (19:39 +0000)]
[AArch64] Add aarch64_neon_vcmla{_rot{90,180,270}} intrinsics.

Add builtins required to implement vcmla and rotated variants from
the ACLE

Reviewed By: t.p.northover

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

3 years ago[libomptarget][amdgpu] clang-format src/rtl.cpp
Jon Chesterfield [Wed, 9 Dec 2020 19:45:20 +0000 (19:45 +0000)]
[libomptarget][amdgpu] clang-format src/rtl.cpp

3 years ago[RISCV][NFC] Regenerate RISCV CodeGen tests
Michael Munday [Wed, 9 Dec 2020 19:41:19 +0000 (19:41 +0000)]
[RISCV][NFC] Regenerate RISCV CodeGen tests

Regenerated using:

./llvm/utils/update_llc_test_checks.py -u llvm/test/CodeGen/RISCV/*.ll

This has added comments to spill-related instructions and added @plt to
some symbols.

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

3 years ago[dfsan] Track field/index-level shadow values in variables
Jianzhou Zhao [Mon, 23 Nov 2020 08:33:59 +0000 (08:33 +0000)]
[dfsan] Track field/index-level shadow values in variables

*************
* The problem
*************
See motivation examples in compiler-rt/test/dfsan/pair.cpp. The current
DFSan always uses a 16bit shadow value for a variable with any type by
combining all shadow values of all bytes of the variable. So it cannot
distinguish two fields of a struct: each field's shadow value equals the
combined shadow value of all fields. This introduces an overtaint issue.

Consider a parsing function

   std::pair<char*, int> get_token(char* p);

where p points to a buffer to parse, the returned pair includes the next
token and the pointer to the position in the buffer after the token.

If the token is tainted, then both the returned pointer and int ar
tainted. If the parser keeps on using get_token for the rest parsing,
all the following outputs are tainted because of the tainted pointer.

The CL is the first change to address the issue.

**************************
* The proposed improvement
**************************
Eventually all fields and indices have their own shadow values in
variables and memory.

For example, variables with type {i1, i3}, [2 x i1], {[2 x i4], i8},
[2 x {i1, i1}] have shadow values with type {i16, i16}, [2 x i16],
{[2 x i16], i16}, [2 x {i16, i16}] correspondingly; variables with
primary type still have shadow values i16.

***************************
* An potential implementation plan
***************************

The idea is to adopt the change incrementially.

1) This CL
Support field-level accuracy at variables/args/ret in TLS mode,
load/store/alloca still use combined shadow values.

After the alloca promotion and SSA construction phases (>=-O1), we
assume alloca and memory operations are reduced. So if struct
variables do not relate to memory, their tracking is accurate at
field level.

2) Support field-level accuracy at alloca
3) Support field-level accuracy at load/store

These two should make O0 and real memory access work.

4) Support vector if necessary.
5) Support Args mode if necessary.
6) Support passing more accurate shadow values via custom functions if
necessary.

***************
* About this CL.
***************
The CL did the following

1) extended TLS arg/ret to work with aggregate types. This is similar
to what MSan does.

2) implemented how to map between an original type/value/zero-const to
its shadow type/value/zero-const.

3) extended (insert|extract)value to use field/index-level progagation.

4) for other instructions, propagation rules are combining inputs by or.
The CL converts between aggragate and primary shadow values at the
cases.

5) Custom function interfaces also need such a conversion because
all existing custom functions use i16. It is unclear whether custome
functions need more accurate shadow propagation yet.

6) Added test cases for aggregate type related cases.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D92261

3 years ago[libomptarget][amdgpu] Let default number of teams equal number of CUs
Jon Chesterfield [Wed, 9 Dec 2020 19:35:34 +0000 (19:35 +0000)]
[libomptarget][amdgpu] Let default number of teams equal number of CUs

3 years ago[libomptarget][amdgpu] Robust handling of device_environment symbol
Jon Chesterfield [Wed, 9 Dec 2020 19:12:10 +0000 (19:12 +0000)]
[libomptarget][amdgpu] Robust handling of device_environment symbol

3 years agoDon't setup inalloca for swiftcc on i686-windows-msvc
Reid Kleckner [Tue, 8 Dec 2020 19:54:11 +0000 (11:54 -0800)]
Don't setup inalloca for swiftcc on i686-windows-msvc

Swiftcall does it's own target-independent argument type classification,
since it is not designed to be ABI compatible with anything local on the
target that isn't LLVM-based. This means it never uses inalloca.
However, we have duplicate logic for checking for inalloca parameters
that runs before call argument setup. This logic needs to know ahead of
time if inalloca will be used later, and we can't move the
CGFunctionInfo calculation earlier.

This change gets the calling convention from either the
FunctionProtoType or ObjCMethodDecl, checks if it is swift, and if so
skips the stackbase setup.

Depends on D92883.

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

3 years agoDe-templatify EmitCallArgs argument type checking, NFCI
Reid Kleckner [Tue, 8 Dec 2020 21:54:34 +0000 (13:54 -0800)]
De-templatify EmitCallArgs argument type checking, NFCI

This template exists to abstract over FunctionPrototype and
ObjCMethodDecl, which have similar APIs for storing parameter types. In
place of a template, use a PointerUnion with two cases to handle this.
Hopefully this improves readability, since the type of the prototype is
easier to discover. This allows me to sink this code, which is mostly
assertions, out of the header file and into the cpp file. I can also
simplify the overloaded methods for computing isGenericMethod, and get
rid of the second EmitCallArgs overload.

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

3 years ago[lldb][NFC] Refactor _get_bool_config_skip_if_decorator
Raphael Isemann [Wed, 9 Dec 2020 19:02:00 +0000 (20:02 +0100)]
[lldb][NFC] Refactor _get_bool_config_skip_if_decorator

NFC preparation for another patch. Also add some documentation for why the
error value is true (and not false).

3 years ago[libomptarget][amdgpu] Improve diagnostics on arch mismatch
Jon Chesterfield [Wed, 9 Dec 2020 18:55:21 +0000 (18:55 +0000)]
[libomptarget][amdgpu] Improve diagnostics on arch mismatch

3 years agoLimit the recursion depth of SelectionDAG::isSplatValue()
Justin Bogner [Wed, 9 Dec 2020 18:33:59 +0000 (10:33 -0800)]
Limit the recursion depth of SelectionDAG::isSplatValue()

This method previously always recursively checked both the left-hand
side and right-hand side of binary operations for splatted (broadcast)
vector values to determine if the parent DAG node is a splat.

Like several other SelectionDAG methods, limit the recursion depth to
MaxRecursionDepth (6). This prevents stack overflow.
See also https://issuetracker.google.com/173785481

Patch by Nicolas Capens. Thanks!

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

3 years ago[MCJIT] Add cmake variables to customize ittapi git location and revision.
Alexey Bader [Wed, 9 Dec 2020 18:01:06 +0000 (21:01 +0300)]
[MCJIT] Add cmake variables to customize ittapi git location and revision.

To support llorg builds this patch provides the following changes:

1)  Added cmake variable ITTAPI_GIT_REPOSITORY to control the location of ITTAPI repository.
     Default value of ITTAPI_GIT_REPOSITORY is github location: https://github.com/intel/ittapi.git
     Also, the separate cmake variable ITTAPI_GIT_TAG was added for repo tag.
2)  Added cmake variable ITTAPI_SOURCE_DIR to control the place where the repo will be cloned.
     Default value of ITTAPI_SOURCE_DIR is build area: PROJECT_BINARY_DIR

Reviewed By: etyurin, bader

Patch by ekovanov.

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

3 years agoReland Pin -loop-reduce to legacy PM
Arthur Eubanks [Mon, 7 Dec 2020 23:25:43 +0000 (15:25 -0800)]
Reland Pin -loop-reduce to legacy PM

This was accidentally reverted by a later change.

LSR currently only runs in the codegen pass manager.
There are a couple issues with LSR and the NPM.
1) Lots of tests assume that LCSSA isn't run before LSR. This breaks a
bunch of tests' expected output. This is fixable with some time put in.
2) LSR doesn't preserve LCSSA. See
llvm/test/Analysis/MemorySSA/update-remove-deadblocks.ll. LSR's use of
SCEVExpander is the only use of SCEVExpander where the PreserveLCSSA option is
off. Turning it on causes some code sinking out of loops to fail due to
SCEVExpander's inability to handle the newly created trivial PHI nodes in the
broken critical edge (I was looking at
llvm/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll).
I also tried simply just calling formLCSSA() at the end of LSR, but the extra
PHI nodes cause regressions in codegen tests.

We'll delay figuring these issues out until later.

This causes the number of check-llvm failures with -enable-new-pm true
by default to go from 60 to 29.

Reviewed By: asbirlea

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

3 years ago[CMake] Add llvm-profgen to LLVM_TEST_DEPENDS
Fangrui Song [Wed, 9 Dec 2020 17:34:51 +0000 (09:34 -0800)]
[CMake] Add llvm-profgen to LLVM_TEST_DEPENDS

Otherwise `check-llvm-*` may not rebuild llvm-profgen, causing llvm-profgen tests
to fail if llvm-profgen happens to be stale.

3 years ago[lldb] Track the API boundary using a thread_local variable.
Jonas Devlieghere [Tue, 8 Dec 2020 04:59:13 +0000 (20:59 -0800)]
[lldb] Track the API boundary using a thread_local variable.

The reproducers currently use a static variable to track the API
boundary. This is obviously incorrect when the SB API is used
concurrently. While I do not plan to support that use-case (right now),
I do want to avoid us crashing. As a first step, correctly track API
boundaries across multiple threads.

Before this patch SB API calls made by the embedded script interpreter
would be considered "behind the API boundary" and correctly ignored.
After this patch, we need to tell the reproducers to ignore the
scripting thread as a "private thread".

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

3 years ago[COFF][LTO][NPM] Use NPM for LTO with ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
Arthur Eubanks [Tue, 8 Dec 2020 18:21:17 +0000 (10:21 -0800)]
[COFF][LTO][NPM] Use NPM for LTO with ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER

Reviewed By: hans

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

3 years ago[FileCheck] Enforce --allow-unused-prefixes=false for llvm/test/Transforms
Mircea Trofin [Tue, 1 Dec 2020 18:00:11 +0000 (10:00 -0800)]
[FileCheck] Enforce --allow-unused-prefixes=false for llvm/test/Transforms

Explicitly opt-out llvm/test/Transforms/Attributor.

Verified by flipping the default value of allow-unused-prefixes and
observing that none of the failures were under llvm/test/Transforms.

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

3 years ago[clangd] Extract per-dir CDB cache to its own threadsafe class. NFC
Sam McCall [Tue, 1 Dec 2020 11:48:41 +0000 (12:48 +0100)]
[clangd] Extract per-dir CDB cache to its own threadsafe class. NFC

This is a step towards making compile_commands.json reloadable.

The idea is:
 - in addition to rare CDB loads we're soon going to have somewhat-rare CDB
   reloads and fairly-common stat() of files to validate the CDB
 - so stop doing all our work under a big global lock, instead using it to
   acquire per-directory structures with their own locks
 - each directory can be refreshed from disk every N seconds, like filecache
 - avoid locking these at all in the most common case: directory has no CDB

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

3 years ago[libc++] Run back-deployment CI on macOS 10.15 instead of 10.14
Louis Dionne [Wed, 9 Dec 2020 14:58:25 +0000 (09:58 -0500)]
[libc++] Run back-deployment CI on macOS 10.15 instead of 10.14

The goal was to add coverage for back-deployment over the filesystem
library, but it was added in macOS 10.15, not 10.14.

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

3 years ago[gn build] Port b804eef0905
LLVM GN Syncbot [Wed, 9 Dec 2020 16:19:07 +0000 (16:19 +0000)]
[gn build] Port b804eef0905

3 years ago[gn build] Port ac7864ec019
LLVM GN Syncbot [Wed, 9 Dec 2020 16:19:07 +0000 (16:19 +0000)]
[gn build] Port ac7864ec019

3 years ago[gn build] Port 5934a79196b
LLVM GN Syncbot [Wed, 9 Dec 2020 16:19:06 +0000 (16:19 +0000)]
[gn build] Port 5934a79196b

3 years ago[clangd] Split tweak tests into one file per tweak.
Adam Czachorowski [Wed, 9 Dec 2020 15:22:10 +0000 (16:22 +0100)]
[clangd] Split tweak tests into one file per tweak.

No changes to the tests themselves, other than some auto -> const auto
diagnostic fixes and formatting.

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

3 years ago[VE] Add vsum and vfsum intrinsic instructions
Kazushi (Jam) Marukawa [Mon, 7 Dec 2020 11:33:20 +0000 (20:33 +0900)]
[VE] Add vsum and vfsum intrinsic instructions

Add vsum and vfsum intrinsic instructions and regression tests.

Reviewed By: simoll

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

3 years ago[TableGen] Cache the vectors of records returned by getAllDerivedDefinitions().
Paul C. Anagnostopoulos [Thu, 3 Dec 2020 14:58:37 +0000 (09:58 -0500)]
[TableGen] Cache the vectors of records returned by getAllDerivedDefinitions().

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

3 years ago[VectorCombine] allow peeking through an extractelt when creating a vector load
Sanjay Patel [Wed, 9 Dec 2020 15:35:12 +0000 (10:35 -0500)]
[VectorCombine] allow peeking through an extractelt when creating a vector load

This is an enhancement to load vectorization that is motivated by
a pattern in https://llvm.org/PR16739.
Unfortunately, it's still not enough to make a difference there.
We will have to handle multi-use cases in some better way to avoid
creating multiple overlapping loads.

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

3 years ago[InstCombine] canonicalizeSaturatedAdd(): last fold is only valid for strict comparis...
Roman Lebedev [Wed, 9 Dec 2020 15:04:08 +0000 (18:04 +0300)]
[InstCombine] canonicalizeSaturatedAdd(): last fold is only valid for strict comparison (PR48390)

We could create uadd.sat under incorrect circumstances
if a select with -1 as the false value was canonicalized
by swapping the T/F values. Unlike the other transforms
in the same function, it is not invariant to equality.

Some alive proofs: https://alive2.llvm.org/ce/z/emmKKL

Based on original patch by David Green!

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

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

3 years ago[NFC][InstCombine] Add test coverage for @llvm.uadd.sat canonicalization
Roman Lebedev [Wed, 9 Dec 2020 14:51:32 +0000 (17:51 +0300)]
[NFC][InstCombine] Add test coverage for @llvm.uadd.sat canonicalization

The non-strict variants are already handled because they are canonicalized
to strict variants by swapping hands in both the select and icmp,
and the fold simply considers that strictness is irrelevant here.

But that isn't actually true for the last pattern, as PR48390 reports.

3 years ago[VE] Add vfmk intrinsic instructions
Kazushi (Jam) Marukawa [Mon, 7 Dec 2020 11:17:36 +0000 (20:17 +0900)]
[VE] Add vfmk intrinsic instructions

Add vfmk intrinsic instructions, a few pseudo instructions to expand
vfmk intrinsic using VM512 correctly, and regression tests.

Reviewed By: simoll

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

3 years ago[LLD][ELF] Fix typo in relocation-model-pic.ll
Yvan Roux [Wed, 9 Dec 2020 14:31:49 +0000 (15:31 +0100)]
[LLD][ELF] Fix typo in relocation-model-pic.ll

Should fix non-x86 bot failures.

3 years ago[X86] Fold CONCAT(VPERMV3(X,Y,M0),VPERMV3(Z,W,M1)) -> VPERMV3(CONCAT(X,Z),CONCAT...
Simon Pilgrim [Tue, 8 Dec 2020 18:35:23 +0000 (18:35 +0000)]
[X86] Fold CONCAT(VPERMV3(X,Y,M0),VPERMV3(Z,W,M1)) -> VPERMV3(CONCAT(X,Z),CONCAT(Y,W),CONCAT(M0,M1))

Further prep work toward supporting different subvector sizes in combineX86ShufflesRecursively

3 years ago[DFSan] Add custom wrapper for epoll_wait.
Matt Morehouse [Wed, 9 Dec 2020 14:05:12 +0000 (06:05 -0800)]
[DFSan] Add custom wrapper for epoll_wait.

The wrapper clears shadow for any events written.

Reviewed By: stephan.yichao.zhao

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

3 years ago[LLDB] Temporarily incrase DEFAULT_TIMEOUT on gdbremote_testcase.py
Muhammad Omair Javaid [Wed, 9 Dec 2020 13:39:40 +0000 (18:39 +0500)]
[LLDB] Temporarily incrase DEFAULT_TIMEOUT on gdbremote_testcase.py

TestLldbGdbServer.py testcases are timing out on LLDB/AArch64 Linux
buildbot since recent changes. I am temporarily increasing
DEFAULT_TIMEOUT to 20 seconds to see impact.

3 years ago[SLP] Use the width of value truncated just before storing
Anton Afanasyev [Tue, 8 Dec 2020 09:51:45 +0000 (12:51 +0300)]
[SLP] Use the width of value truncated just before storing

For stores chain vectorization we choose the size of vector
elements to ensure we fit to minimum and maximum vector register
size for the number of elements given. This patch corrects vector
element size choosing the width of value truncated just before
storing instead of the width of value stored.

Fixes PR46983

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

3 years ago[Debuginfo] [CSInfo] Do not create CSInfo for undef arguments
Djordje Todorovic [Wed, 9 Dec 2020 11:46:30 +0000 (12:46 +0100)]
[Debuginfo] [CSInfo] Do not create CSInfo for undef arguments

If a function parameter is marked as "undef", prevent creation
of CallSiteInfo for that parameter.
Without this patch, the parameter's call_site_value would be incorrect.
The incorrect call_value case reported in PR39716,
addressed in D85111.

Patch by Nikola Tesic

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

3 years ago[SVE][CodeGen] Add DAG combines for s/zext_masked_gather
Kerry McLaughlin [Wed, 9 Dec 2020 11:21:51 +0000 (11:21 +0000)]
[SVE][CodeGen] Add DAG combines for s/zext_masked_gather

This patch adds the following DAGCombines, which apply if isVectorLoadExtDesirable() returns true:
 - fold (and (masked_gather x)) -> (zext_masked_gather x)
 - fold (sext_inreg (masked_gather x)) -> (sext_masked_gather x)

LowerMGATHER has also been updated to fetch the LoadExtType associated with the
gather and also use this value to determine the correct masked gather opcode to use.

Reviewed By: sdesmalen

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

3 years ago[LoopVectorizer][SVE] Vectorize a simple loop with with a scalable VF.
Sander de Smalen [Tue, 8 Dec 2020 14:20:04 +0000 (14:20 +0000)]
[LoopVectorizer][SVE] Vectorize a simple loop with with a scalable VF.

* Steps are scaled by `vscale`, a runtime value.
* Changes to circumvent the cost-model for now (temporary)
  so that the cost-model can be implemented separately.

This can vectorize the following loop [1]:

   void loop(int N, double *a, double *b) {
     #pragma clang loop vectorize_width(4, scalable)
     for (int i = 0; i < N; i++) {
       a[i] = b[i] + 1.0;
     }
   }

[1] This source-level example is based on the pragma proposed
separately in D89031. This patch only implements the LLVM part.

Reviewed By: dmgreen

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

3 years ago[LoopVectorizer] NFC: Remove unnecessary asserts that VF cannot be scalable.
Sander de Smalen [Tue, 8 Dec 2020 14:19:52 +0000 (14:19 +0000)]
[LoopVectorizer] NFC: Remove unnecessary asserts that VF cannot be scalable.

This patch removes a number of asserts that VF is not scalable, even though
the code where this assert lives does nothing that prevents VF being scalable.

Reviewed By: dmgreen

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

3 years ago[SVE][CodeGen] Add the ExtensionType flag to MGATHER
Kerry McLaughlin [Wed, 9 Dec 2020 10:49:43 +0000 (10:49 +0000)]
[SVE][CodeGen] Add the ExtensionType flag to MGATHER

Adds the ExtensionType flag, which reflects the LoadExtType of a MaskedGatherSDNode.
Also updated SelectionDAGDumper::print_details so that details of the gather
load (is signed, is scaled & extension type) are printed.

Reviewed By: sdesmalen

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

3 years ago[mlir] Use mlir::OpState::operator->() to get to methods of mlir::Operation. This...
Christian Sigg [Wed, 9 Dec 2020 10:50:18 +0000 (11:50 +0100)]
[mlir] Use mlir::OpState::operator->() to get to methods of mlir::Operation. This is a preparation step to remove the corresponding methods from OpState.

Reviewed By: silvas, rriddle

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

3 years ago[SelectionDAG] Add llvm.vector.{extract,insert} intrinsics
Joe Ellis [Wed, 9 Dec 2020 11:05:51 +0000 (11:05 +0000)]
[SelectionDAG] Add llvm.vector.{extract,insert} intrinsics

This commit adds two new intrinsics.

- llvm.experimental.vector.insert: used to insert a vector into another
  vector starting at a given index.

- llvm.experimental.vector.extract: used to extract a subvector from a
  larger vector starting from a given index.

The codegen work for these intrinsics has already been completed; this
commit is simply exposing the existing ISD nodes to LLVM IR.

Reviewed By: cameron.mcinally

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

3 years ago[IR] Support scalable vectors in CastInst::CreatePointerCast
Cullen Rhodes [Wed, 2 Dec 2020 13:21:00 +0000 (13:21 +0000)]
[IR] Support scalable vectors in CastInst::CreatePointerCast

Reviewed By: sdesmalen

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

3 years ago[VP] Build VP SDNodes
Simon Moll [Wed, 9 Dec 2020 10:36:30 +0000 (11:36 +0100)]
[VP] Build VP SDNodes

Translate VP intrinsics to VP_* SDNodes.  The tests check whether a
matching vp_* SDNode is emitted.

Reviewed By: craig.topper

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

3 years ago[OpenMPIRBuilder] Put the barrier in the exit block in createWorkshapeLoop
Alex Zinenko [Tue, 8 Dec 2020 22:22:36 +0000 (23:22 +0100)]
[OpenMPIRBuilder] Put the barrier in the exit block in createWorkshapeLoop

The original code was inserting the barrier at the location given by the
caller. Make sure it is always inserted at the end of the loop exit block
instead.

Reviewed By: Meinersbur

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

3 years agoAArch64: use correct operand for ubsantrap immediate.
Tim Northover [Wed, 9 Dec 2020 10:13:36 +0000 (10:13 +0000)]
AArch64: use correct operand for ubsantrap immediate.

I accidentally pushed the wrong patch originally.

3 years ago[LLDB] Fix failing test dwp-separate-debug-file.cpp
Muhammad Omair Javaid [Wed, 9 Dec 2020 09:57:18 +0000 (14:57 +0500)]
[LLDB] Fix failing test dwp-separate-debug-file.cpp

Fix failure introduced by 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.

3 years ago[lldb] Fix one more failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.
Haojian Wu [Wed, 9 Dec 2020 09:43:01 +0000 (10:43 +0100)]
[lldb] Fix one more failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.

3 years ago[NFC][Instructions] Refactor CmpInst::getFlippedStrictnessPredicate() in terms of...
Roman Lebedev [Wed, 9 Dec 2020 08:37:52 +0000 (11:37 +0300)]
[NFC][Instructions] Refactor CmpInst::getFlippedStrictnessPredicate() in terms of is{,Non}StrictPredicate()/get{Non,}StrictPredicate()

In particular, this creates getStrictPredicate() method,
to be symmetrical with already-existing getNonStrictPredicate().

3 years ago[RISCV] Fix missing def operand when creating VSETVLI pseudos
Fraser Cormack [Tue, 8 Dec 2020 09:20:28 +0000 (09:20 +0000)]
[RISCV] Fix missing def operand when creating VSETVLI pseudos

The register operand was not being marked as a def when it should be. No tests
for this in the main branch as there are not yet any pseudos without a
non-negative VLIndex.

Also change the type of a virtual register operand from unsigned to Register
and adjust formatting.

Reviewed By: craig.topper

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

3 years agoRevert "[clang][cli] CompilerInvocationTest: add tests for boolean options"
Jan Svoboda [Wed, 9 Dec 2020 09:35:07 +0000 (10:35 +0100)]
Revert "[clang][cli] CompilerInvocationTest: add tests for boolean options"

Differential Revision of original patch: https://reviews.llvm.org/D92774

3 years ago[llvm-readelf/obj] - Improve diagnostics when printing NT_FILE notes.
Georgii Rymar [Thu, 3 Dec 2020 14:14:05 +0000 (17:14 +0300)]
[llvm-readelf/obj] - Improve diagnostics when printing NT_FILE notes.

This changes the `printNotesHelper` to report warnings on its side when
there are errors when dumping notes.

With that we can provide more content when reporting warnings about broken notes.

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

3 years ago[MLIR] Expose target configuration for lowering to NVVM
Frederik Gossen [Tue, 8 Dec 2020 18:34:06 +0000 (19:34 +0100)]
[MLIR] Expose target configuration for lowering to NVVM

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

3 years ago[obj2yaml] - Support dumping objects that have multiple SHT_SYMTAB_SHNDX sections.
Georgii Rymar [Fri, 4 Dec 2020 10:23:26 +0000 (13:23 +0300)]
[obj2yaml] - Support dumping objects that have multiple SHT_SYMTAB_SHNDX sections.

It is allowed to have multiple `SHT_SYMTAB_SHNDX` sections, though
we currently don't implement it.

The current implementation assumes that there is a maximum of one SHT_SYMTAB_SHNDX
section and that it is always linked with .symtab section.

This patch drops this limitations.

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

3 years agoFix typo in llvm/lib/Target/README.txt
Siddhesh Poyarekar [Wed, 9 Dec 2020 08:29:06 +0000 (09:29 +0100)]
Fix typo in llvm/lib/Target/README.txt

Trivial typo, replace __builtin_objectsize with __builtin_object_size.

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

3 years ago[compiler-rt sanitizer] Use our own PTRACE_GETREGSET if it does not exist.
Jeroen Dobbelaere [Wed, 9 Dec 2020 08:59:47 +0000 (00:59 -0800)]
[compiler-rt sanitizer] Use our own PTRACE_GETREGSET if it does not exist.

On RH66 does not support 'PTRACE_GETREGSET'. This change makes this part of compiler-rt build again on older os-es

Reviewed By: vitalybuka

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

3 years ago[lldb] Fix a failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.
Haojian Wu [Wed, 9 Dec 2020 08:32:13 +0000 (09:32 +0100)]
[lldb] Fix a failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.

The behavior of -gsplit-dwarf is changed because of the new commit.

Restore the old behavior by replacing -gsplit-dwarf with -gsplit-dwarf -g.

3 years ago[clang][cli] CompilerInvocationTest: add tests for boolean options
Jan Svoboda [Tue, 8 Dec 2020 11:29:14 +0000 (12:29 +0100)]
[clang][cli] CompilerInvocationTest: add tests for boolean options

Add more tests of the command line marshalling infrastructure.

The new tests now make a "round-trip": from arguments, to CompilerInvocation instance to arguments again in a single test case.

The TODOs are resolved in a follow-up patch.

Depends on D92830.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: join and add test cases
Jan Svoboda [Tue, 8 Dec 2020 11:15:35 +0000 (12:15 +0100)]
[clang][cli] CompilerInvocationTest: join and add test cases

Depends on D92829.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: check arg parsing does not produce diagnostics
Jan Svoboda [Tue, 8 Dec 2020 09:52:31 +0000 (10:52 +0100)]
[clang][cli] CompilerInvocationTest: check arg parsing does not produce diagnostics

Depends on D92828.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: remove unnecessary command line arguments
Jan Svoboda [Tue, 8 Dec 2020 09:44:03 +0000 (10:44 +0100)]
[clang][cli] CompilerInvocationTest: remove unnecessary command line arguments

Depends on D92827.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: split enum test into two
Jan Svoboda [Tue, 8 Dec 2020 09:37:16 +0000 (10:37 +0100)]
[clang][cli] CompilerInvocationTest: split enum test into two

Depends on D92826.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: rename member variable in fixture
Jan Svoboda [Tue, 8 Dec 2020 09:31:12 +0000 (10:31 +0100)]
[clang][cli] CompilerInvocationTest: rename member variable in fixture

Depends on D92825.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: join two test fixtures into one
Jan Svoboda [Tue, 8 Dec 2020 09:28:18 +0000 (10:28 +0100)]
[clang][cli] CompilerInvocationTest: join two test fixtures into one

Reviewed By: dexonsmith

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

3 years ago[ARM] Common inverse constant predicates to VPNOT
David Green [Wed, 9 Dec 2020 07:56:45 +0000 (07:56 +0000)]
[ARM] Common inverse constant predicates to VPNOT

This scans through blocks looking for constants used as predicates in
MVE instructions. When two constants are found which are the inverse of
one another, the second can be replaced by a VPNOT of the first,
potentially allowing that not to be folded away into an else predicate
of a vpt block.

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

3 years ago[lldb] Remove unused IsFunctionType is_variadic_ptr parameter (NFC)
Dave Lee [Mon, 7 Dec 2020 18:38:14 +0000 (10:38 -0800)]
[lldb] Remove unused IsFunctionType is_variadic_ptr parameter (NFC)

`is_variadic_ptr` is unused.

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

3 years ago[ARM] Constant Mask VPT block tests. NFC
David Green [Wed, 9 Dec 2020 07:44:49 +0000 (07:44 +0000)]
[ARM] Constant Mask VPT block tests. NFC

3 years ago[RISCV] Use SDLoc created early in RISCVDAGToDAGISel::Select instead of recreating...
Craig Topper [Wed, 9 Dec 2020 05:12:34 +0000 (21:12 -0800)]
[RISCV] Use SDLoc created early in RISCVDAGToDAGISel::Select instead of recreating it in multiple cases in the switch. NFC

3 years ago[lldb] Fix -Wformat warning in debugserver unit test
Jonas Devlieghere [Wed, 9 Dec 2020 03:30:10 +0000 (19:30 -0800)]
[lldb] Fix -Wformat warning in debugserver unit test

RNBSocketTest.cpp:31:35: warning: format specifies type 'char *' but the
argument has type 'const void *' [-Wformat]

3 years ago[RISCV] Add a table showing the layout of the fields in VTYPE. Rename MaskedOffAgnost...
Craig Topper [Wed, 9 Dec 2020 04:40:15 +0000 (20:40 -0800)]
[RISCV] Add a table showing the layout of the fields in VTYPE. Rename MaskedOffAgnostic->MaskAgnostic. NFC

3 years ago[PowerPC] Set SubRegIndex offset for sub_vsx1/sub_pair1
Jinsong Ji [Wed, 9 Dec 2020 03:29:38 +0000 (22:29 -0500)]
[PowerPC] Set SubRegIndex offset for sub_vsx1/sub_pair1

We defined SubRegIndex for 256/512 regs,
but we did not set the offset for higher part,
so the offset of lower and higher part are the same.
This may cause problem in assessing ranges of SubReg,
it is great that this haven't affected any testcases,
but I think we should fix it to avoid hidden bugs in the future.

Reviewed By: bsaleil, #powerpc

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

3 years ago[PowerPC] Precommit testcases for regpressure compute fix
Jinsong Ji [Wed, 9 Dec 2020 03:15:45 +0000 (03:15 +0000)]
[PowerPC] Precommit testcases for regpressure compute fix

3 years agoFix MLIR Python bindings build after changes to the C API to use StringRef (NFC)
Mehdi Amini [Wed, 9 Dec 2020 03:26:37 +0000 (03:26 +0000)]
Fix MLIR Python bindings build after changes to the C API to use StringRef (NFC)

3 years ago[MemorySSA] Remove unused declaration determineInsertionPoint (NFC)
Kazu Hirata [Wed, 9 Dec 2020 03:21:44 +0000 (19:21 -0800)]
[MemorySSA] Remove unused declaration determineInsertionPoint (NFC)

The declaration was introduced without a corresponding definition on
Feb 2, 2016 in commit e1100f533f0a48f55e80e1152b06f5deab5f9b30.

3 years ago[IR] Use llvm::is_contained (NFC)
Kazu Hirata [Wed, 9 Dec 2020 03:06:37 +0000 (19:06 -0800)]
[IR] Use llvm::is_contained (NFC)

3 years ago[WebAssembly] Fix code generated for atomic operations in PIC mode
Sam Clegg [Mon, 7 Dec 2020 05:13:55 +0000 (21:13 -0800)]
[WebAssembly] Fix code generated for atomic operations in PIC mode

The main this this test does is to add the `IsNotPIC` predicate to the
all the atomic instructions pattern that directly refer to
`tglobaladdr`.

This is because in PIC mode we need to generate separate instruction
sequence (either a direct global.get, or __memory_base + offset) for
accessing global addresses.

As part of this change I noticed that many of the `Requires` attributes
added to the instruction in `WebAssemblyInstrAtomics.td` were being
honored.  This is because the wrapped in a `let Predicates =
[HasAtomics]` block and it seems that that outer wrapping overrides any
`Requires` on defs within it.   As a workaround I removed the outer
`let` and added `HasAtomics` to all the inner `Requires`.  I believe
that all the instrucitons that don't have `Requires` explicit bottom out
in `ATOMIC_I` and `ATOMIC_NRI` which have `HasAtomics` so this should
not remove this predicate from any patterns (at least that is the idea).

The alternative to this approach looks like implementing something
like `PredicateControl` in `Mips.td` where we can split the predicates
into groups so they don't clobber each other.

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

3 years ago[NFC] Added test for PR33549
Dávid Bolvanský [Wed, 9 Dec 2020 02:20:02 +0000 (03:20 +0100)]
[NFC] Added test for PR33549

3 years agoBasic: Add hashing support for FileEntryRef and DirectoryEntryRef
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 22:25:44 +0000 (18:25 -0400)]
Basic: Add hashing support for FileEntryRef and DirectoryEntryRef

Allow hashing FileEntryRef and DirectoryEntryRef via `hash_value`, and
use that to implement `DenseMapInfo`. This hash should be equal whenever
the entry is the same (the name used to reference it is not relevant).

Also add `DirectoryEntryRef::isSameRef` to simplify the implementation
and facilitate testing.

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

3 years ago[PowerPC] prepare more dq form for P10 pair load/store
Chen Zheng [Tue, 1 Dec 2020 13:48:17 +0000 (08:48 -0500)]
[PowerPC] prepare more dq form for P10 pair load/store

Reviewed By: steven.zhang

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

3 years agoSupport: Add RedirectingFileSystem::create from simple list of redirections
Duncan P. N. Exon Smith [Thu, 12 Nov 2020 04:03:38 +0000 (23:03 -0500)]
Support: Add RedirectingFileSystem::create from simple list of redirections

Add an overload of `RedirectingFileSystem::create` that builds a
redirecting filesystem off of a simple vector of string pairs. This is
intended to be used to support `clang::arcmt::FileRemapper` and
`clang::PreprocessorOptions::RemappedFiles`.

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

3 years agoVFS: Return new file systems as uniquely owned when possible, almost NFC
Duncan P. N. Exon Smith [Tue, 8 Dec 2020 22:58:46 +0000 (14:58 -0800)]
VFS: Return new file systems as uniquely owned when possible, almost NFC

Uniformly return uniquely-owned filesystems from VFS creation APIs. The
one exception is `getRealFileSystem`, which has a single instance and
needs to be shared.

This is almost NFC, except that it fixes a memory leak in
`vfs::collectVFSFromYAML()`.

Depends on https://reviews.llvm.org/D92888

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

3 years agoADT: Allow IntrusiveRefCntPtr construction from std::unique_ptr, NFC
Duncan P. N. Exon Smith [Tue, 8 Dec 2020 22:54:55 +0000 (14:54 -0800)]
ADT: Allow IntrusiveRefCntPtr construction from std::unique_ptr, NFC

Allow a `std::unique_ptr` to be moved into the an `IntrusiveRefCntPtr`,
and remove a couple of now-unnecessary `release()` calls.

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

3 years ago[SampleFDO] Store fixed length MD5 in NameTable instead of using ULEB128 if
Wei Mi [Thu, 3 Dec 2020 20:19:25 +0000 (12:19 -0800)]
[SampleFDO] Store fixed length MD5 in NameTable instead of using ULEB128 if
MD5 is used.

Currently during sample profile loading, NameTable has to be loaded entirely
up front before any name string is retrieved. That is because NameTable is
stored using ULEB128 encoding and cannot be directly accessed like an array.
However, if MD5 is used to represent name in the NameTable, it has fixed
length. If MD5 names are stored in uint64_t type instead of ULEB128, NameTable
can be accessed like an array then in many cases only part of the NameTable
has to be read. This is helpful for reducing compile time especially when
small source file is compiled. We find that after this change, the elapsed
time to build a large application distributively is reduced by 5% and the
accumulative cpu time used for building is also reduced by 5%. The size of
the profile is slightly reduced with this change by ~0.2%, and that also
indicates encoding MD5 in ULEB128 doesn't save the storage space.

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

3 years ago[OpenMP] Add doxygen generation for the runtime
Giorgis Georgakoudis [Fri, 4 Dec 2020 20:50:52 +0000 (12:50 -0800)]
[OpenMP] Add doxygen generation for the runtime

Reviewed By: jdoerfert

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

3 years ago[RISCV] Share VTYPE encoding code between the assembler and the CustomInserter for...
Craig Topper [Wed, 9 Dec 2020 00:02:00 +0000 (16:02 -0800)]
[RISCV] Share VTYPE encoding code between the assembler and the CustomInserter for adding VSETVLI before vector instructions

This merges the SEW and LMUL enums that each used into singles enums in RISCVBaseInfo.h. The patch also adds a new encoding helper to take SEW, LMUL, tail agnostic, mask agnostic and turn it into a vtype immediate.

I also stopped storing the Encoding in the VTYPE operand in the assembler. It is easy to calculate when adding the operand which should only happen once per instruction.

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

3 years agoPrevent FENTRY_CALL reordering
Ilya Leoshkevich [Tue, 8 Dec 2020 21:04:00 +0000 (22:04 +0100)]
Prevent FENTRY_CALL reordering

FEntryInserter prepends FENTRY_CALL to the first basic block. In case
there are other instructions, PostRA Machine Instruction Scheduler can
move FENTRY_CALL call around. This actually occurs on SystemZ (see the
testcase). This is bad for the following reasons:

* FENTRY_CALL clobbers registers.
* Linux Kernel depends on whatever FENTRY_CALL expands to to be the very
  first instruction in the function.

Fix by adding isCall attribute to FENTRY_CALL, which prevents reordering
by making it a scheduling boundary for PostRA Machine Instruction
Scheduler.

Reviewed By: niravd

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