platform/upstream/llvm.git
4 years ago[OPENMP][DOCS]Mark array shaping as done, NFC.
Alexey Bataev [Tue, 31 Mar 2020 23:12:52 +0000 (19:12 -0400)]
[OPENMP][DOCS]Mark array shaping as done, NFC.

4 years ago[OPENMP50]Codegen for array shaping expression in map clauses.
Alexey Bataev [Mon, 30 Mar 2020 20:06:01 +0000 (16:06 -0400)]
[OPENMP50]Codegen for array shaping expression in map clauses.

Added codegen support for array shaping operations in map/to/from
clauses.

4 years ago[lit] Refine adoption of argparse --version action
Julian Lettner [Wed, 30 Oct 2019 06:06:00 +0000 (23:06 -0700)]
[lit] Refine adoption of argparse --version action

The real work for this was already done by serge-sans-paille [1].
Thanks for this!

[1] 1d4849379f71a0f5d73202a291c0b709f7cafbc5

4 years ago[debugserver/ARM64] Make sure watchpoints hit are attributed correctly.
Davide Italiano [Tue, 31 Mar 2020 20:55:36 +0000 (13:55 -0700)]
[debugserver/ARM64] Make sure watchpoints hit are attributed correctly.

This didn't happen for arm64 if you have watches for variables
that are contigous in memory.

<rdar://problem/55135006>

4 years ago[OPENMP50]Fix size calculation for array shaping expression in the
Alexey Bataev [Tue, 31 Mar 2020 22:26:58 +0000 (18:26 -0400)]
[OPENMP50]Fix size calculation for array shaping expression in the
codegen.

Need to include the size of the pointee type when trying to calculate
the total size of the array shaping expression.

4 years ago[libomptarget][nfc] Move non-freestanding headers out of common
JonChesterfield [Tue, 31 Mar 2020 22:43:03 +0000 (23:43 +0100)]
[libomptarget][nfc] Move non-freestanding headers out of common

Summary:
[libomptarget][nfc] Move non-freestanding headers out of common

Lowers the bar for building deviceRTL.
Drops math.h entirely as it wasn't used and libm is a big dependency.

Reviewers: jdoerfert, ABataev, grokos

Reviewed By: jdoerfert

Subscribers: jvesely, openmp-commits

Tags: #openmp

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

4 years ago[mlir][spirv] Include SPIR-V op definitions in main SPIR-V doc
Lei Zhang [Tue, 31 Mar 2020 21:08:12 +0000 (17:08 -0400)]
[mlir][spirv] Include SPIR-V op definitions in main SPIR-V doc

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

4 years agoFix MSan false positive due to select folding.
Evgenii Stepanov [Tue, 17 Mar 2020 22:33:26 +0000 (15:33 -0700)]
Fix MSan false positive due to select folding.

Summary:
Select folding in JumpThreading can create a conditional branch on a
code patch that did not have one in the original program. This is not a
valid transformation in sanitize_memory functions.

Note that JumpThreading does select folding in 3 different places. Two
of them seem safe - they apply to a select instruction in a BB that ends
with an unconditional branch to another BB, which (in turn) ends with a
conditional branch or a switch with the same condition.

Fixes PR45220.

Reviewers: glider, dvyukov, efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ELF][test] Add 'REQUIRES: x86' to threads.s
Fangrui Song [Tue, 31 Mar 2020 22:25:01 +0000 (15:25 -0700)]
[ELF][test] Add 'REQUIRES: x86' to threads.s

4 years agoAMDGPU: Make HIPToolChain a subclass of AMDGPUToolChain
Matt Arsenault [Thu, 26 Mar 2020 18:31:00 +0000 (14:31 -0400)]
AMDGPU: Make HIPToolChain a subclass of AMDGPUToolChain

This fixes some code duplication. This is also a step towards
consolidating builtin library handling.

