platform/upstream/llvm.git
3 years agoRevert "[mlir][Vector] Add transformation + pattern to split vector.transfer_read...
Mehdi Amini [Mon, 3 Aug 2020 16:16:47 +0000 (16:16 +0000)]
Revert "[mlir][Vector] Add transformation + pattern to split vector.transfer_read into full and partial copies."

This reverts commit 35b65be041127db9fe23d3128a004c888893cbae.

Build is broken with -DBUILD_SHARED_LIBS=ON with some undefined
references like:

VectorTransforms.cpp:(.text._ZN4llvm12function_refIFvllEE11callback_fnIZL24createScopedInBoundsCondN4mlir25VectorTransferOpInterfaceEE3$_8EEvlll+0xa5): undefined reference to `mlir::edsc::op::operator+(mlir::Value, mlir::Value)'

3 years ago[FPEnv] Don't transform FSUB(-0,X)->FNEG(X) in SelectionDAGBuilder.
Cameron McInally [Mon, 3 Aug 2020 15:19:33 +0000 (10:19 -0500)]
[FPEnv] Don't transform FSUB(-0,X)->FNEG(X) in SelectionDAGBuilder.

This patch stops unconditionally transforming FSUB(-0,X) into an FNEG(X) while building the DAG. There is also one small change to handle the new FSUB(-0,X) similarly to FNEG(X) in the AMDGPU backend.

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

3 years ago[analyzer][tests] Fix SATest update functionality
Valeriy Savchenko [Wed, 22 Jul 2020 10:36:13 +0000 (13:36 +0300)]
[analyzer][tests] Fix SATest update functionality

Summary:
Not all projects in the project map file might have newer results
for updating, we should handle this situation gracefully.

Additionally, not every user of the test system would want storing
reference results in git.  For this reason, git functionality is now
optional.

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

3 years ago[DWARFYAML] Implement the .debug_loclists section.
Xing GUO [Mon, 3 Aug 2020 15:19:42 +0000 (23:19 +0800)]
[DWARFYAML] Implement the .debug_loclists section.

This patch implements the .debug_loclists section. There are only two
DWARF expressions are implemented in this patch (DW_OP_consts,
DW_OP_stack_value). We will implement more in the future.

The YAML description of the .debug_loclists section is:

```
debug_loclists:
  - Format:              DWARF32 ## Optional
    Length:              0x1234  ## Optional
    Version:             5       ## Optional (5 by default)
    AddressSize:         8       ## Optional
    SegmentSelectorSize: 0       ## Optional (0 by default)
    OffsetEntryCount:    1       ## Optional
    Offsets:             [ 1 ]   ## Optional
    Lists:
      - Entries:
          - Operator:          DW_LLE_startx_endx
            Values:            [ 0x1234, 0x4321 ]
            DescriptorsLength: 0x1234             ## Optional
            Descriptors:
              - Operator: DW_OP_consts
                Values:   [ 0x1234 ]
