platform/upstream/llvm.git
3 years ago[lldb] [Process/FreeBSDRemote] Enable watchpoint support
Michał Górny [Fri, 23 Oct 2020 16:08:56 +0000 (18:08 +0200)]
[lldb] [Process/FreeBSDRemote] Enable watchpoint support

Replace the inline x86 watchpoint handling code with the reusable
NativeRegisterContextWatchpoint_x86.  Implement watchpoint support
in NativeThreadFreeBSD and SIGTRAP handling for watchpoints.

Un-skip all concurrent_events tests as they pass with the new plugin.

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

3 years agoRevert "[IndVars] Remove monotonic checks with unknown exit count"
Raphael Isemann [Tue, 27 Oct 2020 12:37:23 +0000 (13:37 +0100)]
Revert "[IndVars] Remove monotonic checks with unknown exit count"

This reverts commit c6ca26c0bfedb8f80d6f8cb9adde25b1d6aac1c5.
This breaks stage2 builds due to hitting this assert:
```
   Assertion failed: (WeightSum <= UINT32_MAX && "Expected weights to scale down to 32 bits"), function calcMetadataWeights
```
when compiling AArch64RegisterBankInfo.cpp in LLVM.

3 years agoRevert "[NFC] Factor away lambda's redundant parameter"
Raphael Isemann [Tue, 27 Oct 2020 12:37:16 +0000 (13:37 +0100)]
Revert "[NFC] Factor away lambda's redundant parameter"

This reverts commit fdc845b36130d162e5a66e427bf69b2c37b6c6bb.
It seems to be a follow-up to c6372b3fb495 which will be reverted.

3 years agoFix use-after-scope introduced in 850325348ae82cd5e26ea9edfd04219d0fbe7828
Alex Richardson [Tue, 27 Oct 2020 14:26:23 +0000 (14:26 +0000)]
Fix use-after-scope introduced in 850325348ae82cd5e26ea9edfd04219d0fbe7828

3 years ago[amdgpu] Enable use of AA during codegen.
Michael Liao [Mon, 12 Oct 2020 03:51:53 +0000 (23:51 -0400)]
[amdgpu] Enable use of AA during codegen.

- Add an internal option `-amdgpu-use-aa-in-codegen` to enable or
  disable this feature. By Default, it's enabled.

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

3 years agoRevert rG0905bd5c2fa42bd4c "[InstCombine] collectBitParts - add trunc support."
Simon Pilgrim [Tue, 27 Oct 2020 13:43:29 +0000 (13:43 +0000)]
Revert rG0905bd5c2fa42bd4c "[InstCombine] collectBitParts - add trunc support."

This reverts commit 0905bd5c2fa42bd4c0e6e0aaa08b966f165b9dfa.

Causing failures in multistage buildbots that I need to investigate

3 years ago[X86] Don't crash on CVTPS2PH with wide vector inputs.
Benjamin Kramer [Tue, 27 Oct 2020 13:34:26 +0000 (14:34 +0100)]
[X86] Don't crash on CVTPS2PH with wide vector inputs.

3 years ago[X86] Regenerate all-ones vector tests with common prefixes.
Simon Pilgrim [Tue, 27 Oct 2020 13:35:00 +0000 (13:35 +0000)]
[X86] Regenerate all-ones vector tests with common prefixes.

3 years agoRevert "Use uint64_t for branch weights instead of uint32_t"
Nico Weber [Tue, 27 Oct 2020 13:18:42 +0000 (09:18 -0400)]
Revert "Use uint64_t for branch weights instead of uint32_t"

This reverts commit e5766f25c62c185632e3a75bf45b313eadab774b.
Makes clang assert when building Chromium, see https://crbug.com/1142813
for a repro.

3 years ago[clang] RewriteObjCClassMetaData - remove superfluous null pointer check. NFCI.
Simon Pilgrim [Tue, 27 Oct 2020 13:14:40 +0000 (13:14 +0000)]
[clang] RewriteObjCClassMetaData - remove superfluous null pointer check. NFCI.

We've already dereferenced the pointer and no other getClassInterface() calls appear to bother with such a check.

Reported as "Snippet 6" in https://www.viva64.com/en/b/0771/

3 years ago[MallocChecker] Remove duplicate QCoreApplication::postEvent check. NFCI.
Simon Pilgrim [Tue, 27 Oct 2020 12:21:33 +0000 (12:21 +0000)]
[MallocChecker] Remove duplicate QCoreApplication::postEvent check. NFCI.

This appears to have been in the original patch in D14170.

Reported as "Snippet 11" in https://www.viva64.com/en/b/0771/

3 years ago[X86] Regenerate vector shift tests. NFCI.
Simon Pilgrim [Tue, 27 Oct 2020 12:13:53 +0000 (12:13 +0000)]
[X86] Regenerate vector shift tests. NFCI.

Merge prefixes where possible, use 'X86' instead of 'X32' (which we try to only use for gnux32 triple tests).

3 years ago[InstCombine] collectBitParts - add trunc support.
Simon Pilgrim [Mon, 26 Oct 2020 16:22:46 +0000 (16:22 +0000)]
[InstCombine] collectBitParts - add trunc support.

This should allow us to remove the rather limited matchOrConcat fold and just use recognizeBSwapOrBitReverseIdiom.

3 years agoFix for PR47544. Clang is crashing after generating the right
Zahira Ammarguellat [Tue, 27 Oct 2020 12:51:02 +0000 (05:51 -0700)]
Fix for PR47544. Clang is crashing after generating the right
diagnostic for a re-declaration of a friend method.d
https://reviews.llvm.org/D88112

3 years ago[NFC][IntrRefLDV] Some code clean up
Djordje Todorovic [Mon, 26 Oct 2020 14:04:14 +0000 (07:04 -0700)]
[NFC][IntrRefLDV] Some code clean up

