platform/upstream/llvm.git
3 years ago[PhaseOrdering] Update tests after 23c2f2e6b24d.
Florian Hahn [Mon, 7 Jun 2021 09:59:06 +0000 (10:59 +0100)]
[PhaseOrdering] Update tests after 23c2f2e6b24d.

3 years agoASTConcept.h - remove unused <string> include. NFCI.
Simon Pilgrim [Mon, 7 Jun 2021 09:15:45 +0000 (10:15 +0100)]
ASTConcept.h - remove unused <string> include. NFCI.

3 years ago[SimpleLoopBoundSplit] Split Bound of Loop which has conditional branch with IV
Jingu Kang [Thu, 6 May 2021 14:53:00 +0000 (15:53 +0100)]
[SimpleLoopBoundSplit] Split Bound of Loop which has conditional branch with IV

This pass transforms loops that contain a conditional branch with induction
variable. For example, it transforms left code to right code:

                             newbound = min(n, c)
 while (iv < n) {            while(iv < newbound) {
   A                           A
   if (iv < c)                 B
     B                         C
   C                         }
 }                           if (iv != n) {
                               while (iv < n) {
                                 A
                                 C
                               }
                             }

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

3 years ago[Clang] Support a user-defined __dso_handle
Andrew Savonichev [Mon, 24 May 2021 10:29:59 +0000 (13:29 +0300)]
[Clang] Support a user-defined __dso_handle

This fixes PR49198: Wrong usage of __dso_handle in user code leads to
a compiler crash.

When Init is an address of the global itself, we need to track it
across RAUW. Otherwise the initializer can be destroyed if the global
is replaced.

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

3 years ago[LV] Mark increment of main vector loop induction variable as NUW.
Florian Hahn [Mon, 7 Jun 2021 08:24:27 +0000 (09:24 +0100)]
[LV] Mark increment of main vector loop induction variable as NUW.

This patch marks the induction increment of the main induction variable
of the vector loop as NUW when not folding the tail.

If the tail is not folded, we know that End - Start >= Step (either
statically or through the minimum iteration checks). We also know that both
Start % Step == 0 and End % Step == 0. We exit the vector loop if %IV +
%Step == %End. Hence we must exit the loop before %IV + %Step unsigned
overflows and we can mark the induction increment as NUW.

This should make SCEV return more precise bounds for the created vector
loops, used by later optimizations, like late unrolling.

At the moment quite a few tests still need to be updated, but before
doing so I'd like to get initial feedback to make sure I am not missing
anything.

Note that this could probably be further improved by using information
from the original IV.

Attempt of modeling of the assumption in Alive2:
https://alive2.llvm.org/ce/z/H_DL_g

Part of a set of fixes required for PR50412.

Reviewed By: mkazantsev

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

3 years ago[AMDGPU] Fix MC tests for v_fmaak_f16 and v_fmamk_f16
Jay Foad [Fri, 4 Jun 2021 14:49:02 +0000 (15:49 +0100)]
[AMDGPU] Fix MC tests for v_fmaak_f16 and v_fmamk_f16

This looks like a mistake when the tests were committed in r363946.
There were two sets of tests for the f32 variant of these instructions,
instead of one set for f16 and one set for f32.

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

