platform/upstream/llvm.git
4 years agoNFC; add an example that subtracts pointers to two global vars
Juneyoung Lee [Sun, 26 Jul 2020 11:47:19 +0000 (20:47 +0900)]
NFC; add an example that subtracts pointers to two global vars

4 years ago[NFC][XRay] Account: migrate to DenseMap + SmallVector, -16% faster on large (3.8G...
Roman Lebedev [Sun, 26 Jul 2020 11:05:00 +0000 (14:05 +0300)]
[NFC][XRay] Account: migrate to DenseMap + SmallVector, -16% faster on large (3.8G) input

DenseMap is a single allocation underneath, so this is has pretty expected
performance impact on large-ish (3.8G) xray log processing time.

4 years ago[NFC][XRay] Account: decouple getStats() interface from underlying data structure
Roman Lebedev [Sun, 26 Jul 2020 11:00:15 +0000 (14:00 +0300)]
[NFC][XRay] Account: decouple getStats() interface from underlying data structure

It doesn't really need to know where Timings are stored, it just needs
to be able to sort them, so MutableArrayRef is enough.

That uncovers an interesting quirk that it relied on
implicit double->int conversion for calculating percentiles.

4 years ago[lit] Don't include tests skipped due to sharding in reports
Alex Richardson [Sun, 26 Jul 2020 10:39:22 +0000 (11:39 +0100)]
[lit] Don't include tests skipped due to sharding in reports

When running multiple shards, don't include skipped tests in the xunit
output since merging the files will result in duplicates.
In our CHERI Jenkins CI, I configured the libc++ tests to run using sharding
(since we are testing using a single-CPU QEMU). We then merge the generated
XUnit xml files to produce a final result, but if the individual XMLs
report tests excluded due to sharding each test is included N times in the
final result. This also makes it difficult to find the tests that were
skipped due to missing REQUIRES: etc.

Reviewed By: yln

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

4 years ago[asan] Mark the strstr test as UNSUPPORTED on FreeBSD
Alex Richardson [Sun, 26 Jul 2020 10:37:47 +0000 (11:37 +0100)]
[asan] Mark the strstr test as UNSUPPORTED on FreeBSD

 Like Android, FreeBSDs libc calls memchr which causes this test to fail.

Reviewed By: emaste

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

4 years ago[AArch64][GlobalISel] Make <8 x s16> and <16 x s8> legal types for G_SHUFFLE_VECTOR...
Amara Emerson [Sun, 26 Jul 2020 07:46:29 +0000 (00:46 -0700)]
[AArch64][GlobalISel] Make <8 x s16> and <16 x s8> legal types for G_SHUFFLE_VECTOR and G_IMPLICIT_DEF.

Trivial change, we're still missing support for rev matching for these types
in the combiner.

4 years ago[X86] Merge X86MCInstLowering's maxLongNopLength into emitNop and remove check for...
Craig Topper [Sun, 26 Jul 2020 05:05:46 +0000 (22:05 -0700)]
[X86] Merge X86MCInstLowering's maxLongNopLength into emitNop and remove check for FeatureNOPL.

The switch in emitNop uses 64-bit registers for nops exceeding
2 bytes. This isn't valid outside 64-bit mode. We could fix this
easily enough, but there are no users that ask for more than 2
bytes outside 64-bit mode.

Inlining the method to make the coupling between the two methods
more explicit.

4 years ago[X86] Remove getProcFamily() method from X86Subtarget. NFC
Craig Topper [Sun, 26 Jul 2020 03:48:46 +0000 (20:48 -0700)]
[X86] Remove getProcFamily() method from X86Subtarget. NFC

This isn't used and we've decided in the past that a CPU enum
for tuning is not a good idea.

4 years ago[mlir][shape] Further operand and result type generalization
Jacques Pienaar [Sun, 26 Jul 2020 04:37:15 +0000 (21:37 -0700)]
[mlir][shape] Further operand and result type generalization

Previous changes generalized some of the operands and results. Complete
a larger group of those to simplify progressive lowering. Also update
some of the declarative asm form due to generalization. Tried to keep it
mostly mechanical.

4 years agoDADCombiner: Don't simplify the token factor if the node's number of operands already...
Changpeng Fang [Sun, 26 Jul 2020 04:20:59 +0000 (21:20 -0700)]
DADCombiner: Don't simplify the token factor if the node's number of operands already exceeds TokenFactorInlineLimit

Summary:
  In parallelizeChainedStores, a TokenFactor was created with the size greater than 3000.
We found that DAGCombiner::visitTokenFactor will consume a huge amount of time on
such nodes. Since the number of operands already exceeds TokenFactorInlineLimit, we propose
to give up simplification with the consideration of compile time.

Reviewers:
  @spatel, @arsenm

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

4 years ago[X86] Replace a use of ProcIntelSLM with FeatureFast7ByteNOP.
Craig Topper [Sun, 26 Jul 2020 03:46:42 +0000 (20:46 -0700)]
[X86] Replace a use of ProcIntelSLM with FeatureFast7ByteNOP.

4 years agoTemporarily Revert "Unify the return value of GetByteSize to an llvm::Optional<uint64...
Eric Christopher [Sun, 26 Jul 2020 01:42:04 +0000 (18:42 -0700)]
Temporarily Revert "Unify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish)"
as it's causing numerous (176) test failures on linux.

This reverts commit 1d9b860fb6a85df33fd52fcacc6a5efb421621bd.

4 years agoFold StatepointBB into checks as it's only used from an NDEBUG or ASSERT
Eric Christopher [Sun, 26 Jul 2020 01:34:02 +0000 (18:34 -0700)]
Fold StatepointBB into checks as it's only used from an NDEBUG or ASSERT
context fixing an unused variable warning.

4 years ago[PowerPC][NFC] Fix an assert that cannot trip from 7d076e19e31a
Nemanja Ivanovic [Sun, 26 Jul 2020 00:28:52 +0000 (20:28 -0400)]
[PowerPC][NFC] Fix an assert that cannot trip from 7d076e19e31a

I mixed up the precedence of operators in the assert and thought I
had it right since there was no compiler warning. This just
adds the parentheses in the expression as needed.

4 years ago[Statepoints] Style cleanup after 3da1a963 [NFC]
Philip Reames [Sat, 25 Jul 2020 23:40:06 +0000 (16:40 -0700)]
[Statepoints] Style cleanup after 3da1a963 [NFC]

Just fixing a few minor stylistic issues.

4 years ago[X86] Add masked versions of the VPTERNLOG test cases added for D83630. NFC
Craig Topper [Sat, 25 Jul 2020 23:36:33 +0000 (16:36 -0700)]
[X86] Add masked versions of the VPTERNLOG test cases added for D83630. NFC

We don't handle these yet and D83630 won't improve that, but
at least we'll have the tests.

4 years ago[Reduce] Argument reduction: do deal with function declarations
Roman Lebedev [Sat, 25 Jul 2020 21:56:36 +0000 (00:56 +0300)]
[Reduce] Argument reduction: do deal with function declarations

We can happily turn function definitions into declarations,
thus obscuring their argument from being elided by this pass.

I don't believe there is a good reason to just ignore declarations.
likely even proper llvm intrinsics ones,
at worst the input becomes uninteresting.

The other question here is that all these transforms are all-or-nothing.
In some cases, should we be treating each use separately?

The main blocker here seemed to be that llvm::CloneFunctionInto()
does `&OldFunc->front()`, which inserts a nullptr into a densemap,
which is not happy about it and asserts.

4 years ago[Reduce] Argument reduction: do properly handle invoke insts (PR46819)
Roman Lebedev [Sat, 25 Jul 2020 20:24:13 +0000 (23:24 +0300)]
[Reduce] Argument reduction: do properly handle invoke insts (PR46819)

replaceFunctionCalls() is very non-exhaustive, it only handles
CallInst's. Which means, by the time we drop old function,
there may still be uses of it lurking around.
Let's instead whack-a-mole them by all by replacing with undef.

I'm not sure this is the best handling, especially for calls, but IMO
poorly reduced input is much better than crashing reduction tool.
A (previously-crashing!) test added.

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

4 years ago[Reduce] Basic block reduction: do properly handle invoke insts (PR46818)
Roman Lebedev [Sat, 25 Jul 2020 19:31:05 +0000 (22:31 +0300)]
[Reduce] Basic block reduction: do properly handle invoke insts (PR46818)

Terminator may have returned value, so we need to replace uses,
and in general handle invoke as a branch inst.

I'm not sure this is the best handling, but IMO poorly reduced
input is much better than crashing reduction tool.
A (previously-crashing!) test added.

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

4 years ago[ORC] Rename TargetProcessControl DynamicLibraryHandle and loadLibrary.
Lang Hames [Sat, 25 Jul 2020 21:18:52 +0000 (14:18 -0700)]
[ORC] Rename TargetProcessControl DynamicLibraryHandle and loadLibrary.

The new names, DylibHandle and loadDylib, are more concise and make
clear that these utilities are for loading dynamic libraries, not static
ones.

4 years ago[ORC] Don't require PageSize or Triple during TargetProcessControl construction
Lang Hames [Sat, 25 Jul 2020 04:17:37 +0000 (21:17 -0700)]
[ORC] Don't require PageSize or Triple during TargetProcessControl construction

Subclasses will commonly gather that information from a remote during
construction, in which case they won't have meaningful values to pass to
TargetProcessControl's constructor.

4 years ago[MLIR][Shape] Allow `num_elements` to operate on extent tensors
Frederik Gossen [Sat, 25 Jul 2020 22:01:21 +0000 (15:01 -0700)]
[MLIR][Shape] Allow `num_elements` to operate on extent tensors

Re-landing with dependent change landed and error condition relaxed.
Beyond the change to error condition exactly https://reviews.llvm.org/D84445.

4 years ago[MLIR][Shape] Refactor verification
Jacques Pienaar [Sat, 25 Jul 2020 21:55:19 +0000 (14:55 -0700)]
[MLIR][Shape] Refactor verification

Based on https://reviews.llvm.org/D84439 but less restrictive, else we
don't allow shape_of to be able to produce a ranked output and doesn't
allow for iterative refinement here. We can consider making it more
restrictive later.

4 years agoRevert "[MLIR][Shape] Allow `num_elements` to operate on extent tensors"
Jacques Pienaar [Sat, 25 Jul 2020 21:47:57 +0000 (14:47 -0700)]
Revert "[MLIR][Shape] Allow `num_elements` to operate on extent tensors"

This reverts commit 55ced04d6bc13fd0f9396a0cfc393b44378d8784.

Forgot to submit depend change first.

4 years ago[MLIR][Shape] Allow `num_elements` to operate on extent tensors
Frederik Gossen [Sat, 25 Jul 2020 21:39:18 +0000 (14:39 -0700)]
[MLIR][Shape] Allow `num_elements` to operate on extent tensors

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

4 years ago[Statepoints] Support lowering gc relocations to virtual registers
Philip Reames [Sat, 11 Jul 2020 17:50:34 +0000 (10:50 -0700)]
[Statepoints] Support lowering gc relocations to virtual registers

(Disabled under flag for the moment)

This is part of a larger project wherein we are finally integrating lowering of gc live operands with the register allocator.  Today, we force spill all operands in SelectionDAG.  The code to do so is distinctly non-optimal.  The approach this patch is working towards is to instead lower the relocations directly into the MI form, and let the register allocator pick which ones get spilled and which stack slots they get spilled to.  In terms of performance, the later part is actually more important as it avoids redundant shuffling of values between stack slots.

This particular change adds ISEL support to produce the variadic def STATEPOINT form required by the above.  In particular, the first N are lowered to variadic tied def/use pairs.  So new statepoint looks like this:
reloc1,reloc2,... = STATEPOINT ..., base1, derived1<tied-def0>, base2, derived2<tied-def1>, ...

N is limited by the maximal number of tied registers machine instruction can have (15 at the moment).

The current patch is restricted to handling relocations within a single basic block.  Cross block relocations (e.g. invokes) are handled via the legacy mechanism.  This restriction will be relaxed in future patches.

Patch By: dantrushin
Differential Revision: https://reviews.llvm.org/D81648

4 years ago[X86] Add llvm.roundeven test cases. Add f80 tests cases for constrained intrinsics...
Craig Topper [Sat, 25 Jul 2020 20:24:58 +0000 (13:24 -0700)]
[X86] Add llvm.roundeven test cases. Add f80 tests cases for constrained intrinsics that lower to libcalls. NFC

4 years ago[X86] Fix intrinsic names in strict fp80 tests to use f80 in their names instead...
Craig Topper [Sat, 25 Jul 2020 19:12:16 +0000 (12:12 -0700)]
[X86] Fix intrinsic names in strict fp80 tests to use f80 in their names instead of x86_fp80.

The type is called x86_fp80, but when it is printed in the intrinsic
name it should be f80. The parser doesn't seem to care that the
name was wrong.

4 years ago[Driver] Define LinkOption and fix forwarded options to GCC for linking
Fangrui Song [Sat, 25 Jul 2020 19:33:18 +0000 (12:33 -0700)]
[Driver] Define LinkOption and fix forwarded options to GCC for linking

Many driver options are neither 'DriverOption' nor 'LinkerInput'. When gcc is
used for linking, these options get forwarded even if they don't have anything
to do with linking. Among these options, clang-specific ones can cause gcc to
error.

Just use 'OPT_Link_Group' and a new flag 'LinkOption' for options which already
have a group.

gfortran support apparently bit rots (which does not seem to make much sense). XFAIL the test.

4 years ago[gn build] Port 136c8f50e96
LLVM GN Syncbot [Sat, 25 Jul 2020 18:51:58 +0000 (18:51 +0000)]
[gn build] Port 136c8f50e96

4 years ago[Reduce] Try turning function definitions into declarations first, NFCI-ish
Roman Lebedev [Sat, 25 Jul 2020 18:43:36 +0000 (21:43 +0300)]
[Reduce] Try turning function definitions into declarations first, NFCI-ish

ReduceFunctions could do it, but it also replaces *all* calls with undef,
so if any of undef replacements makes reduction uninteresting,
it won't work.

ReduceBasicBlocks also could do it, but well, it may take many guesses
for all the blocks of a function to happen to be out-of-chunk,
which is not a very efficient way to go about it.

So let's just do this first.

4 years agoUnify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish)
Adrian Prantl [Sat, 25 Jul 2020 15:27:21 +0000 (08:27 -0700)]
Unify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish)

