platform/upstream/llvm.git
3 years ago[KnownBits] Implement accurate unsigned and signed max and min
Jay Foad [Wed, 2 Sep 2020 15:01:48 +0000 (16:01 +0100)]
[KnownBits] Implement accurate unsigned and signed max and min

Use the new implementation in ValueTracking, SelectionDAG and
GlobalISel.

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

3 years ago[cmake] Fix build of attribute plugin example on Windows
Kristina Bessonova [Mon, 7 Sep 2020 08:03:32 +0000 (10:03 +0200)]
[cmake] Fix build of attribute plugin example on Windows

Seems '${cmake_2_8_12_PRIVATE}' was removed a long time ago, so it should
be just PRIVATE keyword here.

Reviewed By: john.brawn

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

3 years ago[CMake][TableGen] Remove dead CMake version checks
Raul Tambre [Sat, 5 Sep 2020 15:05:14 +0000 (18:05 +0300)]
[CMake][TableGen] Remove dead CMake version checks

LLVM requires CMake 3.13.4, so remove version checks that are dead code.

Reviewed By: phosek

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

3 years ago[CMake][OpenMP] Remove old dead CMake code
Raul Tambre [Sat, 5 Sep 2020 15:11:34 +0000 (18:11 +0300)]
[CMake][OpenMP] Remove old dead CMake code

LLVM requires CMake 3.13.4 so remove code behind checks for an older version.

Reviewed By: phosek

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

3 years ago[CMake][Polly] Remove dead CMake code
Raul Tambre [Sat, 5 Sep 2020 15:15:32 +0000 (18:15 +0300)]
[CMake][Polly] Remove dead CMake code

LLVM requires CMake 3.13.4 so remove code behind checks for an older version.

Reviewed By: phosek

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

3 years ago[CMake][TableGen] Simplify code by using list(TRANSFORM)
Raul Tambre [Sat, 5 Sep 2020 15:21:05 +0000 (18:21 +0300)]
[CMake][TableGen] Simplify code by using list(TRANSFORM)

LLVM requires CMake 3.13.4 so now we can simplify the code.

Reviewed By: phosek

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

3 years ago[scan-view] Explicitly use utf-8 in send_string
Tomas Rix [Mon, 7 Sep 2020 07:10:15 +0000 (09:10 +0200)]
[scan-view] Explicitly use utf-8 in send_string

send_patched_file decodes with utf-8.
The default encoder for python 2 is ascii.

So it is necessary to also change send_string to use utf-8.

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

3 years ago[Sparc] Select the UltraSPARC instruction set with the external assembler
Brad Smith [Mon, 7 Sep 2020 06:27:11 +0000 (02:27 -0400)]
[Sparc] Select the UltraSPARC instruction set with the external assembler

Select the UltraSPARC instruction set with the external assembler on
Linux / FreeBSD / OpenBSD, matches GCC.

3 years agoExtend PyConcreteType to support intermediate base classes.
Stella Laurenzo [Sun, 6 Sep 2020 19:16:40 +0000 (12:16 -0700)]
Extend PyConcreteType to support intermediate base classes.

* Resolves todos from D87091.
* Also modifies PyConcreteAttribute to follow suite (should be useful for ElementsAttr and friends).
* Adds a test to ensure that the ShapedType base class functions as expected.

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

3 years agoMove NativeRegisterContextLinux/RegisterContextPOSIX*_arm to RegisterInfoAndSetInterface
Muhammad Omair Javaid [Mon, 7 Sep 2020 03:38:43 +0000 (08:38 +0500)]
Move NativeRegisterContextLinux/RegisterContextPOSIX*_arm to RegisterInfoAndSetInterface

This patch removes register set definitions and other redundant code from
NativeRegisterContextLinux/RegisterContextPOSIX*_arm. Register sets are now
moved under RegisterInfosPOSIX_arm which now uses RegisterInfoAndSetInterface.
This is similar to what we earlier did for AArch64.

Reviewed By: labath

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

3 years agoWhen dumping results of StackLifetime, it will print the following
dongAxis [Mon, 7 Sep 2020 03:43:16 +0000 (11:43 +0800)]
When dumping results of StackLifetime, it will print the following
log:

BB  [7, 8): begin {}, end {}, livein {}, liveout {}
BB  [1, 2): begin {}, end {}, livein {}, liveout {}
...

But it is not convenient to know what the basic block is.
So I add the basic block name to it.

Reviewed By: vitalybuka
TestPlan: check-llvm
Differential Revision: https://reviews.llvm.org/D87152

3 years agoMove targetHasSVE function to lldbtest.py
Muhammad Omair Javaid [Mon, 7 Sep 2020 03:35:56 +0000 (08:35 +0500)]
Move targetHasSVE function to lldbtest.py

targetHasSVE helper function was added to test for availability of SVE support
by connected platform. We now intend to use this function in other testcases
and I am moving it to a generic location in lldbtest.py to allow usage by
other upcoming testcases.

