platform/upstream/llvm.git
3 years ago[Attributor][FIX] Traverse uses even if a value is assumed constant
Johannes Doerfert [Sat, 8 May 2021 04:06:44 +0000 (23:06 -0500)]
[Attributor][FIX] Traverse uses even if a value is assumed constant

Not all attributes are able to handle the interprocedural step and
follow the uses into a call site. Let them be able to combine call site
uses instead. This might result in some unused values/arguments being
leftover but it removes problems where we misused "is dead" even though
it was actually "is simplified/replaced".

We explicitly check for dead values due to constant propagation in
`AAIsDeadValueImpl::areAllUsesAssumedDead` instead.

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

3 years agoRevert Attributor patch series
Nico Weber [Sat, 10 Jul 2021 20:15:55 +0000 (16:15 -0400)]
Revert Attributor patch series

Broke check-clang, see https://reviews.llvm.org/D102307#2869065
Ran `git revert -n ebbe149a6f08535ede848a531a601ae6591cfbc5..269416d41908bb670f67af689155d5ab8eea689a`

3 years agoReland "[clang-repl] Allow passing in code as positional arguments."
Vassil Vassilev [Sat, 10 Jul 2021 17:50:41 +0000 (17:50 +0000)]
Reland "[clang-repl] Allow passing in code as positional arguments."

This reverts commit 3ec88ca60b24 which reverted e386871e1d21 due to a asan build
failure.

This patch removes the new lines in the test case which seem to introduce the
failure.

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

3 years agoRevert "llvm-symbolizer: Fix "start file" to work with Split DWARF"
Nico Weber [Sat, 10 Jul 2021 17:35:05 +0000 (13:35 -0400)]
Revert "llvm-symbolizer: Fix "start file" to work with Split DWARF"

This reverts commit 04c203e310bd3fb58e16c936c0200d680100526e.
Test fails on Windows.

3 years ago[Attributor][NFCI] Add UsedAssumedInformation to more interfaces
Johannes Doerfert [Sat, 10 Jul 2021 00:09:40 +0000 (19:09 -0500)]
[Attributor][NFCI] Add UsedAssumedInformation to more interfaces

As with other Attributor interfaces we often want to know if assumed
information was used to answer a query. This is important if only
known information is allowed or if known information can lead to an
early fixpoint. The users have been adjusted but none of them utilizes
the new information yet.

3 years ago[OpenMP] Detect SPMD compatible kernels and execute them as such
Johannes Doerfert [Wed, 23 Jun 2021 21:33:49 +0000 (16:33 -0500)]
[OpenMP] Detect SPMD compatible kernels and execute them as such

In the spirit of TRegions [0], this patch analyzes a kernel and tracks
if it can be executed in SPMD-mode. If so, we flip the arguments of
the __kmpc_target_init and deinit call to enable the mode. We also
update the `<kernel>_exec_mode` flag to indicate to the runtime we
changed the mode to SPMD.

The code analysis is done interprocedurally by extending the
AAKernelInfo abstract attribute to track SPMD compatibility as well.

[0] https://link.springer.com/chapter/10.1007/978-3-030-28596-8_11

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

3 years ago[OpenMP] Remove checkXXXX device runtime functions
Johannes Doerfert [Wed, 7 Jul 2021 20:06:41 +0000 (15:06 -0500)]
[OpenMP] Remove checkXXXX device runtime functions

We had multiple functions to determine the execution mode (SPMD/Generic)
and runtime status (initialized/uninitialized) but that just increased
complexity without a real benefit. Especially with D102307 in mind it
is helpful to reduce the dependence on the `ident_t` flags.

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

3 years ago[Attributor][FIX] Sanitize queries to LVI and ScalarEvolution
Johannes Doerfert [Thu, 24 Jun 2021 21:01:35 +0000 (16:01 -0500)]
[Attributor][FIX] Sanitize queries to LVI and ScalarEvolution

When we talk to outside analyse, e.g., LVI and ScalarEvolution, we need
to be careful with the query. The particular error occurred because we
folded a PHI node before the LVI query but the context location was now
not dominated by the value anymore. This is not supported by LVI so we
have to filter these situations before we query the outside analyses.

3 years ago[Attributor][FIX] Do not replace a value with a non-dominating instruction
Johannes Doerfert [Thu, 24 Jun 2021 18:12:06 +0000 (13:12 -0500)]
[Attributor][FIX] Do not replace a value with a non-dominating instruction

We have to be careful when we replace values to not use a non-dominating
instruction. It makes sense that simplification offers those as
"simplified values" but we can't manifest them in the IR without PHI
nodes. In the future we should consider potentially adding those PHI
nodes.

3 years ago[OpenMP] Create custom state machines for generic target regions
Johannes Doerfert [Thu, 20 May 2021 05:37:29 +0000 (00:37 -0500)]
[OpenMP] Create custom state machines for generic target regions

In the spirit of TRegions [0], this patch creates a custom state
machine for a generic target region based on the potentially called
parallel regions.

The code analysis is done interprocedurally via an abstract attribute
(AAKernelInfo). All outermost parallel regions are collected and we
check if there might be unknown outermost parallel regions for which
we need an indirect call. Other AAKernelInfo extensions are expected.

[0] https://link.springer.com/chapter/10.1007/978-3-030-28596-8_11

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

3 years ago[OpenMP] Unified entry point for SPMD & generic kernels in the device RTL
Johannes Doerfert [Thu, 17 Jun 2021 16:23:20 +0000 (11:23 -0500)]
[OpenMP] Unified entry point for SPMD & generic kernels in the device RTL

In the spirit of TRegions [0], this patch provides a simpler and uniform
interface for a kernel to set up the device runtime. The OMPIRBuilder is
used for reuse in Flang. A custom state machine will be generated in the
follow up patch.

The "surplus" threads of the "master warp" will not exit early anymore
so we need to use non-aligned barriers. The new runtime will not have an
extra warp but also require these non-aligned barriers.

[0] https://link.springer.com/chapter/10.1007/978-3-030-28596-8_11

This was in parts extracted from D59319.

Reviewed By: ABataev, JonChesterfield

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

3 years ago[Attributor] Look through selects in genericValueTraversal
Johannes Doerfert [Thu, 6 May 2021 21:03:51 +0000 (16:03 -0500)]
[Attributor] Look through selects in genericValueTraversal

If we can simplify the select condition we can avoid one value in the
traversal.

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

3 years ago[Attributor] Reorganize AAHeapToStack
Johannes Doerfert [Fri, 25 Jun 2021 23:24:01 +0000 (18:24 -0500)]
[Attributor] Reorganize AAHeapToStack