This cleanup patch unifies all methods called GetByteSize() in the
ValueObject hierarchy to return an optional, like the methods in
CompilerType do. This means fewer magic 0 values, which could fix bugs
down the road in languages where types can have a size of zero, such
as Swift and C (but not C++).

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

4 years ago[X86] Remove stress-scheduledagrrlist.ll.
Florian Hahn [Sat, 25 Jul 2020 14:45:24 +0000 (15:45 +0100)]
[X86] Remove stress-scheduledagrrlist.ll.

This test seems to take quite a long time with EXPENSIVE_CHECKS.

Remove it.

4 years ago[LVI] Don't require operand number for range (NFC)
Nikita Popov [Sat, 25 Jul 2020 14:32:22 +0000 (16:32 +0200)]
[LVI] Don't require operand number for range (NFC)

Pass the Value* instead of the operand number, rename I to CxtI.
This makes the function a bit more generally useful.

4 years agoAMDGPU/GlobalISel: Don't assert on G_INSERT > 128-bits
Matt Arsenault [Tue, 16 Jun 2020 00:13:24 +0000 (20:13 -0400)]
AMDGPU/GlobalISel: Don't assert on G_INSERT > 128-bits

Just fallback for now. Really tablegen needs to generate all of the
subregister index handling we need.