Reviewed By: labath

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

3 years ago[ELF] Add a new e_machine value EM_CSKY and add some CSKY relocation types
Zi Xuan Wu [Wed, 2 Sep 2020 09:02:17 +0000 (17:02 +0800)]
[ELF] Add a new e_machine value EM_CSKY and add some CSKY relocation types

This is the split part of D86269, which add a new ELF machine flag called EM_CSKY and related relocations.
Some target-specific flags and tests for csky can be added in follow-up patches later.

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

3 years ago[machinesink] add testcase for more sinking - NFC
Chen Zheng [Mon, 7 Sep 2020 01:14:14 +0000 (21:14 -0400)]
[machinesink] add testcase for more sinking - NFC

3 years ago[WebAssembly] Fix incorrect assumption of simple value types
Thomas Lively [Sun, 6 Sep 2020 22:42:21 +0000 (15:42 -0700)]
[WebAssembly] Fix incorrect assumption of simple value types

Fixes PR47375, in which an assertion was triggering because
WebAssemblyTargetLowering::isVectorLoadExtDesirable was improperly
assuming the use of simple value types.

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

3 years ago[PowerPC] Implement Vector Expand Mask builtins in LLVM/Clang
Amy Kwan [Thu, 3 Sep 2020 17:33:53 +0000 (12:33 -0500)]
[PowerPC] Implement Vector Expand Mask builtins in LLVM/Clang

This patch implements the vec_expandm function prototypes in altivec.h in order
to utilize the vector expand with mask instructions introduced in Power10.

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

3 years ago[asan_symbolize] Pass --demangle/--no-demangle instead of --demangle={True,False}
Fangrui Song [Sun, 6 Sep 2020 21:44:36 +0000 (14:44 -0700)]
[asan_symbolize] Pass --demangle/--no-demangle instead of --demangle={True,False}

`--demangle={True,False}` were accepted but disallowed after llvm-symbolizer's switch to OptTable.
(`--demangle={true,false}` were temporarily supported but they are case sensitive.)

3 years ago[ValueTracking] Avoid known bits fallback for non-zero get check (NFCI)
Nikita Popov [Sun, 6 Sep 2020 21:14:05 +0000 (23:14 +0200)]
[ValueTracking] Avoid known bits fallback for non-zero get check (NFCI)

The known bits fall back will never be able to infer a non-null
value here, so don't bother.

3 years ago[compiler-rt] Implement __clear_cache() on OpenBSD/arm
Brad Smith [Sun, 6 Sep 2020 19:54:24 +0000 (15:54 -0400)]
[compiler-rt] Implement __clear_cache() on OpenBSD/arm

3 years ago[DSE,MemorySSA] Add a few additional debug messages.
Florian Hahn [Sun, 6 Sep 2020 19:14:58 +0000 (20:14 +0100)]
[DSE,MemorySSA] Add a few additional debug messages.

3 years ago[mlir] Add Shaped Type, Tensor Type and MemRef Type to python bindings.
zhanghb97 [Sun, 6 Sep 2020 18:37:16 +0000 (11:37 -0700)]
[mlir] Add Shaped Type, Tensor Type and MemRef Type to python bindings.

Based on the PyType and PyConcreteType classes, this patch implements the bindings of Shaped Type, Tensor Type and MemRef Type subclasses.
The Tensor Type and MemRef Type are bound as ranked and unranked separately.
This patch adds the ***GetChecked C API to make sure the python side can get a valid type or a nullptr.
Shaped type is not a kind of standard types, it is the base class for vectors, memrefs and tensors, this patch binds the PyShapedType class as the base class of Vector Type, Tensor Type and MemRef Type subclasses.

Reviewed By: stellaraccident

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

3 years agoThread safety analysis: Improve documentation for scoped capabilities
Aaron Puchert [Sun, 6 Sep 2020 18:35:02 +0000 (20:35 +0200)]
Thread safety analysis: Improve documentation for scoped capabilities

They are for more powerful than the current documentation implies, this
adds

* adopting a lock,
* deferring a lock,
* manually unlocking the scoped capability,
* relocking the scoped capability, possibly in a different mode,
* try-relocking the scoped capability.

Also there is now a generic explanation how attributes on scoped
capabilities work. There has been confusion in the past about how to
annotate them (see e.g. PR33504), hopefully this clears things up.

Reviewed By: aaron.ballman

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

3 years agoThread safety analysis: Test and document release_generic_capability
Aaron Puchert [Sun, 6 Sep 2020 18:34:32 +0000 (20:34 +0200)]
Thread safety analysis: Test and document release_generic_capability

The old locking attributes had a generic release, but as it turns out
the capability-based attributes have it as well.

Reviewed By: aaron.ballman

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

3 years ago[SmallVector] Move error handling out of line
Benjamin Kramer [Sun, 6 Sep 2020 16:05:24 +0000 (18:05 +0200)]
[SmallVector] Move error handling out of line