As reading the source code, I've found some minor nits:
  -Use using instead of typedef
  -Fix a comment
  -Refactor

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

3 years ago[TargetLowering] Add i1 condition for bit comparison fold
Sven van Haastregt [Tue, 27 Oct 2020 12:21:40 +0000 (12:21 +0000)]
[TargetLowering] Add i1 condition for bit comparison fold

For i1 types, boolean false is represented identically regardless of
the boolean content, so we can allow optimizations that otherwise
would not be correct for booleans with false represented as a negative
one.

Patch by Erik Hogeman.

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

3 years ago[gn build] Port 850325348ae
LLVM GN Syncbot [Tue, 27 Oct 2020 12:17:41 +0000 (12:17 +0000)]
[gn build] Port 850325348ae

3 years agoFix sancov.py when objdump is llvm-objdump
Alex Richardson [Tue, 27 Oct 2020 10:07:27 +0000 (10:07 +0000)]
Fix sancov.py when objdump is llvm-objdump

The sanitizer-coverage.cpp test case was always failing for me. It turns
out the reason for this is that I was building with
-DLLVM_INSTALL_BINUTILS_SYMLINKS=ON and sancov.py's grep regex does not
handle llvm-objdump's disassembly format (hex immediates have a leading "0x").
While touching those lines also change them to use raw string literals since
invalid escape sequnces will become an error in future python versions.
Also simplify the code by using subprocess.check_output() instead of Popen().
This also works with python2.

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

Reviewed By: #sanitizers, vitalybuka

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

3 years ago[clang-format] Fix misformatted macro definitions after D86959
Alex Richardson [Tue, 27 Oct 2020 10:05:55 +0000 (10:05 +0000)]
[clang-format] Fix misformatted macro definitions after D86959

After D86959 the code `#define lambda [](const decltype(x) &ptr) {}`
was formatted as `#define lambda [](const decltype(x) & ptr) {}` due to
now parsing the '&' token as a BinaryOperator. The problem was caused by
the condition `Line.InPPDirective && (!Left->Previous || !Left->Previous->is(tok::identifier))) {`
being matched and therefore not performing the checks for "previous token
is one of decltype/_Atomic/etc.". This patch moves those checks after the
existing if/else chain to ensure the left-parent token classification is
always run after checking whether the contents of the parens is an
expression or not.

This change also introduces a new TokenAnnotatorTest that checks the
token kind and Role of Tokens after analyzing them. This is used to check
for TT_PointerOrReference, in addition to indirectly testing this based
on the resulting formatting.

Reviewed By: MyDeveloperDay

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

3 years ago[ValueTracking][NFC] Use Log2(Align) instead of countTrailingZeroes
Alex Richardson [Tue, 27 Oct 2020 09:56:19 +0000 (09:56 +0000)]
[ValueTracking][NFC] Use Log2(Align) instead of countTrailingZeroes

The latter can probably be optimized to the same final code, but this might
help -O0 builds.

3 years ago[ValueTracking] Add more tests for alignment assume bundles
Alex Richardson [Tue, 20 Oct 2020 10:41:54 +0000 (11:41 +0100)]
[ValueTracking] Add more tests for alignment assume bundles

I noticed that alignment was no longer inferred as well after I last merged
our CHERI fork from upstream. I opened this review before seeing that D88669
already fixes the same problem, so this commit simply adds the new test that
I added as part of this change.

Reviewed By: jdoerfert

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

3 years ago[ValueTracking] Add tracking of the alignment assume bundle
Shimin Cui [Tue, 27 Oct 2020 09:49:41 +0000 (09:49 +0000)]
[ValueTracking] Add tracking of the alignment assume bundle

This patch is to add the support of the value tracking of the alignment assume bundle.

Reviewed By: jdoerfert

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

3 years agomsgpack: Improve error for empty node
Sebastian Neubauer [Tue, 27 Oct 2020 10:30:01 +0000 (11:30 +0100)]
msgpack: Improve error for empty node

3 years ago[lldb] Correct vFile:pread/pwrite packet docs
David Spickett [Wed, 14 Oct 2020 11:18:05 +0000 (12:18 +0100)]
[lldb] Correct vFile:pread/pwrite packet docs

The statement that lldb-server can handle
decimal and hex numbers is misleading.
(it can only handle hex with 0x prefix)

Mentioning non decimal numbers at all
is just creating more confusion for anyone
who tries to use them with lldb-server.

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

3 years ago[InstCombine] Fold `(X >>? C1) << C2` patterns to shift+bitmask (PR37872)
Roman Lebedev [Tue, 27 Oct 2020 09:17:53 +0000 (12:17 +0300)]
[InstCombine] Fold `(X >>? C1) << C2` patterns to shift+bitmask (PR37872)

This is essentially finalizes a revert of rL155136,
because nowadays the situation has improved, SCEV can model
all these patterns well, and we canonicalize rotate-like patterns
into a funnel shift intrinsics in InstCombine.
So this should not cause any pessimization.

I've verified the canonicalize-{a,l}shr-shl-to-masking.ll transforms
with alive, which confirms that we can freely preserve exact-ness,
and no-wrap flags.

Profs:
* base: https://rise4fun.com/Alive/gPQ
* exact-ness preservation: https://rise4fun.com/Alive/izi
* nuw preservation: https://rise4fun.com/Alive/DmD
* nsw preservation: https://rise4fun.com/Alive/SLN6N
* nuw nsw preservation: https://rise4fun.com/Alive/Qp7

Refs. https://reviews.llvm.org/D46760

3 years ago[NFC][PhaseOrdering] Autogenerate basic.ll test
Roman Lebedev [Tue, 27 Oct 2020 10:47:08 +0000 (13:47 +0300)]
[NFC][PhaseOrdering] Autogenerate basic.ll test

3 years ago[NFC][InstCombine] Autogenerate cast.ll test
Roman Lebedev [Tue, 27 Oct 2020 10:46:28 +0000 (13:46 +0300)]
[NFC][InstCombine] Autogenerate cast.ll test

