platform/upstream/llvm.git
3 years ago[VectorCombine] Don't vectorize scalar load under asan/hwasan/memtag/tsan
Fangrui Song [Mon, 14 Sep 2020 22:11:55 +0000 (15:11 -0700)]
[VectorCombine] Don't vectorize scalar load under asan/hwasan/memtag/tsan

Similar to the tsan suppression in
`Utils/VNCoercion.cpp:getLoadLoadClobberFullWidthSize` (rL175034; load widening used by GVN),
the D81766 optimization should be suppressed under tsan due to potential
spurious data race reports:

  struct A {
    int i;
    const short s; // the load cannot be vectorized because
    int modify;    // it overlaps with bytes being concurrently modified
    long pad1, pad2;
  };
  // __tsan_read16 does not know that some bytes are undef and accessing is safe

Similarly, under asan, users can mark memory regions with
`__asan_poison_memory_region`. A widened load can lead to a spurious
use-after-poison error. hwasan/memtag should be similarly suppressed.

`mustSuppressSpeculation` suppresses asan/hwasan/tsan but not memtag, so
we need to exclude memtag in `vectorizeLoadInsert`.

Note, memtag suppression can be relaxed if the load is aligned to the
its granule (usually 16), but that is out of scope of this patch.

Reviewed By: spatel, vitalybuka

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

3 years ago[lldb] Add -l/--language option to script command
Jonas Devlieghere [Tue, 15 Sep 2020 16:36:28 +0000 (09:36 -0700)]
[lldb] Add -l/--language option to script command

Make it possible to run the script command with a different language
than currently selected.

  $ ./bin/lldb -l python
  (lldb) script -l lua
  >>> io.stdout:write("Hello, World!\n")
  Hello, World!

When passing the language option and a raw command, you need to separate
the flag from the script code with --.

  $ ./bin/lldb -l python
  (lldb) script -l lua -- io.stdout:write("Hello, World!\n")
  Hello, World!

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

3 years ago[X86][AVX] lowerShuffleWithSHUFPS - handle missed canonicalization cases.
Simon Pilgrim [Tue, 15 Sep 2020 16:08:45 +0000 (17:08 +0100)]
[X86][AVX] lowerShuffleWithSHUFPS - handle missed canonicalization cases.

PR47534 exposes a case where calling lowerShuffleWithSHUFPS directly from a derived repeated mask (found by is128BitLaneRepeatedShuffleMask) results in us using an non-canonicalized mask.

The missed canonicalization in this case is trivial - just commute the mask so we have more (swapped) LHS than RHS references so lowerShuffleWithSHUFPS can handle it.

3 years agoNFC: Add whitespace change to .git-blame-ignore-revs
Louis Dionne [Tue, 15 Sep 2020 16:29:41 +0000 (12:29 -0400)]
NFC: Add whitespace change to .git-blame-ignore-revs

3 years ago[MachineBasicBlock] Fix a typo in function copySuccessor
Guozhi Wei [Tue, 15 Sep 2020 16:18:18 +0000 (09:18 -0700)]
[MachineBasicBlock] Fix a typo in function copySuccessor

The condition used to decide if need to copy probability should be reversed.

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

3 years ago[libc++] Add a benchmark for std::map operations
Mark de Wever [Tue, 15 Sep 2020 15:08:13 +0000 (11:08 -0400)]
[libc++] Add a benchmark for std::map operations

Before tackling http://llvm.org/PR38722, make sure there is a baseline
benchmark.

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

3 years ago[XCOFF] Run resource intense test only on platforms where it makes sense
jasonliu [Tue, 15 Sep 2020 15:50:26 +0000 (15:50 +0000)]
[XCOFF] Run resource intense test only on platforms where it makes sense

This is a follow up commit for the issue raised in
https://reviews.llvm.org/D86879

3 years ago[analyzer][Liveness][NFC] Get rid of statement liveness, because such a thing doesn...
Kristóf Umann [Tue, 15 Sep 2020 15:43:02 +0000 (17:43 +0200)]
[analyzer][Liveness][NFC] Get rid of statement liveness, because such a thing doesn't exist

The summary and very short discussion in D82122 summarizes whats happening here.

In short, liveness talks about variables, or expressions, anything that
has a value. Well, statements just simply don't have a one.

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

3 years ago[mlir][openacc] Add loop op verifier
Valentin Clement [Tue, 15 Sep 2020 15:41:50 +0000 (11:41 -0400)]
[mlir][openacc] Add loop op verifier

Add a verifier for the loop op in the OpenACC dialect. Check basic restriction
from 2.9 Loop construct from the OpenACC 3.0 specs.

Reviewed By: ftynse

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

3 years agoSLPVectorizer.h - remove unnecessary AliasAnalysis.h include. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 14:23:19 +0000 (15:23 +0100)]
SLPVectorizer.h - remove unnecessary AliasAnalysis.h include. NFCI.

Forward declare AAResults instead of the (old) AliasAnalysis type.

Remove includes from SLPVectorizer.cpp that are already included in SLPVectorizer.h.

3 years ago[libc++] Use allocator_traits to consistently allocate/deallocate/construct/destroy...
Marshall Clow [Tue, 15 Sep 2020 13:56:03 +0000 (09:56 -0400)]
[libc++] Use allocator_traits to consistently allocate/deallocate/construct/destroy objects in std::any

