platform/upstream/llvm.git
3 years ago[Attributor][FIX] Properly check uses in the call not uses of the call
Johannes Doerfert [Sat, 10 Oct 2020 14:39:51 +0000 (09:39 -0500)]
[Attributor][FIX] Properly check uses in the call not uses of the call

In the AANoAlias logic we determine if a pointer may have been captured
before a call. We need to look at other uses in the call not uses of the
call.

The new code is not perfect as it does not allow trivial cases where the
call has multiple arguments but it is at least not unsound and a TODO
was added.

3 years ago[Attributor][NFC] Improve time trace output
Johannes Doerfert [Sat, 10 Oct 2020 14:28:47 +0000 (09:28 -0500)]
[Attributor][NFC] Improve time trace output

3 years ago[MLIR] [ODS] Allowing attr-dict in custom directive
John Demme [Wed, 28 Oct 2020 01:01:44 +0000 (01:01 +0000)]
[MLIR] [ODS] Allowing attr-dict in custom directive

Enhance tblgen's declarative assembly format to allow `attr-dict` in
custom directives.

Reviewed By: rriddle

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

3 years ago[flang][openacc] Fix ambiguity in the self clause parsing
Valentin Clement [Wed, 28 Oct 2020 01:09:48 +0000 (21:09 -0400)]
[flang][openacc] Fix ambiguity in the self clause parsing

In the OpenACC specification, there are two different self clause. One for the
update directive with a var-list argument. This clause is a synonym of the host clause.
The second self clause is present for most of the compute construct and takes an optional
condition. To solve this ambiguity, the self clause for the update directive is directly
translated to a host clause during the parsing. The self clause in AccClause refers always
to the compute construct clause.

Reviewed By: kiranktp

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

3 years agoRevert "[WebAssembly] Add support for DWARF type units"
Derek Schuff [Wed, 28 Oct 2020 00:57:32 +0000 (17:57 -0700)]
Revert "[WebAssembly] Add support for DWARF type units"

This reverts commit bcb8a119df210753c5f1a3ac346d49597fef0f51.

3 years agoRemove unused variable name. NFC.
Richard Smith [Wed, 28 Oct 2020 00:16:16 +0000 (17:16 -0700)]
Remove unused variable name. NFC.

3 years ago[mlir] Fix stack-use-after-scope in cuda/vulkan cpu runners
Eugene Zhulenev [Wed, 28 Oct 2020 00:02:10 +0000 (17:02 -0700)]
[mlir] Fix stack-use-after-scope in cuda/vulkan cpu runners

+fix rocm runner

Reviewed By: mehdi_amini

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

3 years ago[clang] Pass-through remarks options to linker
Wei Wang [Wed, 28 Oct 2020 00:11:26 +0000 (17:11 -0700)]
[clang] Pass-through remarks options to linker

Summary:
Propagate driver commandline remarks options to linker when LTO is enabled.

This gives novice user a convenient way to collect and filter remarks throughout
a typical toolchain invocation with sample profile and LTO using single switch
from the clang driver.

A typical use of this option from clang command-line:

* Using -Rpass* options to print remarks to screen:

  clang -fuse-ld=lld -flto=thin -fprofile-sample-use=foo_sample.txt
   -Rpass=inline -Rpass-missed=inline -Rpass-analysis=inline
   -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=100 -o foo foo.cpp

  Remarks will be dumped to screen from both pre-lto and lto
  compilation.

* Using serialized remarks options

  clang -fuse-ld=lld -flto=thin -fprofile-sample-use=foo_sample.txt
   -fsave-optimization-record
   -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=100 -o foo foo.cpp

  This will produce multiple yaml files containing optimization remarks:
  1. foo.opt.yaml : remarks from pre-lto
  2. foo.opt.ld.yaml.thin.1.yaml: remark during lto

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

3 years ago[WebAssembly] Add support for DWARF type units
Derek Schuff [Wed, 30 Sep 2020 18:55:12 +0000 (11:55 -0700)]
[WebAssembly] Add support for DWARF type units

Since Wasm comdat sections work similarly to ELF, we can use that mechanism
to eliminate duplicate dwarf type information in the same way.

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

3 years ago[LangRef] Clarify `dereferenceable` -> `nonnull` implication
Johannes Doerfert [Wed, 14 Oct 2020 18:54:20 +0000 (13:54 -0500)]
[LangRef] Clarify `dereferenceable` -> `nonnull` implication

If `null_pointer_is_valid` is present, `dereferenceable` does not imply
`nonnull`, make it clear.

Came up in D17993.

Reviewed By: aqjune

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

3 years ago[OpenMP][CUDA] Add missing overload for `remquo(float,float,int*)`
Johannes Doerfert [Thu, 22 Oct 2020 16:36:49 +0000 (11:36 -0500)]
[OpenMP][CUDA] Add missing overload for `remquo(float,float,int*)`

Reported by Colleen Bertoni <bertoni@anl.gov> after running the OvO test
suite: https://github.com/TApplencourt/OvO/

The template overload is still hidden behind an ifdef for OpenMP. In the
future we probably want to remove the ifdef but that requires further
testing.

Reviewed By: JonChesterfield, tra

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

3 years agoUnbreak build with gcc5.3 after 917acac
Nico Weber [Wed, 28 Oct 2020 00:10:48 +0000 (20:10 -0400)]
Unbreak build with gcc5.3 after 917acac

3 years ago[libc][NFC] Use a convenience macro to declare special floating point constants.
Siva Chandra Reddy [Tue, 27 Oct 2020 20:12:18 +0000 (13:12 -0700)]
[libc][NFC] Use a convenience macro to declare special floating point constants.