3 years ago[NFC][InstCombine] Add more exhaustive test coverage for `(x >>? X1) << C2` pattern...
Roman Lebedev [Tue, 27 Oct 2020 09:13:11 +0000 (12:13 +0300)]
[NFC][InstCombine] Add more exhaustive test coverage for `(x >>? X1) << C2` pattern (PR37872)

3 years ago[VE] Add vector float instructions
Kazushi (Jam) Marukawa [Mon, 26 Oct 2020 15:47:02 +0000 (00:47 +0900)]
[VE] Add vector float instructions

Add VFAD/VFSB/VFMP/VFDV/VFSQRT/VFCP/VFCM/VFMAD/VFMSB/VFNMAD/VFNMSB/
VRCP/VRSQRT/VRSQRTNEX/VFIX/VFIXX/VFLT/VFLTX/VCVS/VCVD instructions.
Add regression tests too.  Also add additional AsmParser for VFIX
and VFIXX instructions to parse their mnemonic.

Reviewed By: simoll

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

3 years ago[VE] Add missing regression test
Kazushi (Jam) Marukawa [Mon, 26 Oct 2020 16:00:21 +0000 (01:00 +0900)]
[VE] Add missing regression test

In the previous "Add vector shift instructions", I forgot to add
regression tests for VSRL and VSRD instructions.  This patch is
adding them.

Reviewed By: simoll

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

3 years ago[clangd] Separate final_result into a different message
Kirill Bobyrev [Tue, 27 Oct 2020 10:45:48 +0000 (11:45 +0100)]
[clangd] Separate final_result into a different message

This is a breaking change in remote index protocol.

Reviewed By: sammccall

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

3 years ago[clang][Basic] Integrate SourceLocation with FoldingSet, NFCI
Mikhail Maltsev [Tue, 27 Oct 2020 10:43:39 +0000 (10:43 +0000)]
[clang][Basic] Integrate SourceLocation with FoldingSet, NFCI

This patch removes the necessity to access the SourceLocation internal
representation in several places that use FoldingSet objects.

Reviewed By: dexonsmith

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

3 years ago[llvm-readelf] - Implement --section-details option.
Georgii Rymar [Tue, 13 Oct 2020 07:46:04 +0000 (10:46 +0300)]
[llvm-readelf] - Implement --section-details option.

--section-details/-t is a GNU readelf option that produce
an output that is an alternative to --sections.

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

3 years ago[llvm/DebugInfo] Simplify DW_OP_implicit_value condition (NFC)
Med Ismail Bennani [Tue, 27 Oct 2020 10:24:16 +0000 (11:24 +0100)]
[llvm/DebugInfo] Simplify DW_OP_implicit_value condition (NFC)

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[AMDGPU] Use DPP instead of Ext in a couple of class names. NFC.
Jay Foad [Tue, 27 Oct 2020 09:52:17 +0000 (09:52 +0000)]
[AMDGPU] Use DPP instead of Ext in a couple of class names. NFC.

3 years ago[lldb][NFC] Rewrite TestQuoting
Raphael Isemann [Tue, 27 Oct 2020 09:37:26 +0000 (10:37 +0100)]
[lldb][NFC] Rewrite TestQuoting

TestQuoting's different test methods all build their own test binaries but
we can just reuse the same test binary by merging all asserts into one method.
This reduces the test runtime from 8 seconds to 4 seconds on my machine.
This also removes the ability to have partial failures in this test, but given
how rarely this code is touched this seems like a fair tradeoff (and we will be
able to re-add this feature once we updated our test framework).

Some other small changes:
  * Fixed that we cleanup "stdout.txt" instead of "output.txt" in the cleanup.
  * Fixed some formatting issues.
  * Call `build` instead of directly calling `buildDefault`.

3 years ago[yaml2obj] - Add a way to override the sh_addralign field of a section.
Georgii Rymar [Fri, 23 Oct 2020 09:50:48 +0000 (12:50 +0300)]
[yaml2obj] - Add a way to override the sh_addralign field of a section.

Imagine the following declaration of a section:
```
Sections:
  - Name:         .dynsym
    Type:         SHT_DYNSYM
    AddressAlign: 0x1111111111111111
```

The aligment is large and yaml2obj reports an error currently:
"the desired output size is greater than permitted. Use the --max-size option to change the limit"

This patch implements the "ShAddrAlign" key, which is similar to other "Sh*" keys we have.
With it it is possible to override the `sh_addralign` field, ignoring the writing of alignment bytes.

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

3 years ago[LoopRotation] Allow loop header duplication if vectorization is forced.
Florian Hahn [Tue, 27 Oct 2020 08:59:18 +0000 (08:59 +0000)]
[LoopRotation] Allow loop header duplication if vectorization is forced.

-Oz normally does not allow loop header duplication so this loop wouldn't be
vectorized.  However the vectorization pragma should override this and allow
for loop rotation.

rdar://problem/49281061

Original patch by Adam Nemet.

Reviewed By: Meinersbur

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

3 years ago[ARM][AArch64] Add VLDN shuffled interleaving tests. NFC
David Green [Tue, 27 Oct 2020 09:27:32 +0000 (09:27 +0000)]
[ARM][AArch64] Add VLDN shuffled interleaving tests. NFC

3 years ago[mlir] use OpBuilderDAG instead of OpBuilder
Alex Zinenko [Fri, 23 Oct 2020 13:30:21 +0000 (15:30 +0200)]
[mlir] use OpBuilderDAG instead of OpBuilder

A recent commit introduced a new syntax for specifying builder arguments in
ODS, which is better amenable to automated processing, and deprecated the old
form. Transition all dialects as well as Linalg ODS generator to use the new
syntax.

Add a deprecation notice to ODS generator.

Reviewed By: rriddle, jpienaar

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