4 years ago[PPCInstPrinter] Print conditional branches as `bt 2, $target` instead of `bt 2,...
Fangrui Song [Fri, 27 Mar 2020 06:40:23 +0000 (23:40 -0700)]
[PPCInstPrinter] Print conditional branches as `bt 2, $target` instead of `bt 2, .+$imm`

Follow-up of D76591.

Reviewed By: #powerpc, sfertile

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

4 years agoHIP: Ensure new denormal mode attributes are set
Matt Arsenault [Thu, 26 Mar 2020 15:17:53 +0000 (11:17 -0400)]
HIP: Ensure new denormal mode attributes are set

Apparently HIPToolChain does not subclass from AMDGPUToolChain, so
this was not applying the new denormal attributes. I'm not sure why
this doesn't subclass. Just copy the implementation for now.

4 years agoReplace uint32_t with typedef (NFC)
Adrian Prantl [Tue, 31 Mar 2020 21:58:25 +0000 (14:58 -0700)]
Replace uint32_t with typedef (NFC)

4 years agoAdd a Type::Payload typedef. (NFC)
Adrian Prantl [Tue, 31 Mar 2020 21:12:11 +0000 (14:12 -0700)]
Add a Type::Payload typedef. (NFC)

This addresses review feedback from Raphael that I missed before
landing the change that introduced the payload field.

4 years ago[FileCheck] Add missing %ProtectFileCheckOutput to FileCheck tests
Joel E. Denny [Tue, 31 Mar 2020 20:41:59 +0000 (16:41 -0400)]
[FileCheck] Add missing %ProtectFileCheckOutput to FileCheck tests

I'm committing this fixup without review because it's an obvious
continuation of D65121 (committed at f471eb8e99b5).

4 years ago[Object] Update ObjectFile::makeTriple for XCOFF
Hubert Tong [Tue, 31 Mar 2020 21:24:22 +0000 (17:24 -0400)]
[Object] Update ObjectFile::makeTriple for XCOFF

Summary:
When we encounter an XCOFF file, reflect that in the triple information.
In addition to knowing the object file format, we know that the
associated OS is AIX.

This means that we can expect that there is no output difference in the
processing of an XCOFF32 input file between cases where the triple is
left unspecified by the user and cases where the user specifies
`--triple powerpc-ibm-aix` explicitly.

Reviewers: jhenderson, sfertile, jasonliu, daltenty

Reviewed By: jasonliu

Subscribers: wuzish, nemanjai, hiraditya, MaskRay, rupprecht, steven.zhang, llvm-commits

Tags: #llvm

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

4 years ago[AArch64] Change AArch64 Windows EH UnwindHelp object to be a fixed object
Daniel Frampton [Tue, 31 Mar 2020 20:12:54 +0000 (13:12 -0700)]
[AArch64] Change AArch64 Windows EH UnwindHelp object to be a fixed object

The UnwindHelp object is used during exception handling by runtime
code. It must be findable from a fixed offset from FP.

This change allocates the UnwindHelp object as a fixed object (as is
done for x86_64) to ensure that both the generated code and runtime
agree on the location of the object.

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

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

4 years ago[AArch64] Fix mismatch in prologue and epilogue for funclets on Windows
Daniel Frampton [Tue, 31 Mar 2020 20:11:16 +0000 (13:11 -0700)]
[AArch64] Fix mismatch in prologue and epilogue for funclets on Windows

The generated code for a funclet can have an add to sp in the epilogue
for which there is no corresponding sub in the prologue.

This patch removes the early return from emitPrologue that was
preventing the sub to sp, and instead conditionalizes the appropriate
parts of the rest of the function.

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

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

4 years ago[OPENMP50]Allow use of array shaping expression in a list.
Alexey Bataev [Tue, 31 Mar 2020 20:53:00 +0000 (16:53 -0400)]
[OPENMP50]Allow use of array shaping expression in a list.

Need to allow arrayshaping expression in a list of expressions, so use
ParseAssignmentExpression() when try to parse the base of the shaping
operation.

4 years ago[libc++] Use 'export' instead of 'env' to run remote commands
Louis Dionne [Tue, 31 Mar 2020 21:10:29 +0000 (17:10 -0400)]
[libc++] Use 'export' instead of 'env' to run remote commands

This allows running commands that use shell builtins remotely too, when
'env' would complain that it can't find the program.

4 years ago[clangd] Don't build clangdserver for (most) completion tests. NFC
Sam McCall [Tue, 31 Mar 2020 21:09:28 +0000 (23:09 +0200)]
[clangd] Don't build clangdserver for (most) completion tests. NFC

4 years agoFixed windows failure after D74873
Stanislav Mekhanoshin [Tue, 31 Mar 2020 20:40:09 +0000 (13:40 -0700)]
Fixed windows failure after D74873

Print format LaneBitmask was set as "%016lX" but should be
"%016llX" for 64 bit support on Windows.

4 years ago[MLIR][NFC] modernize affine.for unroll test pass
Uday Bondhugula [Tue, 31 Mar 2020 19:47:02 +0000 (01:17 +0530)]
[MLIR][NFC] modernize affine.for unroll test pass

The walk code here was written before any of the support was
available in IR/. Replace/cleanup.

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

4 years ago[pch] Honour -fallow-pch-with-compiler-errors for overall compilation status
Ben Langmuir [Tue, 31 Mar 2020 16:26:59 +0000 (09:26 -0700)]
[pch] Honour -fallow-pch-with-compiler-errors for overall compilation status

Previously we would emit a PCH with errors, but fail the overall
compilation. If run using the driver, that would result in removing the
just-produced PCH. Instead, we should have the compilation result match
whether we were able to emit the PCH.

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

rdar://61110294

4 years agoSwitch this function to the LLVM variable naming convention, to match the rest of...
Richard Smith [Tue, 31 Mar 2020 03:14:02 +0000 (20:14 -0700)]
Switch this function to the LLVM variable naming convention, to match the rest of the file.

4 years ago[cmake] Link libc++ tests against static libc++/libc++abi in CrossWinToARMLinux.cmake
Sergej Jaskiewicz [Tue, 31 Mar 2020 20:36:18 +0000 (23:36 +0300)]
[cmake] Link libc++ tests against static libc++/libc++abi in CrossWinToARMLinux.cmake

Summary: Now that D72687 has landed, we can enable this setting in our cache file.

Reviewers: vvereschaka

Reviewed By: vvereschaka

Subscribers: mgorny, kristof.beyls, cfe-commits

Tags: #clang

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

4 years agoRevert "[InlineFunction] Handle return attributes on call within inlined body"
Anna Thomas [Tue, 31 Mar 2020 20:15:32 +0000 (16:15 -0400)]
Revert "[InlineFunction] Handle return attributes on call within inlined body"

This reverts commit 28518d9ae39ff5c6044e230d58b6ae28b0252cae.
There is a failure in MsgPackReader.cpp when built with clang. It
complains about "signext and zeroext" are incompatible. Investigating
offline if it is infact a UB in the MsgPackReader code.

4 years ago[InstCombine] Use replaceOperand() in some select transforms
Nikita Popov [Mon, 30 Mar 2020 19:48:33 +0000 (21:48 +0200)]
[InstCombine] Use replaceOperand() in some select transforms

To make sure the old operand is DCEd.

NFC apart from worklist order.

4 years agoRemove "mask" operand from shufflevector.
Eli Friedman [Tue, 31 Mar 2020 20:08:59 +0000 (13:08 -0700)]
Remove "mask" operand from shufflevector.

Instead, represent the mask as out-of-line data in the instruction. This
should be more efficient in the places that currently use
getShuffleVector(), and paves the way for further changes to add new
shuffles for scalable vectors.

This doesn't change the syntax in textual IR. And I don't currently plan
to change the bitcode encoding in this patch, although we'll probably
need to do something once we extend shufflevector for scalable types.

I expect that once this is finished, we can then replace the raw "mask"
with something more appropriate for scalable vectors.  Not sure exactly
what this looks like at the moment, but there are a few different ways
we could handle it.  Maybe we could try to describe specific shuffles.
Or maybe we could define it in terms of a function to convert a fixed-length
array into an appropriate scalable vector, using a "step", or something
like that.

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

4 years ago[InstCombine] Use replaceOperand() in descaling
Nikita Popov [Mon, 30 Mar 2020 19:31:00 +0000 (21:31 +0200)]
[InstCombine] Use replaceOperand() in descaling

To make sure the old operand gets DCEd.

NFC apart from worklist order.

4 years ago[InstCombine] Erase old alloca in cast of alloca transform
Nikita Popov [Mon, 30 Mar 2020 18:58:58 +0000 (20:58 +0200)]
[InstCombine] Erase old alloca in cast of alloca transform

As we don't return the replaceInstUsesWith() result, we are
responsible for erasing the instruction.

NFC apart from worklist order.

4 years ago[InstCombine] Use replaceOperand() in non zero phi transform
Nikita Popov [Sun, 29 Mar 2020 20:12:00 +0000 (22:12 +0200)]
[InstCombine] Use replaceOperand() in non zero phi transform

To make sure the old operand gets DCEd.

NFC apart from worklist order changes.

4 years ago[InstCombine] Report change in non zero phi transform
Nikita Popov [Sun, 29 Mar 2020 20:10:31 +0000 (22:10 +0200)]
[InstCombine] Report change in non zero phi transform

We need to inform InstCombine (and transitively the pass manager)
that we changed an instruction.

4 years ago[libc++] Allow running .sh.cpp tests with SSHExecutors
Louis Dionne [Tue, 31 Mar 2020 16:09:20 +0000 (12:09 -0400)]
[libc++] Allow running .sh.cpp tests with SSHExecutors

This commit adds a script that can be used as an %{exec} substitution
such that .sh.cpp tests can now run on remote hosts when using the
SSHExecutor.

4 years agoRe-land "[lldb/Reproducers] Always collect the whole dSYM in the reproducer"
Jonas Devlieghere [Tue, 31 Mar 2020 18:35:55 +0000 (11:35 -0700)]
Re-land "[lldb/Reproducers] Always collect the whole dSYM in the reproducer"

The FileCollector in LLDB collects every files that's used during a
debug session when capture is enabled. This ensures that the reproducer
only contains the files necessary to reproduce. This approach is not a
good fit for the dSYM bundle, which is a directory on disk, but should
be treated as a single unit.

On macOS LLDB have automatically find the matching dSYM for a binary by
its UUID. Having a incomplete dSYM in a reproducer can break debugging
even when reproducers are disabled.

This patch adds a was to specify a directory of interest to the
reproducers. It is called from SymbolVendorMacOSX with the path of the
dSYMs used by LLDB.

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

4 years ago[docs] Make llvm-addr2line documentation more explicit about which
Richard Smith [Tue, 31 Mar 2020 03:10:57 +0000 (20:10 -0700)]
[docs] Make llvm-addr2line documentation more explicit about which
behavior is llvm-addr2line's and which is llvm-symbolizer's.

4 years ago[mlir][spirv] Change op doc description autogen separator
Lei Zhang [Tue, 31 Mar 2020 16:26:04 +0000 (12:26 -0400)]
[mlir][spirv] Change op doc description autogen separator

This commit changes the separator line for dividing auto-generated
docs from spec and manually added appendix from "### Custom assembly
form" to "<!-- End of AutoGen section -->". This is in preparation
to use the declarative assembly form in MLIR core. We will replace
more and more manually written assembly forms to be autogenerated.

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

4 years ago[gn build] Port 03f43b3aca36
Fangrui Song [Tue, 31 Mar 2020 19:08:02 +0000 (12:08 -0700)]
[gn build] Port 03f43b3aca36

4 years agoAdd a new -fglobal-isel option and make -fexperimental-isel an alias for it.
Amara Emerson [Mon, 30 Mar 2020 22:31:48 +0000 (15:31 -0700)]
Add a new -fglobal-isel option and make -fexperimental-isel an alias for it.

Since GlobalISel is maturing and is already on at -O0 for AArch64, it's not
completely "experimental". Create a more appropriate driver flag and make
the older option an alias for it.

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

4 years ago[AArch64][SVE] Add support for fcmp.
Eli Friedman [Fri, 27 Mar 2020 02:20:59 +0000 (19:20 -0700)]
[AArch64][SVE] Add support for fcmp.

This also requires support for boolean "not", so I added boolean logic
while I was there.

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

4 years agoReplace std::string::find == 0 with StringRef::startswith
Benjamin Kramer [Tue, 31 Mar 2020 18:56:24 +0000 (20:56 +0200)]
Replace std::string::find == 0 with StringRef::startswith

This is both more readable and faster. Found by clang-tidy's
abseil-string-find-startswith.

4 years ago[lld] Initial commit for new Mach-O backend
Jez Ng [Tue, 31 Mar 2020 18:45:47 +0000 (11:45 -0700)]
[lld] Initial commit for new Mach-O backend

Summary:
This is the first commit for the new Mach-O backend, designed to roughly
follow the architecture of the existing ELF and COFF backends, and
building off work that @ruiu and @pcc did in a branch a while back. Note
that this is a very stripped-down commit with the bare minimum of
functionality for ease of review. We'll be following up with more diffs
soon.

Currently, we're able to generate a simple "Hello World!" executable
that runs on OS X Catalina (and possibly on earlier OS X versions; I
haven't tested them). (This executable can be obtained by compiling
`test/MachO/relocations.s`.) We're mocking out a few load commands to
achieve this -- for example, we can't load dynamic libraries, but
Catalina requires binaries to be linked against `dyld`, so we hardcode
the emission of a `LC_LOAD_DYLIB` command. Other mocked out load
commands include LC_SYMTAB and LC_DYSYMTAB.

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

4 years ago[CodeGenPrepare] Delete intrinsic call to llvm.assume to enable more tailcall
Guozhi Wei [Tue, 31 Mar 2020 18:55:51 +0000 (11:55 -0700)]
[CodeGenPrepare] Delete intrinsic call to llvm.assume to enable more tailcall

The attached test case is simplified from tcmalloc. Both function calls should be optimized as tailcall. But llvm can only optimize the first call. The second call can't be optimized because function dupRetToEnableTailCallOpts failed to duplicate ret into block case2.

There 2 problems blocked the duplication:

  1 Intrinsic call llvm.assume is not handled by dupRetToEnableTailCallOpts.
  2 The control flow is more complex than expected, dupRetToEnableTailCallOpts can only duplicate ret into its predecessor, but here we have an intermediate block between call and ret.

The solutions:

  1 Since CodeGenPrepare is already at the end of LLVM IR phase, we can simply delete the intrinsic call to llvm.assume.
  2 A general solution to the complex control flow is hard, but for this case, after exit2 is duplicated into case1, exit2 is the only successor of exit1 and exit1 is the only predecessor of exit2, so they can be combined through eliminateFallThrough. But this function is called too late, there is no more dupRetToEnableTailCallOpts after it. We can add an earlier call to eliminateFallThrough to solve it.

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

4 years ago[AMDGPU] Define 16 bit VGPR subregs
Stanislav Mekhanoshin [Wed, 5 Feb 2020 20:52:02 +0000 (12:52 -0800)]
[AMDGPU] Define 16 bit VGPR subregs

We have loads preserving low and high 16 bits of their
destinations. However, we always use a whole 32 bit register
for these. The same happens with 16 bit stores, we have to
use full 32 bit register so if high bits are clobbered the
register needs to be copied. One example of such code is
added to the load-hi16.ll.

The proper solution to the problem is to define 16 bit subregs
and use them in the operations which do not read another half
of a VGPR or preserve it if the VGPR is written.

This patch simply defines subregisters and register classes.
At the moment there should be no difference in code generation.
A lot more work is needed to actually use these new register
classes. Therefore, there are no new tests at this time.

Register weight calculation has changed with new subregs so
appropriate changes were made to keep all calculations just
as they are now, especially calculations of register pressure.

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

4 years ago[InlineFunction] Handle return attributes on call within inlined body
Anna Thomas [Sun, 22 Mar 2020 17:59:10 +0000 (13:59 -0400)]
[InlineFunction] Handle return attributes on call within inlined body

Consider a callee function that has a call (C) within it which feeds
into the return.  When we inline that callee into a callsite that has
return attributes, we can backward propagate those attributes to the
call (C) within that inlined callee body.

This is safe to do so only if we can guarantee transfer of execution to
successor in the window of instructions between return value (i.e. the
call C) and the return instruction.

See added test cases.

Reviewed-By: reames, jdoerfert
Differential Revision: https://reviews.llvm.org/D76140

4 years ago[intel-pt] Fix existing support in LLDB
Walter Erquinigo [Wed, 25 Mar 2020 20:24:21 +0000 (13:24 -0700)]
[intel-pt] Fix existing support in LLDB

Summary:
//reviews.llvm.org/D33035 added in 2017 basic support for intel-pt. I
plan to improve it and use it to support reverse debugging.

I fixed a couple of issues and now this plugin works again:
1. pythonlib needed to be linked against it for the SB framework.
Linking was failing because of this
2. the decoding functionality was broken because it lacked handling for
instruction events. It seems old versions of libipt, the actual decoding
library, didn't require these, but modern version require it (you can
read more here
https://github.com/intel/libipt/blob/master/doc/howto_libipt.md). These
events signal overflows of the internal PT buffer in the CPU,
enable/disable events of tracing, async cpu events, interrupts, etc.

I ended up refactoring a little bit the code to reduce code duplication.

In another diff I'll implement some basic tests.

This is a simple execution of the library:

(lldb) target create "/data/users/wallace/rr-project/a.out"
Current executable set to '/data/users/wallace/rr-project/a.out' (x86_64).
(lldb) plugin load liblldbIntelFeatures.so
(lldb) b main
Breakpoint 1: where = a.out`main + 8 at test.cpp:10, address = 0x00000000004007fa
(lldb) b test.cpp:14
Breakpoint 2: where = a.out`main + 50 at test.cpp:14, address = 0x0000000000400824
(lldb) r
Process 902754 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x00000000004007fa a.out`main at test.cpp:10
   7    }
   8
   9    int main() {
-> 10     int z = 0;
   11     for(int i = 0; i < 10000; i++)
   12       z += fun(z);
   13

Process 902754 launched: '/data/users/wallace/rr-project/a.out' (x86_64)
(lldb) processor-trace start all
(lldb) c
Process 902754 resuming
Process 902754 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 2.1
    frame #0: 0x0000000000400824 a.out`main at test.cpp:14
   11     for(int i = 0; i < 10000; i++)
   12       z += fun(z);
   13
-> 14     cout << z<< endl;
   15     return 0;
   16   }

