OSDN Git Service

android-x86/external-llvm-project.git
3 years agoReland "[PowerPC] Implement instruction clustering for stores"
Qiu Chaofan [Sun, 13 Sep 2020 11:39:49 +0000 (19:39 +0800)]
Reland "[PowerPC] Implement instruction clustering for stores"

Commit 3c0b3250 introduced store fusion for PowerPC target, but it
brought failure under UB sanitizer and was reverted. This patch fixes
them.

3 years ago[gcov] Fix memory leak due to BranchProbabilityInfoWrapperPass
Fangrui Song [Sun, 13 Sep 2020 07:44:32 +0000 (00:44 -0700)]
[gcov] Fix memory leak due to BranchProbabilityInfoWrapperPass

This is weird.

3 years ago[gcov] Add spanning tree optimization
Fangrui Song [Sun, 13 Sep 2020 07:07:31 +0000 (00:07 -0700)]
[gcov] Add spanning tree optimization

gcov is an "Edge Profiling with Edge Counters" application according to
Optimally Profiling and Tracing Programs (1994).

The minimum number of counters necessary is |E|-(|V|-1). The unmeasured edges
form a spanning tree. Both GCC --coverage and clang -fprofile-generate leverage
this optimization. This patch implements the optimization for clang --coverage.
The produced .gcda files are much smaller now.

3 years ago[gcov] Assign names to some types and loaded values used in @__llvm_internal*
Fangrui Song [Sun, 13 Sep 2020 05:42:37 +0000 (22:42 -0700)]
[gcov] Assign names to some types and loaded values used in @__llvm_internal*

This makes the generated IR much more readable.

3 years ago[llvm-cov gcov] Improve accuracy when some edges are not measured
Fangrui Song [Sun, 13 Sep 2020 05:33:41 +0000 (22:33 -0700)]
[llvm-cov gcov] Improve accuracy when some edges are not measured

Also guard against infinite recursion if GCOV_ARC_ON_TREE edges contain a cycle.

3 years ago[Docs] Fix --print-supported-cpus option rendering
Travis Finkenauer [Sun, 13 Sep 2020 05:26:08 +0000 (05:26 +0000)]
[Docs] Fix --print-supported-cpus option rendering

Adds link/code sample to avoid rendering two dashes as non-ASCII "en dash".
Also make wording a complete sentence.

Reviewed By: nickdesaulniers, tmfink

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

3 years ago[LegalizeTypes] Remove a few cases from SplitVectorOperand that should never happen...
Craig Topper [Sun, 13 Sep 2020 03:54:48 +0000 (20:54 -0700)]
[LegalizeTypes] Remove a few cases from SplitVectorOperand that should never happen. NFC

CTTZ, CTLZ, CTPOP, and FCANONICALIZE all have the same input and
output types so the operand should have already been legalized when the
result type was legalized.

3 years ago[X86] Use ISD::PARITY directly instead of emitting CTPOP and AND from combineHorizont...
Craig Topper [Sun, 13 Sep 2020 01:09:27 +0000 (18:09 -0700)]
[X86] Use ISD::PARITY directly instead of emitting CTPOP and AND from combineHorizontalPredicateResult.

We have a PARITY ISD node now so might as well use it. It will
get re-expanded later.

3 years ago[Hexagon] Avoid widening vectors with non-HVX element types
Krzysztof Parzyszek [Sat, 12 Sep 2020 21:32:24 +0000 (16:32 -0500)]
[Hexagon] Avoid widening vectors with non-HVX element types

3 years ago[gn build] Port cc2da5554b5
LLVM GN Syncbot [Sat, 12 Sep 2020 23:13:20 +0000 (23:13 +0000)]
[gn build] Port cc2da5554b5

3 years ago[lld][WebAssembly] Add initial support for -Map/--print-map
Sam Clegg [Fri, 27 Mar 2020 23:52:27 +0000 (16:52 -0700)]
[lld][WebAssembly] Add initial support for -Map/--print-map

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

3 years ago[ARM] Add tests for fmin/max + inf folds (NFC)
Nikita Popov [Sat, 12 Sep 2020 22:21:39 +0000 (00:21 +0200)]
[ARM] Add tests for fmin/max + inf folds (NFC)