3 years agoCorrect examples after d3205bbca3e0002d76282878986993e7e7994779
Tyker [Tue, 27 Oct 2020 08:46:06 +0000 (09:46 +0100)]
Correct examples after d3205bbca3e0002d76282878986993e7e7994779

3 years ago[clang][RecoveryExpr] Add tests for ObjectiveC.
Haojian Wu [Tue, 27 Oct 2020 08:42:19 +0000 (09:42 +0100)]
[clang][RecoveryExpr] Add tests for ObjectiveC.

to demonstrate it works for some cases.

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

3 years agoUpdating llvm.mlir test to match recent IR change
Kiran Chandramohan [Tue, 27 Oct 2020 08:15:28 +0000 (08:15 +0000)]
Updating llvm.mlir test to match recent IR change

Recent change updated branch weights to use i64 instead of i32.
Updating llvm.mlir test to match this change.
https://reviews.llvm.org/D88609

3 years ago[clangd] Fix proto deps, for real this time.
Sam McCall [Tue, 27 Oct 2020 08:15:12 +0000 (09:15 +0100)]
[clangd] Fix proto deps, for real this time.

This is ugly (layering violation) but we can clean it up once we know it
works in CI.

3 years ago[Test] One more range check test
Max Kazantsev [Tue, 27 Oct 2020 07:50:00 +0000 (14:50 +0700)]
[Test] One more range check test

3 years ago[Syntax] Disallow invalid Node operations
Sam McCall [Mon, 26 Oct 2020 15:44:36 +0000 (16:44 +0100)]
[Syntax] Disallow invalid Node operations

Copy/move break invariants (move could be fixed).
Node/Tree should have no public constructors, they're abstract.
Destructor is private to enforce arena allocation.