This reduces duplication and avoids emitting ice cold code into every
instance of grow().

3 years ago[X86][AVX] lowerShuffleWithPERMV - adjust binary shuffle masks to account for widenin...
Simon Pilgrim [Sun, 6 Sep 2020 13:52:06 +0000 (14:52 +0100)]
[X86][AVX] lowerShuffleWithPERMV - adjust binary shuffle masks to account for widening on non-VLX targets

rGabd33bf5eff2 enabled us to pad 128/256-bit shuffles to 512-bit on non-VLX targets, but wasn't updating binary shuffles to account for the new vector width.

3 years ago[ARM] Remove -O3 from mve intrinsic tests. NFC
David Green [Sun, 6 Sep 2020 12:19:55 +0000 (13:19 +0100)]
[ARM] Remove -O3 from mve intrinsic tests. NFC

3 years ago[ARM] Regenerate tests. NFC
David Green [Sun, 6 Sep 2020 11:51:43 +0000 (12:51 +0100)]
[ARM] Regenerate tests. NFC

3 years agoAdd proper move ctor/move assign to APValue. NFCI.
Benjamin Kramer [Sun, 6 Sep 2020 11:02:11 +0000 (13:02 +0200)]
Add proper move ctor/move assign to APValue. NFCI.

Swapping 64 bytes to make a move isn't cheap.

3 years ago[InstSimplify] Fold degenerate abs of abs form
Nikita Popov [Sat, 5 Sep 2020 19:30:55 +0000 (21:30 +0200)]
[InstSimplify] Fold degenerate abs of abs form

This addresses the remaining issue from D87188. Due to a series of
folds, we may end up with abs-of-abs represented as
x == 0 ? -abs(x) : abs(x). Rather than recognizing this as a special
abs pattern and doing an abs-of-abs fold on it afterwards,
I'm directly folding this to one of the select operands in InstSimplify.

The general pattern falls into the "select with operand replaced"
category, but that fold is not powerful enough to recognize that
both hands of the select are the same for value zero.

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

3 years ago[Asan] Cleanup atomic usage in allocator
Vitaly Buka [Sun, 6 Sep 2020 07:07:14 +0000 (00:07 -0700)]
[Asan] Cleanup atomic usage in allocator

There are no know bugs related to this, still it may fix some latent ones.
Main concerns with preexisting code:
1. Inconsistent atomic/non-atomic access to the same field.
2. Assumption that bitfield chunk_state is always the first byte without
    even taking into account endianness.

Reviewed By: morehouse

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

3 years agoRevert "[Asan] Cleanup atomic usage in allocator"
Vitaly Buka [Sun, 6 Sep 2020 06:41:25 +0000 (23:41 -0700)]
Revert "[Asan] Cleanup atomic usage in allocator"

Crashes on PPC

This reverts commit eb87e1dbcfdf15c0711146ff3e6b2e1e40c8863a.

3 years ago[GlobalISel] Disable the indexed loads combine completely unless forced. NFC.
Amara Emerson [Sun, 6 Sep 2020 04:00:15 +0000 (21:00 -0700)]
[GlobalISel] Disable the indexed loads combine completely unless forced. NFC.

The post-index matcher, before it queries the target legality, walks uses
of some instructions which in pathological cases can be massive. Since
no targets actually support indexed loads yet, disable this to stop wasting
compile time on something which is going to fail anyway.

3 years ago[Asan] Cleanup atomic usage in allocator
Vitaly Buka [Sun, 6 Sep 2020 02:06:27 +0000 (19:06 -0700)]
[Asan] Cleanup atomic usage in allocator

There are no know bugs related to this, still it may fix some latent ones.
Main concerns with preexisting code:
1. Inconsistent atomic/non-atomic access to the same field.
2. Assumption that bitfield chunk_state is always the first byte without
    even taking into account endianness.

Reviewed By: morehouse

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

3 years ago[NFC][Asan] Fix clang-tidy warning
Vitaly Buka [Sun, 6 Sep 2020 02:09:41 +0000 (19:09 -0700)]
[NFC][Asan] Fix clang-tidy warning

3 years ago[NFC][Asan] Move free_tid from ChunkHeader
Vitaly Buka [Sat, 5 Sep 2020 23:52:48 +0000 (16:52 -0700)]
[NFC][Asan] Move free_tid from ChunkHeader

The goal to make chunk_state atomic, but we can't pack it with
free_tid on Windows.

3 years ago[AMDGPU] Remove the dead spill slots while spilling FP/BP to memory
vnalamot [Sun, 6 Sep 2020 01:30:36 +0000 (07:00 +0530)]
[AMDGPU] Remove the dead spill slots while spilling FP/BP to memory

During the PEI pass, the dead TargetStackID::SGPRSpill spill slots
are not being removed while spilling the FP/BP to memory.

Fixes: SWDEV-250393

