platform/upstream/llvm.git
4 years ago[InstSimplify] add tests for maxnum (PR46627); NFC
Sanjay Patel [Fri, 10 Jul 2020 22:56:26 +0000 (18:56 -0400)]
[InstSimplify] add tests for maxnum (PR46627); NFC

4 years agoFix nesting of #ifdef
Adrian Prantl [Sat, 11 Jul 2020 00:09:39 +0000 (17:09 -0700)]
Fix nesting of #ifdef

This fixes a compile error when building for an arm64 host.

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

4 years ago[openmp] Remove OMPConstants.cpp and replace it by OMP.cpp generated by tablegen
Valentin Clement [Sat, 11 Jul 2020 00:11:11 +0000 (20:11 -0400)]
[openmp] Remove OMPConstants.cpp and replace it by OMP.cpp generated by tablegen

Summary:
Diff D83176 moved the last piece of code from OMPConstants.cpp and now this file was only
useful to include the tablegen generated file. This patch replace OMPConstants.cpp with OMP.cpp
generated by tablegen.

Reviewers: sstefan1, jdoerfert, jdenny

Reviewed By: sstefan1

Subscribers: mgorny, yaxunl, hiraditya, guansong, llvm-commits

Tags: #llvm

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

4 years ago[OpenMP][NFC] Remove unused and untested code from the device runtime
Johannes Doerfert [Tue, 7 Jul 2020 21:44:33 +0000 (16:44 -0500)]
[OpenMP][NFC] Remove unused and untested code from the device runtime

Summary:
We carried a lot of unused and untested code in the device runtime.
Among other reasons, we are planning major rewrites for which reduced
size is going to help a lot.

The number of code lines reduced by 14%!

Before:
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
CUDA                            13            489            841           2454
C/C++ Header                    14            322            493           1377
C                               12            117            124            559
CMake                            4             64             64            262
C++                              1              6              6             39
-------------------------------------------------------------------------------
SUM:                            44            998           1528           4691
-------------------------------------------------------------------------------

After:
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
CUDA                            13            366            733           1879
C/C++ Header                    14            317            484           1293
C                               12            117            124            559
CMake                            4             64             64            262
C++                              1              6              6             39
-------------------------------------------------------------------------------
SUM:                            44            870           1411           4032
-------------------------------------------------------------------------------

Reviewers: hfinkel, jhuber6, fghanim, JonChesterfield, grokos, AndreyChurbanov, ye-luo, tianshilei1992, ggeorgakoudis, Hahnfeld, ABataev, hbae, ronlieb, gregrodgers

Subscribers: jvesely, yaxunl, bollu, guansong, jfb, sstefan1, aaron.ballman, openmp-commits, cfe-commits

Tags: #clang, #openmp

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

4 years ago[COFF] Add cg_profile directive and .llvm.call-graph-profile section
Zequan Wu [Fri, 26 Jun 2020 03:35:03 +0000 (20:35 -0700)]
[COFF] Add cg_profile directive and .llvm.call-graph-profile section

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "[lldb-vscode] Fix TestVSCode_module"
Walter Erquinigo [Sat, 11 Jul 2020 00:05:23 +0000 (17:05 -0700)]
Revert "[lldb-vscode] Fix TestVSCode_module"
This reverts commit 881af6eb0030986876d3b80668193e5c3c04a87c.

Revert "[lldb-vscode] Add Compile Unit List to Modules View"
This reverts commit 03ef61033ff5e1e40518f14f642e4ad8d686974c.

Revert "[lldb-vscode] Add Support for Module Event"
This reverts commit f7f80159753ba725f7e32529fcc369bc358efbb3.

The debian buildbot has reported issues with the modules test.
http://lab.llvm.org:8011/builders/lldb-x86_64-debian/builds/13767/steps/test/logs/stdio

Reverting it for now.

4 years ago[BPI] Compile time improvement when erasing blocks (NFC)
Teresa Johnson [Fri, 10 Jul 2020 22:25:27 +0000 (15:25 -0700)]
[BPI] Compile time improvement when erasing blocks (NFC)

Summary:
eraseBlock is trying to erase all probability info for the given BB.
This info is stored in a DenseMap organized like so:
   using Edge = std::pair<const BasicBlock *, unsigned>;
   DenseMap<Edge, BranchProbability> Probs;
where the unsigned in the Edge key is the successor id.

It was walking through every single map entry, checking if the BB in the
key's pair matched the given BB. Much more efficient is to do what
another method (getEdgeProbability) was already doing, which is to walk
the successors of the BB, and simply do a map lookup on the key formed
from each <BB, successor id> pair.

Doing this dropped the overall compile time for a file containing a
very large function by around 32%.

Reviewers: davidxl, xur

Subscribers: llvm-commits, hiraditya

Tags: #llvm

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

4 years ago[OpenMP] Use __OPENMP_NVPTX__ instead of _OPENMP in wrapper headers
Johannes Doerfert [Fri, 10 Jul 2020 22:11:29 +0000 (17:11 -0500)]
[OpenMP] Use __OPENMP_NVPTX__ instead of _OPENMP in wrapper headers

Due to recent changes we cannot use OpenMP in CUDA files anymore
(PR45533) as the math handling of CUDA is different when _OPENMP is
defined. We actually want this different behavior only if we are
offloading with OpenMP to NVIDIA, thus generating NVPTX. With this patch
we do not interfere with the CUDA math handling except if we are in
NVPTX offloading mode, as indicated by the presence of __OPENMP_NVPTX__.

Reviewed By: tra

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

4 years ago[lldb-vscode] Fix TestVSCode_module
Walter Erquinigo [Fri, 10 Jul 2020 23:32:22 +0000 (16:32 -0700)]
[lldb-vscode] Fix TestVSCode_module

For some reason this works on the original author's machine, but not on my. So I'm using a safer approach of using an unstripped dynamic library to place breakpoints on. The author was placing a breakpoint on the main symbol of a stripped library and for some reason it worked on their machine, but it shouldn't have...

Offender diff: D82477

4 years ago[lldb-vscode] Add Compile Unit List to Modules View
Yifan Shen [Fri, 10 Jul 2020 21:07:30 +0000 (14:07 -0700)]
[lldb-vscode] Add Compile Unit List to Modules View

Summary: User can expand and check compile unit list for the modules that have debug info.

Reviewers: wallace, clayborg

Reviewed By: clayborg

Subscribers: aprantl, lldb-commits

Tags: #lldb

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

4 years ago[lldb-vscode] Add Support for Module Event
Yifan Shen [Fri, 10 Jul 2020 21:07:18 +0000 (14:07 -0700)]
[lldb-vscode] Add Support for Module Event

Summary:
Whenever a module is created, removed or changed, lldb-vscode is now sending an event that can be interpreted by the IDE so that modules can be rendered in the IDE, like the tree view in this screenshot

{F12229758}

Reviewers: wallace, clayborg, kusmour, aadsm

Reviewed By: clayborg