Reviewed By: lntue

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

3 years ago[BranchProbabilityInfo] Make MaxSuccIdx[Src] efficient and add a comment about the...
Fangrui Song [Tue, 27 Oct 2020 23:29:10 +0000 (16:29 -0700)]
[BranchProbabilityInfo] Make MaxSuccIdx[Src] efficient and add a comment about the subtle eraseBlock. NFC

Follow-up to D90272.

3 years ago[mlir][NFC] Fix incorrect header comments.
River Riddle [Tue, 27 Oct 2020 23:22:13 +0000 (16:22 -0700)]
[mlir][NFC] Fix incorrect header comments.

Resolves missed comments in D89103

3 years ago[mlir][NFC] Remove unnecessary PatternRewriter::create methods
River Riddle [Tue, 27 Oct 2020 23:03:40 +0000 (16:03 -0700)]
[mlir][NFC] Remove unnecessary PatternRewriter::create methods

At this point, these methods are just carbon copies of OpBuilder::create and aren't necessary given that PatternRewriter inherits from OpBuilder.

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

3 years ago[mlir][Interfaces] Optimize the implementation of InterfaceMap to reduce generated...
River Riddle [Tue, 27 Oct 2020 23:03:22 +0000 (16:03 -0700)]
[mlir][Interfaces] Optimize the implementation of InterfaceMap to reduce generated code size.

An InterfaceMap is generated for every single operation type, and is responsible for a large amount of the code size from MLIR given that its internals highly utilize templates. This revision refactors the internal implementation to use bare malloc/free for interface instances as opposed to static variables and moves as much code out of templates as possible. This led to a decrease of over >1mb (~12% of total MLIR related code size) for a downstream MLIR library with a large amount of operations.

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

3 years ago[mlir][Interfaces] Generate a struct containing function pointers instead of a class...
River Riddle [Tue, 27 Oct 2020 23:03:07 +0000 (16:03 -0700)]
[mlir][Interfaces] Generate a struct containing function pointers instead of a class with vtables

When compiling for code size, the use of a vtable causes a destructor(and constructor in certain cases) to be generated for the class. Interface models don't need a complex constructor or a destructor, so this can lead to many megabytes of code size increase(even in opt). This revision switches to a simpler struct of function pointers approach that accomplishes the same API requirements as before. This change requires no updates to user code, or any other code aside from the generator, as the user facing API is still exactly the same.

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

3 years ago[mlir][SIdeEffectInterface][NFC] Move several InterfaceMethods to the extraClassDecla...
River Riddle [Tue, 27 Oct 2020 23:02:59 +0000 (16:02 -0700)]
[mlir][SIdeEffectInterface][NFC] Move several InterfaceMethods to the extraClassDeclarations instead

All InterfaceMethods will have a corresponding entry in the interface model, and by extension have an implementation generated for every operation type. This can result in large binary size increases when a large amount of operations use an interface, such as the side effect interface.

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

3 years ago[mlir][Linalg] Add fusion of IndexedGenericOp with TensorReshapeOp by expansion.
MaheshRavishankar [Tue, 27 Oct 2020 23:15:08 +0000 (16:15 -0700)]
[mlir][Linalg] Add fusion of IndexedGenericOp with TensorReshapeOp by expansion.

This patch adds support for fusing linalg.indexed_generic op with
linalg.tensor_reshape op by expansion, i.e.
- linalg.indexed_generic op -> linalg.tensor_reshape op when the
  latter is expanding.
- linalg.tensor_reshape op -> linalg.indexed_generic op when the
  former is folding.

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

3 years ago[BranchProbabilityInfo] Fix eraseBlock
Kazu Hirata [Tue, 27 Oct 2020 23:14:25 +0000 (16:14 -0700)]
[BranchProbabilityInfo] Fix eraseBlock

This patch ensures that BranchProbabilityInfo::eraseBlock(BB) deletes
all entries in Probs associated with with BB.

Without this patch, stale entries for BB may remain in Probs after
eraseBlock(BB), leading to a situation where a newly created basic
block has an edge probability associated with it even before the pass
responsible for creating the basic block adds any edge probability to
it.

Consider the current implementation of eraseBlock(BB):

  for (const_succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) {
    auto MapI = Probs.find(std::make_pair(BB, I.getSuccessorIndex()));
    if (MapI != Probs.end())
      Probs.erase(MapI);
  }

Notice that it uses succ_begin(BB) and succ_end(BB), which are based
on BB->getTerminator().  This means that if the terminator changes
between calls to setEdgeProbability and eraseBlock, then we may not
examine all pairs associated with BB.

This is exactly what happens in MaybeMergeBasicBlockIntoOnlyPred,
which merges basic blocks A into B if A is the sole predecessor of B,
and B is the sole successor of A.  It replaces the terminator of A
with UnreachableInst before (indirectly) calling eraseBlock(A).

The patch fixes the problem by keeping track of all edge probablities
entered with setEdgeProbability in a map from BasicBlock* to a
successor index.

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

3 years ago[JumpThreading] Set edge probabilities when creating basic blocks
Kazu Hirata [Tue, 27 Oct 2020 23:07:27 +0000 (16:07 -0700)]
[JumpThreading] Set edge probabilities when creating basic blocks

This patch teaches the jump threading pass to set edge probabilities
whenever the pass creates new basic blocks.

Without this patch, the compiler sometimes produces non-deterministic
results.  The non-determinism comes from the jump threading pass using
stale edge probabilities in BranchProbabilityInfo.  Specifically, when
the jump threading pass creates a new basic block, we don't initialize
its outgoing edge probability.

