platform/upstream/llvm.git
3 years ago[mlir][linalg] Cleanup LinalgOp usage in sparse compiler (NFC).
Tobias Gysi [Wed, 2 Jun 2021 06:21:13 +0000 (06:21 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in sparse compiler (NFC).

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

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

3 years agoResubmit D85085 after fixing the tests that were failing.
Sriraman Tallam [Tue, 1 Jun 2021 19:38:32 +0000 (12:38 -0700)]
Resubmit D85085 after fixing the tests that were failing.

D85085 was pushed earlier but broke tests on mac and win:
http://lab.llvm.org:8080/green/job/clang-stage1-RA/21182/consoleFull#-706149783d489585b-5106-414a-ac11-3ff90657619c

Recommitting it after adding mtriple to the llc commands.

Emit correct location lists with basic block sections.

This patch addresses multiple things:

1) It ensures that const_value is emitted when possible with basic block
   sections.
2) It emits location lists such that the labels are always within the
   section boundary.
3) It fixes a bug when the parameter is first used in a non-entry block
   which is in a different section from the entry block.

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

3 years ago[lldb/API] Expose triple for SBProcessInfo.
Bruce Mitchener [Sun, 30 May 2021 10:28:09 +0000 (17:28 +0700)]
[lldb/API] Expose triple for SBProcessInfo.

This is present when doing a `platform process list` and is
tracked by the underlying code. To do something like the
process list via the SB API in the future, this must be
exposed.

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

3 years ago[NFC][msan] Fix warning on sanitizer-ppc64le-linux bot
Vitaly Buka [Wed, 2 Jun 2021 04:03:41 +0000 (21:03 -0700)]
[NFC][msan] Fix warning on sanitizer-ppc64le-linux bot

3 years ago[scudo] Enabled MTE in tests
Vitaly Buka [Thu, 27 May 2021 17:10:50 +0000 (10:10 -0700)]
[scudo] Enabled MTE in tests

Reviewed By: pcc, hctim

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

3 years agoRevert "Fix tmp files being left on Windows builds." for now;
Amy Huang [Wed, 2 Jun 2021 02:51:47 +0000 (19:51 -0700)]
Revert "Fix tmp files being left on Windows builds." for now;
causing some asan test failures.

This reverts commit 7daa18215905c831e130c7542f17619e9d936dfc.

3 years ago[libc++] Add a CI job to test libc++ when building for 32 bit
Louis Dionne [Wed, 2 Dec 2020 21:40:31 +0000 (16:40 -0500)]
[libc++] Add a CI job to test libc++ when building for 32 bit

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

3 years ago[RISCV] Improve register allocation for masked vwadd(u).wv, vwsub(u).wv, vfwadd.wv...
Craig Topper [Wed, 2 Jun 2021 01:29:13 +0000 (18:29 -0700)]
[RISCV] Improve register allocation for masked vwadd(u).wv, vwsub(u).wv, vfwadd.wv, and vfwsub.wv.

The first source has the same EEW as the destination, but we're
using earlyclobber which prevents them from ever being the same
register.

To workaround this, add a special TIED pseudo to use whenever the
first source and merge operand are the same value. This allows
us to use a single operand for the merge operand and first source
which we can then tie to the destination. A tied source disables
earlyclobber for that operand.

Reviewed By: arcbbb

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

3 years ago[gn build] Port 924ea3bb53ca
LLVM GN Syncbot [Wed, 2 Jun 2021 01:47:33 +0000 (01:47 +0000)]
[gn build] Port 924ea3bb53ca

3 years ago[libc++] NFC: Move unwrap_iter to its own header
Louis Dionne [Mon, 31 May 2021 16:08:05 +0000 (12:08 -0400)]
[libc++] NFC: Move unwrap_iter to its own header

This re-applies 9968896cd62a, which was reverted in b13edf6e907b because
it broke the build.

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

3 years ago[mlir] Support tensor types in unrolled VectorToSCF
Matthias Springer [Wed, 2 Jun 2021 01:38:59 +0000 (10:38 +0900)]
[mlir] Support tensor types in unrolled VectorToSCF

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

3 years ago[llvm-readobj] Print function names with `--bb-addr-map`.
Rahman Lavaee [Wed, 26 May 2021 20:36:44 +0000 (13:36 -0700)]
[llvm-readobj] Print function names with `--bb-addr-map`.

This patch uses the `getSymbolIndexForFunctionAddress` helper function to print function names for BB address map entries.

Reviewed By: jhenderson

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

3 years ago[mlir] Support tensor types in non-unrolled VectorToSCF
Matthias Springer [Wed, 2 Jun 2021 01:29:07 +0000 (10:29 +0900)]
[mlir] Support tensor types in non-unrolled VectorToSCF

Support for tensor types in the unrolled version will follow in a separate commit.

Add a new pass option to activate lowering of transfer ops with tensor types (default: deactivated).

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

3 years ago[CUDA][HIP] Promote const variables to constant
Yaxun (Sam) Liu [Tue, 25 May 2021 18:06:08 +0000 (14:06 -0400)]
[CUDA][HIP] Promote const variables to constant

Recently we added diagnosing ODR-use of host variables
in device functions, which includes ODR-use of const
host variables since they are not really emitted on
device side. This caused regressions since we used
to allow ODR-use of const host variables in device
functions.

This patch allows ODR-use of const variables in device
functions if the const variables can be statically initialized
and have an empty dtor. Such variables are marked with
implicit constant attrs and emitted on device side. This is
in line with what clang does for constexpr variables.

Reviewed by: Artem Belevich

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

3 years agoMake ignore counts work as "after stop" modifiers so they play nicely with conditions
Jim Ingham [Tue, 1 Jun 2021 23:14:08 +0000 (16:14 -0700)]
Make ignore counts work as "after stop" modifiers so they play nicely with conditions