In order to simplify future extensions, e.g., the merge of
AAHeapToShared in to AAHeapToStack, we reorganize AAHeapToStack and the
state we keep for each malloc-like call. The result is also less
confusing as we only track malloc-like calls, not all calls. Further, we
only perform the updates necessary for a malloc-like to argue it can go
to the stack, e.g., we won't check all uses if we moved on to the
"must-be-freed" argument.

This patch also uses Attributor helps to simplify the allocated size,
alignment, and the potentially freed objects.

Overall, this is mostly a reorganization and only the use of the
optimistic helpers should change (=improve) the capabilities a bit.

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

3 years ago[Attributor] Use AAValueSimplify to simplify returned values
Johannes Doerfert [Mon, 10 May 2021 01:16:50 +0000 (20:16 -0500)]
[Attributor] Use AAValueSimplify to simplify returned values

We should use AAValueSimplify for all value simplification, however
there was some leftover logic that predates AAValueSimplify in
AAReturnedValues. This remove the AAReturnedValues part and provides a
replacement by making AAValueSimplifyReturned strong enough to handle
all previously covered cases. Further, this improve
AAValueSimplifyCallSiteReturned to handle returned arguments.

AAReturnedValues is now much easier and the collected returned
values/instructions are now from the associated function only, making it
much more sane. We also do not have the brittle logic anymore that looks
for unresolved calls. Instead, we use AAValueSimplify to handle
recursion.

Useful code has been split into helper functions, e.g., an Attributor
interface to get a simplified value.

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

3 years ago[Attributor] Introduce an optimistic getUnderlyingObjects helper
Johannes Doerfert [Sat, 8 May 2021 06:21:17 +0000 (01:21 -0500)]
[Attributor] Introduce an optimistic getUnderlyingObjects helper

As the `llvm::getUnderlyingObjects` helper, the optimistic version
collects objects that might be the base of a given pointer. In contrast
to the llvm variant, the optimistic one will use assumed information,
e.g., about select conditions or dead blocks, to provide a more precise
result.

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

3 years ago[Attributor][FIX] Traverse uses even if a value is assumed constant
Johannes Doerfert [Sat, 8 May 2021 04:06:44 +0000 (23:06 -0500)]
[Attributor][FIX] Traverse uses even if a value is assumed constant

Not all attributes are able to handle the interprocedural step and
follow the uses into a call site. Let them be able to combine call site
uses instead. This might result in some unused values/arguments being
leftover but it removes problems where we misused "is dead" even though
it was actually "is simplified/replaced".

We explicitly check for dead values due to constant propagation in
`AAIsDeadValueImpl::areAllUsesAssumedDead` instead.

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

3 years ago[mlir] Gated calls to getAsm{Result,BlockArgument}Names on whether printing ops in...
Itai Zukerman [Sat, 10 Jul 2021 16:39:50 +0000 (16:39 +0000)]
[mlir] Gated calls to getAsm{Result,BlockArgument}Names on whether printing ops in generic form.

Depends On D105300

Reviewed By: mehdi_amini

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

3 years ago[mlir] Added OpPrintingFlags to AsmState and SSANameState.
Itai Zukerman [Sat, 10 Jul 2021 16:39:44 +0000 (16:39 +0000)]
[mlir] Added OpPrintingFlags to AsmState and SSANameState.

This enables checking the printing flags when formatting names
in SSANameState.

Depends On D105299

Reviewed By: mehdi_amini, bondhugula

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

3 years ago[mlir][NFC] Switched `interfaces` to a private member of SSANameState.
Itai Zukerman [Sat, 10 Jul 2021 16:39:34 +0000 (16:39 +0000)]
[mlir][NFC] Switched `interfaces` to a private member of SSANameState.

`interfaces` is passed through to the `numberValuesIn*` functions with exactly
the same value as when SSANameState is constructed.  This just seems cleaner.

Also, a dependent PR adds `printerFlags` which follows similar code paths.

Reviewed By: mehdi_amini

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

3 years ago[OpenMP] Avoid checking parent reference count in targetDataBegin
Joel E. Denny [Sat, 10 Jul 2021 16:01:45 +0000 (12:01 -0400)]
[OpenMP] Avoid checking parent reference count in targetDataBegin

This patch is an attempt to do for `targetDataBegin` what D104924 does
for `targetDataEnd`:

* Eliminates a lock/unlock of the data mapping table.
* Clarifies the logic that determines whether a struct member's
  host-to-device transfer occurs.  The old logic, which checks the
  parent struct's reference count, is a leftover from back when we had
  a different map interface (as pointed out at
  <https://reviews.llvm.org/D104924#2846972>).

Additionally, it eliminates the `DeviceTy::getMapEntryRefCnt`, which
is no longer used after this patch.

While D104924 does not change the computation of `IsLast`, I found I
needed to change the computation of `IsNew` for this patch.  As far as
I can tell, the change is correct, and this patch does not cause any
additional `openmp` tests to fail.  However, I'm not sure I've thought
of all use cases.  Please advise.

Reviewed By: jdoerfert, jhuber6, protze.joachim, tianshilei1992, grokos, RaviNarayanaswamy

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

3 years ago[OpenMP] Avoid checking parent reference count in targetDataEnd
Joel E. Denny [Sat, 10 Jul 2021 16:01:34 +0000 (12:01 -0400)]
[OpenMP] Avoid checking parent reference count in targetDataEnd

The patch has the following benefits:

* Eliminates a lock/unlock of the data mapping table.
* Clarifies the logic that determines whether a struct member's
  device-to-host transfer occurs.  The old logic, which checks the
  parent struct's reference count, is a leftover from back when we had
  a different map interface (as pointed out at
  <https://reviews.llvm.org/D104924#2846972>).

Reviewed By: grokos

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

3 years ago[AFDO] Require x86_64-linux in a testcase
Kazu Hirata [Sat, 10 Jul 2021 14:50:24 +0000 (07:50 -0700)]
[AFDO] Require x86_64-linux in a testcase

This patch fixes a testcase failure by requring x86_64-linux in a
testcase.

3 years ago[X86] Add tests from D93707 for fsub_strict(x,fneg(y)) -> fadd_strict(x,y) folds.
Simon Pilgrim [Sat, 10 Jul 2021 14:08:34 +0000 (15:08 +0100)]
[X86] Add tests from D93707 for fsub_strict(x,fneg(y)) -> fadd_strict(x,y) folds.

Also, add matching i686 coverage to strict-fadd-combines.ll and regenerate checks.

3 years ago[llvm-mca][JSON] Teach the PipelinePrinter how to deal with anonymous code regions...
Andrea Di Biagio [Sat, 10 Jul 2021 12:50:29 +0000 (13:50 +0100)]
[llvm-mca][JSON] Teach the PipelinePrinter how to deal with anonymous code regions (PR51008)

This patch addresses the last remaining problems reported in PR51008.

Previous fixes for PR51008 worked under the wrong assumption that code regions
are always named (except maybe for the default region, which was automatically
named "main").

In reality, it is quite common for users to declare multiple anonymous regions.
So we cannot really use the region name as the key string of a JSON object.  In
practice, code region names are completely optional.

Using "main" for the default region was also problematic because there can be
another region with that same name.

This patch fixes these issues by introducing a json::array of regions.  Each
region has a "Name" field, which would default to the empty string for anonymous
regions.

Added a few more tests to verify that the JSON file format is still valid, and
that multiple anonymous regions all appear in the final output.

3 years ago[llvm-mca][JSON] Further refactoring of the JSON printing logic.
Andrea Di Biagio [Sat, 10 Jul 2021 11:27:30 +0000 (12:27 +0100)]
[llvm-mca][JSON] Further refactoring of the JSON printing logic.

This patch renames object "Resources" to "TargetInfo".

Moved the getJSONTargetInfo method from class InstructionView to the
PipelinePrinter.

Removed uses of std::stringstream.
Removed unused method View::printViewJSON().

3 years ago[LV] NFCI: Do cost comparison on InstructionCost directly.
Sander de Smalen [Sat, 10 Jul 2021 10:57:12 +0000 (11:57 +0100)]
[LV] NFCI: Do cost comparison on InstructionCost directly.

Instead of performing the isMoreProfitable() operation on
InstructionCost::CostTy the operation is performed on InstructionCost
directly, so that it can handle the case where one of the costs is
Invalid.

This patch also changes the CostTy to be int64_t, so that the type is
wide enough to deal with multiplications with e.g. `unsigned MaxTripCount`.

Reviewed By: dmgreen

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

3 years ago[InstructionCost] Add saturation support.
Sander de Smalen [Sat, 10 Jul 2021 10:28:38 +0000 (11:28 +0100)]
[InstructionCost] Add saturation support.

This patch makes the operations on InstructionCost saturate, so that when
costs are accumulated they saturate to <max value>.

One of the compelling reasons for wanting to have saturation support
is because in various places, arbitrary values are used to represent
a 'high' cost, but when accumulating the cost of some set of operations
or a loop, overflow is not taken into account, which may lead to unexpected
results. By defining the operations to saturate, we can express the cost
of something 'very expensive' as InstructionCost::getMax().

Reviewed By: kparzysz, dmgreen

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

3 years agoRevert "Prepare Compiler-RT for GnuInstallDirs, matching libcxx"
Martin Storsjö [Sat, 10 Jul 2021 07:45:54 +0000 (10:45 +0300)]
Revert "Prepare Compiler-RT for GnuInstallDirs, matching libcxx"

This reverts commit 9a9bc76c0eb72f0f2732c729a460abbd5239c2e3.

That commit broke "ninja install" when building compiler-rt for mingw
targets, building standalone (pointing cmake at the compiler-rt
directory) with cmake 3.16.3 (the one shipped in ubuntu 20.04), with
errors like this:

-- Install configuration: "Release"
CMake Error at cmake_install.cmake:44 (file):
  file cannot create directory: /include/sanitizer.  Maybe need
  administrative privileges.
Call Stack (most recent call first):
  /home/martin/code/llvm-mingw/src/llvm-project/compiler-rt/build-i686-sanitizers/cmake_install.cmake:37 (include)

FAILED: include/CMakeFiles/install-compiler-rt-headers
cd /home/martin/code/llvm-mingw/src/llvm-project/compiler-rt/build-i686-sanitizers/include && /usr/bin/cmake -DCMAKE_INSTALL_COMPONENT="compiler-rt-headers" -P /home/martin/code/llvm-mingw/src/llvm-project/compiler-rt/build-i686-sanitizers/cmake_install.cmake
ninja: build stopped: subcommand failed.

3 years ago[AArch64][GlobalISel] Implement moreElements legalization for G_SHUFFLE_VECTOR.
Amara Emerson [Sat, 10 Jul 2021 06:11:22 +0000 (23:11 -0700)]
[AArch64][GlobalISel] Implement moreElements legalization for G_SHUFFLE_VECTOR.

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

3 years ago[NFC][ScalarEvolution] Precommit tests for D104075.
Eli Friedman [Sat, 10 Jul 2021 06:32:31 +0000 (23:32 -0700)]
[NFC][ScalarEvolution] Precommit tests for D104075.

3 years ago[GlobalISel] Add a new artifact combiner for unmerge which looks through general...
Amara Emerson [Mon, 24 May 2021 22:09:33 +0000 (15:09 -0700)]
[GlobalISel] Add a new artifact combiner for unmerge which looks through general artifact expressions.

The original motivation for this was to implement moreElementsVector of shuffles
on AArch64, which resulted in complex sequences of artifacts like unmerge(unmerge(concat...))
which the combiner couldn't handle. It seemed here that the better option,
instead of writing ever-more-complex combines, was to have a way to find
the original "non-artifact" source registers for a given definition, walking
through arbitrary expressions of unmerge/concat/insert. As long as the bits
aren't extended or truncated, this is a pretty simple algorithm that avoids
the need for lots of combines and instead jumps straight to the final result
we want.

I've only used this new technique in 2 places within tryCombineUnmerge, using it
in more general situations resulted in infinite loops in AMDGPU. So for now
it's used when we would otherwise fail to combine and that seems to work.

In order to support looking through G_INSERTs, I also had to add it as an
artifact in isArtifact(), which caused a whole lot of issues in tests. AMDGPU
started infinite looping since full legalization of G_INSERT doensn't seem to
be there. To work around this, I've temporarily added a CLI option to use the
old behaviour so that the MIR tests will still run and terminate.

Other minor changes include no longer making >128b G_MERGE/UNMERGE legal.
We never had isel support for that anyway and it was a remnant of the legacy
legalizer rules. However being legal prevented the combiner from checking if it
was dead and deleting them.

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

3 years ago[ORC] Flesh out ExecutorAddress, rename CommonOrcRuntimeTypes header.
Lang Hames [Thu, 8 Jul 2021 22:24:08 +0000 (08:24 +1000)]
[ORC] Flesh out ExecutorAddress, rename CommonOrcRuntimeTypes header.

Renames CommonOrcRuntimeTypes.h to ExecutorAddress.h and moves ExecutorAddress
into the 'orc' namespace (rather than orc::shared).

Also makes ExecutorAddress a class, adds an ExecutorAddrDiff type and some
arithmetic operations on the pair (subtracting two addresses yields an addrdiff,
adding an addrdiff and an address yields an address).

3 years ago[lld-macho] Fix bug in handling unwind info from ld -r
Vy Nguyen [Fri, 2 Jul 2021 18:49:40 +0000 (14:49 -0400)]
[lld-macho] Fix bug in handling unwind info from ld -r
Two changess:
- Drop assertions that all symbols are in GOT
- Set allEntriesAreOmitted correctly

Related bug: 50812

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

3 years ago[WebAssembly] Custom combines for f64x2.promote_low_f32x4
Thomas Lively [Sat, 10 Jul 2021 01:59:29 +0000 (18:59 -0700)]
[WebAssembly] Custom combines for f64x2.promote_low_f32x4

Replace the clang builtin function and LLVM intrinsic previously used to select
the f64x2.promote_low_f32x4 instruction with custom combines from standard
SelectionDAG nodes. Implement the new combines to share code with the similar
combines for f64x2.convert_low_i32x4_{s,u}. Resolves PR50232.

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

3 years agollvm-symbolizer: Fix "start file" to work with Split DWARF
David Blaikie [Sat, 10 Jul 2021 01:27:31 +0000 (18:27 -0700)]
llvm-symbolizer: Fix "start file" to work with Split DWARF

A followup to the feature added in
69da27c7496ea373567ce5121e6fe8613846e7a5 that added the optional "start
file name" to match "start line" - but this didn't work with Split DWARF
because of the need for the decl file number resolution code to refer
back to the skeleton unit to find its .debug_line contribution. So this
patch adds the necessary infrastructure to track the skeleton unit
corresponding to a split full unit for the purpose of this lookup.

3 years agoFix buildbot regression from 9c4baf5.
Eli Friedman [Sat, 10 Jul 2021 00:52:04 +0000 (17:52 -0700)]
Fix buildbot regression from 9c4baf5.

Apparently ScalarEvolution::isImpliedCond tries to truncate a pointer in
some obscure cases. Guard the code with a check for pointers.

3 years ago[scudo] Check if we use __clang_major__ >= 12
Vitaly Buka [Fri, 9 Jul 2021 19:24:50 +0000 (12:24 -0700)]
[scudo] Check if we use __clang_major__ >= 12

This makes sure we have support for MTE instructions.
Later the check can be extended to support MTE on other compilers.

Reviewed By: pcc

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

3 years ago[ScalarEvolution] Strictly enforce pointer/int type rules.
Eli Friedman [Wed, 23 Jun 2021 21:43:59 +0000 (14:43 -0700)]
[ScalarEvolution] Strictly enforce pointer/int type rules.

Rules:

1. SCEVUnknown is a pointer if and only if the LLVM IR value is a
   pointer.
2. SCEVPtrToInt is never a pointer.
3. If any other SCEV expression has no pointer operands, the result is
   an integer.
4. If a SCEVAddExpr has exactly one pointer operand, the result is a
   pointer.
5. If a SCEVAddRecExpr's first operand is a pointer, and it has no other
   pointer operands, the result is a pointer.
6. If every operand of a SCEVMinMaxExpr is a pointer, the result is a
   pointer.
7. Otherwise, the SCEV expression is invalid.

I'm not sure how useful rule 6 is in practice.  If we exclude it, we can
guarantee that ScalarEvolution::getPointerBase always returns a
SCEVUnknown, which might be a helpful property. Anyway, I'll leave that
for a followup.

This is basically mop-up at this point; all the changes with significant
functional effects have landed.  Some of the remaining changes could be
split off, but I don't see much point.

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

3 years ago[SLP] Do not make an attempt to match reduction on already erased instruction.
Valery N Dmitriev [Fri, 9 Jul 2021 23:19:11 +0000 (16:19 -0700)]
[SLP] Do not make an attempt to match reduction on already erased instruction.

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

3 years agoWebAssembly: Update datalayout to match fp128 ABI change
Derek Schuff [Fri, 9 Jul 2021 22:15:35 +0000 (15:15 -0700)]
WebAssembly: Update datalayout to match fp128 ABI change

This fix goes along with d1a96e906cc03a95cfd41a1f22bdda92651250c7
and makes the fp128 alignment match clang's long double alignment.

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

3 years ago[MLIR][GPU][NFC] Fix documentation for wmma matrix load/store ops
Uday Bondhugula [Fri, 9 Jul 2021 07:21:19 +0000 (12:51 +0530)]
[MLIR][GPU][NFC] Fix documentation for wmma matrix load/store ops

Fix/improve documentation for wmma load/store matrix ops. Fix some
broken and stale sentences.

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

3 years ago[AFDO] Merge function attributes after inlining
Kazu Hirata [Fri, 9 Jul 2021 23:47:12 +0000 (16:47 -0700)]
[AFDO] Merge function attributes after inlining

This patch teaches the sample profile loader to merge function
attributes after inlining functions.

Without this patch, the compiler could inline a function requiring the
512-bit vector width into its caller without merging function
attributes, triggering a failure during instruction selection.

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

3 years ago[WebAssembly] Fix warnings
Kazu Hirata [Fri, 9 Jul 2021 23:39:35 +0000 (16:39 -0700)]
[WebAssembly] Fix warnings

3 years ago[gn build] fix formatting after 9647a6f719ee
Nico Weber [Fri, 9 Jul 2021 23:04:46 +0000 (19:04 -0400)]
[gn build] fix formatting after 9647a6f719ee

3 years ago[llvm-nm][test] diff -q => diff to make AIX happy
Fangrui Song [Fri, 9 Jul 2021 22:24:45 +0000 (15:24 -0700)]
[llvm-nm][test] diff -q => diff to make AIX happy

3 years ago[llvm-mca] Refactor the logic that prints JSON files.
Andrea Di Biagio [Fri, 9 Jul 2021 21:35:12 +0000 (22:35 +0100)]
[llvm-mca] Refactor the logic that prints JSON files.

Moved most of the printing logic into the PipelinePrinter.

This patch also fixes the JSON output when flag -instruction-tables is
specified.

3 years ago[WebAssembly] Fixed 2 warnings in Asm Type Checker
Wouter van Oortmerssen [Fri, 9 Jul 2021 21:38:52 +0000 (14:38 -0700)]
[WebAssembly] Fixed 2 warnings in Asm Type Checker

3 years ago[WebAssembly] fix broken tools/llvm-symbolizer/wasm-basic.s test
Wouter van Oortmerssen [Fri, 9 Jul 2021 21:30:12 +0000 (14:30 -0700)]
[WebAssembly] fix broken tools/llvm-symbolizer/wasm-basic.s test

3 years ago[HIP] Move std headers after device malloc/free
Aaron En Ye Shi [Thu, 8 Jul 2021 19:38:32 +0000 (19:38 +0000)]
[HIP] Move std headers after device malloc/free

Set the device malloc and free functions as weak,
and move the std headers after device malloc/free
to avoid issues with std malloc/free.

Fixes: SWDEV-293590

Reviewed By: yaxunl

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

3 years ago[GlobalISel] Use GCDTy when extracting GCD ty from leftover regs in insertParts
Jessica Paquette [Thu, 8 Jul 2021 23:45:45 +0000 (16:45 -0700)]
[GlobalISel] Use GCDTy when extracting GCD ty from leftover regs in insertParts

`LegalizerHelper::insertParts` uses `extractGCDType` on registers split into
a desired type and a smaller leftover type. This is used to populate a list
of registers. Each register in the list will have the same type as returned by
`extractGCDType`.

If we have

- `ResultTy` = s792
- `PartTy` = s64
- `LeftoverTy` = s24

When we call `extractGCDType`, we'll end up with two different types appended
to the list:

Part: gcd(792, 64, 24) => s8
Leftover: gcd(792, 24, 24) => s24

When this happens, we'll hit an assert while trying to build a G_MERGE_VALUES.

This patch changes the code for the leftover type so that we reuse the GCD from
the desired type.

e.g.

Leftover: gcd(792, 8, 24) => s8

https://llvm.godbolt.org/z/137Kqxj6j

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

3 years ago[WebAssembly] Added initial type checker to MC Assembler
Wouter van Oortmerssen [Mon, 7 Jun 2021 19:10:47 +0000 (12:10 -0700)]
[WebAssembly] Added initial type checker to MC Assembler

This to protect against non-sensical instruction sequences being assembled,
which would either cause asserts/crashes further down, or a Wasm module being output that doesn't validate.

Unlike a validator, this type checker is able to give type-errors as part of the parsing process, which makes the assembler much friendlier to be used by humans writing manual input.

Because the MC system is single pass (instructions aren't even stored in MC format, they are directly output) the type checker has to be single pass as well, which means that from now on .globaltype and .functype decls must come before their use. An extra pass is added to Codegen to collect information for this purpose, since AsmPrinter is normally single pass / streaming as well, and would otherwise generate this information on the fly.

A `-no-type-check` flag was added to llvm-mc (and any other tools that take asm input) that surpresses type errors, as a quick escape hatch for tests that were not intended to be type correct.

This is a first version of the type checker that ignores control flow, i.e. it checks that types are correct along the linear path, but not the branch path. This will still catch most errors. Branch checking could be added in the future.

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

3 years agoPR51018: A few more explicit conversions from SmallString to StringRef
David Blaikie [Fri, 9 Jul 2021 20:52:39 +0000 (13:52 -0700)]
PR51018: A few more explicit conversions from SmallString to StringRef

Follow-up to 1def2579e10dd84405465f403e8c31acebff0c97 with a few more
obscure cases.

3 years agoPrepare Compiler-RT for GnuInstallDirs, matching libcxx
John Ericson [Wed, 28 Apr 2021 22:36:47 +0000 (22:36 +0000)]
Prepare Compiler-RT for GnuInstallDirs, matching libcxx

Instead of using `COMPILER_RT_INSTALL_PATH` through the CMake for
complier-rt, just use it to define variables for the subdirs which
themselves are used.

This preserves compatibility, but later on we might consider getting rid
of `COMPILER_RT_INSTALL_PATH` and just changing the defaults for the
subdir variables directly.

---

There was a seaming bug where the (non-Apple) per-target libdir was
`${target}` not `lib/${target}`. I suspect that has to do with the docs
on `COMPILER_RT_INSTALL_PATH` saying was the library dir when that's no
longer true, so I just went ahead and fixed it, allowing me to define
fewer and more sensible variables.

That last part should be the only behavior changes; everything else
should be a pure refactoring.

---

D99484 is the main thrust of the `GnuInstallDirs` work. Once this lands,
it should be feasible to follow both of these up with a simple patch for
compiler-rt analogous to the one for libcxx.

Reviewed By: phosek

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

3 years agoAdd scoped timers to ReadMemoryFromInferior and ReadMemoryFromFileCache.
Adrian Prantl [Fri, 9 Jul 2021 20:36:26 +0000 (13:36 -0700)]
Add scoped timers to ReadMemoryFromInferior and ReadMemoryFromFileCache.

3 years ago[lldb] Drop REQUIRES where redundant because of lit.local.cfg
Jonas Devlieghere [Fri, 9 Jul 2021 20:20:37 +0000 (13:20 -0700)]
[lldb] Drop REQUIRES where redundant because of lit.local.cfg

3 years ago[AMDGPU] Added v_accvgpr_read_b32 rematerialization test. NFC.
Stanislav Mekhanoshin [Fri, 9 Jul 2021 19:41:11 +0000 (12:41 -0700)]
[AMDGPU] Added v_accvgpr_read_b32 rematerialization test. NFC.

3 years ago[OPENMP]Fix overlapped mapping for dereferenced pointer members.
Alexey Bataev [Wed, 7 Jul 2021 12:26:53 +0000 (05:26 -0700)]
[OPENMP]Fix overlapped mapping for dereferenced pointer members.

If the base is used in a map clause and later we have a memberexpr with
this base, and the member is a pointer, and this pointer is dereferenced
anyhow (subscript, array section, dereference, etc.), such components
should be considered as overlapped, otherwise it may lead to incorrect
size computations, since we try to map a pointee as a part of the whole
struct, which is not true for the pointer members.

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

3 years ago[AMDGPU] Fix flags of V_MOV_B64_PSEUDO
Stanislav Mekhanoshin [Fri, 9 Jul 2021 18:48:19 +0000 (11:48 -0700)]
[AMDGPU] Fix flags of V_MOV_B64_PSEUDO

In particular it was not rematerializable.

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

3 years ago[lldb] Use custom script instead of lldb.macosx.crashlog in test
Jonas Devlieghere [Fri, 9 Jul 2021 19:40:19 +0000 (12:40 -0700)]
[lldb] Use custom script instead of lldb.macosx.crashlog in test

I'm not entirely sure this is the problem, but the Windows bot doesn't
seem to like this test. Let's do something similar to
command_import.test which doesn't have that issue.

3 years ago[IR] Add GEPOperator::indices() (NFC)
Nikita Popov [Fri, 9 Jul 2021 19:38:41 +0000 (21:38 +0200)]
[IR] Add GEPOperator::indices() (NFC)

In order to mirror the GetElementPtrInst::indices() API.

Wanted to use this in the IRForTarget code, and was surprised to
find that it didn't exist yet.

3 years ago[PhaseOrdering] add tests for vector cmp reductions; NFC
Sanjay Patel [Fri, 9 Jul 2021 19:08:03 +0000 (15:08 -0400)]
[PhaseOrdering] add tests for vector cmp reductions; NFC

These are based on PR41312. There needs to be effort
from all of SimplifyCFG, InstCombine, SLP, and possibly
VectorCombine to get this into ideal form.

3 years ago[SLP] add tests for poison-safe logical reductions; NFC
Sanjay Patel [Fri, 9 Jul 2021 17:47:38 +0000 (13:47 -0400)]
[SLP] add tests for poison-safe logical reductions; NFC

3 years ago[SLP] make invalid operand explicit for extra arg in reduction matching; NFC
Sanjay Patel [Fri, 9 Jul 2021 17:30:42 +0000 (13:30 -0400)]
[SLP] make invalid operand explicit for extra arg in reduction matching; NFC

This makes it clearer when we have encountered the extra arg.
Also, we may need to adjust the way the operand iteration
works when handling logical and/or.

3 years ago[libcxx][CI] Work around Arm buildkite failures
David Spickett [Fri, 9 Jul 2021 19:29:40 +0000 (15:29 -0400)]
[libcxx][CI] Work around Arm buildkite failures

For reasons unknown, the build is now using compilers
from /usr/bin instead of /usr/local/bin which is where
we have our clang-12 aliases placed.

Reviewed By: #libc, ldionne

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

3 years ago[hwasan] More realistic setjmp test.
Florian Mayer [Fri, 9 Jul 2021 15:44:12 +0000 (16:44 +0100)]
[hwasan] More realistic setjmp test.

The existing one actually failed on the int* p, not on int z (as can be
seen by the fault being 8 bytes rather than 4).

This is also needed to make sure the stack safety analysis does not
classify the alloca as safe.

Reviewed By: hctim

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

3 years ago[ARC][NFC] Include file re-ordering
Graham Yiu [Wed, 7 Jul 2021 16:46:06 +0000 (09:46 -0700)]
[ARC][NFC] Include file re-ordering

- Sort includes in alphabetical order via clang-format

3 years ago[AMDGPU] Add VOP rematerialization test. NFC.
Stanislav Mekhanoshin [Fri, 9 Jul 2021 19:08:45 +0000 (12:08 -0700)]
[AMDGPU] Add VOP rematerialization test. NFC.

3 years agoReapply [IR] Don't accept nullptr as GEP element type
Nikita Popov [Thu, 8 Jul 2021 18:56:05 +0000 (20:56 +0200)]
Reapply [IR] Don't accept nullptr as GEP element type

Reapply after fixing another occurrence in lldb that was relying
on this in the preceding commit.

-----

GetElementPtrInst::Create() (and IRBuilder methods based on it)
currently accept nullptr as the element type, and will fetch the
element type from the pointer in that case. Remove this fallback,
as it is incompatible with opaque pointers. I've removed a handful
of leftover calls using this behavior as a preliminary step.

Out-of-tree code affected by this change should either pass a proper
type, or can temporarily explicitly call getPointerElementType(),
if the newly added assertion is encountered.

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

3 years ago[IRForTarget] Don't pass nullptr to GetElementPtrInst::Create() (NFC)
Nikita Popov [Fri, 9 Jul 2021 19:12:44 +0000 (21:12 +0200)]
[IRForTarget] Don't pass nullptr to GetElementPtrInst::Create() (NFC)

In one case use the source element type of the original GEP. In the
other the correct type isn't obvious to me, so use
getPointerElementType() for now.

3 years ago[Polly][Isl] Use isl::*::ctx instead of isl::*::get_ctx. NFC
Riccardo Mori [Fri, 9 Jul 2021 18:10:57 +0000 (20:10 +0200)]
[Polly][Isl] Use isl::*::ctx instead of isl::*::get_ctx. NFC

This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in `lib/External/isl/include/isl/isl-noxceptions.h` and the official isl C++ interface.

Changes made:
 - Use `isl::*::ctx()` instead of `isl::*::get_ctx()` (for example `isl::space::ctx()` instead of `isl::space::get_ctx()`)
 - Add `isl::` namespace in front of isl types to avoid confusion (for example `isl::space::ctx` and `isl::ctx`
 - `isl-noexceptions.h` has been generated by this https://github.com/patacca/isl/commit/b64e33c62d3fe7db506f6630f9e935b663f9c5a4

Reviewed By: Meinersbur

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

3 years agoPR51034: Debug Info: Remove 'prototyped' from K&R function declarations
David Blaikie [Fri, 9 Jul 2021 18:56:37 +0000 (11:56 -0700)]
PR51034: Debug Info: Remove 'prototyped' from K&R function declarations

Regression caused by 6c9559b67b91966bfeff9e17808a3e84a92e64a0.

3 years agoReapply [IR] Don't mark mustprogress as type attribute
Nikita Popov [Fri, 9 Jul 2021 15:58:48 +0000 (17:58 +0200)]
Reapply [IR] Don't mark mustprogress as type attribute

Reapply with fixes for clang tests.

-----

This is a simple enum attribute. Test changes are because enum
attributes are sorted before type attributes, so mustprogress is
now in a different position.

3 years ago[Clang] Introduce Swift async calling convention.
Varun Gandhi [Tue, 22 Jun 2021 21:44:29 +0000 (14:44 -0700)]
[Clang] Introduce Swift async calling convention.

This change is intended as initial setup. The plan is to add
more semantic checks later. I plan to update the documentation
as more semantic checks are added (instead of documenting the
details up front). Most of the code closely mirrors that for
the Swift calling convention. Three places are marked as
[FIXME: swiftasynccc]; those will be addressed once the
corresponding convention is introduced in LLVM.

Reviewed By: rjmccall

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

3 years agoRevert "[IR] Don't accept nullptr as GEP element type"
Stella Stamenova [Fri, 9 Jul 2021 18:32:39 +0000 (11:32 -0700)]
Revert "[IR] Don't accept nullptr as GEP element type"

This reverts commit 5035e7be1a8ab923e1a82def7e313cc11c0b176f.

This change broke several lldb bots.

3 years ago[flang][driver] Fix how output filename is generated
Andrzej Warzynski [Wed, 7 Jul 2021 10:41:45 +0000 (11:41 +0100)]
[flang][driver] Fix how output filename is generated

Currently, `flang -c file.f` generates `flang_unparsed_source_file_0.o`.
This is incorrect. This patch:
  * simplifies the logic around output filename generation, and
  * makes sure that `file.o` is produced instead of e.g.
    `flang_unparsed_source_file_0.o` when using the `-c` flag

The output filename generation is moved to a dedicated function. I've
also made a few minor improvements, e.g. marked variables as local,
added comments, refined error messages.

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

3 years ago[NFC][compiler-rt][hwasan] Move TagMemoryAligned into hwasan_linux.cpp
Leonard Chan [Thu, 8 Jul 2021 22:04:30 +0000 (15:04 -0700)]
[NFC][compiler-rt][hwasan] Move TagMemoryAligned into hwasan_linux.cpp

Based on comments in D91466, we can make the current implementation
linux-speciic. The fuchsia implementation will just be a call to
`__sanitizer_fill_shadow`.

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

3 years ago[NFC][compiler-rt][hwasan] Rename InitPrctl to InitializeOsSupport
Leonard Chan [Thu, 8 Jul 2021 22:32:20 +0000 (15:32 -0700)]
[NFC][compiler-rt][hwasan] Rename InitPrctl to InitializeOsSupport

The new name is something less linux-y and more platform generic. Once we
finalize the tagged pointer ABI in zircon, we will do the appropriate check
for fuchsia to see that TBI is enabled.

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

3 years ago[NFC][compiler-rt][hwasan] Move __hwasan_tag_mismatch4 to hwasan.cpp
Leonard Chan [Thu, 8 Jul 2021 22:49:04 +0000 (15:49 -0700)]
[NFC][compiler-rt][hwasan] Move __hwasan_tag_mismatch4 to hwasan.cpp

This can be moved out of hwasan_linux.cpp because it can be re-used in the fuchsia port.

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

3 years ago[AMDGPU][Docs] Update Code Object V3 example to includes args section
Krzysztof Drewniak [Thu, 1 Jul 2021 18:45:03 +0000 (18:45 +0000)]
[AMDGPU][Docs] Update Code Object V3 example to includes args section

The documentation for the AMDGPU assembler's examples don't show the
.args section, which, if ommitted, will cause arguments to silently
not be passed into the kernel. This commit fixes this issue.

Reviewed By: #amdgpu, scott.linder

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

3 years ago[llvm-mca] Fix -Wunused-private-field after D105618
Fangrui Song [Fri, 9 Jul 2021 17:30:16 +0000 (10:30 -0700)]
[llvm-mca] Fix -Wunused-private-field after D105618

3 years ago[OpaquePtr][InferAddrSpace] Use PointerType::getWithSamePointeeType()
Arthur Eubanks [Fri, 9 Jul 2021 17:28:50 +0000 (10:28 -0700)]
[OpaquePtr][InferAddrSpace] Use PointerType::getWithSamePointeeType()

3 years ago[llvm-size] Switch command line parsing from llvm::cl to OptTable
Fangrui Song [Fri, 9 Jul 2021 17:26:53 +0000 (10:26 -0700)]
[llvm-size] Switch command line parsing from llvm::cl to OptTable

Part of https://lists.llvm.org/pipermail/llvm-dev/2021-July/151622.html
"Binary utilities: switch command line parsing from llvm::cl to OptTable"

* `--totals=false` and `--totals=0` cannot be used. Omit the option.
* `--help-list` is removed. This is a `cl::` specific option.

OptTable avoids global option collision if we decide to support multiplexing for binary utilities.

Note: because the tool is simple, and its long options are uncommon, I just drop
the one-dash forms except `-arch <value>` (Darwin style).

Reviewed By: jhenderson

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

3 years ago[gn build] Port 0e09a41b415b
LLVM GN Syncbot [Fri, 9 Jul 2021 17:14:37 +0000 (17:14 +0000)]
[gn build] Port 0e09a41b415b

3 years ago[libcxx][ranges] Add `ranges::transform_view`.
zoecarver [Fri, 9 Jul 2021 17:12:16 +0000 (10:12 -0700)]
[libcxx][ranges] Add `ranges::transform_view`.

Reviewed By: cjdb, ldionne, #libc

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

3 years ago[libcxx][nfc] Remove <variant>'s dependence on <array>.
zoecarver [Wed, 7 Jul 2021 22:25:53 +0000 (15:25 -0700)]
[libcxx][nfc] Remove <variant>'s dependence on <array>.

This will allow us to use variant in common_iterator. We do this by introducing a new `__light_array` type that variant uses instead of `std::array`.

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

3 years ago[X86] Return src/dest register from stack spill/restore recogniser
Jeremy Morse [Fri, 9 Jul 2021 16:49:46 +0000 (17:49 +0100)]
[X86] Return src/dest register from stack spill/restore recogniser

LLVM provides target hooks to recognise stack spill and restore
instructions, such as isLoadFromStackSlot, and it also provides post frame
elimination versions such as isLoadFromStackSlotPostFE. These are supposed
to return the store-source and load-destination registers; unfortunately on
X86, the PostFE recognisers just return "1", apparently to signify "yes
it's a spill/load". This patch alters the hooks to correctly return the
store-source and load-destination registers:

This is really useful for debug-info as we it helps follow variable values
as they move on/off the stack. There should be no codegen changes: the only
other users of these PostFE target hooks are MachineInstr::getRestoreSize
and MachineInstr::getSpillSize, which don't attempt to interpret the
returned register location.

While we're here, delete the (InstrRef) LiveDebugValues heuristic that
tries to find the spill source register by looking for a killed reg -- we
should be able to rely on the target hooks for that. This involves
temporarily turning off a n InstrRef LivedDebugValues test on aarch64
(patch to re-enable it is in D104521).

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

3 years ago[llvm-cxxfilt] Switch command line parsing from llvm::cl to OptTable
Fangrui Song [Fri, 9 Jul 2021 17:10:45 +0000 (10:10 -0700)]
[llvm-cxxfilt] Switch command line parsing from llvm::cl to OptTable

Similar to D104889. The tool is very simple and its long options are uncommon,
so just drop the one-dash form in this patch.

Reviewed By: jhenderson

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

3 years ago[lldb] Add the ability to silently import scripted commands
Jonas Devlieghere [Fri, 9 Jul 2021 16:23:54 +0000 (09:23 -0700)]
[lldb] Add the ability to silently import scripted commands

Add the ability to silence command script import. The motivation for
this change is being able to add command script import -s
lldb.macosx.crashlog to your ~/.lldbinit without it printing the
following message at the beginning of every debug session.

  "malloc_info", "ptr_refs", "cstr_refs", "find_variable", and
  "objc_refs" commands have been installed, use the "--help" options on
  these commands for detailed help.

In addition to forwarding the silent option to LoadScriptingModule, this
also changes ScriptInterpreterPythonImpl::ExecuteOneLineWithReturn and
ScriptInterpreterPythonImpl::ExecuteMultipleLines to honor the enable IO
option in ExecuteScriptOptions, which until now was ignored.

Note that IO is only enabled (or disabled) at the start of a session,
and for this particular use case, that's done when taking the Python
lock in LoadScriptingModule, which means that the changes to these two
functions are not strictly necessary, but (IMO) desirable nonetheless.

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

3 years agom86k: adjust the usage of ArgInfo after change 9b057f647d70fc958d4a1a7a00e2deba65
Sylvestre Ledru [Fri, 9 Jul 2021 16:55:06 +0000 (18:55 +0200)]
m86k: adjust the usage of ArgInfo after change 9b057f647d70fc958d4a1a7a00e2deba65

Fails with:

```

/build/llvm-toolchain-snapshot-13~++20210709092633+88326bbce38c/llvm/lib/Target/M68k/GlSel/M68kCallLowering.cpp: In member function 'virtual bool llvm::M68kCallLowering::lowerReturn(llvm::MachineIRBuilder&, const llvm::Value*, llvm::ArrayRef<llvm::Register>, llvm::FunctionLoweringInfo&, llvm::Register) const':
/build/llvm-toolchain-snapshot-13~++20210709092633+88326bbce38c/llvm/lib/Target/M68k/GlSel/M68kCallLowering.cpp:71:42: error: no matching function for call to 'llvm::CallLowering::ArgInfo::ArgInfo(<brace-enclosed initializer list>)'
     ArgInfo OrigArg{VRegs, Val->getType()};
```

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

3 years ago[NFC][OpaquePtr] Use GlobalValue::getValueType() more
Arthur Eubanks [Fri, 9 Jul 2021 16:55:07 +0000 (09:55 -0700)]
[NFC][OpaquePtr] Use GlobalValue::getValueType() more

Instead of getType()->getElementType().

3 years ago[SLP] improve code comments; NFC
Sanjay Patel [Fri, 9 Jul 2021 16:48:42 +0000 (12:48 -0400)]
[SLP] improve code comments; NFC

This likely started out only supporint binops,
but now we handle min/max using cmp+sel, and
we may extend to handle bool logic in the form
of select.

3 years agoRevert "[IR] Don't mark mustprogress as type attribute"
Nikita Popov [Fri, 9 Jul 2021 16:45:28 +0000 (18:45 +0200)]
Revert "[IR] Don't mark mustprogress as type attribute"

This reverts commit 84ed3a794b4ffe7bd673f1e5a17d507aa3113d12.

A number of clang tests are also affected by this change. Revert
until I can update them.

3 years ago[SLP] make checks for cmp+select min/max more explicit
Sanjay Patel [Fri, 9 Jul 2021 15:56:26 +0000 (11:56 -0400)]
[SLP] make checks for cmp+select min/max more explicit

This is NFC-intended currently (so no test diffs). The motivation
is to eventually allow matching for poison-safe logical-and and
logical-or (these are in the form of a select-of-bools).
( https://llvm.org/PR41312 )

Those patterns will not have all of the same constraints as min/max
in the form of cmp+sel. We may also end up removing the cmp+sel
min/max matching entirely (if we canonicalize to intrinsics), so
this will make that step easier.

3 years ago[OpaquePointers][CallPromotion] Don't look at pointee type for byval
Arthur Eubanks [Fri, 9 Jul 2021 16:32:40 +0000 (09:32 -0700)]
[OpaquePointers][CallPromotion] Don't look at pointee type for byval

byval's type parameter is now always required.

3 years ago[AttrBuilder] Try to fix build
Nikita Popov [Fri, 9 Jul 2021 16:27:57 +0000 (18:27 +0200)]
[AttrBuilder] Try to fix build

Some buildbots fail with undefined references to ByValTypeIndex
etc. Replace static consts with an enum to ensure the address is
not taken.

3 years ago[IR] Don't mark mustprogress as type attribute
Nikita Popov [Fri, 9 Jul 2021 15:58:48 +0000 (17:58 +0200)]
[IR] Don't mark mustprogress as type attribute

This is a simple enum attribute.

Test changes are because enum attributes are sorted before type
attributes.

3 years ago[libc++][ci] Keep the C++03 build job on Clang 12
Louis Dionne [Fri, 9 Jul 2021 16:22:48 +0000 (12:22 -0400)]
[libc++][ci] Keep the C++03 build job on Clang 12

Because of https://reviews.llvm.org/D104500, libc++ is broken with
recent Clangs in C++03 mode.

3 years ago[llvm-mca] Fix JSON format for multiple regions
Marcos Horro [Fri, 9 Jul 2021 15:58:57 +0000 (17:58 +0200)]
[llvm-mca] Fix JSON format for multiple regions

Instead of printing each region individually when using JSON format,
this patch creates a JSON object which is updated with the values of
each region, printing them at the end. New test is added for JSON output
with multiple regions.

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

Reviewed By: andreadb

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

3 years ago[mlir] add support for reductions in OpenMP WsLoopOp
Alex Zinenko [Thu, 8 Jul 2021 08:59:02 +0000 (10:59 +0200)]
[mlir] add support for reductions in OpenMP WsLoopOp

Use a modeling similar to SCF ParallelOp to support arbitrary parallel
reductions. The two main differences are: (1) reductions are named and declared
beforehand similarly to functions using a special op that provides the neutral
element, the reduction code and optionally the atomic reduction code; (2)
reductions go through memory instead because this is closer to the OpenMP
semantics.

See https://llvm.discourse.group/t/rfc-openmp-reduction-support/3367.

Reviewed By: kiranchandramohan

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

3 years ago[mlir] don't drop undef initializers in translation to LLVM IR
Alex Zinenko [Thu, 8 Jul 2021 14:07:09 +0000 (16:07 +0200)]
[mlir] don't drop undef initializers in translation to LLVM IR

LLVM IR allows globals with external linkage to have initializers, including
undef. The translation was incorrectly using undef as a indicator that the
initializer should be ignored in translation, leading to the impossibility to
create an external global with an explicit undef initializer. Fix this and use
nullptr as a marker instead.

Reviewed By: wsmoses

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