4 years ago[SCCP] Add assume non null test (NFC)
Nikita Popov [Sat, 25 Jul 2020 14:02:15 +0000 (16:02 +0200)]
[SCCP] Add assume non null test (NFC)

4 years ago[SCCP] Restore the change reporting as well
Nikita Popov [Sat, 25 Jul 2020 13:10:48 +0000 (15:10 +0200)]
[SCCP] Restore the change reporting as well

Reapply 5db5b4bc4394ca247c9eb665e03b851848aa2fbf.

4 years agoReapply [SCCP] Directly remove non-feasible edges
Nikita Popov [Tue, 21 Jul 2020 19:26:30 +0000 (21:26 +0200)]
Reapply [SCCP] Directly remove non-feasible edges

Reapply with DTU update moved after CFG update, which is a
requirement of the API.

-----

Non-feasible control-flow edges are currently removed by replacing
the branch condition with a constant and then calling
ConstantFoldTerminator. This happens in a rather roundabout manner,
by inspecting the users (effectively: predecessors) of unreachable
blocks, and further complicated by the need to explicitly materialize
the condition for "forced" edges. I would like to extend SCCP to
discard switch conditions that are non-feasible based on range
information, but this is incompatible with the current approach
(as there is no single constant we could use.)

Instead, this patch explicitly removes non-feasible edges. It
currently only needs to handle the case where there is a single
feasible edge. The llvm_unreachable() branch will need to be
implemented for the aforementioned switch improvement.

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