https://llvm.org/PR45099 notes (correctly) that we're inconsistent in memory
allocation in `std::any`. We allocate memory with `std::allocator<T>::allocate`,
construct with placement new, destroy by calling the destructor directly, and
deallocate by calling `delete`. Most of those are customizable by the user,
but in different ways.

The standard is silent on how these things are to be accomplished.
This patch makes it so we use `allocator_traits<allocator<T>>` for all
of these operations (allocate, construct, destruct, deallocate).
This is, at least, consistent.

Fixes https://llvm.org/PR45099.

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

3 years ago[InstSimplify] add limit folds for fmin/fmax
Sanjay Patel [Tue, 15 Sep 2020 14:30:35 +0000 (10:30 -0400)]
[InstSimplify] add limit folds for fmin/fmax

If the constant operand is the opposite of the min/max value,
then the result must be the other value.

This is based on the similar codegen transform proposed in:
D87571

3 years ago[analyzer] Add documentation for alpha.fuchsia.Lock and alpha.core.C11Lock
Kristóf Umann [Tue, 25 Aug 2020 11:49:41 +0000 (13:49 +0200)]
[analyzer] Add documentation for alpha.fuchsia.Lock and alpha.core.C11Lock

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

3 years ago[llvm-readobj/elf] - Don't crash when the size of s dynamic symbol table, inferred...
Georgii Rymar [Tue, 1 Sep 2020 08:11:34 +0000 (11:11 +0300)]
[llvm-readobj/elf] - Don't crash when the size of s dynamic symbol table, inferred from the hash table, is broken.

Currently we might derive the dynamic symbol table size from the DT_HASH hash table (using its `nchain` field).
It is possible to crash dumpers with a broken relocation that refers to a symbol with an index
that is too large. To trigger it, the inferred size of the dynamic symbol table should go past the end of the object.

This patch adds a size validation + warning.

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

3 years ago[analyzer][StdLibraryFunctionsChecker] Elaborate the summary of fread and fwrite
Gabor Marton [Thu, 3 Sep 2020 11:23:49 +0000 (13:23 +0200)]
[analyzer][StdLibraryFunctionsChecker] Elaborate the summary of fread and fwrite

Add the BufferSize argument constraint to fread and fwrite. This change
itself makes it possible to discover a security critical case, described
in SEI-CERT ARR38-C.

We also add the not-null constraint on the 3rd arguments.

In this patch, I also remove those lambdas that don't take any
parameters (Fwrite, Fread, Getc), thus making the code better
structured.

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

3 years ago[libc] Add missing TableGen dependency
Guillaume Chatelet [Tue, 15 Sep 2020 14:26:04 +0000 (14:26 +0000)]
[libc] Add missing TableGen dependency

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

3 years ago[libc] Add missing LibcFPTestHelpers library
Guillaume Chatelet [Tue, 15 Sep 2020 14:25:34 +0000 (14:25 +0000)]
[libc] Add missing LibcFPTestHelpers library

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

3 years ago[libc] Fix typo in platform_defs.h.inc
Guillaume Chatelet [Tue, 15 Sep 2020 14:25:00 +0000 (14:25 +0000)]
[libc] Fix typo in platform_defs.h.inc

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

3 years ago[LLD][PowerPC] Add support for R_PPC64_TPREL34 used in TLS Local Exec
Stefan Pintilie [Tue, 15 Sep 2020 13:23:58 +0000 (08:23 -0500)]
[LLD][PowerPC] Add support for R_PPC64_TPREL34 used in TLS Local Exec

Add Thread Local Storage Local Exec support to LLD. This is to support PC Relative addressing of Local Exec.
The patch teaches LLD to handle:
```
paddi r9, r13, x1@tprel
```
The relocation is:
```
R_PPC_TPREL34
```

Reviewed By: NeHuang, MaskRay

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

3 years agoRevert "[SelectionDAG] Remove unused FP constant in getNegatedExpression"
Qiu Chaofan [Tue, 15 Sep 2020 14:03:50 +0000 (22:03 +0800)]
Revert "[SelectionDAG] Remove unused FP constant in getNegatedExpression"

2508ef01 doesn't totally fix the issue since we did not handle the case
when unused temporary negated result is the same with the result, which
is found by address sanitizer.

3 years agoAMDGPUPrintfRuntimeBinding.cpp - drop unnecessary casts/dyn_casts. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 13:48:40 +0000 (14:48 +0100)]
AMDGPUPrintfRuntimeBinding.cpp - drop unnecessary casts/dyn_casts. NFCI.

GetElementPtrInst::Create returns a GetElementPtrInst* so we don't need to cast. Similarly IntegerType inherits from the Type base class.

Also, I've used auto* in a few places to cleanup the code.

Helps fix some clang-tidy warnings which saw the dyn_casts and warned that these can return null.

3 years ago[Utils] isLegalToPromote - Fix missing null check before writing to FailureReason.
Simon Pilgrim [Tue, 15 Sep 2020 12:48:40 +0000 (13:48 +0100)]
[Utils] isLegalToPromote - Fix missing null check before writing to FailureReason.

