lldb.git
2 years agoRevert "[BrachProbablityInfo] Set edge probabilities at once. NFC."
Reid Kleckner [Wed, 13 May 2020 15:23:09 +0000 (08:23 -0700)]
Revert "[BrachProbablityInfo] Set edge probabilities at once. NFC."

This reverts commit eef95f2746c3347b8dad19091ffb82a88d73acd3.

The new assertion about branch propability sums does not hold.

2 years ago[lldb][NFC] Early-exit in SetupDeclVendor
Raphael Isemann [Wed, 13 May 2020 13:56:51 +0000 (15:56 +0200)]
[lldb][NFC] Early-exit in SetupDeclVendor

Also removed the unnecessary element-by-element copy of the std::vector
hand_imported_modules to modules_for_macros.

2 years agoMake FormatToken::Type private.
Manuel Klimek [Tue, 27 Aug 2019 14:11:25 +0000 (16:11 +0200)]
Make FormatToken::Type private.

This enables us to intercept changes to the token type via setType(), which
is a precondition for being able to use multi-pass formatting for macro
arguments.

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

2 years agoPerform ActOnConversionDeclarator after looking for any virtual functions it overrides
Ronald Wampler [Sun, 19 Apr 2020 02:23:21 +0000 (22:23 -0400)]
Perform ActOnConversionDeclarator after looking for any virtual functions it overrides

Summary: This allows for suppressing warnings about the conversion function never being called if it overrides a virtual function in a base class.

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

2 years ago[DebugInfo] Fix test Fortran-DIModule.ll after 678bd84c4
Russell Gallop [Wed, 13 May 2020 14:23:37 +0000 (15:23 +0100)]
[DebugInfo] Fix test Fortran-DIModule.ll after 678bd84c4

Was failing here:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/32320

2 years ago[ARM] Convert floating point splats to integer
David Green [Wed, 13 May 2020 13:35:32 +0000 (14:35 +0100)]
[ARM] Convert floating point splats to integer

Under MVE a vdup will always take a gpr register, not a floating point
value. During DAG combine we convert the types to a bitcast to an
integer in an attempt to fold the bitcast into other instructions. This
is OK, but only works inside the same basic block. To do the same trick
across a basic block boundary we need to convert the type in
codegenprepare, before the splat is sunk into the loop.

This adds a convertSplatType function to codegenprepare to do that,
putting bitcasts around the splat to force the type to an integer. There
is then some adjustment to the code in shouldSinkOperands to handle the
extra bitcasts.

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

2 years ago[mlir] [VectorOps] Add missing EDSC intrinsics.
Pierre Oechsel [Wed, 13 May 2020 14:09:39 +0000 (10:09 -0400)]
[mlir] [VectorOps] Add missing EDSC intrinsics.

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

2 years ago[mlir] Add SubViewOp::getOrCreateRanges and fix folding pattern
Nicolas Vasilache [Wed, 13 May 2020 02:21:36 +0000 (22:21 -0400)]
[mlir] Add SubViewOp::getOrCreateRanges and fix folding pattern

The existing implementation of SubViewOp::getRanges relies on all
offsets/sizes/strides to be dynamic values and does not work in
combination with canonicalization. This revision adds a
SubViewOp::getOrCreateRanges to create the missing constants in the
canonicalized case.

This allows reactivating the fused pass with staged pattern
applications.

However another issue surfaces that the SubViewOp verifier is now too
strict to allow folding. The existing folding pattern is turned into a
canonicalization pattern which rewrites memref_cast + subview into
subview + memref_cast.

The transform-patterns-matmul-to-vector can then be reactivated.

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

2 years ago[AMDGPU] Strengthen export cluster ordering
Carl Ritson [Wed, 13 May 2020 14:06:57 +0000 (23:06 +0900)]
[AMDGPU] Strengthen export cluster ordering

Summary:
When removing barrier edges on exports then dependencies need to
be propagated.

Reviewers: foad

Reviewed By: foad

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

2 years ago[ARM] Sink splats to fma intrinsics
David Green [Wed, 13 May 2020 09:08:16 +0000 (10:08 +0100)]
[ARM] Sink splats to fma intrinsics

Similar to fmul/fadd, we can sink a splat into a loop containing a fma
in order to use more register instruction variants. For that there are
also adjustments to the sinking code to handle more than 2 arguments.

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

2 years ago[lldb][NFC] Don't specify a default argument when creating a TextDiagnosticPrinter
Raphael Isemann [Wed, 13 May 2020 12:55:46 +0000 (14:55 +0200)]
[lldb][NFC] Don't specify a default argument when creating a TextDiagnosticPrinter

2 years ago[libcxx][span] Implement P1976R2
Michael Schellenberger Costa [Wed, 13 May 2020 13:50:06 +0000 (09:50 -0400)]
[libcxx][span] Implement P1976R2

This resolves the NB comment about the construction of a fixed-size span
from a dynamic range.

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

2 years ago[LSR][ARM] Add new TTI hook to mark some LSR chains as profitable
Pierre-vh [Tue, 5 May 2020 13:25:23 +0000 (14:25 +0100)]
[LSR][ARM] Add new TTI hook to mark some LSR chains as profitable

This patch adds a new TTI hook to allow targets to tell LSR that
a chain including some instruction is already profitable and
should not be optimized. This patch also adds an implementation
of this TTI hook for ARM so LSR doesn't optimize chains that include
the VCTP intrinsic.

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

2 years ago[MLIR] Nested regions test for Buffer Assginment
Ehsan Toosi [Mon, 4 May 2020 15:05:51 +0000 (17:05 +0200)]
[MLIR] Nested regions test for Buffer Assginment

Due to the extension of Liveness, Buffer Assignment can now work on nested regions. This PR provides a test case to show that existing functionally of BA works properly.

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

2 years agoClang crash targeting ARM or Thumb when assembling a prel31 relocation variant
Simon Wallis [Wed, 13 May 2020 09:40:14 +0000 (10:40 +0100)]
Clang crash targeting ARM or Thumb when assembling a prel31 relocation variant

Summary:
In the assembler or inline assembler,
attempting to use an invalid fixup type
gives a crash with a segmentation fault.

__attribute__((naked))
void foo(void) {
 __asm__("mov r9, :lower16:bar(prel31)");
}

This should give a proper error message when building for ARM or Thumb.
This brings it in line with AARCH64.

This fixes all 8 instances of llvm_unreachable("Unsupported Modifier");
in ARM/MCTargetDesc/ARMELFObjectWriter.cpp.
A test is provided for each instance.

Reviewers: llvm-commits, MarkMurrayARM

Reviewed By: MarkMurrayARM

Subscribers: kristof.beyls, hiraditya, danielkiss

Tags: #llvm

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

Change-Id: I6971ba37f129cc453568fe71514ccb2ac9d16831

2 years agoRecommit #2: "[LV] Induction Variable does not remain scalar under tail-folding."
Sjoerd Meijer [Tue, 12 May 2020 19:23:09 +0000 (20:23 +0100)]
Recommit #2: "[LV] Induction Variable does not remain scalar under tail-folding."