Edge probabilities are maintained in:

  DenseMap<Edge, BranchProbability> Probs;

in class BranchProbabilityInfo, where Edge is an ordered pair of
BasicBlock * and a successor index declared as:

  using Edge = std::pair<const BasicBlock *, unsigned>;

Probs maps edges to their corresponding probabilities.

Now, we rarely remove entries from this map, so if we happen to
allocate a new basic block at the same address as a previously deleted
basic block with an edge probability assigned, the newly created basic
block appears to have an edge probability, albeit a stale one.

This patch fixes the problem by explicitly setting edge probabilities
whenever the jump threading pass creates new basic blocks.

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

3 years ago[lld][WebAssembly] Fix memory size in dylink section for -pie exectuables
Sam Clegg [Tue, 27 Oct 2020 19:46:07 +0000 (12:46 -0700)]
[lld][WebAssembly] Fix memory size in dylink section for -pie exectuables

This field to represents the amount of static data needed by
an dynamic library or executable it should not include things
like heap or stack areas, which in the case of `-pie` are
not determined until runtime (e.g. __stack_pointer is imported).

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

3 years ago[mlir] JitRunner: add a config option to register symbols with ExecutionEngine at...
Eugene Zhulenev [Tue, 27 Oct 2020 21:12:47 +0000 (14:12 -0700)]
[mlir] JitRunner: add a config option to register symbols with ExecutionEngine at runtime

Reviewed By: mehdi_amini

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

3 years ago[CostModel] remove cost-kind predicate for FP add/mul vector reduction costs
Sanjay Patel [Tue, 27 Oct 2020 21:40:58 +0000 (17:40 -0400)]
[CostModel] remove cost-kind predicate for FP add/mul vector reduction costs

This was originally part of:
f2c25c70791d
but that was reverted because there was an underlying bug in
processing the vector type of these intrinsics. That was
fixed with:
74ffc823ed21

This is similar in spirit to 01ea93d85d6e (memcpy) except that
here the underlying caller assumptions were created for vectorizer
use (throughput) rather than other passes.

That meant targets could have an enormous throughput cost with no
corresponding size, latency, or blended cost increase.

Paraphrasing from the previous commits:
This may not make sense for some callers, but at least now the
costs will be consistently wrong instead of mysteriously wrong.

Targets should provide better overrides if the current modeling
is not accurate.

3 years ago[CostModel] add tests for FP reductions; NFC
Sanjay Patel [Tue, 27 Oct 2020 21:23:42 +0000 (17:23 -0400)]
[CostModel] add tests for FP reductions; NFC

3 years ago[libcxx] Don't truncate intermediates to wchar_t when widening
Martin Storsjö [Tue, 27 Oct 2020 11:01:54 +0000 (13:01 +0200)]
[libcxx] Don't truncate intermediates to wchar_t when widening

On windows, wchar_t is 16 bit, while we might be widening chars to
char32_t.

This cast had been present since the initial commit, and removing it
doesn't seem to make any tests fail.

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

3 years ago[PowerPC] Fix single-use check and update chain users for ld-splat
Nemanja Ivanovic [Tue, 27 Oct 2020 21:43:11 +0000 (16:43 -0500)]
[PowerPC] Fix single-use check and update chain users for ld-splat

When converting a BUILD_VECTOR or VECTOR_SHUFFLE to a splatting load
as of 1461fb6e783cb946b061f66689b419f74f7fad63, we inaccurately check
for a single user of the load and neglect to update the users of the
output chain of the original load. As a result, we can emit a new
load when the original load is kept and the new load can be reordered
after a dependent store. This patch fixes those two issues.

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

3 years ago[OpenMP] Add Support for Mapping Names in Libomptarget RTL
Joseph Huber [Tue, 27 Oct 2020 20:12:16 +0000 (16:12 -0400)]
[OpenMP] Add Support for Mapping Names in Libomptarget RTL

Summary:
This patch adds basic support for priting the source location and names for the
mapped variables. This patch does not support names for custom mappers. This is
based on D89802. The names information currently will be printed out only in
debug mode or using env LIBOMPTARGET_INFO during execution. But the information
is added when availible to the Device and Private data structures. To get the
information out the code must be built with debug symbols on using -g or
-Rpass=openmp-opt

Reviewers: jdoerfert

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

3 years ago[libc++] Try to fix cross-loading of lit.local.cfg on Windows
Louis Dionne [Tue, 27 Oct 2020 20:24:47 +0000 (16:24 -0400)]
[libc++] Try to fix cross-loading of lit.local.cfg on Windows

On windows, the previous path replacement using forward slashes wouldn't
work, and so we'd end up including the same file again. We would do that
until we'd hit the recursion limit of the Python interpreter.

Instead, use `os.path` to properly replace without assuming a specific
path separator.

3 years ago[AMDGPU] Order AMDGPU ELF machine numbers in ascending order
Tony [Tue, 27 Oct 2020 08:08:45 +0000 (08:08 +0000)]
[AMDGPU] Order AMDGPU ELF machine numbers in ascending order

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

3 years ago[OpenMP] Add Passing in Original Declaration Names To Mapper API
Joseph Huber [Thu, 22 Oct 2020 18:06:50 +0000 (14:06 -0400)]
[OpenMP] Add Passing in Original Declaration Names To Mapper API

