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

3 years ago[flang] Check for undefined derived types
Peter Steinfeld [Fri, 4 Jun 2021 20:24:19 +0000 (13:24 -0700)]
[flang] Check for undefined derived types

It's possible to specify refer to an undefined derived type as the type of a
component of another derived type and then never define the type of the
component.  We were not detecting this situation.  To fix this, I
changed the value of isForwardReferenced_ in the symbol's
DerivedTypeDetails and checked for it when performing other derived type
checks.

I also had to record the fact that error messages were previously
emitted for the same problem in some cases so that I could avoid
duplicate messages.

I also added a test.

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

3 years ago[flang][OpenMP] Add semantic check to allow only loop iteration variables in a `linea...
Arnamoy Bhattacharyya [Fri, 4 Jun 2021 21:17:49 +0000 (17:17 -0400)]
[flang][OpenMP] Add semantic check to allow only loop iteration variables in a `linear` clause within `distribute` construct.

Implement the following semantic check:

"A list item may not appear in a linear clause, unless it is the loop iteration variable."

Reviewed By: kiranchandramohan

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

3 years ago[Windows SEH]: Fix -O2 crash for Windows -EHa
Ten Tzen [Fri, 4 Jun 2021 21:04:46 +0000 (14:04 -0700)]
[Windows SEH]: Fix -O2 crash for Windows -EHa

This patch fixes a Windows -EHa crash induced by previous commit 797ad701522988e212495285dade8efac41a24d4.
The crash was caused by "LifetimeMarker" scope (with option -O2) that should not be considered as SEH Scope.

This change also turns off -fasync-exceptions by default under -EHa option for now.

Differential Revision: https://reviews.llvm.org/D103664#2799944

3 years ago[OpenMP] Add experimental nesting mode feature
Terry Wilmarth [Mon, 10 May 2021 17:58:39 +0000 (12:58 -0500)]
[OpenMP] Add experimental nesting mode feature

Nesting mode is a new experimental feature in the OpenMP
runtime. It allows a user to set up nesting for an application in a
way that corresponds to the hardware topology levels on the machine an
application is being run on.  For example, if a machine has 2 sockets,
each with 12 cores, then use of nesting mode could set up an outer
level of nesting that uses 2 threads per parallel region, and an inner
level of nesting that uses 12 threads per parallel region.

Nesting mode is controlled with the KMP_NESTING_MODE environment
variable as follows:

1) KMP_NESTING_MODE = 0: Nesting mode is off (default); max-active-levels-var
is set to 1 (the default -- nesting is off, nested parallel regions
are serialized).

2) KMP_NESTING_MODE = 1: Nesting mode is on, and a number of threads
will be assigned for each level discovered in the machine topology;
max-active-levels-var is set to the number of levels discovered.

3) KMP_NESTING_MODE = n, n>1: [Note: this option is experimental and may change
or be removed in the future.] Nesting mode is on, and a number of
threads will be assigned for each topology level discovered on the
machine, up to k<=n levels (since there may be fewer than n levels
discovered in the topology), and beyond the kth level, nested parallel
regions will be serialized; NOTE: max-active-levels-var is 1 (the default --
nesting is off, and nested parallel regions are serialized until the
user changes max-active-levels-var.

If the user sets OMP_NUM_THREADS or OMP_MAX_ACTIVE_LEVELS, they will
override KMP_NESTING_MODE settings for the associated environment
variables. The detected topology may be limited by an affinity mask
setting on the initial thread, or if the user sets KMP_HW_SUBSET. See
also: KMP_HOT_TEAMS_MAX_LEVEL for controlling use of hot teams for
nested parallel regions. Note that this feature only sets numbers of
threads used at nesting levels.  The user should make use of
OMP_PLACES and OMP_PROC_BIND or KMP_AFFINITY for affinitizing those
threads, if desired.

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

3 years ago[scudo] Fix String DCHECK
Kostya Kortchinsky [Fri, 4 Jun 2021 20:38:26 +0000 (13:38 -0700)]
[scudo] Fix String DCHECK

This resolves an issue tripping a `DCHECK`, as I was checking for the
capacity and not the size. We don't need to 0-init the Vector as it's
done already, and make sure we only 0-out the string on clear if it's
not empty.

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

3 years ago[gn build] (semi-manually) port 07c92b2e9581
Nico Weber [Fri, 4 Jun 2021 20:41:35 +0000 (16:41 -0400)]
[gn build] (semi-manually) port 07c92b2e9581

3 years agoAdd memref.dim canonicalization patterns to TilingCanonicalizationPatterns
Ahmed Taei [Fri, 4 Jun 2021 20:31:05 +0000 (13:31 -0700)]
Add memref.dim canonicalization patterns to TilingCanonicalizationPatterns

Otherwise tiled and padded linalg op will be alive (after distribution).

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

3 years agoRegenerate a few tests related to SCEV.
Eli Friedman [Fri, 4 Jun 2021 20:33:29 +0000 (13:33 -0700)]
Regenerate a few tests related to SCEV.

In preparation for https://reviews.llvm.org/D103656

3 years ago[InstrProfiling] If no value profiling, make data variable private and (for Windows...
Fangrui Song [Fri, 4 Jun 2021 20:27:56 +0000 (13:27 -0700)]
[InstrProfiling] If no value profiling, make data variable private and (for Windows) use one comdat

`__profd_*` variables are referenced by code only when value profiling is
enabled. If disabled (e.g. default -fprofile-instr-generate), the symbols just
waste space on ELF/Mach-O. We change the comdat symbol from `__profd_*` to
`__profc_*` because an internal symbol does not provide deduplication features
on COFF. The choice doesn't matter on ELF.

(In -DLLVM_BUILD_INSTRUMENTED_COVERAGE=on build, there is now no `__profd_*` symbols.)

On Windows this enables further optimization. We are no longer affected by the
link.exe limitation: an external symbol in IMAGE_COMDAT_SELECT_ASSOCIATIVE can
cause duplicate definition error.
https://lists.llvm.org/pipermail/llvm-dev/2021-May/150758.html
We can thus use llvm.compiler.used instead of llvm.used like ELF (D97585).
This avoids many `/INCLUDE:` directives in `.drectve`.

Here is rnk's measurement for Chrome:
```
This reduced object file size of base_unittests.exe, compiled with coverage, optimizations, and gmlt debug info by 10%:

#BEFORE

$ find . -iname '*.obj' | xargs du -b | awk '{ sum += $1 } END { print sum}'
1047758867

$ du -cksh base_unittests.exe
82M     base_unittests.exe
82M     total

# AFTER

$ find . -iname '*.obj' | xargs du -b | awk '{ sum += $1 } END { print sum}'
937886499

$ du -cksh base_unittests.exe
78M     base_unittests.exe
78M     total
```

The change is NFC for Mach-O.

Reviewed By: davidxl, rnk

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

3 years agoFix a diagnoses-valid bug with using declarations
Aaron Ballman [Fri, 4 Jun 2021 19:50:44 +0000 (15:50 -0400)]
Fix a diagnoses-valid bug with using declarations

The following was found by a customer and is accepted by the other primary
C++ compilers, but fails to compile in Clang:

namespace sss {
double foo(int, double);
template <class T>
T foo(T); // note: target of using declaration
}  // namespace sss

namespace oad {
void foo();
}

namespace oad {
using ::sss::foo;
}

namespace sss {
using oad::foo; // note: using declaration
}

namespace sss {
double foo(int, double) { return 0; }
template <class T>
T foo(T t) { // error: declaration conflicts with target of using
  return t;
}
}  // namespace sss

I believe the issue is that MergeFunctionDecl() was calling
checkUsingShadowRedecl() but only considering a FunctionDecl as a
possible shadow and not FunctionTemplateDecl. The changes in this patch
largely mirror how variable declarations were being handled by also
catching FunctionTemplateDecl.

3 years ago[scudo] Untag pointer in iterateOverChunks
Vitaly Buka [Sun, 30 May 2021 00:18:17 +0000 (17:18 -0700)]
[scudo] Untag pointer in iterateOverChunks

Pointer comparison in Lambda will not work on tagged pointers.

Reviewed By: pcc

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

3 years ago[scudo] Add memtag_test
Vitaly Buka [Tue, 25 May 2021 04:40:44 +0000 (21:40 -0700)]
[scudo] Add memtag_test

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

3 years ago[scudo] Remove disableMemoryTagChecksTestOnly
Vitaly Buka [Fri, 4 Jun 2021 18:25:47 +0000 (11:25 -0700)]
[scudo] Remove disableMemoryTagChecksTestOnly

And replace with ScopedDisableMemoryTagChecks.

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

3 years ago[mailmap] Add the canonical spelling of my name
Martin Storsjö [Fri, 4 Jun 2021 19:27:18 +0000 (22:27 +0300)]
[mailmap] Add the canonical spelling of my name

3 years ago[IndVars] Don't forget value when inferring nowrap flags
Nikita Popov [Mon, 31 May 2021 19:22:21 +0000 (21:22 +0200)]
[IndVars] Don't forget value when inferring nowrap flags

When SimplifyIndVars infers IR nowrap flags from SCEV, this may
happen in two ways: Either nowrap flags were already present in
SCEV and just get transferred to IR. Or zero/sign extension of
addrecs infers additional nowrap flags, and those get transferred
to IR. In the latter case, calling forgetValue() ensures that the
newly inferred nowrap flags get propagated to any other SCEV
expressions based on the addrec. However, the invalidation can
also have a major compile-time effect in some cases. For
https://bugs.llvm.org/show_bug.cgi?id=50384 with n=512 compile-
time drops from 7.1s to 0.8s without this invalidation. At the
same time, removing the invalidation doesn't affect any codegen
in test-suite.

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

3 years ago[SampleFDO] New hierarchical discriminator for FS SampleFDO (llvm-profdata part)
Rong Xu [Fri, 4 Jun 2021 18:02:11 +0000 (11:02 -0700)]
[SampleFDO] New hierarchical discriminator for FS SampleFDO (llvm-profdata part)

This patch was split from https://reviews.llvm.org/D102246
[SampleFDO] New hierarchical discriminator for Flow Sensitive SampleFDO
This is for llvm-profdata part of change. It sets the bit masks for the
profile reader in llvm-profdata. Also add an internal option
"-fs-discriminator-pass" for show and merge command to process the profile
offline.

This patch also moved setDiscriminatorMaskedBitFrom() to
SampleProfileReader::create() to simplify the interface.

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

3 years ago[flang] CheckConformance: tristate-ify result
peter klausler [Thu, 3 Jun 2021 22:48:16 +0000 (15:48 -0700)]
[flang] CheckConformance: tristate-ify result

To ensure that errors are emitted by CheckConformance and
its callers in all situations, it's necessary for the returned result
of that function to distinguish between three possible
outcomes: the arrays are known to conform at compilation time,
the arrays are known to not conform (and a message has been
produced), and an indeterminate result in which is not possible
to determine conformance.  So convert CheckConformance's
result into an optional<bool>, and convert its confusing
Boolean flag arguments into a bit-set of named flags too.

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

3 years ago[Matrix] Fix transpose-multiply folding if transpose has multiple uses
Adam Nemet [Thu, 3 Jun 2021 15:57:33 +0000 (08:57 -0700)]
[Matrix] Fix transpose-multiply folding if transpose has multiple uses

Don't add it to FusedInsts in this case.

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

3 years ago[profile] Add -fprofile-instr-generate tests for weak definition and various linkages
Fangrui Song [Fri, 4 Jun 2021 17:26:55 +0000 (10:26 -0700)]
[profile] Add -fprofile-instr-generate tests for weak definition and various linkages

3 years ago[scudo] Always exclude Tag 0
Vitaly Buka [Fri, 28 May 2021 09:08:44 +0000 (02:08 -0700)]
[scudo] Always exclude Tag 0

prepareTaggedChunk uses Tag 0 for header.

Android already PR_MTE_TAG_MASK to 0xfffe,
but with the patch we will not need to deppend
on the system configuration.

Reviewed By: pcc

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

3 years ago[OpenCL] Add DWARF address spaces mapping for SPIR
Jason Zheng [Tue, 1 Jun 2021 09:22:00 +0000 (10:22 +0100)]
[OpenCL] Add DWARF address spaces mapping for SPIR

Extend debug info handling by adding DWARF address space mapping for
SPIR, with corresponding test case.

Reviewed By: Anastasia

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

3 years agoCUDA/HIP: Change device-use-host-var.cu's NOT "external" check to include variable...
Konstantin Zhuravlyov [Fri, 4 Jun 2021 12:55:26 +0000 (08:55 -0400)]
CUDA/HIP: Change device-use-host-var.cu's NOT "external" check to include variable name

Otherwise it is causing one of our build jobs to fail,
it is using "external" as directory, and NOT is
failing because "external" is found in ModuleID.

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

3 years ago[AArch64][GlobalISel] Handle multiple phis in fixupPHIOpBanks
Jessica Paquette [Thu, 3 Jun 2021 00:45:58 +0000 (17:45 -0700)]
[AArch64][GlobalISel] Handle multiple phis in fixupPHIOpBanks

If we ended up with two phi instructions in a block, and we needed to fix up
the banks for the first one, we'd end up inserting our COPY before the second
phi.

E.g.

```
%x = G_PHI ...
%fixup = COPY ...
%y = G_PHI ...
```

This is invalid MIR, and breaks assumptions made by the register allocator later
down the line. With the verifier enabled, it also emits a verification error.

This teaches fixupPHIOpBanks to walk past any phi instructions in the block
when emitting the fixup copies.

Here's an example of the crashing code (same as added testcase):
https://godbolt.org/z/h5j1x3o6e

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

3 years ago[libcxx][ranges] Add concepts in range.utility.helpers.
zoecarver [Tue, 1 Jun 2021 21:54:29 +0000 (14:54 -0700)]
[libcxx][ranges] Add concepts in range.utility.helpers.

There are no changes to public APIs.

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

3 years agoAdd commutable attribute to opcodes for ARC
Mark Schimmel [Fri, 4 Jun 2021 16:47:50 +0000 (19:47 +0300)]
Add commutable attribute to opcodes for ARC

This patch sets the isCommutable attribute for several opcodes that have
the "reg = OPCODE reg, reg" format.

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

3 years ago[gn build] Port d31a2e7554ea
LLVM GN Syncbot [Fri, 4 Jun 2021 16:41:04 +0000 (16:41 +0000)]
[gn build] Port d31a2e7554ea

3 years ago[gn build] Port 7ed7d4ccb899
LLVM GN Syncbot [Fri, 4 Jun 2021 16:41:03 +0000 (16:41 +0000)]
[gn build] Port 7ed7d4ccb899

3 years ago[libcxx][ranges] Add `ranges::empty_view`.
zoecarver [Wed, 26 May 2021 21:25:02 +0000 (14:25 -0700)]
[libcxx][ranges] Add `ranges::empty_view`.

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

3 years ago[Attributor] Check HeapToStack's state for isKnownHeapToStack
Joseph Huber [Thu, 3 Jun 2021 00:20:17 +0000 (20:20 -0400)]
[Attributor] Check HeapToStack's state for isKnownHeapToStack

This patch changes the `isKnownHeapToStack` and `isAssumedHeapToStack`
member functions to return if a function call is going to be altered by
HeapToStack.

Reviewed By: jdoerfert

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

3 years ago[libcxx][gardening] Move all algorithms into their own headers.
zoecarver [Thu, 3 Jun 2021 18:26:03 +0000 (11:26 -0700)]
[libcxx][gardening] Move all algorithms into their own headers.

This is a fairly mechanical change, it just moves each algorithm into its own header. This is a NFC.

Note: during this change, I burned down all the includes, so this follows "include only and exactly what you use."

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

3 years ago[Attributor] Allow lookupAAFor to return null on invalid state
Joseph Huber [Wed, 2 Jun 2021 21:32:42 +0000 (17:32 -0400)]
[Attributor] Allow lookupAAFor to return null on invalid state

This patch adds an option to `lookupAAFor` that allows it to return a
nullptr if the state of the looked up attribute is invalid. This is so
future passes can use this to query other attributes with the guarantee
that they are valid.

Reviewed By: jdoerfert

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

3 years ago[OpenMP] fix spelling error in message-converter.pl
Peyton, Jonathan L [Fri, 4 Jun 2021 16:19:27 +0000 (11:19 -0500)]
[OpenMP] fix spelling error in message-converter.pl

3 years ago[RISCV] Teach vsetvli insertion pass that operations on masks don't care about SEW...
Craig Topper [Fri, 4 Jun 2021 15:57:07 +0000 (08:57 -0700)]
[RISCV] Teach vsetvli insertion pass that operations on masks don't care about SEW/LMUL.

All that really matters is that the VLMAX of the preceding
instructions is the same as the VLMAX required by the mask
operation.

Also update the vmsge(u) handling to use the SEW/LMUL we use for
other mask register operations. We were matching it to the compare
before. Some cases will be improve if we fix masked compares to
use tail agnostic policy. I think they ignore the tail policy
anyway.

Reviewed By: frasercrmck

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

3 years ago[clang] use a different name for generated test cdb
Mikhail Goncharov [Fri, 4 Jun 2021 16:10:17 +0000 (18:10 +0200)]
[clang] use a different name for generated test cdb

if build system copied source files as readonly, then override of db_tu.json
will fail