This was reverted because of a miscompilation. At closer inspection, the
problem was actually visible in a changed llvm regression test too. This
one-line follow up fix/recommit will splat the IV, which is what we are trying
to avoid if unnecessary in general, if tail-folding is requested even if all
users are scalar instructions after vectorisation. Because with tail-folding,
the splat IV will be used by the predicate of the masked loads/stores
instructions. The previous version omitted this, which caused the
miscompilation. The original commit message was:

If tail-folding of the scalar remainder loop is applied, the primary induction
variable is splat to a vector and used by the masked load/store vector
instructions, thus the IV does not remain scalar. Because we now mark
that the IV does not remain scalar for these cases, we don't emit the vector IV
if it is not used. Thus, the vectoriser produces less dead code.

Thanks to Ayal Zaks for the direction how to fix this.

2 years ago[StructurizeCFG] Fix region nodes ordering
Ehud Katz [Wed, 13 May 2020 12:33:36 +0000 (15:33 +0300)]
[StructurizeCFG] Fix region nodes ordering

This is a reimplementation of the `orderNodes` function, as the old
implementation didn't take into account all cases.

Fix PR41509

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

2 years ago[compiler-rt] [builtin] Switch the return type of __atomic_compare_exchange_##n to...
Kamil Rytarowski [Wed, 13 May 2020 12:08:39 +0000 (14:08 +0200)]
[compiler-rt] [builtin] Switch the return type of __atomic_compare_exchange_##n to bool

Summary:
Synchronize the function definition with the LLVM documentation.

https://llvm.org/docs/Atomics.html#libcalls-atomic

GCC also returns bool for the same atomic builtin.

Reviewers: theraven

Reviewed By: theraven

Subscribers: theraven, dberris, jfb, #sanitizers

Tags: #sanitizers

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

2 years ago[mlir] Adapted standard Alloc and Alloca ops to use new side-effect resources.
Marcel Koester [Fri, 8 May 2020 08:11:25 +0000 (10:11 +0200)]
[mlir] Adapted standard Alloc and Alloca ops to use new side-effect resources.

The current standard Alloca node is not annotated with the
MemEffect<Alloc> trait. This CL updates the Alloc and Alloca
memory-effect annotations using the latest Resource objects. Alloca
nodes will use a newly defined AutomaticAllocationScopeResource to
distinguish between Alloc and Alloca memory effects.

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

2 years ago[lldb] Merge PlatformXXX::ResolveExecutable
Pavel Labath [Wed, 13 May 2020 11:21:59 +0000 (13:21 +0200)]
[lldb] Merge PlatformXXX::ResolveExecutable

The near-identical implementations of this function for posix-y
platforms were merged in r293910. PlatformWindows was left out of this
merge because at the time we did not have a suitable base class to sink
the code into. That is no longer true, so this commit finishes the job
by moving the code into RemoteAwarePlatform::ResolveExecutable.

2 years ago[AMDGPU][MC][GFX9+] Enabled clamp for v_add_i32 and v_sub_i32
Dmitry Preobrazhensky [Wed, 13 May 2020 11:15:46 +0000 (14:15 +0300)]
[AMDGPU][MC][GFX9+] Enabled clamp for v_add_i32 and v_sub_i32

See bug 45830: https://bugs.llvm.org/show_bug.cgi?id=45830

Reviewers: arsenm, rampitec

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

2 years agoRevert "[libc++] [LWG3321] Mark "year_month_day_last::day() specification does not...
Marek Kurdej [Wed, 13 May 2020 11:15:40 +0000 (13:15 +0200)]
Revert "[libc++] [LWG3321] Mark "year_month_day_last::day() specification does not cover !ok() values" issue as "Nothing to do", but add assertion."

This reverts commit e25a2601aaa95c861af3228982ecbb2b1c19d27a.
It was failing due to _LIBCPP_ASSERT throwing in a method marked noexcept.

2 years ago[analyzer] SATestBuild.py: Be defensive against corrupt plist files.
Artem Dergachev [Wed, 13 May 2020 11:06:44 +0000 (14:06 +0300)]
[analyzer] SATestBuild.py: Be defensive against corrupt plist files.

2 years ago[lldb] Also recognize DWARF UTF base types using their size
Mathias LANG [Wed, 13 May 2020 10:48:19 +0000 (12:48 +0200)]
[lldb] Also recognize DWARF UTF base types using their size

Summary:
The D programming language has 'char', 'wchar', and 'dchar' as base types,
which are defined as UTF-8, UTF-16, and UTF-32, respectively.

It also has type constructors (e.g. 'const' and 'immutable'),
that leads to D compilers emitting DW_TAG_base_type with DW_ATE_UTF
and name 'char', 'immutable(wchar)', 'const(char)', etc...

Before this patch, DW_ATE_UTF would only recognize types that
followed the C/C++ naming, and emit an error message for the rest, e.g.:
```
error: need to add support for DW_TAG_base_type 'immutable(char)'
encoded with DW_ATE = 0x10, bit_size = 8
```

The code was changed to check the byte size first,
then fall back to the old name-based check.

Reviewers: clayborg, labath

Reviewed By: labath

Subscribers: labath, lldb-commits

Tags: #lldb

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

2 years ago[libcxx testing] Remove ALLOW_RETRIES from wait_for futures test
David Zarzycki [Wed, 13 May 2020 10:43:16 +0000 (06:43 -0400)]
[libcxx testing] Remove ALLOW_RETRIES from wait_for futures test

This test tried to verify that "wait()" returned quickly but "quick" is
impossible to define given a busy and/or slow system.

Instead, I've refactored the test to verify that `wait()` actually
waits which the old test did not verify.

2 years ago[examples] Skip building the Bye pass plugin on windows
Martin Storsjö [Tue, 12 May 2020 08:54:51 +0000 (11:54 +0300)]
[examples] Skip building the Bye pass plugin on windows

Windows doesn't properly support pass plugins (as a shared library
can't have undefined references, which pass plugins assume, being
loaded into a host process that contains provides them), thus
disable building it and the corresponding test.

This matches what was done for the passes unit test in
bc8e44218810c0db6328b9809c959ceb7d43e3f5.

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

2 years ago[analyzer] Fix crash for non-pointers annotated as nonnull
Valeriy Savchenko [Wed, 13 May 2020 10:02:00 +0000 (13:02 +0300)]
[analyzer] Fix crash for non-pointers annotated as nonnull

Summary:
Nonnull attribute can be applied to non-pointers.  This caused assertion
failures in NonNullParamChecker when we tried to *assume* such parameters
to be non-zero.

rdar://problem/63150074

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

2 years ago[libc++] [LWG3321] Mark "year_month_day_last::day() specification does not cover...
Marek Kurdej [Wed, 13 May 2020 09:37:58 +0000 (11:37 +0200)]
[libc++] [LWG3321] Mark "year_month_day_last::day() specification does not cover !ok() values" issue as "Nothing to do", but add assertion.