Previously ignore counts were checked when we stopped to do the sync callback in Breakpoint::ShouldStop. That meant we would do all the ignore count work even when
there is also a condition says the breakpoint should not stop.

That's wrong, lldb treats breakpoint hits that fail the thread or condition checks as "not having hit the breakpoint". So the ignore count check should happen after
the condition and thread checks in StopInfoBreakpoint::PerformAction.

The one side-effect of doing this is that if you have a breakpoint with a synchronous callback, it will run the synchronous callback before checking the ignore count.
That is probably a good thing, since this was already true of the condition and thread checks, so this removes an odd asymmetry. And breakpoints with sync callbacks
are all internal lldb breakpoints and there's not a really good reason why you would want one of these to use an ignore count (but not a condition or thread check...)

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

3 years ago[RISCV][test] Add new tests of bitwise and with constant for the Zbs extension
Ben Shi [Sat, 29 May 2021 10:18:45 +0000 (18:18 +0800)]
[RISCV][test] Add new tests of bitwise and with constant for the Zbs extension

These tests will show how (and r i) will be optimized to
(BCLRI (BCLRI r, i0), i1) or (BCLRI (ANDI r, i0), i1) by future
commits.

Reviewed By: craig.topper

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

3 years ago[CUDA][HIP] Change default lang std to c++14
Yaxun (Sam) Liu [Thu, 27 May 2021 03:11:33 +0000 (23:11 -0400)]
[CUDA][HIP] Change default lang std to c++14

Currently clang and nvcc use c++14 as default std for C++.
gcc 11 even uses c++17 as default std for C++. However,
clang uses c++98 as default std for CUDA/HIP.

As c++14 has been well adopted and became default for
clang, it seems reasonable to use c++14 as default std
for CUDA/HIP.

Reviewed by: Artem Belevich

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

3 years agoRemove x86 test amx-fast-tile-config.mir (by its author)
Xiang1 Zhang [Wed, 2 Jun 2021 00:29:29 +0000 (08:29 +0800)]
Remove x86 test amx-fast-tile-config.mir (by its author)

This test contains a lot of manual changes which is not convenient
to update, and the checks are duplicated with test amx-configO2toO0.ll

3 years agoFix tmp files being left on Windows builds.
Amy Huang [Tue, 4 May 2021 18:28:28 +0000 (11:28 -0700)]
Fix tmp files being left on Windows builds.

Clang writes object files by first writing to a .tmp file and then
renaming to the final .obj name. On Windows, if a compile is killed
partway through the .tmp files don't get deleted.

Currently it seems like RemoveFileOnSignal takes care of deleting the
tmp files on Linux, but on Windows we need to call
setDeleteDisposition on tmp files so that they are deleted when
closed.

This patch switches to using TempFile to create the .tmp files we write
when creating object files, since it uses setDeleteDisposition on Windows.
This change applies to both Linux and Windows for consistency.

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

3 years ago[AMDGPU] All GWS instructions need aligned VGPR on gfx90a
Stanislav Mekhanoshin [Tue, 25 May 2021 23:37:01 +0000 (16:37 -0700)]
[AMDGPU] All GWS instructions need aligned VGPR on gfx90a

Fixes: SWDEV-288006

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

3 years ago[OpaquePtr] Create API to make a copy of a PointerType with some address space
Arthur Eubanks [Thu, 27 May 2021 03:32:04 +0000 (20:32 -0700)]
[OpaquePtr] Create API to make a copy of a PointerType with some address space

Some existing places use getPointerElementType() to create a copy of a
pointer type with some new address space.

Reviewed By: dblaikie

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

3 years ago[mlir-reduce] Reducer refactor.
Chia-hung Duan [Tue, 1 Jun 2021 23:00:19 +0000 (07:00 +0800)]
[mlir-reduce] Reducer refactor.

* A Reducer is a kind of RewritePattern, so it's just the same as
writing graph rewrite.
* ReductionTreePass operates on Operation rather than ModuleOp, so that
* we are able to reduce a nested structure(e.g., module in module) by
* self-nesting.

Reviewed By: jpienaar, rriddle

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

3 years ago[InstSimplify] Treat invariant group insts as bitcasts for load operands
Arthur Eubanks [Thu, 22 Apr 2021 20:03:09 +0000 (13:03 -0700)]
[InstSimplify] Treat invariant group insts as bitcasts for load operands

We can look through invariant group intrinsics for the purposes of
simplifying the result of a load.

Since intrinsics can't be constants, but we also don't want to
completely rewrite load constant folding, we convert the load operand to
a constant. For GEPs and bitcasts we just treat them as constants. For
invariant group intrinsics, we treat them as a bitcast.

Reviewed By: lebedev.ri

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

3 years ago[test] Precommit test for D101103
Arthur Eubanks [Tue, 1 Jun 2021 23:30:48 +0000 (16:30 -0700)]
[test] Precommit test for D101103

3 years ago[lld/mac] Make -t work correctly with -flat_namespace
Nico Weber [Mon, 31 May 2021 22:20:22 +0000 (18:20 -0400)]
[lld/mac] Make -t work correctly with -flat_namespace

We used to not print dylibs referenced by other dylibs in `-t` mode. This
affected reexports, and with `-flat_namespace` also just dylibs loaded by
dylibs. Now we print them.

Fixes PR49514.

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

3 years ago[clang][Fuchsia] Turn on relative-vtables by default for Fuchsia
Leonard Chan [Wed, 12 May 2021 17:37:37 +0000 (10:37 -0700)]
[clang][Fuchsia] Turn on relative-vtables by default for Fuchsia

All fuchsia targets will now use the relative-vtables ABI by default.
Also remove -fexperimental-relative-c++-abi-vtables from test RUNs targeting fuchsia.

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

