platform/upstream/llvm.git
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.

3 years agoFormatTest: Provide real line number in failure messages
Alex Richardson [Fri, 4 Sep 2020 15:13:29 +0000 (16:13 +0100)]
FormatTest: Provide real line number in failure messages

Currently a test failure always reports a line number inside verifyFormat()
which is not very helpful to see which test failed. With this change we now
emit the line number where the verify function was called. When using an
IDE such as CLion, the output now includes a clickable link that points to
the call site.

Reviewed By: MyDeveloperDay

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

3 years ago[clang-format] Add a test showing the current config file list parsing
Alex Richardson [Fri, 4 Sep 2020 15:11:48 +0000 (16:11 +0100)]
[clang-format] Add a test showing the current config file list parsing

Currently clang-format starts overriding the default values at index 0
(keeping the existing values) instead of appending or replacing all values.
This patch simply checks the current (IMO surprising) behaviour and does
not attempt to change it.

Reviewed By: MyDeveloperDay

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

3 years ago[clang-format] Parse __ptr32/__ptr64 as a pointer qualifier
Alex Richardson [Fri, 4 Sep 2020 15:02:26 +0000 (16:02 +0100)]
[clang-format] Parse __ptr32/__ptr64 as a pointer qualifier

Before:
x = (foo *__ptr32) * v;
MACRO(A * __ptr32 a);
x = (foo *__ptr64) * v;
MACRO(A * __ptr64 a);

After:
x = (foo *__ptr32)*v;
MACRO(A *__ptr32 a);
x = (foo *__ptr64)*v;
MACRO(A *__ptr64 a);

Depends on D86721 (to apply cleanly)

Reviewed By: MyDeveloperDay

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

3 years ago[AArch64][SVE] Add lowering for rounding operations
Muhammad Asif Manzoor [Fri, 4 Sep 2020 15:11:34 +0000 (11:11 -0400)]
[AArch64][SVE] Add lowering for rounding operations

Add the functionality to lower SVE rounding operations for passthru variant.
Created a new test case file for all rounding operations.

Reviewed By: paulwalker-arm

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

3 years agosanitizer_common: Implement COMPILER_CHECK using static_assert
Nico Weber [Fri, 4 Sep 2020 15:05:52 +0000 (11:05 -0400)]
sanitizer_common: Implement COMPILER_CHECK using static_assert

Since this is an internal header, we can just assume static_assert
exists.

If this doesn't upset any bots, I'll replace all uses of
COMPILER_CHECK in a follow-up.

3 years agoRevert "[Asan] Cleanup atomic usage in allocator"
Nico Weber [Fri, 4 Sep 2020 14:47:20 +0000 (10:47 -0400)]
Revert "[Asan] Cleanup atomic usage in allocator"

This reverts commit 8b8be6f38ab568d40869205389a002f32f6558a2
and follow-ups 99a93c3a223e3bfc9a9781bfbf98d2fd4551f923,
a9c0bf04043462d43013bc5616aa48f6d3e16b88,
48ac5b4833b60f00f0923db11ea31e7316bc78c6.

It breaks building on Windows, see https://reviews.llvm.org/D86917#2255872

3 years ago[MachOYAML] Allow handcrafting custom contents for DWARF sections.
Xing GUO [Fri, 4 Sep 2020 14:41:25 +0000 (22:41 +0800)]
[MachOYAML] Allow handcrafting custom contents for DWARF sections.

This patch enables users to handcraft custom contents for DWARF
sections. If we specify the contents of DWARF sections both in the
'DWARF' entry and the 'content', yaml2obj will emit an error message.
In addition, this patch helps remove the restriction that only the
content of sections whose segname are __DWARF can be specified in the
"DWARF" entry.

Reviewed By: jhenderson

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

3 years ago[EarlyCSE] Verify hash code in regression tests
Bryan Chan [Sun, 30 Aug 2020 23:17:43 +0000 (19:17 -0400)]
[EarlyCSE] Verify hash code in regression tests

As discussed in D86843, -earlycse-debug-hash should be used in more regression
tests to catch inconsistency between the hashing and the equivalence check.

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

3 years agoclang: Add test for -Wunreachable-code + weak redeclaration
Nico Weber [Fri, 4 Sep 2020 14:26:46 +0000 (10:26 -0400)]
clang: Add test for -Wunreachable-code + weak redeclaration

This tests what caused the revert in 7b033238.

3 years ago[spirv] Add more target and resource limit fields
Lei Zhang [Fri, 4 Sep 2020 00:55:20 +0000 (20:55 -0400)]
[spirv] Add more target and resource limit fields

These fields will be used to choose/influence patterns for
SPIR-V code generation.

Reviewed By: mravishankar

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

3 years ago[gn build] fix llvm-lit after d23b15cc16077
Nico Weber [Fri, 4 Sep 2020 14:23:16 +0000 (10:23 -0400)]
[gn build] fix llvm-lit after d23b15cc16077