4 years agoSimplifyLibCalls - remove unnecessary header and forward declaration. NFC.
Simon Pilgrim [Sat, 25 Jul 2020 11:58:39 +0000 (12:58 +0100)]
SimplifyLibCalls - remove unnecessary header and forward declaration. NFC.

We include TargetLibraryInfo.h so don't need to forward declare it, and we don't need to include TargetLibraryInfo.h in SimplifyLibCalls.cpp as well.

4 years ago[X86][SSE] combineX86ShufflesRecursively - move all Root node asserts to the same...
Simon Pilgrim [Sat, 25 Jul 2020 11:08:06 +0000 (12:08 +0100)]
[X86][SSE] combineX86ShufflesRecursively - move all Root node asserts to the same location. NFCI.

Minor tidyup for some upcoming shuffle combine improvements.

4 years agoSymbolRemappingReader.h - pass Twine by reference not value. NFCI.
Simon Pilgrim [Sat, 25 Jul 2020 10:35:47 +0000 (11:35 +0100)]
SymbolRemappingReader.h - pass Twine by reference not value. NFCI.

4 years ago[IPSCCP] Drop argmemonly after replacing pointer argument.
Florian Hahn [Sat, 25 Jul 2020 10:52:14 +0000 (11:52 +0100)]
[IPSCCP] Drop argmemonly after replacing pointer argument.

This patch updates IPSCCP to drop argmemonly and
inaccessiblemem_or_argmemonly if it replaces a pointer argument.

Fixes PR46717.

Reviewers: efriedma, davide, nikic, jdoerfert

Reviewed By: efriedma, jdoerfert

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

4 years agoFix C2975 error under MSVC
Nathan James [Sat, 25 Jul 2020 10:03:59 +0000 (11:03 +0100)]
Fix C2975 error under MSVC

Apparantly a constexpr value isn't a compile time constant under certain versions of MSVC.

4 years ago[X86][SSE] getFauxShuffle - ignore undemanded sources for PACKSS/PACKUS faux shuffles
Simon Pilgrim [Sat, 25 Jul 2020 09:50:56 +0000 (10:50 +0100)]
[X86][SSE] getFauxShuffle - ignore undemanded sources for PACKSS/PACKUS faux shuffles

If we don't care about an entire LHS/RHS of the PACK op, then can just treat it the same as undef (we don't care if it saturates) and is safe to treat as a shuffle.

This can happen if we attempt to decode as a faux shuffle before SimplifyDemandedVectorElts has been called on the PACK which should replace the source with UNDEF entirely.

4 years ago[ADT] Add a range-based version of std::move
Nathan James [Sat, 25 Jul 2020 09:37:33 +0000 (10:37 +0100)]
[ADT] Add a range-based version of std::move

Adds a range-based version of `std::move`, the version that moves a range, not the one that creates r-value references.

Reviewed By: dblaikie, gamesh411

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

4 years ago[AArch64][GlobalISel] Look through constants when selection stores of 0
Jessica Paquette [Sat, 25 Jul 2020 01:14:41 +0000 (18:14 -0700)]
[AArch64][GlobalISel] Look through constants when selection stores of 0

Very minor code size improvements (hits 8 times in Bullet at -O3), but still
something.

Also very minor NFC change to make sure we only search for a 0 constant when
selecting a store. Before, we'd do this for loads as well.

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

4 years ago[tsan] Allow TSan in the Clang driver for Apple Silicon Macs
Kuba Mracek [Sat, 25 Jul 2020 03:14:00 +0000 (20:14 -0700)]
[tsan] Allow TSan in the Clang driver for Apple Silicon Macs

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

4 years ago[PowerPC] Exploit the High Order Vector Multiply Instructions on Power10
Amy Kwan [Sat, 25 Jul 2020 01:57:57 +0000 (20:57 -0500)]
[PowerPC] Exploit the High Order Vector Multiply Instructions on Power10

This patch aims to exploit the following vector multiply high instructions on Power10.
vmulhsw VRT, VRA, VRB
vmulhsd VRT, VRA, VRB
vmulhuw VRT, VRA, VRB
vmulhud VRT, VRA, VRB

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

4 years agoUpstream macCatalyst support in ArchSpec and associated unit tests.
Adrian Prantl [Sat, 25 Jul 2020 00:59:28 +0000 (17:59 -0700)]
Upstream macCatalyst support in ArchSpec and associated unit tests.

4 years ago[PGO] Fix incorrect function entry count
Rong Xu [Sat, 25 Jul 2020 00:39:55 +0000 (17:39 -0700)]
[PGO] Fix incorrect function entry count