3 years ago[lld][WebAssembly] Error on import/export of mutable global without `mutable-globals...
Sam Clegg [Thu, 23 Jul 2020 22:06:21 +0000 (15:06 -0700)]
[lld][WebAssembly] Error on import/export of mutable global without `mutable-globals` feature

Also add the +mutable-globals features in clang when
building with `-fPIC` since the linker will generate mutable
globals imports and exports in that case.

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

3 years ago[gcov] Process .gcda immediately after the accompanying .gcno instead of doing all...
Fangrui Song [Sat, 12 Sep 2020 20:51:53 +0000 (13:51 -0700)]
[gcov] Process .gcda immediately after the accompanying .gcno instead of doing all .gcda after all .gcno

i.e. change the work flow from

* .gcno for function A
* .gcno for function B
* .gcno for function C
* .gcda for function A
* .gcda for function B
* .gcda for function C

to

* .gcno for function A
* .gcda for function A
* .gcno for function B
* .gcda for function B
* .gcno for function C
* .gcda for function C

Currently there is duplicate logic in .gcno & .gcda processing: how functions
are filtered, which edges are instrumented, etc. This refactor enables simplification.

Since we always process .gcno, in -fprofile-arcs -fno-test-coverage mode,
__llvm_internal_gcov_emit_function_args.0 will have non-zero checksums.

3 years ago[ARM] Add additional vecreduce float legalization test (NFC)
Nikita Popov [Sat, 12 Sep 2020 20:39:39 +0000 (22:39 +0200)]
[ARM] Add additional vecreduce float legalization test (NFC)

3 years agoUpdate TableGen test files to use the new '...' range punctuation.
Paul C. Anagnostopoulos [Fri, 11 Sep 2020 14:26:26 +0000 (10:26 -0400)]
Update TableGen test files to use the new '...' range punctuation.

3 years agoChange range operator from deprecated '-' to '...'
Paul C. Anagnostopoulos [Fri, 11 Sep 2020 13:49:27 +0000 (09:49 -0400)]
Change range operator from deprecated '-' to '...'

3 years agoRevert "[gcov] emitProfileArcs: iterate over GCOVFunction's instead of Function's...
Fangrui Song [Sat, 12 Sep 2020 19:34:43 +0000 (12:34 -0700)]
Revert "[gcov] emitProfileArcs: iterate over GCOVFunction's instead of Function's to avoid duplicated filtering"

This reverts commit 412c9c0bf2a8ccbda2d925575891a51ef5df846e.

3 years ago[gcov] emitProfileArcs: iterate over GCOVFunction's instead of Function's to avoid...
Fangrui Song [Sat, 12 Sep 2020 19:17:40 +0000 (12:17 -0700)]
[gcov] emitProfileArcs: iterate over GCOVFunction's instead of Function's to avoid duplicated filtering

3 years ago[gcov] Clean up by getting llvm.dbg.cu earlier
Fangrui Song [Sat, 12 Sep 2020 19:05:25 +0000 (12:05 -0700)]
[gcov] Clean up by getting llvm.dbg.cu earlier

3 years ago[InstCombine] Add extra use tests for abs canonicalization (NFC)
Nikita Popov [Sat, 12 Sep 2020 18:31:46 +0000 (20:31 +0200)]
[InstCombine] Add extra use tests for abs canonicalization (NFC)

3 years ago[MinGW][libclang] Allow simultaneous shared and static lib
Mateusz Mikuła [Sat, 12 Sep 2020 19:03:22 +0000 (22:03 +0300)]
[MinGW][libclang] Allow simultaneous shared and static lib

It builds fine for MinGW on Windows.

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

3 years ago[MinGW][clang-shlib] Build by default on MinGW
Mateusz Mikuła [Sat, 12 Sep 2020 19:02:11 +0000 (22:02 +0300)]
[MinGW][clang-shlib] Build by default on MinGW

It builds without errors and makes possible to use
CLANG_LINK_CLANG_DYLIB=1.

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

3 years ago[MinGW] Use lib prefix for libraries
Mateusz Mikuła [Sat, 12 Sep 2020 19:00:42 +0000 (22:00 +0300)]
[MinGW] Use lib prefix for libraries

In MinGW world, UNIX like lib prefix is preferred for the libraries.
This patch adjusts CMake files to do that.

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

3 years ago[SelectionDAG][X86][ARM][AArch64] Add ISD opcode for __builtin_parity. Expand it...
Craig Topper [Sat, 12 Sep 2020 18:42:18 +0000 (11:42 -0700)]
[SelectionDAG][X86][ARM][AArch64] Add ISD opcode for __builtin_parity. Expand it to shifts and xors.

Clang emits (and (ctpop X), 1) for __builtin_parity. If ctpop
isn't natively supported by the target, this leads to poor codegen
due to the expansion of ctpop being more complex than what is needed
for parity.

This adds a DAG combine to convert the pattern to ISD::PARITY
before operation legalization. Type legalization is updated
to handled Expanding and Promoting this operation. If after type
legalization, CTPOP is supported for this type, LegalizeDAG will
turn it back into CTPOP+AND. Otherwise LegalizeDAG will emit a
series of shifts and xors followed by an AND with 1.

I've avoided vectors in this patch to avoid more legalization
complexity for this patch.

X86 previously had a custom DAG combiner for this. This is now
moved to Custom lowering for the new opcode. There is a minor
regression in vector-reduce-xor-bool.ll, but a follow up patch
can easily fix that.

Fixes PR47433

Reviewed By: efriedma

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

3 years ago[DSE] Adjust coroutines test after e082dee2b588.
Florian Hahn [Sat, 12 Sep 2020 18:19:49 +0000 (19:19 +0100)]
[DSE] Adjust coroutines test after e082dee2b588.

3 years ago[DSE] Bail out on MemoryPhis when deleting stores at end of function.
Florian Hahn [Sat, 12 Sep 2020 17:57:26 +0000 (18:57 +0100)]
[DSE] Bail out on MemoryPhis when deleting stores at end of function.

When deleting stores at the end of a function, we have to do PHI
translation, otherwise we might miss reads in different iterations of a
loop. See multiblock-loop-carried-dependence.ll for details.

This fixes a mis-compile and surprisingly also increases the number of
eliminated stores from 26047 to 26572 for MultiSource/SPEC2000/SPEC2006
on X86 with -O3 -flto. This is most likely because we save budget by not
exploring through MemoryPhis, which are less likely to result in valid
candidates for elimination.

The issue was reported post-commit for fb109c42d91c.

3 years ago[DSE] Precommit test case with loop carried dependence.
Florian Hahn [Sat, 12 Sep 2020 17:28:57 +0000 (18:28 +0100)]
[DSE] Precommit test case with loop carried dependence.

3 years ago[LV][ARM] Add preferInloopReduction target hook.
David Green [Sat, 12 Sep 2020 16:47:04 +0000 (17:47 +0100)]
[LV][ARM] Add preferInloopReduction target hook.

This allows the backend to tell the vectorizer to produce inloop
reductions through a TTI hook.

For the moment on ARM under MVE this means allowing integer add
reductions of the correct size. In the future this can include integer
min/max too, under -Os.

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

3 years agoTableGen: change a couple of member names to clarify their use.
Paul C. Anagnostopoulos [Sat, 12 Sep 2020 15:50:01 +0000 (11:50 -0400)]
TableGen: change a couple of member names to clarify their use.

3 years ago[InstCombine][X86] Covert masked load/stores with (sign extended) bool vector masks...
Simon Pilgrim [Sat, 12 Sep 2020 14:02:30 +0000 (15:02 +0100)]
[InstCombine][X86] Covert masked load/stores with (sign extended) bool vector masks to generic intrinsics.

As detailed on PR11210, if the mask is known to come from a (sign extended) bool vector (e.g. comparisons) then we can represent with a generic masked load/store without losing anything.

We already do something similar for BLENDV -> SELECT conversion.

3 years ago[Clang] Add option to allow marking pass-by-value args as noalias.
Florian Hahn [Sat, 12 Sep 2020 13:23:36 +0000 (14:23 +0100)]
[Clang] Add option to allow marking pass-by-value args as noalias.

After the recent discussion on cfe-dev 'Can indirect class parameters be
noalias?' [1], it seems like using using noalias is problematic for
current C++, but should be allowed for C-only code.

This patch introduces a new option to let the user indicate that it is
safe to mark indirect class parameters as noalias. Note that this also
applies to external callers, e.g. it might not be safe to use this flag
for C functions that are called by C++ functions.

In targets that allocate indirect arguments in the called function, this
enables more agressive optimizations with respect to memory operations
and brings a ~1% - 2% codesize reduction for some programs.

[1] : http://lists.llvm.org/pipermail/cfe-dev/2020-July/066353.html

Reviewed By: rjmccall

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

3 years ago[MachineScheduler] Fix operand scheduling for pre/post-increment loads
Evgeny Leviant [Sat, 12 Sep 2020 13:53:12 +0000 (16:53 +0300)]
[MachineScheduler] Fix operand scheduling for pre/post-increment loads

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

3 years agoReland [AssumeBundles] Use operand bundles to encode alignment assumptions
Tyker [Sat, 12 Sep 2020 11:36:45 +0000 (13:36 +0200)]
Reland [AssumeBundles] Use operand bundles to encode alignment assumptions

NOTE: There is a mailing list discussion on this: http://lists.llvm.org/pipermail/llvm-dev/2019-December/137632.html

Complemantary to the assumption outliner prototype in D71692, this patch
shows how we could simplify the code emitted for an alignemnt
assumption. The generated code is smaller, less fragile, and it makes it
easier to recognize the additional use as a "assumption use".

As mentioned in D71692 and on the mailing list, we could adopt this
scheme, and similar schemes for other patterns, without adopting the
assumption outlining.

3 years ago[InstCombine][X86] Add tests for masked load/stores with comparisons.
Simon Pilgrim [Sat, 12 Sep 2020 13:31:26 +0000 (14:31 +0100)]
[InstCombine][X86] Add tests for masked load/stores with comparisons.

As detailed on PR11210, if the mask is known to come from a (sign extended) bool vector (e.g. comparisons) then we can represent with a generic masked load/store without losing anything.

3 years ago[ARM] Fixup single source mla reductions.
David Green [Sat, 12 Sep 2020 13:31:26 +0000 (14:31 +0100)]
[ARM] Fixup single source mla reductions.

This fixes a complication on top of D87276. If we are sign extending
around a mul with the two operands that are the same, instcombine will
helpfully convert one of the sext to a zext. Reverse that so that we
again generate a reduction.

Differnetial Revision: https://reviews.llvm.org/D87287

3 years ago[Intrinsics] define semantics for experimental fmax/fmin vector reductions
Sanjay Patel [Sat, 12 Sep 2020 13:08:07 +0000 (09:08 -0400)]
[Intrinsics] define semantics for experimental fmax/fmin vector reductions

As discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2020-April/140729.html

This is hopefully the final remaining showstopper before we can remove
the 'experimental' from the reduction intrinsics.

No behavior was specified for the FP min/max reductions, so we have a
mess of different interpretations.

There are a few potential options for the semantics of these max/min ops.
I think this is the simplest based on current behavior/implementation:
make the reductions inherit from the existing llvm.maxnum/minnum intrinsics.
These correspond to libm fmax/fmin, and those are similar to the (now
deprecated?) IEEE-754 maxNum/minNum functions (NaNs are treated as missing
data). So the default expansion creates calls to libm functions.

Another option would be to inherit from llvm.maximum/minimum (NaNs propagate),
but most targets just crash in codegen when given those nodes because no
default expansion was ever implemented AFAICT.

We could also just assume 'nnan' semantics by default (we are already
assuming 'nsz' semantics in the maxnum/minnum intrinsics), but some targets
(AArch64, PowerPC) support the more defined behavior, so it doesn't make much
sense to not allow a tighter spec. Fast-math-flags (nnan) can be used to
loosen the semantics.

(Note that D67507 was proposed to update the LangRef to acknowledge the more
recent IEEE-754 2019 standard, but that patch seems to have stalled. If we do
update based on the new standard, the reduction instructions can seamlessly
inherit from whatever updates are made to the max/min intrinsics.)

x86 sees a regression here on 'nnan' tests because we have underlying,
longstanding bugs in FMF creation/propagation. Those need to be fixed apart
from this change (for example: https://llvm.org/PR35538). The expansion
sequence before this patch may not have been correct.

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

3 years ago[InstCombine][X86] getNegativeIsTrueBoolVec - use ConstantExpr evaluators. NFCI.
Simon Pilgrim [Sat, 12 Sep 2020 12:51:25 +0000 (13:51 +0100)]
[InstCombine][X86] getNegativeIsTrueBoolVec - use ConstantExpr evaluators. NFCI.

Don't do this manually, we can just use the ConstantExpr evaluators to do it more tidily for us.

3 years ago[ARM] Recognize "double extend" reduction patterns
David Green [Sat, 12 Sep 2020 12:51:42 +0000 (13:51 +0100)]
[ARM] Recognize "double extend" reduction patterns

We can sometimes get code that does:
  xe = zext i16 x to i32
  ye = zext i16 y to i32
  m = mul i32 xe, ye
  me = zext i32 m to i64
  r = vecreduce.add(me)
This "double extend" can trip up the reduction identification, but
should give identical results.

This extends the pattern matching to handle them.

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

3 years ago[InstCombine] Fix incorrect SimplifyWithOpReplaced transform (PR47322)
Nikita Popov [Thu, 10 Sep 2020 10:19:16 +0000 (12:19 +0200)]
[InstCombine] Fix incorrect SimplifyWithOpReplaced transform (PR47322)

This is a followup to D86834, which partially fixed this issue in
InstSimplify. However, InstCombine repeats the same transform while
dropping poison flags -- which does not cover cases where poison is
introduced in some other way.

The fix here is a bit more comprehensive, because things are quite
entangled, and it's hard to only partially address it without
regressing optimization. There are really two changes here:

 * Export the SimplifyWithOpReplaced API from InstSimplify, with an
   added AllowRefinement flag. For replacements inside the TrueVal
   we don't actually care whether refinement occurs or not, the
   replacement is always legal. This part of the transform is now
   done in InstSimplify only. (It should be noted that the current
   AllowRefinement check is not sufficient -- that's an issue we
   need to address separately.)
 * Change the InstCombine fold to work by temporarily dropping
   poison generating flags, running the fold and then restoring the
   flags if it didn't work out. This will ensure that the InstCombine
   fold is correct as long as the InstSimplify fold is correct.

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

3 years ago[X86][SSE] lowerShuffleAsDecomposedShuffleBlend - support decomposed unpacks for...
Simon Pilgrim [Sat, 12 Sep 2020 12:39:33 +0000 (13:39 +0100)]
[X86][SSE] lowerShuffleAsDecomposedShuffleBlend - support decomposed unpacks for some vXi8/vXi16 cases

Follow up to D86429 to handle the remaining regressions.

This patch generalizes lowerShuffleAsDecomposedShuffleBlend to lowerShuffleAsDecomposedShuffleMerge, and attempts to use an UNPCKL shuffle mask instead of a blend for the cases where the inputs are coming from alternating vXi8/vXi16 sources. Technically they don't have to be alternating (just as long as they can fit into a lower lane half for the unpack) but I didn't find as many general cases and it needed a lot more of the function to be altered.

For vXi32/vXi64 cases this could still be beneficial but in most cases the existing permute+blend approach was better.

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

3 years ago[gn build] Port 19531a81f1d
LLVM GN Syncbot [Sat, 12 Sep 2020 10:08:18 +0000 (10:08 +0000)]
[gn build] Port 19531a81f1d

3 years agoRevert "[AST][FPEnv] Keep FP options in trailing storage of CastExpr"
Serge Pavlov [Sat, 12 Sep 2020 10:05:26 +0000 (17:05 +0700)]
Revert "[AST][FPEnv] Keep FP options in trailing storage of CastExpr"

This reverts commit 6c8041aa0ffed827636935e59c489b1e390c8542.
It caused some fails on buildbots.

3 years agoAdd a header file to support ssize_t for windows
Jianzhou Zhao [Sat, 12 Sep 2020 08:49:22 +0000 (08:49 +0000)]
Add a header file to support ssize_t for windows

fixing
https://github.com/llvm/llvm-project/commit/0ece51c60c51f0d4c285dbda3b6cff794041bdd7

3 years agoMissing change from previous commit
Serge Pavlov [Sat, 12 Sep 2020 08:10:09 +0000 (15:10 +0700)]
Missing change from previous commit

3 years agoAdd raw_fd_stream_test.cpp into CMakeLists.txt
Jianzhou Zhao [Sat, 12 Sep 2020 07:48:12 +0000 (07:48 +0000)]
Add raw_fd_stream_test.cpp into CMakeLists.txt

Fixing https://github.com/llvm/llvm-project/commit/0ece51c60c51f0d4c285dbda3b6cff794041bdd7

3 years agoAdd raw_fd_stream that supports reading/seeking/writing
Jianzhou Zhao [Tue, 1 Sep 2020 07:16:07 +0000 (07:16 +0000)]
Add raw_fd_stream that supports reading/seeking/writing

This is used by https://reviews.llvm.org/D86905 to support bitcode
writer's incremental flush.

3 years ago[AST][FPEnv] Keep FP options in trailing storage of CastExpr
Serge Pavlov [Sat, 12 Sep 2020 07:30:44 +0000 (14:30 +0700)]
[AST][FPEnv] Keep FP options in trailing storage of CastExpr

This change allow a CastExpr to have optional FPOptionsOverride object,
stored in trailing storage. Of all cast nodes only ImplicitCastExpr,
CStyleCastExpr, CXXFunctionalCastExpr and CXXStaticCastExpr are allowed
to have FPOptions.

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

3 years ago[Power10] Enable the heuristic for Power10 and switch the sched model
QingShan Zhang [Sat, 12 Sep 2020 02:49:47 +0000 (02:49 +0000)]
[Power10] Enable the heuristic for Power10 and switch the sched model
with P9 Model

Enable the pre-ra and post-ra scheduler strategy for Power10 as we want
to customize the heuristic later. And switch the scheduler model with P9
model before P10 Model is available. The NoSchedModel is modelled as
in-order cpu and the pre-ra scheduler is not bi-directional which will
have big impact on the scheduler.

Reviewed By: jji

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

3 years ago[PowerPC] Set the mayRaiseFPException for FCMPUS/FCMPUD
QingShan Zhang [Sat, 12 Sep 2020 02:42:22 +0000 (02:42 +0000)]
[PowerPC] Set the mayRaiseFPException for FCMPUS/FCMPUD

From ISA, fcmpu will raise the Floating-Point Invalid Operation
Exception (SNaN) if either of the operands is a Signaling NaN by setting
the bit VXSNAN. But the instruction description didn't set the
mayRaiseFPException which might have impact on the scheduling or some
backend optimization.

Reviewed By: qiucf

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

3 years ago[gn build] Port ad99e34c59b
LLVM GN Syncbot [Sat, 12 Sep 2020 01:54:23 +0000 (01:54 +0000)]
[gn build] Port ad99e34c59b

3 years agoRevert "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline"
Yuanfang Chen [Sat, 12 Sep 2020 01:51:54 +0000 (18:51 -0700)]
Revert "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline"

This reverts commit 31ecf8d29d81d196374a562c6d2bd2c25a62861e.
This reverts commit 3fdaa8602a086a3fca5f0fc8527536ac659079d0.

There is laying violation for Target->CodeGen.

3 years ago[gn] Remove unneeded MC dep from llvm-tblgen
Reid Kleckner [Sat, 12 Sep 2020 00:43:49 +0000 (17:43 -0700)]
[gn] Remove unneeded MC dep from llvm-tblgen

Tablegen does not have link time dependencies on MC. Having llvm-tblgen
depend on it causes it to be rebuilt in the gn build every time somebody
touches any cpp file in llvm/lib/MC* or llvm/lib/DebugInfo/Codeview*.
Touching tablegen invalidates most of the rest of the build, and
re-running it takes a while. This is is annoying for me when swapping
between branches that touch CodeView logic.

This dep was added to LLVMBuild.txt back in 2018, and presumably it was
carried over into the gn build.

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

3 years agoFix a couple of tests that relied on the clang binary having 'clang' somewhere in...
David Blaikie [Sat, 12 Sep 2020 00:44:49 +0000 (17:44 -0700)]
Fix a couple of tests that relied on the clang binary having 'clang' somewhere in the name

Because why would that be necessary? (I joke - I hadn't actually
expected this to be an issue but a content-hash-named filesystem means
the clang binary's just a bunch of numbers, and doesn't have 'clang'
anywhere in the name)

3 years ago[lldb] Use GetNonKVOClassDescriptor to get the NSDictionary class descriptor
Jonas Devlieghere [Fri, 11 Sep 2020 20:25:40 +0000 (13:25 -0700)]
[lldb] Use GetNonKVOClassDescriptor to get the NSDictionary class descriptor

On macOS Big Sur the class descriptor contains the NSKVONotifying_
prefix. This is covered by TestDataFormatterObjCKVO.

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

3 years ago[ConstantFold] Make areGlobalsPotentiallyEqual less aggressive.
Eli Friedman [Fri, 4 Sep 2020 03:58:56 +0000 (20:58 -0700)]
[ConstantFold] Make areGlobalsPotentiallyEqual less aggressive.

In particular, we shouldn't make assumptions about globals which are
unnamed_addr: we can fold them together with other globals.

Also while I'm here, use isInterposable() instead of trying to
explicitly name all the different kinds of weak linkage.

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

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

3 years ago[gn build] Port 31ecf8d29d8
LLVM GN Syncbot [Fri, 11 Sep 2020 23:54:25 +0000 (23:54 +0000)]
[gn build] Port 31ecf8d29d8

3 years agoFix a typo in 31ecf8d29d81d196374a562c6d2bd2c25a62861e
Yuanfang Chen [Fri, 11 Sep 2020 23:50:36 +0000 (16:50 -0700)]
Fix a typo in 31ecf8d29d81d196374a562c6d2bd2c25a62861e

3 years ago[NFC] Remove unused static function
Vitaly Buka [Fri, 11 Sep 2020 23:49:20 +0000 (16:49 -0700)]
[NFC] Remove unused static function

3 years ago[ConstantFold] Fold binary arithmetic on scalable vector splats.
Eli Friedman [Wed, 9 Sep 2020 22:22:38 +0000 (15:22 -0700)]
[ConstantFold] Fold binary arithmetic on scalable vector splats.

It's a nice simplification, and it confuses instcombine if we don't do
it.

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

3 years ago[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline
Yuanfang Chen [Fri, 11 Sep 2020 22:56:27 +0000 (15:56 -0700)]
[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline

Following up on D67687.
Please refer to the RFC here http://lists.llvm.org/pipermail/llvm-dev/2020-July/143309.html

`CodeGenPassBuilder` is the NPM counterpart of `TargetPassConfig` with below differences.
- Debugging features (MIR print/verify, disable pass, start/stop-before/after, etc.) living in `TargetPassConfig` are moved to use PassInstrument as much as possible. (Implementation also lives in `TargetPassConfig.cpp`)
- `TargetPassConfig` is a polymorphic base (virtual inheritance) to build the target-dependent pipeline whereas `CodeGenPassBuilder` is the CRTP base/helper to implement the target-dependent pipeline. The motivation is flexibility for targets to customize the pipeline, inlining opportunity, and fits the overall NPM value semantics design.
- `TargetPassConfig` is a legacy immutable pass to declare hooks for targets to customize some target-independent codegen layer behavior. This is partially ported to TargetMachine::options. The rest, such as `createMachineScheduler/createPostMachineScheduler`, are left out for now. They should be implemented in LLVMTargetMachine in the future.

Reviewed By: arsenm

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

3 years ago[NFC][Asan] Add another lsan test
Vitaly Buka [Fri, 11 Sep 2020 21:22:54 +0000 (14:22 -0700)]
[NFC][Asan] Add another lsan test

3 years ago[MS ABI] Add mangled type for auto template parameter whose argument kind is Integeral
Zequan Wu [Fri, 11 Sep 2020 00:45:16 +0000 (17:45 -0700)]
[MS ABI] Add mangled type for auto template parameter whose argument kind is Integeral

3 years ago[lldb] Add test for CFMutableDictionaryRef
Jonas Devlieghere [Fri, 11 Sep 2020 21:33:55 +0000 (14:33 -0700)]
[lldb] Add test for CFMutableDictionaryRef

While writing a test for a change in Foundation I noticed we didn't yet
test CFMutableDictionaryRef.

3 years agoFix clang Wrange-loop-analysis in BuildTree.cpp
Dmitri Gribenko [Fri, 11 Sep 2020 23:07:54 +0000 (01:07 +0200)]
Fix clang Wrange-loop-analysis in BuildTree.cpp

Building on Mac OS with clang 12:

```
jhemphill@jhemphill-mbp build % clang --version
Apple clang version 12.0.0 (clang-1200.0.26.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
```

yields one warning:

```
/Users/jhemphill/oss/llvm-project/clang/lib/Tooling/Syntax/BuildTree.cpp:1126:22: warning: loop variable 'Arg' is always a copy because the range of type 'llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr *, clang::Stmt *> >' does not return a reference [-Wrange-loop-analysis]
    for (const auto &Arg : Args) {
                     ^
/Users/jhemphill/oss/llvm-project/clang/lib/Tooling/Syntax/BuildTree.cpp:1126:10: note: use non-reference type 'clang::Expr *'
    for (const auto &Arg : Args) {
```

It appears that `Arg` is an `Expr*`, passed by value rather than by const reference.

Reviewed By: eduucaldas, gribozavr2

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

3 years ago[NFC][Asan] Early return from GetBlockBegin
Vitaly Buka [Fri, 11 Sep 2020 20:45:07 +0000 (13:45 -0700)]
[NFC][Asan] Early return from GetBlockBegin

3 years ago[MC] Allow .org directives in SHT_NOBITS sections
Fangrui Song [Fri, 11 Sep 2020 22:12:15 +0000 (15:12 -0700)]
[MC] Allow .org directives in SHT_NOBITS sections

This is used by kvm-unit-tests and can be trivially supported.

3 years agodocs: add a newline to appease Sphinx
Saleem Abdulrasool [Fri, 11 Sep 2020 22:08:38 +0000 (22:08 +0000)]
docs: add a newline to appease Sphinx

Sphinx expects an empty newline after the bulleted list.

3 years agoRegAllocFast: Fix typo in comment
Matt Arsenault [Tue, 25 Aug 2020 20:07:35 +0000 (16:07 -0400)]
RegAllocFast: Fix typo in comment

3 years agoCodeGen: Require SSA to run PeepholeOptimizer
Matt Arsenault [Fri, 28 Aug 2020 23:51:33 +0000 (19:51 -0400)]
CodeGen: Require SSA to run PeepholeOptimizer

3 years agoFix test hip-gz-options.hip
Yaxun (Sam) Liu [Fri, 11 Sep 2020 21:56:28 +0000 (17:56 -0400)]
Fix test hip-gz-options.hip

3 years ago[lld][WebAssembly] Convert a objyaml-using test to assembly
Sam Clegg [Fri, 11 Sep 2020 18:22:31 +0000 (11:22 -0700)]
[lld][WebAssembly] Convert a objyaml-using test to assembly

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

3 years agoSema: add support for `__attribute__((__swift_error__))`
Saleem Abdulrasool [Tue, 8 Sep 2020 21:19:43 +0000 (21:19 +0000)]
Sema: add support for `__attribute__((__swift_error__))`

Introduce a new attribute that is used to indicate the error handling
convention used by a function.  This is used to translate the error
semantics from the decorated interface to a compatible Swift interface.

The supported error convention is one of:
- none: no error handling
- nonnull_error: a non-null error parameter indicates an error signifier
- null_result: a return value of NULL is an error signifier
- zero_result: a return value of 0 is an error signifier
- nonzero_result: a non-zero return value is an error signifier

Since this is the first of the attributes needed to support the semantic
annotation for Swift, this change also includes the necessary supporting
infrastructure for a new category of attributes (Swift).

This is based on the work of the original changes in
https://github.com/llvm/llvm-project-staging/commit/8afaf3aad2af43cfedca7a24cd817848c4e95c0c

Differential Revision: https://reviews.llvm.org/D87331
Reviewed By: John McCall, Aaron Ballman, Dmitri Gribenko

3 years agoFix -gz=zlib options for linker
Yaxun (Sam) Liu [Tue, 8 Sep 2020 17:45:45 +0000 (13:45 -0400)]
Fix -gz=zlib options for linker

gcc translates -gz=zlib to --compress-debug-options=zlib for both assembler and linker
but clang only does this for assembler.

The linker needs --compress-debug-options=zlib option to compress the debug sections
in the generated executable or shared library.

Due to this bug, -gz=zlib has no effect on the generated executable or shared library.

This patch fixes that.

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

3 years agoRe-apply "[ORC] Make MaterializationResponsibility immovable..." with fixes.
Lang Hames [Fri, 11 Sep 2020 16:23:14 +0000 (09:23 -0700)]
Re-apply "[ORC] Make MaterializationResponsibility immovable..." with fixes.

Re-applies c74900ca672 with fixes for the ThinLtoJIT example.

3 years ago[SyntaxTree][Synthesis] Add support for Tree.
Eduardo Caldas [Fri, 11 Sep 2020 15:59:22 +0000 (15:59 +0000)]
[SyntaxTree][Synthesis] Add support for Tree.

In a future patch
* Implement helper function to generate Trees for tests
* and test Tree methods, namely `findFirstLeaf` and `findLastLeaf`

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

3 years ago[Coroutine][Sema] Tighten the lifetime of symmetric transfer returned handle
Xun Li [Fri, 11 Sep 2020 20:34:03 +0000 (13:34 -0700)]
[Coroutine][Sema] Tighten the lifetime of symmetric transfer returned handle

In generating the code for symmetric transfer, a temporary object is created to store the returned handle from await_suspend() call of the awaiter. Previously this temp won't be cleaned up until very later, which ends up causing this temp to be spilled to the heap. However, we know that this temp will no longer be needed after the coro_resume call. We can clean it up right after.

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

3 years ago[ThinLTO] Make -lto-embed-bitcode an enum
Mircea Trofin [Thu, 10 Sep 2020 19:16:26 +0000 (12:16 -0700)]
[ThinLTO] Make -lto-embed-bitcode an enum

The current behavior of -lto-embed-bitcode is not quite the same as that
of -fembed-bitcode. While both populate .llvmbc with bitcode, the latter
populates it with pre-optimized bitcode(*), while the former with
post-optimized. The scenarios driving them are different - the latter's
goal is to allow re-compilation, while the former, IIUC, is execution.

I plan to add a third mode for thinlto cases, closely-related to
-fembed-bitcode's scenario: adding the bitcode pre-optimization, but
post-merging. This would allow re-compilation without requiring the
other .bc files that were merged (akin to how -fembed-bitcode allows
recompilation without all the .h files)

The third mode can't co-exist with the current -lto-embed-bitcode mode,
because the latter would overwrite it. For clarity, we change
-lto-embed-bitcode to be an enum.

(*) That's the compiler semantics. The driver splits compilation in 2
phases, so if -fembed-bitcode is given to the driver, the .llvmbc is
optimized bitcode; if the option is passed to the compiler (after -cc1),
the section is pre-optimized.

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

3 years agoRe-split integral & pointer overloads. Add tests.
Olivier Giroux [Fri, 11 Sep 2020 19:13:35 +0000 (12:13 -0700)]
Re-split integral & pointer overloads. Add tests.

3 years ago[flang] Fix bug for forward referenced type
Peter Steinfeld [Fri, 11 Sep 2020 18:02:04 +0000 (11:02 -0700)]
[flang] Fix bug for forward referenced type

A type name in an IMPLICIT declaration that was later used in a PARAMETER
statement caused problems because the default symbol scope had not yet been
initialized.  I avoided dereferencing in the situation where the default scope
was uninitialized and added a test that triggers the problem.

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

3 years ago[SyntaxTree] Add const qualifiers, from [llvm-qualified-auto]
Eduardo Caldas [Fri, 11 Sep 2020 16:33:18 +0000 (16:33 +0000)]
[SyntaxTree] Add const qualifiers, from [llvm-qualified-auto]

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

3 years ago[SyntaxTree] Reduce visibility of `Arena::lexBuffer`.
Eduardo Caldas [Fri, 11 Sep 2020 13:13:19 +0000 (13:13 +0000)]
[SyntaxTree] Reduce visibility of `Arena::lexBuffer`.

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

3 years ago[SyntaxTree][Synthesis] Add support for simple Leafs and test based on tree dump
Eduardo Caldas [Thu, 10 Sep 2020 17:54:54 +0000 (17:54 +0000)]
[SyntaxTree][Synthesis] Add support for simple Leafs and test based on tree dump

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

3 years ago[CMake][OpenMP] Simplify getting CUDA library directory
Raul Tambre [Sat, 5 Sep 2020 15:27:04 +0000 (18:27 +0300)]
[CMake][OpenMP] Simplify getting CUDA library directory

LLVM now requires CMake 3.13.4 so we can simplify this.

Reviewed By: phosek

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

3 years ago[WebAssembly] Add assembly syntax for mutable globals
Sam Clegg [Fri, 11 Sep 2020 14:20:40 +0000 (07:20 -0700)]
[WebAssembly] Add assembly syntax for mutable globals

This adds and optional ", immutable" to the end of a `.globaltype`
declaration.  I would have prefered to match the `.wat` syntax
where immutable is the default and `mut` is the signifier for
mutable globals.  Sadly changing the default would break backwards
compat with existing assembly in the wild so I think its best
to stick with this approach.

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

3 years ago[lldb/API] Add Breakpoint::SerializeToStructuredData to SBAPI
Med Ismail Bennani [Fri, 11 Sep 2020 18:09:44 +0000 (20:09 +0200)]
[lldb/API] Add Breakpoint::SerializeToStructuredData to SBAPI

This patch adds a way to fetch breakpoint metadatas as a serialized
`Structured` Data format (JSON). This can be used by IDEs to update
their UI when a breakpoint is set or modified from the console.

rdar://11013798

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[mlir] Fix some edge cases around 0-element TensorFromElementsOp
Sean Silva [Fri, 11 Sep 2020 05:04:58 +0000 (22:04 -0700)]
[mlir] Fix some edge cases around 0-element TensorFromElementsOp

This introduces a builder for the more general case that supports zero
elements (where the element type can't be inferred from the ValueRange,
since it might be empty).

Also, fix up some cases in ShapeToStandard lowering that hit this. It
happens very easily when dealing with shapes of 0-D tensors.

The SameOperandsAndResultElementType is redundant with the new
TypesMatchWith and prevented having zero elements.

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

3 years ago[mlir][spirv] OpConvertSToF support operands with different bitwidth.
Xin Wang [Fri, 11 Sep 2020 17:39:00 +0000 (10:39 -0700)]
[mlir][spirv] OpConvertSToF support operands with different bitwidth.

close SameBitWidth check in verifier.

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

3 years ago[SVE] Regenerate sve vector bits tests. NFC
David Green [Fri, 11 Sep 2020 17:51:57 +0000 (18:51 +0100)]
[SVE] Regenerate sve vector bits tests. NFC

3 years ago[ARM] Extra MLA reductions tests. NFC
David Green [Fri, 11 Sep 2020 16:51:15 +0000 (17:51 +0100)]
[ARM] Extra MLA reductions tests. NFC

3 years ago[FPEnv] [Clang] Enable constrained FP support for PowerPC
Qiu Chaofan [Fri, 11 Sep 2020 16:37:36 +0000 (00:37 +0800)]
[FPEnv] [Clang] Enable constrained FP support for PowerPC

d4ce862f introduced HasStrictFP to disable generating constrained FP
operations for platforms lacking support. Since work for enabling
constrained FP on PowerPC is almost done, we'd like to enable it.

Reviewed By: kpn, steven.zhang

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

3 years agoRevert "[examples] Adjust ThinLtoInstrumentationLayer for emit signature change"
Jonas Devlieghere [Fri, 11 Sep 2020 16:22:42 +0000 (09:22 -0700)]
Revert "[examples] Adjust ThinLtoInstrumentationLayer for emit signature change"

I raced with Florian and he had already reverted the original patch.

3 years ago[ELF][PowerPC] Define NOP as 0x60000000 to tidy up code. NFC
Fangrui Song [Thu, 10 Sep 2020 21:37:11 +0000 (14:37 -0700)]
[ELF][PowerPC] Define NOP as 0x60000000 to tidy up code. NFC

Reviewed By: nemanjai

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

3 years ago[DFSan] Re-enable event_callbacks test.
Matt Morehouse [Fri, 11 Sep 2020 16:13:34 +0000 (09:13 -0700)]
[DFSan] Re-enable event_callbacks test.

Mark the dest pointers for memcpy and memmove as volatile, to avoid dead
store elimination.  Fixes https://bugs.llvm.org/show_bug.cgi?id=47488.

3 years ago[docs] Fix typos
YangZhihui [Fri, 11 Sep 2020 15:51:36 +0000 (17:51 +0200)]
[docs] Fix typos

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

3 years ago[SLP] further limit bailout for load combine candidate (PR47450)
Sanjay Patel [Fri, 11 Sep 2020 15:47:23 +0000 (11:47 -0400)]
[SLP] further limit bailout for load combine candidate (PR47450)

The test example based on PR47450 shows that we can
match non-byte-sized shifts, but those won't ever be
bswap opportunities. This isn't a full fix (we'd still
match if the shifts were by 8-bits for example), but
this should be enough until there's evidence that we
need to do more (this is a borderline case for
vectorization in the first place).

3 years ago[SLP] add test for missed store vectorization; NFC
Sanjay Patel [Fri, 11 Sep 2020 15:33:41 +0000 (11:33 -0400)]
[SLP] add test for missed store vectorization; NFC

3 years ago[libcxx] Remove the 'availability' Lit feature
Louis Dionne [Fri, 11 Sep 2020 15:05:22 +0000 (11:05 -0400)]
[libcxx] Remove the 'availability' Lit feature

Instead, use with_system_cxx_lib with various compile-only tests to ensure
that we're getting compile-time errors, as expected. This follows the
lead of ec46cfefe80d5.

3 years ago[examples] Adjust ThinLtoInstrumentationLayer for emit signature change
Jonas Devlieghere [Fri, 11 Sep 2020 15:32:55 +0000 (08:32 -0700)]
[examples] Adjust ThinLtoInstrumentationLayer for emit signature change

Emit now takes a std::unique_ptr<MaterializationResponsibility> instead
of a MaterializationResponsibility directly.

This should fix:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-standalone/

3 years ago[gn build] slightly improve libcxx_needs_site_config
Nico Weber [Fri, 11 Sep 2020 15:32:17 +0000 (11:32 -0400)]
[gn build] slightly improve libcxx_needs_site_config

The write_cmake_config() here still looks busted, but at least
the value that's explicitly set is now set correctly.