Reviewed By: arsenm

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

3 years ago[Hexagon] Add assertions about V6_pred_scalar2
Krzysztof Parzyszek [Sat, 5 Sep 2020 23:15:38 +0000 (18:15 -0500)]
[Hexagon] Add assertions about V6_pred_scalar2

3 years ago[Hexagon] When widening truncate result, also widen operand if necessary
Krzysztof Parzyszek [Sat, 5 Sep 2020 21:29:36 +0000 (16:29 -0500)]
[Hexagon] When widening truncate result, also widen operand if necessary

3 years ago[Hexagon] Resize the mem operand when widening loads and stores
Krzysztof Parzyszek [Sat, 5 Sep 2020 21:11:07 +0000 (16:11 -0500)]
[Hexagon] Resize the mem operand when widening loads and stores

3 years ago[NFC][Asan] Reformat some allocator code
Vitaly Buka [Fri, 4 Sep 2020 08:17:18 +0000 (01:17 -0700)]
[NFC][Asan] Reformat some allocator code

3 years ago[NFC][Asan] Inline enum doc strings
Vitaly Buka [Fri, 4 Sep 2020 07:17:34 +0000 (00:17 -0700)]
[NFC][Asan] Inline enum doc strings

3 years ago[NFC][Asan] Rename internal enum value.
Vitaly Buka [Fri, 4 Sep 2020 01:54:52 +0000 (18:54 -0700)]
[NFC][Asan] Rename internal enum value.

New name better represents the state of chunk.

3 years ago[NFC][compiler-rt] Refine .clang-tidy checks
Vitaly Buka [Sat, 5 Sep 2020 06:30:16 +0000 (23:30 -0700)]
[NFC][compiler-rt] Refine .clang-tidy checks

Reviewed By: MaskRay

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

3 years ago[Hexagon] Handle widening of vector truncate
Krzysztof Parzyszek [Sat, 5 Sep 2020 00:33:14 +0000 (19:33 -0500)]
[Hexagon] Handle widening of vector truncate

3 years ago[InstSimplify] Add tests for a peculiar abs of abs form (NFC)
Nikita Popov [Sat, 5 Sep 2020 19:40:53 +0000 (21:40 +0200)]
[InstSimplify] Add tests for a peculiar abs of abs form (NFC)

This pattern shows up when canonicalizing to spf abs form to
intrinsic abs form.

3 years ago[LangRef] Adjust guarantee for llvm.memcpy to also allow equal arguments.
Florian Hahn [Fri, 4 Sep 2020 19:43:28 +0000 (20:43 +0100)]
[LangRef] Adjust guarantee for llvm.memcpy to also allow equal arguments.

This adjusts the description of `llvm.memcpy` to also allow operands
to be equal. This is in line with what Clang currently expects.

This change is intended to be temporary and followed by re-introduce
a variant with the non-overlapping guarantee for cases where we can
actually ensure that property in the front-end.

See the links below for more details:
http://lists.llvm.org/pipermail/cfe-dev/2020-August/066614.html
and PR11763.

Reviewed By: nikic

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

3 years agoscan-build-py: fix multiprocessing error
Lawrence D'Anna [Sat, 5 Sep 2020 18:09:21 +0000 (11:09 -0700)]
scan-build-py: fix multiprocessing error

Recent versions of python3's multiprocessing module will blow up with
a Runtime error from this code, saying:

  An attempt has been made to start a new process before the
  current process has finished its bootstrapping phase

This is becuae the wrappers in bin/ are not using the  `__name__ == "__main__"`   idiom correctly.

Reviewed By: ldionne

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

3 years ago[ELF] Handle SHT_RISCV_ATTRIBUTES similarly to SHT_ARM_ATTRIBUTES
Jessica Clarke [Thu, 20 Aug 2020 17:10:18 +0000 (18:10 +0100)]
[ELF] Handle SHT_RISCV_ATTRIBUTES similarly to SHT_ARM_ATTRIBUTES

Currently we treat SHT_RISCV_ATTRIBUTES like a normal section and
concatenate all such input sections, yielding invalid output unless only
a single attributes section is present in the input. Instead, pick the
first as with SHT_ARM_ATTRIBUTES. We do not currently need to condition
our behaviour on the contents, unlike Arm. In future, we should both do
stricter validation of the input and merge all sections together to
ensure we have, for example, the full arch string requirement, but this
rudimentary implementation is good enough for most common cases.

Reviewed By: MaskRay

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

3 years agoAttempt to fix Sphinx build failure, NFC
Aaron Puchert [Sat, 5 Sep 2020 16:25:27 +0000 (18:25 +0200)]
Attempt to fix Sphinx build failure, NFC

A code block wasn't properly introduced.

3 years agoRestore size of TemplateParameterList after D44352
Aaron Puchert [Sat, 5 Sep 2020 15:52:57 +0000 (17:52 +0200)]
Restore size of TemplateParameterList after D44352