3 years ago[mlir][linalg] Cleanup LinalgOp usage in comprehensive bufferization.
Tobias Gysi [Mon, 7 Jun 2021 08:43:23 +0000 (08:43 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in comprehensive bufferization.

Replace the uses of deprecated Structured Op Interface methods in ComprehensiveBufferize.cpp. This patch is based on https://reviews.llvm.org/D103394.

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

3 years ago[OpenCL] Fix missing addrspace on implicit move assignment operator
Ole Strohm [Mon, 7 Jun 2021 08:34:53 +0000 (09:34 +0100)]
[OpenCL] Fix missing addrspace on implicit move assignment operator

This fixes the missing address space on `this` in the implicit move
assignment operator.
The function called here is an abstraction around the lines that have
been removed which also sets the address space correctly.
This is copied from CopyConstructor, CopyAssignment and MoveConstructor,
all of which use this function, and now MoveAssignment does too.

Fixes: PR50259

Reviewed By: svenvh

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

3 years ago[AMDGPU][Libomptarget] Rework logic for locating kernarg pools
Pushpinder Singh [Thu, 3 Jun 2021 08:58:10 +0000 (08:58 +0000)]
[AMDGPU][Libomptarget] Rework logic for locating kernarg pools

Previous logic was to always use the first kernarg pool found to allocate
kernel args. This patch changes this to use only the kernarg pool which
has non-zero size. This logic is also reworked to not use any globals.

Reviewed By: JonChesterfield

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

3 years agoFixed the build failure of yaml2obj in XCOFFEmitter.cpp:
Esme-Yi [Mon, 7 Jun 2021 05:45:05 +0000 (05:45 +0000)]
Fixed the build failure of yaml2obj in XCOFFEmitter.cpp:
  error: ambiguous overload for 'operator=='
  (operand types are 'llvm::yaml::Hex16' and 'llvm::XCOFF::MagicNumber')
     Is64Bit = Obj.Header.Magic == XCOFF::XCOFF64;

3 years ago[yaml2obj] Initial the support of yaml2obj for 32-bit XCOFF.
Esme-Yi [Mon, 7 Jun 2021 04:14:44 +0000 (04:14 +0000)]
[yaml2obj] Initial the support of yaml2obj for 32-bit XCOFF.

Summary: The patch implements the mapping of the Yaml
information to XCOFF object file to enable the yaml2obj
tool for XCOFF. Currently only 32-bit is supported.

Reviewed By: jhenderson, shchenz

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

3 years ago[lld/mac] Implement support for searching dylibs with @loader_path/ in install name
Nico Weber [Sun, 6 Jun 2021 22:12:27 +0000 (18:12 -0400)]
[lld/mac] Implement support for searching dylibs with @loader_path/ in install name

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

3 years ago[lld/mac] Implement support for searching dylibs with @executable_path/ in install...
Nico Weber [Sun, 6 Jun 2021 20:57:19 +0000 (16:57 -0400)]
[lld/mac] Implement support for searching dylibs with @executable_path/ in install name

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

3 years ago[lld/mac] Rename DylibFile::dylibName to DylibFile::installName
Nico Weber [Sun, 6 Jun 2021 22:25:28 +0000 (18:25 -0400)]
[lld/mac] Rename DylibFile::dylibName to DylibFile::installName

The flag to set it is called `-install_name`, and it's called `installName` in tbd files.

No behavior change.

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

3 years ago[lld/mac] Use fewer magic numbers in magic $ld$ handling code
Nico Weber [Sun, 6 Jun 2021 20:11:25 +0000 (16:11 -0400)]
[lld/mac] Use fewer magic numbers in magic $ld$ handling code

Also simply a conditional and de-alias a variable.
Minor cleanups, no behavior change.

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

3 years ago[dfsan] Use the sanitizer allocator to reduce memory cost
Jianzhou Zhao [Fri, 23 Apr 2021 22:35:25 +0000 (22:35 +0000)]
[dfsan] Use the sanitizer allocator to reduce memory cost

dfsan does not use sanitizer allocator as others. In practice,
we let it use glibc's allocator since tcmalloc needs more work
to be working with dfsan well. With glibc, we observe large
memory leakage. This could relate to two things:

1) glibc allocator has limitation: for example, tcmalloc can reduce memory footprint 2x easily

2) glibc may call unmmap directly as an internal system call by using system call number. so DFSan has no way to release shadow spaces for those unmmap.

Using sanitizer allocator addresses the above issues
1) its memory management is close to tcmalloc

2) we can register callback when sanitizer allocator calls unmmap, so dfsan can release shadow spaces correctly.

Our experiment with internal server-based application proved that with the change, in a-few-day run, memory usage leakage is close to what tcmalloc does w/o dfsan.

This change mainly follows MSan's code.

1) define allocator callbacks at dfsan_allocator.h|cpp

2) mark allocator APIs to be discard

3) intercept allocator APIs

4) make dfsan_set_label consistent with MSan's SetShadow when setting 0 labels, define dfsan_release_meta_memory when unmap is called

5) add flags about whether zeroing memory after malloc/free. dfsan works at byte-level, so bit-level oparations can cause reading undefined shadow. See D96842. zeroing memory after malloc helps this. About zeroing after free, reading after free is definitely UB, but if user code does so, it is hard to debug an overtainting caused by this w/o running MSan. So we add the flag to help debugging.

This change will be split to small changes for review. Before that, a question is
"this code shares a lot of with MSan, for example, dfsan_allocator.* and dfsan_new_delete.*.
Does it make sense to unify the code at sanitizer_common? will that introduce some
maintenance issue?"

Reviewed By: morehouse

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

3 years ago[CostModel][X86] Add 512-bit bswap costs
Simon Pilgrim [Sun, 6 Jun 2021 21:36:26 +0000 (22:36 +0100)]
[CostModel][X86] Add 512-bit bswap costs

3 years ago[CostModel][X86] Add 512-bit bswap cost tests
Simon Pilgrim [Sun, 6 Jun 2021 21:24:34 +0000 (22:24 +0100)]
[CostModel][X86] Add 512-bit bswap cost tests

3 years ago[ARM] MVE tests for vmull from a splat. NFC
David Green [Sun, 6 Jun 2021 21:30:02 +0000 (22:30 +0100)]
[ARM] MVE tests for vmull from a splat. NFC

3 years ago[AArch64] Extra tests for vector shift. NFC
David Green [Sun, 6 Jun 2021 21:29:44 +0000 (22:29 +0100)]
[AArch64] Extra tests for vector shift. NFC

3 years ago[CostModel][X86] Improve AVX512 FDIV costs
Simon Pilgrim [Sun, 6 Jun 2021 20:40:59 +0000 (21:40 +0100)]
[CostModel][X86] Improve AVX512 FDIV costs