Summary:
This LWG issue states that the result of `year_month_day_last::day()` is implementation defined if `ok()` is `false`.
However, from user perspective, calling `day()` in this situation will lead to a (possibly difficult to find) crash.
Hence, I have added an assertion to warn user at least when assertions are enabled.
I am however not aware of the libc++ stand on the desired behaviour.

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

Reviewed By: ldionne, #libc

Subscribers: christof, dexonsmith, libcxx-commits

Tags: #libc

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

2 years ago[NFC] [PowerPC] Narrow fast-math flags in tests
Qiu Chaofan [Wed, 13 May 2020 09:21:31 +0000 (17:21 +0800)]
[NFC] [PowerPC] Narrow fast-math flags in tests

A lot of tests under PowerPC are using fast flag, while fast is just
alias of 7 fast-math flags. This change makes test points clearer.

mc-instrlat.ll and sms-iterator.ll keeps unchanged since they are not
testing fast-math behavior. (one for machine combiner crash, one for
machine pipeliner bug)

Reviewed By: steven.zhang, spatel

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

2 years ago[TableGen] Fix register class handling in TableGen's DAG ISel Matcher Generator
Victor Campos [Tue, 5 May 2020 14:42:23 +0000 (15:42 +0100)]
[TableGen] Fix register class handling in TableGen's DAG ISel Matcher Generator

Summary:
In TableGen's instruction selection table generator, references to
register classes were handled by generating a matcher table entry in the
form of "EmitStringInteger, MVT::i32, 'RegisterClassID'". This ID is in
fact the enum integer value corresponding to the register class.

However, both the table generator and the table consumer
(SelectionDAGISel) assume that this ID is less than or equal to 127,
i.e. at most 7 bits. Values greater than this threshold cause completely
wrong behaviours in the instruction selection process.

This patch adds a check to determine if the enum integer value is
greater than the limit of 127. In finding so, the generator emits an
"EmitInteger" instead, which properly supports values with arbitrary
sizes.

Commit f8d044bbcfdc9e1ddc02247ffb86fe39e1f277f0 fixed the very same bug
for register subindices. The present patch now extends this cover to
register classes.

Reviewers: rampitec

Reviewed By: rampitec

Subscribers: llvm-commits

Tags: #llvm

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

2 years ago[mips] Fix typo in FileCheck directives - replace \0xa0 char by space. NFC
Simon Atanasyan [Wed, 13 May 2020 05:14:28 +0000 (08:14 +0300)]
[mips] Fix typo in FileCheck directives - replace \0xa0 char by space. NFC

The problem is found by the D79276 on the following builder:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/23489

2 years ago[DebugInfo] Fixes windows bot failure due to a test failure
Sourabh Singh Tomar [Wed, 13 May 2020 08:57:53 +0000 (14:27 +0530)]
[DebugInfo] Fixes windows bot failure due to a test failure

This fixes failures on windows bot specifically:

http://lab.llvm.org:8011/builders/lld-x86_64-win/builds/445
and http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/
builds/32314

* TEST 'LLVM :: DebugInfo/X86/Fortran-DIModule.ll' FAILED *
Script:
--
: 'RUN: at line 2';   c:\ps4-buildslave2\lld-x86_64-win\build\bin\llc.exe
-mtriple=x86_64-pc-windows-gnu
c:\ps4-buildslave2\lld-x86_64-win\llvm-project\llvm\test\DebugInfo\X86\Fortran-DIModule.ll
-filetype=obj -o - |    c:\ps4-buildslave2\lld-x86_64-win\build\bin\llvm-dwarfdump.exe - |
 c:\ps4-buildslave2\lld-x86_64-win\build\bin\filecheck.exe
c:\ps4-buildslave2\lld-x86_64-win\llvm-project\llvm\test\DebugInfo\X86\Fortran-DIModule.ll
--
Exit Code: 1
error: command failed with exit status: 1

2 years ago[DebugInfo] Fortran module DebugInfo support in LLVM
Sourabh Singh Tomar [Fri, 8 May 2020 06:01:41 +0000 (11:31 +0530)]
[DebugInfo] Fortran module DebugInfo support in LLVM

This patch extends DIModule Debug metadata in LLVM to support
Fortran modules. DIModule is extended to contain File and Line
fields, these fields will be used by Flang FE to create debug
information necessary for representing Fortran modules at IR level.

Furthermore DW_TAG_module is also extended to contain these fields.
If these fields are missing, debuggers like GDB won't be able to
show Fortran modules information correctly.

Reviewed By: aprantl

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

2 years ago[BrachProbablityInfo] Set edge probabilities at once. NFC.
Yevgeny Rouban [Wed, 13 May 2020 05:14:06 +0000 (12:14 +0700)]
[BrachProbablityInfo] Set edge probabilities at once. NFC.

Hide the method that allows setting probability for particular
edge and introduce a public method that sets probabilities for
all outgoing edges at once.
Setting individual edge probability is error prone. More over
it is difficult to check that the total probability is 1.0
because there is no easy way to know when the user finished
setting all the probabilities.

Reviewers: yamauchi, ebrevnov
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79396

2 years ago[NFC] Code cleanup in TargetInfo.cpp
Shengchen Kan [Wed, 13 May 2020 06:44:54 +0000 (14:44 +0800)]
[NFC] Code cleanup in TargetInfo.cpp

Fix the signed/unsigned mismatch issue

2 years ago[PowerPC] Exploit VSX neg, abs and nabs for f32
Qiu Chaofan [Tue, 12 May 2020 06:29:40 +0000 (14:29 +0800)]
[PowerPC] Exploit VSX neg, abs and nabs for f32

xsnegdp, xsabsdp and xsnabsdp can be used to operate on f32 operand.

This patch adds the missing patterns since we prefer VSX instructions
when available.

Reviewed By: steven.zhang

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

2 years ago[CostModel] Modify BasicTTI getCastInstrCost
Sam Parker [Wed, 13 May 2020 06:22:42 +0000 (07:22 +0100)]
[CostModel] Modify BasicTTI getCastInstrCost

Fix the assumption that all bitcasts of the same type sizes are free.
We now only assume that bitcasts between ints and ptrs of the same
size are free. This allows TTImpl to just call the concrete
implementation of getCastInstrCost.

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

2 years ago[mlir][StandardToLLVM] Add SinOp to LLVM dialect and lowering of std.sin to this op.
MaheshRavishankar [Wed, 13 May 2020 06:04:33 +0000 (23:04 -0700)]
[mlir][StandardToLLVM] Add SinOp to LLVM dialect and lowering of std.sin to this op.

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

2 years ago[PowerPC] Respect SDNodeFlags in lowering SELECT_CC
Qiu Chaofan [Wed, 13 May 2020 06:03:38 +0000 (14:03 +0800)]
[PowerPC] Respect SDNodeFlags in lowering SELECT_CC