(Making the constructor of all subclasses private doesn't seem worthwhile)

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

3 years ago[X86] Alternate implementation of D88194.
Craig Topper [Tue, 27 Oct 2020 07:20:03 +0000 (00:20 -0700)]
[X86] Alternate implementation of D88194.

This uses PreprocessISelDAG to replace the constant before
instruction selection instead of matching opcodes after.

Reviewed By: pengfei

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

3 years ago[X86] Encode global address in small code model
Wei Wang [Fri, 23 Oct 2020 05:54:16 +0000 (22:54 -0700)]
[X86] Encode global address in small code model

In small code model, program and its symbols are linked in the lower 2 GB of
the address space. Try encoding global address even when the range is unknown
in such case.

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

3 years ago[mlir] Fix TypeID lookup in GDB pretty printers.
Christian Sigg [Mon, 26 Oct 2020 21:13:59 +0000 (22:13 +0100)]
[mlir] Fix TypeID lookup in GDB pretty printers.

The TypeID instance was moved in D89153.

It wasn't caught that it broke MLIR pretty printers because pre-merge checks don't run check-debuginfo.

Avoid disabling all MLIR printers in case this happens again by catching the exception.

Reviewed By: stellaraccident

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

3 years ago[NFC] Factor away lambda's redundant parameter
Max Kazantsev [Tue, 27 Oct 2020 05:55:17 +0000 (12:55 +0700)]
[NFC] Factor away lambda's redundant parameter

3 years ago[clangd] Increase the TooMany limit for index-based textual navigation to 5
Nathan Ridge [Sun, 26 Apr 2020 04:45:51 +0000 (00:45 -0400)]
[clangd] Increase the TooMany limit for index-based textual navigation to 5

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

3 years ago[libTooling] Recognize sccache as a compiler wrapper in compilation database commands
Nathan Ridge [Sun, 4 Oct 2020 05:07:20 +0000 (01:07 -0400)]
[libTooling] Recognize sccache as a compiler wrapper in compilation database commands

sccache is a compiler caching tool similar to ccache.

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

3 years ago[GVN LoadPRE] Add an option to disable splitting backedge
Serguei Katkov [Tue, 20 Oct 2020 10:32:08 +0000 (17:32 +0700)]
[GVN LoadPRE] Add an option to disable splitting backedge

GVN Load PRE can split the backedge causing breaking the loop structure where the latch
contains the conditional branch with for example induction variable.

Different optimizations expect this form of the loop, so it is better to preserve it for some time.
This CL adds an option to control an ability to split backedge.

Default value is true so technically it is NFC and current behavior is not changed.

Reviewers: fedor.sergeev, mkazantsev, nikic, reames, fhahn
Reviewed By: mkazasntsev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D89854

3 years ago[IndVars] Remove monotonic checks with unknown exit count
Max Kazantsev [Tue, 27 Oct 2020 04:35:16 +0000 (11:35 +0700)]
[IndVars] Remove monotonic checks with unknown exit count

Even if the exact exit count is unknown, we can still prove that this
exit will not be taken. If we can prove that the predicate is monotonic,
fulfilled on first & last iteration, and no overflow happened in between,
then the check can be removed.

Differential Revision: https://reviews.llvm.org/D87832
Reviewed By: apilipenko

3 years ago[Clang][OpenMP] Avoid unnecessary privatization of mapper array when there is no...
Shilei Tian [Tue, 27 Oct 2020 04:02:23 +0000 (00:02 -0400)]
[Clang][OpenMP] Avoid unnecessary privatization of mapper array when there is no user defined mapper

In current implementation, if it requires an outer task, the mapper array will be privatized no matter whether it has mapper. In fact, when there is no mapper, the mapper array only contains number of nullptr. In the libomptarget, the use of mapper array is `if (mappers_array && mappers_array[i])`, which means we can directly set mapper array to nullptr if there is no mapper. This can avoid unnecessary data copy.

In this patch, the data privatization will not be emitted if the mapper array is nullptr. When it comes to the emit of task body, the nullptr will be used directly.

Reviewed By: jdoerfert

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

3 years agoFix calls to (p)read on macOS when size > INT32_MAX
Jonas Devlieghere [Tue, 27 Oct 2020 03:31:33 +0000 (20:31 -0700)]
Fix calls to (p)read on macOS when size > INT32_MAX

On macOS, the read and pread syscalls return EINVAL when the number of
bytes to read exceeds INT32_MAX:

https://github.com/apple/darwin-xnu/blob/a449c6a3b8014d9406c2ddbdc81795da24aa7443/bsd/kern/sys_generic.c#L355

rdar://68751407

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

3 years agoReland [AlwaysInliner] Pass callee AAResults to InlineFunction()
Arthur Eubanks [Sat, 17 Oct 2020 00:21:12 +0000 (17:21 -0700)]
Reland [AlwaysInliner] Pass callee AAResults to InlineFunction()

Test copied from noalias-calls.ll with small changes.

Reviewed By: asbirlea

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

3 years agoUse uint64_t for branch weights instead of uint32_t
Arthur Eubanks [Wed, 30 Sep 2020 19:11:46 +0000 (12:11 -0700)]
Use uint64_t for branch weights instead of uint32_t

CallInst::updateProfWeight() creates branch_weights with i64 instead of i32.
To be more consistent everywhere and remove lots of casts from uint64_t
to uint32_t, use i64 for branch_weights.

Reviewed By: davidxl

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

3 years agoRevert "[AlwaysInliner] Pass callee AAResults to InlineFunction()"
Arthur Eubanks [Tue, 27 Oct 2020 03:23:18 +0000 (20:23 -0700)]
Revert "[AlwaysInliner] Pass callee AAResults to InlineFunction()"

This reverts commit 504fbec7a61cdfbb5f6e1b25cf14afe5195ccaf6.

Test failure.

3 years ago[CostModel][X86] teach TTI calculate cost of chain of vector inserts/extracts more...
Bing1 Yu [Tue, 27 Oct 2020 02:34:07 +0000 (10:34 +0800)]
[CostModel][X86] teach TTI calculate cost of chain of vector inserts/extracts more precisely and correctly:In each 128-lane, if there is at least one index is demanded and not all indices are demanded...

In each 128-lane, if there is at least one index is demanded and not all
indices are demanded and this 128-lane is not the first 128-lane of the
legalized-vector, then this 128-lane needs a extracti128;
If in each 128-lane, there is at least one index is demanded, this 128-lane
needs a inserti128.

The following cases will help you build a better understanding:
Assume we insert several elements into a v8i32 vector in avx2,
Case#1: inserting into 1th index needs vpinsrd + inserti128
Case#2: inserting into 5th index needs extracti128 + vpinsrd +
inserti128
Case#3: inserting into 4,5,6,7 index needs 4*vpinsrd + inserti128.

Reviewed By: pengfei, RKSimon

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

3 years ago[AlwaysInliner] Pass callee AAResults to InlineFunction()
Arthur Eubanks [Sat, 17 Oct 2020 00:21:12 +0000 (17:21 -0700)]
[AlwaysInliner] Pass callee AAResults to InlineFunction()

Test copied from noalias-calls.ll with small changes.

Reviewed By: asbirlea

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

3 years ago[PlaceSafepoints] Pin tests to legacy PM
Arthur Eubanks [Mon, 26 Oct 2020 20:21:39 +0000 (13:21 -0700)]
[PlaceSafepoints] Pin tests to legacy PM

This pass isn't used in tree and can be ported to the NPM later on if desired.

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

3 years agoPort -objc-arc-expand to NPM
Arthur Eubanks [Mon, 26 Oct 2020 18:59:23 +0000 (11:59 -0700)]
Port -objc-arc-expand to NPM

Reviewed By: asbirlea

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

3 years agoPort -objc-arc-apelim to NPM
Arthur Eubanks [Mon, 26 Oct 2020 18:46:30 +0000 (11:46 -0700)]
Port -objc-arc-apelim to NPM

Reviewed By: asbirlea

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

3 years ago[mlir][SymbolTable] Use Identifier instead of StringRef when looking up symbol name...
River Riddle [Tue, 27 Oct 2020 02:31:10 +0000 (19:31 -0700)]
[mlir][SymbolTable] Use Identifier instead of StringRef when looking up symbol name attributes

Using an Identifier is much more efficient for attribute lookups because it uses pointer comparison as opposed to string comparison.

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

3 years ago[mlir][StorageUniquer] Refactor parametric storage to use sharded dense sets
River Riddle [Tue, 27 Oct 2020 02:31:04 +0000 (19:31 -0700)]
[mlir][StorageUniquer] Refactor parametric storage to use sharded dense sets

This revisions implements sharding in the storage of parametric instances to decrease lock contention by sharding out the allocator/mutex/etc. to use for a specific storage instance based on the hash key. This is a somewhat common approach to reducing lock contention on data structures, and is used by the concurrent hashmaps provided by folly/java/etc. For several compilations tested, this removed all/most lock contention from profiles and reduced compile time by several seconds.

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

3 years ago[Clang][OpenMP] Fixed an issue of segment fault when using target nowait
Shilei Tian [Tue, 27 Oct 2020 02:32:18 +0000 (22:32 -0400)]
[Clang][OpenMP] Fixed an issue of segment fault when using target nowait

The implementation of target nowait just wraps the target region into a task. The essential four parameters (base ptr, ptr, size, mapper) are taken as firstprivate such that they will be copied to the private location. When there is no user-defined mapper, the mapper variable will be nullptr. However, it will be still copied to the corresponding place. Therefore, a memcpy will be generated and the source pointer will be nullptr, causing a segmentation fault. The root cause is when calling `emitOffloadingArraysArgument`, the last argument `Options` has a field about whether it requires a task. It only takes depend clause into account. In this patch, the nowait clause is also included.

There're two things that will be done in another patches:
1. target data nowait has not been supported yet. D90099 added the support.
2. When there is no mapper, the mapper array can be nullptr no matter whether it requires outer task or not. It can avoid an unnecessary data copy. This is an optimization that is covered in D90101.

Reviewed By: jdoerfert

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

3 years ago[LSR] fix typo in comments and rename for a new added hook.
Chen Zheng [Tue, 27 Oct 2020 02:29:22 +0000 (22:29 -0400)]
[LSR] fix typo in comments and rename for a new added hook.

3 years agoSourceManager: clang-format the SrcMgr namespace, NFC
Duncan P. N. Exon Smith [Tue, 27 Oct 2020 01:26:36 +0000 (21:26 -0400)]
SourceManager: clang-format the SrcMgr namespace, NFC

3 years agoIR: Simplify two loops walking ConstantDataSequential, NFC
Duncan P. N. Exon Smith [Mon, 26 Oct 2020 23:03:23 +0000 (19:03 -0400)]
IR: Simplify two loops walking ConstantDataSequential, NFC

Follow-up to b2b7cf39d596b1528cd64015575b3f5d1461c011.

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

3 years agoUpdate email addresses in CODE_OWNERS.
Craig Topper [Tue, 27 Oct 2020 01:51:04 +0000 (18:51 -0700)]
Update email addresses in CODE_OWNERS.

3 years agoTeach `-fsanitize=fuzzer` to respect `-static` and `-static-libstdc++` when adding...
Chandler Carruth [Sun, 24 May 2020 07:02:38 +0000 (00:02 -0700)]
Teach `-fsanitize=fuzzer` to respect `-static` and `-static-libstdc++` when adding C++ standard libraries.

Summary:
Makes linking the sanitizers follow the same logic as the rest of the
driver with respect to the static linking strategy for the C++ standard
library.

Subscribers: mcrosier, cfe-commits

Tags: #clang

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

3 years ago[AMDGPU] Move WQM Pass after MI Scheduler
Carl Ritson [Tue, 27 Oct 2020 00:55:55 +0000 (09:55 +0900)]
[AMDGPU] Move WQM Pass after MI Scheduler

Exec mask manipulation inserted by SIWholeQuadMode barriers to
instruction scheduling.  Move the entire pass after the machine
instruction scheduler and make changes so pass is correct for
non-SSA operation.  These changes should leave the pass still
usable pre-scheduler, although tests have be updated to reflect
post-scheduler results.

Reviewed By: nhaehnle

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

3 years ago[NPM] Port -slsr to NPM
TaWeiTu [Tue, 27 Oct 2020 01:21:07 +0000 (09:21 +0800)]
[NPM] Port -slsr to NPM

`-separate-const-offset-from-gep` has not yet be ported, so some tests are not updated.

Reviewed By: aeubanks

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

3 years agoIR: Add a comment at missing std::make_unique calls from b2b7cf39d596b1528cd64015575b...
Duncan P. N. Exon Smith [Tue, 27 Oct 2020 01:18:16 +0000 (21:18 -0400)]
IR: Add a comment at missing std::make_unique calls from b2b7cf39d596b1528cd64015575b3f5d1461c011, NFC

3 years ago[mlir][Pattern] Add a new FrozenRewritePatternList class
River Riddle [Tue, 27 Oct 2020 00:25:01 +0000 (17:25 -0700)]
[mlir][Pattern] Add a new FrozenRewritePatternList class

This class represents a rewrite pattern list that has been frozen, and thus immutable. This replaces the uses of OwningRewritePatternList in pattern driver related API, such as dialect conversion. When PDL becomes more prevalent, this API will allow for optimizing a set of patterns once without the need to do this per run of a pass.

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

3 years ago[mlir][NFC] Move around the code related to PatternRewriting to improve layering
River Riddle [Tue, 27 Oct 2020 00:24:17 +0000 (17:24 -0700)]
[mlir][NFC] Move around the code related to PatternRewriting to improve layering

There are several pieces of pattern rewriting infra in IR/ that really shouldn't be there. This revision moves those pieces to a better location such that they are easier to evolve in the future(e.g. with PDL). More concretely this revision does the following:

* Create a Transforms/GreedyPatternRewriteDriver.h and move the apply*andFold methods there.
The definitions for these methods are already in Transforms/ so it doesn't make sense for the declarations to be in IR.

* Create a new lib/Rewrite library and move PatternApplicator there.
This new library will be focused on applying rewrites, and will also include compiling rewrites with PDL.

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

3 years ago[mlir][Pattern] Refactor the Pattern class into a "metadata only" class
River Riddle [Tue, 27 Oct 2020 00:23:41 +0000 (17:23 -0700)]
[mlir][Pattern] Refactor the Pattern class into a "metadata only" class

The Pattern class was originally intended to be used for solely matching operations, but that use never materialized. All of the pattern infrastructure uses RewritePattern, and the infrastructure for pure matching(Matchers.h) is implemented inline. This means that this class isn't a useful abstraction at the moment, so this revision refactors it to solely encapsulate the "metadata" of a pattern. The metadata includes the various state describing a pattern; benefit, root operation, etc. The API on PatternApplicator is updated to now operate on `Pattern`s as nothing special from `RewritePattern` is necessary.

This refactoring is also necessary for the upcoming use of PDL patterns alongside C++ rewrite patterns.

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

3 years ago[mlir] Add a conversion pass between PDL and the PDL Interpreter Dialect
River Riddle [Tue, 27 Oct 2020 00:23:16 +0000 (17:23 -0700)]
[mlir] Add a conversion pass between PDL and the  PDL Interpreter Dialect

The conversion between PDL and the interpreter is split into several different parts.
** The Matcher:

The matching section of all incoming pdl.pattern operations is converted into a predicate tree and merged. Each pattern is first converted into an ordered list of predicates starting from the root operation. A predicate is composed of three distinct parts:
* Position
  - A position refers to a specific location on the input DAG, i.e. an
    existing MLIR entity being matched. These can be attributes, operands,
    operations, results, and types. Each position also defines a relation to
    its parent. For example, the operand `[0] -> 1` has a parent operation
    position `[0]` (the root).
* Question
  - A question refers to a query on a specific positional value. For
  example, an operation name question checks the name of an operation
  position.
* Answer
  - An answer is the expected result of a question. For example, when
  matching an operation with the name "foo.op". The question would be an
  operation name question, with an expected answer of "foo.op".

After the predicate lists have been created and ordered(based on occurrence of common predicates and other factors), they are formed into a tree of nodes that represent the branching flow of a pattern match. This structure allows for efficient construction and merging of the input patterns. There are currently only 4 simple nodes in the tree:
* ExitNode: Represents the termination of a match
* SuccessNode: Represents a successful match of a specific pattern
* BoolNode/SwitchNode: Branch to a specific child node based on the expected answer to a predicate question.

Once the matcher tree has been generated, this tree is walked to generate the corresponding interpreter operations.

 ** The Rewriter:
The rewriter portion of a pattern is generated in a very straightforward manor, similarly to lowerings in other dialects. Each PDL operation that may exist within a rewrite has a mapping into the interpreter dialect. The code for the rewriter is generated within a FuncOp, that is invoked by the interpreter on a successful pattern match. Referenced values defined in the matcher become inputs the generated rewriter function.

An example lowering is shown below:

```mlir
// The following high level PDL pattern:
pdl.pattern : benefit(1) {
  %resultType = pdl.type
  %inputOperand = pdl.input
  %root, %results = pdl.operation "foo.op"(%inputOperand) -> %resultType
  pdl.rewrite %root {
    pdl.replace %root with (%inputOperand)
  }
}

// is lowered to the following:
module {
  // The matcher function takes the root operation as an input.
  func @matcher(%arg0: !pdl.operation) {
    pdl_interp.check_operation_name of %arg0 is "foo.op" -> ^bb2, ^bb1
  ^bb1:
    pdl_interp.return
  ^bb2:
    pdl_interp.check_operand_count of %arg0 is 1 -> ^bb3, ^bb1
  ^bb3:
    pdl_interp.check_result_count of %arg0 is 1 -> ^bb4, ^bb1
  ^bb4:
    %0 = pdl_interp.get_operand 0 of %arg0
    pdl_interp.is_not_null %0 : !pdl.value -> ^bb5, ^bb1
  ^bb5:
    %1 = pdl_interp.get_result 0 of %arg0
    pdl_interp.is_not_null %1 : !pdl.value -> ^bb6, ^bb1
  ^bb6:
    // This operation corresponds to a successful pattern match.
    pdl_interp.record_match @rewriters::@rewriter(%0, %arg0 : !pdl.value, !pdl.operation) : benefit(1), loc([%arg0]), root("foo.op") -> ^bb1
  }
  module @rewriters {
    // The inputs to the rewriter from the matcher are passed as arguments.
    func @rewriter(%arg0: !pdl.value, %arg1: !pdl.operation) {
      pdl_interp.replace %arg1 with(%arg0)
      pdl_interp.return
    }
  }
}
```

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

3 years agoSourceManager: Use the same fake SLocEntry whenever it fails to load
Duncan P. N. Exon Smith [Mon, 19 Oct 2020 22:30:49 +0000 (18:30 -0400)]
SourceManager: Use the same fake SLocEntry whenever it fails to load

Instead of putting a fake `SLocEntry` at `LoadedSLocEntryTable[Index]`
when it fails to load in `SourceManager::loadSLocEntry`, allocate a fake
one. Unless someone is sniffing the address of the returned `SLocEntry`
(doubtful), this won't be a functionality change. Note that
`SLocEntryLoaded[Index]` wasn't being set to `true` either before or
after this change so no accessor is every going to look at
`LoadedSLocEntryTable[Index]`.

As a side effect, drop the `mutable` from `LoadedSLocEntryTable`.

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

3 years ago[NFC] Use [MC]Register in RegAllocPBQP & RegisterCoalescer
Gaurav Jain [Thu, 22 Oct 2020 22:38:04 +0000 (15:38 -0700)]
[NFC] Use [MC]Register in RegAllocPBQP & RegisterCoalescer

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

3 years ago[lldb][NativePDB] fix test load-pdb.cpp
Zequan Wu [Tue, 27 Oct 2020 00:12:51 +0000 (17:12 -0700)]
[lldb][NativePDB] fix test load-pdb.cpp

3 years ago[clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding
Nathan James [Tue, 27 Oct 2020 00:03:42 +0000 (00:03 +0000)]
[clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding

Rearrange the fields to reduce the size of the classes

Reviewed By: gribozavr2

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

3 years agoFix checking for C++98 ICEs in C++11-and-later mode to not consider use
Richard Smith [Mon, 26 Oct 2020 23:59:02 +0000 (16:59 -0700)]
Fix checking for C++98 ICEs in C++11-and-later mode to not consider use
of a reference to be acceptable.

3 years ago[PowerPC] Implement Set Boolean Condition Instructions
Amy Kwan [Mon, 26 Oct 2020 16:16:05 +0000 (11:16 -0500)]
[PowerPC] Implement Set Boolean Condition Instructions

This patch implements the set boolean condition instructions introduced in
POWER10.

The set boolean condition instructions (set[n]bc[r]) are used during
the following situations:
- sign/zero/any extending i1 to an i32 or i64,
- reg+reg, reg+imm or floating point comparisons being sign/zero extended to i32 or i64,
- spilling CR bits (using the setnbc instruction)

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

3 years ago[profile] Suppress spurious 'expected profile to require unlock' warning
Vedant Kumar [Mon, 26 Oct 2020 23:23:06 +0000 (16:23 -0700)]
[profile] Suppress spurious 'expected profile to require unlock' warning

In %c (continuous sync) mode, avoid attempting to unlock an
already-unlocked profile.

The profile is only locked when profile merging is enabled.

3 years ago[DebugInfo] Expose Fortran array debug info attributes through DIBuilder.
Adrian Prantl [Mon, 26 Oct 2020 23:09:35 +0000 (16:09 -0700)]
[DebugInfo] Expose Fortran array debug info attributes through DIBuilder.

The support of a few debug info attributes specifically for Fortran
arrays have been added to LLVM recently, but there's no way to take
advantage of them through DIBuilder. This patch extends
DIBuilder::createArrayType to enable the settings of those attributes.

Patch by Chih-Ping Chen!

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

3 years ago[mlir][Linalg] Miscalleneous enhancements to cover more fusion cases.
MaheshRavishankar [Mon, 26 Oct 2020 23:16:40 +0000 (16:16 -0700)]
[mlir][Linalg] Miscalleneous enhancements to cover more fusion cases.

Adds support for
- Dropping unit dimension loops for indexed_generic ops.
- Folding consecutive folding (or expanding) reshapes when the result
  (or src) is a scalar.
- Fixes to indexed_generic -> generic fusion when zero-dim tensors are
  involved.

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

3 years agoExplicitly check for entry basic block, rather than relying on MachineBasicBlock...
Rahman Lavaee [Mon, 26 Oct 2020 23:15:56 +0000 (16:15 -0700)]
Explicitly check for entry basic block, rather than relying on MachineBasicBlock::pred_empty.

Sometimes in unoptimized code, we have dangling unreachable basic blocks with no predecessors. Basic block sections should be emitted for those as well. Without this patch, the included test fails with a fatal error in `AsmPrinter::emitBasicBlockEnd`.

Reviewed By: tmsriram

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

3 years agoFixed release build after D89170
Stanislav Mekhanoshin [Mon, 26 Oct 2020 22:55:59 +0000 (15:55 -0700)]
Fixed release build after D89170

3 years ago[mlir] Document 'ParentOneOf' with the HasParent trait
Stephen Neuendorffer [Mon, 26 Oct 2020 22:45:57 +0000 (15:45 -0700)]
[mlir] Document 'ParentOneOf' with the HasParent trait

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

3 years ago[cmake] Add LLVM_UBSAN_FLAGS, to allow overriding UBSan flags
Vedant Kumar [Thu, 15 Oct 2020 02:09:50 +0000 (19:09 -0700)]
[cmake] Add LLVM_UBSAN_FLAGS, to allow overriding UBSan flags

Allow overriding the default set of flags used to enable UBSan when
building llvm.

This can be used to test new checks or opt out of certain checks.

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

3 years agoIR: Clarify ownership of ConstantDataSequentials, NFC
Duncan P. N. Exon Smith [Fri, 23 Oct 2020 22:51:02 +0000 (18:51 -0400)]
IR: Clarify ownership of ConstantDataSequentials, NFC

Change `ConstantDataSequential::Next` to a
`unique_ptr<ConstantDataSequential>` and update `CDSConstants` to a
`StringMap<unique_ptr<ConstantDataSequential>>`, making the ownership
more obvious.

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

3 years ago[MLIR] Fix AttributeInterface declaration.
Ulysse Beaugnon [Mon, 26 Oct 2020 22:40:40 +0000 (23:40 +0100)]
[MLIR] Fix AttributeInterface declaration.

Substitues `Type` by `Attribute` in the declaration of AttributeInterface. It
looks like the code was written by copy-pasting the definition of TypeInterface,
but the substitution of Type by Attribute was missing at some places.

Reviewed By: rriddle, ftynse

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

3 years ago[CodeView] Emit static data members as S_CONSTANTs.
Amy Huang [Wed, 7 Oct 2020 21:52:02 +0000 (14:52 -0700)]
[CodeView] Emit static data members as S_CONSTANTs.

We used to only emit static const data members in CodeView as
S_CONSTANTS when they were used; this patch makes it so they are always emitted.

I changed CodeViewDebug.cpp to find the static const members from the
class debug info instead of creating DIGlobalVariables in the IR
whenever a static const data member is used.

Bug: https://bugs.llvm.org/show_bug.cgi?id=47580

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

3 years ago[TargetRegisterInfo] Fix a couple of typos in the comments
Quentin Colombet [Mon, 26 Oct 2020 22:04:36 +0000 (15:04 -0700)]
[TargetRegisterInfo] Fix a couple of typos in the comments

Spotted by Nicolas Guillemot <nguillemot@apple.com>.

Thanks Nicolas!

NFC

3 years ago[mlir] Do not print back 0 alignment in LLVM dialect 'alloca' op
Alex Zinenko [Mon, 26 Oct 2020 18:29:28 +0000 (19:29 +0100)]
[mlir] Do not print back 0 alignment in LLVM dialect 'alloca' op

The alignment attribute in the 'alloca' op treats the '0' value as 'unset'.
When parsing the custom form of the 'alloca' op, ignore the alignment attribute
with if its value is '0' instead of actually creating it and producing a
slightly different textually yet equivalent semantically form in the output.

Reviewed By: rriddle

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

3 years ago[nfc] [lldb] Refactor DWARFUnit::GetDIE
Jan Kratochvil [Mon, 26 Oct 2020 22:17:27 +0000 (23:17 +0100)]
[nfc] [lldb] Refactor DWARFUnit::GetDIE

Reduce indentation of the code by early returns for failed code paths.

3 years ago[NFC] Fixing comment heading for MachineStableHash.h.
Puyan Lotfi [Mon, 26 Oct 2020 22:06:38 +0000 (18:06 -0400)]
[NFC] Fixing comment heading for MachineStableHash.h.

Wrong filename and description.

3 years ago[libc++] Remove the reliance of several <random> tests on <iostream>
Louis Dionne [Mon, 26 Oct 2020 21:55:36 +0000 (17:55 -0400)]
[libc++] Remove the reliance of several <random> tests on <iostream>