After adding a field of one bit, the bitfield members would take
30+1+1+1 = 33 bits, causing the size of TemplateParameterList to
increase from 16 to 24 bytes on 64-bit systems.

With 29 bits for NumParams we can encode up to half a billion template
parameters, which is almost certainly still enough for anybody.

3 years ago[InstCombine] Add tests for known negative abs intrinsic (NFC)
Nikita Popov [Sat, 5 Sep 2020 15:14:13 +0000 (17:14 +0200)]
[InstCombine] Add tests for known negative abs intrinsic (NFC)

And duplicate tests for known non-negative from InstSimplify.

3 years agoThread safety analysis: ValueDecl in Project is non-null
Aaron Puchert [Sat, 25 Jul 2020 23:53:32 +0000 (01:53 +0200)]
Thread safety analysis: ValueDecl in Project is non-null

The constructor asserts that, use it in the ThreadSafetyAnalyzer.
Also note that the result of a cast<> cannot be null.

3 years agoThread safety analysis: Consider global variables in scope
Aaron Puchert [Sat, 5 Sep 2020 13:44:20 +0000 (15:44 +0200)]
Thread safety analysis: Consider global variables in scope

Instead of just mutex members we also consider mutex globals.
Unsurprisingly they are always in scope. Now the paper [1] says that

> The scope of a class member is assumed to be its enclosing class,
> while the scope of a global variable is the translation unit in
> which it is defined.

But I don't think we should limit this to TUs where a definition is
available - a declaration is enough to acquire the mutex, and if a mutex
is really limited in scope to a translation unit, it should probably be
only declared there.

[1] https://static.googleusercontent.com/media/research.google.com/en/us/pubs/archive/42958.pdf

Fixes PR46354.

Reviewed By: aaron.ballman

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

3 years ago[SCEV] Recognize min/max intrinsics
Nikita Popov [Fri, 4 Sep 2020 20:06:52 +0000 (22:06 +0200)]
[SCEV] Recognize min/max intrinsics

Recognize umin/umax/smin/smax intrinsics and convert them to the
already existing SCEV nodes of the same name.

In the future we'll want SCEVExpander to also produce the intrinsics,
but we're not ready for that yet.

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

3 years ago[InstCombine] Fold abs with dominating condition
Nikita Popov [Sat, 5 Sep 2020 09:09:06 +0000 (11:09 +0200)]
[InstCombine] Fold abs with dominating condition

Similar to D87168, but for abs. If we have a dominating x >= 0
condition, then we know that abs(x) is x. This fold is in
InstCombine, because we need to create a sub instruction for
the x < 0 case.

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

3 years ago[InstSimplify] Fold min/max based on dominating condition
Nikita Popov [Fri, 4 Sep 2020 21:44:58 +0000 (23:44 +0200)]
[InstSimplify] Fold min/max based on dominating condition

If we have a dominating condition that x >= y, then umax(x, y) is x,
etc. I'm doing this in InstSimplify as the corresponding transform
for the select form is also done there.

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

3 years ago[InstCombine] Fold abs intrinsic eq zero
Nikita Popov [Sat, 5 Sep 2020 13:10:09 +0000 (15:10 +0200)]
[InstCombine] Fold abs intrinsic eq zero

Following the same transform for the select version of abs.

3 years ago[InstCombine] Add tests for abs intrinsic eq zero (NFC)
Nikita Popov [Sat, 5 Sep 2020 13:05:59 +0000 (15:05 +0200)]
[InstCombine] Add tests for abs intrinsic eq zero (NFC)

3 years ago[MLIR] Remove unused arg from affine tiling validity check
Uday Bondhugula [Fri, 4 Sep 2020 11:38:17 +0000 (17:08 +0530)]
[MLIR] Remove unused arg from affine tiling validity check

Drop unused function arg from affine loop tiling validity check.

3 years agoSet InvalidDecl directly when deserializing a Decl
Aaron Puchert [Sat, 5 Sep 2020 12:23:54 +0000 (14:23 +0200)]
Set InvalidDecl directly when deserializing a Decl

When parsing a C++17 binding declaration, we first create the
BindingDecls in Sema::ActOnDecompositionDeclarator, and then build the
DecompositionDecl in Sema::ActOnVariableDeclarator, so the contained
BindingDecls are never null. But when deserializing, we read the
DecompositionDecl with all properties before filling in the Bindings.
Among other things, reading a declaration reads whether it's invalid,
then calling setInvalidDecl which assumes that all bindings of the
DecompositionDecl are available, but that isn't the case.

Deserialization should just set all properties directly without invoking
subsequent functions, so we just set the flag without using the setter.

Fixes PR34960.

Reviewed By: rsmith

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

3 years agoThread safety analysis: Document how try-acquire is handled
Aaron Puchert [Sat, 5 Sep 2020 12:21:42 +0000 (14:21 +0200)]
Thread safety analysis: Document how try-acquire is handled