(lldb) processor-trace show-instr-log
thread #1: tid=902754
    0x7ffff72299b9 <+9>: addq   $0x8, %rsp
    0x7ffff72299bd <+13>: retq
    0x4007ed <+16>: addl   $0x1, %eax
    0x4007f0 <+19>: leave
    0x4007f1 <+20>: retq
    0x400814 <+34>: addl   %eax, -0x4(%rbp)
    0x400817 <+37>: addl   $0x1, -0x8(%rbp)
    0x40081b <+41>: cmpl   $0x270f, -0x8(%rbp)       ; imm = 0x270F
    0x400822 <+48>: jle    0x40080a                  ; <+24> at test.cpp:12
    0x400822 <+48>: jle    0x40080a                  ; <+24> at test.cpp:12
```

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

4 years ago[clang-format] Correct line breaks in C# generic type constraints
Jonathan Coe [Tue, 31 Mar 2020 17:41:39 +0000 (18:41 +0100)]
[clang-format] Correct line breaks in C# generic type constraints

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

4 years ago[libc++] Move a bunch of tests from .sh.cpp to .pass.cpp
Louis Dionne [Tue, 31 Mar 2020 18:09:09 +0000 (14:09 -0400)]
[libc++] Move a bunch of tests from .sh.cpp to .pass.cpp

Using the ADDITIONAL_COMPILE_FLAGS annotation, it is possible to move
these tests from .sh.cpp to .pass.cpp, making them suitable for running
on remote hosts more easily.

4 years agoAdd an opque payload field to lldb::Type (NFC).
Adrian Prantl [Tue, 3 Mar 2020 21:01:51 +0000 (13:01 -0800)]
Add an opque payload field to lldb::Type (NFC).

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

4 years ago[MLIR][NFC] Move test/Transforms/lower-affine.mlir -> test/Conversion
Uday Bondhugula [Sun, 29 Mar 2020 07:10:38 +0000 (12:40 +0530)]
[MLIR][NFC] Move test/Transforms/lower-affine.mlir -> test/Conversion

Move lower-affine.mlir from test/Transforms to
test/Conversion/AffineToStandard/. Other related NFC.

Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D77008

4 years ago[libc++] Make sure substitutions are expanded inside FILE_DEPENDENCIES
Louis Dionne [Tue, 31 Mar 2020 17:46:16 +0000 (13:46 -0400)]
[libc++] Make sure substitutions are expanded inside FILE_DEPENDENCIES

4 years agoRevert "[lldb/Reproducers] Always collect the whole dSYM in the reproducer"
Davide Italiano [Tue, 31 Mar 2020 17:55:38 +0000 (10:55 -0700)]
Revert "[lldb/Reproducers] Always collect the whole dSYM in the reproducer"

This reverts commit 38ddb49e5242920e44a982cff7bbe2e86bd23a69 as it
breaks the macOS bots.

4 years ago[SystemZ] Allow %r0 in address context for AsmParser
Ulrich Weigand [Tue, 31 Mar 2020 17:41:04 +0000 (19:41 +0200)]
[SystemZ] Allow %r0 in address context for AsmParser

Registers used in any address (as well as in a few other contexts)
have special semantics when a "zero" register is used, which is
why the back-end defines extra register classes ADDR32, ADDR64 etc
to be used to prevent the register allocator from using %r0 there.

However, when writing assembler code "by hand", you sometimes need
to trigger that special semantics.  However, currently the AsmParser
will reject %r0 in those places.  In some cases it may be possible
to write that instruction differently - but in others it is currently
not possible at all.

This check in AsmParser simply seems overly strict, so this patch
just removes the check completely.  This brings the behaviour of
AsmParser in line with the GNU assembler as well.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=45092

4 years ago[InstCombine] Deduce attributes for aligned_alloc in InstCombine
Uday Bondhugula [Sat, 28 Mar 2020 06:35:36 +0000 (12:05 +0530)]
[InstCombine] Deduce attributes for aligned_alloc in InstCombine

Make InstCombine aware of the aligned_alloc library function.

Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Depends on D76970.

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

4 years agoFix 7093b92a136b0696cf9cfc3f9822973ed886be5b
Tyker [Tue, 31 Mar 2020 17:38:08 +0000 (19:38 +0200)]
Fix 7093b92a136b0696cf9cfc3f9822973ed886be5b
accidently pushed the wrong version of the patch.

4 years ago[lldb/API] Add missing reproducer instrumentation to GetHostPlatform.
Jonas Devlieghere [Tue, 31 Mar 2020 17:43:22 +0000 (10:43 -0700)]
[lldb/API] Add missing reproducer instrumentation to GetHostPlatform.

SBPlatform::GetHostPlatform was missing the reproducer instrumentation
macros. Fixed by running lldb-instr on SBPlatform.cpp:

$ ./bin/lldb-instr ../llvm-project/lldb/source/API/SBPlatform.cpp

4 years ago[MLIR] Add simple runner utilities for timing
Uday Bondhugula [Fri, 27 Mar 2020 09:20:05 +0000 (14:50 +0530)]
[MLIR] Add simple runner utilities for timing

Add utilities print_flops, rtclock for timing / benchmarking. Add
mlir_runner_utils_dir test conf variable.

Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D76912

4 years ago[NFC] Do not run CGProfilePass when not using integrated assembler
zhizhouy [Tue, 31 Mar 2020 17:23:17 +0000 (10:23 -0700)]
[NFC] Do not run CGProfilePass when not using integrated assembler

Summary:
CGProfilePass is run by default in certain new pass manager optimization pipeline. Assemblers other than llvm as (such as gnu as) cannot recognize the .cgprofile entries generated and emitted from this pass, causing build time error.

This patch adds new options in clang CodeGenOpts and PassBuilder options so that we can turn cgprofile off when not using integrated assembler.

Reviewers: Bigcheese, xur, george.burgess.iv, chandlerc, manojgupta

Reviewed By: manojgupta

Subscribers: manojgupta, void, hiraditya, dexonsmith, llvm-commits, tcwang, llozano

Tags: #llvm, #clang

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

4 years ago[llvm-symbolizer] Delete unneeded option name comments. NFC
Fangrui Song [Tue, 31 Mar 2020 17:15:51 +0000 (10:15 -0700)]
[llvm-symbolizer] Delete unneeded option name comments. NFC

Follow-up of D76733. The code documents itself.

4 years agoMake FunctionDecl::isDefined non-virtual, NFC
Reid Kleckner [Tue, 31 Mar 2020 16:01:06 +0000 (09:01 -0700)]
Make FunctionDecl::isDefined non-virtual, NFC

This convenience wrapper was made virtual when it was introduced. I see
no overrides and no reason for it to be virtual, so make it non-virtual.

4 years ago[X86][SSE] Add additional PTEST/TESTP inversion tests
Simon Pilgrim [Tue, 31 Mar 2020 16:53:02 +0000 (17:53 +0100)]
[X86][SSE] Add additional PTEST/TESTP inversion tests

4 years ago[X86][SSE] Simplify PTEST/TESTP tests for D76984
Simon Pilgrim [Tue, 31 Mar 2020 14:17:11 +0000 (15:17 +0100)]
[X86][SSE] Simplify PTEST/TESTP tests for D76984

We don't need to use an allones for the second operand - test the general case.

4 years agoAdd manually overriding of the darwin SDK version
Valentin Churavy [Tue, 31 Mar 2020 16:48:59 +0000 (12:48 -0400)]
Add manually overriding of the darwin SDK version

Summary:
When doing cross-compilation from Linux to MacOS we don't have
access to have access to `xcodebuild` and therefore need a way
to set the SDK version from the outside.

Fixes https://reviews.llvm.org/D68292#1853594 for me.

Reviewers: delcypher, yln

Reviewed By: delcypher

Subscribers: #julialang, mgorny, #sanitizers

Tags: #sanitizers

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

4 years ago[CodeComplete] Member completion for concept-constrained types.
Sam McCall [Wed, 29 Jan 2020 18:11:21 +0000 (19:11 +0100)]
[CodeComplete] Member completion for concept-constrained types.

Summary:
The basic idea is to walk through the concept definition, looking for
t.foo() where t has the constrained type.

In this patch:
 - nested types are recognized and offered after ::
 - variable/function members are recognized and offered after the correct
   dot/arrow/colon trigger
 - member functions are recognized (anything directly called). parameter
   types are presumed to be the argument types. parameters are unnamed.
 - result types are available when a requirement has a type constraint.
   These are printed as constraints, except same_as<T> which prints as T.

Not in this patch:
 - support for merging/overloading when two locations describe the same member.
   The last one wins, for any given name. This is probably important...
 - support for nested template members (T::x<int>)
 - support for completing members of (instantiations of) template template parameters

Reviewers: nridge, saar.raz

Subscribers: mgrang, cfe-commits

Tags: #clang

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

4 years agoFix buildgo.sh script to fix linux build failure due to changes in ad1466f8cbc5.
Douglas Yung [Tue, 31 Mar 2020 16:26:43 +0000 (09:26 -0700)]
Fix buildgo.sh script to fix linux build failure due to changes in ad1466f8cbc5.

The above change used a binary literal that is not supported in c++11 mode when
using gcc. It was formalized into the c++14 standard and works when using that
mode to compile, so change the script to use c++14 instead.

Reviewed by: dvyukov

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

4 years agoNew symbolizer option to print files relative to the compilation directory.
Sterling Augustine [Fri, 20 Mar 2020 20:28:50 +0000 (13:28 -0700)]
New symbolizer option to print files relative to the compilation directory.

Summary: New "--relative" option to allow printing files relative to the compilation directory.

Reviewers: jhenderson

Subscribers: MaskRay, rupprecht, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Linalg] Allow tiling of batch dimension for convolution ops with padding.
MaheshRavishankar [Tue, 31 Mar 2020 15:59:45 +0000 (08:59 -0700)]
[mlir][Linalg] Allow tiling of batch dimension for convolution ops with padding.

Existing tiling implementation of Linalg would still work for tiling
the batch dimensions of the convolution op.

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

4 years ago[SCCP] Limit use of range info for binops to integers for now.
Florian Hahn [Tue, 31 Mar 2020 16:08:09 +0000 (17:08 +0100)]
[SCCP] Limit use of range info for binops to integers for now.

This fixes a crash when building the test suite.

4 years ago[Alignment][NFC] Deprecate MachineMemOperand::getMachineMemOperand version that takes...
Guillaume Chatelet [Tue, 31 Mar 2020 12:55:24 +0000 (12:55 +0000)]
[Alignment][NFC] Deprecate MachineMemOperand::getMachineMemOperand version that takes an untyped alignement.

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

4 years ago[libc++abi] Remove the old testit script
Louis Dionne [Tue, 31 Mar 2020 15:53:04 +0000 (11:53 -0400)]
[libc++abi] Remove the old testit script

It's not used anymore, we use Lit as a test runner now (and have been
for a long time).

4 years ago[AssumeBundles] Preserve information in EarlyCSE
Tyker [Wed, 25 Mar 2020 21:07:03 +0000 (22:07 +0100)]
[AssumeBundles] Preserve information in EarlyCSE

Summary: this patch preserve information from various places in EarlyCSE into assume bundles.

Reviewers: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AssumeBundles] Preserve Information from Load/Store
Tyker [Wed, 25 Mar 2020 20:55:35 +0000 (21:55 +0100)]
[AssumeBundles] Preserve Information from Load/Store

Summary: This patch preserve dereferenceable, nonnull and alignment from loads and stores.

Reviewers: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lld][COFF][ELF][WebAssembly] Replace --[no-]threads /threads[:no] with --threads...
Fangrui Song [Tue, 17 Mar 2020 19:40:19 +0000 (12:40 -0700)]
[lld][COFF][ELF][WebAssembly] Replace --[no-]threads /threads[:no] with --threads={1,2,...} /threads:{1,2,...}

--no-threads is a name copied from gold.
gold has --no-thread, --thread-count and several other --thread-count-*.

There are needs to customize the number of threads (running several lld
processes concurrently or customizing the number of LTO threads).
Having a single --threads=N is a straightforward replacement of gold's
--no-threads + --thread-count.

--no-threads is used rarely. So just delete --no-threads instead of
keeping it for compatibility for a while.

If --threads= is specified (ELF,wasm; COFF /threads: is similar),
--thinlto-jobs= defaults to --threads=,
otherwise all available hardware threads are used.

There is currently no way to override a --threads={1,2,...}. It is still
a debate whether we should use --threads=all.

Reviewed By: rnk, aganea

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

4 years ago[lldb/DWARF] Fix evaluator crash when accessing empty stack.
Med Ismail Bennani [Tue, 31 Mar 2020 00:33:42 +0000 (02:33 +0200)]
[lldb/DWARF] Fix evaluator crash when accessing empty stack.

This patch fixes a crash that happens on the DWARF expression evaluator
when trying to access the top of the stack while it's empty.

rdar://60512489

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years agoRevert "[lldb/DWARF] Fix evaluator crash when accessing empty stack."
Med Ismail Bennani [Tue, 31 Mar 2020 15:44:17 +0000 (17:44 +0200)]
Revert "[lldb/DWARF] Fix evaluator crash when accessing empty stack."

This reverts commit e26eece1e2e7d7e6fbadb1207afef9b6353b5330.

4 years ago[MLIR][Vector] Add support for TupleGetOp folding through InsertSlicesOp and ExtractS...
Andy Davis [Tue, 31 Mar 2020 15:21:04 +0000 (08:21 -0700)]
[MLIR][Vector] Add support for TupleGetOp folding through InsertSlicesOp and ExtractSlicesOp.

Summary:
Add support for TupleGetOp folding through InsertSlicesOp and ExtractSlicesOp.
Vector-to-vector transformations for unrolling and lowering to hardware vectors
can generate chains of structured vector operations (InsertSlicesOp,
ExtractSlicesOp and ShapeCastOp) between the producer of a hardware vector
value and its consumer. Because InsertSlicesOp, ExtractSlicesOp and ShapeCastOp
are structured, we can track the location (tuple index and vector offsets) of
the consumer vector value through the chain of structured operations to the
producer, enabling a much more powerful producer-consumer fowarding of values
through structured ops and tuple, which in turn enables a more powerful
TupleGetOp folding transformation.

Reviewers: nicolasvasilache, aartbik

Reviewed By: aartbik

Subscribers: grosul1, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[libc++] Execute tests using an external shell
Louis Dionne [Tue, 31 Mar 2020 15:17:11 +0000 (11:17 -0400)]
[libc++] Execute tests using an external shell

This makes it closer to how one would run the tests by hand, and it is
also closer to how the SSHExecutor runs the tests remotely. It also
allows using shell builtins in .sh.cpp tests when using %{exec}.

4 years ago[lldb/DWARF] Fix evaluator crash when accessing empty stack.
Med Ismail Bennani [Tue, 31 Mar 2020 00:33:42 +0000 (02:33 +0200)]
[lldb/DWARF] Fix evaluator crash when accessing empty stack.

This patch fixes a crash that happens on the DWARF expression evaluator
when trying to access the top of the stack while it's empty.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years ago[SystemZ] Add isCommutable flag on VFA and VFM.
Jonas Paulsson [Tue, 31 Mar 2020 13:32:01 +0000 (15:32 +0200)]
[SystemZ] Add isCommutable flag on VFA and VFM.

NFC

Review: Ulrich Weigand

4 years ago[SystemZ] Improve foldMemoryOperandImpl().
Jonas Paulsson [Tue, 17 Mar 2020 12:19:30 +0000 (13:19 +0100)]
[SystemZ] Improve foldMemoryOperandImpl().

Fold MS(G)RKC -> MS(G)C.

Review: Ulrich Weigand

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

4 years ago[obj2yaml] - Teach tool to dump program headers.
Georgii Rymar [Mon, 17 Feb 2020 10:16:16 +0000 (13:16 +0300)]
[obj2yaml] - Teach tool to dump program headers.

Currently obj2yaml does not dump program headers,
this patch teaches it to do that.

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

4 years agoRevert rGefe59d6717dcdf7777acb9b7a734e1a520bdf22a "[X86][SSE] lowerShuffleWithPACK...
Simon Pilgrim [Tue, 31 Mar 2020 14:47:30 +0000 (15:47 +0100)]
Revert rGefe59d6717dcdf7777acb9b7a734e1a520bdf22a "[X86][SSE] lowerShuffleWithPACK - extend to use chained PACKs for larger truncations"

This might be causing an issue on the fuchsia-x86_64-linux buildbot - reverting to see what happens.

4 years agoFix enumeral mismatch warning. NFCI.
Simon Pilgrim [Tue, 31 Mar 2020 14:37:41 +0000 (15:37 +0100)]
Fix enumeral mismatch warning. NFCI.

Don't mix llvm::ISD and llvm::X86ISD.

4 years ago[gn build] Port 154d517bc7d
LLVM GN Syncbot [Tue, 31 Mar 2020 14:11:06 +0000 (14:11 +0000)]
[gn build] Port 154d517bc7d

4 years ago[ADT] Implement the Waymarking as an independent utility
Ehud Katz [Tue, 31 Mar 2020 13:46:01 +0000 (16:46 +0300)]
[ADT] Implement the Waymarking as an independent utility

This is the Waymarking algorithm implemented as an independent utility.
The utility is operating on a range of sequential elements.
First we "tag" the elements, by calling `fillWaymarks`.
Then we can "follow" the tags from every element inside the tagged
range, and reach the "head" (the first element), by calling
`followWaymarks`.

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

4 years ago[libc++] Remove incorrect assertion in the filesystem tests
Louis Dionne [Tue, 31 Mar 2020 14:05:34 +0000 (10:05 -0400)]
[libc++] Remove incorrect assertion in the filesystem tests

Based on the current discussion in https://llvm.org/PR45307, it seems
that it's legitimate for `temp_directory_path()` to return a path with
a trailing slash. Since `p.parent_path()` will never contain a trailing
slash, comparing it to the result of `temp_directory_path()` will fail
depending on whether `temp_directory_path()` returns a trailing slash
or not.

4 years ago[X86][SSE] lowerShuffleWithPACK - extend to use chained PACKs for larger truncations
Simon Pilgrim [Tue, 31 Mar 2020 13:37:48 +0000 (14:37 +0100)]
[X86][SSE] lowerShuffleWithPACK - extend to use chained PACKs for larger truncations

If canLowerByDroppingEvenElements indicates that the shuffle is a N:1 compaction pattern and the inputs are suitably sign/zero extended then we can use a chain of PACKSS/PACKUS to compact.

This helps avoid PSHUFB (and its mask load) for short shuffle chains, shuffle combining will still replace with a PSHUFB if we have enough shuffles as getFauxShuffleMask can recognise PACKSS/PACKUS chains.

4 years ago[libc++] Quote the filesystem static env root in the source files instead of the...
Louis Dionne [Mon, 30 Mar 2020 20:24:48 +0000 (16:24 -0400)]
[libc++] Quote the filesystem static env root in the source files instead of the command line

Otherwise, trying to reproduce a failing filesystem test by copy-pasting
the command-line used and running that in the shell won't work, because
the shell will eat quoting around the define and we'll end up with a
non-stringized path in the .cpp file.

4 years ago[libc++] Provide a method for adding compiler flags in lit.local.cfg files
Louis Dionne [Mon, 30 Mar 2020 17:22:06 +0000 (13:22 -0400)]
[libc++] Provide a method for adding compiler flags in lit.local.cfg files

That way, local lit configuration files don't have to worry about
deep-copying the compiler instance of the test format, which is
arguably an implementation detail.

We pass the config to this method even though it is not used by the
current test format because this allows replacing the current test
format by other test formats that would require the config to add
new compile flags.

4 years ago[libc++] Set filesystem test flags in a lit.local.cfg
Louis Dionne [Wed, 25 Mar 2020 17:28:27 +0000 (13:28 -0400)]
[libc++] Set filesystem test flags in a lit.local.cfg

This reduces the complexity of our already complex global lit configuration,
and also avoids cluttering the compilation commands for all tests with
things that are only relevant to the filesystem tests.

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

4 years ago[InstCombine] remove stray auto-generated test comment; NFC
Sanjay Patel [Tue, 31 Mar 2020 13:16:02 +0000 (09:16 -0400)]
[InstCombine] remove stray auto-generated test comment; NFC

The script now includes extra info about command-line options used
when generating its advertisement heading, but we don't want that
here. This is a special-case because we have enhanced the check
lines (as noted in the 2nd comment line).

4 years ago[clangd] Support new semanticTokens request from LSP 3.16.
Sam McCall [Tue, 24 Mar 2020 01:24:47 +0000 (02:24 +0100)]
[clangd] Support new semanticTokens request from LSP 3.16.

Summary:
This is a simpler request/response protocol.

Reference: https://github.com/microsoft/vscode-languageserver-node/blob/master/protocol/src/protocol.semanticTokens.proposed.ts

No attempt to support incremental formatting (yet).

Reviewers: hokein

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

Tags: #clang

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

4 years ago[libc++] Do not rely on the environment to run filesystem tests
Louis Dionne [Tue, 24 Mar 2020 21:06:29 +0000 (17:06 -0400)]
[libc++] Do not rely on the environment to run filesystem tests

Previously, filesystem tests would require LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT
to be present in the environment and to match the value provided when
compiling, as a macro. This has the problem that it only allows for the
filesystem tests to be run on the same machine they are created.

Instead, we create a temporary directory for each test. Technically,
this is tricky to do because we're relying on some of the code that
we're testing to do this. However, there's no other portable way of
creating temporary direcories in C++, so this is difficult to avoid.

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

4 years ago[LoopTerminology] LCSSA form
Stefanos Baziotis [Tue, 31 Mar 2020 12:30:59 +0000 (15:30 +0300)]
[LoopTerminology] LCSSA form

Reviewed by: Michael Kruse (Meinersbur)

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

4 years ago[clang-tidy] Fix crash in readability-redundant-string-cstr
Nathan James [Wed, 25 Mar 2020 19:22:09 +0000 (19:22 +0000)]
[clang-tidy] Fix crash in readability-redundant-string-cstr

Summary: Addresses [[ https://bugs.llvm.org/show_bug.cgi?id=45286 | clang-tidy-11: Crash in DynTypedMatcher::matches during readability-redundant-string-cstr check ]]

Reviewers: aaron.ballman, alexfh, gribozavr2

Reviewed By: gribozavr2

Subscribers: xazax.hun, cfe-commits

Tags: #clang, #clang-tools-extra

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

4 years ago[VPlan] Move test strs to variables, silence spurious C4129 (NFC).
Florian Hahn [Tue, 31 Mar 2020 12:15:10 +0000 (13:15 +0100)]
[VPlan] Move test strs to variables, silence spurious C4129 (NFC).

This is a speculative fix to silence the spurious C4129 warning that
some version of MSVC generate for the raw string literals in the changed
files.

Before disabling the warning (D76428), try a potential fix suggested in
the review.

4 years ago[LLD][ELF] Allow empty (.init|.preinit|.fini)_array to be RELRO
Peter Smith [Fri, 27 Mar 2020 10:15:02 +0000 (10:15 +0000)]
[LLD][ELF] Allow empty (.init|.preinit|.fini)_array to be RELRO

The default GNU linker script uses the following idiom for the array
sections. I'll use .init_array here, but this also applies to
.preinit_array and .fini_array sections.

  .init_array    :
  {
    PROVIDE_HIDDEN (__init_array_start = .);
    KEEP (*(.init_array))
    PROVIDE_HIDDEN (__init_array_end = .);
  }

The C-library will take references to the _start and _end symbols to
process the array. This will make LLD keep the OutputSection even if there
are no .init_array sections. As the current check for RELRO uses the
section type for .init_array the above example with no .init_array
InputSections fails the checks as there are no .init_array sections to give
the OutputSection a type of SHT_INIT_ARRAY. This often leads to a
non-contiguous RELRO error message.

The simple fix is to a textual section match as well as a section type
match.

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

4 years ago[ValueLattice] Distinguish between constant ranges with/without undef.
Florian Hahn [Tue, 31 Mar 2020 10:10:00 +0000 (11:10 +0100)]
[ValueLattice] Distinguish between constant ranges with/without undef.

This patch updates ValueLattice to distinguish between ranges that are
guaranteed to not include undef and ranges that may include undef.

A constant range guaranteed to not contain undef can be used to simplify
instructions to arbitrary values. A constant range that may contain
undef can only be used to simplify to a constant. If the value can be
undef, it might take a value outside the range. For example, consider
the snipped below

define i32 @f(i32 %a, i1 %c) {
  br i1 %c, label %true, label %false
true:
  %a.255 = and i32 %a, 255
  br label %exit
false:
  br label %exit
exit:
  %p = phi i32 [ %a.255, %true ], [ undef, %false ]
  %f.1 = icmp eq i32 %p, 300
  call void @use(i1 %f.1)
  %res = and i32 %p, 255
  ret i32 %res
}

In the exit block, %p would be a constant range [0, 256) including undef as
%p could be undef. We can use the range information to replace %f.1 with
false because we remove the compare, effectively forcing the use of the
constant to be != 300. We cannot replace %res with %p however, because
if %a would be undef %cond may be true but the  second use might not be
< 256.

Currently LazyValueInfo uses the new behavior just when simplifying AND
instructions and does not distinguish between constant ranges with and
without undef otherwise. I think we should address the remaining issues
in LVI incrementally.

Reviewers: efriedma, reames, aqjune, jdoerfert, sstefan1

Reviewed By: efriedma

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

4 years ago[ELF][test] Add test for --gc-sections + many sections
James Henderson [Fri, 13 Mar 2020 14:28:52 +0000 (14:28 +0000)]
[ELF][test] Add test for --gc-sections + many sections

This test covers the case where --gc-sections is used when there are
many sections. In particular, it ensures that there is no adverse
interaction with common and absolute symbols.

Reviewed by: MaskRay, grimar

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

4 years ago[lld][ELF][test] Improve deplib.s
James Henderson [Thu, 26 Mar 2020 14:47:33 +0000 (14:47 +0000)]
[lld][ELF][test] Improve deplib.s

The test had a few style issues, and I noticed a hole in the coverage
(namely that the search order wasn't tested). Adding cases for the hole
in turn meant other cases weren't important.

The .so test case isn't important, since the code is shared code, so
I've removed it. Additionally, I've modified the usage of the "bar"
directive to show that an unneeded library must still be present, or the
link will fail, even though it isn't linked in.

Reviewed by: MaskRay, grimar

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