Legalizer should respect both command-line options or SDNode-level
fast-math flags.

Also, this patch propagates other flags during custom simplifying.

Reviewed By: steven.zhang

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

2 years ago[mlir][Linalg] Add folders and canonicalizers for
MaheshRavishankar [Wed, 13 May 2020 05:50:44 +0000 (22:50 -0700)]
[mlir][Linalg] Add folders and canonicalizers for
linalg.reshape/linalg.tensor_reshape operations.

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

2 years ago[mlir][Linalg] Allow reshapes to collapse to a zero-rank tensor.
MaheshRavishankar [Wed, 13 May 2020 05:50:35 +0000 (22:50 -0700)]
[mlir][Linalg] Allow reshapes to collapse to a zero-rank tensor.

This is only valid if the source tensors (result tensor) is static
shaped with all unit-extents when the reshape is collapsing
(expanding) dimensions.

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

2 years ago[PowerPC] Use add instead of addReg in ppc-early-ret pass
Kang Zhang [Wed, 13 May 2020 05:59:52 +0000 (05:59 +0000)]
[PowerPC] Use add instead of addReg in ppc-early-ret pass

Summary:
The ppc-early-ret pass use the addReg() to add operand to the new
instruction, it can't reserve the flag of old operand. This has caused
machine verfications failed.
This patch use add() to instead of addReg().

Reviewed By: steven.zhang

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

2 years ago[cmake] Update creation of object library dependencies for LINK_LIBS PUBLIC
Stephen Neuendorffer [Wed, 13 May 2020 03:43:50 +0000 (20:43 -0700)]
[cmake] Update creation of object library dependencies for LINK_LIBS PUBLIC

We need to avoid declaring dependencies on strings which are valid
LINK_LIBS and not valid targets.  Previously, we used if(TARGET) to
check this condition.  However, if(TARGET) checks whether a target has
been created (in the cmake subdirectory traversal order) and not
whether it *will* be created.  This results in annoying directory
ordering problems.

This patch changes the check to more explicitly eliminate problematic
libraries (namely -lpthread) using a REGEX.

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

2 years ago[gcov] Fix simultaneous .gcda creation/lock
KAWASHIMA Takahiro [Thu, 7 May 2020 07:40:06 +0000 (16:40 +0900)]
[gcov] Fix simultaneous .gcda creation/lock

Fixes PR45673

The commit 9180c14fe4d (D76206) resolved only a part of the problem
of concurrent .gcda file creation. It ensured that only one process
creates the file but did not ensure that the process locks the
file first. If not, the process which created the file may clobber
the contents written by a process which locked the file first.
This is the cause of PR45673.

This commit prevents the clobbering by revising the assumption
that a process which creates the file locks the file first.
Regardless of file creation, a process which locked the file first
uses fwrite (new_file==1) and other processes use mmap (new_file==0).

I also tried to keep the creation/first-lock process same by using
mkstemp/link/unlink but the code gets long. This commit is more
simple.

Note: You may be confused with other changes which try to resolve
concurrent file access. My understanding is (may not be correct):

D76206:   Resolve race of .gcda file creation (but not lock)
This one: Resolve race of .gcda file creation and lock
D54599:   Same as D76206 but abandoned?
D70910:   Resolve race of multi-threaded counter flushing
D74953:   Resolve counter sharing between parent/children processes
D78477:   Revision of D74953

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

2 years ago[LoopReroll] Fix rerolling loop with use outside the loop
KAWASHIMA Takahiro [Thu, 7 May 2020 04:30:25 +0000 (13:30 +0900)]
[LoopReroll] Fix rerolling loop with use outside the loop

Fixes PR41696

The loop-reroll pass generates an invalid IR (or its assertion
fails in debug build) if values of the base instruction and
other root instructions (terms used in the loop-reroll pass)
are used outside the loop block. See IRs written in PR41696
as examples.

The current implementation of the loop-reroll pass can reroll
only loops that don't have values that are used outside the
loop, except reduced values (the last values of reduction chains).
This is described in the comment of the `LoopReroll::reroll`
function.
https://github.com/llvm/llvm-project/blob/llvmorg-10.0.0/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp#L1600

This is checked in the `LoopReroll::DAGRootTracker::validate`
function.
https://github.com/llvm/llvm-project/blob/llvmorg-10.0.0/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp#L1393

However, the base instruction and other root instructions skip
this check in the validation loop.
https://github.com/llvm/llvm-project/blob/llvmorg-10.0.0/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp#L1229

Moving the check in front of the skip is the logically simplest
fix. However, inserting the check in an earlier stage is better
in terms of compilation time of unrerollable loops. This fix
inserts the check for the base instruction into the function
to validate possible base/root instructions. Check for other
root instructions is unnecessary because they don't match any
base instructions if they have uses outside the loop.

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

2 years ago[LLDB] Fix typo in xfail decorator assert.test
Muhammad Omair Javaid [Wed, 13 May 2020 03:51:47 +0000 (08:51 +0500)]
[LLDB] Fix typo in xfail decorator assert.test

Fix a typo in earlier xfailed assert.test replace // with #.

2 years ago[LLDB] Mark some xfails for arm-linux
Muhammad Omair Javaid [Wed, 13 May 2020 03:03:28 +0000 (08:03 +0500)]
[LLDB] Mark some xfails for arm-linux

This patch marks following tests as xfail for arm-linux target.

lldb/test/API/functionalities/load_using_paths/TestLoadUsingPaths.py
lldb/test/API/python_api/thread/TestThreadAPI.py
lldb/test/Shell/Recognizer/assert.test

Bugs have been filed for all of them for the corresponding failing
component.

2 years ago[mlir] [VectorOps] Implement vector.constant_mask lowering to LLVM IR
aartbik [Wed, 13 May 2020 00:07:29 +0000 (17:07 -0700)]
[mlir] [VectorOps] Implement vector.constant_mask lowering to LLVM IR

Summary:
Makes this operation runnable on CPU by generating MLIR instructions
that are eventually folded into an LLVM IR constant for the mask.

Reviewers: nicolasvasilache, ftynse, reidtatge, bkramer, andydavis1

Reviewed By: nicolasvasilache, ftynse, andydavis1

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

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

2 years ago[LLDB] Fix minidebuginfo-set-and-hit-breakpoint.test for arm 32-bit
Muhammad Omair Javaid [Wed, 13 May 2020 02:15:10 +0000 (07:15 +0500)]
[LLDB] Fix minidebuginfo-set-and-hit-breakpoint.test for arm 32-bit

This patch fixes minidebuginfo-set-and-hit-breakpoint.test for arm-linux
targets. 32-bit elf executables use .rel.dyn and 64-bit uses .rela.dyn for
relocation entries for dynamic symbols.

2 years ago[Attributor][FIX] Stabilize the state of AAReturnedValues each update
Johannes Doerfert [Wed, 13 May 2020 01:51:21 +0000 (20:51 -0500)]
[Attributor][FIX] Stabilize the state of AAReturnedValues each update