Function entry count might be zero after the profile counts reset and
before reentry to the function.

Zero profile entry count is very bad as the profile count from BFI will
be wrong.

A simple fix is to set the profile entry count to 1 if there are
non-zero profile counts in this function.

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

4 years ago[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction
Rong Xu [Sat, 25 Jul 2020 00:38:31 +0000 (17:38 -0700)]
[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction

Skip profile count promotion if any of the ExitBlocks contains a ret
instruction. This is to prevent dumping of incomplete profile -- if the
the loop is a long running loop and dump is called in the middle
of the loop, the result profile is incomplete.

ExitBlocks containing a ret instruction is an indication of a long running
loop -- early exit to error handling code.

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

4 years agoRevert "[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruc...
Rong Xu [Sat, 25 Jul 2020 00:35:44 +0000 (17:35 -0700)]
Revert "[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction"

This reverts commit 6fdc6f6c7d34af60c45c405f448370a684ef6f2a.

4 years agoRevert "[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruc...
Rong Xu [Sat, 25 Jul 2020 00:33:49 +0000 (17:33 -0700)]
Revert "[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction"

This reverts commit 867ef4472d8e57384c929e4f06b74d1ac8883a99.

4 years ago[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction
Rong Xu [Sat, 25 Jul 2020 00:16:25 +0000 (17:16 -0700)]
[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction

Forgot including the tests in the commit 6fdc6f6c7d34af60c4.

4 years ago[PowerPC] Implement Truncate and Store VSX Vector Builtins
Amy Kwan [Fri, 24 Jul 2020 22:41:50 +0000 (17:41 -0500)]
[PowerPC] Implement Truncate and Store VSX Vector Builtins

This patch implements the `vec_xst_trunc` function in altivec.h in  order to
utilize the Store VSX Vector Rightmost [byte | half | word | doubleword] Indexed
instructions introduced in Power10.

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

4 years ago[AArch64][GlobalISel] Use wzr/xzr for 16 and 32 bit stores of zero
Jessica Paquette [Fri, 24 Jul 2020 23:57:37 +0000 (16:57 -0700)]
[AArch64][GlobalISel] Use wzr/xzr for 16 and 32 bit stores of zero

We weren't performing this optimization on 16 and 32 bit stores. SDAG happily
does this though.

e.g. https://godbolt.org/z/cWocKr

This saves about 0.2% in code size on CTMark at -O3.

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

4 years ago[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction
Rong Xu [Sat, 25 Jul 2020 00:13:58 +0000 (17:13 -0700)]
[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction

Skip profile count promotion if any of the ExitBlocks contains a ret
instruction. This is to prevent dumping of incomplete profile -- if the
the loop is a long running loop and dump is called in the middle
of the loop, the result profile is incomplete.

ExitBlocks containing a ret instruction is an indication of a long running
loop -- early exit to error handling code.

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

4 years agoGlobalISel: Define mulfix/divfix opcodes
Matt Arsenault [Sun, 19 Jul 2020 17:09:48 +0000 (13:09 -0400)]
GlobalISel: Define mulfix/divfix opcodes

The full expansion involves the funnel shifts, which depend on another
patch to expand those.

4 years ago[AArch64][GlobalISel] Promote G_UITOFP vector operands to same elt size as result.
Amara Emerson [Fri, 24 Jul 2020 23:43:55 +0000 (16:43 -0700)]
[AArch64][GlobalISel] Promote G_UITOFP vector operands to same elt size as result.

Fixes legalization failures.

4 years ago[lldb] Have LanguageRuntime and SystemRuntime share a base class (NFC)
Jonas Devlieghere [Fri, 24 Jul 2020 23:20:55 +0000 (16:20 -0700)]
[lldb] Have LanguageRuntime and SystemRuntime share a base class (NFC)

LangaugeRuntime and SystemRuntime now both inherit from Runtime.

4 years ago[lldb] Don't wrap and release raw pointer in unique_ptr (NFC)
Jonas Devlieghere [Fri, 24 Jul 2020 22:10:05 +0000 (15:10 -0700)]
[lldb] Don't wrap and release raw pointer in unique_ptr (NFC)

4 years ago[lld-macho] Ignore -dependency_info and its argument
Jez Ng [Fri, 24 Jul 2020 22:55:14 +0000 (15:55 -0700)]
[lld-macho] Ignore -dependency_info and its argument

XCode passes in this flag, which we do not yet implement. Skip
over the argument for now so we can at least successfully parse the
linker invocation.

Reviewed By: #lld-macho, compnerd

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

4 years ago[lld-macho] Partial support for weak definitions
Jez Ng [Fri, 24 Jul 2020 22:55:25 +0000 (15:55 -0700)]
[lld-macho] Partial support for weak definitions

This diff adds support for weak definitions, though it doesn't handle weak
symbols in dylibs quite correctly -- we need to emit binding opcodes for them
in the weak binding section rather than the lazy binding section.

What *is* covered in this diff:

1. Reading the weak flag from symbol table / export trie, and writing it to the
   export trie
2. Refining the symbol table's rules for choosing one symbol definition over
   another. Wrote a few dozen test cases to make sure we were matching ld64's
   behavior.

We can now link basic C++ programs.

Reviewed By: #lld-macho, compnerd

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

4 years agoReapply "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."
Alina Sbirlea [Fri, 10 Apr 2020 01:29:40 +0000 (18:29 -0700)]
Reapply "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."

This is the part of the patch that's moving the Updates to a CFGDiff
object. Splitting off from the clean-up work merging the two branches when BUI is null.

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

4 years ago[compiler-rt][CMake] Remove unused -stdlib when passing -nostdinc++
Jinsong Ji [Fri, 24 Jul 2020 20:55:52 +0000 (20:55 +0000)]
[compiler-rt][CMake] Remove unused -stdlib when passing -nostdinc++

We added -nostdinc++ to clang_rt.profile in https://reviews.llvm.org/D84205.
This will cause warnings when building with LLVM_ENABLE_LIBCXX,
and failure if with Werror on.

This patch is to fix it by removing unused -stdlib,
similar to what we have done in https://reviews.llvm.org/D42238.

Reviewed By: phosek

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

4 years ago[compiler-rt][fuzzer] Disable bcmp.test on darwin
Jon Roelofs [Fri, 24 Jul 2020 20:54:17 +0000 (14:54 -0600)]
[compiler-rt][fuzzer] Disable bcmp.test on darwin

It broke one of the buildbots:

http://lab.llvm.org:8080/green/job/clang-stage1-RA/13026/console

4 years agoAMDGPU: Skip other terminators before inserting s_cbranch_exec[n]z
Matt Arsenault [Thu, 23 Jul 2020 01:24:21 +0000 (21:24 -0400)]
AMDGPU: Skip other terminators before inserting s_cbranch_exec[n]z

PHIElimination/createPHISourceCopy inserts non-branch terminators
after the control flow pseudo if a successor phi reads a register
defined by the control flow pseudo. If this happens, we need to split
the expansion of the control flow pseudo to ensure all the branches
are after all of the other mask management instructions.

GlobalISel hit this in testscases that happened to be tail
duplicated. The original testcase still does not work, since the same
problem appears to be present in a later pass.

4 years ago[CMake] Find zlib when building lldb as standalone
Petr Hosek [Fri, 24 Jul 2020 20:36:13 +0000 (13:36 -0700)]
[CMake] Find zlib when building lldb as standalone

This addresses the issue introduced by 10b1b4a.

4 years agoAdd Debug Info Size to Symbol Status
Yifan Shen [Fri, 24 Jul 2020 20:30:04 +0000 (13:30 -0700)]
Add Debug Info Size to Symbol Status

If a module has debug info, the size of debug symbol will be displayed after the Symbols Loaded Message for each module in the VScode modules view.{F12335461}

Reviewed By: wallace, clayborg

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

4 years agoRevert "Add Debug Info Size to Symbol Status"
Walter Erquinigo [Fri, 24 Jul 2020 20:28:29 +0000 (13:28 -0700)]
Revert "Add Debug Info Size to Symbol Status"

This reverts commit 986e3af53bfe591e88a1ae4f82ea1cc0a15819a3.

It incorrectly deleted clang/tools/clang-format/git-clang-format

4 years agoAdd Debug Info Size to Symbol Status
Yifan Shen [Fri, 24 Jul 2020 19:45:41 +0000 (12:45 -0700)]
Add Debug Info Size to Symbol Status

Summary: If a module has debug info, the size of debug symbol will be displayed after the Symbols Loaded Message for each module in the VScode modules view.{F12335461}

Reviewers: wallace, clayborg

Reviewed By: wallace, clayborg

Subscribers: cfe-commits, aprantl, lldb-commits

Tags: #lldb, #clang

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

4 years ago[AArch64][SVE] Add "fast" fcmp operations.
Eli Friedman [Thu, 23 Jul 2020 19:52:46 +0000 (12:52 -0700)]
[AArch64][SVE] Add "fast" fcmp operations.

dacf8d3 added support for most fcmp operations, but there are some extra
variations I hadn't considered: SelectionDAG supports float comparisons
that are neither ordered nor unordered. Add support for the missing
operations.

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

4 years ago[SROA] Teach promote to register about droppable instructions
Johannes Doerfert [Fri, 24 Jul 2020 19:06:27 +0000 (14:06 -0500)]
[SROA] Teach promote to register about droppable instructions

This is the second of two patches to address PR46753. We basically allow
SROA to promote allocas that are used in doppable instructions, for
now that means `llvm.assume`. The (transitive) uses are replaced by
`undef` in the droppable instructions.

See also D83976.

Reviewed By: Tyker

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

4 years ago[Mem2Reg] Teach promote to register about droppable instructions
Johannes Doerfert [Fri, 24 Jul 2020 18:11:19 +0000 (13:11 -0500)]
[Mem2Reg] Teach promote to register about droppable instructions

This is the first of two patches to address PR46753. We basically allow
mem2reg to promote allocas that are used in doppable instructions, for
now that means `llvm.assume`. The uses of the alloca (or a bitcast or
zero offset GEP from there) are replaced by `undef` in the droppable
instructions.

Reviewed By: Tyker

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

4 years ago[SROA][Mem2Reg] Do not crash on alloca + addrspacecast
Johannes Doerfert [Fri, 24 Jul 2020 18:10:55 +0000 (13:10 -0500)]
[SROA][Mem2Reg] Do not crash on alloca + addrspacecast

SROA knows that it can look through addrspacecast but
PromoteMemoryToRegister did not handle them. This caused an assertion
error for the test case, exposed while running
`Transforms/PhaseOrdering/inlining-alignment-assumptions.ll` with D83978
applied.

Reviewed By: arsenm

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

4 years ago[OpenMP] Use `abort` not `error` for fatal runtime exceptions
Johannes Doerfert [Thu, 16 Jul 2020 21:55:09 +0000 (16:55 -0500)]
[OpenMP] Use `abort` not `error` for fatal runtime exceptions

See PR46515 for the rational but generally, we want to *really* abort
not gracefully shut down.

Reviewed By: grokos, ABataev

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

4 years ago[mlir][shape] Fix missing dependency
Jacques Pienaar [Fri, 24 Jul 2020 20:15:53 +0000 (13:15 -0700)]
[mlir][shape] Fix missing dependency

4 years ago[ASTImporter] Modify ImportDefiniton for ObjCInterfaceDecl so that we always the...
shafik [Fri, 24 Jul 2020 20:11:59 +0000 (13:11 -0700)]
[ASTImporter] Modify ImportDefiniton for ObjCInterfaceDecl so that we always the ImportDeclContext one we start the definition

Once we start the definition of an ObjCInterfaceDecl we won't attempt to ImportDeclContext
later on. Unlike RecordDecl case which uses DefinitionCompleter to force completeDefinition
we don't seem to have a similar mechanism for ObjCInterfaceDecl.

This fix was needed due to a bug we see in LLDB expression parsing where an initial expression
cause an ObjCInterfaceDecl to be defined and subsequent expressions during import do not call
ImportDeclContext and we can end up in a situation where ivars are imported out of order and not all ivars are imported.

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

4 years ago[MSAN] Allow inserting array checks
Gui Andrade [Fri, 24 Jul 2020 20:00:02 +0000 (20:00 +0000)]
[MSAN] Allow inserting array checks

Flattens arrays by ORing together all their elements.

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

4 years ago[libc] [Obvious] Place entrypoints, specs alphabetically.
cgyurgyik [Fri, 24 Jul 2020 19:40:19 +0000 (15:40 -0400)]
[libc] [Obvious] Place entrypoints, specs alphabetically.

4 years agoMake hip math headers easier to use from C
Jon Chesterfield [Fri, 24 Jul 2020 19:50:25 +0000 (20:50 +0100)]
Make hip math headers easier to use from C

Summary:
Make hip math headers easier to use from C

Motivation is a step towards using the hip math headers to implement math.h
for openmp, which needs to work with C as well as C++. NFC for C++ code.

Reviewers: yaxunl, jdoerfert

Reviewed By: yaxunl

Subscribers: sstefan1, cfe-commits

Tags: #clang

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

4 years ago[PowerPC] Fix computation of offset for load-and-splat for permuted loads
Nemanja Ivanovic [Fri, 24 Jul 2020 19:38:27 +0000 (15:38 -0400)]
[PowerPC] Fix computation of offset for load-and-splat for permuted loads

Unfortunately this is another regression from my canonicalization patch
(1fed131660b2). The patch contained two implicit assumptions:
1. That we would have a permuted load only if we are loading a partial vector
2. That a partial vector load would necessarily be as wide as the splat

However, assumption 2 is not correct since it is possible to do a wider
load and only splat a half of it. This patch corrects this assumption by
simply checking if the load is permuted and adjusting the offset if it is.

4 years ago[analyzer] Revert the accidental commit of D82122
Kirstóf Umann [Fri, 24 Jul 2020 17:10:50 +0000 (19:10 +0200)]
[analyzer] Revert the accidental commit of D82122

Was accidentally squished into
rGb6cbe6cb0399d4671e5384dcc326af56bc6bd122. The assert fires on the code
snippet included in this commit.

More discussion can be found in https://reviews.llvm.org/D82598.

4 years ago[MC] [COFF] Make sure that weak external symbols are undefined symbols
Martin Storsjö [Tue, 21 Jul 2020 20:39:37 +0000 (23:39 +0300)]
[MC] [COFF] Make sure that weak external symbols are undefined symbols

For comdats (e.g. caused by -ffunction-sections), Section is already
set here; make sure it's null, for the weak external symbol to be undefined.

This fixes PR46779.

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

4 years ago[llvm-lib] Support adding short import library objects with llvm-lib
Martin Storsjö [Thu, 23 Jul 2020 21:05:55 +0000 (00:05 +0300)]
[llvm-lib] Support adding short import library objects with llvm-lib

This fixes PR 42837.

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

4 years agoRename scoped-noalias -> scoped-noalias-aa
Arthur Eubanks [Fri, 24 Jul 2020 18:54:13 +0000 (11:54 -0700)]
Rename scoped-noalias -> scoped-noalias-aa

Summary: To match NewPM name. Also the new name is clearer and more consistent.

Subscribers: jvesely, nhaehnle, hiraditya, asbirlea, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[lldb] Inform every language runtime of the modified modules
Jonas Devlieghere [Fri, 24 Jul 2020 19:09:36 +0000 (12:09 -0700)]
[lldb] Inform every language runtime of the modified modules

When a process is notified that modules got loaded, currently only
existing language runtimes are given a chance to deal with that. This
means that if the runtime for a given language wasn't needed before it
won't be informed of the module chance.

This is wrong because the module change might be what triggers the need
for a certain runtime. Instead, we should give the language runtime for
every supported language a chance to deal with the modified modules.

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

4 years ago[openmp] Clean up OMPKinds.def remove OMP_DIRECTIVE
Valentin Clement [Fri, 24 Jul 2020 19:06:30 +0000 (15:06 -0400)]
[openmp] Clean up OMPKinds.def remove OMP_DIRECTIVE

This patch removes the OMP_DIRECTIVE definition from OMPKinds.def since they
are now defined in OMP.td and OMP_DIRECTIVE is not used anymore in the code.

Reviewed By: jdenny

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

4 years ago[libc] Adds implementation for memrchr.
cgyurgyik [Fri, 24 Jul 2020 18:31:27 +0000 (14:31 -0400)]
[libc] Adds implementation for memrchr.

Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D84469

4 years ago[AMDGPU] Fix incorrect arch assert while setting up FlatScratchInit
madhur13490 [Thu, 23 Jul 2020 09:48:03 +0000 (09:48 +0000)]
[AMDGPU] Fix incorrect arch assert while setting up FlatScratchInit

Reviewers: arsenm, foad, rampitec, scott.linder

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[X86] Move the implicit enabling of sse2 for 64-bit mode from X86Subtarget::initSubta...
Craig Topper [Fri, 24 Jul 2020 18:10:28 +0000 (11:10 -0700)]
[X86] Move the implicit enabling of sse2 for 64-bit mode from X86Subtarget::initSubtargetFeatures to X86_MC::ParseX86Triple.

ParseX86Triple already checks for 64-bit mode and produces a
static string. We can just add +sse2 to the end of that static
string. This avoids a potential reallocation when appending it
to the std::string at runtime.

This is a slight change to the behavior of tools that only use
MC layer which weren't implicitly enabling sse2 before, but will
now. I don't think we check for sse2 explicitly in any MC layer
components so this shouldn't matter in practice. And if it did
matter the new behavior is more correct.

4 years ago[llvm][sve] Reg + Imm addressing mode for ld1ro.
Francesco Petrogalli [Tue, 7 Jul 2020 19:03:13 +0000 (19:03 +0000)]
[llvm][sve] Reg + Imm addressing mode for ld1ro.

Reviewers: kmclaughlin, efriedma, sdesmalen

Subscribers: tschuett, hiraditya, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[X86] Use X86_MC::ParseX86Triple to add mode features to feature string in X86Subtarg...
Craig Topper [Fri, 24 Jul 2020 17:47:46 +0000 (10:47 -0700)]
[X86] Use X86_MC::ParseX86Triple to add mode features to feature string in X86Subtarget::initSubtargetFeatures.

Remove mode flags from constructor and remove calls to
ToggleFeature for the mode bits.

By adding them to the feature string we handle initializing the
mode member variables in X86Subtarget and the feature bits in
MCSubtargetInfo in one shot.

4 years ago[ARM] Added additional patterns to VABD instruction
Meera Nakrani [Fri, 24 Jul 2020 17:46:25 +0000 (17:46 +0000)]
[ARM] Added additional patterns to VABD instruction

Added extra patterns to VABD instruction so it is selected in place of VSUB and VABS. Added corresponding regression test too.

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

4 years ago[scudo][standalone] Change the release loop for efficiency purposes
Kostya Kortchinsky [Thu, 16 Jul 2020 23:13:04 +0000 (16:13 -0700)]
[scudo][standalone] Change the release loop for efficiency purposes

Summary:
On 32-b, the release algo loops multiple times over the freelist for a size
class, which lead to a decrease in performance when there were a lot of free
blocks.

This changes the release functions to loop only once over the freelist, at the
cost of using a little bit more memory for the release process: instead of
working on one region at a time, we pass the whole memory area covered by all
the regions for a given size class, and work on sub-areas of `RegionSize` in
this large area. For 64-b, we just have 1 sub-area encompassing the whole
region. Of course, not all the sub-areas within that large memory area will
belong to the class id we are working on, but those will just be left untouched
(which will not add to the RSS during the release process).

Reviewers: pcc, cferris, hctim, eugenis

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

4 years ago[NFC][GVN] Improve loadpre-missed-opportunity.ll test again thanks to @fhahn
Roman Lebedev [Fri, 24 Jul 2020 17:31:35 +0000 (20:31 +0300)]
[NFC][GVN] Improve loadpre-missed-opportunity.ll test again thanks to @fhahn

4 years agoTest Commit
Meera Nakrani [Fri, 24 Jul 2020 17:22:56 +0000 (17:22 +0000)]
Test Commit

Test commit - added whitespace in ARMInstrMVE.td

4 years ago[test commit] Add my name to the CREDITS.TXT
biplmish [Fri, 24 Jul 2020 09:30:04 +0000 (04:30 -0500)]
[test commit] Add my name to the CREDITS.TXT

Add my name to the CREDITS.TXT

This is my test commit. (NFC)

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

4 years agodebugserver: Support ios simulator load command disambiguation in qProcessInfo
Adrian Prantl [Fri, 24 Jul 2020 16:43:15 +0000 (09:43 -0700)]
debugserver: Support ios simulator load command disambiguation in qProcessInfo

This patch basically moves the disambiguation code from a place where
it was complicated to implement straight to where the load command is
parsed, which has the neat side affect of actually supporting all call
sites!

rdar://problem/66011909

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

4 years ago[libFuzzer] Disable noasan-memcmp64.test and bcmp.test on Windows.
Dokyung Song [Fri, 24 Jul 2020 16:14:42 +0000 (16:14 +0000)]
[libFuzzer] Disable noasan-memcmp64.test and bcmp.test on Windows.

Summary: This patch disables (i) noasan-memcmp64.test on Windows as libFuzzer's interceptors are only supported on Linux for now, and (ii) bcmp.test as on Windows bcmp is not available in strings.h.

Reviewers: morehouse, hctim, kcc

Subscribers: #sanitizers

Tags: #sanitizers

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