3 years ago[Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable
Michael Benfield [Tue, 1 Jun 2021 21:49:34 +0000 (14:49 -0700)]
[Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

These are intended to mimic warnings available in gcc.

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

3 years ago[various] Remove or use variables which are unused but set.
Michael Benfield [Tue, 1 Jun 2021 21:48:42 +0000 (14:48 -0700)]
[various] Remove or use variables which are unused but set.

This is in preparation for the -Wunused-but-set-variable warning.

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

3 years ago[lld-macho][nfc] Remove unnecessary use of Optional<T*>
Vy Nguyen [Tue, 1 Jun 2021 20:09:41 +0000 (16:09 -0400)]
[lld-macho][nfc] Remove unnecessary use of Optional<T*>

In all of these cases, the functions could simply return a nullptr instead of {}.
There is no case where Optional<nullptr> has a special meaning.

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

3 years ago[CSE] Ask DominanceInfo about "hasSSADominance" instead of reconstructing it.
Chris Lattner [Tue, 1 Jun 2021 22:15:28 +0000 (15:15 -0700)]
[CSE] Ask DominanceInfo about "hasSSADominance" instead of reconstructing it.

I backed this off to make the previous patch easier to wrangle, but now
this is an efficient query and it is better to not replace it in CSE.

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

3 years ago[lld/mac] Emit only one LC_LOAD_DYLIB per dylib
Nico Weber [Tue, 1 Jun 2021 19:13:46 +0000 (15:13 -0400)]
[lld/mac] Emit only one LC_LOAD_DYLIB per dylib

In some cases, we end up with several distinct DylibFiles that
have the same install name. Only emit a single LC_LOAD_DYLIB in
those cases.

This happens in 3 cases I know of:

1. Some tbd files are symlinks. libpthread.tbd is a symlink against
   libSystem.tbd for example, so `-lSystem -lpthread` loads
   libSystem.tbd twice. We could (and maybe should) cache loaded
   dylibs by realpath() to catch this.

2. Some tbd files are copies of each other. For example,
   CFNetwork.framework/CFNetwork.tbd and
   CFNetwork.framework/Versions/A/CFNetwork.tbd are two distinct
   copies of the same file. The former is found by
   `-framework CFNetwork` and the latter by the reexport in
   CoreServices.tbd. We could conceivably catch this by
   making `-framework` search look in `Versions/Current` instead
   of in the root, and/or by using a content hash to cache
   tbd files, but that's starting to sound complicated.

3. Magic $ld$ symbol processing can change the install name of
   a dylib based on the target platform_version. Here, two
   truly distinct dylibs can have the same install name.

So we need this code to deal with (3) anyways. Might as well use
it for 1 and 2, at least for now :)

With this (and D103430), clang-format links in the same dylibs
when linked with lld and ld64.

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

3 years ago[Fuchsia] Add compat multilibs to cache file
Leonard Chan [Tue, 1 Jun 2021 22:14:03 +0000 (15:14 -0700)]
[Fuchsia] Add compat multilibs to cache file

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

3 years ago[Dominators] Rewrite the dominator implementation for efficiency. NFC.
Chris Lattner [Mon, 31 May 2021 01:02:51 +0000 (18:02 -0700)]
[Dominators] Rewrite the dominator implementation for efficiency. NFC.

The previous impl densely scanned the entire region starting with an op
when dominators were created, creating a DominatorTree for every region.

This is extremely expensive up front -- particularly for clients like
Linalg/Transforms/Fusion.cpp that construct DominanceInfo for a single
query.  It is also extremely memory wasteful for IRs that use single
block regions commonly (e.g. affine.for) because it's making a
dominator tree for a region that has trivial dominance.  The
implementation also had numerous unnecessary minor efficiencies, e.g.
doing multiple walks of the region tree or tryGetBlocksInSameRegion
building a DenseMap that it didn't need.

This patch switches to an approach where [Post]DominanceInfo is free
to construct, and which lazily constructs DominatorTree's for any
multiblock regions that it needs.  This avoids the up-front cost
entirely, making its runtime proportional to the complexity of the
region tree instead of # ops in a region.  This also avoids the memory
and time cost of creating DominatorTree's for single block regions.

Finally this rewrites the implementation for simplicity and to avoids
the constant factor problems the old implementation had.

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

3 years ago[lld][WebAssemlby] Fix for string merging of -dwarf-5 sections
Sam Clegg [Tue, 1 Jun 2021 19:48:21 +0000 (12:48 -0700)]
[lld][WebAssemlby] Fix for string merging of -dwarf-5 sections

We were mistakenly treating `.debug_str_offsets` as a string mergable
section when it is not (it contains integers not strings).  This is an
indication that we really should find a way to store flags for custom
sections.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=48828
Fixes: https://bugs.chromium.org/p/chromium/issues/detail?id=1172217

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

3 years ago[gn build] Port 065cf3f9d703
LLVM GN Syncbot [Tue, 1 Jun 2021 21:08:31 +0000 (21:08 +0000)]
[gn build] Port 065cf3f9d703

3 years ago[libcxx][ranges] Add `default_sentinel` and `default_sentinel_t`.
zoecarver [Tue, 1 Jun 2021 19:55:33 +0000 (12:55 -0700)]
[libcxx][ranges] Add `default_sentinel` and `default_sentinel_t`.

Refs https://eel.is/c++draft/default.sentinel and https://eel.is/c++draft/iterator.synopsis

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

3 years agoFix a Clang diagnostic to start with a lowercase letter; NFC
Aaron Ballman [Tue, 1 Jun 2021 21:03:00 +0000 (17:03 -0400)]
Fix a Clang diagnostic to start with a lowercase letter; NFC

3 years agofixup: Missing operator in [globalisel][legalizer] Separate the deprecated LegalizerI...
Daniel Sanders [Tue, 1 Jun 2021 20:57:46 +0000 (13:57 -0700)]
fixup: Missing operator in [globalisel][legalizer] Separate the deprecated LegalizerInfo from the current one

My local compiler was fine with it but the bots complain about ambiguous types.

3 years ago[lld/mac] fix test failure after 24979e111
Nico Weber [Tue, 1 Jun 2021 20:34:10 +0000 (16:34 -0400)]
[lld/mac] fix test failure after 24979e111

If there is an error reading the dylib, we shouldn't try
to load its reexports.

Caught e.g. by https://lab.llvm.org/buildbot/#/builders/36/builds/8946

3 years ago[libc++] Fix the std_include.sh.cpp test that has been failing since c9385297ce
Louis Dionne [Tue, 1 Jun 2021 17:58:17 +0000 (13:58 -0400)]
[libc++] Fix the std_include.sh.cpp test that has been failing since c9385297ce

The compiler used on Apple bots doesn't know about -std=c++20 yet, so
we can't use that just yet.

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

3 years ago[gn build] Port aaac268285ff
LLVM GN Syncbot [Tue, 1 Jun 2021 20:28:25 +0000 (20:28 +0000)]
[gn build] Port aaac268285ff

3 years ago[mlir] Updated depthwise conv to support kernel dilation
Rob Suderman [Thu, 27 May 2021 01:02:30 +0000 (18:02 -0700)]
[mlir] Updated depthwise conv to support kernel dilation

Depthwise convolution should support kernel dilation and non-dilation should
not be a special case. Updated op definition to include a dilation attribute.

This also adds a tosa.depthwise_conv2d lowering to linalg to support the new
linalg behavior.

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

3 years ago[globalisel][legalizer] Separate the deprecated LegalizerInfo from the current one
Daniel Sanders [Sat, 29 May 2021 02:36:56 +0000 (19:36 -0700)]
[globalisel][legalizer] Separate the deprecated LegalizerInfo from the current one

It's still in use in a few places so we can't delete it yet but there's not
many at this point.

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

3 years agoConvert TableGen assert to error
Stephen Neuendorffer [Wed, 28 Apr 2021 04:34:35 +0000 (21:34 -0700)]
Convert TableGen assert to error

This gives a nice message about the location of errors in a large
tablegen file, which is much more useful for users

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

3 years ago[NFC][OpaquePtr] Explicitly pass GEP source type to IRBuilder in more places
Arthur Eubanks [Tue, 18 May 2021 22:09:06 +0000 (15:09 -0700)]
[NFC][OpaquePtr] Explicitly pass GEP source type to IRBuilder in more places

3 years ago[lld/mac] Implement removal of unused dylibs
Nico Weber [Tue, 1 Jun 2021 02:12:35 +0000 (22:12 -0400)]
[lld/mac] Implement removal of unused dylibs

This omits load commands for unreferenced dylibs if:
- the dylib was loaded implicitly,
- it is marked MH_DEAD_STRIPPABLE_DYLIB
- or -dead_strip_dylibs is passed

This matches ld64.

Currently, the "is dylib referenced" state is computed before dead code
stripping and is not updated after dead code stripping. This too matches ld64.
We should do better here.

With this, clang-format linked with lld (like with ld64) no longer has
libobjc.A.dylib in `otool -L` output. (It was implicitly loaded as a reexport
of CoreFoundation.framework, but it's not needed.)

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

3 years agoWindowsSupport.h: do not depend on private config header
Andrew Kelley [Tue, 1 Jun 2021 19:58:05 +0000 (22:58 +0300)]
WindowsSupport.h: do not depend on private config header

WindowsSupport.h is a public header, however if it gets included, will cause a compile error indicating that llvm/Config/config.h cannot be found, because config.h is a private header. However there is no actual dependency on the private things in this header, so it can be changed to the public config header.

Reviewed By: amccarth

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

3 years ago[InstCombine] add tests for cast folding; NFC
Sanjay Patel [Tue, 1 Jun 2021 16:05:36 +0000 (12:05 -0400)]
[InstCombine] add tests for cast folding; NFC

https://llvm.org/PR49543

3 years ago[SystemZ][z/OS] Stricter condition for HLASM class instantiation
Anirudh Prasad [Tue, 1 Jun 2021 19:55:34 +0000 (15:55 -0400)]
[SystemZ][z/OS] Stricter condition for HLASM class instantiation

- A lot of lit tests simply specify the arch minus the triple. On z/OS, this could result in a scenario of some-other-triple-unknown-ibm-zos. This points to an incorrect triple + arch combo.
- To prevent this, isOSzOS change is switched in favour of isOSBinFormatGOFF.
- This is because, the GOFF format is set only if the triple is systemz and if the operating system is GOFF. And currently, there are no other architectures/os's using the GOFF file format.
- An argument could be made that the problematic tests be fixed to explicitly specify the arch-vendor-triple string, but there's a large number of these tests, and adding this stricter scope ensures that we aren't instantiating the incorrect instance of the AsmParser for other platforms when run on z/OS.

Reviewed By: uweigand

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

3 years ago[clang] Fix ICE with typeid & polymorphic class (pr50497)
Nathan Sidwell [Thu, 27 May 2021 14:34:39 +0000 (07:34 -0700)]
[clang] Fix ICE with typeid & polymorphic class (pr50497)

This addresses pr50497. The argument of a typeid expression is
unevaluated, *except* when it's a polymorphic type. We handle this by
parsing as unevaluated and then transforming to evaluated if we
discover it should have been an evaluated context.

We do the same in TreeTransform<Derived>::TransformCXXTypeidExpr,
entering unevaluated context before transforming and rebuilding the
typeid. But that's incorrect and can lead us to converting to
evaluated context twice -- and hitting an assert.

During normal template instantiation we're always cloning the
expression, but during generic lambda processing we do not necessarily
AlwaysRebuild, and end up with TransformDeclRefExpr unconditionally
calling MarkDeclRefReferenced around line 10226. That triggers the
assert.

// Mark it referenced in the new context regardless.
// FIXME: this is a bit instantiation-specific.
SemaRef.MarkDeclRefReferenced(E);

This patch makes 2 changes.

a) TreeTransform<Derived>::TransformCXXTypeidExpr only enters
unevaluated context if the typeid's operand is not a polymorphic
glvalue. If it is, it keeps the same evaluation context.

b) Sema::BuildCXXTypeId is altered to only transform to evaluated, if
the current context is unevaluated.

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