The FailureReason input parameter maybe null, we check this in all other cases in the method but this one was missed somehow.

Fixes clang-tidy warning.

3 years ago[mlir][openacc] Add missing print of vector_length in parallel op
Valentin Clement [Tue, 15 Sep 2020 13:48:24 +0000 (09:48 -0400)]
[mlir][openacc] Add missing print of vector_length in parallel op

This patch adds the missing print for the vector_length in the parallel operation.

Reviewed By: ftynse

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

3 years ago[mlir][Standard] Add canonicalizer for dynamic_tensor_from_elements
Stephan Herhut [Mon, 14 Sep 2020 09:54:55 +0000 (11:54 +0200)]
[mlir][Standard] Add canonicalizer for dynamic_tensor_from_elements

This add canonicalizer for

- extracting an element from a dynamic_tensor_from_elements
- propagating constant operands to the type of dynamic_tensor_from_elements

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

3 years ago[gn build] Port cd4edf94cd4
LLVM GN Syncbot [Tue, 15 Sep 2020 13:32:48 +0000 (13:32 +0000)]
[gn build] Port cd4edf94cd4

3 years ago[gn build] Port a8058c6f8d1
LLVM GN Syncbot [Tue, 15 Sep 2020 13:32:47 +0000 (13:32 +0000)]
[gn build] Port a8058c6f8d1

3 years ago[InstCombine] fix bug in pow expansion
Sanjay Patel [Tue, 15 Sep 2020 13:27:16 +0000 (09:27 -0400)]
[InstCombine] fix bug in pow expansion

There at least one other bug related to pow -> sqrt transforms:
http://lists.llvm.org/pipermail/llvm-dev/2020-September/145051.html
...but we probably can't solve that without fixing this first.

3 years ago[InstCombine] add RUN to show miscompile of pow expansion; NFC
Sanjay Patel [Tue, 15 Sep 2020 13:21:20 +0000 (09:21 -0400)]
[InstCombine] add RUN to show miscompile of pow expansion; NFC

The code drops the sqrt op instead of bailing out,
so this is very wrong.

3 years ago[InstCombine] improve test names; NFC
Sanjay Patel [Tue, 15 Sep 2020 12:38:51 +0000 (08:38 -0400)]
[InstCombine] improve test names; NFC

This is not a valid transform unless we can prove
that the program does not read errno after the pow
call and before some other function changes it.

3 years ago[libcxx] Disable failing test for no-exceptions build
Oliver Stannard [Tue, 15 Sep 2020 10:40:05 +0000 (11:40 +0100)]
[libcxx] Disable failing test for no-exceptions build

This test tries to create a 2 GiB std::string, catching the bad_alloc
exception if the allocation fails. However, for no-exceptions builds
there is no way for the error to be reported, so this crashes with a
null pointer dereference.

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

3 years ago[ConstraintElimination] Add initial tests.
Florian Hahn [Fri, 24 Jul 2020 18:36:48 +0000 (19:36 +0100)]
[ConstraintElimination] Add initial tests.

3 years ago[gn build] (semi-manually) port 380e746bcca
Nico Weber [Tue, 15 Sep 2020 13:25:19 +0000 (09:25 -0400)]
[gn build] (semi-manually) port 380e746bcca

3 years ago[lld][WebAssembly] Fix --export-all when __stack_pointer is present
Sam Clegg [Tue, 15 Sep 2020 01:28:26 +0000 (18:28 -0700)]
[lld][WebAssembly] Fix --export-all when __stack_pointer is present

With https://reviews.llvm.org/D87537 we made it an error
to import or export a mutable global with the +mutable-globals
feature present.  However the scan was of the entire symbol
table rather than just the imports or exports and the filter
didn't match exaclyt meaning the `__stack_pointer` (a mutable
global) was always triggering with error when the `--export-all`
flag was used.

This also revealed that we didn't have any test coverage for
the `--export-all` flag.

This change fixes the current breakage on the emscripten-releases
roller.

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

3 years ago[Flang] Add GettingInvolved documentation page and sidebar.
sameeran joshi [Sun, 13 Sep 2020 11:54:34 +0000 (17:24 +0530)]
[Flang] Add GettingInvolved documentation page and sidebar.

Adds a new GettingInvolved page to documentation which provides details about
mailing list, chats and calls.

Adds a sidebar page which provides common links on
all documentation pages.
The links include:
-  Getting Started
-  Getting Involved
-  Github Repository
-  Bug Reports
-  Code Review

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

Reviewed By: richard.barton.arm

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

3 years ago[ConstraintSolver] Add isConditionImplied helper.
Florian Hahn [Tue, 15 Sep 2020 12:50:11 +0000 (13:50 +0100)]
[ConstraintSolver] Add isConditionImplied helper.

This patch adds a isConditionImplied function that
takes a constraint and returns true if the constraint
is implied by the current constraints in the system.

Reviewed By: spatel

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

3 years agoRestrict UnnecessaryCopyInitialization check to variables initialized from free funct...
Felix Berger [Tue, 15 Sep 2020 12:44:13 +0000 (08:44 -0400)]
Restrict UnnecessaryCopyInitialization check to variables initialized from free functions without arguments