3 years agoRevert "Canonicalize declaration pointers when forming APValues."
Nico Weber [Fri, 4 Sep 2020 14:13:28 +0000 (10:13 -0400)]
Revert "Canonicalize declaration pointers when forming APValues."

This reverts commit e6393ee813178e9d3306b8e3c6949a4f32f8a2cb.
It breaks Wunreachable for weak attributes, see
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20200831/336645.html

3 years ago[DSE] Move legacy tests to DeadStoreElimination/MemDepAnalysis.
Florian Hahn [Fri, 4 Sep 2020 08:48:04 +0000 (09:48 +0100)]
[DSE] Move legacy tests to DeadStoreElimination/MemDepAnalysis.

This patch moves the tests for the old MemDepAnalysis based DSE
implementation to the MemDepAnalysis subdirectory and updates them to
pass -enable-dse-memoryssa=false.

This is in preparation for the switch to MemorySSA-backed DSE.

3 years ago[mlir] Refactor standalone-translate to use mlirTranslateMain()
Marius Brehler [Fri, 4 Sep 2020 08:52:25 +0000 (10:52 +0200)]
[mlir] Refactor standalone-translate to use mlirTranslateMain()

This refactors the standalone-translate executable to use mlirTranslateMain() declared in Translation.h and further applies D87129.

Reviewed By: jpienaar

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

3 years ago[mlir] Fix includes in mlir-translate
Marius Brehler [Fri, 4 Sep 2020 08:39:30 +0000 (10:39 +0200)]
[mlir] Fix includes in mlir-translate

Drops the include on InitAllDialects.h, as dialects are now initialized in the translation passes.

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

3 years ago[MemCpyOpt] Account for case that MemInsertPoint == BI.
Florian Hahn [Fri, 4 Sep 2020 12:58:59 +0000 (13:58 +0100)]
[MemCpyOpt] Account for case that MemInsertPoint == BI.

In that case, the new MemoryDef needs to be inserted *before*
MemInsertPoint.

3 years ago[x86] add tests for store merging; NFC
Sanjay Patel [Thu, 3 Sep 2020 20:26:59 +0000 (16:26 -0400)]
[x86] add tests for store merging; NFC

3 years ago[Test] Range fix in test
Max Kazantsev [Fri, 4 Sep 2020 12:06:14 +0000 (19:06 +0700)]
[Test] Range fix in test

test02_neg is not testing what it claims to test because its starting
value -1 lies outside of specified range.

3 years agoFix typos in doc LangRef.rst
Yang Zhihui [Fri, 4 Sep 2020 12:15:59 +0000 (05:15 -0700)]
Fix typos in doc LangRef.rst

Reviewed By: vitalybuka

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

3 years ago[lldb][NFC] Rewrite CPP11EnumTypes test to make it faster
Raphael Isemann [Fri, 4 Sep 2020 10:29:40 +0000 (12:29 +0200)]
[lldb][NFC] Rewrite CPP11EnumTypes test to make it faster

TestCPP11EnumTypes is one of the most expensive tests on my system and takes
around 35 seconds to run. A relatively large amount of that time is actually
doing CPU intensive work it seems (and not waiting on timeouts like other
slow tests).

The main issue is that this test repeatedly compiles the same source files
with different compiler defines. The test is also including standard library
headers, so it will also build all system modules with the gmodules debug
info variant. This leads to the problem that this test ends up compiling all
system Clang modules 8 times (one for each subtest with a unique define). As
the system modules are quite large, this causes that this test spends most
of its runtime just recompiling all system modules on macOS.

There is also the small issue that this test is starting and start-stopping
the test process a few hundred times.

This rewrites the test to instead just use a macro to instantiate all the
enum types in a single source and uses global variables to test the values
(which means there is no more need to continue/stop or even start a process).

I kept running all the debug info variants (event though it doesn't seem really
relevant) to keep this as NFC as possible.

This reduced the test runtime by around 1.5 seconds on my system (or in relative
numbers, the runtime of this test decreases by 95%).

3 years ago[modules] Correctly parse LateParsedTemplates in case of dependent modules.
Vaibhav Garg [Fri, 4 Sep 2020 10:49:11 +0000 (10:49 +0000)]
[modules] Correctly parse LateParsedTemplates in case of dependent modules.

While parsing LateParsedTemplates, Clang assumes that the Global DeclID matches
with the Local DeclID of a Decl. This is not the case when we have multiple
dependent modules , each having their own LateParsedTemplate section. In such a
case, a Local/Global DeclID confusion occurs which leads to improper casting of
FunctionDecl's.

This commit creates a Vector to map the LateParsedTemplate section of each
Module with their module file and therefore resolving the Global/Local DeclID
confusion.

Reviewed By: rsmith

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