I don't think this is obvious, since try-acquire seemingly contradicts
our usual requirements of "no conditional locking".

Reviewed By: aaron.ballman

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

3 years ago[InstCombine] Fold mul of abs intrinsic
Nikita Popov [Sat, 5 Sep 2020 10:37:45 +0000 (12:37 +0200)]
[InstCombine] Fold mul of abs intrinsic

Same as the existing SPF_ABS fold. We don't need to explicitly
handle NABS, as the negs will get folded away first.

3 years ago[InstCombine] Add tests for mul of abs intrinsic (NFC)
Nikita Popov [Sat, 5 Sep 2020 10:36:27 +0000 (12:36 +0200)]
[InstCombine] Add tests for mul of abs intrinsic (NFC)

3 years ago[InstCombine] Fold cttz of abs intrinsic
Nikita Popov [Sat, 5 Sep 2020 10:25:41 +0000 (12:25 +0200)]
[InstCombine] Fold cttz of abs intrinsic

Same as the existing fold for SPF_ABS. We don't need to explicitly
handle the NABS variant, as we'll first fold away the neg in that
case.

3 years ago[InstCombine] Add tests for cttz of abs intrinsic (NFC)
Nikita Popov [Sat, 5 Sep 2020 10:22:42 +0000 (12:22 +0200)]
[InstCombine] Add tests for cttz of abs intrinsic (NFC)

3 years ago[InstCombine] Test abs with dominating condition (NFC)
Nikita Popov [Sat, 5 Sep 2020 08:56:19 +0000 (10:56 +0200)]
[InstCombine] Test abs with dominating condition (NFC)

3 years ago[SelectionDAG] Always intersect SDNode flags during getNode() node memoization.
Jonas Paulsson [Mon, 31 Aug 2020 11:26:36 +0000 (13:26 +0200)]
[SelectionDAG] Always intersect SDNode flags during getNode() node memoization.

Previously SDNodeFlags::instersectWith(Flags) would do nothing if Flags was
in an undefined state, which is very bad given that this is the default when
getNode() is called without passing an explicit SDNodeFlags argument.

This meant that if an already existing and reused node had a flag which the
second caller to getNode() did not set, that flag would remain uncleared.

This was exposed by https://bugs.llvm.org/show_bug.cgi?id=47092, where an NSW
flag was incorrectly set on an add instruction (which did in fact overflow in
one of the two original contexts), so when SystemZElimCompare removed the
compare with 0 trusting that flag, wrong-code resulted.

There is more that needs to be done in this area as discussed here:

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

Review: Ulrich Weigand, Sanjay Patel

3 years ago[SCCP] Add tests for intrinsic ranges (NFC)
Nikita Popov [Sat, 5 Sep 2020 08:27:55 +0000 (10:27 +0200)]
[SCCP] Add tests for intrinsic ranges (NFC)

3 years agoFix return status of SimplifyCFG
serge-sans-paille [Fri, 4 Sep 2020 13:36:48 +0000 (15:36 +0200)]
Fix return status of SimplifyCFG

When a switch case is folded into default's case, that's an IR change that
should be reported, update ConstantFoldTerminator accordingly.

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

3 years ago[PowerPC] Expand constrained ppc_fp128 to i32 conversion
Qiu Chaofan [Sat, 5 Sep 2020 05:16:20 +0000 (13:16 +0800)]
[PowerPC] Expand constrained ppc_fp128 to i32 conversion

Libcall __gcc_qtou is not available, which breaks some tests needing
it. On PowerPC, we have code to manually expand the operation, this
patch applies it to constrained conversion. To keep it strict-safe,
it's using the algorithm similar to expandFP_TO_UINT.

For constrained operations marking FP exception behavior as 'ignore',
we should set the NoFPExcept flag. However, in some custom lowering
the flag is missed. This should be fixed by future patches.

Reviewed By: uweigand

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

3 years ago[PowerPC] Provide vec_cmpne on pre-Power9 architectures in altivec.h
Nemanja Ivanovic [Sat, 5 Sep 2020 01:44:37 +0000 (21:44 -0400)]
[PowerPC] Provide vec_cmpne on pre-Power9 architectures in altivec.h

These overloads are listed in appendix A of the ELFv2 ABI specification
without a requirement for ISA 3.0. So these need to be available on
all Altivec-capable architectures. The implementation in altivec.h
erroneously had them guarded for Power9 due to the availability of
the VCMPNE[BHW] instructions. However these need to be implemented
in terms of the VCMPEQ[BHW] instructions on older architectures.

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

3 years ago[compiler-rt] Add .clang-tidy with customization to disable readability-identifier...
Fangrui Song [Fri, 4 Sep 2020 23:05:20 +0000 (16:05 -0700)]
[compiler-rt] Add .clang-tidy with customization to disable readability-identifier-naming

Copied from lldb/.clang-tidy (D75810).