3 years ago[gn build] Port 5671ff20d92b
LLVM GN Syncbot [Tue, 1 Jun 2021 19:37:29 +0000 (19:37 +0000)]
[gn build] Port 5671ff20d92b

3 years ago[libcxx] Implement view.interface.
zoecarver [Fri, 30 Apr 2021 22:24:28 +0000 (15:24 -0700)]
[libcxx] Implement view.interface.

This will unblock work on ranges::view. Based on D101396.

Refs http://eel.is/c++draft/view.interface.

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

3 years ago[lld/mac] Don't load DylibFiles from the DylibFile constructor
Nico Weber [Mon, 31 May 2021 18:59:48 +0000 (14:59 -0400)]
[lld/mac] Don't load DylibFiles from the DylibFile constructor

loadDylib() keeps a name->DylibFile cache, but it only writes
to the cache once the DylibFile constructor has completed.
So dylib loads done recursively from the DylibFile constructor
wouldn't use the cache.

Now, we load additional dylibs after writing to the cache,
which means the cache now gets used for dylibs loaded because
they're referenced from other dylibs.

Related to PR49514 and PR50101, but no dramatic behavior change in itself.
(Technically we no longer crash when a tbd file reexports itself,
but that doesn't happen in practice. We now accept it silently instead
of crashing; ld64 has a diag for the reexport cycle.)

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