```

Reviewed By: jhenderson

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

3 years ago[NFC][APInt][DenseMapInfo] Move DenseMapAPIntKeyInfo into DenseMap.h as DenseMapInfo...
Shinji Okumura [Mon, 3 Aug 2020 14:31:13 +0000 (23:31 +0900)]
[NFC][APInt][DenseMapInfo] Move DenseMapAPIntKeyInfo into DenseMap.h as DenseMapInfo<APInt>

`DenseMapAPIntKeyInfo` is now located in `lib/IR/LLVMContextImpl.h`.
Moved it into `include/ADT/DenseMapInfo.h` to use it.

Reviewed By: jdoerfert

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

3 years ago[InstCombine] reduce xor-of-or's bitwise logic (PR46955); 2nd try
Sanjay Patel [Mon, 3 Aug 2020 13:19:11 +0000 (09:19 -0400)]
[InstCombine] reduce xor-of-or's bitwise logic (PR46955); 2nd try

The 1st try at this (rG2265d01f2a5b) exposed what looks like
unspecified behavior in C/C++ resulting in test variations.

The arguments to BinaryOperator::CreateAnd() were both IRBuilder
function calls, and the order in which they execute determines
the order of the new instructions in the IR. But the order of
function arg evaluation is not fixed by the rules of C/C++, so
depending on compiler config, the test would fail because the
test expected a single fixed ordering of instructions.

Original commit message:
I tried to use m_Deferred() on this, but didn't find
a clean way to do that.

http://bugs.llvm.org/PR46955

https://alive2.llvm.org/ce/z/2h6QTq

3 years ago[DWARFYAML] Offsets should be omitted when the OffsetEntryCount is 0.
Xing GUO [Mon, 3 Aug 2020 14:04:33 +0000 (22:04 +0800)]
[DWARFYAML] Offsets should be omitted when the OffsetEntryCount is 0.

The offsets field should be omitted when the 'OffsetEntryCount' entry is
specified to be 0.

Reviewed By: jhenderson

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

3 years ago[mlir] First-party modeling of LLVM types
Alex Zinenko [Wed, 29 Jul 2020 12:58:09 +0000 (14:58 +0200)]
[mlir] First-party modeling of LLVM types

The current modeling of LLVM IR types in MLIR is based on the LLVMType class
that wraps a raw `llvm::Type *` and delegates uniquing, printing and parsing to
LLVM itself. This model makes thread-safe type manipulation hard and is being
progressively replaced with a cleaner MLIR model that replicates the type
system.  Introduce a set of classes reflecting the LLVM IR type system in MLIR
instead of wrapping the existing types. These are currently introduced as
separate classes without affecting the dialect flow, and are exercised through
a test dialect. Once feature parity is reached, the old implementation will be
gradually substituted with the new one.

Depends On D84171

Reviewed By: rriddle

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

3 years agoGlobalISel: Handle arbitrary FewerElementsVector for G_IMPLICIT_DEF
Matt Arsenault [Tue, 28 Jul 2020 14:15:30 +0000 (10:15 -0400)]
GlobalISel: Handle arbitrary FewerElementsVector for G_IMPLICIT_DEF

3 years agoAMDGPU/GlobalISel: Remove old hacks for boolean selection
Matt Arsenault [Sun, 26 Jul 2020 14:47:08 +0000 (10:47 -0400)]
AMDGPU/GlobalISel: Remove old hacks for boolean selection

There were various hacks used to try to avoid making s1 SGPR vs. s1
VCC ambiguous after constraining the register before we had a strategy
to deal with this. This also attempted to handle undef operands, which
are now illegal gMIR.

3 years agoGlobalISel: Reimplement moreElementsVectorDst
Matt Arsenault [Sun, 2 Feb 2020 22:42:02 +0000 (17:42 -0500)]
GlobalISel: Reimplement moreElementsVectorDst

Use pad with undef and unmerge with unused results. This is annoyingly
similar to several other places in LegalizerHelper, but they're all
slightly different.

3 years agoRevert "[InstCombine] reduce xor-of-or's bitwise logic (PR46955)"
Sanjay Patel [Mon, 3 Aug 2020 12:58:41 +0000 (08:58 -0400)]
Revert "[InstCombine] reduce xor-of-or's bitwise logic (PR46955)"

This reverts commit 2265d01f2a5bd153959701e22f5be2a40e1674a3.
Seeing bot failures after this change like:
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/42586

3 years agoAMDGPU/GlobalISel: Apply load bitcast to s.buffer.load intrinsic
Matt Arsenault [Tue, 16 Jun 2020 18:52:14 +0000 (14:52 -0400)]
AMDGPU/GlobalISel: Apply load bitcast to s.buffer.load intrinsic

Should also apply this to the non-scalar buffer loads.

3 years ago[X86][SSE] Start shuffle combining from ANY_EXTEND_VECTOR_INREG on SSE targets
Simon Pilgrim [Mon, 3 Aug 2020 11:18:21 +0000 (12:18 +0100)]
[X86][SSE] Start shuffle combining from ANY_EXTEND_VECTOR_INREG on SSE targets

We already do this on AVX (+ for ZERO_EXTEND_VECTOR_INREG), but this enables it for all SSE targets - we attempted something similar back at rL357057 but hit issues with the ZERO_EXTEND_VECTOR_INREG handling (PR41249).

I'm still looking at the vector-mul.ll regression - which is due to 32-bit targets performing the load as a f64, resulting in the shuffle combiner thinking it has to create a shuffle in the float domain.

3 years agoAMDGPU/GlobalISel: Fix selecting broken copies for s32->s64 anyext
Matt Arsenault [Thu, 23 Jul 2020 01:07:03 +0000 (21:07 -0400)]
AMDGPU/GlobalISel: Fix selecting broken copies for s32->s64 anyext

These should probably not be legal in the first place, but that might
also be a pain.

3 years ago[InstCombine] reduce xor-of-or's bitwise logic (PR46955)
Sanjay Patel [Mon, 3 Aug 2020 12:11:06 +0000 (08:11 -0400)]
[InstCombine] reduce xor-of-or's bitwise logic (PR46955)

I tried to use m_Deferred() on this, but didn't find
a clean way to do that.

http://bugs.llvm.org/PR46955

https://alive2.llvm.org/ce/z/2h6QTq

3 years ago[InstCombine] add tests for xor-of-ors; NFC
Sanjay Patel [Sun, 2 Aug 2020 17:40:23 +0000 (13:40 -0400)]
[InstCombine] add tests for xor-of-ors; NFC

3 years ago[clang][ARM] Add name-mangling test for direct __fp16 arguments.
Simon Tatham [Mon, 3 Aug 2020 12:30:48 +0000 (13:30 +0100)]
[clang][ARM] Add name-mangling test for direct __fp16 arguments.

`clang/test/CodeGenCXX/fp16-mangle.cpp` tests pointers to __fp16, but
if you give the `-fallow-half-arguments-and-returns` option, then
clang can also leave an __fp16 unmodified as a function argument or
return type. This regression test checks the name-mangling of that.

Reviewed By: miyuki

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

3 years ago[ARM] Fix IT block generation after Thumb2SizeReduce with -Oz
Nicholas Guy [Wed, 1 Jul 2020 10:35:58 +0000 (11:35 +0100)]
[ARM] Fix IT block generation after Thumb2SizeReduce with -Oz

Fixes a regression caused by D82439, in which IT blocks were no longer being
generated when -Oz is present. This was due to the CPSR register being marked as
dead, while this case was not accounted for.

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

3 years ago[clangd] Support new/deleta operator in TargetFinder.
Haojian Wu [Sat, 25 Jul 2020 19:52:33 +0000 (21:52 +0200)]
[clangd] Support new/deleta operator in TargetFinder.

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

3 years ago[analyzer] Introduce minor refactoring of SVal::getSubKind function
Denys Petrov [Fri, 31 Jul 2020 12:54:46 +0000 (15:54 +0300)]
[analyzer] Introduce minor refactoring of SVal::getSubKind function

Summary: `BaseMask` occupies the lowest bits. Effect of applying the mask is neutralized by right shift operation, thus making it useless.

Fix: Remove a redundant bitwise operation.

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

3 years ago[analyzer] Simplify function SVal::getAsSymbolicExpression and similar ones
Denys Petrov [Fri, 31 Jul 2020 15:57:04 +0000 (18:57 +0300)]
[analyzer] Simplify function SVal::getAsSymbolicExpression and similar ones

Summary: Simplify functions SVal::getAsSymbolicExpression SVal::getAsSymExpr and SVal::getAsSymbol. After revision I concluded that `getAsSymbolicExpression` and `getAsSymExpr` repeat functionality of `getAsSymbol`, thus them can be removed.

Fix: Remove functions SVal::getAsSymbolicExpression and SVal::getAsSymExpr.

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

3 years ago[clang][Tooling] Optimize addTargetAndMode in case of invalid modes
Kadir Cetinkaya [Sat, 1 Aug 2020 17:03:40 +0000 (19:03 +0200)]
[clang][Tooling] Optimize addTargetAndMode in case of invalid modes

This skips searching for `target` related flags in the existing args if
we don't have a valid target to insert.

Depends on D85076

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

3 years ago[llvm-readobj] - Don't stop dumping when the name of a relocation section can't be...
Georgii Rymar [Thu, 23 Jul 2020 14:10:31 +0000 (17:10 +0300)]
[llvm-readobj] - Don't stop dumping when the name of a relocation section can't be read.

This removes undesired `unwrapOrError` calls from printRelocations() methods.

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

3 years ago[llvm-readobj] - Massive test cases cleanup.
Georgii Rymar [Thu, 30 Jul 2020 14:55:47 +0000 (17:55 +0300)]
[llvm-readobj] - Massive test cases cleanup.

This patch does the following:
1) Starts using YAML macro to reduce the number of YAML documents in tests.
2) Adds `#` before 'RUN'/`CHECK` lines in a few tests where it is missing.
3) Removes unused YAML keys.
4) Starts using `ENTSIZE=<none>` to simplify tests (see D84526).
5) Removes trailing white spaces in a few places.

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