For AAReturnedValues we treated new and existing information differently
in the updateImpl. Only the latter was properly analyzed and
categorized. The former was thought to be analyzed in the subsequent
update. Since the Attributor does not support "self-updates" we need to
make sure the state is "stable" after each updateImpl invocation. That
is, if the surrounding information does not change, the state is valid.
Now we make sure all return values have been handled and properly
categorized each iteration. We might not update again if we have not
requested a non-fix attribute so we cannot "wait" for the next update to
analyze a new return value.

Bug reported by @sdmitriev.

2 years ago[libcxx] Constrain function assignment operator (2574).
zoecarver [Wed, 13 May 2020 01:56:18 +0000 (18:56 -0700)]
[libcxx] Constrain function assignment operator (2574).

This patch fixes LWG issue 2574.

Differential Review: https://reviews.llvm.org/D62928

2 years agotest commit
Zequan Wu [Wed, 13 May 2020 01:46:24 +0000 (18:46 -0700)]
test commit

2 years ago[ValueTracking] Fix crash in isGuaranteedNotToBeUndefOrPoison when V is in an unreach...
Juneyoung Lee [Tue, 12 May 2020 15:37:38 +0000 (00:37 +0900)]
[ValueTracking] Fix crash in isGuaranteedNotToBeUndefOrPoison when V is in an unreachable block

Summary:
This fixes PR45885 by fixing isGuaranteedNotToBeUndefOrPoison so it does not look into dominating
branch conditions of V when V is an instruction in an unreachable block.

Reviewers: spatel, nikic, lebedev.ri

Reviewed By: nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

2 years agoFix error in TestNumThreads.py when frame.GetFunctionName returns none
Muhammad Omair Javaid [Wed, 13 May 2020 00:12:48 +0000 (05:12 +0500)]
Fix error in TestNumThreads.py when frame.GetFunctionName returns none

Summary:
This patch fixes an error happening in TestNumThreads.py when it encounters frame.GetFunctionName none for address only locations in stripped libc.

This error was showing up on arm-linux docker container running lldb buildbot.

Reviewers: labath

Reviewed By: labath

Subscribers: kristof.beyls, lldb-commits

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

2 years ago[mlir] Revisit std.subview handling of static information.
Nicolas Vasilache [Tue, 12 May 2020 21:17:34 +0000 (17:17 -0400)]
[mlir] Revisit std.subview handling of static information.

The main objective of this revision is to change the way static information is represented, propagated and canonicalized in the SubViewOp.

In the current implementation the issue is that canonicalization may strictly lose information because static offsets are combined in irrecoverable ways into the result type, in order to fit the strided memref representation.

The core semantics of the op do not change but the parser and printer do: the op always requires `rank` offsets, sizes and strides. These quantities can now be either SSA values or static integer attributes.

The result type is automatically deduced from the static information and more powerful canonicalizations (as powerful as the representation with sentinel `?` values allows). Previously static information was inferred on a best-effort basis from looking at the source and destination type.

Relevant tests are rewritten to use the idiomatic `offset: x, strides : [...]`-form. Bugs are corrected along the way that were not trivially visible in flattened strided memref form.

Lowering to LLVM is updated, simplified and now supports all cases.
A mixed static-dynamic mode test that wouldn't previously lower is added.

It is an open question, and a longer discussion, whether a better result type representation would be a nicer alternative. For now, the subview op carries the required semantic.

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

2 years agoAdd nomerge function attribute to supress tail merge optimization in simplifyCFG
Zequan Wu [Tue, 12 May 2020 21:07:50 +0000 (14:07 -0700)]
Add nomerge function attribute to supress tail merge optimization in simplifyCFG

We want to add a way to avoid merging identical calls so as to keep the
separate debug-information for those calls. There is also an asan
usecase where having this attribute would be beneficial to avoid
alternative work-arounds.

Here is the link to the feature request:
https://bugs.llvm.org/show_bug.cgi?id=42783.

`nomerge` is different from `noline`. `noinline` prevents function from
inlining at callsites, but `nomerge` prevents multiple identical calls
from being merged into one.

This patch adds `nomerge` to disable the optimization in IR level. A
followup patch will be needed to let backend understands `nomerge` and
avoid tail merge at backend.

Reviewed By: asbirlea, rnk

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

2 years ago[lld-macho] Ignore -platform_version and -syslibroot flags.
Nico Weber [Tue, 12 May 2020 18:02:13 +0000 (14:02 -0400)]
[lld-macho] Ignore -platform_version and -syslibroot flags.

clang passes these flags; this makes it easier to try `clang -v`
output with `ld -flavor darwinnew`.

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

2 years ago[libc][Obvious] Fix deps of few threads targets.
Siva Chandra Reddy [Tue, 12 May 2020 23:11:15 +0000 (16:11 -0700)]
[libc][Obvious] Fix deps of few threads targets.

A missing dep has been added, and a few redundent deps have been
removed.

2 years ago[libc++][test] Properly mark libc++-only XFAILs
Casey Carter [Tue, 12 May 2020 23:11:22 +0000 (16:11 -0700)]
[libc++][test] Properly mark libc++-only XFAILs

These tests PASS on libstdc++ and MSVC.

2 years ago[AMDGPU] Make v4i64/v4f64/v8i64/v8f64 legal
Stanislav Mekhanoshin [Tue, 12 May 2020 21:18:53 +0000 (14:18 -0700)]
[AMDGPU] Make v4i64/v4f64/v8i64/v8f64 legal

We can produce such vectors in the Promote Alloca pass,
but we are unable to use movrel to operate it and lower
via scratch. Making it legal makes SI_INDIRECT patterns
work.

There is more work to do in subsequent changes:

1. We initialize m0 twice to access each dword. It shall
be possible to only do it once and increment base register
number instead.
2. We also need v16i64/v16f64 but these first need to be
added to tablegen.

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

2 years ago[lldb/Reproducers] Also record directories FileSystem::Collect.
Jonas Devlieghere [Tue, 12 May 2020 20:18:35 +0000 (13:18 -0700)]
[lldb/Reproducers] Also record directories FileSystem::Collect.

Now that the FileCollector knows how to deal with directories we no
longer have to ignore them in the FileSystem class.

2 years agoRevert of Revert of [mlir][shape] Tidy up shape.shape_of
Sean Silva [Tue, 12 May 2020 20:40:00 +0000 (13:40 -0700)]
Revert of Revert of [mlir][shape] Tidy up shape.shape_of

Summary:

- Mark it NoSideEffect
- Add custom parser/printer

This reverts the temporary revert in
https://reviews.llvm.org/rG84a9c725742d26df04808a3c7349dbd98684c6cb
That was a false alarm. A downstream test actually needed to be updated.

2 years ago[YAMLVFSWriter] Fix for delimiters
Jan Korous [Tue, 12 May 2020 21:42:22 +0000 (14:42 -0700)]
[YAMLVFSWriter] Fix for delimiters

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