3 years ago[lld/mac] Don't write mtimes to N_OSO entries if ZERO_AR_DATE is set.
Nico Weber [Tue, 1 Jun 2021 10:55:36 +0000 (06:55 -0400)]
[lld/mac] Don't write mtimes to N_OSO entries if ZERO_AR_DATE is set.

This is important for build determinism. This matches ld64.

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

3 years ago[AMDGPU][NFC] Remove author's name from codebase
madhur13490 [Tue, 1 Jun 2021 19:18:26 +0000 (00:48 +0530)]
[AMDGPU][NFC] Remove author's name from codebase

This must have made to code by accident.

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

3 years ago[SLPVectorizer] Ignore unreachable blocks
Harald van Dijk [Tue, 1 Jun 2021 19:21:04 +0000 (20:21 +0100)]
[SLPVectorizer] Ignore unreachable blocks

As the existing test unreachable.ll shows, we should be doing more
work to avoid entering unreachable blocks: we should not stop
vectorization just because a PHI incoming value from an unreachable
block cannot be vectorized. We know that particular value will never
be used so we can just replace it with poison.

3 years ago[OpenMP] Add L2-Tile equivalence for KNL
Peyton, Jonathan L [Thu, 20 May 2021 18:50:03 +0000 (13:50 -0500)]
[OpenMP] Add L2-Tile equivalence for KNL

When on KNL and L2 or Tile layer is detected, manually add
the corresponding layer which is equivalent.

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

3 years ago[clang] RecursiveASTVisitor visits ObjCPropertyRefExpr's class receiver
David Goldman [Fri, 30 Apr 2021 16:14:32 +0000 (12:14 -0400)]
[clang] RecursiveASTVisitor visits ObjCPropertyRefExpr's class receiver

We now make up a TypeLoc for the class receiver to simplify visiting,
notably for indexing, availability, and clangd.

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

3 years ago[flang][openacc] Enforce restriction on attach and detach variables
Valentin Clement [Tue, 1 Jun 2021 18:36:58 +0000 (14:36 -0400)]
[flang][openacc] Enforce restriction on attach and detach variables

Each var argument to an attach or detach clause must be a
Fortran variable or array with the pointer or allocatable attribute.
This patch enforce this restruction.

Reviewed By: kiranchandramohan

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

3 years ago[ORC-RT] Add WrapperFunctionResult, Simple Packed Serialization (SPS) system.
Lang Hames [Mon, 31 May 2021 22:50:26 +0000 (15:50 -0700)]
[ORC-RT] Add WrapperFunctionResult, Simple Packed Serialization (SPS) system.

WrapperFunctionResult is a C++ wrapper for __orc_rt_CWrapperFunctionResult
that automatically manages the underlying struct.

The Simple Packed Serialization (SPS) utilities support a simple serialization
scheme for wrapper function argument and result buffers:

Primitive typess (bool, char, int8_t, and uint8_t, int16_t, uint16_t, int32_t,
uint32_t, int64_t, uint64_t) are serialized in little-endian form.

SPSTuples are serialized by serializing each of the tuple members in order
without padding.

SPSSequences are serialized by serializing a sequence length (as a uint64_t)
followed by each of the elements of the sequence in order without padding.

Serialization/deserialization always involves a pair of SPS type tag (a tag
representing the serialized format to use, e.g. uint32_t, or
SPSTuple<bool, SPSString>) and a concrete type to be serialized from or
deserialized to (uint32_t, std::pair<bool, std::string>). Serialization for new
types can be implemented by specializing the SPSSerializationTraits type.