Add missing v16f32/v8f64 costs and adjust other costs as well based off the SkylakeServer model

3 years ago[RISCV] Replace && with ||. Spotted by coverity.
Craig Topper [Sun, 6 Jun 2021 19:48:25 +0000 (12:48 -0700)]
[RISCV] Replace && with ||. Spotted by coverity.

We should be exiting when the shift amount is greater than
the bit width regardless of whether it is a power of 2.

Reported by Simon Pilgrim here https://reviews.llvm.org/D96661

This requires getting a shift amount that is out of bounds that
wasn't already optimized by SelectionDAG. This would be pretty
trick to construct a test for.

Or it would require a non-power of 2 shift amount and a mask
that has runs of ones and zeros of the next lowest power of 2 from
that shift amount. I tried a little to produce a test for this,
but didn't get it to work.

3 years ago[X86][SSE] LowerFP_TO_INT - remove dead code. NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 19:00:34 +0000 (20:00 +0100)]
[X86][SSE] LowerFP_TO_INT - remove dead code. NFCI.

Non-Strict v2f32->v2i64 cases have already early-returned to be handled by legalization.

3 years ago[X86][SSE] combineVectorTruncation - simplify PSHUFB-is-better logic. NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 18:53:49 +0000 (19:53 +0100)]
[X86][SSE] combineVectorTruncation - simplify PSHUFB-is-better logic. NFCI.

OutSVT is guaranteed to be i8/i16 and we accept any InSVT that isn't i64

3 years agoRevert "[LoopUnrollAndJam] Change LoopUnrollAndJamPass to LoopNest pass"
maekawatoshiki [Sun, 6 Jun 2021 16:26:47 +0000 (01:26 +0900)]
Revert "[LoopUnrollAndJam] Change LoopUnrollAndJamPass to LoopNest pass"

This reverts commit 21653600034084e8335374ddc1eb8d362158d9a8.

To fix the crash problem in legacy pass manager

3 years ago[Clang][OpenMP] Refactor checking for mutually exclusive clauses. NFC.
Michael Kruse [Sun, 6 Jun 2021 14:18:59 +0000 (09:18 -0500)]
[Clang][OpenMP] Refactor checking for mutually exclusive clauses. NFC.

Multiple clauses are mutually exclusive. This patch refactors the functions that check for pairs of mutually exclusive clauses into a generalized function which also also accepts a list of clause types if which at most one can appear.

NFC patch extracted out of D99459 by request.

Reviewed By: ABataev

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

3 years agoX86MachObjectWriter.cpp - silence null deference warnings. NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 14:33:28 +0000 (15:33 +0100)]
X86MachObjectWriter.cpp - silence null deference warnings. NFCI.

The MCSymbol data should always be present for non-absolute sections so assert that it is to silence static analysis warnings.

3 years ago[TargetLowering] Use IRBuilderBase instead of IRBuilder<> (NFC)
Nikita Popov [Sat, 5 Jun 2021 20:56:19 +0000 (22:56 +0200)]
[TargetLowering] Use IRBuilderBase instead of IRBuilder<> (NFC)

Don't require a specific kind of IRBuilder for TargetLowering hooks.
This allows us to drop the IRBuilder.h include from TargetLowering.h.

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

3 years ago[LexicalScopesTest] Add missing IRBuilder.h include (NFC)
Nikita Popov [Sun, 6 Jun 2021 14:29:00 +0000 (16:29 +0200)]
[LexicalScopesTest] Add missing IRBuilder.h include (NFC)

This currently depends on a transitive include via TargetLowering.h.

3 years agoX86Operand.h - fix uninitialized variable warnings in constructor. NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 14:24:46 +0000 (15:24 +0100)]
X86Operand.h - fix uninitialized variable warnings in constructor. NFCI.

3 years agoAssumeBundleQueries.cpp - don't dereference a dyn_cast<> result. NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 14:05:32 +0000 (15:05 +0100)]
AssumeBundleQueries.cpp - don't dereference a dyn_cast<> result. NFCI.

Use cast<> instead which will assert that the cast is correct and not just return null - the match() should have already failed if the cast isn't valid anyhow.

Fixes static analysis warning.

3 years ago[Clang][OpenMP] Add static version of getSingleClause<ClauseT>. NFC.
Michael Kruse [Sun, 6 Jun 2021 12:28:08 +0000 (07:28 -0500)]
[Clang][OpenMP] Add static version of getSingleClause<ClauseT>. NFC.

The current method getSingleClause requires an instance of OMPExecutableDirective to be called. Introduce a static version taking a list of clauses as argument instead that can be used during parsing/Sema before any OMPExecutableDirective has been created.

This is the same approach as taken for getClausesOfKind for getting more more than a single clause of a type which also has a method and static version. NFC patch extracted out of D99459 by request.

Reviewed By: ABataev

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