Subscribers: cfe-commits, labath, lldb-commits

Tags: #lldb, #clang

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

4 years ago[Sanitizers] Change protoent test to check for IPv6 instead of RDP
Gui Andrade [Fri, 10 Jul 2020 23:49:40 +0000 (23:49 +0000)]
[Sanitizers] Change protoent test to check for IPv6 instead of RDP

Looks like RDP isn't present on some of LLVM's buildbot machines

4 years agoRevert "Re-land [CodeView] Add full repro to LF_BUILDINFO record"
Alexandre Ganea [Fri, 10 Jul 2020 23:45:01 +0000 (19:45 -0400)]
Revert "Re-land [CodeView] Add full repro to LF_BUILDINFO record"

This reverts commit add59ecb34e3003311b7e2318b16a0ef10c76d79 and 41d2813a5faea1c18b7d329109e0287c5cd9ffea.

4 years ago[libc] [Obvious] Remove unneeded header in strchr.
cgyurgyik [Fri, 10 Jul 2020 23:12:03 +0000 (19:12 -0400)]
[libc] [Obvious] Remove unneeded header in strchr.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

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

4 years agoRemove unnecessary/erroneous "static" from function templates in headers
David Blaikie [Thu, 9 Jul 2020 22:33:09 +0000 (15:33 -0700)]
Remove unnecessary/erroneous "static" from function templates in headers

This risks ODR violations in inline functions that call these functions
(if they remain static) & otherwise just causes some object size
increase, potentially, by these functions not being deduplicated by the
linker.

4 years ago[PDB] Attempt fix for debug-info-codeview-buildinfo.c test
Alexandre Ganea [Fri, 10 Jul 2020 22:52:19 +0000 (18:52 -0400)]
[PDB] Attempt fix for debug-info-codeview-buildinfo.c test

This is a bit a shot in the dark, as it doesn't occur on my Windows 10 machines, nor on x64 Linux Ubuntu 18.04.
This patch tries to fix the following kind of error:
- http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/31511/steps/cmake%20stage%201/logs/stdio
- http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/25150/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Adebug-info-codeview-buildinfo.c
- http://lab.llvm.org:8011/builders/fuchsia-x86_64-linux/builds/7947/steps/check/logs/stdio

4 years ago[docs] LLVM Security Group and Process
JF Bastien [Fri, 15 Nov 2019 18:54:39 +0000 (10:54 -0800)]
[docs] LLVM Security Group and Process

Summary:
See the corresponding RFC on llvm-dev for a discussion of this proposal.
  http://lists.llvm.org/pipermail/llvm-dev/2019-November/136839.html

Subscribers: jkorous, dexonsmith, arphaman, ributzka, llvm-commits

Tags: #llvm

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

4 years agoTemporarily revert "[NFC] Separate bitcode reading for FUNC_CODE_INST_CMPXCHG(_OLD)"
Eric Christopher [Fri, 10 Jul 2020 22:10:52 +0000 (15:10 -0700)]
Temporarily revert "[NFC] Separate bitcode reading for FUNC_CODE_INST_CMPXCHG(_OLD)"
as it wasn't NFC and is causing issues with thinlto bitcode reading.

I've followed up offline with reproduction instructions and testcases.

This reverts commit 30582457b47004dec8a78144abc919a13ccbd08c.

4 years agoAMDGPU: Remove .value_type from kernel metadata
Matt Arsenault [Mon, 29 Jun 2020 21:02:10 +0000 (17:02 -0400)]
AMDGPU: Remove .value_type from kernel metadata

This doesn't appear used for anything, and is emitted incorrectly
based on the description. This also depends on the IR type, and
pointee element type.

4 years ago[X86] Add isel patterns for matching broadcast vpternlog if the ternlog and the broad...
Craig Topper [Fri, 10 Jul 2020 22:15:01 +0000 (15:15 -0700)]
[X86] Add isel patterns for matching broadcast vpternlog if the ternlog and the broadcast have different types.

4 years ago[mlir][linalg] Improve aliasing approximation for hoisting transfer read/write
Thomas Raoux [Fri, 10 Jul 2020 21:55:04 +0000 (14:55 -0700)]
[mlir][linalg] Improve aliasing approximation for hoisting transfer read/write

Improve the logic deciding if it is safe to hoist vector transfer read/write
out of the loop. Change the logic to prevent hoisting operations if there are
any unknown access to the memref in the loop no matter where the operation is.
For other transfer read/write in the loop check if we can prove that they
access disjoint memory and ignore them in this case.

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

4 years ago[Polly] Fix prevectorization of fused loops.
Michael Kruse [Fri, 10 Jul 2020 21:11:19 +0000 (16:11 -0500)]
[Polly] Fix prevectorization of fused loops.

The schedule of a fused loop has one isl_space per statement, such that
a conversion to a isl_map fails. However, the prevectorization is
interested in the schedule space only: Converting to the non-union
representation only after extracting the schedule range fixes the problem.

This fixes llvm.org/PR46578

4 years ago[Polly] Fix -polly-opt-isl -analyze
Michael Kruse [Fri, 10 Jul 2020 21:05:42 +0000 (16:05 -0500)]
[Polly] Fix -polly-opt-isl -analyze

The member LastSchedule was never set, such that printScop would always
print "n/a" instead of the last schedule.

To ensure that the isl_ctx lives as least as long as the stored
schedule, also store a shared_ptr.

Also set the schedule tree output style to ISL_YAML_STYLE_BLOCK to avoid
printing everything on a single line.

`opt -polly-opt-isl -analyze` will be used in the next commit.

4 years ago[clang-shlib] Don't link with static clang libraries
Tom Stellard [Fri, 10 Jul 2020 15:44:28 +0000 (08:44 -0700)]
[clang-shlib] Don't link with static clang libraries

Summary:
If we are building static libraries we don't need to link them into
clang-shlib, since clang-shlib already has all the individual object
files linked in.

Reviewers: smeenai

Reviewed By: smeenai

Subscribers: mgorny, cfe-commits, llvm-commits

Tags: #clang

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

4 years ago[FileCheck] Fix up -dump-input* docs
Joel E. Denny [Fri, 10 Jul 2020 21:13:25 +0000 (17:13 -0400)]
[FileCheck] Fix up -dump-input* docs

In FileCheck.rst, add `-dump-input-context` and `-dump-input-filter`,
and fix some `-dump-input` documentation.

In `FileCheck -help`, `cl::value_desc("kind")` is being ignored for
`-dump-input-filter`, so just drop it.

Extend `-dump-input=help` to mention FILECHECK_OPTS.

4 years ago[mlir][Vector] Add folding for vector.transfer ops
Nicolas Vasilache [Fri, 10 Jul 2020 20:47:51 +0000 (16:47 -0400)]
[mlir][Vector]  Add folding for vector.transfer ops

This revision folds vector.transfer operations by updating the `masked` bool array attribute when more unmasked dimensions can be discovered.

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