3 years ago[ORC-RT] Rename C-API functions to use __orc_rt_ prefix (instead of OrcRT).
Lang Hames [Mon, 31 May 2021 22:37:00 +0000 (15:37 -0700)]
[ORC-RT] Rename C-API functions to use __orc_rt_ prefix (instead of OrcRT).

This matches the C++ namespace name, and is consistent with other C linkage
functions (e.g. __orc_rt_jit_dispatch).

3 years ago[ORC-RT] Add equality/inequality comparison to string_view.
Lang Hames [Mon, 31 May 2021 22:25:13 +0000 (15:25 -0700)]
[ORC-RT] Add equality/inequality comparison to string_view.

3 years ago[OpenMP] Define named constants for interop's foreign runtime ID
Hansang Bae [Tue, 1 Jun 2021 14:31:27 +0000 (09:31 -0500)]
[OpenMP] Define named constants for interop's foreign runtime ID

Also added missing Fortran definitions for interop support.

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

3 years agoFix a git apply that went bad somehow.
Aaron Ballman [Tue, 1 Jun 2021 18:05:26 +0000 (14:05 -0400)]
Fix a git apply that went bad somehow.

When applying the changes in 8edd3464afbff65d7d5945b3a8b20009d6ff5deb,
it seems that this bit got merged incorrectly and no test coverage
caught the issue. This fixes the diagnostic and adds a test.

3 years ago[GlobalISel][AArch64] Combine and (lshr x, cst), mask -> ubfx x, cst, width
Jessica Paquette [Wed, 24 Mar 2021 17:52:21 +0000 (10:52 -0700)]
[GlobalISel][AArch64] Combine and (lshr x, cst), mask -> ubfx x, cst, width

Also add a target hook which allows us to get around custom legalization on
AArch64.

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

3 years ago[libc++] Temporary hack to unbreak CI
Louis Dionne [Tue, 1 Jun 2021 17:49:53 +0000 (13:49 -0400)]
[libc++] Temporary hack to unbreak CI

Until I figure out what the issue is with this test on AppleClang (and
in particular which change caused it), I want to avoid all CI being broken.

3 years ago[clangd][ObjC] Fix issue completing a method decl by name
David Goldman [Mon, 19 Apr 2021 20:38:37 +0000 (16:38 -0400)]
[clangd][ObjC] Fix issue completing a method decl by name

When completing an Objective-C method declaration by name, we need to
preserve the leading text as a `qualifier` so we insert it properly
before the first typed text chunk.

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