3 years ago[TargetLowering] Move methods out of line (NFC)
Nikita Popov [Sun, 6 Jun 2021 13:39:15 +0000 (15:39 +0200)]
[TargetLowering] Move methods out of line (NFC)

Move methods using IRBuilder out of line, so we can drop the
dependency on the header.

3 years ago[CodeGen] Add missing includes (NFC)
Nikita Popov [Sun, 6 Jun 2021 13:47:30 +0000 (15:47 +0200)]
[CodeGen] Add missing includes (NFC)

These currently rely on the IRBuilder.h include in TargetLowering.h.
Make them explicit.

3 years agoSimplifyCFG.cpp - remove dead early-return code added at rGcc63203908da. NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 13:15:11 +0000 (14:15 +0100)]
SimplifyCFG.cpp - remove dead early-return code added at rGcc63203908da. NFCI.

We've already checked that ScanIdx == 0 a few lines above.

3 years agoBreadthFirstIterator.h - fix uninitialized variable warning in default constructor...
Simon Pilgrim [Sun, 6 Jun 2021 13:13:08 +0000 (14:13 +0100)]
BreadthFirstIterator.h - fix uninitialized variable warning in default constructor. NFCI.

3 years agoFix implicit fall through compiler warning. NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 12:45:11 +0000 (13:45 +0100)]
Fix implicit fall through compiler warning. NFCI.

3 years agoPatternMatch.h - wrap WrapFlags tests inside brackets to stop static analysis warning...
Simon Pilgrim [Sun, 6 Jun 2021 12:38:39 +0000 (13:38 +0100)]
PatternMatch.h - wrap WrapFlags tests inside brackets to stop static analysis warning about & vs && usage. NFCI.

3 years agoBPFISelDAGToDAG.cpp - don't dereference a dyn_cast<> result. NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 12:24:02 +0000 (13:24 +0100)]
BPFISelDAGToDAG.cpp - don't dereference a dyn_cast<> result. NFCI.

Use cast<> instead which will assert that the cast is correct and not just return null.

Fixes static analysis warnings.

3 years agoSmallVector.h - remove unused MathExtras.h header. NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 11:05:39 +0000 (12:05 +0100)]
SmallVector.h - remove unused MathExtras.h header. NFCI.

3 years agoFix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 10:09:55 +0000 (11:09 +0100)]
Fix uninitialized variable warnings. NFCI.

3 years agoLibcBenchmark.h - add missing implicit cmath header dependency. NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 09:39:31 +0000 (10:39 +0100)]
LibcBenchmark.h - add missing implicit cmath header dependency. NFCI.

Noticed while investigating if we can remove an unnecessary MathExtras.h include from SmallVector.h

3 years agoDirectoryWatcher-linux.cpp - add missing implicit MathExtras.h header dependency...
Simon Pilgrim [Sun, 6 Jun 2021 08:40:20 +0000 (09:40 +0100)]
DirectoryWatcher-linux.cpp - add missing implicit MathExtras.h header dependency. NFCI.

3 years agoRevert rG0b18c4c0ec03f0321ee83b9976da5777d0e4f53f "SmallVector.h - remove unused...
Simon Pilgrim [Sun, 6 Jun 2021 08:39:19 +0000 (09:39 +0100)]
Revert rG0b18c4c0ec03f0321ee83b9976da5777d0e4f53f "SmallVector.h - remove unused MathExtras.h header (REAPPLIED). NFCI."

Buildbots still seem to find implicit header dependencies that I can't locally....

3 years agoSmallVector.h - remove unused MathExtras.h header (REAPPLIED). NFCI.
Simon Pilgrim [Sun, 6 Jun 2021 08:30:15 +0000 (09:30 +0100)]
SmallVector.h - remove unused MathExtras.h header (REAPPLIED). NFCI.

Try again to remove this header - I think I've found the implicit dependencies (mainly for <cmath>) on linux builds now.

3 years agoRevert "[llvm] Add interface to order inlining"
Liqiang Tao [Sun, 6 Jun 2021 06:45:03 +0000 (14:45 +0800)]
Revert "[llvm] Add interface to order inlining"

3 years ago[llvm] Add interface to order inlining
Liqiang Tao [Sun, 6 Jun 2021 03:49:37 +0000 (11:49 +0800)]
[llvm] Add interface to order inlining

This patch abstract Calls in Inliner:run() to InlineOrder.
With this patch, it's possible to customize the inlining order, i.e. use queue or priority queue.

Reviewed By: kazu

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

3 years agoxray-color-helper.cpp - add missing implicit cmath header dependency. NFCI.
Simon Pilgrim [Sat, 5 Jun 2021 20:32:41 +0000 (21:32 +0100)]
xray-color-helper.cpp - add missing implicit cmath header dependency. NFCI.

Noticed while investigating if we can remove an unnecessary MathExtras.h include from SmallVector.h (necessary for gcc builds but not MSVC)

3 years agoxray-color-helper.h - sort includes. NFCI.
Simon Pilgrim [Sat, 5 Jun 2021 20:31:55 +0000 (21:31 +0100)]
xray-color-helper.h - sort includes. NFCI.