4 years ago[analyzer] Silence a warning.
Artem Dergachev [Fri, 10 Jul 2020 18:56:06 +0000 (11:56 -0700)]
[analyzer] Silence a warning.

An old clang warns that the const object has no default constructor so it may
remain uninitialized forever. That's a false alarm because all fields
have a default initializer. Apply the suggested fixit anyway.

4 years ago[mlir] [VectorOps] Merge OUTER/AXPY vector.contract lowering into single case
aartbik [Fri, 10 Jul 2020 20:11:52 +0000 (13:11 -0700)]
[mlir] [VectorOps] Merge OUTER/AXPY vector.contract lowering into single case

We temporarily had separate OUTER lowering (for matmat flavors) and
AXPY lowering (for matvec flavors). With the new generalized
"vector.outerproduct" semantics, these cases can be merged into
a single lowering method. This refactoring will simplify future
decisions on cost models and lowering heuristics.

Reviewed By: nicolasvasilache

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

4 years agoChange behavior with zero-sized static array extents
Aaron Ballman [Fri, 10 Jul 2020 19:54:57 +0000 (15:54 -0400)]
Change behavior with zero-sized static array extents

Currently, Clang previously diagnosed this code by default:
  void f(int a[static 0]);
saying that "static has no effect on zero-length arrays", which was
accurate.

However, static array extents require that the caller of the function
pass a nonnull pointer to an array of *at least* that number of
elements, but it can pass more (see C17 6.7.6.3p6). Given that we allow
zero-sized arrays as a GNU extension and that it's valid to pass more
elements than specified by the static array extent, we now support
zero-sized static array extents with the usual semantics because it can
be useful in cases like:

  void my_bzero(char p[static 0], int n);
  my_bzero(&c+1, 0); //ok
  my_bzero(t+k,n-k); //ok, pattern from actual code

4 years agoReland [NFC] Derive from PassInfoMixin for no-op/printing passes
Arthur Eubanks [Thu, 9 Jul 2020 23:49:48 +0000 (16:49 -0700)]
Reland [NFC] Derive from PassInfoMixin for no-op/printing passes

PassInfoMixin should be used for all NPM passes, rater than a custom
`name()`.

This caused ambiguous references in LegacyPassManager.cpp, so had to
remove "using namespace llvm::legacy" and move some things around.

Reviewed By: ychen, asbirlea

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

4 years ago[ldb/Reproducers] Add YamlRecorder and MultiProvider
Jonas Devlieghere [Fri, 10 Jul 2020 19:45:38 +0000 (12:45 -0700)]
[ldb/Reproducers] Add YamlRecorder and MultiProvider

This patch does several things that are all closely related:

 - It introduces a new YamlRecorder as a counterpart to the existing
   DataRecorder. As the name suggests the former serializes data as yaml
   while the latter uses raw texts or bytes.

 - It introduces a new MultiProvider base class which can be backed by
   either a DataRecorder or a YamlRecorder.

 - It reimplements the CommandProvider in terms of the new
   MultiProvider.

Finally, it adds unit testing coverage for the MultiProvider, a naive
YamlProvider built on top of the new YamlRecorder and the existing
MutliLoader.

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

4 years ago[AST][ObjC] Fix crash when printing invalid objc categories
David Goldman [Thu, 9 Jul 2020 21:32:05 +0000 (17:32 -0400)]
[AST][ObjC] Fix crash when printing invalid objc categories

Summary:
If no valid interface definition was found previously we would crash.

With this change instead we just print `<<error-type>>` in place
of the NULL interface. In the future this could be improved by
saving the invalid interface's name and using that.

Reviewers: sammccall, gribozavr

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[mlir] [VectorOps] Allow AXPY to be expressed as special case of OUTERPRODUCT
aartbik [Fri, 10 Jul 2020 19:23:03 +0000 (12:23 -0700)]
[mlir] [VectorOps] Allow AXPY to be expressed as special case of OUTERPRODUCT

This specialization allows sharing more code where an AXPY follows naturally
in cases where an OUTERPRODUCT on a scalar would be generated.

Reviewed By: nicolasvasilache

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

4 years agoAArch64: Fix unused variables
Matt Arsenault [Fri, 10 Jul 2020 18:27:24 +0000 (14:27 -0400)]
AArch64: Fix unused variables

4 years ago[lldb] on s390x fix override issue
Konrad Kleine [Fri, 10 Jul 2020 18:47:00 +0000 (14:47 -0400)]
[lldb] on s390x fix override issue

Summary:
This fixes an override issue by marking a function as const so that the
signature maps to the signature of the function in the base class.

This is the original error:

In file included from /root/llvm/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp:11:
/root/llvm/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h:79:10: error: 'size_t lldb_private::process_linux::NativeRegisterContextLinux_s390x::GetGPRSize()' marked 'override', but does not override
   79 |   size_t GetGPRSize() override { return sizeof(m_regs); }
      |          ^~~~~~~~~~

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[Sema] Emit a -Wformat warning for printf("%s", (void*)p)
Erik Pilkington [Fri, 10 Jul 2020 17:22:11 +0000 (13:22 -0400)]
[Sema] Emit a -Wformat warning for printf("%s", (void*)p)

Its dangerous to assume that the opaque pointer points to a null-terminated
string, and this has an easy fix (casting to char*).

rdar://62432331

4 years ago[PredicateInfo] Add test for multiple branches on same condition (NFC)
Nikita Popov [Fri, 10 Jul 2020 18:58:09 +0000 (20:58 +0200)]
[PredicateInfo] Add test for multiple branches on same condition (NFC)

This illustrates a case where RenamedOp does not correspond to the
value used in the condition, which it ideally should.

4 years ago[NFC] Separate Peeling Properties into its own struct (re-land after minor fix)
Sidharth Baveja [Fri, 10 Jul 2020 18:38:08 +0000 (18:38 +0000)]
[NFC] Separate Peeling Properties into its own struct (re-land after minor fix)

Summary:
This patch separates the peeling specific parameters from the UnrollingPreferences,
and creates a new struct called PeelingPreferences. Functions which used the
UnrollingPreferences struct for peeling have been updated to use the PeelingPreferences struct.

Author: sidbav (Sidharth Baveja)

Reviewers: Whitney (Whitney Tsang), Meinersbur (Michael Kruse), skatkov (Serguei Katkov), ashlykov (Arkady Shlykov), bogner (Justin Bogner), hfinkel (Hal Finkel), anhtuyen (Anh Tuyen Tran), nikic (Nikita Popov)

Reviewed By: Meinersbur (Michael Kruse)

Subscribers: fhahn (Florian Hahn), hiraditya (Aditya Kumar), llvm-commits, LLVM

Tag: LLVM

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

4 years ago[libc] Add strchr implementation. Fixes bug in memchr.
cgyurgyik [Fri, 10 Jul 2020 18:28:20 +0000 (14:28 -0400)]
[libc] Add strchr implementation. Fixes bug in memchr.

Summary: [libc] Adds strchr implementation with unit tests. Fixes signed character bug in memchr.