This restriction avoids cases where an alias is returned to an argument and
which could lead to to a false positive change.

3 years ago[libc++] Allow building without threads in standalone builds
Louis Dionne [Tue, 15 Sep 2020 12:43:08 +0000 (08:43 -0400)]
[libc++] Allow building without threads in standalone builds

Setting _LIBCPP_HAS_NO_THREADS is needed when building libcxxabi without
threads in standalone mode. This is useful when target WASM. Otherwise,
you get an error like "No thread API" when building libcxxabi.

It would be better to link against a properly-configured libc++ headers
CMake target when building libc++abi instead, but we don't generate such
targets yet.

Thanks to Matthew Bauer for the patch.

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

3 years agoLoopCacheAnalysis.h - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 12:34:19 +0000 (13:34 +0100)]
LoopCacheAnalysis.h - remove unnecessary includes. NFCI.

More remaining dependencies down to LoopCacheAnalysis.cpp

3 years agoProvenanceAnalysis.h - remove unnecessary AliasAnalysis.h include. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 12:09:03 +0000 (13:09 +0100)]
ProvenanceAnalysis.h - remove unnecessary AliasAnalysis.h include. NFCI.

Forward declare AAResults instead of the (old) AliasAnalysis type.

3 years agoAliasSetTracker.cpp - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 11:59:00 +0000 (12:59 +0100)]
AliasSetTracker.cpp - remove unnecessary includes. NFCI.

These are all directly included in AliasSetTracker.h

3 years ago[ARM][MVE] Tail-predication: use unsigned SCEV ranges for tripcount
Sjoerd Meijer [Tue, 15 Sep 2020 12:10:30 +0000 (13:10 +0100)]
[ARM][MVE] Tail-predication: use unsigned SCEV ranges for tripcount

Loop tripcount expressions have a positive range, so use unsigned SCEV ranges
for them.

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

3 years ago[Scalarizer] Avoid changing name of non-instructions
Bjorn Pettersson [Mon, 14 Sep 2020 20:53:54 +0000 (22:53 +0200)]
[Scalarizer] Avoid changing name of non-instructions

The "takeName" logic in ScalarizerVisitor::gather did not consider
that the value vector could refer to non-instructions, such as
global variables. This patch make sure that we avoid changing the
name of a value if it isn't an instruction.

Reviewed By: lebedev.ri

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

3 years ago[lldb] Improve qemu interop for aarch64
Pavel Labath [Tue, 15 Sep 2020 11:20:09 +0000 (13:20 +0200)]
[lldb] Improve qemu interop for aarch64

qemu calls the "fp" and "lr" registers via their generic names
(x29/x30). This mismatch manifested itself as not being able to unwind
or display values of some local variables.

3 years ago[lldb/cmake] Fix testing support library dependencies
Pavel Labath [Fri, 28 Aug 2020 10:31:16 +0000 (12:31 +0200)]
[lldb/cmake] Fix testing support library dependencies

lldbUtilityHelpers does not depend on lldbSymbolHelpers. Remove that
dependency, and add direct lldbSymbolHelpers dependencies where needed.

3 years agoRevert "RegAllocFast: Record internal state based on register units"
Hans Wennborg [Tue, 15 Sep 2020 08:47:02 +0000 (10:47 +0200)]
Revert "RegAllocFast: Record internal state based on register units"

This seems to have caused incorrect register allocation in some cases,
breaking tests in the Zig standard library (PR47278).

As discussed on the bug, revert back to green for now.

> Record internal state based on register units. This is often more
> efficient as there are typically fewer register units to update
> compared to iterating over all the aliases of a register.
>
> Original patch by Matthias Braun, but I've been rebasing and fixing it
> for almost 2 years and fixed a few bugs causing intermediate failures
> to make this patch independent of the changes in
> https://reviews.llvm.org/D52010.

This reverts commit 66251f7e1de79a7c1620659b7f58352b8c8e892e, and
follow-ups 931a68f26b9a3de853807ffad7b2cd0a2dd30922
and 0671a4c5087d40450603d9d26cf239f1a8b1367e. It also adjust some
test expectations.

3 years agoSpillPlacement.cpp - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 11:18:06 +0000 (12:18 +0100)]
SpillPlacement.cpp - remove unnecessary includes. NFCI.

These are all directly included in SpillPlacement.h

3 years agoStatepointLowering.cpp - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 11:00:21 +0000 (12:00 +0100)]
StatepointLowering.cpp - remove unnecessary includes. NFCI.

These are all directly included in StatepointLowering.h

3 years agoSelectionDAGBuilder.h - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 15 Sep 2020 10:44:47 +0000 (11:44 +0100)]
SelectionDAGBuilder.h - remove unnecessary includes. NFCI.

Reduce to forward declarations and move implicit dependencies down to the cpp files.

3 years agoRecommit "[ConstraintSystem] Add helpers to deal with linear constraints."
Florian Hahn [Tue, 15 Sep 2020 09:28:25 +0000 (10:28 +0100)]
Recommit "[ConstraintSystem] Add helpers to deal with linear constraints."

This patch recommits "[ConstraintSystem] Add helpers to deal with linear constraints."
(it reverts the revert commit 8da6ae4ce1b686c5c13698e4c5ee937811fda6f7).