3 years agoBranchProbability.cpp - add missing implicit cmath header dependency. NFCI.
Simon Pilgrim [Sat, 5 Jun 2021 20:14:18 +0000 (21:14 +0100)]
BranchProbability.cpp - add missing implicit cmath header dependency. NFCI.

Noticed while investigating if we can remove an unnecessary MathExtras.h include from SmallVector.h (necessary for gcc builds but not MSVC)

3 years agoRevert rG7b839b3542983a313a9bf9f8d8039ceeea35c4d7 - "SmallVector.h - remove unused...
Simon Pilgrim [Sat, 5 Jun 2021 19:59:10 +0000 (20:59 +0100)]
Revert rG7b839b3542983a313a9bf9f8d8039ceeea35c4d7 - "SmallVector.h - remove unused MathExtras.h header. NFCI."

Breaks on linux buildbots as I seem to have missed some implicit header dependencies....

3 years ago[lld][MachO] Add support for $ld$install_name symbols
Alexander Shaposhnikov [Sat, 5 Jun 2021 19:51:36 +0000 (12:51 -0700)]
[lld][MachO] Add support for $ld$install_name symbols

This diff adds support for $ld$install_name symbols.

Test plan: make check-lld-macho

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

3 years agoSmallVector.h - remove unused MathExtras.h header. NFCI.
Simon Pilgrim [Sat, 5 Jun 2021 19:19:42 +0000 (20:19 +0100)]
SmallVector.h - remove unused MathExtras.h header. NFCI.

3 years ago[AArch64] Remove AArch64ISD::NEG
David Green [Sat, 5 Jun 2021 18:54:42 +0000 (19:54 +0100)]
[AArch64] Remove AArch64ISD::NEG

This NEG node is just a vector negation, easily represented as a SUB
zero. Removing it from the one place it is generated is essentially an
NFC, but can allow some extra folding. The updated tests are now loading
different constant literals, which have already been negated.

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

3 years agoFix "not all control paths return a value" MSVC warning. NFCI.
Simon Pilgrim [Sat, 5 Jun 2021 18:42:00 +0000 (19:42 +0100)]
Fix "not all control paths return a value" MSVC warning. NFCI.

3 years agoBitstreamWriter.h - add missing implicit MathExtras.h header dependency. NFCI.
Simon Pilgrim [Sat, 5 Jun 2021 18:20:14 +0000 (19:20 +0100)]
BitstreamWriter.h - add missing implicit MathExtras.h header dependency. NFCI.

Noticed while investigating if we can remove an unnecessary MathExtras.h include from SmallVector.h

3 years agoELFTypes.h - add missing implicit MathExtras.h header dependency. NFCI.
Simon Pilgrim [Sat, 5 Jun 2021 18:11:40 +0000 (19:11 +0100)]
ELFTypes.h - add missing implicit MathExtras.h header dependency. NFCI.

Noticed while investigating if we can remove an unnecessary MathExtras.h include from SmallVector.h

3 years ago[MCA] Support.h - add missing implicit MathExtras.h header dependency. NFCI.
Simon Pilgrim [Sat, 5 Jun 2021 18:10:49 +0000 (19:10 +0100)]
[MCA] Support.h - add missing implicit MathExtras.h header dependency. NFCI.

Noticed while investigating if we can remove an unnecessary MathExtras.h include from SmallVector.h

3 years agoEndianStream.h - add missing implicit MathExtras.h header dependency. NFCI.
Simon Pilgrim [Sat, 5 Jun 2021 17:04:38 +0000 (18:04 +0100)]
EndianStream.h - add missing implicit MathExtras.h header dependency. NFCI.

Noticed while investigating if we can remove an unnecessary MathExtras.h include from SmallVector.h

3 years agoMsgPackReader.cpp - add missing implicit MathExtras.h header dependency. NFCI.
Simon Pilgrim [Sat, 5 Jun 2021 17:03:37 +0000 (18:03 +0100)]
MsgPackReader.cpp - add missing implicit MathExtras.h header dependency. NFCI.

Noticed while investigating if we can remove an unnecessary MathExtras.h include from SmallVector.h

3 years agoNativeFormatting.cpp - add missing implicit MathExtras.h header dependency. NFCI.
Simon Pilgrim [Sat, 5 Jun 2021 17:02:52 +0000 (18:02 +0100)]
NativeFormatting.cpp - add missing implicit MathExtras.h header dependency. NFCI.

Noticed while investigating if we can remove an unnecessary MathExtras.h include from SmallVector.h

3 years ago[libc++] graph_header_deps.py: Update the computing of "root" (public) headers.
Arthur O'Dwyer [Sat, 5 Jun 2021 16:47:30 +0000 (12:47 -0400)]
[libc++] graph_header_deps.py: Update the computing of "root" (public) headers.