Summary:
This patch adds support for passing in the original delcaration name in the
source file to the libomptarget runtime. This will allow the runtime to provide
more intelligent debugging messages. This patch takes the original expression
parsed from the OpenMP map / update clause and provides a textual
representation if it was explicitly mapped, otherwise it takes the name of the
variable declaration as a fallback. The information in passed to the runtime in
a global array of strings that matches the existing ident_t source location
strings using ";name;filename;column;row;;". See
clang/test/OpenMP/target_map_names.cpp for an example of the generated output
for a given map clause.

Reviewers: jdoervert

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

3 years ago[libc++] Make sure we include a header when checking compiler macros
Louis Dionne [Tue, 27 Oct 2020 19:57:47 +0000 (15:57 -0400)]
[libc++] Make sure we include a header when checking compiler macros

Otherwise, it's possible for some __config_site macros not to be
picked up.

3 years ago[test] Delete Feature/load_module.ll which is covered by load_extension.ll
Fangrui Song [Tue, 27 Oct 2020 19:49:45 +0000 (12:49 -0700)]
[test] Delete Feature/load_module.ll which is covered by load_extension.ll

3 years ago[gn build] Port e025d09b216
LLVM GN Syncbot [Tue, 27 Oct 2020 19:40:30 +0000 (19:40 +0000)]
[gn build] Port e025d09b216

3 years ago[gn build] Port ce6900c6cb5
LLVM GN Syncbot [Tue, 27 Oct 2020 19:40:29 +0000 (19:40 +0000)]
[gn build] Port ce6900c6cb5

3 years ago[test] Make ThinLTO/X86/crash_debuginfo.ll work with -enable-new-pm=1
Fangrui Song [Tue, 27 Oct 2020 19:36:59 +0000 (12:36 -0700)]
[test] Make ThinLTO/X86/crash_debuginfo.ll work with -enable-new-pm=1

LegacyInlinerBase::doFinalization runs removeDeadFunctions() to remove bar but
the new PM inliner doesn't. Improve the test to use llvm-nm -U.

3 years ago[HIP][NFC] Use correct max in cuda_complex_builtins
Aaron En Ye Shi [Tue, 27 Oct 2020 19:08:58 +0000 (19:08 +0000)]
[HIP][NFC] Use correct max in cuda_complex_builtins

Update the clang complex builtins for OpenMP to use the
correct max function from either __nv_* or __ocml_*.

3 years agoRevert multiple patches based on "Introduce CfgTraits abstraction"
Nicolai Hähnle [Tue, 27 Oct 2020 19:28:41 +0000 (20:28 +0100)]
Revert multiple patches based on "Introduce CfgTraits abstraction"

These logically belong together since it's a base commit plus
followup fixes to less common build configurations.

The patches are:

Revert "CfgInterface: rename interface() to getInterface()"

This reverts commit a74fc481588fcea9317cbf1f6c5888a30c9edd2d.

Revert "Wrap CfgTraitsFor in namespace llvm to please GCC 5"

This reverts commit f2a06875b604c00cbe96e54363f4f5d28935d610.

Revert "Try to make GCC5 happy about the CfgTraits thing"

This reverts commit 03a5f7ce12e2111c8b7bc5a95cff4c51b516250f.

Revert "Introduce CfgTraits abstraction"

This reverts commit c0cdd22c72fab47a3c37b5a8401763995cadaa77.

3 years agoRevert "DomTree: Extract (mostly) read-only logic into type-erased base classes"
Nicolai Hähnle [Tue, 27 Oct 2020 19:27:51 +0000 (20:27 +0100)]
Revert "DomTree: Extract (mostly) read-only logic into type-erased base classes"

This reverts commit 848a68a032d1c59274526abb3220714202d4757e.

3 years ago[llvm-reduce] Add test with some aliases.
Florian Hahn [Tue, 27 Oct 2020 19:03:19 +0000 (19:03 +0000)]
[llvm-reduce] Add test with some aliases.

3 years ago[mlir][Python] Custom python op view wrappers for building and traversing.
Stella Laurenzo [Thu, 22 Oct 2020 06:34:01 +0000 (23:34 -0700)]
[mlir][Python] Custom python op view wrappers for building and traversing.

* Still rough edges that need more sugar but the bones are there. Notes left in the test case for things that can be improved.
* Does not actually yield custom OpViews yet for traversing. Will rework that in a followup.

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

3 years ago[AMDGPU] Change predicate for fma/fmac legacy
Stanislav Mekhanoshin [Tue, 27 Oct 2020 17:00:53 +0000 (10:00 -0700)]
[AMDGPU] Change predicate for fma/fmac legacy

I do not exactly like the use of a negative predicate to
enable instructions' support. Change HasNoMadMacF32Insts
with HasFmaLegacy32.

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

3 years ago[PowerPC][PCRelative] Turn on TLS support for PCRel by default
Victor Huang [Tue, 27 Oct 2020 18:56:54 +0000 (13:56 -0500)]
[PowerPC][PCRelative] Turn on TLS support for PCRel by default

Turn on TLS support for PCRel by default and update the test cases.

Differential Revision: https://reviews.llvm.org/D88738
Reviewed by: stefanp, kamaub

3 years ago[libc++] Add a libc++ configuration that does not support localization
Louis Dionne [Fri, 9 Oct 2020 19:31:05 +0000 (15:31 -0400)]
[libc++] Add a libc++ configuration that does not support localization

When porting libc++ to embedded systems, it can be useful to drop support
for localization, which these systems don't implement or care about.

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

3 years agoFileManager: Shrink FileEntryRef to the size of a pointer
Duncan P. N. Exon Smith [Thu, 15 Oct 2020 15:39:07 +0000 (11:39 -0400)]
FileManager: Shrink FileEntryRef to the size of a pointer