The reason for the revert was using __builtin_multiply_overflow, which
is not available for all compilers. The patch has been updated to use
MulOverflow from MathExtras.h

3 years ago[mlir] check for failures when packing function sigunatures in std->llvm conversion
Alex Zinenko [Mon, 14 Sep 2020 11:47:27 +0000 (13:47 +0200)]
[mlir] check for failures when packing function sigunatures in std->llvm conversion

When packing function results into a structure during the standard-to-llvm
dialect conversion, do not assume the conversion was successful and propagate
nullptr as error state.

Fixes PR45184.

Reviewed By: nicolasvasilache

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

3 years ago[mlir][integration_test] Linalg Conv folder renamed to CPU
Jakub Lichman [Tue, 15 Sep 2020 10:07:29 +0000 (10:07 +0000)]
[mlir][integration_test] Linalg Conv folder renamed to CPU

Changing directory name to reflect naming convention discussed here:
https://llvm.discourse.group/t/vectorops-rfc-add-suite-of-integration-tests-for-vector-dialect-operations/1213

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

3 years agoRevert "[InstCombine] Simplify select operand based on equality condition"
Benjamin Kramer [Tue, 15 Sep 2020 10:22:47 +0000 (12:22 +0200)]
Revert "[InstCombine] Simplify select operand based on equality condition"

This reverts commit cfff88c03cf9e9b72906a41fd11e06721d54f293. Sends
instcombine into an infinite loop.

```
define i1 @foo(i32 %arg, i32 %arg1) {
bb:
  %tmp = udiv i32 %arg, %arg1
  %tmp2 = mul nsw i32 %tmp, %arg1
  %tmp3 = icmp eq i32 %tmp2, %arg
  %tmp4 = select i1 %tmp3, i32 %tmp, i32 undef
  %tmp5 = icmp sgt i32 %tmp4, 255
  ret i1 %tmp5
}
```

3 years ago[X86] Update SSE/AVX integer MINMAX intrinsics to emit llvm.smax.* etc. (PR46851)
Simon Pilgrim [Tue, 15 Sep 2020 10:18:44 +0000 (11:18 +0100)]
[X86] Update SSE/AVX integer MINMAX intrinsics to emit llvm.smax.* etc. (PR46851)

We're now getting close to having the necessary analysis/combines etc. for the new generic llvm smax/smin/umax/umin intrinsics.

This patch updates the SSE/AVX integer MINMAX intrinsics to emit the generic equivalents instead of the icmp+select code pattern.

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

3 years ago[ARM] Corrected condition in isSaturatingConditional
Meera Nakrani [Tue, 15 Sep 2020 10:14:30 +0000 (10:14 +0000)]
[ARM] Corrected condition in isSaturatingConditional

Fixed a small error in an if condition to prevent usat/ssat being generated if (upper constant + 1) is not a
power of 2.

3 years ago[SelectionDAG] Remove unused FP constant in getNegatedExpression
Qiu Chaofan [Tue, 15 Sep 2020 09:59:10 +0000 (17:59 +0800)]
[SelectionDAG] Remove unused FP constant in getNegatedExpression

960cbc53 immediately removes nodes that won't be used to avoid
compilation time explosion. This patch adds the removal to constants to
fix PR47517.

Reviewed By: RKSimon, steven.zhang

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

3 years ago[Transforms][Coroutines] Add missing header path to CMakeLists.txt
Simon Pilgrim [Tue, 15 Sep 2020 09:37:25 +0000 (10:37 +0100)]
[Transforms][Coroutines] Add missing header path to CMakeLists.txt

Helps Visual Studio check include dependencies.

3 years ago[MVE] fix typo in llvm debug message. NFC.
Sjoerd Meijer [Tue, 15 Sep 2020 09:04:02 +0000 (10:04 +0100)]
[MVE] fix typo in llvm debug message. NFC.

3 years ago[X86] detectAVGPattern - accept non-pow2 vectors by padding.
Simon Pilgrim [Tue, 15 Sep 2020 09:06:35 +0000 (10:06 +0100)]
[X86] detectAVGPattern - accept non-pow2 vectors by padding.

Drop the pow2 vector limitation for AVG generation by padding the vector to the next pow2, creating the PAVG nodes and then extracting the final subvector.

Fixes some poor codegen that has been annoying me for years.....

3 years ago[llvm-readobj/elf] - Simplify and refine the implementation which dumps .stack_sizes
Georgii Rymar [Sat, 5 Sep 2020 16:13:50 +0000 (19:13 +0300)]
[llvm-readobj/elf] - Simplify and refine the implementation which dumps .stack_sizes

Our implementation of stack sizes section dumping heavily uses `ELFObjectFile<ELFT>`,
while the rest of the code uses `ELFFile<ELFT>`.

That APIs are very different. `ELFObjectFile<ELFT>` is very generic
and has `SectionRef`, `RelocationRef`, `SymbolRef` and other generic concepts.
The `ELFFile<ELFT>` class works directly with `Elf_Shdr`, `Elf_Rel[a]`, `Elf_Sym` etc,
what is probably much cleaner for ELF dumper.