3 years agoFix update_cc_test_checks.py --llvm-bin after D78478
Alex Richardson [Mon, 3 Aug 2020 10:18:01 +0000 (11:18 +0100)]
Fix update_cc_test_checks.py --llvm-bin after D78478

Not passing --clang would result in a python exception after this change:
(TypeError: expected str, bytes or os.PathLike object, not NoneType)
because the --clang argument default was only being populated in the
initial argument parsing pass but not later on.
Fix this by adding an argparse callback to set the default values.

Reviewed By: vitalybuka, MaskRay

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

3 years ago[lldb/Process/Windows] Attempting to kill exited/detached process in not an error
Tatyana Krasnukha [Thu, 30 Jul 2020 17:13:23 +0000 (20:13 +0300)]
[lldb/Process/Windows] Attempting to kill exited/detached process in not an error

The lldb test-suite on Windows reports a 'CLEANUP ERROR' when attempting to kill
an exited/detached process. This change makes ProcessWindows consistent with
the other processes which only log the error. After this change a number of
'CLEANUP ERROR' messages are now removed.

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

3 years ago[cmake] Make MSVC generate appropriate __cplusplus macro definition
Tatyana Krasnukha [Fri, 17 Jul 2020 12:58:28 +0000 (15:58 +0300)]
[cmake] Make MSVC generate appropriate __cplusplus macro definition

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

3 years agoExecute llvm-lit with the python found by CMake by default
Alex Richardson [Mon, 3 Aug 2020 09:51:14 +0000 (10:51 +0100)]
Execute llvm-lit with the python found by CMake by default

The check-* targets run ${Python3_EXECUTABLE} $BUILD/bin/llvm-lit, but
running `./bin/llvm-lit $ARGS` from the build directory currently always
uses "python" to run llvm-lit. On most systems this will be python2.7 even
if we found python3 at CMake time.

Reviewed By: compnerd

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

3 years ago[msan] Compile the libatomic.c test with a C compiler
Alex Richardson [Mon, 3 Aug 2020 09:31:31 +0000 (10:31 +0100)]
[msan] Compile the libatomic.c test with a C compiler

Otherwise we end up compiling in C++ mode and on FreeBSD
/usr/include/stdatomic.h is not compatible with C++ since it uses _Bool.

Reviewed By: guiand, eugenis, vitalybuka, emaste

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

3 years ago[asan][tsan] Mark tests failing with debug checks as XFAIL
Alex Richardson [Mon, 3 Aug 2020 09:04:01 +0000 (10:04 +0100)]
[asan][tsan] Mark tests failing with debug checks as XFAIL

See https://llvm.org/PR46862. This does not fix the underlying issue but at
least it allows me to run check-all again without having to disable
building compiler-rt.

Reviewed By: #sanitizers, vitalybuka

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

3 years ago[clang][Tooling] Fix addTargetAndModeForProgramName to use correct flag names
Kadir Cetinkaya [Sat, 1 Aug 2020 16:55:30 +0000 (18:55 +0200)]
[clang][Tooling] Fix addTargetAndModeForProgramName to use correct flag names

The logic was using incorrect flag versions. For example:
- `-target=` can't be a prefix, it must be `--target=`.
- `--driver-mode` can't appear on its own, value must be attached to it.

While fixing those, also changes the append logic to make use of new
`--target=X` format instead of the legacy `-target X` version.

In addition to that makes use of the OPTTable instead of hardcoded strings to
make sure helper also gets updated if clang's options are modified.

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

3 years ago[llvm-readobj] - Don't call `unwrapOrErr` in `findSectionByName`.
Georgii Rymar [Mon, 27 Jul 2020 13:03:03 +0000 (16:03 +0300)]
[llvm-readobj] - Don't call `unwrapOrErr` in `findSectionByName`.

We have a `findSectionByName` helper that tries to find a section
by it name. It is used in a few places, but never tested.