The "root nodes" of the graph are displayed in bold. My intent here
was to bold just the public-API headers, e.g. <vector> and
<experimental/coroutine> and <stdlib.h>, but not helper headers
such as <__functional_base> and <__iterator/next.h>. However,
the recent mass helper-header-ification has exposed defects in
this logic: all the new helpers were ending up bolded! Fix this.
Also, add <__undef_macros> to the list of headers we don't display
by default (like <__config>); it's not interesting to see those edges.

Also, add a sample `dot` command line to the `--help` text.

3 years ago[libc++] Fix result-type and value_type computation in <valarray>.
Arthur O'Dwyer [Mon, 31 May 2021 15:33:51 +0000 (11:33 -0400)]
[libc++] Fix result-type and value_type computation in <valarray>.

The `operator[]` of `_UnaryOp` and `_BinaryOp` returns the result of
calling `__op_`, so its return type should be `__result_type`, not
e.g. `_A0::value_type`. However, `_UnaryOp::value_type` also should
never have been `_A0::value_type`; it needs to be the correct type
for the result of the unary op, e.g. `bool` when the op is `logical_not`.

This turns out to matter when multiple operators are nested, e.g.
`+(v == v)` needs to have a `value_type` of `bool`, not `int`,
even when `v` is of type `valarray<int>`.

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

3 years agoMake TableGenGlobalISel an object library
Aaron Puchert [Sat, 5 Jun 2021 13:04:18 +0000 (15:04 +0200)]
Make TableGenGlobalISel an object library

That's how it was originally intended but that wasn't possible because
we still needed to support older CMake versions.

The problem here is that the sources in TableGenGlobalISel are meant to
be linked into both llvm-tblgen and TableGenTests (a unit test), but not
be part of LLVM proper. So they shouldn't be an ordinary LLVM component.
Because they are used in llvm-tblgen, they can't draw in the LLVM dylib
dependency, but then we'd have to do the same thing in TableGenTests to
make sure we don't link both a static Support library and another copy
through the LLVM dylib.

With an object library we're just reusing the object files and don't
have to care about dependencies at all.

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

3 years ago[libc++][doc] Update Format status.
Mark de Wever [Sat, 5 Jun 2021 11:58:38 +0000 (13:58 +0200)]
[libc++][doc] Update Format status.

The first part of the <format> header patch series is now complete for
review. This updates the status document.

3 years ago[NFC] Promote willNotOverflow() / getStrengthenedNoWrapFlagsFromBinOp() from IndVars...
Roman Lebedev [Tue, 1 Jun 2021 08:33:52 +0000 (11:33 +0300)]
[NFC] Promote willNotOverflow() / getStrengthenedNoWrapFlagsFromBinOp() from IndVars into SCEV proper

We might want to use it when creating SCEV proper in createSCEV(),
now that we don't `forgetValue()` in `SimplifyIndvar::strengthenOverflowingOperation()`,
which might have caused us to loose some optimization potential.

3 years ago[LoopUnroll] Regenerate test checks (NFC)
Nikita Popov [Sat, 5 Jun 2021 08:51:14 +0000 (10:51 +0200)]
[LoopUnroll] Regenerate test checks (NFC)

3 years agoRevert "[LLDB/API] Expose args and env from SBProcessInfo."
Bruce Mitchener [Sat, 5 Jun 2021 08:50:49 +0000 (15:50 +0700)]
Revert "[LLDB/API] Expose args and env from SBProcessInfo."

This reverts commit 8d33437d030af27fff21dd3fd0e66893b0148217.

This broke one of the buildbots.

3 years ago[LoopUnroll] Separate peeling from unrolling
Nikita Popov [Sat, 29 May 2021 16:33:31 +0000 (18:33 +0200)]
[LoopUnroll] Separate peeling from unrolling

Loop peeling is currently performed as part of UnrollLoop().
Outside test scenarios, it is always performed with an unroll
count of 1. This means that unrolling doesn't actually do anything
apart from performing post-unroll simplification.

When testing, it's currently possible to specify both an explicit
peel count and an explicit unroll count. This doesn't perform any
sensible operation and may result in miscompiles, see
https://bugs.llvm.org/show_bug.cgi?id=45939.

This patch moves peeling from UnrollLoop() into tryToUnrollLoop(),
so that peeling does not also perform a susequent unroll. We only
run the post-unroll simplifications. Specifying both an explicit
peel count and unroll count is forbidden.

In the future, we may want to support both (non-PGO) peeling a
loop and unrolling it, but this needs to be done by first performing
the peel and then recalculating unrolling heuristics on a now
possibly analyzable loop.

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

3 years ago[lld][MachO] Fix typo in special-symbol-ld-previous.s
Alexander Shaposhnikov [Sat, 5 Jun 2021 08:27:42 +0000 (01:27 -0700)]
[lld][MachO] Fix typo in special-symbol-ld-previous.s

Fix typo in the test special-symbol-ld-previous.s. NFC.

3 years agoRevert "Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never...
Vitaly Buka [Sat, 5 Jun 2021 07:39:21 +0000 (00:39 -0700)]
Revert "Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtime]|always)."