Also, `ELFObjectFile<ELFT>` API does not always provide a way to check
for possible errors. E.g. the implementation of `symbol_end()` does not verify the `sh_size`:

```
template <class ELFT>
basic_symbol_iterator ELFObjectFile<ELFT>::symbol_end() const {
  const Elf_Shdr *SymTab = DotSymtabSec;
  if (!SymTab)
    return symbol_begin();
  DataRefImpl Sym = toDRI(SymTab, SymTab->sh_size / sizeof(Elf_Sym));
  return basic_symbol_iterator(SymbolRef(Sym, this));
}
```
There are many other examples which makes me thing we might win from
switching to `ELFFile<ELFT>` API, where we heavily validate an input data already.

This patch is the first step in this direction. I've converted the large portion of the code
to use `ELFFile<ELFT>`.

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

3 years ago[NFC][DebugInfo] Use consistent regex group spelling
Petr Hosek [Tue, 15 Sep 2020 08:46:58 +0000 (01:46 -0700)]
[NFC][DebugInfo] Use consistent regex group spelling

This is a follow up to c1f2fb5184ca.

3 years ago[lib/Object] - Refine interface of ELFFile<ELFT>. NFCI.
Georgii Rymar [Wed, 9 Sep 2020 14:03:53 +0000 (17:03 +0300)]
[lib/Object] - Refine interface of ELFFile<ELFT>. NFCI.

`ELFFile<ELFT>` has many methods that take pointers,
though they assume that arguments are never null and
hence could take references instead.

This patch performs such clean-up.

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

3 years agoGlobalISel/IRTranslator resetTargetOptions based on function attributes
Petar Avramovic [Tue, 15 Sep 2020 08:25:38 +0000 (10:25 +0200)]
GlobalISel/IRTranslator resetTargetOptions based on function attributes

Update TargetMachine.Options with function attributes before we start
to generate MIR instructions. This allows access to correct function
attributes via TargetMachine.Options (it used to access attributes of
the function that was translated first).
This affects some existing tests with "no-nans-fp-math" attribute.
Follow-up on D87456.

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

3 years ago[MVE] Rename of tests making them consistent with tail-predication tests. NFC.
Sjoerd Meijer [Tue, 15 Sep 2020 08:09:59 +0000 (09:09 +0100)]
[MVE] Rename of tests making them consistent with tail-predication tests. NFC.

3 years ago[Support] Make building with snmalloc work
Hans Wennborg [Thu, 10 Sep 2020 17:32:45 +0000 (19:32 +0200)]
[Support] Make building with snmalloc work

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

3 years ago[DebugInfo] Support both forward and backward slashes in tests
Petr Hosek [Tue, 15 Sep 2020 07:48:12 +0000 (00:48 -0700)]
[DebugInfo] Support both forward and backward slashes in tests

This addresses test failure revealed by 042c23506869.

3 years ago[doc] Fix broken link
Han Seoul-Oh [Tue, 15 Sep 2020 04:15:16 +0000 (21:15 -0700)]
[doc] Fix broken link

3 years ago[SVE] Fix isLoadInvariantInLoop for scalable vectors
David Sherwood [Mon, 7 Sep 2020 08:17:10 +0000 (09:17 +0100)]
[SVE] Fix isLoadInvariantInLoop for scalable vectors

I've amended the isLoadInvariantInLoop function to bail out for
scalable vectors for now since the invariant.start intrinsic is only
ever generated by the clang frontend for thread locals or struct
and class constructors, neither of which support sizeless types.
In addition, the intrinsic itself does not currently support the
concept of a scaled size, which makes it impossible to compare
the sizes of different scalable objects, e.g. <vscale x 32 x i8>
and <vscale x 16 x i8>.

Added new tests here:

  Transforms/LICM/AArch64/sve-load-hoist.ll
  Transforms/LICM/hoisting.ll

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

3 years ago[NFC][Asan] Remove chunk pointer from metadata
Vitaly Buka [Tue, 15 Sep 2020 07:22:10 +0000 (00:22 -0700)]
[NFC][Asan] Remove chunk pointer from metadata

kAllocBegMagic should be enough.
kAllocBegMagic is already set for the Secondary allocations.
kAllocBegMagic is good enough for the Primary, but it's even safer for
the Secondary allocator as all allocated block are from mmap.

Depends on D87646.

Reviewed By: morehouse

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

3 years ago[NFC] Test commit
Chris Hamilton [Tue, 15 Sep 2020 07:19:02 +0000 (02:19 -0500)]
[NFC] Test commit

3 years ago[NFC][Asan] Return uptr as before D87646
Vitaly Buka [Tue, 15 Sep 2020 07:16:55 +0000 (00:16 -0700)]
[NFC][Asan] Return uptr as before D87646

3 years ago[Asan] Cleanup kAllocBegMagic setup
Vitaly Buka [Tue, 15 Sep 2020 07:12:02 +0000 (00:12 -0700)]
[Asan] Cleanup kAllocBegMagic setup

Make it atomic.
Wrap it into class.
Set it late after chunk is initialized.
Reset it soon when the chunk is still valid.

Depends on D87645.

Reviewed By: morehouse

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