I'd like to reuse this helper for a different place.
For this, I've changed it to return Expected<> and now it
doesn't use `unwrapOrErr` anymore. It also now a member of
Dumper class and might report warnings.

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

3 years agoAdd document outline symbols from unnamed contexts, e.g. extern "C".
Ilya Golovenko [Mon, 3 Aug 2020 09:34:14 +0000 (11:34 +0200)]
Add document outline symbols from unnamed contexts, e.g. extern "C".

It is necessary to traverse children of unnamed declaration contexts
to get symbols which are currently missing in document outline, e.g.:

extern "C" {
void foo();
}

Reviewed By: kadircet

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

3 years ago[yaml2obj] - Add a support for "<none>" value for all optional fields.
Georgii Rymar [Thu, 23 Jul 2020 12:26:23 +0000 (15:26 +0300)]
[yaml2obj] - Add a support for "<none>" value for all optional fields.

It implements an approach suggested in the D84398 thread.

With it the following:

```
Sections:
  - Name:   .bar
    Type:   SHT_PROGBITS
    Offset: [[MACRO=<none>]]
```

works just like the `Offset` key was not specified.
It is useful for tests that want to have a default value for a field and to
have a way to override it at the same time.

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

3 years ago[mlir] Extended Buffer Assignment to support AllocaOps.
Julian Gross [Fri, 31 Jul 2020 09:42:31 +0000 (11:42 +0200)]
[mlir] Extended Buffer Assignment to support AllocaOps.

Added support for AllocaOps in Buffer Assignment.

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

3 years agofix lldb test on lib64 systems
Luboš Luňák [Sun, 2 Aug 2020 15:44:24 +0000 (17:44 +0200)]
fix lldb test on lib64 systems

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

3 years ago[LV] Do not check widening decision for instrs outside of loop.
Florian Hahn [Mon, 3 Aug 2020 08:47:16 +0000 (09:47 +0100)]
[LV] Do not check widening decision for instrs outside of loop.

No widening decisions will be computed for instructions outside the
loop. Do not try to get a widening decision. The load/store will be just
a scalar load, so treating at as normal should be fine I think.

Fixes PR46950.

Reviewed By: dmgreen

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

3 years ago[mlir][Vector] Add transformation + pattern to split vector.transfer_read into full...
Nicolas Vasilache [Mon, 3 Aug 2020 08:39:18 +0000 (04:39 -0400)]
[mlir][Vector] Add transformation + pattern to split vector.transfer_read into full and partial copies.

This revision adds a transformation and a pattern that rewrites a "maybe masked" `vector.transfer_read %view[...], %pad `into a pattern resembling:

```
   %1:3 = scf.if (%inBounds) {
      scf.yield %view : memref<A...>, index, index
    } else {
      %2 = vector.transfer_read %view[...], %pad : memref<A...>, vector<...>
      %3 = vector.type_cast %extra_alloc : memref<...> to
      memref<vector<...>> store %2, %3[] : memref<vector<...>> %4 =
      memref_cast %extra_alloc: memref<B...> to memref<A...> scf.yield %4 :
      memref<A...>, index, index
   }
   %res= vector.transfer_read %1#0[%1#1, %1#2] {masked = [false ... false]}
```
where `extra_alloc` is a top of the function alloca'ed buffer of one vector.

This rewrite makes it possible to realize the "always full tile" abstraction where vector.transfer_read operations are guaranteed to read from a padded full buffer.
The extra work only occurs on the boundary tiles.

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

3 years ago[debugserver] Fix that is_dot_app is producing unused warnings
Raphael Isemann [Mon, 3 Aug 2020 08:23:48 +0000 (10:23 +0200)]
[debugserver] Fix that is_dot_app is producing unused warnings

Some build configurations don't use this static function.

3 years ago[MLIR][Shape] Lower `shape.broadcast` to `scf`
Frederik Gossen [Mon, 3 Aug 2020 08:18:48 +0000 (08:18 +0000)]
[MLIR][Shape] Lower `shape.broadcast` to `scf`

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

3 years ago[MachOYAML] Remove redundant variable initialization. NFC.
Xing GUO [Mon, 3 Aug 2020 08:14:47 +0000 (16:14 +0800)]
[MachOYAML] Remove redundant variable initialization. NFC.

The value of `is64Bit` is initialized in the constructor body.

3 years ago[Attributor] Check nonnull attribute violation in AAUndefinedBehavior
Shinji Okumura [Mon, 3 Aug 2020 08:02:49 +0000 (17:02 +0900)]
[Attributor] Check nonnull attribute violation in AAUndefinedBehavior

This patch makes it possible to handle nonnull attribute violation at callsites in AAUndefinedBehavior.
If null pointer is passed to callee at a callsite and the corresponding argument of callee has nonnull attribute, the behavior of the callee is undefined.
In this patch, violations of argument nonnull attributes is only handled.
But violations of returned nonnull attributes can be handled and I will implement that in a follow-up patch.

Reviewed By: jdoerfert

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

3 years ago[DebugInfo] Make DIEDelta::SizeOf() more explicit. NFCI.
Igor Kudrin [Mon, 3 Aug 2020 08:04:15 +0000 (15:04 +0700)]
[DebugInfo] Make DIEDelta::SizeOf() more explicit. NFCI.

The patch restricts DIEDelta::SizeOf() to accept only DWARF forms that
are actually used in the LLVM codebase. This should make the use of the
class more explicit and help to avoid issues similar to fixed in D83958
and D84094.

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

3 years ago[DebugInfo] Fix misleading using of DWARF forms with DIELabel. NFCI.
Igor Kudrin [Mon, 3 Aug 2020 08:04:08 +0000 (15:04 +0700)]
[DebugInfo] Fix misleading using of DWARF forms with DIELabel. NFCI.