Windows is still broken.

This reverts commit 927688a4cd9dcde92e8bf430e6ceefac6ab8c8a0.

3 years ago[MC] Add getLSDASection interface
Amir Ayupov [Sat, 5 Jun 2021 07:27:47 +0000 (00:27 -0700)]
[MC] Add getLSDASection interface

This diff adds getLSDASection method to MCObjectFileInfo.

Test plan: make check-all

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

3 years agoUpdate and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtim...
Kevin Athey [Sat, 5 Jun 2021 03:21:01 +0000 (20:21 -0700)]
Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtime]|always).

In addition:
  - optionally add global flag to capture compile intent for UAR:
    __asan_detect_use_after_return_always.
    The global is a SANITIZER_WEAK_ATTRIBUTE.

for issue: https://github.com/google/sanitizers/issues/1394

Reviewed By: vitalybuka

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

3 years agoRevert "[gn build] manually port 60e5243e593e (weak asan symbol)"
Vitaly Buka [Sat, 5 Jun 2021 07:01:37 +0000 (00:01 -0700)]
Revert "[gn build] manually port 60e5243e593e (weak asan symbol)"

Not needed after d8a4a2cb93212c493b7b47663c1cda1103de0bfc.

This reverts commit 00542932fe13ea3b989f40b434399c72f5eca4ec.

3 years ago[LLDB/API] Expose args and env from SBProcessInfo.
Bruce Mitchener [Fri, 4 Jun 2021 08:29:34 +0000 (15:29 +0700)]
[LLDB/API] Expose args and env from SBProcessInfo.

This is another step towards implementing the equivalent of
`platform process list` and related functionality.

`uint32_t` is used for the argument count and index despite the
underlying value being `size_t` to be consistent with other
index-based access to arguments.

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

3 years agoFix some -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off build
Fangrui Song [Sat, 5 Jun 2021 06:34:43 +0000 (23:34 -0700)]
Fix some -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off build

3 years ago[lld][MachO] Add first bits to support special symbols
Alexander Shaposhnikov [Sat, 5 Jun 2021 06:31:40 +0000 (23:31 -0700)]
[lld][MachO] Add first bits to support special symbols

This diff adds first bits to support special symbols $ld$previous* in LLD.
$ld$* symbols modify properties/behavior of the library
(e.g. its install name, compatibility version or hide/add symbols)
for specific target versions.

Test plan: make check-lld-macho

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

3 years ago[NFC][asan] Split fake_stack() into two funcions
Vitaly Buka [Sat, 5 Jun 2021 05:27:45 +0000 (22:27 -0700)]
[NFC][asan] Split fake_stack() into two funcions

3 years ago[NFC][asan] Fix include order
Vitaly Buka [Sat, 5 Jun 2021 06:23:12 +0000 (23:23 -0700)]
[NFC][asan] Fix include order

3 years ago[NFC][memprof] FIx delete[] usage in test
Vitaly Buka [Sat, 5 Jun 2021 06:06:43 +0000 (23:06 -0700)]
[NFC][memprof] FIx delete[] usage in test

3 years ago[NFC][asan] format ThreadStackContainsAddress
Vitaly Buka [Sat, 5 Jun 2021 05:35:06 +0000 (22:35 -0700)]
[NFC][asan] format ThreadStackContainsAddress

3 years ago[NFC][memprof] Compile *.c tests as C
Vitaly Buka [Sat, 5 Jun 2021 06:05:53 +0000 (23:05 -0700)]
[NFC][memprof] Compile *.c tests as C

3 years ago[RISCV] Replace (XLenVT (VLOp GPR:$vl)) with VLOpFrag
Jim Lin [Sat, 5 Jun 2021 04:49:14 +0000 (12:49 +0800)]
[RISCV] Replace (XLenVT (VLOp GPR:$vl)) with VLOpFrag

This is for D100288 to reduce the changes.

Reviewed By: craig.topper

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

3 years ago[Polly] Move MatMul optimization into its own file. NFC.
Michael Kruse [Sat, 5 Jun 2021 04:17:41 +0000 (23:17 -0500)]
[Polly] Move MatMul optimization into its own file. NFC.

Functions shared between generalized matrix-multiplication optimization
and other post-reschedule optimizations (tiling, prevect) are moved into
the schedule tree transformation utility ScheduleTreeTransform.

3 years agoRevert "Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never...
Vitaly Buka [Sat, 5 Jun 2021 03:17:45 +0000 (20:17 -0700)]
Revert "Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtime]|always)."

Reverts commits of D103304, it breaks Darwin.

This reverts commit 60e5243e593ec7e0feca42783edb735e9ac2c4a7.
This reverts commit 26b3ea224e7744058c0053e8eee25a8a3acc9f5d.
This reverts commit 17600ec32a6f3e5720e5232ddb23d67daa650f4d.

3 years ago[lsan] Bump the thread limit from 1<<13 to 1<<22
Fangrui Song [Sat, 5 Jun 2021 03:15:56 +0000 (20:15 -0700)]
[lsan] Bump the thread limit from 1<<13 to 1<<22