3 years ago[NFC][Asan] Reorder bitfields
Vitaly Buka [Tue, 15 Sep 2020 07:07:56 +0000 (00:07 -0700)]
[NFC][Asan] Reorder bitfields

Depends on D87644.

Reviewed By: morehouse

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

3 years agoRevert "[Sema] Address-space sensitive index check for unbounded arrays"
Chris Hamilton [Tue, 15 Sep 2020 06:54:41 +0000 (01:54 -0500)]
Revert "[Sema] Address-space sensitive index check for unbounded arrays"

This reverts commit da55e9ba1273284f1af61bceeaeb25e487838034.

Build bots uncovered coverage gap in testing.  Change not ready.

3 years ago[NFC][Asan] Remove from_memalign and rz_log
Vitaly Buka [Tue, 15 Sep 2020 06:54:48 +0000 (23:54 -0700)]
[NFC][Asan] Remove from_memalign and rz_log

Before D87643 they where used to optimize UsedSize(). Which was
called frequently from leak scanner.
It was also used for calls from QuarantineCallback
but we have heavy get_allocator().Deallocate call there anyway.

Depends on D87643.

Reviewed By: morehouse

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

3 years ago[NFC][Asan] Don't use MetaData for size
Vitaly Buka [Tue, 15 Sep 2020 06:53:58 +0000 (23:53 -0700)]
[NFC][Asan] Don't use MetaData for size

Now we have enough space in the ChunkHeader.
45 bit is enough for kMaxAllowedMallocSize.

Depends on D87642.

Reviewed By: morehouse

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

3 years ago[X86] Pre-commit test cases for D87593
Craig Topper [Tue, 15 Sep 2020 05:41:39 +0000 (22:41 -0700)]
[X86] Pre-commit test cases for D87593

The memory operand for these is incorrect.

3 years ago[NFC][lsan][fuzzer] Relax fuzzer-leak.test
Vitaly Buka [Tue, 15 Sep 2020 02:44:27 +0000 (19:44 -0700)]
[NFC][lsan][fuzzer] Relax fuzzer-leak.test

With lsan we can't guarantee to catch leak on the same iteration.

3 years ago[Windows][Polly] Disable LLVMPolly module for all compilers on Windows
Mateusz Mikuła [Tue, 15 Sep 2020 06:12:02 +0000 (09:12 +0300)]
[Windows][Polly] Disable LLVMPolly module for all compilers on Windows

Before this patch, the cmake disabled loadable modules when compiling
with Visual Studio. However, the reason for this is a limitation of the
Windows DLLs, thus this restriction should apply to any compiler for the
Windows platform, such as MinGW, Cygwin, icc, etc.

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

3 years ago[LLD] Allow configuring default ld.lld backend
Mateusz Mikuła [Tue, 15 Sep 2020 05:39:15 +0000 (08:39 +0300)]
[LLD] Allow configuring default ld.lld backend

The motivation for this is ld.lld --help targeting MinGW which
currently prints help for the ELF backend unless -m i386pe{,p} is
added. This confuses build systems that grep through linker help to
find supported flags.

This matches LD from Binutils which always prints help for MinGW
when configured to target it.

After this change, the backend can still be overridden to any
supported ELF/MinGW target by using correct -m <arch>.

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

3 years ago[llvm-readobj] [ARMWinEH] Print ARM64 packed unwind info
Martin Storsjö [Fri, 4 Sep 2020 20:42:22 +0000 (23:42 +0300)]
[llvm-readobj] [ARMWinEH] Print ARM64 packed unwind info