Most compiler-rt code actually uses variableName or variable_name but not VariableName.
Lots of functions use `__function_name` and FunctionName instead of functionName.
Just exclude readability-identifier-naming.

3 years ago[compiler-rt] Try again to correct test after 3f1a9b7eca0 added segment names to...
Daniel Sanders [Fri, 4 Sep 2020 22:48:27 +0000 (15:48 -0700)]
[compiler-rt] Try again to correct test after 3f1a9b7eca0 added segment names to objdump output

One check was missed on the previous attempt

3 years ago[Hexagon] Unindent everything in HexagonISelLowering.h, NFC
Krzysztof Parzyszek [Fri, 4 Sep 2020 22:17:55 +0000 (17:17 -0500)]
[Hexagon] Unindent everything in HexagonISelLowering.h, NFC

Just a shift, no other formatting changes.

3 years ago[Driver] Allow -specs and -nostartfiles to be forwarded to GCC
Pengxuan Zheng [Fri, 4 Sep 2020 20:56:06 +0000 (13:56 -0700)]
[Driver] Allow -specs and -nostartfiles to be forwarded to GCC

With 6a75496836ea14bcfd2f4b59d35a1cad4ac58cee, these two options are no longer
forwarded to GCC. This patch restores the original behavior.

Reviewed By: MaskRay

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

3 years ago[libclang] Add missing dependency on clangRewrite lib
Jan Korous [Fri, 4 Sep 2020 21:53:38 +0000 (14:53 -0700)]
[libclang] Add missing dependency on clangRewrite lib

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

3 years ago[InstSimplify] Add tests for min/max with dominating condition (NFC)
Nikita Popov [Fri, 4 Sep 2020 21:40:54 +0000 (23:40 +0200)]
[InstSimplify] Add tests for min/max with dominating condition (NFC)

3 years ago[gn build] Port 69e5abb57b7
LLVM GN Syncbot [Fri, 4 Sep 2020 21:18:33 +0000 (21:18 +0000)]
[gn build] Port 69e5abb57b7

3 years ago[libclang] Add CXRewriter to libclang API
Jan Korous [Fri, 4 Sep 2020 19:18:49 +0000 (12:18 -0700)]
[libclang] Add CXRewriter to libclang API

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

3 years ago[X86] Prevent shuffle combining from creating an identical X86ISD::SHUF128.
Craig Topper [Fri, 4 Sep 2020 20:52:26 +0000 (13:52 -0700)]
[X86] Prevent shuffle combining from creating an identical X86ISD::SHUF128.

This can cause an infinite loop if SimplifiedDemandedElts asks
for the node to replace itself.

A similar protection exists in other places in shuffle combining.

Fixes ISPC https://github.com/ispc/ispc/issues/1864

3 years ago[InstCombine] rename tmp values to avoid scripted FileCheck conflicts; NFC
Sanjay Patel [Fri, 4 Sep 2020 20:56:21 +0000 (16:56 -0400)]
[InstCombine] rename tmp values to avoid scripted FileCheck conflicts; NFC

3 years ago[InstCombine] add test for assume in block with unreachable (PR47416); NFC
Sanjay Patel [Fri, 4 Sep 2020 15:14:48 +0000 (11:14 -0400)]
[InstCombine] add test for assume in block with unreachable (PR47416); NFC

3 years ago[BDCE] Add tests for min/max intrinsincs (NFC)
Nikita Popov [Fri, 4 Sep 2020 20:41:25 +0000 (22:41 +0200)]
[BDCE] Add tests for min/max intrinsincs (NFC)

3 years ago[libclang] Expose couple more AST details via cursors
Jan Korous [Tue, 1 Sep 2020 23:29:36 +0000 (16:29 -0700)]
[libclang] Expose couple more AST details via cursors

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

3 years ago[LiveDebugVariables] Delete unneeded doInitialization
Fangrui Song [Fri, 4 Sep 2020 20:27:42 +0000 (13:27 -0700)]
[LiveDebugVariables] Delete unneeded doInitialization

3 years ago[ORC] Fix some bugs in TPCDynamicLibrarySearchGenerator, use in llvm-jitlink.
Lang Hames [Fri, 4 Sep 2020 19:27:40 +0000 (12:27 -0700)]
[ORC] Fix some bugs in TPCDynamicLibrarySearchGenerator, use in llvm-jitlink.

TPCDynamicLibrarySearchGenerator was generating errors on missing
symbols, but that doesn't fit the DefinitionGenerator contract: A symbol
that isn't generated by a particular generator should not cause an
error.

This commit fixes the error by using SymbolLookupFlags::WeaklyReferencedSymbol
for all elements of the lookup, and switches llvm-jitlink to use
TPCDynamicLibrarySearchGenerator.

3 years ago[SCEV] Add tests for min/max intrinsics (NFC)
Nikita Popov [Fri, 4 Sep 2020 20:07:36 +0000 (22:07 +0200)]
[SCEV] Add tests for min/max intrinsics (NFC)