DIELabel can emit only 32- or 64-bit values, while it was created in
some places with DW_FORM_udata, which implies emitting uleb128.
Nevertheless, these places also expected to emit U32 or U64, but just
used a misleading DWARF form. The patch updates those places to use more
appropriate DWARF forms and restricts DIELabel::SizeOf() to accept only
forms that are actually used in the LLVM codebase.

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

3 years ago[DebugInfo] Fix a comment and a variable name. NFC.
Igor Kudrin [Mon, 3 Aug 2020 08:04:00 +0000 (15:04 +0700)]
[DebugInfo] Fix a comment and a variable name. NFC.

DebugLocListIndex keeps the index of an entry list, not the offset.

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

3 years ago[DebugInfo] Make DIELocList::SizeOf() more explicit. NFCI.
Igor Kudrin [Mon, 3 Aug 2020 08:03:37 +0000 (15:03 +0700)]
[DebugInfo] Make DIELocList::SizeOf() more explicit. NFCI.

DIELocList is used with a limited number of DWARF forms, see the only
place where it is instantiated, DwarfCompileUnit::addLocationList().

The patch marks the unexpected execution path in DIELocList::SizeOf()
as unreachable, to reduce ambiguity.

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

3 years ago[libunwind] Make the test depend on the libunwind explicitly.
Daniel Kiss [Mon, 3 Aug 2020 07:40:35 +0000 (09:40 +0200)]
[libunwind] Make the test depend on the libunwind explicitly.

Before this patch the `ninja check-unwind` won't rebuild the unwind library.

Reviewed By: jroelofs

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

3 years ago[NFC] [MIR] Document the reg state flags
Djordje Todorovic [Mon, 3 Aug 2020 07:01:37 +0000 (09:01 +0200)]
[NFC] [MIR] Document the reg state flags

This patch adds documentation for the RegState enumeration.

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

3 years ago[MLIR][SPIRV] Control attributes support for loop and selection
George Mitenkov [Mon, 3 Aug 2020 06:31:08 +0000 (09:31 +0300)]
[MLIR][SPIRV] Control attributes support for loop and selection

This patch handles loopControl and selectionControl in parsing and
printing. In order to reuse the functionality, and avoid handling cases when
`{` of the region is parsed as a dictionary attribute, `control` keyword was
introduced.`None` is a default control attribute. This functionality can be
later extended to `spv.func`.
Also, loopControl and selectionControl can now be (de)serialized.

Reviewed By: antiagainst

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

3 years ago[CMake] Default ENABLE_X86_RELAX_RELOCATIONS to ON
Fangrui Song [Mon, 3 Aug 2020 06:05:50 +0000 (23:05 -0700)]
[CMake] Default ENABLE_X86_RELAX_RELOCATIONS to ON

This makes clang default to -Wa,-mrelax-relocations=yes, which enables
R_386_GOT32X (GNU as enables it regardless of -mrelax-relocations=) and
R_X86_64_[REX_]GOTPCRELX in MC. The produced object files require GNU ld>=2.26
to link. binutils 2.26 is considered a very old release today.

3 years ago[gn build] Port 160ff83765a
LLVM GN Syncbot [Mon, 3 Aug 2020 05:55:14 +0000 (05:55 +0000)]
[gn build] Port 160ff83765a

3 years ago[OpenMP][AMDGCN] Support OpenMP offloading for AMDGCN architecture - Part 3
Saiyedul Islam [Mon, 3 Aug 2020 05:29:48 +0000 (05:29 +0000)]
[OpenMP][AMDGCN] Support OpenMP offloading for AMDGCN architecture - Part 3

Provides AMDGCN and NVPTX specific specialization of getGPUWarpSize,
getGPUThreadID, and getGPUNumThreads methods. Adds tests for AMDGCN
codegen for these methods in generic and simd modes. Also changes the
precondition in InitTempAlloca to be slightly more permissive. Useful for
AMDGCN OpenMP codegen where allocas are created with a cast to an
address space.

Reviewed By: ABataev

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

3 years ago[MC] Default MCAsmBackend::mayNeedRelaxation() to false
Fangrui Song [Mon, 3 Aug 2020 05:13:59 +0000 (22:13 -0700)]
[MC] Default MCAsmBackend::mayNeedRelaxation() to false

3 years ago[FLANG] Fix issues in SELECT TYPE construct when intrinsic type specification is...
compinder [Mon, 3 Aug 2020 03:27:17 +0000 (08:57 +0530)]
[FLANG] Fix issues in SELECT TYPE construct when intrinsic type specification is specified in TYPE GUARD statement.

Fix of PR46789 and PR46830.

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

3 years ago[NFC][PowerPC] Add a multiclass for fsetcc to define them in a uniform way
QingShan Zhang [Mon, 3 Aug 2020 03:25:20 +0000 (03:25 +0000)]
[NFC][PowerPC] Add a multiclass for fsetcc to define them in a uniform way

This is a refactor patch to prepare for adding the support for strict-fsetcc
in PowerPC backend. We want to move their definition into a uniform way so that,
we could add the strict node easier.

Reviewed By: shchenz

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

3 years ago[RISCV] eliminate the repetition declare of SDLoc DL
StephenFan [Fri, 31 Jul 2020 05:31:48 +0000 (13:31 +0800)]
[RISCV] eliminate the repetition declare of SDLoc DL

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

3 years agoReland D64327 [MC][ELF] Allow STT_SECTION referencing SHF_MERGE on REL targets
Fangrui Song [Mon, 3 Aug 2020 01:05:17 +0000 (18:05 -0700)]
Reland D64327 [MC][ELF] Allow STT_SECTION referencing SHF_MERGE on REL targets