2 years ago[x86][CGP] enable target hook to sink funnel shift intrinsic's splatted shift amount
Sanjay Patel [Tue, 12 May 2020 21:08:24 +0000 (17:08 -0400)]
[x86][CGP] enable target hook to sink funnel shift intrinsic's splatted shift amount

SDAG suffers when it can't see that a funnel operand is a splat value
(due to single-basic-block visibility), so invert the normal loop
hoisting rules to move a splat op closer to its use.

This would be part 1 of an enhancement similar to D63233.

This is needed to re-fix PR37426:
https://bugs.llvm.org/show_bug.cgi?id=37426
...because we got better at canonicalizing IR to funnel shift intrinsics.

The existing CGP code for shift opcodes is likely overstepping what it was
intended to do, so that will be fixed in a follow-up.

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

2 years ago[GIsel] Update a comment and make it more precise.
Davide Italiano [Tue, 12 May 2020 22:37:44 +0000 (15:37 -0700)]
[GIsel] Update a comment and make it more precise.

This only covers ANYEXT/ZEXT. SEXT is covered in another test
I just checked in.

2 years ago[mlir] Move Conversion/StandardToStandard to Dialect/StandardOps/Transforms/FuncConve...
Alex Zinenko [Tue, 12 May 2020 22:30:54 +0000 (00:30 +0200)]
[mlir] Move Conversion/StandardToStandard to Dialect/StandardOps/Transforms/FuncConversions

Conversion/ folders were originally intended to store patterns for
DialectA->DialectB conversions that depend on both dialects and do not
conceptually belong to either of the dialects. As such, DialectA->DialectA
conversion does not make sense under Conversion/ and should rather live with
the dialect it operates on.

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

2 years ago[GlobalISel] Assign the correct location when combining G_SEXT.
Davide Italiano [Tue, 12 May 2020 22:31:34 +0000 (15:31 -0700)]
[GlobalISel] Assign the correct location when combining G_SEXT.

<rdar://problem/62991635>

2 years agoFix buildbots #2 after aa1eb5152d9a5bd588c8479a376fa65cbeabbc9f.
Alexey Lapshin [Tue, 12 May 2020 22:20:33 +0000 (01:20 +0300)]
Fix buildbots #2 after aa1eb5152d9a5bd588c8479a376fa65cbeabbc9f.

2 years agoPowerPC: Treat llvm.fma.f* intrinsic as using CTR with SPE
Justin Hibbits [Sun, 19 Apr 2020 04:09:30 +0000 (23:09 -0500)]
PowerPC: Treat llvm.fma.f* intrinsic as using CTR with SPE

Summary:
The SPE doesn't have a 'fma' instruction, so the intrinsic becomes a
libcall.  It really should become an expansion to two instructions, but
for some reason the compiler doesn't think that's as optimal as a
branch.  Since this lowering is done after CTR is allocated for loops,
tell the optimizer that CTR may be used in this case.  This prevents a
"Invalid PPC CTR loop!" assertion in the case that a fma() function call
is used in a C/C++ file, and clang converts it into an intrinsic.

Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D78668

2 years agoFix buildbots after aa1eb5152d9a5bd588c8479a376fa65cbeabbc9f.
Alexey Lapshin [Tue, 12 May 2020 22:10:32 +0000 (01:10 +0300)]
Fix buildbots after aa1eb5152d9a5bd588c8479a376fa65cbeabbc9f.

2 years ago[SampleFDO] Rename llvm-profdata flag -partial-profile to -gen-partial-profile.
Wei Mi [Tue, 12 May 2020 21:48:22 +0000 (14:48 -0700)]
[SampleFDO] Rename llvm-profdata flag -partial-profile to -gen-partial-profile.

The internal flag -partial-profile in llvm conflicts with the flag with
the same name in llvm-profdata. The conflict happens in builds with
LLVM_LINK_LLVM_DYLIB enabled. In this case the tools are linked with libLLVM
and we end up with two definitions for the same cl::opt.

The patch renames llvm-profdata flag -partial-profile to -gen-partial-profile.

2 years ago[VirtualFileSystem] Add unit test that showcases another YAMLVFSWriter bug
Jonas Devlieghere [Tue, 12 May 2020 21:55:17 +0000 (14:55 -0700)]
[VirtualFileSystem] Add unit test that showcases another YAMLVFSWriter bug

This scenario generates another broken YAML mapping as illustrated below.

  {
    'type': 'directory',
    'name': "c",
    'contents': [
      ,
      {
        'type': 'directory',
        'name': "d",
        'contents': [
          ,
          {
            'type': 'directory',
            'name': "e",
            'contents': [
              {
                'type': 'file',
                'name': "f",
                'external-contents': "//root/a/c/d/e/f"
              }                    {
                'type': 'file',
                'name': "g",
                'external-contents': "//root/a/c/d/e/g"
              }
            ]
          }
        ]
      }
    ]
  },

2 years ago[VirtualFileSystem] Add unit test that showcases YAMLVFSWriter bug
Jonas Devlieghere [Tue, 12 May 2020 21:46:23 +0000 (14:46 -0700)]
[VirtualFileSystem] Add unit test that showcases YAMLVFSWriter bug

This scenario generates a broken YAML mapping as illustrated below.

 {
   'type': 'directory',
   'name': "c",
   'contents': [
     {
       'type': 'file',
       'name': "d",
       'external-contents': "//root/a/c/d"
     }            {
       'type': 'file',
       'name': "e",
       'external-contents': "//root/a/c/e"
     }            {
       'type': 'file',
       'name': "f",
       'external-contents': "//root/a/c/f"
     }
   ]
 },

2 years ago[X86][ISelLowering] refactor Varargs handling in X86ISelLowering.cpp
Alexey Lapshin [Wed, 12 Feb 2020 17:47:39 +0000 (20:47 +0300)]
[X86][ISelLowering] refactor Varargs handling in X86ISelLowering.cpp

Summary:
This patch refactors handling of VarArgs in
X86TargetLowering::LowerFormalArguments.
That refactoring was requested while reviewing
D69372. Code related to varargs handling is removed
from X86TargetLowering::LowerFormalArguments and
is divided into smaller routines.

Reviewed By: aeubanks

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

2 years ago[TargetLoweringObjectFileImpl] Produce .text.hot. instead of .text.hot for -fno-uniqu...
Fangrui Song [Thu, 7 May 2020 21:00:24 +0000 (14:00 -0700)]
[TargetLoweringObjectFileImpl] Produce .text.hot. instead of .text.hot for -fno-unique-section-names

GNU ld's internal linker script uses (https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=add44f8d5c5c05e08b11e033127a744d61c26aee)

  .text           :
  {
    *(.text.unlikely .text.*_unlikely .text.unlikely.*)
    *(.text.exit .text.exit.*)
    *(.text.startup .text.startup.*)
    *(.text.hot .text.hot.*)
    *(SORT(.text.sorted.*))
    *(.text .stub .text.* .gnu.linkonce.t.*)
    /* .gnu.warning sections are handled specially by elf.em.  */
    *(.gnu.warning)
  }