Reviewers: sivachandra, PaulkaToast

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

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

4 years ago[PowerPC] Enable default support of quad precision operations
Lei Huang [Wed, 8 Jul 2020 22:07:34 +0000 (17:07 -0500)]
[PowerPC] Enable default support of quad precision operations

Summary: Remove option guarding support of quad precision operations.

Reviewers: nemanjai, #powerpc, steven.zhang

Reviewed By: nemanjai, #powerpc, steven.zhang

Subscribers: qiucf, wuzish, nemanjai, hiraditya, kbarton, shchenz, llvm-commits

Tags: #llvm

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

4 years agoRevert "[NFC] Derive from PassInfoMixin for no-op/printing passes"
Davide Italiano [Fri, 10 Jul 2020 18:16:33 +0000 (11:16 -0700)]
Revert "[NFC] Derive from PassInfoMixin for no-op/printing passes"

This reverts commit 8039d2c3bf14585ef37dc9343bf393ecad9aead9 as
it breaks the modules build on macOS.

4 years agoThis is a refinement on 96601ec28b7efe5abf3479a1aa91bcedb235bbbd. The intent of that...
Jim Ingham [Fri, 10 Jul 2020 18:10:56 +0000 (11:10 -0700)]
This is a refinement on 96601ec28b7efe5abf3479a1aa91bcedb235bbbd. The intent of that change was to do the same work for the computation of the locations of the children of ValueObjectVariable as was done for the root ValueObjectVariable. This original patch did that by moving the computation from ValueObjectVariable to ValueObject. That fixed the problem but caused a handful of swift-lldb testsuite failures and a crash or two.

The problem is that synthetic value objects can sometimes represent objects in target memory, and other times they might be made up wholly in lldb memory, with pointers from one synthetic object to another, and so the ValueObjectVariable computation was not appropriate.

This patch delegates the computation to the root of the ValueObject in question. That solves the problem for ValueObjectVariable while not messing up the computation for ValueObjectConstResult or ValueObjectSynthetic.

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

4 years ago[OpenCL] Fixed typo for ctor stub name in UsersManual
Anastasia Stulova [Fri, 10 Jul 2020 18:04:49 +0000 (19:04 +0100)]
[OpenCL] Fixed typo for ctor stub name in UsersManual

4 years agoRe-land [CodeView] Add full repro to LF_BUILDINFO record
Alexandre Ganea [Fri, 10 Jul 2020 16:47:58 +0000 (12:47 -0400)]
Re-land [CodeView] Add full repro to LF_BUILDINFO record

This patch adds some missing information to the LF_BUILDINFO which allows for rebuilding an .OBJ without any external dependency but the .OBJ itself (other than the compiler executable).

Some tools need this information to reproduce a build without any knowledge of the build system. The LF_BUILDINFO therefore stores a full path to the compiler, the PWD (which is the CWD at program startup), a relative or absolute path to the TU, and the full CC1 command line. The command line needs to be freestanding (not depend on any environment variable). In the same way, MSVC doesn't store the provided command-line, but an expanded version (somehow their equivalent of CC1) which is also freestanding.

For more information see PR36198 and D43002.

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

4 years ago[IR] Disable select ? C : undef -> C fold in ConstantFoldSelectInstruction unless...
Craig Topper [Fri, 10 Jul 2020 17:41:46 +0000 (10:41 -0700)]
[IR] Disable select ? C : undef -> C fold in ConstantFoldSelectInstruction unless we know C isn't poison.

This matches the recent change to InstSimplify from D83440.

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

4 years ago[ARM] Add Cortex-A78 and Cortex-X1 Support for Clang and LLVM
Luke Geeson [Wed, 1 Jul 2020 11:50:36 +0000 (12:50 +0100)]
[ARM] Add Cortex-A78 and Cortex-X1 Support for Clang and LLVM

This patch upstreams support for the Arm-v8 Cortex-A78 and Cortex-X1
processors for AArch64 and ARM.

In detail:
- Adding cortex-a78 and cortex-x1 as cpu options for aarch64 and arm targets in clang
- Adding Cortex-A78 and Cortex-X1 CPU names and ProcessorModels in llvm

details of the CPU can be found here:
https://www.arm.com/products/cortex-x

https://www.arm.com/products/silicon-ip-cpu/cortex-a/cortex-a78

The following people contributed to this patch:
- Luke Geeson
- Mikhail Maltsev

Reviewers: t.p.northover, dmgreen

Reviewed By: dmgreen

Subscribers: dmgreen, kristof.beyls, hiraditya, danielkiss, cfe-commits,
llvm-commits, miyuki

Tags: #clang, #llvm

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

4 years ago[CGProfile] Fix layering, IPO depends in Instrumentation.
Benjamin Kramer [Fri, 10 Jul 2020 17:13:47 +0000 (19:13 +0200)]
[CGProfile] Fix layering, IPO depends in Instrumentation.

4 years agoRevert "[compiler-rt] [test] Use the parent process env as base env in tests"
Sergej Jaskiewicz [Fri, 10 Jul 2020 17:01:50 +0000 (20:01 +0300)]
Revert "[compiler-rt] [test] Use the parent process env as base env in tests"

This reverts commit 5ab446cfe5503fd4431a94db4d741cf3b5fdcd15.

That commit caused memory sanitizer test failures on PowerPC buildbots

4 years agoRemove clang options that were added back when merging the TableGen files
Daniel Grumberg [Fri, 10 Jul 2020 16:54:44 +0000 (17:54 +0100)]
Remove clang options that were added back when merging the TableGen files

4 years agorepair standalone clang builds
Saleem Abdulrasool [Fri, 10 Jul 2020 16:33:54 +0000 (09:33 -0700)]
repair standalone clang builds

Add missing C++ language standard setup for clang standalone build.

Patch by Michele Scandale!

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

4 years agoUse FileRange::text instead of Lexer::getSpelling
Eduardo Caldas [Fri, 10 Jul 2020 09:23:09 +0000 (09:23 +0000)]
Use FileRange::text instead of Lexer::getSpelling

* as we are using them only for integer and floating literals they have
the same behavior
* FileRange::text is simpler to call and is within the context of
syntax trees

4 years agoAdd kinded UDL for raw literal operator and numeric literal operator template
Eduardo Caldas [Thu, 9 Jul 2020 15:49:15 +0000 (15:49 +0000)]
Add kinded UDL for raw literal operator and  numeric literal operator template

4 years agoFix crash on `user defined literals`
Eduardo Caldas [Mon, 15 Jun 2020 17:08:39 +0000 (17:08 +0000)]
Fix crash on `user defined literals`

Summary:
Given an UserDefinedLiteral `1.2_w`:
Problem: Lexer generates one Token for the literal, but ClangAST
references two source locations
Fix: Ignore the operator and interpret it as the underlying literal.
e.g.: `1.2_w` token generates syntax node IntegerLiteral(1.2_w)

Subscribers: cfe-commits

Tags: #clang

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