This matches asan. Some applications need more than 1<<13 threads.

Reviewed By: vitalybuka

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

3 years ago[NFC][scudo] Fix sign-compare warning in test
Vitaly Buka [Sat, 5 Jun 2021 02:32:24 +0000 (19:32 -0700)]
[NFC][scudo] Fix sign-compare warning in test

3 years ago[NFC][scudo] Convert to TYPED more ScudoCombinedTest
Vitaly Buka [Sat, 5 Jun 2021 02:26:03 +0000 (19:26 -0700)]
[NFC][scudo] Convert to TYPED more ScudoCombinedTest

3 years ago[scudo] Remove ScopedString::Length
Vitaly Buka [Fri, 4 Jun 2021 22:56:13 +0000 (15:56 -0700)]
[scudo] Remove ScopedString::Length

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

3 years ago[Scudo] Improve ScopedString constructor
Vitaly Buka [Fri, 4 Jun 2021 20:48:54 +0000 (13:48 -0700)]
[Scudo] Improve ScopedString constructor

Avoid referencing elements beyond internal vector size.

Reviewed By: cryptoad

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

3 years ago[NFC][scudo] Fix sign-compare warning in test
Vitaly Buka [Sat, 5 Jun 2021 01:22:32 +0000 (18:22 -0700)]
[NFC][scudo] Fix sign-compare warning in test

3 years agoremove windows tests for -asan_use-after-return=always (as this is currently disabled...
Kevin Athey [Fri, 4 Jun 2021 23:58:39 +0000 (16:58 -0700)]
remove windows tests for -asan_use-after-return=always (as this is currently disabled for Windows)

3 years ago[mlir][sparse] add option for 32-bit indices in scatter/gather
Aart Bik [Fri, 4 Jun 2021 23:17:16 +0000 (16:17 -0700)]
[mlir][sparse] add option for 32-bit indices in scatter/gather

Controlled by a compiler option, if 32-bit indices can be handled
with zero/sign-extention alike (viz. no worries on non-negative
indices), scatter/gather operations can use the more efficient
32-bit SIMD version.

Reviewed By: bixia

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

3 years ago[gn build] manually port 60e5243e593e (weak asan symbol)
Nico Weber [Fri, 4 Jun 2021 23:49:29 +0000 (19:49 -0400)]
[gn build] manually port 60e5243e593e (weak asan symbol)

3 years agofix SANITIZE_WINDOWS pragma for https://reviews.llvm.org/rG60e5243e593ec7e0feca42783e...
Kevin Athey [Fri, 4 Jun 2021 23:44:34 +0000 (16:44 -0700)]
fix SANITIZE_WINDOWS pragma for https://reviews.llvm.org/rG60e5243e593ec7e0feca42783edb735e9ac2c4a7

3 years ago[mlir][tosa] Update tosa.rescale for i48 input type
Rob Suderman [Fri, 4 Jun 2021 23:30:46 +0000 (16:30 -0700)]
[mlir][tosa] Update tosa.rescale for i48 input type

i48 integers require slightly tweaked behavior, specifically supporting zero
point offsetting with slightly higher bitdepth. Updated results lowering
appropriately.

Reviewed By: NatashaKnk

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

3 years agoUpdate and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtim...
Kevin Athey [Fri, 4 Jun 2021 21:30:04 +0000 (14:30 -0700)]
Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtime]|always).

In addition:
  - optionally add global flag to capture compile intent for UAR:
    __asan_detect_use_after_return_always.
    The global is a SANITIZER_WEAK_ATTRIBUTE.

for issue: https://github.com/google/sanitizers/issues/1394

Reviewed By: vitalybuka

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

3 years agoRevert "Add memref.dim canonicalization patterns to TilingCanonicalizationPatterns"
Ahmed Taei [Fri, 4 Jun 2021 22:41:19 +0000 (15:41 -0700)]
Revert "Add memref.dim canonicalization patterns to TilingCanonicalizationPatterns"

This reverts commit a52959401d9544ac7037405aaf714bd08f071ea9.

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

3 years ago[ADT] Refactor enumerate unit tests
Scott Linder [Wed, 26 May 2021 20:38:41 +0000 (20:38 +0000)]
[ADT] Refactor enumerate unit tests

Preparation for landing the tests for llvm::makeVisitor, including
breaking out the a "Counted" base class and explicitly testing
the prvalue case as distinct from the rvalue case.

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

3 years ago[X86] AMD Zen 3: double the LoopMicroOpBufferSize
Roman Lebedev [Fri, 4 Jun 2021 22:23:25 +0000 (01:23 +0300)]
[X86] AMD Zen 3: double the LoopMicroOpBufferSize

While the IndVars issue (PR50384) has been resolved,
and the compile performance improved, a new blocker emerged,
the codegen machine instruction scheduling is also quadratic.
So we still can't really specify the right value here.

Filed PR50584.