Because `*(.text.exit .text.exit.*)` is ordered before `*(.text .text.*)`, in a -ffunction-sections build, the C library function `exit` will be placed before other functions.
gold's `-z keep-text-section-prefix` has the same problem.

In lld, `-z keep-text-section-prefix` recognizes `.text.{exit,hot,startup,unlikely,unknown}.*`, but not `.text.{exit,hot,startup,unlikely,unknown}`, to avoid the strange placement problem.

In -fno-function-sections or -fno-unique-section-names mode, a function whose `function_section_prefix` is set to `.exit"`
will go to the output section `.text` instead of `.text.exit` when linked by lld.
To address the problem, append a dot to become `.text.exit.`

Reviewed By: grimar

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

2 years ago[libc++abi] Adjust XFAIL on macOS for bug that was fixed in recent OSes
Louis Dionne [Tue, 12 May 2020 20:57:53 +0000 (16:57 -0400)]
[libc++abi] Adjust XFAIL on macOS for bug that was fixed in recent OSes

2 years ago[Attributor] Fixup block addresses after rewriting function signature
Sergey Dmitriev [Tue, 12 May 2020 20:31:03 +0000 (13:31 -0700)]
[Attributor] Fixup block addresses after rewriting function signature

Reviewers: jdoerfert, sstefan1, uenoku

Reviewed By: jdoerfert

Subscribers: hiraditya, uenoku, llvm-commits

Tags: #llvm

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

2 years agoPR45589: Properly decompose overloaded `&&` and `||` operators in
Richard Smith [Tue, 12 May 2020 20:14:32 +0000 (13:14 -0700)]
PR45589: Properly decompose overloaded `&&` and `||` operators in
constraint expressions.

We create overloaded `&&` and `||` operators to hold the possible
unqualified lookup results (if any) when the operands are dependent. We
could avoid building these in some cases (we will never use the stored
lookup results, and it would be better to not store them or perform the
lookups), but in the general case we will probably still need to handle
overloaded operators even with that optimization.

2 years ago[MLIR] Fix dependencies for Analysis libraries
Stephen Neuendorffer [Tue, 12 May 2020 20:37:31 +0000 (13:37 -0700)]
[MLIR] Fix dependencies for Analysis libraries

cmake does not truly support dependencies on automatically generated files
which are not in the same directory as the targets which depend on them.
It works with ninja, but doesn't work with make

This patch adds an explicit dependence so that all dialects are built
before the analysis libraries.

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

2 years ago[analyzer] SATestBuild.py: Fix support for #NOPREFIX.
Artem Dergachev [Tue, 12 May 2020 19:43:32 +0000 (22:43 +0300)]
[analyzer] SATestBuild.py: Fix support for #NOPREFIX.

Regressed in ec2d93c.

2 years ago[MLIR] Rename SideEffects.td -> SideEffectInterfaces.td
Stephen Neuendorffer [Wed, 6 May 2020 19:52:00 +0000 (12:52 -0700)]
[MLIR] Rename SideEffects.td -> SideEffectInterfaces.td

This normalize the name of the tablegen file with the name of the generated
files (SideEffectInterfaces.h.inc) and the other Interface tablegen files,
which all end in Interface(s).td

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

2 years ago[lldb/Driver] Support terminal resizing
Fred Riss [Fri, 8 May 2020 22:14:14 +0000 (15:14 -0700)]
[lldb/Driver] Support terminal resizing

Summary:
The comment in the Editine.h header made it sound like editline was
just unable to handle terminal resizing. We were not ever telling
editline that the terminal had changed size, which might explain why
it wasn't working.

This patch threads a `TerminalSizeChanged()` callback through the
IOHandler and invokes it from the SIGWINCH handler in the driver. Our
`Editline` class already had a `TerminalSizeChanged()` method which
was invoked only when editline was configured.

This patch also changes `Editline` to not apply the changes right away
in `TerminalSizeChanged()`, but instead defer that to the next
character read. During my testing, it happened once that the signal
was received while our `ConnectionFileDescriptor::Read` was allocating
memory. As `el_resize` seems to allocate memory too, this crashed.

Reviewers: labath, teemperor

Subscribers: lldb-commits

Tags: #lldb

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