4 years ago [NFC][PowerPC] Add a new MIR file to test mi-peephole pass
Kang Zhang [Fri, 10 Jul 2020 16:08:07 +0000 (16:08 +0000)]
 [NFC][PowerPC] Add a new MIR file to test mi-peephole pass

4 years ago[Lexer] Fix missing coverage line after #endif
Zequan Wu [Thu, 9 Jul 2020 21:56:06 +0000 (14:56 -0700)]
[Lexer] Fix missing coverage line after #endif

Summary: bug reported here: https://bugs.llvm.org/show_bug.cgi?id=46660

Reviewers: vsk, efriedma, arphaman

Reviewed By: vsk

Subscribers: dexonsmith, cfe-commits

Tags: #clang

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

4 years ago[LPM] Port CGProfilePass from NPM to LPM
Zequan Wu [Wed, 8 Jul 2020 19:30:28 +0000 (12:30 -0700)]
[LPM] Port CGProfilePass from NPM to LPM

Reviewers: hans, chandlerc!, asbirlea, nikic

Reviewed By: hans, nikic

Subscribers: steven_wu, dexonsmith, nikic, echristo, void, zhizhouy, cfe-commits, aeubanks, MaskRay, jvesely, nhaehnle, hiraditya, kerbowa, llvm-commits

Tags: #llvm, #clang

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

4 years agoRevert "[OpenMPOpt] ICV Tracking"
Roman Lebedev [Fri, 10 Jul 2020 15:54:48 +0000 (18:54 +0300)]
Revert "[OpenMPOpt] ICV Tracking"

There appears to be some kind of memory corruption/use-after-free/etc
going on here. In particular, in `OpenMPOpt::deleteParallelRegions()`,
in `DeleteCallCB()`, `CI` is garbage.

WIll post reproducer in the original review.

This reverts commit 6c4a5e9257bac022ffe60e466686ba7fc96ffd1a.

4 years agoDelete CC1Options.td, since it should have happened in D82574
Daniel Grumberg [Fri, 10 Jul 2020 15:11:54 +0000 (16:11 +0100)]
Delete CC1Options.td, since it should have happened in D82574

4 years ago[ARM] Pass -verify-machineinstr to test and XFAIL until fixed.
Florian Hahn [Fri, 10 Jul 2020 15:43:35 +0000 (16:43 +0100)]
[ARM] Pass -verify-machineinstr to test and XFAIL until fixed.

Some bots run with -verify-machineinstr enabled. Add it to the new test
and XFAIL it until fixed.

4 years ago[Attributor][NFC] Update tests after recent changes
Johannes Doerfert [Fri, 10 Jul 2020 15:37:31 +0000 (10:37 -0500)]
[Attributor][NFC] Update tests after recent changes

Attributor tests are mostly updated using the auto upgrade scripts but
sometimes we forget. If we do it manually or continue using old check
lines that still match we see unrelated changes down the line. This is
just a cleanup.

4 years ago[DomTreeUpdater] Use const auto * when iterating over pointers (NFC).
Florian Hahn [Fri, 10 Jul 2020 15:39:15 +0000 (16:39 +0100)]
[DomTreeUpdater] Use const auto * when iterating over pointers (NFC).

This silences the warning below:

llvm-project/llvm/lib/Analysis/DomTreeUpdater.cpp:510:20: warning: loop variable 'BB' is always a copy because the range of type 'const SmallPtrSet<llvm::BasicBlock *, 8>' does not return a reference [-Wrange-loop-analysis]
  for (const auto &BB : DeletedBBs) {
                   ^
llvm-project/llvm/lib/Analysis/DomTreeUpdater.cpp:510:8: note: use non-reference type 'llvm::BasicBlock *'
  for (const auto &BB : DeletedBBs) {
       ^~~~~~~~~~~~~~~~
1 warning generated.

4 years ago[ARM] Add test with tcreturn and debug value.
Florian Hahn [Fri, 10 Jul 2020 15:08:25 +0000 (16:08 +0100)]
[ARM] Add test with tcreturn and debug value.

In the attached test case, a non-terminator instruction (DBG_VALUE) is
inserted after a terminator, producing an invalid MBB.

4 years ago[AArch64][x86] add tests for rotated store merge; NFC
Sanjay Patel [Fri, 10 Jul 2020 00:03:49 +0000 (20:03 -0400)]
[AArch64][x86] add tests for rotated store merge; NFC

4 years ago[DAGCombiner] move/rename variables for readability; NFC
Sanjay Patel [Thu, 9 Jul 2020 21:49:14 +0000 (17:49 -0400)]
[DAGCombiner] move/rename variables for readability; NFC

4 years ago[mlir][Vector] Add ExtractOp folding when fed by a TransposeOp
Nicolas Vasilache [Fri, 10 Jul 2020 13:49:22 +0000 (09:49 -0400)]
[mlir][Vector] Add ExtractOp folding when fed by a TransposeOp

TransposeOp are often followed by ExtractOp.
In certain cases however, it is unnecessary (and even detrimental) to lower a TransposeOp to either a flat transpose (llvm.matrix intrinsics) or to unrolled scalar insert / extract chains.

Providing foldings of ExtractOp mitigates some of the unnecessary complexity.

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

4 years ago[FileCheck] Implement -dump-input-filter
Joel E. Denny [Fri, 10 Jul 2020 11:50:42 +0000 (07:50 -0400)]
[FileCheck] Implement -dump-input-filter

This makes the input dump filtering implemented by D82203 more
configurable.  D82203 enables filtering out everything but the initial
input lines of error diagnostics (plus some context).  This patch
enables including any line with any kind of annotation.

Reviewed By: mehdi_amini

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

4 years ago[FileCheck] In input dump, elide only if ellipsis is shorter
Joel E. Denny [Fri, 10 Jul 2020 11:50:31 +0000 (07:50 -0400)]
[FileCheck] In input dump, elide only if ellipsis is shorter

For example, given `-dump-input-context=3 -vv`, the following now
shows more leading context for the error than requested because a
leading ellipsis would occupy the same number of lines as it would
elide:

```
<<<<<<
         1: foo6
         2: foo5
         3: foo4
         4: foo3
         5: foo2
         6: foo1
         7: hello world
check:1     ^~~~~
check:2           X~~~~ error: no match found
         8: foo1
check:2     ~~~~
         9: foo2
check:2     ~~~~
        10: foo3
check:2     ~~~~
         .
         .
         .
>>>>>>
```

Reviewed By: mehdi_amini

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

4 years ago[FileCheck] Implement -dump-input-context
Joel E. Denny [Fri, 10 Jul 2020 11:50:00 +0000 (07:50 -0400)]
[FileCheck] Implement -dump-input-context

This patch is motivated by discussions at each of:

* <https://reviews.llvm.org/D81422>
* <http://lists.llvm.org/pipermail/llvm-dev/2020-June/142369.html>

When input is dumped as specified by `-dump-input=fail`, this patch
filters the dump to show only input lines that are the starting lines
of error diagnostics plus the number of contextual lines specified
`-dump-input-context` (defaults to 5).

When `-dump-input=always`, there might be not be any errors, so all
input lines are printed, as without this patch.

Here's some sample output with `-dump-input-context=3 -vv`:

```
<<<<<<
           .
           .
           .
          13: foo
          14: foo
          15: hello world
check:1       ^~~~~~~~~~~
          16: foo
check:2'0     X~~ error: no match found
          17: foo
check:2'0     ~~~
          18: foo
check:2'0     ~~~
          19: foo
check:2'0     ~~~
           .
           .
           .
          27: foo
check:2'0     ~~~
          28: foo
check:2'0     ~~~
          29: foo
check:2'0     ~~~
          30: goodbye word
check:2'0     ~~~~~~~~~~~~
check:2'1     ?            possible intended match
          31: foo
check:2'0     ~~~
          32: foo
check:2'0     ~~~
          33: foo
check:2'0     ~~~
           .
           .
           .
>>>>>>
```

Reviewed By: mehdi_amini, arsenm, jhenderson, rsmith, SjoerdMeijer, Meinersbur, lattner

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

4 years ago[PDB] Fix out-of-bounds acces when sorting GSI buckets
Alexandre Ganea [Fri, 10 Jul 2020 14:38:29 +0000 (10:38 -0400)]
[PDB] Fix out-of-bounds acces when sorting GSI buckets

When building in Debug on Windows-MSVC after b7402edce315, a lot of tests were failing because we were dereferencing an element past the end of HashRecords. This happened towards the end of the table, in unused slots.

4 years ago[clangd] Update semanticTokens support to reflect latest LSP draft
Sam McCall [Fri, 10 Jul 2020 14:08:14 +0000 (16:08 +0200)]
[clangd] Update semanticTokens support to reflect latest LSP draft

Summary: Mostly a few methods and message names have been renamed.

Reviewers: hokein

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

Tags: #clang

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

4 years agoReland "[InstCombine] Lower infinite combine loop detection thresholds""
Roman Lebedev [Fri, 10 Jul 2020 13:55:44 +0000 (16:55 +0300)]
Reland "[InstCombine] Lower infinite combine loop detection thresholds""

This relands commit cd7f8051ac7b6f08734102446482c1e5d951bfcc that was
reverted since lower threshold have successfully found an issue.
Now that the issue is fixed, let's wait until the next one is reported.

This reverts commit caa423eef0d128f35ac11ddbce34964caafb61c1.

4 years ago[InstCombine] After merging store into successor, queue prev. store to be visited...
Roman Lebedev [Fri, 10 Jul 2020 13:40:15 +0000 (16:40 +0300)]
[InstCombine] After merging store into successor, queue prev. store to be visited (PR46661)

We can happen to have a situation with many stores eligible for transform,
but due to our visitation order (top to bottom), when we have processed
the first eligible instruction, we would not try to reprocess the previous
instructions that are now also eligible.

So after we've successfully merged a store that was second-to-last instruction
into successor, if the now-second-to-last instruction is also a such store
that is eligible, add it to worklist to be revisited.

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

4 years ago[NFCI][InstCombine] PR46661: multiple stores eligible for merging into successor...
Roman Lebedev [Fri, 10 Jul 2020 13:30:23 +0000 (16:30 +0300)]
[NFCI][InstCombine] PR46661: multiple stores eligible for merging into successor - worklist issue

The testcase should pass with a single instcombine iteration.

4 years ago[FPEnv][Clang][Driver] Disable constrained floating point on targets lacking support."
Kevin P. Neal [Fri, 10 Jul 2020 14:31:41 +0000 (10:31 -0400)]
[FPEnv][Clang][Driver] Disable constrained floating point on targets lacking support."

Use the new -fexperimental-strict-floating-point flag in more cases to
fix the arm and aarch64 bots.

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

4 years ago[mlir][Linalg] Generalize Vectorization of Linalg contractions
Nicolas Vasilache [Fri, 10 Jul 2020 14:21:45 +0000 (10:21 -0400)]
[mlir][Linalg] Generalize Vectorization of Linalg contractions

This revision adds support for vectorizing named and generic contraction ops to vector.contract. Cases in which the memref is 0-D are special cased to emit std.load/std.store instead of vector.transfer. Relevant tests are added.

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

4 years ago[clangd] Fix hover crash on InitListExpr.
Haojian Wu [Fri, 10 Jul 2020 14:18:10 +0000 (16:18 +0200)]
[clangd] Fix hover crash on InitListExpr.

Fixes https://github.com/clangd/clangd/issues/455

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

4 years ago[mlir][Vector] Fold chains of ExtractOp
Nicolas Vasilache [Fri, 10 Jul 2020 13:31:02 +0000 (09:31 -0400)]
[mlir][Vector] Fold chains of ExtractOp

This revision adds folding to ExtractOp by simply concatenating the position attributes.

4 years agoNormalize default value for -triple correctly
Daniel Grumberg [Fri, 10 Jul 2020 12:57:59 +0000 (13:57 +0100)]
Normalize default value for -triple correctly

4 years agoReland "[FPEnv][Clang][Driver] Disable constrained floating point on targets lacking...
Kevin P. Neal [Fri, 10 Jul 2020 12:46:09 +0000 (08:46 -0400)]
Reland "[FPEnv][Clang][Driver] Disable constrained floating point on targets lacking support."

We currently have strict floating point/constrained floating point enabled
for all targets. Constrained SDAG nodes get converted to the regular ones
before reaching the target layer. In theory this should be fine.

However, the changes are exposed to users through multiple clang options
already in use in the field, and the changes are _completely_ _untested_
on almost all of our targets. Bugs have already been found, like
"https://bugs.llvm.org/show_bug.cgi?id=45274".

This patch disables constrained floating point options in clang everywhere
except X86 and SystemZ. A warning will be printed when this happens.

Use the new -fexperimental-strict-floating-point flag to force allowing
strict floating point on hosts that aren't already marked as supporting
it (X86 and SystemZ).

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

4 years agoRevert "[BasicAA] Enable -basic-aa-recphi by default"
David Green [Fri, 10 Jul 2020 12:16:17 +0000 (13:16 +0100)]
Revert "[BasicAA] Enable -basic-aa-recphi by default"

This reverts commit af839a96187e3538d63ad57571e4bdf01e2b15c5.

Some issues appear to be being caused by this. Reverting whilst we
investigate.

4 years ago[clangd] Config: If.PathExclude
Sam McCall [Thu, 9 Jul 2020 21:33:46 +0000 (23:33 +0200)]
[clangd] Config: If.PathExclude

Reviewers: hokein

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

Tags: #clang

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

4 years ago[PowerPC] Implement R_PPC64_REL24_NOTOC calls, callee also has no TOC
Victor Huang [Fri, 10 Jul 2020 11:47:47 +0000 (06:47 -0500)]
[PowerPC] Implement R_PPC64_REL24_NOTOC calls, callee also has no TOC

The PC Relative code allows for calls that are marked with the relocation
R_PPC64_REL24_NOTOC. This indicates that the caller does not have a valid TOC
pointer in R2 and does not require R2 to be restored after the call.

This patch is added to support local calls to callees tha also do not have a TOC.

Reviewed By: sfertile, MaskRay, stefanp

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

4 years ago[ABI] Handle C++20 [[no_unique_address]] attribute
Ulrich Weigand [Fri, 10 Jul 2020 11:52:47 +0000 (13:52 +0200)]
[ABI] Handle C++20 [[no_unique_address]] attribute

Many platform ABIs have special support for passing aggregates that
either just contain a single member of floatint-point type, or else
a homogeneous set of members of the same floating-point type.

When making this determination, any extra "empty" members of the
aggregate type will typically be ignored.  However, in C++ (at least
in all prior versions), no data member would actually count as empty,
even if it's type is an empty record -- it would still be considered
to take up at least one byte of space, and therefore make those ABI
special cases not apply.

This is now changing in C++20, which introduced the [[no_unique_address]]
attribute.  Members of empty record type, if they also carry this
attribute, now do *not* take up any space in the type, and therefore
the ABI special cases for single-element or homogeneous aggregates
should apply.

The C++ Itanium ABI has been updated accordingly, and GCC 10 has
added support for this new case.  This patch now adds support to
LLVM.  This is cross-platform; it affects all platforms that use
the single-element or homogeneous aggregate ABI special case and
implement this using any of the following common subroutines
in lib/CodeGen/TargetInfo.cpp:
  isEmptyField
  isEmptyRecord
  isSingleElementStruct
  isHomogeneousAggregate

4 years agoDomTreeUpdater::dump() - use const auto& iterator in for-range-loop.
Simon Pilgrim [Fri, 10 Jul 2020 11:47:02 +0000 (12:47 +0100)]
DomTreeUpdater::dump() - use const auto& iterator in for-range-loop.

Avoids unnecessary copies and silences clang tidy warning.

4 years ago[clang-tidy] Use Options priority in enum options where it was missing
Nathan James [Fri, 10 Jul 2020 11:27:08 +0000 (12:27 +0100)]
[clang-tidy] Use Options priority in enum options where it was missing

4 years agoStackSafetyAnalysis.cpp - pass ConstantRange arg as const reference.
Simon Pilgrim [Fri, 10 Jul 2020 11:07:37 +0000 (12:07 +0100)]
StackSafetyAnalysis.cpp - pass ConstantRange arg as const reference.

Avoids unnecessary copies and silences clang tidy warning - we do this in most places, there are just a few that were missed.

4 years ago[X86][SSE] Use shouldUseHorizontalOp helper to determine whether to use (F)HADD....
Simon Pilgrim [Fri, 10 Jul 2020 10:20:46 +0000 (11:20 +0100)]
[X86][SSE] Use shouldUseHorizontalOp helper to determine whether to use (F)HADD. NFCI.

4 years ago[NFC] Change isFPPredicate comparison to ignore lower bound
dstuttar [Wed, 8 Jul 2020 10:02:47 +0000 (11:02 +0100)]
[NFC] Change isFPPredicate comparison to ignore lower bound

Summary:
Since changing the Predicate to be an unsigned enum, the lower bound check for
isFPPredicate no longer needs to check the lower bound, since
it will always evaluate to true.

Also fixed a similar issue in SIISelLowering.cpp by removing the need for
comparing to FIRST and LAST predicates

Added an assert to the isFPPredicate comparison to flag if the
FIRST_FCMP_PREDICATE is ever changed to anything other than 0, in which case the
logic will break.

Without this change warnings are generated in VS.

Change-Id: I358f0daf28c0628c7bda8ad4cab4e1757b761bab

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[SVE] Code generation for fixed length vector truncates.
Paul Walker [Fri, 10 Jul 2020 10:37:19 +0000 (10:37 +0000)]
[SVE] Code generation for fixed length vector truncates.

 Lower fixed length vector truncates to a sequence of SVE UZP1 instructions.

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

4 years ago[lldb/pecoff] Use a different llvm createBinary overload for parsing
Pavel Labath [Fri, 10 Jul 2020 09:53:47 +0000 (11:53 +0200)]
[lldb/pecoff] Use a different llvm createBinary overload for parsing

Change the code the use the version which accepts a memory buffer,
instead of the one taking a file name.

This ensures we are not loading the file into memory twice
(ObjectFilePECOFF also loads a copy), reducing our memory footprint, as
well as enabling additional goodies in the future, like being able to
open files which don't exist on disk (D83512).

4 years ago[clang-tidy] More strict on matching the standard memset function in memset-usage...
Haojian Wu [Fri, 10 Jul 2020 09:42:04 +0000 (11:42 +0200)]
[clang-tidy] More strict on matching the standard memset function in memset-usage check.

The check assumed the matched function call has 3 arguments, but the
matcher didn't guaranteed that.

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

4 years ago[LV] Pick vector loop body as insert point for SCEV expansion.
Florian Hahn [Fri, 10 Jul 2020 08:45:02 +0000 (09:45 +0100)]
[LV] Pick vector loop body as insert point for SCEV expansion.

Currently the DomTree is not kept up to date for additional blocks
generated in the vector loop, for example when vectorizing with
predication. SCEVExpander relies on dominance checks when looking for
existing instructions to re-use and in some cases that can lead to the
expander picking instructions that do not actually dominate their insert
point (e.g. as in PR46525).

Unfortunately keeping the DT up-to-date is a bit tricky, because the CFG
is only patched up after generating code for a block. For now, we can
just use the vector loop header, as this ensures the inserted
instructions dominate all uses in the vector loop. There should be no
noticeable impact on the generated code, as other passes should sink
those instructions, if profitable.

Fixes PR46525.

Reviewers: Ayal, gilr, mkazantsev, dmgreen

Reviewed By: dmgreen

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

4 years ago[AMDGPU][GlobalISel] Fix G_AMDGPU_TBUFFER_STORE_FORMAT mapping
Mirko Brkusanin [Fri, 10 Jul 2020 09:32:32 +0000 (11:32 +0200)]
[AMDGPU][GlobalISel] Fix G_AMDGPU_TBUFFER_STORE_FORMAT mapping

Add missing mappings and tablegen definitions for TBUFFER_STORE_FORMAT.

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

4 years agoextractConstantWithoutWrapping - use const APInt& returned by SCEVConstant::getAPInt()
Simon Pilgrim [Thu, 9 Jul 2020 16:36:26 +0000 (17:36 +0100)]
extractConstantWithoutWrapping - use const APInt& returned by SCEVConstant::getAPInt()

Avoids unnecessary APInt copies and silences clang tidy warning.

4 years agoFix check-all with -DLLVM_USE_SANITIZER=Address
Vitaly Buka [Fri, 10 Jul 2020 08:24:58 +0000 (01:24 -0700)]
Fix check-all with -DLLVM_USE_SANITIZER=Address

4 years ago[X86][AVX] Attempt to fold PACK(SHUFFLE(X,Y),SHUFFLE(X,Y)) -> SHUFFLE(PACK(X,Y)).
Simon Pilgrim [Fri, 10 Jul 2020 08:33:10 +0000 (09:33 +0100)]
[X86][AVX] Attempt to fold PACK(SHUFFLE(X,Y),SHUFFLE(X,Y)) -> SHUFFLE(PACK(X,Y)).

Truncations lowered as shuffles of multiple (concatenated) vectors often leave us with lane-crossing shuffles that feed a PACKSS/PACKUS, if both shuffles are fed from the same 2 vector sources, then we can PACK the sources directly and shuffle the result instead.

This is currently limited to whole i128 lanes in a 256-bit vector, but we can extend this if the need arises (but I'm not seeing many examples in real world code).

4 years ago[analyzer][tests] Fix zip unpacking
Valeriy Savchenko [Fri, 10 Jul 2020 08:20:36 +0000 (11:20 +0300)]
[analyzer][tests] Fix zip unpacking

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

4 years ago[analyzer][tests] Make test interruption safe
Valeriy Savchenko [Fri, 10 Jul 2020 08:20:20 +0000 (11:20 +0300)]
[analyzer][tests] Make test interruption safe

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

4 years ago[analyzer][tests] Measure peak memory consumption for every project
Valeriy Savchenko [Fri, 10 Jul 2020 07:54:18 +0000 (10:54 +0300)]
[analyzer][tests] Measure peak memory consumption for every project

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

4 years ago[builtins] Optimize udivmodti4 for many platforms.
Danila Kutenin [Fri, 10 Jul 2020 07:46:57 +0000 (09:46 +0200)]
[builtins] Optimize udivmodti4 for many platforms.

Summary:
While benchmarking uint128 division we found out that it has huge latency for small divisors

https://reviews.llvm.org/D83027

```
Benchmark                                                   Time(ns)        CPU(ns)     Iterations
--------------------------------------------------------------------------------------------------
BM_DivideIntrinsic128UniformDivisor<unsigned __int128>            13.0           13.0     55000000
BM_DivideIntrinsic128UniformDivisor<__int128>                     14.3           14.3     50000000
BM_RemainderIntrinsic128UniformDivisor<unsigned __int128>         13.5           13.5     52000000
BM_RemainderIntrinsic128UniformDivisor<__int128>                  14.1           14.1     50000000
BM_DivideIntrinsic128SmallDivisor<unsigned __int128>             153            153        5000000
BM_DivideIntrinsic128SmallDivisor<__int128>                      170            170        3000000
BM_RemainderIntrinsic128SmallDivisor<unsigned __int128>          153            153        5000000
BM_RemainderIntrinsic128SmallDivisor<__int128>                   155            155        5000000
```

This patch suggests a more optimized version of the division:

If the divisor is 64 bit, we can proceed with the divq instruction on x86 or constant multiplication mechanisms for other platforms. Once both divisor and dividend are not less than 2**64, we use branch free subtract algorithm, it has at most 64 cycles. After that our benchmarks improved significantly

```
Benchmark                                                   Time(ns)        CPU(ns)     Iterations
--------------------------------------------------------------------------------------------------
BM_DivideIntrinsic128UniformDivisor<unsigned __int128>            11.0           11.0     64000000
BM_DivideIntrinsic128UniformDivisor<__int128>                     13.8           13.8     51000000
BM_RemainderIntrinsic128UniformDivisor<unsigned __int128>         11.6           11.6     61000000
BM_RemainderIntrinsic128UniformDivisor<__int128>                  13.7           13.7     52000000
BM_DivideIntrinsic128SmallDivisor<unsigned __int128>              27.1           27.1     26000000
BM_DivideIntrinsic128SmallDivisor<__int128>                       29.4           29.4     24000000
BM_RemainderIntrinsic128SmallDivisor<unsigned __int128>           27.9           27.8     26000000
BM_RemainderIntrinsic128SmallDivisor<__int128>                    29.1           29.1     25000000
```

If not using divq instrinsics, it is still much better

```
Benchmark                                                   Time(ns)        CPU(ns)     Iterations
--------------------------------------------------------------------------------------------------
BM_DivideIntrinsic128UniformDivisor<unsigned __int128>            12.2           12.2     58000000
BM_DivideIntrinsic128UniformDivisor<__int128>                     13.5           13.5     52000000
BM_RemainderIntrinsic128UniformDivisor<unsigned __int128>         12.7           12.7     56000000
BM_RemainderIntrinsic128UniformDivisor<__int128>                  13.7           13.7     51000000
BM_DivideIntrinsic128SmallDivisor<unsigned __int128>              30.2           30.2     24000000
BM_DivideIntrinsic128SmallDivisor<__int128>                       33.2           33.2     22000000
BM_RemainderIntrinsic128SmallDivisor<unsigned __int128>           31.4           31.4     23000000
BM_RemainderIntrinsic128SmallDivisor<__int128>                    33.8           33.8     21000000
```

PowerPC benchmarks:

Was
```
BM_DivideIntrinsic128UniformDivisor<unsigned __int128>            22.3           22.3     32000000
BM_DivideIntrinsic128UniformDivisor<__int128>                     23.8           23.8     30000000
BM_RemainderIntrinsic128UniformDivisor<unsigned __int128>         22.5           22.5     32000000
BM_RemainderIntrinsic128UniformDivisor<__int128>                  24.9           24.9     29000000
BM_DivideIntrinsic128SmallDivisor<unsigned __int128>             394            394        2000000
BM_DivideIntrinsic128SmallDivisor<__int128>                      397            397        2000000
BM_RemainderIntrinsic128SmallDivisor<unsigned __int128>          399            399        2000000
BM_RemainderIntrinsic128SmallDivisor<__int128>                   397            397        2000000
```

With this patch
```
BM_DivideIntrinsic128UniformDivisor<unsigned __int128>            21.7           21.7     33000000
BM_DivideIntrinsic128UniformDivisor<__int128>                     23.0           23.0     31000000
BM_RemainderIntrinsic128UniformDivisor<unsigned __int128>         21.9           21.9     33000000
BM_RemainderIntrinsic128UniformDivisor<__int128>                  23.9           23.9     30000000
BM_DivideIntrinsic128SmallDivisor<unsigned __int128>              32.7           32.6     23000000
BM_DivideIntrinsic128SmallDivisor<__int128>                       33.4           33.4     21000000
BM_RemainderIntrinsic128SmallDivisor<unsigned __int128>           31.1           31.1     22000000
BM_RemainderIntrinsic128SmallDivisor<__int128>                    33.2           33.2     22000000
```

My email: danilak@google.com, I don't have commit rights

Reviewers: howard.hinnant, courbet, MaskRay

Reviewed By: courbet

Subscribers: steven.zhang, #sanitizers

Tags: #sanitizers

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