3 years ago[ThinLTO][Legacy] Fix StringRef assertion from ThinLTO bots
Steven Wu [Fri, 4 Sep 2020 19:25:01 +0000 (12:25 -0700)]
[ThinLTO][Legacy] Fix StringRef assertion from ThinLTO bots

This is a presumed fix for FireFox thinLTO bot fix which hits assertion
failure for invalid index when access StringRef. Techinically, `IRName`
in the symtab should not be empty string for the entries we cared about
but this will help to fix the bot before more information can be
provided. Otherwise, NFCI.

3 years ago[compiler-rt] Try to correct test after 3f1a9b7eca0 added segment names to objdump...
Daniel Sanders [Fri, 4 Sep 2020 19:23:49 +0000 (12:23 -0700)]
[compiler-rt] Try to correct test after 3f1a9b7eca0 added segment names to objdump output

3 years ago[PowerPC] Allow const pointers for load builtins in altivec.h
Nemanja Ivanovic [Fri, 4 Sep 2020 17:54:21 +0000 (13:54 -0400)]
[PowerPC] Allow const pointers for load builtins in altivec.h

The load builtins in altivec.h do not have const in the signature
for the pointer parameter. This prevents using them for loading
from constant pointers. A notable case for such a use is Eigen.

This patch simply adds the missing const.

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

3 years ago[DSE,MemorySSA] Check for throwing instrs between killing/killed def.
Florian Hahn [Fri, 4 Sep 2020 16:19:56 +0000 (17:19 +0100)]
[DSE,MemorySSA] Check for throwing instrs between killing/killed def.

We also have to check all uses between the killing & killed def and
check if any of them is throwing.

3 years agoFix the type of the invoke function in the block ABI documentation
Akira Hatanaka [Fri, 4 Sep 2020 17:26:05 +0000 (10:26 -0700)]
Fix the type of the invoke function in the block ABI documentation

rdar://problem/67892794

3 years ago[lld] Test corrections after 3f1a9b7eca0 added segment names to objdump output
Daniel Sanders [Fri, 4 Sep 2020 17:26:09 +0000 (10:26 -0700)]
[lld] Test corrections after 3f1a9b7eca0 added segment names to objdump output

3 years ago[tests][libFuzzer] Fix `-Wmissing-field-initializers` after D86092
Hubert Tong [Fri, 4 Sep 2020 17:07:44 +0000 (13:07 -0400)]
[tests][libFuzzer] Fix `-Wmissing-field-initializers` after D86092

Speculatively fix `-Werror,-Wmissing-field-initializers` failures
relating to the `ScalePerExecTime` field added by D86092.

3 years ago[objdump][macho] Emit segment names along with section names
Daniel Sanders [Fri, 4 Sep 2020 00:07:59 +0000 (17:07 -0700)]
[objdump][macho] Emit segment names along with section names

I recently came across a MachO with multiple sections of the same name but
different segments. We should emit the segment name alongside the section name
for MachO's.

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

3 years ago[DSE,MemorySSA] Remove some duplicated test functions.
Florian Hahn [Fri, 4 Sep 2020 16:49:33 +0000 (17:49 +0100)]
[DSE,MemorySSA] Remove some duplicated test functions.

Some tests from multibuild-malloc-free.ll do not actually use malloc or
free and where split out to multiblock-throwing.ll, but not removed from
the original file. This patch cleans that up. It also moves @test22 to
simple.ll, because it does not involve multiple blocks.

3 years ago[analyzer][StdLibraryFunctionsChecker] Add POSIX time handling functions
Gabor Marton [Tue, 21 Jul 2020 16:50:43 +0000 (18:50 +0200)]
[analyzer][StdLibraryFunctionsChecker] Add POSIX time handling functions

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

3 years ago[libclang] Add translateCXRangeToCharRange conversion
Jan Korous [Wed, 2 Sep 2020 20:11:35 +0000 (13:11 -0700)]
[libclang] Add translateCXRangeToCharRange conversion

Add new conversion with clearly specified semantics.

https://reviews.llvm.org/D86990

3 years ago[OpenMPOpt] Assume indirect call always changes ICV
Wei Wang [Fri, 4 Sep 2020 16:05:13 +0000 (09:05 -0700)]
[OpenMPOpt] Assume indirect call always changes ICV

When checking call sites, give special handling to indirect call, as the
callee may be unknown and can lead to nullptr dereference later. Assume
conservatively that the ICV always changes in such case.

Reviewed By: sstefan1

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

3 years ago[HeapProf] Address post-review comments in instrumentation code
Teresa Johnson [Fri, 4 Sep 2020 06:29:21 +0000 (23:29 -0700)]
[HeapProf] Address post-review comments in instrumentation code

Addresses post-review comments from D85948, which can be found here:
https://reviews.llvm.org/rG7ed8124d46f9.