3 years ago[X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB
Guozhi Wei [Tue, 1 Jun 2021 17:31:30 +0000 (10:31 -0700)]
[X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB

This patch transforms the sequence

    lea (reg1, reg2), reg3
    sub reg3, reg4

to two sub instructions

    sub reg1, reg4
    sub reg2, reg4

Similar optimization can also be applied to LEA/ADD sequence.
The modifications to TwoAddressInstructionPass is to ensure the operands of ADD
instruction has expected order (the dest register of LEA should be src register of ADD).

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

3 years ago[MLIR] Add missing APSInt.h include
Nikita Popov [Tue, 1 Jun 2021 17:18:19 +0000 (19:18 +0200)]
[MLIR] Add missing APSInt.h include

Since fd7e309e02fd226b0390888388ed732608e52c73 this is no longer
pulled in indirectly through DenseMapInfo.h.

3 years ago[SystemZ] Return true from hasBitPreservingFPLogic().
Jonas Paulsson [Tue, 1 Jun 2021 16:24:06 +0000 (18:24 +0200)]
[SystemZ] Return true from hasBitPreservingFPLogic().

This is currently NFC on benchmarks and tests.

Review: Ulrich Weigand

3 years ago[polly] Fix SCEVLoopAddRecRewriter to avoid invalid AddRecs.
Eli Friedman [Fri, 21 May 2021 23:58:36 +0000 (16:58 -0700)]
[polly] Fix SCEVLoopAddRecRewriter to avoid invalid AddRecs.

When we're remapping an AddRec, the AddRec constructed by a partial
rewrite might not make sense.  This triggers an assertion complaining
it's not loop-invariant.

Instead of constructing the partially rewritten AddRec, just skip
straight to calling evaluateAtIteration.

Testcase was automatically reduced using llvm-reduce, so it's a little
messy, but hopefully makes sense.

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

3 years ago[ADT] Move DenseMapInfo for APInt into APInt.h (PR50527)
Nikita Popov [Mon, 31 May 2021 16:49:34 +0000 (18:49 +0200)]
[ADT] Move DenseMapInfo for APInt into APInt.h (PR50527)

As suggested in https://bugs.llvm.org/show_bug.cgi?id=50527, this
moves the DenseMapInfo for APInt and APSInt into the respective
headers, removing the need to include APInt.h and APSInt.h from
DenseMapInfo.h.

We could probably do the same from StringRef and ArrayRef as well.

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

3 years ago[RISCV] Remove earlyclobber from vnsrl/vnsra/vnclip(u) when the source and dest are...
Craig Topper [Tue, 1 Jun 2021 16:09:01 +0000 (09:09 -0700)]
[RISCV] Remove earlyclobber from vnsrl/vnsra/vnclip(u) when the source and dest are a single vector register.

This guarantees they meet this overlap exception:

"The destination EEW is smaller than the source EEW and the overlap
is in the lowest-numbered part of the source register group"

Being a single register guarantees the overlap is always in the
lowerst-number part of the group.

Reviewed By: frasercrmck, khchen

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

3 years ago[RISCV] Remove earlyclobber from compares with LMUL<=1.
Craig Topper [Tue, 1 Jun 2021 15:50:18 +0000 (08:50 -0700)]
[RISCV] Remove earlyclobber from compares with LMUL<=1.

Compares are considered a narrowing operation for register overlap.
I believe for LMUL<=1 they meet this exception to allow overlap

"The destination EEW is smaller than the source EEW and the overlap is in the
lowest-numbered part of the source register group"

Both the result and the sources will occupy a single register for
LMUL<=1 so the overlap would always be in the "lowest-numbered part".

Reviewed By: frasercrmck, HsiangKai

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

3 years ago[lldb][NFC] Use Language plugins in Mangled::GuessLanguage
Raphael Isemann [Tue, 1 Jun 2021 15:58:12 +0000 (17:58 +0200)]
[lldb][NFC] Use Language plugins in Mangled::GuessLanguage

This removes the direct dependency to the ObjC and C++ plugins.

Reviewed By: bulbazord

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

3 years ago[lldb] Remove SBCommandReturnObject::ref
Raphael Isemann [Tue, 1 Jun 2021 15:50:26 +0000 (17:50 +0200)]
[lldb] Remove SBCommandReturnObject::ref

This function was added in D67589 and returns an internal CommandReturnObject
which isn't allowed in the SB API. This patch just makes it private as all uses
of this function are inside SBCommandReturnObject.

Reviewed By: jankratochvil

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

3 years ago[x86] add test for sext-of-setcc; NFC
Sanjay Patel [Tue, 1 Jun 2021 12:58:55 +0000 (08:58 -0400)]
[x86] add test for sext-of-setcc; NFC

3 years agoSimplify coro-zero-alloca.ll
Xun Li [Tue, 1 Jun 2021 15:12:18 +0000 (08:12 -0700)]
Simplify coro-zero-alloca.ll

D101841 added this test. It appears to generate different outcome on different platforms.
Make it to only call -coro-split instead of entire O2 pipeline to simplify the test flow.
Hope this will make  the test more robust.

Reviewed By: djtodoro

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

3 years ago[SLP]Better detection of perfect/shuffles matches for gather nodes.
Alexey Bataev [Fri, 21 May 2021 13:29:23 +0000 (06:29 -0700)]
[SLP]Better detection of perfect/shuffles matches for gather nodes.

Implemented better scheme for perfect/shuffled matches of the gather
nodes which allows to fix the performance regressions introduced by
earlier patches. Starting detecting matches for broadcast nodes and
extractelement gathering.

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

3 years ago[llvm-dwarfdump][test] Add missing dedicated tests for some options
gbreynoo [Tue, 1 Jun 2021 13:57:00 +0000 (14:57 +0100)]
[llvm-dwarfdump][test] Add missing dedicated tests for some options

This change adds tests specifically for --parent-recurse-depth, --quiet
and -o. The test for -o found a typo in an error message which is also
fixed in this change.

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

3 years ago[clang][Parse] Add parsing support for C++ attributes on using-declarations
Louis Dionne [Mon, 31 May 2021 20:18:30 +0000 (16:18 -0400)]
[clang][Parse] Add parsing support for C++ attributes on using-declarations

This is a re-application of dc67299 which was reverted in f63adf5b because
it broke the build. The issue should now be fixed.

Attribution note: The original author of this patch is Erik Pilkington.
I'm only trying to land it after rebasing.

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

3 years ago[OpenCL] Fix ICE with invalid use of half
Ole Strohm [Tue, 1 Jun 2021 12:01:47 +0000 (13:01 +0100)]
[OpenCL] Fix ICE with invalid use of half

Because half is limited to the `cl_khr_fp16` extension being enabled,
`DefaultLvalueConversion` can fail when it's not enabled.
The original assumption that it will never fail is therefore wrong now.

Fixes: PR47976

Reviewed By: Anastasia

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

3 years ago[AMDGPU][Libomptarget] Remove g_atmi_machine global
Pushpinder Singh [Tue, 1 Jun 2021 09:23:10 +0000 (09:23 +0000)]
[AMDGPU][Libomptarget] Remove g_atmi_machine global

Turns out the only purpose of this class was verify if device ID
was in range or not which could be done easily by using g_atl_machine.

Still getting rid of g_atl_machine is pending which would be done in
a later patch.

Reviewed By: JonChesterfield

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

3 years ago[InstCombine] Relax constraints of uses for exp(X) * exp(Y) -> exp(X + Y)
Daniil Seredkin [Tue, 1 Jun 2021 12:31:23 +0000 (08:31 -0400)]
[InstCombine] Relax constraints of uses for exp(X) * exp(Y) -> exp(X + Y)

InstCombine didn't perform the transformations when fmul's operands were
the same instruction because it required to have one use for each of them
which is false in the case. This patch fixes this + adds tests for them
and introduces a new function isOnlyUserOfAnyOperand to check these cases
in a single place.

This patch is a result of discussion in D102574.

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

3 years ago[compiler-rt] Fix compilation when multiple architectures can be targeted
Evgeny Leviant [Tue, 1 Jun 2021 12:26:51 +0000 (15:26 +0300)]
[compiler-rt] Fix compilation when multiple architectures can be targeted

When toolchain can supports all of arm, armhf and armv6m architectures compiler-rt
libraries won't compile because architecture specific flags are appended to single
BUILTIN_CFLAGS variable.

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

3 years ago[LoopDeletion] Consider infinite loops alive, unless mustprogress.
Florian Hahn [Tue, 1 Jun 2021 11:20:46 +0000 (12:20 +0100)]
[LoopDeletion] Consider infinite loops alive, unless mustprogress.

The current loop or any of its sub-loops may be infinite. Unless the
function or the loops are marked as mustprogress, this in itself makes
the loop *not* dead.

This patch moves the logic to check whether the current loop is finite
or mustprogress to `isLoopDead` and also extends it to check the
sub-loops. This should fix PR50511.

Reviewed By: nikic

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

3 years ago[SDAG] add helper function for sext-of-setcc folds; NFC
Sanjay Patel [Tue, 1 Jun 2021 11:51:58 +0000 (07:51 -0400)]
[SDAG] add helper function for sext-of-setcc folds; NFC

Try to make this easier to read as noted in D103280

3 years ago[mlir] Use interfaces in MathToLibm
Tres Popp [Tue, 1 Jun 2021 10:17:33 +0000 (12:17 +0200)]
[mlir] Use interfaces in MathToLibm

Previously, this assumed use of ModuleOp and FuncOp. There is no need to
restrict this, and using interfaces allows these patterns to be used
during dialect conversion to LLVM.

Some assertions were removed due to inconsistent implementation of
FunctionLikeOps.

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

3 years ago[mlir][linalg] Fix signed/unsigned comparison warnings (NFC).
Tobias Gysi [Tue, 1 Jun 2021 10:55:08 +0000 (10:55 +0000)]
[mlir][linalg] Fix signed/unsigned comparison warnings (NFC).

Fix signedness warnings in Utils.cpp and LinalgInterfaces.cpp.

3 years ago[VectorCombine] Freeze index unless it is known to be non-poison.
Florian Hahn [Tue, 1 Jun 2021 09:20:42 +0000 (10:20 +0100)]
[VectorCombine] Freeze index unless it is known to be non-poison.

If the index itself is already poison, the poison propagates through
instructions clamping the index to a valid range. This still causes
introducing a load of poison, as flagged by Alive2 and pointed out
at 575e2aff5574.

This patch updates the code to freeze the index, unless it is proven to
not be poison.

Reviewed By: nlopes

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

3 years ago[RISCV] Support vector types in combination with fastcc
Fraser Cormack [Thu, 13 May 2021 16:34:41 +0000 (17:34 +0100)]
[RISCV] Support vector types in combination with fastcc

This patch extends the RISC-V lowering of the 'fastcc' calling
convention to vector types, both fixed-length and scalable. Without this
patch, any function passing or returning vector types by value would
throw a compiler error.

Vectors are handled in 'fastcc' much as they are in the default calling
convention, the noticeable difference being the extended set of scalar
GPR registers that can be used to pass vectors indirectly.

Reviewed By: HsiangKai

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

3 years ago[WebAssembly][CodeGen] IR support for WebAssembly local variables
Andy Wingo [Wed, 21 Apr 2021 13:41:48 +0000 (15:41 +0200)]
[WebAssembly][CodeGen] IR support for WebAssembly local variables

This patch adds TargetStackID::WasmLocal.  This stack holds locations of
values that are only addressable by name -- not via a pointer to memory.
For the WebAssembly target, these objects are lowered to WebAssembly
local variables, which are managed by the WebAssembly run-time and are
not addressable by linear memory.

For the WebAssembly target IR indicates that an AllocaInst should be put
on TargetStackID::WasmLocal by putting it in the non-integral address
space WASM_ADDRESS_SPACE_WASM_VAR, with value 1.  SROA will mostly lift
these allocations to SSA locals, but any alloca that reaches instruction
selection (usually in non-optimized builds) will be assigned the new
TargetStackID there.  Loads and stores to those values are transformed
to new WebAssemblyISD::LOCAL_GET / WebAssemblyISD::LOCAL_SET nodes,
which then lower to the type-specific LOCAL_GET_I32 etc instructions via
tablegen patterns.

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

3 years ago[VectorCombine] Add tests with multiple noundef indices for scalarization.
Florian Hahn [Sun, 30 May 2021 11:45:55 +0000 (12:45 +0100)]
[VectorCombine] Add tests with multiple noundef indices for scalarization.

3 years agoMark test as requiring asserts.
Douglas Yung [Tue, 1 Jun 2021 09:01:01 +0000 (02:01 -0700)]
Mark test as requiring asserts.

3 years ago[mlir][linalg] Cleanup LinalgOp usage in dependence analysis (NFC).
Tobias Gysi [Tue, 1 Jun 2021 08:43:43 +0000 (08:43 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in dependence analysis (NFC).

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

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

3 years ago[mlir][linalg] Cleanup LinalgOp usage in fusion (NFC).
Tobias Gysi [Tue, 1 Jun 2021 08:20:58 +0000 (08:20 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in fusion (NFC).

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

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

3 years ago[mlir][linalg] Cleanup LinalgOp usage in tiling (NFC).
Tobias Gysi [Tue, 1 Jun 2021 08:10:59 +0000 (08:10 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in tiling (NFC).

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

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

3 years ago[clangd] Fix -Wunused-variable warning (NFC)
Yang Fan [Tue, 1 Jun 2021 08:15:09 +0000 (16:15 +0800)]
[clangd] Fix -Wunused-variable warning (NFC)

GCC warning:
```
/llvm-project/clang-tools-extra/clangd/InlayHints.cpp: In member function ‘bool clang::clangd::InlayHintVisitor::VisitVarDecl(clang::VarDecl*)’:
/llvm-project/clang-tools-extra/clangd/InlayHints.cpp:81:15: warning: unused variable ‘AT’ [-Wunused-variable]
   81 |     if (auto *AT = D->getType()->getContainedAutoType()) {
      |               ^~

```

3 years ago[mlir][linalg] Cleanup LinalgOp usage in vectorization (NFC).
Tobias Gysi [Tue, 1 Jun 2021 07:48:03 +0000 (07:48 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in vectorization (NFC).

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

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

3 years ago[X86] AMD Zen 3 has fast variable per-lane shuffles
Roman Lebedev [Tue, 1 Jun 2021 07:46:05 +0000 (10:46 +0300)]
[X86] AMD Zen 3 has fast variable per-lane shuffles

... but lane-crossing shuffles are slow.