2 years agoAvoid binding pointers to "auto&" (by dereferencing the pointer that's non-null anyway)
David Blaikie [Tue, 12 May 2020 18:39:01 +0000 (11:39 -0700)]
Avoid binding pointers to "auto&" (by dereferencing the pointer that's non-null anyway)

Based on @djtodoro's 2552dc5317e0

2 years ago[libcxx] Re-commit: shared_ptr changes from library fundamentals (P0414R2).
zoecarver [Tue, 12 May 2020 01:42:50 +0000 (18:42 -0700)]
[libcxx] Re-commit: shared_ptr changes from library fundamentals (P0414R2).

Implements P0414R2:
  * Adds support for array types in std::shared_ptr.
  * Adds reinterpret_pointer_cast for shared_ptr.

Re-committing now that the leaking tests are fixed.

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

2 years ago[PowerPC] Fold redundant load immediates of zero and delete if possible
Kamau Bridgeman [Tue, 12 May 2020 18:15:06 +0000 (13:15 -0500)]
[PowerPC] Fold redundant load immediates of zero and delete if possible

This patch folds redundant load immediates into a zero for instructions
which recognise this as the value zero and not the register. If the load
immediate is no longer in use it is then deleted.

This is already done in earlier passes but the ppc-mi-peephole allows for
a more general implementation.

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

2 years ago[Reproducers] Serialize process arguments in ProcessInfo
Jonas Devlieghere [Tue, 12 May 2020 17:28:27 +0000 (10:28 -0700)]
[Reproducers] Serialize process arguments in ProcessInfo

While debugging why TestProcessList.py failed during passive replay, I
remembered that we don't serialize the arguments for ProcessInfo. This
is necessary to make the test pass and to make platform process list -v
behave the same during capture and replay.

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

2 years ago[FileCollector][NFC] Add comments
Jan Korous [Fri, 8 May 2020 23:29:17 +0000 (16:29 -0700)]
[FileCollector][NFC] Add comments

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

2 years ago[ValueTracking] Let propagatesPoison support binops/unaryops/cast/etc.
Juneyoung Lee [Mon, 20 Apr 2020 15:35:45 +0000 (00:35 +0900)]
[ValueTracking] Let propagatesPoison support binops/unaryops/cast/etc.

Summary:
This patch makes propagatesPoison be more accurate by returning true on
more bin ops/unary ops/casts/etc.

The changed test in ScalarEvolution/nsw.ll was introduced by
https://github.com/llvm/llvm-project/commit/a19edc4d15b0dae0210b90615775edd76f021008 .
IIUC, the goal of the tests is to show that iv.inc's SCEV expression still has
no-overflow flags even if the loop isn't in the wanted form.
It becomes more accurate with this patch, so think this is okay.

Reviewers: spatel, lebedev.ri, jdoerfert, reames, nikic, sanjoy

Reviewed By: spatel, nikic

Subscribers: regehr, nlopes, efriedma, fhahn, javed.absar, llvm-commits, hiraditya

Tags: #llvm

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

2 years ago[X86] Remove the v16i8->v16i16 path for MULHS with AVX2.
Craig Topper [Tue, 12 May 2020 17:10:42 +0000 (10:10 -0700)]
[X86] Remove the v16i8->v16i16 path for MULHS with AVX2.

We have a couple main strategies for legalizing MULH.

-If the vXi16 type is legal, extend to do the full i16 multiply
and then shift and truncate the results.
-Use unpcks to split each 128 bit lane into high and low halves.a

For signed we have an extra case to split a v32i8 to v16i8 and then
use the extending to v16i16 strategy.

This patch proposes to use the unpck strategy instead. Which is
what we already do for unsigned.

This seems to be 1 instruction shorter when the RHS is constant
like the idiv case. It's 1 instruction longer for the smulo case.
But we're trading cross lane shuffles for inlane shuffles and a
shift.

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

2 years ago[arm] Add big-endian version of pcrel fixups for adr instructions
Dimitry Andric [Tue, 12 May 2020 10:33:15 +0000 (12:33 +0200)]
[arm] Add big-endian version of pcrel fixups for adr instructions

Summary:
In 2e24219d3cbf, a number of ARM pcrel fixups were resolved at assembly
time, to solve PR44929. This only covered little-endian ARM however, so
add similar fixups for big-endian ARM. Also extend the test case to
cover big-endian ARM.

Reviewers: hans, psmith, MaskRay

Reviewed By: psmith, MaskRay

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

Tags: #llvm

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

2 years ago[AMDGPU] Add AGPRs to getRegClassForSizeOnBank
Austin Kerbow [Tue, 12 May 2020 03:30:10 +0000 (20:30 -0700)]
[AMDGPU] Add AGPRs to getRegClassForSizeOnBank

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

2 years ago[CodeGen] Use Align in MachineConstantPool.
Craig Topper [Tue, 12 May 2020 16:43:24 +0000 (09:43 -0700)]
[CodeGen] Use Align in MachineConstantPool.

2 years ago[VectorCombine] add test to check for iterative improvements; NFC
Sanjay Patel [Tue, 12 May 2020 16:48:51 +0000 (12:48 -0400)]
[VectorCombine] add test to check for iterative improvements; NFC

2 years ago[WebAssembly] Implement pseudo-min/max SIMD instructions
Thomas Lively [Tue, 12 May 2020 16:39:01 +0000 (09:39 -0700)]
[WebAssembly] Implement pseudo-min/max SIMD instructions

Summary:
As proposed in https://github.com/WebAssembly/simd/pull/122. Since
these instructions are not yet merged to the SIMD spec proposal, this
patch makes them entirely opt-in by surfacing them only through LLVM
intrinsics and clang builtins. If these instructions are made
official, these intrinsics and builtins should be replaced with simple
instruction patterns.

Reviewers: aheejin

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

Tags: #clang, #llvm

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

2 years ago[gcov][test] Fix clang test
Fangrui Song [Tue, 12 May 2020 16:21:19 +0000 (09:21 -0700)]
[gcov][test] Fix clang test

2 years ago[gcov] Default coverage version to '408*' and delete CC1 option -coverage-exit-block...
Fangrui Song [Tue, 12 May 2020 06:20:33 +0000 (23:20 -0700)]
[gcov] Default coverage version to '408*' and delete CC1 option -coverage-exit-block-before-body

gcov 4.8 (r189778) moved the exit block from the last to the second.
The .gcda format is compatible with 4.7 but

* decoding libgcov 4.7 produced .gcda with gcov [4.7,8) can mistake the
  exit block, emit bogus `%s:'%s' has arcs from exit block\n` warnings,
  and print wrong `" returned %s` for branch statistics (-b).
* decoding libgcov 4.8 produced .gcda with gcov 4.7 has similar issues.

Also, rename "return block" to "exit block" because the latter is the
appropriate term.

2 years ago[PassBuilder] Moved ProfileSummaryAnalysis in buildInlinerPipeline.
Whitney Tsang [Tue, 12 May 2020 15:56:14 +0000 (15:56 +0000)]
[PassBuilder] Moved ProfileSummaryAnalysis in buildInlinerPipeline.

Summary:
As commented in the code, ProfileSummaryAnalysis is required for inliner
pass to query, so this patch moved
RequireAnalysisPass<ProfileSummaryAnalysis> in the recently created
buildInlinerPipeline.
Reviewer: mtrofin, davidxl, tejohnson, dblaikie, jdoerfert, sstefan1
Reviewed By: mtrofin, davidxl, jdoerfert
Subscribers: hiraditya, steven_wu, dexonsmith, wuzish, llvm-commits,
jsji
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D79696

2 years ago[GlobalISel][IRTranslator] Fix <1 x Ty> handling in ConstantExprs
Jay Foad [Fri, 17 Apr 2020 15:17:26 +0000 (16:17 +0100)]
[GlobalISel][IRTranslator] Fix <1 x Ty> handling in ConstantExprs

Summary:
ConstantExprs involving operations on <1 x Ty> could translate into MIR
that failed to verify with:
*** Bad machine code: Reading virtual register without a def ***

The problem was that translate(const Constant &C, Register Reg) had
recursive calls that passed the same Reg in for the translation of a
subexpression, but without updating VMap for the subexpression first as
translate(const Constant &C, Register Reg) expects.

Fix this by using the same translateCopy helper function that we use for
translating Instructions. In some cases this causes extra G_COPY
MIR instructions to be generated.

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

Reviewers: arsenm, volkan, t.p.northover, aditya_nandakumar

Subscribers: jvesely, wdng, nhaehnle, rovka, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

2 years ago[GlobalISel][IRTranslator] New helper function translateCopy. NFC.
Jay Foad [Fri, 17 Apr 2020 13:36:01 +0000 (14:36 +0100)]
[GlobalISel][IRTranslator] New helper function translateCopy. NFC.

Reviewers: arsenm, volkan, t.p.northover, aditya_nandakumar

Subscribers: wdng, rovka, hiraditya, llvm-commits

Tags: #llvm

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

2 years ago[Matrix] Check non-dependent elt type before creating DepSizedMatrix.
Florian Hahn [Tue, 12 May 2020 15:37:01 +0000 (16:37 +0100)]
[Matrix] Check non-dependent elt type before creating DepSizedMatrix.

We should check non-dependent element types before creating a
DependentSizedMatrixType. Otherwise we do not generate an error message
for dependent-sized matrix types with invalid non-dependent element
types, if the template is never instantiated. See the make5 struct in
the tests.

It also moves the SEMA template tests to
clang/test/SemaTemplate/matrix-type.cpp and introduces a few more test
cases.