Shrink `FileEntryRef` to the size of a pointer, by having it directly
reference the `StringMapEntry` the same way that `DirectoryEntryRef`
does. This makes `FileEntryRef::FileEntryRef` private as a side effect
(`FileManager` is a friend!).

There are two helper types added within `FileEntryRef`:

- `FileEntryRef::MapValue` is the type stored in
  `FileManager::SeenFileEntries`. It's a replacement for
  `SeenFileEntryOrRedirect`, where the second pointer type has been
  changed from `StringRef*` to `MapEntry*` (see next bullet).
- `FileEntryRef::MapEntry` is the instantiation of `StringMapEntry<>`
  where `MapValue` is stored. This is what `FileEntryRef` has a pointer
  to, in order to grab the name in addition to the value.

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

3 years ago[mlir] Add bufferization for std.select op.
Sean Silva [Tue, 27 Oct 2020 00:29:18 +0000 (17:29 -0700)]
[mlir] Add bufferization for std.select op.

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

3 years ago[AMDGPU] Fix check prefix for VOP3 VI disassembler tests
Jay Foad [Tue, 27 Oct 2020 15:14:12 +0000 (15:14 +0000)]
[AMDGPU] Fix check prefix for VOP3 VI disassembler tests

Also, following D81841, don't try to encode f16 literals in i16/u16
instructions.

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

3 years ago[mlir] Catch async.yield operands not matching the number of async.execute results.
Christian Sigg [Tue, 27 Oct 2020 08:45:55 +0000 (09:45 +0100)]
[mlir] Catch async.yield operands not matching the number of async.execute results.

Reviewed By: ezhulenev

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

3 years ago[libcxx] Fix typo in spelling of 'sentinel'. NFC.
Martin Storsjö [Tue, 27 Oct 2020 09:46:06 +0000 (11:46 +0200)]
[libcxx] Fix typo in spelling of 'sentinel'. NFC.

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

3 years ago[llvm-readobj] Remove duplicate inner if() condition. NFCI.
Simon Pilgrim [Tue, 27 Oct 2020 18:35:42 +0000 (18:35 +0000)]
[llvm-readobj] Remove duplicate inner if() condition. NFCI.

This should have been removed when rG445c3fdd2ae8 simplified the conditions.

Reported as "Snippet 5" in https://www.viva64.com/en/b/0771/

3 years agoRevert "[CodeView] Emit static data members as S_CONSTANTs."
Amy Huang [Tue, 27 Oct 2020 18:29:27 +0000 (11:29 -0700)]
Revert "[CodeView] Emit static data members as S_CONSTANTs."

Seems like there's an assert in here that we shouldn't be running into.

This reverts commit 515973222ed29abe49f241e89edb6854f44162d4.

3 years ago[gn build] Port 46c3d5cb05d
LLVM GN Syncbot [Tue, 27 Oct 2020 18:08:19 +0000 (18:08 +0000)]
[gn build] Port 46c3d5cb05d

3 years ago[amdgpu] Add the late codegen preparation pass.
Michael Liao [Fri, 22 May 2020 19:52:26 +0000 (15:52 -0400)]
[amdgpu] Add the late codegen preparation pass.

Summary:
- Teach that pass to widen naturally aligned but not DWORD aligned
  sub-DWORD loads.

Reviewers: rampitec, arsenm

Subscribers:

Tags: #llvm

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

3 years ago[X86] Regenerate scalar fptosi/fptoui tests. NFCI.
Simon Pilgrim [Tue, 27 Oct 2020 17:43:16 +0000 (17:43 +0000)]
[X86] Regenerate scalar fptosi/fptoui tests. NFCI.

Merge prefixes where possible, use 'X86' instead of 'X32' (which we try to only use for gnux32 triple tests).

3 years ago[libc++] Get rid of iostreams in the to_string tests
Louis Dionne [Tue, 27 Oct 2020 17:31:21 +0000 (13:31 -0400)]
[libc++] Get rid of iostreams in the to_string tests

3 years ago[VE] Add vector reduction instructions
Kazushi (Jam) Marukawa [Tue, 27 Oct 2020 12:03:17 +0000 (21:03 +0900)]
[VE] Add vector reduction instructions

Add VSUMS/VSUMX/VFSUM/VMAXS/VMAXX/VFMAX/VRAND/VROR/VRXOR isntructions.
Add regression tests too.

Reviewed By: simoll

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

3 years ago[Utils] Skip RemoveRedundantDbgInstrs in MergeBlockIntoPredecessor (PR47746)
Vedant Kumar [Tue, 6 Oct 2020 21:18:20 +0000 (14:18 -0700)]
[Utils] Skip RemoveRedundantDbgInstrs in MergeBlockIntoPredecessor (PR47746)

This patch changes MergeBlockIntoPredecessor to skip the call to
RemoveRedundantDbgInstrs, in effect partially reverting D71480 due to
some compile-time issues spotted in LoopUnroll and SimplifyCFG.