This drops a GNU gold workaround and reverts the revert commit rL366708.

  Before binutils 2.34, gold -O2 and above did not correctly handle R_386_GOTOFF to
  SHF_MERGE|SHF_STRINGS sections: https://sourceware.org/bugzilla/show_bug.cgi?id=16794

From the original review:

  ... it reduced the size of a big ARM-32 debug image by 33%. It contained ~68M
  of relocations symbols out of total ~71M symbols (96% of symbols table was
  generated for relocations with symbol).

-Wl,-O2 (and -Wl,-O3) is so rare that we should just lower the
optimization level for LLVM_LINKER_IS_GOLD rather than pessimizing all users.

3 years ago[Bindings] Remove ipc_propagation.
Florian Hahn [Sun, 2 Aug 2020 21:36:53 +0000 (22:36 +0100)]
[Bindings] Remove ipc_propagation.

IPConstantPropagation has been removed, also remove the bindings.

3 years agoRecommit "[IPConstProp] Remove and move tests to SCCP."
Florian Hahn [Sun, 2 Aug 2020 21:04:44 +0000 (22:04 +0100)]
Recommit "[IPConstProp] Remove and move tests to SCCP."

This reverts commit 59d6e814ce0e7b40b7cc3ab136b9af2ffab9c6f8.

The cause for the revert (3 clang tests running opt -ipconstprop) was
fixed by removing those lines.

3 years ago[StackSafety, NFC] Don't insert empty objects into the map
Vitaly Buka [Sun, 2 Aug 2020 20:56:38 +0000 (13:56 -0700)]
[StackSafety, NFC] Don't insert empty objects into the map

Result should be the same but it makes generateParamAccessSummary 5x
faster.

3 years ago[Clang] Remove run-lines which use opt to run -ipconstprop.
Florian Hahn [Sun, 2 Aug 2020 20:45:42 +0000 (21:45 +0100)]
[Clang] Remove run-lines which use opt to run -ipconstprop.

ipconstprop is going to get removed and checking opt with specific
passes makes the tests more fragile.

The tests retain the important checks that !callback metadata is created
correctly.

3 years ago[lldb] [test] Fix DW_TAG_GNU_call_site-DW_AT_low_pc.s relocation
Jan Kratochvil [Sun, 2 Aug 2020 20:41:02 +0000 (22:41 +0200)]
[lldb] [test] Fix DW_TAG_GNU_call_site-DW_AT_low_pc.s relocation

I have made the DW_FORM_ref4 relative. One could also use relocated
DW_FORM_ref_addr instead.

Tested with:
        echo 'void f(){}'|clang -o 1.o -c -Wall -g -x c -;./bin/clang -o 1 1.o ../llvm-monorepo/lldb/test/Shell/SymbolFile/DWARF/DW_TAG_GNU_call_site-DW_AT_low_pc.s;./bin/lldb --no-lldbinit ./1 -o r -o 'p p' -o exit

3 years ago[X86] Use parity flag from byte test/cmp instruction for __builtin_parity when input...
Craig Topper [Sun, 2 Aug 2020 16:58:55 +0000 (09:58 -0700)]
[X86] Use parity flag from byte test/cmp instruction for __builtin_parity when input fits in 8 bits.

If the upper bits of the __builtin_parity idiom are known to be
0 we were previously emitting an xor with 0 to get the parity flag.
But we can use cmp/test instead which may expose opportunities for
load folding or combining an AND.

3 years ago[X86] Add test cases for missed opportunity to use a byte test instruction instead...
Craig Topper [Sun, 2 Aug 2020 07:20:11 +0000 (00:20 -0700)]
[X86] Add test cases for missed opportunity to use a byte test instruction instead of an xor with 0 in parity patterns.

If the input to the ctpop fits in 8 bits, we can use the parity
flag from a TEST instruction, but we're currently XORing with 0.

3 years ago[AMDGPU] Regenerate tests to fix whitespace indentations
Simon Pilgrim [Sun, 2 Aug 2020 17:11:01 +0000 (18:11 +0100)]
[AMDGPU] Regenerate tests to fix whitespace indentations

Noticed while updating D77804

3 years agoRemove debug flags from test (NFC)
Mehdi Amini [Sun, 2 Aug 2020 16:57:02 +0000 (16:57 +0000)]
Remove debug flags from test (NFC)

3 years ago[IR] Add IRBuilderBase::CreateVectorSplat(ElementCount EC) variant
Simon Pilgrim [Sun, 2 Aug 2020 15:55:16 +0000 (16:55 +0100)]
[IR] Add IRBuilderBase::CreateVectorSplat(ElementCount EC) variant

As discussed on D81500, this adds a more general ElementCount variant of the build helper and converts the (non-scalable) unsigned NumElts variant to use it internally.

3 years ago[InstSimplify] fold max (max X, Y), X --> max X, Y
Sanjay Patel [Sun, 2 Aug 2020 15:11:05 +0000 (11:11 -0400)]
[InstSimplify] fold max (max X, Y), X --> max X, Y

https://alive2.llvm.org/ce/z/VGgG3M

3 years ago[InstSimplify] add tests for max(max x,y), x) and variants; NFC
Sanjay Patel [Sun, 2 Aug 2020 14:53:51 +0000 (10:53 -0400)]
[InstSimplify] add tests for max(max x,y), x) and variants; NFC

3 years agoGlobalISel: Implement bitcast action for G_EXTRACT_VECTOR_ELEMENT
Matt Arsenault [Mon, 15 Jun 2020 15:54:49 +0000 (11:54 -0400)]
GlobalISel: Implement bitcast action for G_EXTRACT_VECTOR_ELEMENT

