platform/upstream/llvm.git
3 years agoRevert "[flang] Make 'this_image()' an intrinsic function"
Mehdi Amini [Wed, 15 Sep 2021 03:28:34 +0000 (03:28 +0000)]
Revert "[flang] Make 'this_image()' an intrinsic function"

This reverts commit 81f8ad1769665a569a235b749e0e9e69ce7dc65e.
This seems to break the shared libs build
(linaro-flang-aarch64-sharedlibs bot) with:

  undefined reference to `Fortran::semantics::IsCoarray(Fortran::semantics::Symbol const&)

(from tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/tools.cpp.o)

When linking lib/libFortranEvaluate.so.14git

3 years agoMake the --mlir-disable-threading command line option overrides the C++ API usage
Mehdi Amini [Wed, 15 Sep 2021 01:38:38 +0000 (01:38 +0000)]
Make the --mlir-disable-threading command line option overrides the C++ API usage

This seems in-line with the intent and how we build tools around it.
Update the description for the flag accordingly.
Also use an injected thread pool in MLIROptMain, now we will create
threads up-front and reuse them across split buffers.

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

3 years ago[MLIR] Use memref.copy ops in BufferResultsToOutParams pass.
cwz920716 [Wed, 15 Sep 2021 02:59:18 +0000 (02:59 +0000)]
[MLIR] Use memref.copy ops in BufferResultsToOutParams pass.

Both copy/alloc ops are using memref dialect after this change.

Reviewed By: silvas, mehdi_amini

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

3 years ago[gn build] Port 626586fc253c
LLVM GN Syncbot [Wed, 15 Sep 2021 02:29:04 +0000 (02:29 +0000)]
[gn build] Port 626586fc253c

3 years agoRe-Revert "clang-tidy: introduce readability-containter-data-pointer check"
Nico Weber [Wed, 15 Sep 2021 02:27:59 +0000 (22:27 -0400)]
Re-Revert "clang-tidy: introduce readability-containter-data-pointer check"

This reverts commit 49992c04148e5327bef9bd2dff53a0d46004b4b4.
The test is still failing on Windows, see comments on https://reviews.llvm.org/D108893

3 years agoregen an autogened test which is stale
Philip Reames [Wed, 15 Sep 2021 01:42:16 +0000 (18:42 -0700)]
regen an autogened test which is stale

3 years agoDAG: Fix incorrect folding of fmul -1 to fneg
Matt Arsenault [Thu, 26 Aug 2021 02:10:40 +0000 (22:10 -0400)]
DAG: Fix incorrect folding of fmul -1 to fneg

The fmul is a canonicalizing operation, and fneg is not so this would
break denormals that need flushing and also would not quiet signaling
nans. Fold to fsub instead, which is also canonicalizing.

3 years ago[CSSPGO] Enable pseudo probe instrumentation in O0 mode.
Hongtao Yu [Thu, 9 Sep 2021 18:41:39 +0000 (11:41 -0700)]
[CSSPGO] Enable pseudo probe instrumentation in O0 mode.

Pseudo probe instrumentation was missing from O0 build. It is needed in cases where some source files are built in O0 while the others are built in optimize mode.

Reviewed By: wenlei, wlei, wmi

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

3 years ago[lld][WebAssembly] Use llvm-objdump to test __wasm_init_memory
Thomas Lively [Wed, 15 Sep 2021 01:07:58 +0000 (18:07 -0700)]
[lld][WebAssembly] Use llvm-objdump to test __wasm_init_memory

Rather than depending on the hex dump from obj2yaml. Now the test shows the
expected function body in a human readable format.

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

3 years agoRegAllocGreedy: Account for reserved registers in num regs heuristic
Matt Arsenault [Sat, 21 Aug 2021 18:54:51 +0000 (14:54 -0400)]
RegAllocGreedy: Account for reserved registers in num regs heuristic

This simple heuristic uses the estimated live range length combined
with the number of registers in the class to switch which heuristic to
use. This was taking the raw number of registers in the class, even
though not all of them may be available. AMDGPU heavily relies on
dynamically reserved numbers of registers based on user attributes to
satisfy occupancy constraints, so the raw number is highly misleading.

There are still a few problems here. In the original testcase that
made me notice this, the live range size is incorrect after the
scheduler rearranges instructions, since the instructions don't have
the original InstrDist offsets. Additionally, I think it would be more
appropriate to use the number of disjointly allocatable registers in
the class. For the AMDGPU register tuples, there are a large number of
registers in each tuple class, but only a small fraction can actually
be allocated at the same time since they all overlap with each
other. It seems we do not have a query that corresponds to the number
of independently allocatable registers. Relatedly, I'm still debugging
some allocation failures where overlapping tuples seem to not be
handled correctly.

The test changes are mostly noise. There are a handful of x86 tests
that look like regressions with an additional spill, and a handful
that now avoid a spill. The worst looking regression is likely
test/Thumb2/mve-vld4.ll which introduces a few additional
spills. test/CodeGen/AMDGPU/soft-clause-exceeds-register-budget.ll
shows a massive improvement by completely eliminating a large number
of spills inside a loop.

3 years ago[CMake] Delete obsoleted COMPILER_RT_TEST_TARGET_TRIPLE
Fangrui Song [Wed, 15 Sep 2021 00:46:50 +0000 (17:46 -0700)]
[CMake] Delete obsoleted COMPILER_RT_TEST_TARGET_TRIPLE

The last user has been removed from llvm-zorg for Android.

3 years ago[mlir][linalg] PadTensorOp vectorization: Avoid redundant FillOps
Matthias Springer [Tue, 14 Sep 2021 23:57:55 +0000 (08:57 +0900)]
[mlir][linalg] PadTensorOp vectorization: Avoid redundant FillOps

Do not generate FillOps when these would be entirely overwritten.

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

3 years agoSeparateConstOffsetFromGEP: Fix stack overflow in unreachable code
Matt Arsenault [Tue, 14 Sep 2021 01:16:17 +0000 (21:16 -0400)]
SeparateConstOffsetFromGEP: Fix stack overflow in unreachable code

ConstantOffsetExtractor::Find was infinitely recursing on the add
referencing itself.

3 years agoAttributor: Fix crash on undef in !callees
Matt Arsenault [Tue, 14 Sep 2021 01:35:53 +0000 (21:35 -0400)]
Attributor: Fix crash on undef in !callees

3 years agoAMDGPU: Rename attributor class for uniform-work-group-size
Matt Arsenault [Thu, 9 Sep 2021 22:40:22 +0000 (18:40 -0400)]
AMDGPU: Rename attributor class for uniform-work-group-size

This isn't really an AMDGPU specific attribute and could be moved to
generic code. It's also important to include the word uniform in the
name.

3 years agoAttributor: Fix typos
Matt Arsenault [Thu, 9 Sep 2021 22:45:12 +0000 (18:45 -0400)]
Attributor: Fix typos

3 years ago[flang] Make 'this_image()' an intrinsic function
Craig Rasmussen [Tue, 14 Sep 2021 18:04:44 +0000 (11:04 -0700)]
[flang] Make 'this_image()' an intrinsic function

Added 'this_image()' to the list of functions that are evaluated as intrinsic.
Added IsCoarray functions to determine if an expression is a coarray (corank > 1).

Added save attribute to coarray variables in test file, this_image.f90.

reviewers: klausler, PeteSteinfeld

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

3 years agoRemove unused llvm/Support/Parallel.h from MLIR (NFC)
Mehdi Amini [Tue, 14 Sep 2021 23:30:42 +0000 (23:30 +0000)]
Remove unused llvm/Support/Parallel.h from MLIR (NFC)

This header aren't needed anymore: MLIR is using a thread pool
injected in the context instead of a global one.

3 years agoNFC: DebugInfo: refactor pretty printing into a utility class
David Blaikie [Tue, 14 Sep 2021 21:48:08 +0000 (14:48 -0700)]
NFC: DebugInfo: refactor pretty printing into a utility class

Laying more foundation for full template name rebuilding - more complex
type printing benefits from an object to carry some state rather than
passing it around as parameters to every function.

3 years ago[test] precommit anoter test for D109786
Philip Reames [Tue, 14 Sep 2021 22:31:44 +0000 (15:31 -0700)]
[test] precommit anoter test for D109786

3 years ago[test] precommit test for D109786
Philip Reames [Tue, 14 Sep 2021 22:22:43 +0000 (15:22 -0700)]
[test] precommit test for D109786

3 years ago[mlir] Apply py::module_local() to a few more classes.
Sean Silva [Tue, 14 Sep 2021 21:55:54 +0000 (21:55 +0000)]
[mlir] Apply py::module_local() to a few more classes.

Reviewed By: ftynse

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

3 years agoautogen a test for ease of update in later patch
Philip Reames [Tue, 14 Sep 2021 21:48:47 +0000 (14:48 -0700)]
autogen a test for ease of update in later patch

3 years ago[SCEV] Stop applying contextual flags in applyLoopGuards
Philip Reames [Tue, 14 Sep 2021 21:08:47 +0000 (14:08 -0700)]
[SCEV] Stop applying contextual flags in applyLoopGuards

This fixes a violation of the wrap flag rules introduced in c4048d8f. As noted in the original review, the NUW is legal to infer from the structure of the replacee, but a) there's no test coverage, and b) this should be done generically for all multiplies.

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

3 years ago[StopInfoMachException] Summarize arm64e BLRAx/LDRAx auth failures
Vedant Kumar [Thu, 14 Nov 2019 21:12:46 +0000 (13:12 -0800)]
[StopInfoMachException] Summarize arm64e BLRAx/LDRAx auth failures

Upstream lldb support for summarizing BLRAx and LDRAx auth failures.

rdar://41615322

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

3 years ago[SCEV] Attempt to define what flags are legal on a SCEV
Philip Reames [Tue, 14 Sep 2021 20:10:17 +0000 (13:10 -0700)]
[SCEV] Attempt to define what flags are legal on a SCEV

This is an attempt to define what the current semantics are closest too.  Unfortunately, the current implementation does appear to be inconsistent with all semantic variants we've considered.  This semantics is the one which seems to be closest to the spirit of the code, and that matched several long time contributors mental models of how the code "should work".

https://bugs.llvm.org/show_bug.cgi?id=51817 tracks the list of currently known violations of these rules.  A series of follow up patches will be addressing each now that we've defined them to be bugs.

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

3 years ago[CMake][AIX] Disable visibility options in build
David Tenty [Fri, 20 Aug 2021 03:01:22 +0000 (23:01 -0400)]
[CMake][AIX] Disable visibility options in build

Visibility options currently have limited support on AIX and may cause warnings or errors
depending on the build compiler used.

Reviewed By: ZarkoCA

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

3 years agoRevert "[WebAssembly] Rethrow longjmp in EH handling if EmSjLj is enabled"
Heejin Ahn [Tue, 14 Sep 2021 19:58:09 +0000 (12:58 -0700)]
Revert "[WebAssembly] Rethrow longjmp in EH handling if EmSjLj is enabled"

This reverts commit b7b4ebbcfa463a7fae61dca7cec30c5b747bdec8.

Reason: This breaks several code-size tests in Emscripten test suite
because this exports `emscripten_longjmp` for programs that didn't do it
before.

3 years ago[AMDGPU] Switch PostRA sched to MachineSched
Joe Nash [Wed, 8 Sep 2021 17:22:15 +0000 (13:22 -0400)]
[AMDGPU] Switch PostRA sched to MachineSched

Use GCNHazardRecognizer in postra sched.
Updated tests for the new schedules.

Reviewed By: arsenm

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

Change-Id: Ia86ba2ae168f12fb34b4d8efdab491f84d936cde

3 years ago[lld/mac] Search .tbd before binary for framework files too
Nico Weber [Tue, 14 Sep 2021 16:23:41 +0000 (12:23 -0400)]
[lld/mac] Search .tbd before binary for framework files too

This matters for example for the iPhoneSimulator14.0.sdk, which has
a System/Library/Frameworks/UIKit.framework/UIKit that has
LC_BUILD_VERSION with minos of 14.0, so linking against that file
will produce warnings like:

   .../iPhoneSimulator14.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit
   has version 14.0.0, which is newer than target minimum of 12.0.0

when targeting x86_64-apple-ios12.0-simulator. That doens't happen when
linking against UIKit.tbd instead, obviously.

Linking with RC_TRACE_DYLIB_SEARCHING=1 shows that ld64 also searches
the tbd file first, and we already get that right for non-framework
dylibs.

Fixes crbug.com/1249456.

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

3 years ago[llvm-profgen] Ignore broken LBR samples
Hongtao Yu [Fri, 10 Sep 2021 23:34:49 +0000 (16:34 -0700)]
[llvm-profgen] Ignore broken LBR samples

Perf script can sometimes give disordered LBR samples like below.

```
          b022500
          32de0044
          3386e1d1
      7f118e05720c
      7f118df2d81f
 0x2a0b9622/0x2a0b9610/P/-/-/1  0x2a0b79ff/0x2a0b9618/P/-/-/2  0x2a0b7a4a/0x2a0b79e8/P/-/-/1  0x2a0b7a33/0x2a0b7a46/P/-/-/1  0x2a0b7a42/0x2a0b7a23/P/-/-/1  0x2a0b7a21/0x2a0b7a37/P/-/-/2  0x2a0b79e6/0x2a0b7a07/P/-/-/1  0x2a0b79d4/0x2a0b79dc/P/-/-/2  0x2a0b7a03/0x2a0b79aa/P/-/-/1  0x2a0b79a8/0x2a0b7a00/P/-/-/234  0x2a0b9613/0x2a0b7930/P/-/-/1  0x2a0b9622/0x2a0b9610/P/-/-/1  0x2a0b79ff/0x2a0b9618/P/-/-/2  0x2a0b7a4a/0x2aWarning:
Processed 10263226 events and lost 1 chunks!

```
 Note that the last LBR record `0x2a0b7a4a/0x2aWarning:` . Currently llvm-profgen does not detect that and as a result an uninitialized branch target value will be used. The uninitialized value can cause creepy instruction ranges created which which in turn will result in a completely wrong profile. An example is like

```

 .... @ _ZN5folly13loadUnalignedIsEET_PKv]:18446744073709551615:18446744073709551615
 1: 18446744073709551615
 !CFGChecksum: 4294967295
 !Attributes: 0
```

Reviewed By: wenlei, wlei

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

3 years ago[VPlan] Queue (block, operand) pairs together (NFC).
Florian Hahn [Tue, 14 Sep 2021 18:01:28 +0000 (19:01 +0100)]
[VPlan] Queue (block, operand) pairs together (NFC).

Instead of discovering the sink-to block for each operand in the main
loop, the sink-to block can instead be directly queued with the
operands.

This simplifies processing in the main loop and is a NFC change split
off from D104254 as suggested there.

3 years ago[Sanitizers] intercept fparseln on freebsd
David Carlier [Tue, 14 Sep 2021 18:13:45 +0000 (19:13 +0100)]
[Sanitizers] intercept fparseln on freebsd

Reviewed By: vitalybuka, emaste

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

3 years agoPut code that avoids heapifying local blocks behind a flag
Walter Lee [Wed, 8 Sep 2021 01:56:02 +0000 (21:56 -0400)]
Put code that avoids heapifying local blocks behind a flag

This change puts the functionality in commit
c5792aa90fa45a1842f190c146f19e2c71ea6fbd behind a flag that is off by
default.  The original commit is not in Apple's Clang fork (and blocks
are an Apple extension in the first place), and there is one known
issue that needs to be addressed before it can be enabled safely.

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

3 years ago[gn build] Port 49992c04148e
LLVM GN Syncbot [Tue, 14 Sep 2021 17:54:35 +0000 (17:54 +0000)]
[gn build] Port 49992c04148e

3 years agoRevert "Revert "clang-tidy: introduce readability-containter-data-pointer check""
Saleem Abdulrasool [Tue, 14 Sep 2021 17:51:19 +0000 (10:51 -0700)]
Revert "Revert "clang-tidy: introduce readability-containter-data-pointer check""

This reverts commit 76dc8ac36d07cebe8cfe8fe757323562bb36df94.

Restore the change.  The test had an incorrect negative from testing.
The test is expected to trigger a failure as mentioned in the review
comments.  This corrects the test and should resolve the failure.

3 years agoRevert "[Dexter] Improve performance by evaluating expressions only when needed"
Stephen Tozer [Tue, 14 Sep 2021 17:23:39 +0000 (18:23 +0100)]
Revert "[Dexter] Improve performance by evaluating expressions only when needed"

Reverted due to build failure on greendragon lldb build.

This reverts commit 9bbc0c1ffb47f9cf4c9d8e9a0e8100002fe5aafb.

3 years ago[StackColoring] Fix a debug invariance problem
Bjorn Pettersson [Tue, 14 Sep 2021 13:06:28 +0000 (15:06 +0200)]
[StackColoring] Fix a debug invariance problem

Ignore dbg instructions when collecting stack slot markers. This is
to make sure the coloring is invariant regarding presence of dbg
instructions (even in cases when the dbg instructions might be
badly placed in the input).

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

3 years ago[StackColoring] Pre-commit of test case showing a debug invariance bug
Bjorn Pettersson [Tue, 14 Sep 2021 13:01:58 +0000 (15:01 +0200)]
[StackColoring] Pre-commit of test case showing a debug invariance bug

Having DBG_VALUE instructions referencing a stack slot while being outside
of the LIFETIME_START/LIFETIME_END markers for that stack slot is perhaps
not always ideal (from a debugging perspective), but it might happen during
codegen that we end up with such situations (e.g. positioning of the
DBG_VALUE instruction for a SDDbgOperand::FRAMEIX at ISel is a bit sloppy
in that context).

This patch adds a test case showing that StackColoring currently isn't
debug invariant, and that the position of DBG_VALUE instructions referencing
the stack slots might impact the decision making regarding stack slot reuse.

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

3 years ago[NFC] Add trailing comma on TYPED_TEST_SUITE
Alexandre Rames [Tue, 14 Sep 2021 16:56:57 +0000 (09:56 -0700)]
[NFC] Add trailing comma on TYPED_TEST_SUITE

This avoids a -pedantic warning:
warning: ISO C++11 requires at least one argument for the "..." in a variadic macro

See also https://github.com/google/googletest/issues/2271

3 years agoRevert "clang-tidy: introduce readability-containter-data-pointer check"
Nico Weber [Tue, 14 Sep 2021 16:37:10 +0000 (12:37 -0400)]
Revert "clang-tidy: introduce readability-containter-data-pointer check"

This reverts commit d0d9e6f0849b2e76e980e2edf365302f47f4e35f.
Breaks tests, see e.g. https://lab.llvm.org/buildbot/#/builders/188/builds/3326

3 years ago[gn build] Use lib_dirs instead of qualified path in libs for diaguids.lib
Nico Weber [Tue, 14 Sep 2021 16:31:41 +0000 (12:31 -0400)]
[gn build] Use lib_dirs instead of qualified path in libs for diaguids.lib

Follow-up to D109708: Using lib_dirs means this will work with ancient gn binaries.

Change the toolchain definitions to make lib_dirs have the right effect, and
pull out lib_switch of each of the tools while here.

This means we now do pass /LIBPATH: to link.exe, but since we invoke it directly
and not through clang-cl, this doesn't actually require D109624. And since this
is built in to GN, we don't need a config to push the flag to dependents.

This is arguably a bit more idiomatic, and it doesn't require folks to update
their GN binaries. No effective behavior change.

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

3 years ago[flang][OpenMP] Add semantic check for threadprivate directive
PeixinQiao [Tue, 14 Sep 2021 16:22:03 +0000 (00:22 +0800)]
[flang][OpenMP] Add semantic check for threadprivate directive

This patch implements the following check for THREADPRIVATE construct:
```
A variable that is part of another variable (as an array, structure
element or type parameter inquiry) cannot appear in a threadprivate
directive.
```

Reviewed By: kiranchandramohan

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

3 years ago[IPO] Use make_early_inc_range (NFC)
Kazu Hirata [Tue, 14 Sep 2021 15:59:35 +0000 (08:59 -0700)]
[IPO] Use make_early_inc_range (NFC)

3 years ago[mli][linalg] Reuse getValueOrCreateConstantIndexOp method (NFC).
Tobias Gysi [Tue, 14 Sep 2021 15:11:45 +0000 (15:11 +0000)]
[mli][linalg] Reuse getValueOrCreateConstantIndexOp method (NFC).

Use getValueOrCreateConstantIndexOp introduced by https://reviews.llvm.org/D109601 in multiple places in LinalgOps.cpp.

Reviewed By: nicolasvasilache, springerm

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

3 years ago[JITLink] Allow moving a Symbol to a Block in a different Section
Ben Langmuir [Tue, 14 Sep 2021 14:58:09 +0000 (07:58 -0700)]
[JITLink] Allow moving a Symbol to a Block in a different Section

When moving a Symbol between Blocks that are in different Sections,
update the symbol tables for each Section. Otherwise
symbol.getBlock().getSection() will not match the contents of
Section::symbols(), which asserts during linking.

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

3 years agoclang-tidy: introduce readability-containter-data-pointer check
Saleem Abdulrasool [Sun, 29 Aug 2021 05:05:59 +0000 (22:05 -0700)]
clang-tidy: introduce readability-containter-data-pointer check

This introduces a new check, readability-containter-data-pointer.  This
check is meant to catch the cases where the user may be trying to
materialize the data pointer by taking the address of the 0-th member of
a container.  With C++11 or newer, the `data` member should be used for
this.  This provides the following benefits:

- `.data()` is easier to read than `&[0]`
- it avoids an unnecessary re-materialization of the pointer
  * this doesn't matter in the case of optimized code, but in the case
    of unoptimized code, this will be visible
- it avoids a potential invalid memory de-reference caused by the
  indexing when the container is empty (in debug mode, clang will
  normally optimize away the re-materialization in optimized builds).

The small potential behavioural change raises the question of where the
check should belong.  A reasoning of defense in depth applies here, and
this does an unchecked conversion, with the assumption that users can
use the static analyzer to catch cases where we can statically identify
an invalid memory de-reference.  For the cases where the static analysis
is unable to prove the size of the container, UBSan can be used to track
the invalid access.

Special thanks to Aaron Ballmann for the discussion on whether this
check would be useful and where to place it.

This also partially resolves PR26817!

Reviewed By: aaron.ballman

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

3 years ago[IR] Reduce max supported integer from 2^24-1 to 2^23.
Craig Topper [Tue, 14 Sep 2021 14:33:33 +0000 (07:33 -0700)]
[IR] Reduce max supported integer from 2^24-1 to 2^23.

SelectionDAG will promote illegal types up to a power of 2 before
splitting down to a legal type. This will create an IntegerType
with a bit width that must be <= MAX_INT_BITS. This places an
effective upper limit on any type of 2^23 so that we don't try
create a 2^24 type.

I considered putting a fatal error somewhere in the path from
TargetLowering::getTypeConversion down to IntegerType::get, but
limiting the type in IR seemed better.

This breaks backwards compatibility with IR that is using a really
large type. I suspect such IR is going to be very rare due to the
the compile time costs such a type likely incurs.

Prevents the ICE in PR51829.

Reviewed By: efriedma, aaron.ballman

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

3 years agoFix test failure created by ef8c9135efcb
Sam Clegg [Tue, 14 Sep 2021 14:34:34 +0000 (07:34 -0700)]
Fix test failure created by ef8c9135efcb

Followup to https://reviews.llvm.org/D108877 to fix test
failure.

3 years agoFix a unittest file after D108695 when Z3 is enabled
Kristóf Umann [Tue, 14 Sep 2021 14:10:29 +0000 (16:10 +0200)]
Fix a unittest file after D108695 when Z3 is enabled

3 years ago[clangd] Ignore ObjC `id` and `instancetype` in FindTarget
David Goldman [Mon, 23 Aug 2021 14:30:49 +0000 (10:30 -0400)]
[clangd] Ignore ObjC `id` and `instancetype` in FindTarget

Even though they're implemented via typedefs, we typically
want to treat them like keywords.

We could add hover information / xrefs, but it's very unlikely
to provide any value.

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

3 years ago[WebAssembly] Allow import and export of TLS symbols between DSOs
Sam Clegg [Thu, 26 Aug 2021 19:29:32 +0000 (15:29 -0400)]
[WebAssembly] Allow import and export of TLS symbols between DSOs

We previously had a limitation that TLS variables could not
be exported (and therefore could also not be imported).  This
change removed that limitation.

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

3 years ago[PowerPC] Exploit Prefixed Load/Stores using the refactored Load/Store Implementation
Amy Kwan [Mon, 13 Sep 2021 17:26:11 +0000 (12:26 -0500)]
[PowerPC] Exploit Prefixed Load/Stores using the refactored Load/Store Implementation

This patch exploits the prefixed load and store instructions utilizing the
refactored load/store implementation introduced in D93370.

Prefixed load and store instructions are emitted whenever we are loading or
storing a value with an offset that fits into a 34-bit signed immediate.
Patterns for the prefixed load and stores are added in this patch, as well as
the implementation that detects when we are loading and storing a value with an
offset that fits in 34-bits.

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

3 years agoRemove incorrect comment in getSingleUndroppableUse. NFC
Anna Thomas [Mon, 13 Sep 2021 19:41:40 +0000 (15:41 -0400)]
Remove incorrect comment in getSingleUndroppableUse. NFC

We traverse the entire use list to find the undroppable use.

3 years agoAMDGPU: Avoid relying on an undef value in test
Matt Arsenault [Tue, 14 Sep 2021 13:19:56 +0000 (09:19 -0400)]
AMDGPU: Avoid relying on an undef value in test

This was really becoming a direct call during the DAG, so it wasn't as
true to the test purpose.

3 years ago[lldb/test] Start pexpect tests with a custom HOME
Pavel Labath [Tue, 14 Sep 2021 13:13:51 +0000 (15:13 +0200)]
[lldb/test] Start pexpect tests with a custom HOME

This addresses the flakyness of (at least) TestMultilineNavigation,
which was failing when the editline history of a concurrently executing
test made leaked in. Using a test-specific home directory ensures the
tests are independent.

3 years agoCleanup identifier parsing; NFC
Corentin Jabot [Tue, 14 Sep 2021 13:11:23 +0000 (09:11 -0400)]
Cleanup identifier parsing; NFC

Rename methods to clearly signal when they only deal with ASCII,
simplify the parsing of identifier, and use start/continue instead of
head/body for consistency with Unicode terminology.

3 years ago[Dexter] Improve performance by evaluating expressions only when needed
Stephen Tozer [Tue, 14 Sep 2021 11:06:23 +0000 (12:06 +0100)]
[Dexter] Improve performance by evaluating expressions only when needed

Currently, Dexter's model for fetching watch values is to build a list of
expressions to watch before running the debugger, then evaluating all of them at
each breakpoint, then finally looking up the values of these expressions at each
line they were expected on. When using dexter on a large project while watching
many different expressions, this is very slow, as Dexter will make a massive
number of calls made to the debugger's API, the vast majority of which are not
being used for anything. This patch fixes this issue by having Dexter only
evaluate expressions at a breakpoint when it will be used by a Dexter command.

Reviewed By: jmorse

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

3 years ago[Windows build] Use "DIA SDK" in sysroot
Nico Weber [Tue, 14 Sep 2021 12:59:28 +0000 (08:59 -0400)]
[Windows build] Use "DIA SDK" in sysroot

This updates llvm/utils/sysroot.py to include the "DIA SDK" folder in the
sysroot.

It also updates the build to look for the DIA SDK there if a sysroot is set.

This requires moving LLVM_WINSYSROOT to config-ix.cmake.

For the GN build, I chose to pass a qualified path to diaguids in libs instead
of pushing a config with a `/libpath:` flag. The former requires a GN with
https://gn-review.googlesource.com/c/gn/+/12200, the latter requires D109624.
The former is more like the cmake build, arguably a bit simpler, and it's
easier to check for the wrong GN revision and easier to update GN.

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

3 years ago[llvm cmake] replace tabs with spaces in config-ix.cmake
Nico Weber [Tue, 14 Sep 2021 12:58:59 +0000 (08:58 -0400)]
[llvm cmake] replace tabs with spaces in config-ix.cmake

3 years ago[OpenCL] Enables .rgba vector extension in C++ for OpenCL 2021
Justas Janickas [Tue, 7 Sep 2021 13:32:05 +0000 (14:32 +0100)]
[OpenCL] Enables .rgba vector extension in C++ for OpenCL 2021

`.rgba` vector extension setting in C++ for OpenCL 2021 is now
performed analogously to OpenCL C 3.0. Test case added.

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

3 years ago[mlir][linalg] Fold ExtractSliceOps during tiling.
Tobias Gysi [Tue, 14 Sep 2021 11:43:08 +0000 (11:43 +0000)]
[mlir][linalg] Fold ExtractSliceOps during tiling.

Add the makeComposedExtractSliceOp method that creates an ExtractSliceOp and folds chains of ExtractSliceOps by computing the sum of their offsets and by multiplying their strides.

Reviewed By: nicolasvasilache

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

3 years ago[runtimes] Check whether -nostdinc++ and -nostdlib++ are supported
Martin Storsjö [Mon, 13 Sep 2021 20:05:23 +0000 (23:05 +0300)]
[runtimes] Check whether -nostdinc++ and -nostdlib++ are supported

Don't blindly assume they're supported - GCC doesn't support -nostdlib++.

The llvm-project/runtimes directory is supposed to allow building the
runtimes standalone from a newly built Clang, and thus should allow
building with other compilers too.

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

3 years agoRecommit "[LAA] Support pointer phis in loop by analyzing each incoming pointer."
Florian Hahn [Mon, 13 Sep 2021 13:44:39 +0000 (14:44 +0100)]
Recommit "[LAA] Support pointer phis in loop by analyzing each incoming pointer."

SCEV does not look through non-header PHIs inside the loop. Such phis
can be analyzed by adding separate accesses for each incoming pointer
value.

This results in 2 more loops vectorized in SPEC2000/186.crafty and
avoids regressions when sinking instructions before vectorizing.

Fixes PR50296, PR50288.

Reviewed By: Meinersbur

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

3 years ago[ARM] Teach DemandedVectorElts about VMOVN lanes
David Green [Tue, 14 Sep 2021 10:05:31 +0000 (11:05 +0100)]
[ARM] Teach DemandedVectorElts about VMOVN lanes

The class of instructions that write to narrow top/bottom lanes only
demand the even or odd elements of the input lanes. Which means that a
pair of VMOVNT; VMOVNB demands no lanes from the original input. This
teaches that to instcombine from the target hooks available through
ARMTTIImpl.

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

3 years ago[MLIR] Improve op parse error message for AtLeastNOperands trait
Uday Bondhugula [Tue, 14 Sep 2021 08:42:50 +0000 (14:12 +0530)]
[MLIR] Improve op parse error message for AtLeastNOperands trait

Improve parse error message for "at least N operands" op trait.

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

3 years ago[libc][Obvious] Some clean work with memmove.
Cheng Wang [Tue, 14 Sep 2021 09:19:28 +0000 (17:19 +0800)]
[libc][Obvious] Some clean work with memmove.

3 years ago[clang] disable implicit moves when not in CPlusPLus
Matheus Izvekov [Sat, 11 Sep 2021 23:11:02 +0000 (01:11 +0200)]
[clang] disable implicit moves when not in CPlusPLus

See PR51842.

This fixes an assert firing in the static analyzer, triggered by implicit moves
in blocks in C mode:

This also simplifies the AST a little bit when compiling non C++ code,
as the xvalue implicit casts are not inserted.

We keep and test that the nrvo flag is still being set on the VarDecls,
as that is still a bit beneficial while not really making anything
more complicated.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: NoQ

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

3 years agoAArch64: fix indentation of ProcAppleA14. NFC.
Tim Northover [Tue, 14 Sep 2021 09:00:34 +0000 (10:00 +0100)]
AArch64: fix indentation of ProcAppleA14. NFC.

3 years ago[OpenCL] Tests C++ for OpenCL version macros
Justas Janickas [Tue, 7 Sep 2021 13:40:46 +0000 (14:40 +0100)]
[OpenCL] Tests C++ for OpenCL version macros

Version macro definitions are tested for C++ for OpenCL when
explicit version is provided on command line via `-cl-std` flag.

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

3 years ago[WebAssembly] NFC: Remove unused tblgen template args
Cullen Rhodes [Tue, 14 Sep 2021 07:52:12 +0000 (07:52 +0000)]
[WebAssembly] NFC: Remove unused tblgen template args

Identified in D109359.

Reviewed By: aheejin

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

3 years ago[AArch64] NFC: Use 'asm' in SIMDScalarCPY
Cullen Rhodes [Tue, 14 Sep 2021 07:52:05 +0000 (07:52 +0000)]
[AArch64] NFC: Use 'asm' in SIMDScalarCPY

Fixes a warning identified in D109359. The mnemonic is also mov, not
cpy.

Reviewed By: dmgreen

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

3 years ago[Win64EH] Write .pdata symbol relocations relative to the temporary begin symbol
Martin Storsjö [Tue, 7 Sep 2021 11:56:43 +0000 (14:56 +0300)]
[Win64EH] Write .pdata symbol relocations relative to the temporary begin symbol

Previously the relocations pointed at the public user facing,
possibly external symbol.

When the function itself is weak, that symbol may be overridden at
link time, pointing at another strong implementation of the same
function instead. In that case, there's two conflicting pdata entries
pointing at the same address, and the wrong unwind info might end up
used.

Both GCC/binutils and MSVC produce pdata pointing at internal static
symbols. (GCC/binutils point at the .text section just as LLVM does
after this change, MSVC points at special label type symbols with the
type IMAGE_SYM_CLASS_LABEL and names like '$LN4'.)

This fixes unwinding through an overridden "operator new" with a
statically linked C++ library in MinGW mode. (Building libc++ with
-ffunction-sections and linking with --gc-sections might avoid the
issue too.)

This makes the produced object files a little less user friendly
to debug, but with other recent improvements for llvm-readobj, the
unwind info debugging experience should be pretty much the same.

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

3 years ago[llvm-readobj] [COFF] Resolve relocations pointing at section symbols for arm64 too
Martin Storsjö [Mon, 6 Sep 2021 12:30:37 +0000 (15:30 +0300)]
[llvm-readobj] [COFF] Resolve relocations pointing at section symbols for arm64 too

This syncs parts from the x86 implementation to the ARMWinEH
implementation.

Currently, neither of the compilers targeting COFF/arm64 (MSVC, LLVM)
produce such relocations, but LLVM might after a later patch.

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

3 years ago[llvm-readobj] [COFF] Try to resolve symbols in unwind info on x86
Martin Storsjö [Fri, 10 Sep 2021 13:31:30 +0000 (16:31 +0300)]
[llvm-readobj] [COFF] Try to resolve symbols in unwind info on x86

This is the same as we do on arm64 already for the MSVC style label
symbols, but also handle the way GCC produces it - with all relocations
pointing at the .text section symbol, with various offsets.

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

3 years ago[runtimes] Calculate the path to the llvm directory without the LLVM cmake package
Martin Storsjö [Mon, 13 Sep 2021 19:27:44 +0000 (22:27 +0300)]
[runtimes] Calculate the path to the llvm directory without the LLVM cmake package

If building by pointing cmake directly at the llvm-project/runtimes
directory, the llvm cmake package files (that provide e.g.
LLVM_BUILD_MAIN_SRC_DIR) aren't necessarily available. Instead just
use a path relative to the current source dir.

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

3 years ago[runtimes] Initialize LLVM_DEFAULT_TARGET_TRIPLE if not set by the caller
Martin Storsjö [Mon, 13 Sep 2021 19:27:17 +0000 (22:27 +0300)]
[runtimes] Initialize LLVM_DEFAULT_TARGET_TRIPLE if not set by the caller

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

3 years agoCheck supported architectures in sseXYZ/avxXYZ headers
serge-sans-paille [Mon, 13 Sep 2021 13:27:24 +0000 (15:27 +0200)]
Check supported architectures in sseXYZ/avxXYZ headers

It doesn't make sense to include those headers on the wrong architecture,
provide an explicit error message in that case.

Fix https://bugs.llvm.org/show_bug.cgi?id=48915

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

3 years ago[WebAssembly] Fix a typo in comments
Heejin Ahn [Tue, 14 Sep 2021 07:44:27 +0000 (00:44 -0700)]
[WebAssembly] Fix a typo in comments

3 years agoFixup some formatting from a recent commit
David Blaikie [Tue, 14 Sep 2021 07:41:19 +0000 (00:41 -0700)]
Fixup some formatting from a recent commit

3 years agoDebugInfo: Add support for template parameters with reference qualifiers
David Blaikie [Tue, 14 Sep 2021 07:32:06 +0000 (00:32 -0700)]
DebugInfo: Add support for template parameters with reference qualifiers

Followon from the previous commit supporting cvr qualifiers.

3 years agoDebugInfo: Add support for template parameters with qualifiers
David Blaikie [Tue, 14 Sep 2021 07:02:36 +0000 (00:02 -0700)]
DebugInfo: Add support for template parameters with qualifiers

eg: t1<void () const> - DWARF doesn't have a particularly nice way to
encode this, for real member function types (like `void (t1::*)()
const`) the const-ness is encoded in the type of the artificial first
parameter. But `void () const` has no parameters, so encode it like a
normal const-qualified type, using DW_TAG_const_type. (similarly for
restrict and volatile)

Reference qualifiers (& and &&) coming in a separate commit shortly.

3 years ago[yaml2obj][XCOFF] add the SectionIndex field for symbol.
Esme-Yi [Tue, 14 Sep 2021 06:18:03 +0000 (06:18 +0000)]
[yaml2obj][XCOFF] add the SectionIndex field for symbol.

Summary: Add the SectionIndex field for symbol.
1: a symbol can reference a section by SectionName or SectionIndex.
2: a symbol can reference a section by both SectionName and SectionIndex.
3: if both Section and SectionIndex are specified, but the two values refer
   to different sections, an error will be reported.
4: an invalid SectionIndex is allowed.
5: if a symbol references a non-existent section by SectionName, an error will be reported.

Reviewed By: jhenderson, Higuoxing

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

3 years ago[APInt] Add a concat method, use LLVM_UNLIKELY to help optimizer.
Chris Lattner [Fri, 10 Sep 2021 18:31:26 +0000 (11:31 -0700)]
[APInt] Add a concat method, use LLVM_UNLIKELY to help optimizer.

Three unrelated changes:

1) Add a concat method as a convenience to help write bitvector
   use cases in a nicer way.
2) Use LLVM_UNLIKELY as suggested by @xbolva00 in a previous patch.
3) Fix casing of some "slow" methods to follow naming standards.

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

3 years ago[PowerPC] prepare more loop load/store instructions
Chen Zheng [Tue, 14 Sep 2021 04:26:33 +0000 (04:26 +0000)]
[PowerPC] prepare more loop load/store instructions

PPCLoopInstrFormPrep pass now can prepare for load store instructions
in a loop whose increment is not a constant integer.

Reviewed By: jsji

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

3 years agoAMDGPU: Fix assert with indirect call with known required inputs
Matt Arsenault [Tue, 14 Sep 2021 01:52:07 +0000 (21:52 -0400)]
AMDGPU: Fix assert with indirect call with known required inputs

The attributor can determine that some indirect calls do not require
special inputs. The special inputs will still be present in the ABI,
so we need to allocate the registers and pass undefs.

3 years agoImprove type printing of const arrays to normalize array-of-const and const-array
David Blaikie [Tue, 14 Sep 2021 02:03:41 +0000 (19:03 -0700)]
Improve type printing of const arrays to normalize array-of-const and const-array

Since these map to the same effective type - render them the same/in the
more legible way (const x[n]).

3 years ago[mlir][linalg] makeTiledShape: No affine.min if tile size == 1
Matthias Springer [Tue, 14 Sep 2021 01:47:39 +0000 (10:47 +0900)]
[mlir][linalg] makeTiledShape: No affine.min if tile size == 1

This improves codegen (more static type information) with `scalarize-dynamic-dims`.

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

3 years ago[mlir][linalg] New tiling option: Scalarize dynamic dims
Matthias Springer [Tue, 14 Sep 2021 01:40:13 +0000 (10:40 +0900)]
[mlir][linalg] New tiling option: Scalarize dynamic dims

This tiling option scalarizes all dynamic dimensions, i.e., it tiles all dynamic dimensions by 1.

This option is useful for linalg ops with partly dynamic tensor dimensions. E.g., such ops can appear in the partial iteration after loop peeling. After scalarizing dynamic dims, those ops can be vectorized.

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

3 years ago[mlir][linalg] Add scf.for loop peeling to codegen strategy
Matthias Springer [Tue, 14 Sep 2021 01:27:00 +0000 (10:27 +0900)]
[mlir][linalg] Add scf.for loop peeling to codegen strategy

Only scf.for loops are supported at the moment. linalg.tiled_loop support will be added in a subsequent commit.

Only static tensor sizes are supported. Loops for dynamic tensor sizes can be peeled, but the generated code is not optimal due to a missing canonicalization pattern.

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

3 years ago[Bazel] Fix Bazel config for 2c8e784915
Geoffrey Martin-Noble [Tue, 14 Sep 2021 01:22:42 +0000 (18:22 -0700)]
[Bazel] Fix Bazel config for 2c8e784915

Updates the Bazel config for OrcTargetProcess after
https://github.com/llvm/llvm-project/commit/2c8e784915

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

3 years ago[mlir][linalg] TiledLoopOp peeling: Do not peel partial iterations
Matthias Springer [Tue, 14 Sep 2021 00:59:41 +0000 (09:59 +0900)]
[mlir][linalg] TiledLoopOp peeling: Do not peel partial iterations

Extend the unit test with an option for skipping partial iterations during loop peeling.

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

3 years ago[RISCV] add Half-precision test for vle/vse
Shao-Ce Sun [Mon, 13 Sep 2021 10:28:10 +0000 (18:28 +0800)]
[RISCV] add Half-precision test for vle/vse

Reviewed By: craig.topper

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

3 years ago[gn build] Port 2c8e78491588
LLVM GN Syncbot [Tue, 14 Sep 2021 00:27:49 +0000 (00:27 +0000)]
[gn build] Port 2c8e78491588

3 years ago[ORC] Fix self-assignment.
Lang Hames [Mon, 13 Sep 2021 23:21:39 +0000 (09:21 +1000)]
[ORC] Fix self-assignment.

We want to read the page size from EPI->PageSize. Thanks to Simon Pilgrim for
spotting this.

3 years ago[ORC] Add Shared/OrcRTBridge, and TargetProcess/OrcRTBootstrap.
Lang Hames [Mon, 13 Sep 2021 03:45:31 +0000 (13:45 +1000)]
[ORC] Add Shared/OrcRTBridge, and TargetProcess/OrcRTBootstrap.

This is a small first step towards reorganization of the ORC libraries:

Declarations for types and function names (as strings) to be found in the
"ORC runtime bootstrap" set are moved into OrcRTBridge.h / OrcRTBridge.cpp.

The current implementation of the "ORC runtime bootstrap" functions is moved
into OrcRTBootstrap.h and OrcRTBootstrap.cpp. It is likely that this code will
eventually be moved into ORT-RT proper (in compiler RT).

The immediate goal of this change is to make these bootstrap functions usable
for clients other than SimpleRemoteEPC/SimpleRemoteEPCServer. The first planned
client is a new RuntimeDyld::MemoryManager that will run over EPC, which will
allow us to remove the old OrcRemoteTarget code.

3 years ago[Hexagon] Use getTypeAllocSize to compute difference between objects
Brendon Cahoon [Tue, 14 Sep 2021 00:04:00 +0000 (19:04 -0500)]
[Hexagon] Use getTypeAllocSize to compute difference between objects

The code was using getTypeStoreSize to calculate the difference
between consecutive objects. The calculation was incorrect due
to padding that is added between consecutive objects. The
getTypeAllocSize includes the padding amount. For example,
if the type is [19 x i8], the difference between consecutive
objects is 32 bytes, not 19 bytes.

A second case for getTypeAllocSize is needed when computing
the pointer values for the vector accesses. The calculation needs
to account for the padding as well.

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

3 years ago[Hexagon] Handle bitcast of i64/i128 -> v64i1/v128i1
Ankit Aggarwal [Mon, 13 Sep 2021 23:52:09 +0000 (18:52 -0500)]
[Hexagon] Handle bitcast of i64/i128 -> v64i1/v128i1

3 years ago[clang] Revert gcc-driver part of 648feabc65d8
Nico Weber [Mon, 13 Sep 2021 23:03:33 +0000 (19:03 -0400)]
[clang] Revert gcc-driver part of 648feabc65d8

See discussion on https://reviews.llvm.org/D109624

3 years ago[opt] Remove some legacy PM flags
Arthur Eubanks [Sun, 12 Sep 2021 21:39:49 +0000 (14:39 -0700)]
[opt] Remove some legacy PM flags

Reviewed By: asbirlea

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