The call to RemoveRedundantDbgInstrs appears to have changed the
worst-case behavior of the merging utility. Loosely speaking, it seems
to have gone from O(#phis) to O(#insts).

It might not be possible to mitigate this by scanning a block to
determine whether there are any debug intrinsics to remove, since such a
scan costs O(#insts).

So: skip the call to RemoveRedundantDbgInstrs. There's surprisingly
little fallout from this, and most of it can be addressed by doing
RemoveRedundantDbgInstrs later. The exception is (the block-local
version of) SimplifyCFG, where it might just be too expensive to call
RemoveRedundantDbgInstrs.

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

3 years ago[ADT] Fix accidental pointer comparison in test
Sam McCall [Tue, 27 Oct 2020 17:11:45 +0000 (18:11 +0100)]
[ADT] Fix accidental pointer comparison in test

3 years ago[X86] Regenerate xor tests. NFCI.
Simon Pilgrim [Tue, 27 Oct 2020 16:06:19 +0000 (16:06 +0000)]
[X86] Regenerate xor tests. NFCI.

Merge prefixes where possible, use 'X86' instead of 'X32' (which we try to only use for gnux32 triple tests).

3 years ago[X86] Regenerate tbm intrinsics tests. NFCI.
Simon Pilgrim [Tue, 27 Oct 2020 15:25:50 +0000 (15:25 +0000)]
[X86] Regenerate tbm intrinsics tests. NFCI.

Merge prefixes where possible, use 'X86' instead of 'X32' (which we try to only use for gnux32 triple tests).

3 years ago[X86] Regenerate popcnt tests. NFCI.
Simon Pilgrim [Tue, 27 Oct 2020 14:40:52 +0000 (14:40 +0000)]
[X86] Regenerate popcnt tests. NFCI.

Merge prefixes where possible, use 'X86' instead of 'X32' (which we try to only use for gnux32 triple tests).

3 years ago[X86] Regenerate xop tests with common prefixes.
Simon Pilgrim [Tue, 27 Oct 2020 14:37:42 +0000 (14:37 +0000)]
[X86] Regenerate xop tests with common prefixes.

3 years ago[Flang][OpenMP 4.5] Add semantic check for OpenMP default clause
Yashaswini Hegde [Tue, 27 Oct 2020 16:23:52 +0000 (12:23 -0400)]
[Flang][OpenMP 4.5] Add semantic check for OpenMP default clause

3 years ago[libc++] Remove references to CONDUIT_TOKEN
Louis Dionne [Tue, 27 Oct 2020 16:24:57 +0000 (12:24 -0400)]
[libc++] Remove references to CONDUIT_TOKEN

It's not required anymore, since we rely on another job to report
the results back to Phabricator.

3 years ago[lldb] Support Python imports relative the to the current file being sourced
Jonas Devlieghere [Tue, 27 Oct 2020 16:14:40 +0000 (09:14 -0700)]
[lldb] Support Python imports relative the to the current file being sourced

Make it possible to use a relative path in command script import to the
location of the file being sourced. This allows the user to put Python
scripts next to LLDB command files and importing them without having to
specify an absolute path.

To enable this behavior pass `-c` to `command script import`. The
argument can only be used when sourcing the command from a file.

rdar://68310384

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

3 years ago[AMDGPU] Add llvm.amdgcn.div.scale with fneg tests
Jay Foad [Tue, 27 Oct 2020 13:15:21 +0000 (13:15 +0000)]
[AMDGPU] Add llvm.amdgcn.div.scale with fneg tests

3 years ago[clangd] Start using SyntaxTrees for folding ranges feature
Kirill Bobyrev [Tue, 27 Oct 2020 15:44:52 +0000 (16:44 +0100)]
[clangd] Start using SyntaxTrees for folding ranges feature

This is an initial attempt to start using Syntax Trees in clangd while improving state of folding ranges feature and experimenting with Syntax Tree capabilities.

Reviewed By: sammccall

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

3 years ago[AMDGPU] Add missing support for targets
Tony [Mon, 26 Oct 2020 01:16:59 +0000 (01:16 +0000)]
[AMDGPU] Add missing support for targets

- Add missing tests.

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

3 years agoRevert "Updating llvm.mlir test to match recent IR change"
Arthur Eubanks [Tue, 27 Oct 2020 15:35:18 +0000 (08:35 -0700)]
Revert "Updating llvm.mlir test to match recent IR change"

This reverts commit 0fc1aa22ee6ac337a5d51fa5666c9cd61da61b07.

3 years ago[lldb][NFC] Make GetResumeCountForLaunchInfo return an unsigned.
Raphael Isemann [Tue, 27 Oct 2020 11:39:44 +0000 (12:39 +0100)]
[lldb][NFC] Make GetResumeCountForLaunchInfo return an unsigned.

The number of resumes should always be positive to let's make this an
unsigned everywhere. Also remove the unused 'localhost' parameter from
ConvertArgumentsForLaunchingInShell.

3 years ago[libc++] Fix filesystem test in C++11/14
Louis Dionne [Tue, 27 Oct 2020 15:21:33 +0000 (11:21 -0400)]
[libc++] Fix filesystem test in C++11/14

Before C++17, std::string::data() was marked as const, so we can't use
it to write to the contents of the string.

3 years ago[AArch64] Add additional tests for vector inserts with common element.
Florian Hahn [Tue, 27 Oct 2020 12:54:21 +0000 (12:54 +0000)]
[AArch64] Add additional tests for vector inserts with common element.

3 years ago[lldb] Add llvm-pdbutil to lldb test dependencies
Raphael Isemann [Tue, 27 Oct 2020 14:44:24 +0000 (15:44 +0100)]
[lldb] Add llvm-pdbutil to lldb test dependencies

Since D89812 we use llvm-pdbutil in the LLDB tests but we didn't add it to
the test dependencies.

3 years ago[lldb] [Process/FreeBSD] Fix missing namespace qualifier
Michał Górny [Tue, 27 Oct 2020 13:15:01 +0000 (14:15 +0100)]
[lldb] [Process/FreeBSD] Fix missing namespace qualifier

Fixes e4cc6e9bcdff5fe979ab72025cb803d723cd9c31

3 years ago[lldb] [Process/FreeBSDRemote] Enable watchpoint support
Michał Górny [Fri, 23 Oct 2020 16:08:56 +0000 (18:08 +0200)]
[lldb] [Process/FreeBSDRemote] Enable watchpoint support

Replace the inline x86 watchpoint handling code with the reusable
NativeRegisterContextWatchpoint_x86.  Implement watchpoint support
in NativeThreadFreeBSD and SIGTRAP handling for watchpoints.

Un-skip all concurrent_events tests as they pass with the new plugin.

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

3 years agoRevert "[IndVars] Remove monotonic checks with unknown exit count"
Raphael Isemann [Tue, 27 Oct 2020 12:37:23 +0000 (13:37 +0100)]
Revert "[IndVars] Remove monotonic checks with unknown exit count"

This reverts commit c6ca26c0bfedb8f80d6f8cb9adde25b1d6aac1c5.
This breaks stage2 builds due to hitting this assert:
```
   Assertion failed: (WeightSum <= UINT32_MAX && "Expected weights to scale down to 32 bits"), function calcMetadataWeights
```
when compiling AArch64RegisterBankInfo.cpp in LLVM.

3 years agoRevert "[NFC] Factor away lambda's redundant parameter"
Raphael Isemann [Tue, 27 Oct 2020 12:37:16 +0000 (13:37 +0100)]
Revert "[NFC] Factor away lambda's redundant parameter"

This reverts commit fdc845b36130d162e5a66e427bf69b2c37b6c6bb.
It seems to be a follow-up to c6372b3fb495 which will be reverted.

3 years agoFix use-after-scope introduced in 850325348ae82cd5e26ea9edfd04219d0fbe7828
Alex Richardson [Tue, 27 Oct 2020 14:26:23 +0000 (14:26 +0000)]
Fix use-after-scope introduced in 850325348ae82cd5e26ea9edfd04219d0fbe7828

3 years ago[amdgpu] Enable use of AA during codegen.
Michael Liao [Mon, 12 Oct 2020 03:51:53 +0000 (23:51 -0400)]
[amdgpu] Enable use of AA during codegen.

- Add an internal option `-amdgpu-use-aa-in-codegen` to enable or
  disable this feature. By Default, it's enabled.

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

3 years agoRevert rG0905bd5c2fa42bd4c "[InstCombine] collectBitParts - add trunc support."
Simon Pilgrim [Tue, 27 Oct 2020 13:43:29 +0000 (13:43 +0000)]
Revert rG0905bd5c2fa42bd4c "[InstCombine] collectBitParts - add trunc support."

This reverts commit 0905bd5c2fa42bd4c0e6e0aaa08b966f165b9dfa.

Causing failures in multistage buildbots that I need to investigate

3 years ago[X86] Don't crash on CVTPS2PH with wide vector inputs.
Benjamin Kramer [Tue, 27 Oct 2020 13:34:26 +0000 (14:34 +0100)]
[X86] Don't crash on CVTPS2PH with wide vector inputs.

3 years ago[X86] Regenerate all-ones vector tests with common prefixes.
Simon Pilgrim [Tue, 27 Oct 2020 13:35:00 +0000 (13:35 +0000)]
[X86] Regenerate all-ones vector tests with common prefixes.

3 years agoRevert "Use uint64_t for branch weights instead of uint32_t"
Nico Weber [Tue, 27 Oct 2020 13:18:42 +0000 (09:18 -0400)]
Revert "Use uint64_t for branch weights instead of uint32_t"

This reverts commit e5766f25c62c185632e3a75bf45b313eadab774b.
Makes clang assert when building Chromium, see https://crbug.com/1142813
for a repro.

3 years ago[clang] RewriteObjCClassMetaData - remove superfluous null pointer check. NFCI.
Simon Pilgrim [Tue, 27 Oct 2020 13:14:40 +0000 (13:14 +0000)]
[clang] RewriteObjCClassMetaData - remove superfluous null pointer check. NFCI.

We've already dereferenced the pointer and no other getClassInterface() calls appear to bother with such a check.

Reported as "Snippet 6" in https://www.viva64.com/en/b/0771/

3 years ago[MallocChecker] Remove duplicate QCoreApplication::postEvent check. NFCI.
Simon Pilgrim [Tue, 27 Oct 2020 12:21:33 +0000 (12:21 +0000)]
[MallocChecker] Remove duplicate QCoreApplication::postEvent check. NFCI.

This appears to have been in the original patch in D14170.

Reported as "Snippet 11" in https://www.viva64.com/en/b/0771/

3 years ago[X86] Regenerate vector shift tests. NFCI.
Simon Pilgrim [Tue, 27 Oct 2020 12:13:53 +0000 (12:13 +0000)]
[X86] Regenerate vector shift tests. NFCI.

Merge prefixes where possible, use 'X86' instead of 'X32' (which we try to only use for gnux32 triple tests).

3 years ago[InstCombine] collectBitParts - add trunc support.
Simon Pilgrim [Mon, 26 Oct 2020 16:22:46 +0000 (16:22 +0000)]
[InstCombine] collectBitParts - add trunc support.

This should allow us to remove the rather limited matchOrConcat fold and just use recognizeBSwapOrBitReverseIdiom.

3 years agoFix for PR47544. Clang is crashing after generating the right
Zahira Ammarguellat [Tue, 27 Oct 2020 12:51:02 +0000 (05:51 -0700)]
Fix for PR47544. Clang is crashing after generating the right
diagnostic for a re-declaration of a friend method.d
https://reviews.llvm.org/D88112

3 years ago[NFC][IntrRefLDV] Some code clean up
Djordje Todorovic [Mon, 26 Oct 2020 14:04:14 +0000 (07:04 -0700)]
[NFC][IntrRefLDV] Some code clean up

As reading the source code, I've found some minor nits:
  -Use using instead of typedef
  -Fix a comment
  -Refactor

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

3 years ago[TargetLowering] Add i1 condition for bit comparison fold
Sven van Haastregt [Tue, 27 Oct 2020 12:21:40 +0000 (12:21 +0000)]
[TargetLowering] Add i1 condition for bit comparison fold

For i1 types, boolean false is represented identically regardless of
the boolean content, so we can allow optimizations that otherwise
would not be correct for booleans with false represented as a negative
one.

Patch by Erik Hogeman.

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

3 years ago[gn build] Port 850325348ae
LLVM GN Syncbot [Tue, 27 Oct 2020 12:17:41 +0000 (12:17 +0000)]
[gn build] Port 850325348ae

3 years agoFix sancov.py when objdump is llvm-objdump
Alex Richardson [Tue, 27 Oct 2020 10:07:27 +0000 (10:07 +0000)]
Fix sancov.py when objdump is llvm-objdump

The sanitizer-coverage.cpp test case was always failing for me. It turns
out the reason for this is that I was building with
-DLLVM_INSTALL_BINUTILS_SYMLINKS=ON and sancov.py's grep regex does not
handle llvm-objdump's disassembly format (hex immediates have a leading "0x").
While touching those lines also change them to use raw string literals since
invalid escape sequnces will become an error in future python versions.
Also simplify the code by using subprocess.check_output() instead of Popen().
This also works with python2.

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

Reviewed By: #sanitizers, vitalybuka

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

3 years ago[clang-format] Fix misformatted macro definitions after D86959
Alex Richardson [Tue, 27 Oct 2020 10:05:55 +0000 (10:05 +0000)]
[clang-format] Fix misformatted macro definitions after D86959

After D86959 the code `#define lambda [](const decltype(x) &ptr) {}`
was formatted as `#define lambda [](const decltype(x) & ptr) {}` due to
now parsing the '&' token as a BinaryOperator. The problem was caused by
the condition `Line.InPPDirective && (!Left->Previous || !Left->Previous->is(tok::identifier))) {`
being matched and therefore not performing the checks for "previous token
is one of decltype/_Atomic/etc.". This patch moves those checks after the
existing if/else chain to ensure the left-parent token classification is
always run after checking whether the contents of the parens is an
expression or not.

This change also introduces a new TokenAnnotatorTest that checks the
token kind and Role of Tokens after analyzing them. This is used to check
for TT_PointerOrReference, in addition to indirectly testing this based
on the resulting formatting.

Reviewed By: MyDeveloperDay

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

3 years ago[ValueTracking][NFC] Use Log2(Align) instead of countTrailingZeroes
Alex Richardson [Tue, 27 Oct 2020 09:56:19 +0000 (09:56 +0000)]
[ValueTracking][NFC] Use Log2(Align) instead of countTrailingZeroes

The latter can probably be optimized to the same final code, but this might
help -O0 builds.

3 years ago[ValueTracking] Add more tests for alignment assume bundles
Alex Richardson [Tue, 20 Oct 2020 10:41:54 +0000 (11:41 +0100)]
[ValueTracking] Add more tests for alignment assume bundles

I noticed that alignment was no longer inferred as well after I last merged
our CHERI fork from upstream. I opened this review before seeing that D88669
already fixes the same problem, so this commit simply adds the new test that
I added as part of this change.

Reviewed By: jdoerfert

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

3 years ago[ValueTracking] Add tracking of the alignment assume bundle
Shimin Cui [Tue, 27 Oct 2020 09:49:41 +0000 (09:49 +0000)]
[ValueTracking] Add tracking of the alignment assume bundle

This patch is to add the support of the value tracking of the alignment assume bundle.

Reviewed By: jdoerfert

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

3 years agomsgpack: Improve error for empty node
Sebastian Neubauer [Tue, 27 Oct 2020 10:30:01 +0000 (11:30 +0100)]
msgpack: Improve error for empty node

3 years ago[lldb] Correct vFile:pread/pwrite packet docs
David Spickett [Wed, 14 Oct 2020 11:18:05 +0000 (12:18 +0100)]
[lldb] Correct vFile:pread/pwrite packet docs

The statement that lldb-server can handle
decimal and hex numbers is misleading.
(it can only handle hex with 0x prefix)

Mentioning non decimal numbers at all
is just creating more confusion for anyone
who tries to use them with lldb-server.

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

3 years ago[InstCombine] Fold `(X >>? C1) << C2` patterns to shift+bitmask (PR37872)
Roman Lebedev [Tue, 27 Oct 2020 09:17:53 +0000 (12:17 +0300)]
[InstCombine] Fold `(X >>? C1) << C2` patterns to shift+bitmask (PR37872)

This is essentially finalizes a revert of rL155136,
because nowadays the situation has improved, SCEV can model
all these patterns well, and we canonicalize rotate-like patterns
into a funnel shift intrinsics in InstCombine.
So this should not cause any pessimization.

I've verified the canonicalize-{a,l}shr-shl-to-masking.ll transforms
with alive, which confirms that we can freely preserve exact-ness,
and no-wrap flags.

Profs:
* base: https://rise4fun.com/Alive/gPQ
* exact-ness preservation: https://rise4fun.com/Alive/izi
* nuw preservation: https://rise4fun.com/Alive/DmD
* nsw preservation: https://rise4fun.com/Alive/SLN6N
* nuw nsw preservation: https://rise4fun.com/Alive/Qp7

Refs. https://reviews.llvm.org/D46760