In addition to printing the individual fields, synthesize and
print the corresponding prolog for the unwind info (in reverse
order, to match how it's printed for non-packed unwind info).

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

3 years ago[BinaryFormat/MachO] Add a missing constant.
Davide Italiano [Tue, 15 Sep 2020 05:29:53 +0000 (22:29 -0700)]
[BinaryFormat/MachO] Add a missing constant.

Reference:
https://opensource.apple.com/source/cctools/cctools-949.0.1/include/mach-o/loader.h.auto.html

3 years ago[DebugInfo] Make offsets of dwarf units 64-bit (19/19).
Igor Kudrin [Tue, 15 Sep 2020 04:32:08 +0000 (11:32 +0700)]
[DebugInfo] Make offsets of dwarf units 64-bit (19/19).

In the case of LTO, several DWARF units can be emitted in one section.
For an extremely large application, they may exceed the limit of 4GiB
for 32-bit offsets. As it is now possible to emit 64-bit debugging info,
the patch enables storing the larger offsets.

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

3 years ago[DebugInfo] Make the offset of string pool entries 64-bit (18/19).
Igor Kudrin [Tue, 15 Sep 2020 04:32:01 +0000 (11:32 +0700)]
[DebugInfo] Make the offset of string pool entries 64-bit (18/19).

The string pool is shared among several units in the case of LTO,
and it potentially can exceed the limit of 4GiB for an extremely
large application. As it is now possible to emit 64-bit debugging
info, the limitation can be removed.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_macro[.dwo] sections (17/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:55 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_macro[.dwo] sections (17/19).

The patch fixes emitting flags and the debug_line_offset field in
the header, as well as the reference to the macro string for
a pre-standard GNU .debug_macro extension.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_names sections (16/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:49 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_names sections (16/19).

The patch fixes emitting the unit length field in the header of
the table and offsets to the entry pool. Note that while the patch
changes the common method to emit offsets, in fact, nothing is changed
for Apple accelerator tables, because we do not yet support DWARF64 for
those targets.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_addr sections (15/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:41 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_addr sections (15/19).

The patch fixes emitting the header of the table. The content is
independent of the DWARF format.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_loclists sections (14/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:34 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_loclists sections (14/19).

The size of the offsets in the table depends on the DWARF format.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_rnglists sections (13/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:28 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_rnglists sections (13/19).

The size of the offsets in the table depends on the DWARF format.

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

3 years ago[DebugInfo] Fix emitting pre-v5 name lookup tables in the DWARF64 format (12/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:20 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting pre-v5 name lookup tables in the DWARF64 format (12/19).

The transition is done by using methods of AsmPrinter which
automatically emit values in compliance with the selected DWARF format.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_aranges sections (11/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:14 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_aranges sections (11/19).

The patch fixes calculating the size of the table and emitting
the fields which depend on the DWARF format by using methods that
choose appropriate sizes automatically.

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

3 years ago[DebugInfo] Fix emitting DWARF64 type units (10/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:07 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 type units (10/19).

The patch fixes emitting the offset to the type DIE. All other fields
are already fixed in previous patches.

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

3 years ago[DebugInfo] Fix emitting DWARF64 DWO compilation units and string offset tables ...
Igor Kudrin [Tue, 15 Sep 2020 04:31:00 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 DWO compilation units and string offset tables (9/19).

These two fixes are better to go together because llvm-dwarfdump is
unable to dump a table when another one is malformed.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_str_offsets sections (8/19).
Igor Kudrin [Tue, 15 Sep 2020 04:30:53 +0000 (11:30 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_str_offsets sections (8/19).

The patch fixes calculating the size of the table and emitting the unit
length field.

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

3 years ago[DebugInfo] Fix emitting the DW_AT_location attribute for 64-bit DWARFv3 (7/19).
Igor Kudrin [Tue, 15 Sep 2020 04:30:46 +0000 (11:30 +0700)]
[DebugInfo] Fix emitting the DW_AT_location attribute for 64-bit DWARFv3 (7/19).

The patch uses a common method to determine the appropriate form for
the value of the attribute.

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

3 years ago[DebugInfo] Use a common method to determine a suitable form for section offsts ...
Igor Kudrin [Tue, 15 Sep 2020 04:30:38 +0000 (11:30 +0700)]
[DebugInfo] Use a common method to determine a suitable form for section offsts (6/19).

This is mostly an NFC patch because the involved methods are used when
emitting DWO files, which is incompatible with DWARFv3, or for platforms
where DWARF64 is not supported yet.

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

3 years ago[DebugInfo] Fix emitting DWARF64 compilation units (5/19).
Igor Kudrin [Tue, 15 Sep 2020 04:30:30 +0000 (11:30 +0700)]
[DebugInfo] Fix emitting DWARF64 compilation units (5/19).

The patch also adds a method to choose an appropriate DWARF form
to represent section offsets according to the version and the format
of producing debug info.

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

3 years ago[DebugInfo] Add the -dwarf64 switch to llc and other internal tools (4/19).
Igor Kudrin [Tue, 15 Sep 2020 04:30:18 +0000 (11:30 +0700)]
[DebugInfo] Add the -dwarf64 switch to llc and other internal tools (4/19).

The patch adds a switch to enable emitting debug info in the 64-bit
DWARF format. Most emitter for sections will be updated in the subsequent
patches, whereas for .debug_line and .debug_frame the emitters are in
the MC library, which is already updated.

For now, the switch is enabled only for 64-bit ELF targets.

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

3 years ago[DebugInfo] Add new emitting methods for values which depend on the DWARF format...
Igor Kudrin [Tue, 15 Sep 2020 04:30:10 +0000 (11:30 +0700)]
[DebugInfo] Add new emitting methods for values which depend on the DWARF format (3/19).

These methods are going to be used in subsequent patches.

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

3 years ago[DebugInfo] Fix DIE value emitters to be compatible with DWARF64 (2/19).
Igor Kudrin [Tue, 15 Sep 2020 04:30:02 +0000 (11:30 +0700)]
[DebugInfo] Fix DIE value emitters to be compatible with DWARF64 (2/19).

DW_FORM_sec_offset and DW_FORM_strp imply values of different sizes with
DWARF32 and DWARF64. The patch fixes DIE value classes to use correct
sizes when emitting their values. For DIELocList it ensures that the
requested DWARF form matches the current DWARF format because that class
uses a method that selects the size automatically.

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

3 years ago[DebugInfo] Fix methods of AsmPrinter to emit values corresponding to the DWARF forma...
Igor Kudrin [Tue, 15 Sep 2020 04:29:48 +0000 (11:29 +0700)]
[DebugInfo] Fix methods of AsmPrinter to emit values corresponding to the DWARF format (1/19).

These methods are used to emit values which are 32-bit in DWARF32 and
64-bit in DWARF64. The patch fixes them so that they choose the length
automatically, depending on the DWARF format set in the Context.

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