For AMDGPU, vectors with elements < 32 bits should be indexed in
32-bit elements and the desired bits extracted from there. For
elements > 64-bits, these should be reduce to 64/32 elements to enable
the normal dynamic indexing paths.

In the dynamic index cases, this produces shorter code most of the
time. This does immediately regress the constant index cases, but this
should be fixed once we have the most basic of shift combines.

The element size > 64 case is pretty much ported from the exisiting
DAG implementation for extract element promote. The increasing element
size case is new.

3 years agoX86InstrInfo.cpp - fix include ordering. NFCI.
Simon Pilgrim [Sun, 2 Aug 2020 14:21:52 +0000 (15:21 +0100)]
X86InstrInfo.cpp - fix include ordering. NFCI.

3 years agoUse merge null and isa<> tests into isa_and_nonnull<>. NFCI.
Simon Pilgrim [Sun, 2 Aug 2020 14:16:00 +0000 (15:16 +0100)]
Use merge null and isa<> tests into isa_and_nonnull<>. NFCI.

3 years ago[DAG] TargetLowering::expandMUL_LOHI - pass SDLoc as const&
Simon Pilgrim [Sun, 2 Aug 2020 14:31:36 +0000 (15:31 +0100)]
[DAG] TargetLowering::expandMUL_LOHI - pass SDLoc as const&

Try to be more consistent with the SDLoc param in the TargetLowering methods.

This also exposes an issue where we were passing a SDNode as a SDLoc, relying on the implicit SDLoc(SDNode) constructor.

3 years ago[DAG] TargetLowering::LowerAsmOutputForConstraint - pass SDLoc as const&
Simon Pilgrim [Sun, 2 Aug 2020 14:03:04 +0000 (15:03 +0100)]
[DAG] TargetLowering::LowerAsmOutputForConstraint - pass SDLoc as const&

Try to be more consistent with the SDLoc param in the TargetLowering methods.

3 years agoRemove unused param tag to fix Wdocumentation warning. NFC.
Simon Pilgrim [Sun, 2 Aug 2020 13:57:39 +0000 (14:57 +0100)]
Remove unused param tag to fix Wdocumentation warning. NFC.

3 years agoRevert "[Attributor] AAPotentialValues Interface"
Shinji Okumura [Sun, 2 Aug 2020 13:48:28 +0000 (22:48 +0900)]
Revert "[Attributor] AAPotentialValues Interface"

The commit cause build failure.

3 years ago[InstSimplify] Reduce code duplication in icmp of binop folds (NFC)
Nikita Popov [Sun, 2 Aug 2020 13:45:24 +0000 (15:45 +0200)]
[InstSimplify] Reduce code duplication in icmp of binop folds (NFC)

For folds where we check for the binop on both the LHS and RHS,
extract a function that expects it on the LHS and call it with
swapped order.

3 years ago[DWARFYAML][debug_aranges] Make the 'Descriptors' field optional.
Xing GUO [Sun, 2 Aug 2020 13:37:11 +0000 (21:37 +0800)]
[DWARFYAML][debug_aranges] Make the 'Descriptors' field optional.

3 years ago[X86] Use const APInt& in for-range loop to avoid unnecessary copies. NFCI.
Simon Pilgrim [Sun, 2 Aug 2020 13:32:05 +0000 (14:32 +0100)]
[X86] Use const APInt& in for-range loop to avoid unnecessary copies. NFCI.

Fixes clang-tidy warning.

3 years ago[X86] Pass SDLoc by const reference. NFCI.
Simon Pilgrim [Sun, 2 Aug 2020 13:23:00 +0000 (14:23 +0100)]
[X86] Pass SDLoc by const reference. NFCI.

3 years ago[X86] Use const APInt& in for-range loop to avoid unnecessary copies. NFCI.
Simon Pilgrim [Sun, 2 Aug 2020 13:15:15 +0000 (14:15 +0100)]
[X86] Use const APInt& in for-range loop to avoid unnecessary copies. NFCI.

Fixes clang-tidy warning.

3 years ago[X86] combineX86ShuffleChain - pull out repeated RootVT.getSizeInBits() calls. NFCI.
Simon Pilgrim [Sun, 2 Aug 2020 13:13:13 +0000 (14:13 +0100)]
[X86] combineX86ShuffleChain - pull out repeated RootVT.getSizeInBits() calls. NFCI.

3 years ago[Attributor] AAPotentialValues Interface
Shinji Okumura [Sun, 2 Aug 2020 09:37:07 +0000 (18:37 +0900)]
[Attributor] AAPotentialValues Interface

This is a split patch of D80991.
This patch introduces AAPotentialValues and its interface only.
For more detail of AAPotentialValues abstract attribute, see the original patch.

Reviewed By: jdoerfert

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

3 years ago[SCEV] Precommit tests with signed counting down loop.
Florian Hahn [Fri, 31 Jul 2020 21:10:39 +0000 (22:10 +0100)]
[SCEV] Precommit tests with signed counting down loop.

From PR46939.

3 years ago[CMake] Pass bugreport URL to standalone clang build
Michał Górny [Thu, 30 Jul 2020 22:11:40 +0000 (00:11 +0200)]
[CMake] Pass bugreport URL to standalone clang build

BUG_REPORT_URL is currently used both in LLVM and in Clang but declared
only in the latter.  This means that it's missing in standalone clang
builds and the driver ends up outputting:

  PLEASE submit a bug report to  and include [...]

(note the missing URL)

To fix this, include LLVM_PACKAGE_BUGREPORT in LLVMConfig.cmake
(similarly to how we pass PACKAGE_VERSION) and use it to fill
BUG_REPORT_URL when building clang standalone.

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

3 years ago[X86] Improve parity idiom recognition to handle (and (truncate (ctpop X)), 1).
Craig Topper [Sun, 2 Aug 2020 05:05:10 +0000 (22:05 -0700)]
[X86] Improve parity idiom recognition to handle (and (truncate (ctpop X)), 1).

Fixes part of PR46954

3 years ago[X86] Add parity test cases for PR46954.
Craig Topper [Sun, 2 Aug 2020 04:57:24 +0000 (21:57 -0700)]
[X86] Add parity test cases for PR46954.

This adds tests cases where the parity idiom of (and (ctpop X, 1))
has a truncate in the middle.

3 years ago[HotColdSplit] Add test case for unlikely attribute in outlined function
AK [Sun, 2 Aug 2020 05:34:44 +0000 (22:34 -0700)]
[HotColdSplit] Add test case for unlikely attribute in outlined function

Authored by: rjf (Ruijie Fang)
Reviewed by: hiraditya,tejohnson,fhahn

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

3 years agoOutline non returning functions unless a longjmp
AK [Sun, 2 Aug 2020 02:15:05 +0000 (19:15 -0700)]
Outline non returning functions unless a longjmp

__assert_fail, abort, exit etc. are cold.
TODO: outline throw

Authored by: rjf (Ruijie Fang)
Reviewed by: hiraditya,tejohnson,fhahn

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

3 years agoUse llvm::is_contained where appropriate (NFC)
Kazu Hirata [Sun, 2 Aug 2020 04:49:38 +0000 (21:49 -0700)]
Use llvm::is_contained where appropriate (NFC)

Use llvm::is_contained where appropriate (NFC)

Reviewed By: kazu

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

3 years ago[llvm-jitlink] Add -phony-externals option to suppress unresolved externals.
Lang Hames [Sun, 2 Aug 2020 00:44:34 +0000 (17:44 -0700)]
[llvm-jitlink] Add -phony-externals option to suppress unresolved externals.

The -phony-externals option adds a generator which explicitly defines any
otherwise unresolved externals as null. This transforms link-time
unresolved-symbol errors into potential runtime null pointer accesses
(if an unresolved external is actually accessed during execution).

This option can be useful in -harness mode to avoid having to mock a
large number of symbols that are not reachable at runtime (e.g. unused
methods referenced by a class vtable).

3 years ago[llvm-jitlink] Support promotion of ODR weak symbols in -harness mode.
Lang Hames [Sat, 1 Aug 2020 04:32:27 +0000 (21:32 -0700)]
[llvm-jitlink] Support promotion of ODR weak symbols in -harness mode.

This prevents weak symbols from being immediately dead-stripped when not
directly referenced from the test harneess, enabling use of weak symbols
from the code under test.

3 years ago[ELF] --wrap: set isUsedInRegularObj of __wrap_ only if it is defined
Fangrui Song [Sun, 2 Aug 2020 01:19:14 +0000 (18:19 -0700)]
[ELF] --wrap: set isUsedInRegularObj of __wrap_ only if it is defined

Fixes PR46169

3 years ago[msan] Respect no_huge_pages_for_shadow.
Evgenii Stepanov [Sat, 1 Aug 2020 00:18:06 +0000 (17:18 -0700)]
[msan] Respect no_huge_pages_for_shadow.

Disable huge pages in the MSan shadow region when
no_huge_pages_for_shadow == true (default).

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

3 years agoUpdated the -I option description.
Andrei Lebedev [Sat, 1 Aug 2020 22:54:11 +0000 (15:54 -0700)]
Updated the -I option description.

3 years ago[NewPM][LVI] Abandon LVI after CVP
Nikita Popov [Thu, 30 Jul 2020 17:14:02 +0000 (19:14 +0200)]
[NewPM][LVI] Abandon LVI after CVP

As mentioned on D70376, LVI can currently cause performance issues
when running under NewPM. The problem is that, unlike the legacy
pass manager, NewPM will not immediately discard the LVI analysis
if the following pass does not need it. This is a problem, because
LVI has a high memory requirement, and mass invalidation of LVI
values is very inefficient. LVI should only be alive during passes
that actively interact with it.

This patch addresses the issue by explicitly abandoning LVI after CVP,
which gets us back to the LegacyPM behavior.

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

3 years ago[X86] Add assembler support for {disp8} and {disp32} to control the size of displacem...
Craig Topper [Sat, 1 Aug 2020 20:25:18 +0000 (13:25 -0700)]
[X86] Add assembler support for {disp8} and {disp32} to control the size of displacement used for memory operands.

These prefixes should override the default behavior and force a larger immediate size. I don't believe gas issues any warning if you use {disp8} when a 32-bit displacement is already required. And this patch doesn't either.

This completes the {disp8} and {disp32} support from PR46650.

Reviewed By: RKSimon

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

3 years ago[InstSimplify] Fold abs(abs(x)) -> abs(x)
Craig Topper [Sat, 1 Aug 2020 17:01:58 +0000 (10:01 -0700)]
[InstSimplify] Fold abs(abs(x)) -> abs(x)

It's always safe to pick the earlier abs regardless of the nsw flag. We'll just lose it if it is on the outer abs but not the inner abs.

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

3 years ago[InstCombine] Fold abs(-x) -> abs(x)
Craig Topper [Sat, 1 Aug 2020 16:59:09 +0000 (09:59 -0700)]
[InstCombine] Fold abs(-x) -> abs(x)

Negating the input doesn't matter. I left a FIXME to copy the nsw flag if its present on the neg but not on the abs.

Reviewed By: nikic

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