platform/upstream/llvm.git
3 years ago[PowerPC] Add XL Compat fetch builtins
Jinsong Ji [Mon, 28 Jun 2021 02:46:33 +0000 (02:46 +0000)]
[PowerPC] Add XL Compat fetch builtins

Prototype
```
unsigned int __fetch_and_add (volatile unsigned int* addr, unsigned int
val);
unsigned long __fetch_and_addlp (volatile unsigned long* addr, unsigned
long val);
```
Ref:
https://www.ibm.com/docs/en/xl-c-and-cpp-linux/16.1.1?topic=functions-fetch

Reviewed By: #powerpc, w2yehia, lkail

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

3 years ago[LLDB] Silence warnings in cli-wrapper-mpxtable.cpp
Muhammad Omair Javaid [Mon, 28 Jun 2021 01:18:58 +0000 (01:18 +0000)]
[LLDB] Silence warnings in cli-wrapper-mpxtable.cpp

cli-wrapper-mpxtable.cpp was emitting warnings from printfs of
uint64_t on 32 bit arm build. This patch makes affected printfs
in cli-wrapper-mpxtable.cpp portable accross targets variants.

3 years agoTag sanitize-coverage-old-pm.c unsupported on arm 32 bit
Muhammad Omair Javaid [Mon, 28 Jun 2021 02:19:09 +0000 (07:19 +0500)]
Tag sanitize-coverage-old-pm.c unsupported on arm 32 bit

This test is again failing across multiple bots and passing on others
there is no reliable way to enable it for some of the bots while
disabling for the unsupported ones. Tagging it as unsupported across all
types of Arm 32 bit cores.

3 years ago[M68k][GloballSel] Formal arguments lowering in IRTranslator
Sushma Unnibhavi [Sun, 27 Jun 2021 23:13:05 +0000 (16:13 -0700)]
[M68k][GloballSel] Formal arguments lowering in IRTranslator

Implementation of formal arguments lowering in the IRTranslator for the
M68k backend

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

3 years agoRemove XFAIL flag from sanitize-coverage-old-pm.c
Muhammad Omair Javaid [Sun, 27 Jun 2021 22:33:17 +0000 (03:33 +0500)]
Remove XFAIL flag from sanitize-coverage-old-pm.c

This test has started passing consistently on 32bit arm where underlying
core is reported as Armv7 or Thumbv7.
However it still fails intermittently on 32bit AArch32 reported as Armv8l.

https://lab.llvm.org/buildbot/#/builders/190/builds/20
https://lab.llvm.org/buildbot/#/builders/170/builds/41

3 years agoPR50708: Update link to Intel SIMD ABI
David Blaikie [Sun, 27 Jun 2021 21:55:08 +0000 (14:55 -0700)]
PR50708: Update link to Intel SIMD ABI

3 years agoPR37255: DebugInfo: LTO with -g inlined into -gmlt combined with Split DWARF without...
David Blaikie [Sun, 27 Jun 2021 21:34:18 +0000 (14:34 -0700)]
PR37255: DebugInfo: LTO with -g inlined into -gmlt combined with Split DWARF without CU cross-references

A combination of features ^ that lead to a mismatch of expectations
about how a subprogram definition DIE would be produced with/without a
declaration when taking full -g debug info and inlining it into a -gmlt
CU - specifically when using Split DWARF that doesn't support cross-CU
references, so we have to put the -g debug info into the -gmlt CU, which
gets confusing about which mode is respected.

This patch comes down on respecting the CU the debug info is emitted
into, rather than preserving the full debug info when it's emitted into
the gmlt CU.

3 years ago[RISCV] Add tests for __builtin_parity idiom.
Craig Topper [Sun, 27 Jun 2021 18:23:56 +0000 (11:23 -0700)]
[RISCV] Add tests for __builtin_parity idiom.

We use (and (ctpop X), 1) to represent parity.

The generated code for i32 parity on RV64 has more instructions than
necessary which I hope to improve in a followup patch.

Also add missing test for i64 ctpop.

3 years ago[BitCode] Add noprofile to getAttrFromCode()
Nathan Chancellor [Sun, 27 Jun 2021 18:59:57 +0000 (11:59 -0700)]
[BitCode] Add noprofile to getAttrFromCode()

After D104475 / D104658, building the Linux kernel with ThinLTO is
broken:

ld.lld: error: Unknown attribute kind (73) (Producer: 'LLVM13.0.0git'
Reader: 'LLVM 13.0.0git')

getAttrFromCode() has never handled this attribute so it is written
during the ThinLTO phase but it cannot be handled during the linking
phase.

Add noprofile to getAttrFromCode() so that disassembly works properly.

Reviewed By: MaskRay

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

3 years ago[DSE] Preserve address space
Nikita Popov [Sun, 27 Jun 2021 18:26:00 +0000 (20:26 +0200)]
[DSE] Preserve address space

Preserve address space when inserting i8* cast.

3 years ago[MemCpyOpt] Preserve address space
Nikita Popov [Sun, 27 Jun 2021 18:20:27 +0000 (20:20 +0200)]
[MemCpyOpt] Preserve address space

Preserve address space when generating the cast to i8*.

3 years agoRevert "[RISCV] Use zexti32/sexti32 in srliw/sraiw isel patterns to improve usage...
Craig Topper [Sun, 27 Jun 2021 17:32:48 +0000 (10:32 -0700)]
Revert "[RISCV] Use zexti32/sexti32 in srliw/sraiw isel patterns to improve usage of those instructions."

I thought this might help with another optimization I was
thinking about, but I don't think it will. So it just wastes
compile time calling computeKnownBits for no benefit.

This reverts commit 81b2f95971edd47a0057ac4a77b674d7ea620c01.

3 years ago[DSE] Support opaque pointers
Nikita Popov [Sun, 27 Jun 2021 14:11:20 +0000 (16:11 +0200)]
[DSE] Support opaque pointers

For the start shortening optimization, always use a i8 type for
the GEP, as it is a raw offset calculation.

Handling of non-i8* memset/memcpy arguments requires insertion
of casts. These cases were previously miscompiled, as the offset
calculation was performed on the wrong type.

3 years ago[Bazel] Update for 0813700de1
Geoffrey Martin-Noble [Sun, 27 Jun 2021 15:30:54 +0000 (08:30 -0700)]
[Bazel] Update for 0813700de1

Updates Bazel BUILD files for changes in
https://github.com/llvm/llvm-project/commit/0813700de1

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

3 years ago[clang-format] Fix the issue that empty lines being removed at the beginning of namespace
Darwin Xu [Sun, 27 Jun 2021 14:57:57 +0000 (15:57 +0100)]
[clang-format] Fix the issue that empty lines being removed at the beginning of namespace

This is a bug fix of https://bugs.llvm.org/show_bug.cgi?id=50116

Reviewed By: MyDeveloperDay

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

3 years ago[MemCpyOpt] Handle unusual memcpy element type
Nikita Popov [Sun, 27 Jun 2021 14:19:21 +0000 (16:19 +0200)]
[MemCpyOpt] Handle unusual memcpy element type

Apparently, it is legal to use memcpy/memset with pointer types
other than i8*. Prior to 81fcdae68c5ff656c30032fd26c6a21af4c51dbb
this case was silently miscompiled, as the i8 offset calculation
was performed on some other type. Now it would crash due to a
type mismatch. Fix this by inserting an explicit bitcast to i8*.

3 years ago[InstCombine] hoist min/max intrinsics above select with constant op
Sanjay Patel [Sun, 27 Jun 2021 13:58:28 +0000 (09:58 -0400)]
[InstCombine] hoist min/max intrinsics above select with constant op

This is an extension of the handling for unary intrinsics and
follows the logic that we use for binary ops.

We don't canonicalize to min/max intrinsics yet, but this might
help unlock other folds seen in D98152.

3 years ago[MemCpyOpt] Support opaque pointers
Nikita Popov [Sun, 27 Jun 2021 13:52:24 +0000 (15:52 +0200)]
[MemCpyOpt] Support opaque pointers

3 years ago[LoadStoreVectorizer] Support opaque pointers
Nikita Popov [Sun, 27 Jun 2021 13:40:43 +0000 (15:40 +0200)]
[LoadStoreVectorizer] Support opaque pointers

There are remaining redundant bitcasts.

3 years ago[VPlan] Track both incoming values for first-order recurrence phis.
Florian Hahn [Sun, 27 Jun 2021 11:39:01 +0000 (12:39 +0100)]
[VPlan] Track both incoming values for first-order recurrence phis.

This patch updates VPWidenPHI recipes for first-order recurrences to
also track the incoming value from the back-edge. Similar to D99294,
which did the same for reductions.

Reviewed By: Ayal

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

3 years ago[InstCombine][test] add tests for min/max intrinsics with select operand; NFC
Sanjay Patel [Fri, 25 Jun 2021 18:51:00 +0000 (14:51 -0400)]
[InstCombine][test] add tests for min/max intrinsics with select operand; NFC

3 years ago[Analysis] improve function signature checking for calloc
Sanjay Patel [Fri, 25 Jun 2021 17:19:39 +0000 (13:19 -0400)]
[Analysis] improve function signature checking for calloc

This would crash later if we thought the parameters were
valid for the standard library call as shown in:
https://llvm.org/PR50846

3 years ago[Orc][examples] LLJITWithRemoteDebugger: fix CMake when utils are not built
Mara Sophie Grosch [Sun, 27 Jun 2021 11:52:04 +0000 (13:52 +0200)]
[Orc][examples] LLJITWithRemoteDebugger: fix CMake when utils are not built

3 years ago[lld/mac] Don't fold UNWIND_X86_64_MODE_STACK_IND unwind entries
Nico Weber [Sat, 26 Jun 2021 02:50:46 +0000 (22:50 -0400)]
[lld/mac] Don't fold UNWIND_X86_64_MODE_STACK_IND unwind entries

libunwind uses unwind info to find the function address belonging
to the current instruction pointer. libunwind/src/CompactUnwinder.hpp's
step functions read functionStart for UNWIND_X86_64_MODE_STACK_IND
(and for nothing else), so these encodings need a dedicated entry
per function, so that the runtime can get the stacksize off the
`subq` instrunction in the function's prologue.

This matches ld64.

(CompactUnwinder.hpp from https://opensource.apple.com/source/libunwind/
also reads functionStart in a few more cases if `SUPPORT_OLD_BINARIES` is set,
but it defaults to 0, and ld64 seems to not worry about these additional
cases.)

Related upstream bug: https://crbug.com/1220175

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

3 years agoFix lld testsuite after llvm-dwarfdump now errors on invalid DWARF
Jan Kratochvil [Sun, 27 Jun 2021 10:26:11 +0000 (12:26 +0200)]
Fix lld testsuite after llvm-dwarfdump now errors on invalid DWARF

D104271 broke buildbots for lld/test/ELF/non-abs-reloc.s .

3 years agollvm-dwarfdump: Print warnings on invalid DWARF
Jan Kratochvil [Sun, 27 Jun 2021 09:38:35 +0000 (11:38 +0200)]
llvm-dwarfdump: Print warnings on invalid DWARF

llvm-dwarfdump was silent even when the format of DWARF was invalid
and/or llvm-dwarfdump did not understand/support some of the constructs.
This can be pretty confusing as llvm-dwarfdump is a tool for DWARF
producers+consumers development.

Review comments also by @dblaikie.

Reviewed By: jhenderson

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

3 years ago[mlir][NFC] Cleanup: Move helper functions to StaticValueUtils
Matthias Springer [Sun, 27 Jun 2021 06:15:44 +0000 (15:15 +0900)]
[mlir][NFC] Cleanup: Move helper functions to StaticValueUtils

Reduce code duplication: Move various helper functions, that are duplicated in TensorDialect, MemRefDialect, LinalgDialect, StandardDialect, into a new StaticValueUtils.cpp.

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

3 years ago[X86] Tighten up some inline assembly constraint handling.
Craig Topper [Sun, 27 Jun 2021 05:48:56 +0000 (22:48 -0700)]
[X86] Tighten up some inline assembly constraint handling.

Don't allow vectors to split into GPRs for 'r' and other scalar
constraints. Prevents assertion in getCopyToPartsVector.

Makes PR50907 give a better error instead of crashing.

3 years ago[docs][llvm-strip] Fix documentation for -s/-S
Alexander Shaposhnikov [Sun, 27 Jun 2021 04:26:53 +0000 (21:26 -0700)]
[docs][llvm-strip] Fix documentation for -s/-S

Fix the command line guide for -g/-s/-S.
In particular, previously it was incorrectly stating that -S is an alias for --strip-all.

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

3 years ago[X86] Correct the conversion of VALIGND/Q intrinsics to shufflevector.
Craig Topper [Sun, 27 Jun 2021 02:02:26 +0000 (19:02 -0700)]
[X86] Correct the conversion of VALIGND/Q intrinsics to shufflevector.

We need to mask the immediate to the width of a single vector
rather than 2 vectors. If we use the width of 2 vectors then
any shift larger than the length of 1 vector is going to overflow
the shuffle indices.

Fixes PR50895.

3 years ago[Driver] do not link _p libs for -pg on FreeBSD 14 and later
Ed Maste [Tue, 22 Jun 2021 14:35:36 +0000 (10:35 -0400)]
[Driver] do not link _p libs for -pg on FreeBSD 14 and later

In FreeBSD 14 the project will deprecate the _p special profiling
libraries.

Support for -pg (i.e., mcount) still exists but libraries compiled
with -pg will not be built by default, so stop linking against them.

Reviewed by: Dimitry Andric
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.llvm.org/D104753

3 years ago[ARM] Lower MVETRUNC to stack operations
David Green [Sat, 26 Jun 2021 21:12:57 +0000 (22:12 +0100)]
[ARM] Lower MVETRUNC to stack operations

The MVETRUNC node truncates two wide vectors to a single vector with
narrower elements. This is usually lowered to a series of extract/insert
elements, going via GPR registers. This patch changes that to instead
use a pair of truncating stores and a stack reload. This cuts down the
number of instructions at the expense of some stack space.

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

3 years ago[clang] add C++ feature test macro for P2266 simpler implicit move
Matheus Izvekov [Sat, 26 Jun 2021 00:11:41 +0000 (02:11 +0200)]
[clang] add C++ feature test macro for P2266 simpler implicit move

The feature was implemented in D99005, but we forgot to add the test
macro.

Reviewed By: Quuxplusone

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

3 years ago[ARM] Introduce MVETRUNC ISel lowering
David Green [Sat, 26 Jun 2021 21:00:26 +0000 (22:00 +0100)]
[ARM] Introduce MVETRUNC ISel lowering

Currently, when encountering store(trunc(..)) where the trunc is double
a legal vector lenth in MVE, we spilt the node into two different stores
each performing half of the trunc from the wider type. This works well
for efficiently lowering wider than legal types, else the trunc becomes
a series of individual lane moves. Unfortunately this splitting is
currently one of the first combines attempted, so can happen before any
other combines which might be more preferable.

This patch instead introduces the concept of a MVETRUNC ISel node that
the trunk is initially lowered to, to keep it intact as a single item as
opposed to splitting it up. This allows us to push the store(trunc(..))
combine later, allowing other optimisations to potentially happen on the
trunc first. The store(trunc(..)) splitting can then be done later in
the legalisation period if needed, or else fall back to a buildvector as
before.

This can also be used in the future to lower to loads/stores, as opposed
to the more expensive lane extracts/inserts. Some extra combines are
added to keep all the existing tests happy.

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

3 years ago[RISCV] Use zexti32/sexti32 in srliw/sraiw isel patterns to improve usage of those...
Craig Topper [Sat, 26 Jun 2021 18:56:43 +0000 (11:56 -0700)]
[RISCV] Use zexti32/sexti32 in srliw/sraiw isel patterns to improve usage of those instructions.

3 years ago[ARM] MVE vabd
David Green [Sat, 26 Jun 2021 18:41:32 +0000 (19:41 +0100)]
[ARM] MVE vabd

This adds MVE lowering for VABDS/VABDU, using the code parted from
AArch64 in D91937.

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

3 years ago[ISel] Port AArch64 SABD and UABD to DAGCombine
David Green [Sat, 26 Jun 2021 18:34:16 +0000 (19:34 +0100)]
[ISel] Port AArch64 SABD and UABD to DAGCombine

This ports the AArch64 SABD and USBD over to DAG Combine, where they can be
used by more backends (notably MVE in a follow-up patch). The matching code
has changed very little, just to handle legal operations and types
differently. It selects from (ABS (SUB (EXTEND a), (EXTEND b))), producing
a ubds/abdu which is zexted to the original type.

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

3 years ago[Verifier] Support masked load/store with opaque pointers
Nikita Popov [Sat, 26 Jun 2021 16:11:59 +0000 (18:11 +0200)]
[Verifier] Support masked load/store with opaque pointers

3 years ago[gn build] Port 8b7881a084d0
LLVM GN Syncbot [Sat, 26 Jun 2021 14:20:52 +0000 (14:20 +0000)]
[gn build] Port 8b7881a084d0

3 years ago[clang-format] Add basic support for formatting JSON
mydeveloperday [Sat, 26 Jun 2021 14:20:17 +0000 (15:20 +0100)]
[clang-format] Add basic support for formatting JSON

I find as I develop I'm moving between many different languages C++,C#,JavaScript all the time. As I move between the file types I like to keep `clang-format` as my formatting tool of choice. (hence why I initially added C# support  in {D58404}) I know those other languages have their own tools but I have to learn them all, and I have to work out how to configure them, and they may or may not have integration into my IDE or my source code integration.

I am increasingly finding that I'm editing additional JSON files as part of my daily work and my editor and git commit hooks are just not setup to go and run [[ https://stedolan.github.io/jq/ | jq ]], So I tend to go to  [[ https://jsonformatter.curiousconcept.com/ | JSON Formatter ]] and copy and paste back and forth. To get nicely formatted JSON. This is a painful process and I'd like a new one that causes me much less friction.

This has come up from time to time:

{D10543}
https://stackoverflow.com/questions/35856565/clang-format-a-json-file
https://bugs.llvm.org/show_bug.cgi?id=18699

I would like to stop having to do that and have formatting JSON as a first class clang-format support `Language` (even if it has minimal style settings at present).

This revision adds support for formatting JSON using the inbuilt JSON serialization library of LLVM, With limited control at present only over the indentation level

This adds an additional Language into the .clang-format file to separate the settings from your other supported languages.

Reviewed By: HazardyKnusperkeks

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

3 years ago[clang-format] [PR50702] Lamdba processing does not respect AfterClass and AfterNamespace
mydeveloperday [Sat, 26 Jun 2021 12:34:07 +0000 (13:34 +0100)]
[clang-format] [PR50702] Lamdba processing does not respect AfterClass and AfterNamespace

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

I believe {D44609} may be too aggressive with brace wrapping rules which doesn't always apply to Lamdbas

The introduction of BeforeLambdaBody and AllowShortLambdasOnASingleLine has impact on brace handling on other block types, which I suspect we didn't see before as people may not be using the BeforeLambdaBody  style

From what I can tell this can be seen by the unit test I change as its not honouring the orginal LLVM brace wrapping style for the `Fct()` function

I added a unit test from PR50702 and have removed some of the code (which has zero impact on the unit test, which kind of suggests its unnecessary), some additional attempt has been made to try and ensure we'll only break on what is actually a LamdbaLBrace

Reviewed By: HazardyKnusperkeks

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

3 years ago[clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some...
mydeveloperday [Sat, 26 Jun 2021 12:28:34 +0000 (13:28 +0100)]
[clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations

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

AlignConsecutiveAssignments/Declarations cause incorrect alignment in the presence of a DesignatedInitializerPeriod (https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html)

```
static NTSTATUS stg(PLW_STREAM Stream, int identity)
{
     NTSTATUS             status;
     BYTE                 payload[256] = {'l', 'h', 'o', 't', 's', 'e'};
     struct dm_rpc_header header       = {.drh_magic        = DRH_MAGIC,
                                    .drh_op_code      = RPC_OP_ECHO,
                                    .drh_payload_size = sizeof(payload),
                                    .drh_body_size    = sizeof(payload),
                                    .drh_request_id   = 1};
     header.drh_version                = identity;
```

This fix addresses that by ensuring the period isn't ignored

Reviewed By: HazardyKnusperkeks

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

3 years ago[ARM] Regenerate big-endian-vector-caller.ll test checks. NFC
David Green [Sat, 26 Jun 2021 12:21:54 +0000 (13:21 +0100)]
[ARM] Regenerate big-endian-vector-caller.ll test checks. NFC

3 years ago[LV] Adjust trip count based on IsOrdered in widenPHIInstruction (NFC).
Florian Hahn [Sat, 26 Jun 2021 12:11:18 +0000 (13:11 +0100)]
[LV] Adjust trip count based on IsOrdered in widenPHIInstruction (NFC).

Suggested in D104197, avoids the early exit.

3 years ago[gn build] Port aff57ff24aca
LLVM GN Syncbot [Sat, 26 Jun 2021 11:38:00 +0000 (11:38 +0000)]
[gn build] Port aff57ff24aca

3 years ago[JITLink][ELF] Add generic ELFLinkGraphBuilder template.
Lang Hames [Sat, 26 Jun 2021 11:27:14 +0000 (21:27 +1000)]
[JITLink][ELF] Add generic ELFLinkGraphBuilder template.

ELFLinkGraphBuilder<ELFT> will hold generic parsing and LinkGraph-building code
that can be shared between JITLink ELF backends for different architectures.

For now it's just a stub. The plan is to incrementally move functionality down
from ELFLinkGraphBuilder_x86_64 into the new template.

3 years ago[clang][tests] Specify unwindlib in aix-ld tests
Timm Bäder [Fri, 25 Jun 2021 07:32:01 +0000 (09:32 +0200)]
[clang][tests] Specify unwindlib in aix-ld tests

Clang can be configured with a different default unwindlib, for example
gcc. In that case, -lunwind will not be present in the output.

Fix this by explicitly specifying libunwind as the unwindlib.

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

3 years ago[RISCV][NFC] Combine the control flow for different RetOp of interrupt function
Jim Lin [Sat, 26 Jun 2021 09:28:01 +0000 (17:28 +0800)]
[RISCV][NFC] Combine the control flow for different RetOp of interrupt function

Reviewed By: frasercrmck

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

3 years ago[Docs] Minor fixes with language extension docs
Saurabh Jha [Sat, 26 Jun 2021 09:07:14 +0000 (10:07 +0100)]
[Docs] Minor fixes with language extension docs

There were some issues in the patch https://reviews.llvm.org/D104198. I also forgot to address one comment. This patch addresses these.

Reviewed By: xgupta

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

3 years ago[RISCV] Add DAG combine to detect opportunities to replace (i64 (any_extend (i32...
Craig Topper [Fri, 25 Jun 2021 19:58:31 +0000 (12:58 -0700)]
[RISCV] Add DAG combine to detect opportunities to replace (i64 (any_extend (i32 X)) with sign_extend.

If type legalization is going to insert a sign_extend for other users
of X and we can fold the sign_extend into ADDW/MULW/SUBW, it is
better to replace the ANY_EXTEND so we don't end up with a separate
ADD/MUL/SUB instruction for the users of the ANY_EXTEND.

I'm only handling setcc uses right now, but there are other
instructions that force sign_extends like ashr.

There are probably other *W instructions we could use in addition
to ADDW/SUBW/MULW.

My motivating case was a loop terminating compare and a phi use
as seen in the new test file.

Reviewed By: asb

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

3 years ago[MLIR][Sparse] Move `buildLattices` into Merger
Gus Smith [Fri, 25 Jun 2021 23:37:53 +0000 (23:37 +0000)]
[MLIR][Sparse] Move `buildLattices` into Merger

This allows us to use `buildLattices` in the `Merger` unittests.

Reviewed By: aartbik

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

3 years ago[ms] [llvm-ml] Disable C-style comments
Eric Astor [Sat, 26 Jun 2021 03:09:13 +0000 (23:09 -0400)]
[ms] [llvm-ml] Disable C-style comments

3 years ago[X86] Selecting fld0 for undefined value in fast ISEL.
Luo, Yuanke [Tue, 22 Jun 2021 01:48:10 +0000 (09:48 +0800)]
[X86] Selecting fld0 for undefined value in fast ISEL.

When set opt-bisect-limit to some value that is less than ISel pass
in command line and CurBisectNum expired, "DAG to DAG" pass lower
its opt level to O0. However "processimpdefs" and "X86 FP Stackifier"
is not stopped due to the CurBisectNum expiration. So undefined fp0
is generated. This cause crash in the "X86 FP Stackifier" pass,
because Stackifier doesn't expect any undefined fp value.

Here is the scenario that cause compiler crash.

  successors: %bb.26
  liveins: $r14
    ST_FPrr $st0, implicit-def $fpsw, implicit $fpcw
    renamable $rdi = MOV64ri @.str.3.16422
    renamable $rdx = LEA64r %stack.6, 1, $noreg, 0, $noreg
    ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def dead
    $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
    dead $esi = MOV32r0 implicit-def dead $eflags, implicit-def $rsi
    CALL64pcrel32 @foo, implicit $rsp, implicit $ssp, implicit $rdi,
    implicit $rsi, implicit $rdx, implicit-def dead $fp0
    renamable $xmm0 = MOVSDrm_alt %stack.10, 1, $noreg, 0, $noreg :: (load 8
    from %stack.10)
    ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def dead $eflags,
    implicit-def $ssp, implicit $rsp, implicit $ssp
    renamable $fp2 = CHS_Fp80 killed undef renamable $fp0, implicit-def
    $fpsw
    JMP_1 %bb.26
The CALL64pcrel32 mark fp0 dead, so llvm free the stack slot for fp0
and the stack become empty. In the late instruction CHS_Fp80, it use
undefined register fp0, the original code assume there must be a stack
slot for the src register (fp0) without respecting it is undefined,
so llvm report error.

We have some discussion in https://reviews.llvm.org/D104440 and we
decide to fix it in fast ISel. The fix is to lower undefined fp value to
zero value, so that it release the burden of "X86 FP Stackifier" pass.
Thank Craig for the suggestion and the initial patch to fix it.

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

3 years agoDisable ReplaceLDS pass, patch up tests to match
Jon Chesterfield [Sat, 26 Jun 2021 00:36:41 +0000 (01:36 +0100)]
Disable ReplaceLDS pass, patch up tests to match

Most tests passed with an extra argument to explicitly enable the pass.
One does not, deleted it as part of this change. I can't see why the codegen
would be different between default on and default off but switched on. It
can be retrieved from the project history.

This would be a revert, but git revert was not clean. Disabling the pass
and leaving it in tree is less likely to cause breakage elsewhere than
patching up the git revert conflicts on unfamiliar code. It'll be landed
without review, as @hsmhsm is believed unavailable at present.

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

3 years ago[DFSan] Change shadow and origin memory layouts to match MSan.
Andrew Browne [Fri, 25 Jun 2021 05:16:36 +0000 (22:16 -0700)]
[DFSan] Change shadow and origin memory layouts to match MSan.

Previously on x86_64:

  +--------------------+ 0x800000000000 (top of memory)
  | application memory |
  +--------------------+ 0x700000008000 (kAppAddr)
  |                    |
  |       unused       |
  |                    |
  +--------------------+ 0x300000000000 (kUnusedAddr)
  |       origin       |
  +--------------------+ 0x200000008000 (kOriginAddr)
  |       unused       |
  +--------------------+ 0x200000000000
  |   shadow memory    |
  +--------------------+ 0x100000008000 (kShadowAddr)
  |       unused       |
  +--------------------+ 0x000000010000
  | reserved by kernel |
  +--------------------+ 0x000000000000

  MEM_TO_SHADOW(mem) = mem & ~0x600000000000
  SHADOW_TO_ORIGIN(shadow) = kOriginAddr - kShadowAddr + shadow

Now for x86_64:

  +--------------------+ 0x800000000000 (top of memory)
  |    application 3   |
  +--------------------+ 0x700000000000
  |      invalid       |
  +--------------------+ 0x610000000000
  |      origin 1      |
  +--------------------+ 0x600000000000
  |    application 2   |
  +--------------------+ 0x510000000000
  |      shadow 1      |
  +--------------------+ 0x500000000000
  |      invalid       |
  +--------------------+ 0x400000000000
  |      origin 3      |
  +--------------------+ 0x300000000000
  |      shadow 3      |
  +--------------------+ 0x200000000000
  |      origin 2      |
  +--------------------+ 0x110000000000
  |      invalid       |
  +--------------------+ 0x100000000000
  |      shadow 2      |
  +--------------------+ 0x010000000000
  |    application 1   |
  +--------------------+ 0x000000000000

  MEM_TO_SHADOW(mem) = mem ^ 0x500000000000
  SHADOW_TO_ORIGIN(shadow) = shadow + 0x100000000000

Reviewed By: stephan.yichao.zhao, gbalats

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

3 years ago[libc] Use __builtin_ctzll instead of __builtin_ctzl in elements_x86.h.
Siva Chandra Reddy [Fri, 25 Jun 2021 05:43:47 +0000 (05:43 +0000)]
[libc] Use __builtin_ctzll instead of __builtin_ctzl in elements_x86.h.

__builtin_ctzl takes an unsigned long argument which need not be 64-bit
long on all platforms. Using __builtin_ctzll, which takes an unsigned
long long argument, ensures that 64-bit values will be handled on a
wider range of platforms.

Without this change, the test corresponding to M512 fails in Windows.

Reviewed By: gchatelet

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

3 years agoRevert "[InstCombine] Make indexed compare fold opaque ptr compatible"
Nikita Popov [Fri, 25 Jun 2021 22:32:59 +0000 (00:32 +0200)]
Revert "[InstCombine] Make indexed compare fold opaque ptr compatible"

This reverts commit 5cb20ef8a235c2027489a196bba27630ca21a00b.

Assertion failures with this patch were reported on
https://reviews.llvm.org/rG5cb20ef8a235, revert for now.

3 years agoOpaquePtr: Reject 'ptr*' again when parsing textual IR
Duncan P. N. Exon Smith [Fri, 25 Jun 2021 18:53:27 +0000 (11:53 -0700)]
OpaquePtr: Reject 'ptr*' again when parsing textual IR

Bring back the testcase dropped in
1e6303e60ca5af4fbe7ca728572fd65666a98271 and get it passing by checking
explicitly for `ptr*` in LLParser. Uses `Type::isOpaquePointerTy()` from
ad4bb8280952c2cacf497e30560ee94c119b36e0.

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

3 years ago[mlir][sparse] add print methods to Merger (for debugging)
Aart Bik [Fri, 25 Jun 2021 19:02:08 +0000 (12:02 -0700)]
[mlir][sparse] add print methods to Merger (for debugging)

Reviewed By: gussmith23

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

3 years ago[clang] Stop providing builtin overload candidate for relational function pointer...
Matheus Izvekov [Tue, 22 Jun 2021 01:48:51 +0000 (03:48 +0200)]
[clang] Stop providing builtin overload candidate for relational function pointer comparisons

Word on the grapevine was that the committee had some discussion that
ended with unanimous agreement on eliminating relational function pointer comparisons.

We wanted to be bold and just ban all of them cold turkey.
But then we chickened out at the last second and are going for
eliminating just the spaceship overload candidate instead, for now.

See D104680 for reference.

This should be fine and "safe", because the only possible semantic change this
would cause is that overload resolution could possibly be ambiguous if
there was another viable candidate equally as good.

But to save face a little we are going to:
* Issue an "error" for three-way comparisons on function pointers.
  But all this is doing really is changing one vague error message,
  from an "invalid operands to binary expression" into an
  "ordered comparison of function pointers", which sounds more like we mean business.
* Otherwise "warn" that comparing function pointers like that is totally
  not cool (unless we are told to keep quiet about this).

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

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

3 years ago[lldb] Use the non-locking variant of objc_copyRealizedClassList
Jonas Devlieghere [Fri, 25 Jun 2021 19:57:36 +0000 (12:57 -0700)]
[lldb] Use the non-locking variant of objc_copyRealizedClassList

Avoid standing the Objective-C runtime lock by calling
objc_copyRealizedClassList_nolock instead of objc_copyRealizedClassList.

We already guarantee that no other threads can run while we're running
this utility expression, similar to when we parse the data ourselves
from the gdb_objc_realized_classes struct.

Worst case this will crash if the list is getting edited, which won't do
any harm and we'll just try again later.

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

3 years agoAdd support for the NSMutableDictionary variant: "__NSFrozenDictionaryM"
Jim Ingham [Fri, 25 Jun 2021 01:58:21 +0000 (18:58 -0700)]
Add support for the NSMutableDictionary variant: "__NSFrozenDictionaryM"

This was an oversight of the commit: bb93483c119b92c1ec2b7a58505e21b9dce6a333 that
added support for the Frozen variants.  Also added a test case for the way that
currently produces one of these variants (a copy).

3 years ago[NFC] Prefer ConstantRange::makeExactICmpRegion over makeAllowedICmpRegion
Eli Friedman [Fri, 25 Jun 2021 21:43:13 +0000 (14:43 -0700)]
[NFC] Prefer ConstantRange::makeExactICmpRegion over makeAllowedICmpRegion

The implementation is identical, but it makes the semantics a bit more
obvious.

3 years ago[ms] [llvm-ml] Add support for ALIGN, EVEN, and ORG directives
Eric Astor [Fri, 25 Jun 2021 21:19:39 +0000 (17:19 -0400)]
[ms] [llvm-ml] Add support for ALIGN, EVEN, and ORG directives

Match ML.EXE's behavior for ALIGN, EVEN, and ORG directives both at file level and in STRUCTs.

We currently reject negative offsets passed to ORG inside STRUCTs (in ML.EXE and ML64.EXE, they wrap around as for an unsigned 32-bit integer).

Also, if a STRUCT is declared using an ORG directive, no value of that type can be defined.

Reviewed By: thakis

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

3 years agoChange PathMappingList::RemapPath to return an optional result (NFC)
Adrian Prantl [Fri, 25 Jun 2021 20:49:01 +0000 (13:49 -0700)]
Change PathMappingList::RemapPath to return an optional result (NFC)

This is an NFC modernization refactoring that replaces the combination
of a bool return + reference argument, with an Optional return value.

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

3 years ago[SimplifyLibCalls] Fix memchr opt to use CreateLogicalAnd
Juneyoung Lee [Fri, 25 Jun 2021 08:56:10 +0000 (17:56 +0900)]
[SimplifyLibCalls] Fix memchr opt to use CreateLogicalAnd

This fixes a bug at LibCallSimplifier::optimizeMemChr which does the following transformation:

```
// memchr("\r\n", C, 2) != nullptr -> (1 << C & ((1 << '\r') | (1 << '\n')))
// != 0
//   after bounds check.
```

As written above, a bounds check on C (whether it is less than integer bitwidth) is done before doing `1 << C` otherwise 1 << C will overflow.
If the bounds check is false, the result of (1 << C & ...) must not be used at all, otherwise the result of shift (which is poison) will contaminate the whole results.
A correct way to encode this is `select i1 (bounds check), (1 << C & ...), false`  because select does not allow the unused operand to contaminate the result.
However, this optimization was introducing `and (bounds check), (1 << C & ...)` which cannot do that.

The bug was found from compilation of this C++ code: https://reviews.llvm.org/rG2fd3037ac615#1007197

Reviewed By: nikic

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

3 years ago[OpenMP] Change OpenMPOpt to check openmp metadata
Joseph Huber [Thu, 24 Jun 2021 21:11:54 +0000 (17:11 -0400)]
[OpenMP] Change OpenMPOpt to check openmp metadata

The metadata added in D102361 introduces a module flag that we can check
to determine if the module was compiled with `-fopenmp` enables. We can
now check for the precense of this instead of scanning the call graph
for OpenMP runtime functions.

Depends on D102361

Reviewed By: jdoerfert

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

3 years ago[OpenMP] Add Module metadata for OpenMP compilation
Joseph Huber [Thu, 24 Jun 2021 18:39:12 +0000 (14:39 -0400)]
[OpenMP] Add Module metadata for OpenMP compilation

This patch adds a module level metadata flag indicating that the module
was compiled with the `-fopenmp` flag. This will make it easier for
passes like OpenMPOpt to determine if it should be run.

Reviewed By: jdoerfert

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

3 years ago[PowerPC] Disable combine 64-bit bswap(load) without LDBRX
Nemanja Ivanovic [Fri, 25 Jun 2021 20:09:02 +0000 (15:09 -0500)]
[PowerPC] Disable combine 64-bit bswap(load) without LDBRX

This causes failures on the big endian bootstrap bot.
Disabling this combine temporarily until I can get a proper fix.

3 years ago[analyzer] Fix assertion failure on code with transparent unions
Valeriy Savchenko [Tue, 22 Jun 2021 13:04:15 +0000 (16:04 +0300)]
[analyzer] Fix assertion failure on code with transparent unions

rdar://76948312

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

3 years ago[llvm-rc] Don't rewrite the arch in the default triple unless necessary
Martin Storsjö [Fri, 18 Jun 2021 19:59:58 +0000 (22:59 +0300)]
[llvm-rc] Don't rewrite the arch in the default triple unless necessary

When the default target arch isn't one that is supported as a
windows target, we want to set a suitable architecture (so that
Clang tests that run plain 'llvm-rc' succeed checks for e.g.
"#ifdef _WIN32" even for llvm builds that default to e.g. ppc64).

But if the default target architecture is usable, don't rewrite it.
(Rewriting it, by e.g. "T.setArch(T.getArch())", normalizes the
spelling of the architecture, e.g. changing i686 to i386. Such a
change can make clang unable to find the right sysroot.)

This can't, unfortunately, practically be tested very well because
it is entirely dependent on the default triple of the llvm build.

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

3 years ago[ELF] --sysroot: change sysrooted script to not fall back for an absolute path
Fangrui Song [Fri, 25 Jun 2021 19:52:39 +0000 (12:52 -0700)]
[ELF] --sysroot: change sysrooted script to not fall back for an absolute path

Modify the D13209 logic: for a script inside the sysroot, if an absolute path
does not exist, report an error instead of falling back to the path without the
sysroot prefix.

This matches GNU ld, which makes sense to me: we don't want to find an arbitrary
file in the host.

Reviewed By: ikudrin

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

3 years ago[SystemZ] Add support for .reloc assembler directive
Ulrich Weigand [Fri, 25 Jun 2021 19:49:07 +0000 (21:49 +0200)]
[SystemZ] Add support for .reloc assembler directive

Add support for the .reloc directive along the lines of
other back-ends.

This fixes a regression after https://reviews.llvm.org/D104080
was merged, since that patch presupposed support for .reloc.

3 years ago[Coroutines] Define __coro_frame_ty in function scope
Hongtao Yu [Fri, 25 Jun 2021 18:35:02 +0000 (11:35 -0700)]
[Coroutines] Define __coro_frame_ty in function scope

Types should be defined in function scope instead of a local lexical scope. Field types should be defined inside in its parent type scope.

We were seeing a type defined in a local scope causing trouble to the dwarf emitter where a context is required to be a funciton scope, a namespace or a global scope.

Reviewed By: aprantl

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

3 years ago[mlir:Async] Submit accidentally omitted changes
Eugene Zhulenev [Fri, 25 Jun 2021 19:14:51 +0000 (12:14 -0700)]
[mlir:Async] Submit accidentally omitted changes

Accidentally pushed old branches that did not include all the changes discussed in the PRs.

https://reviews.llvm.org/rGd43b23608ad664f02f56e965ca78916bde220950
https://reviews.llvm.org/rG86ad0af87054c3cccd68d32e103a6f1f6c6194c7

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

3 years ago[OpaquePtr] Enumerate GlobalAlias value type
Nikita Popov [Fri, 25 Jun 2021 19:19:08 +0000 (21:19 +0200)]
[OpaquePtr] Enumerate GlobalAlias value type

The type is no longer implicitly enumerated through the pointer
type.

3 years ago[libc++] Enable the rvalue overloads of operator<< and operator>> even in C++03.
Arthur O'Dwyer [Tue, 15 Jun 2021 16:57:05 +0000 (12:57 -0400)]
[libc++] Enable the rvalue overloads of operator<< and operator>> even in C++03.

Continuing to eliminate no-longer-needed uses of _LIBCPP_CXX03_LANG.

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

3 years ago[IR] Add Type::isOpaquePointerTy() helper (NFC)
Nikita Popov [Fri, 25 Jun 2021 18:55:09 +0000 (20:55 +0200)]
[IR] Add Type::isOpaquePointerTy() helper (NFC)

Shortcut to check for opaque pointers without a cast to PointerType.

3 years ago[flang] Fix generic/specific procedure confusion
peter klausler [Fri, 25 Jun 2021 17:35:03 +0000 (10:35 -0700)]
[flang] Fix generic/specific procedure confusion

A recent change that extended semantic analysis for actual arguments
that associate with procedure dummy arguments exposed some bugs in
regression test suites due to points of confusion in symbol table
handling in situations where a generic interface contains a specific
procedure of the same name.  When passing that name as an actual
argument, for example, it's necessary to take this possibility into
account because the symbol for the generic interface shadows the
symbol of the same name for the specific procedure, which is
what needs to be checked.  So add a small utility that bypasses
the symbol for a generic interface in this case, and use it
where needed.

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

3 years ago[DAG] Fold neg(splat(neg(x)) -> splat(x)
David Green [Fri, 25 Jun 2021 18:53:29 +0000 (19:53 +0100)]
[DAG] Fold neg(splat(neg(x)) -> splat(x)

This add as a fold of sub(0, splat(sub(0, x))) -> splat(x). This can
come up in the lowering of right shifts under AArch64, where we generate
a shift left of a negated number.

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

3 years ago[X86] Simplify part of the isel for X86ISD::FCMP/STRICT_FCMP/STRICT_FCMPS.
Craig Topper [Fri, 25 Jun 2021 17:58:23 +0000 (10:58 -0700)]
[X86] Simplify part of the isel for X86ISD::FCMP/STRICT_FCMP/STRICT_FCMPS.

We don't need to have the compare output a value and then copy it
to FPSW for use by FNSTSW. Instead we can just have the compare
output Glue and glue the FNSTSW to it. InstrEmitter effectively
performed this optimization when emitting the Machine IR. Doing
it directly simplifies the codes and reduces the work in
InstrEmitter. There's no change in the machine IR at the end of
isel before and after this change.

3 years ago[UpdateCCTestChecks] Fix new test from 9eaf0d120d32
Joel E. Denny [Fri, 25 Jun 2021 18:06:52 +0000 (14:06 -0400)]
[UpdateCCTestChecks] Fix new test from 9eaf0d120d32

`clang/test/utils/update_cc_test_checks/check-globals.test` from
9eaf0d120d32 broke at:

* <https://lab.llvm.org/buildbot/#/builders/110/builds/4415>
* <https://lab.llvm.org/buildbot/#/builders/5/builds/9076>

The problem is non-deterministic test order because the
`.lit_test_times.txt` from one run of a sample test suite affects the
other.

3 years ago[AArch64] Extra negated shift tests. NFC
David Green [Fri, 25 Jun 2021 18:17:31 +0000 (19:17 +0100)]
[AArch64] Extra negated shift tests. NFC

3 years ago[libomptarget][amdgpu] Build openmp for two more targets
Jon Chesterfield [Fri, 25 Jun 2021 18:02:02 +0000 (19:02 +0100)]
[libomptarget][amdgpu] Build openmp for two more targets

[libomptarget][amdgpu] Build openmp for two more targets

The 4800U APU is a gfx902 and the MI100 accelerator is a gfx908.
Both numbers are listed in ROCT topology.c

Reviewed By: jhuber6

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

3 years ago[clang] Make fewer assumptions about path to lit.site.cfg after 9eaf0d120d32
Nico Weber [Fri, 25 Jun 2021 18:01:21 +0000 (14:01 -0400)]
[clang] Make fewer assumptions about path to lit.site.cfg after 9eaf0d120d32

3 years ago[test] Add coverage for existing overflow rule with uadd.with.overflow
Philip Reames [Fri, 25 Jun 2021 17:44:53 +0000 (10:44 -0700)]
[test] Add coverage for existing overflow rule with uadd.with.overflow

3 years ago[LV] Doxygenize VectorizationFactor member comments (NFC).
Florian Hahn [Fri, 25 Jun 2021 14:57:25 +0000 (15:57 +0100)]
[LV] Doxygenize VectorizationFactor member comments (NFC).

Minor cleanup for follow-up patch.

3 years ago[mlir:Async] Implement recursive async work splitting for scf.parallel operation...
Eugene Zhulenev [Thu, 24 Jun 2021 12:27:42 +0000 (05:27 -0700)]
[mlir:Async] Implement recursive async work splitting for scf.parallel operation (async-parallel-for pass)

Depends On D104780

Recursive work splitting instead of sequential async tasks submission gives ~20%-30% speedup in microbenchmarks.

Algorithm outline:
1. Collapse scf.parallel dimensions into a single dimension
2. Compute the block size for the parallel operations from the 1d problem size
3. Launch parallel tasks
4. Each parallel task reconstructs its own bounds in the original multi-dimensional iteration space
5. Each parallel task computes the original parallel operation body using scf.for loop nest

Reviewed By: herhut

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

3 years ago[mlir:Async] Add the size parameter to the async.group
Eugene Zhulenev [Wed, 23 Jun 2021 13:24:09 +0000 (06:24 -0700)]
[mlir:Async] Add the size parameter to the async.group

Specify the `!async.group` size (the number of tokens that will be added to it) at construction time. `async.await_all` operation can potentially race with `async.execute` operations that keep updating the group, for this reason it is required to know upfront how many tokens will be added to the group.

Reviewed By: ftynse, herhut

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

3 years ago[instcombine] Fold overflow check using umulo to comparison
Philip Reames [Fri, 25 Jun 2021 17:24:10 +0000 (10:24 -0700)]
[instcombine] Fold overflow check using umulo to comparison

If we have a umul.with.overflow where the multiply result is not used and one of the operands is a constant, we can perform the overflow check cheaper with a comparison then by performing the multiply and extracting the overflow flag.

(Noticed when looking at the conditions SCEV emits for overflow checks.)

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

3 years ago[UpdateCCTestChecks] Support --check-globals
Joel E. Denny [Fri, 25 Jun 2021 16:40:04 +0000 (12:40 -0400)]
[UpdateCCTestChecks] Support --check-globals

This option is already supported by update_test_checks.py, but it can
also be useful in update_cc_test_checks.py.  For example, I'd like to
use it in OpenMP offload codegen tests to check global variables like
`.offload_maptypes*`.

Reviewed By: jdoerfert, arichardson, ggeorgakoudis

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

3 years ago[test][instcombine] Add test cases for all x.with.overflow overflow checks
Philip Reames [Thu, 24 Jun 2021 01:50:00 +0000 (18:50 -0700)]
[test][instcombine] Add test cases for all x.with.overflow overflow checks

For each of the x.with.overflow variants, if only the overflow bit is consumed, we can generate a direct overflow comparison.  This precommits tests for each of the variants and tries to cover interesting cornercases.

3 years ago[mlir][memref] Introduce UnrankedMemRefOf to tablegen definitions
Stephan Herhut [Fri, 25 Jun 2021 10:44:22 +0000 (12:44 +0200)]
[mlir][memref] Introduce UnrankedMemRefOf to tablegen definitions

This enables specifying operations that only support some element types for
unranked memrefs.

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

3 years ago[ModuloSchedule] Pass loop block explicitly to kernel rewriter.
Hendrik Greving [Wed, 23 Jun 2021 19:32:04 +0000 (12:32 -0700)]
[ModuloSchedule] Pass loop block explicitly to kernel rewriter.

This change is NFC upstream. We pass in the loop's block to the kernel
rewriter explicitly, instead of assuming it's the loop's top block. This
change is made for downstream targets where this assumption doesn't hold.

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

3 years ago[Coroutines] Remove all legacy test command
Xun Li [Fri, 25 Jun 2021 16:46:55 +0000 (09:46 -0700)]
[Coroutines] Remove all legacy test command

With new pm becomes the default, the old-style test command becomes exactly the same as the new test command, i.e. the two commands are now redundant.
We should just delete the old command. (unless someone wants to add enable-new-pm=0 to all old commands.

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

3 years agoRevert "[GlobalISel] NFC: Have LLT::getSizeInBits/Bytes return a TypeSize."
Sander de Smalen [Fri, 25 Jun 2021 16:36:44 +0000 (17:36 +0100)]
Revert "[GlobalISel] NFC: Have LLT::getSizeInBits/Bytes return a TypeSize."

This patch seems to be causing build errors, reverting it for now.

This reverts commit aeab9d9570ac8cb554aff6e1af24a471fdf5b4e5.

3 years ago[OpaquePtr] Allow globals with opaque pointer value type
Nikita Popov [Fri, 25 Jun 2021 09:26:15 +0000 (11:26 +0200)]
[OpaquePtr] Allow globals with opaque pointer value type

Do this by making opaque pointers a valid pointer element type,
for which we implicitly create an opaque pointer (moving the logic
from getPointerTo into PointerType::get).

We'll never create something like a "pointer to opaque pointer",
but accept it in the API, because a lot of code reasonably assumes
that you can create a pointer to pointer type.

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

3 years ago[lldb-vscode] Make extension contribute breakpoints use new package.json schema
Chris Bond [Fri, 25 Jun 2021 16:15:04 +0000 (18:15 +0200)]
[lldb-vscode] Make extension contribute breakpoints use new package.json schema

See https://code.visualstudio.com/updates/v1_42#_implement-a-debug-adapter-inside-an-extension

Reviewed By: clayborg

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

3 years ago[Analysis] use better version of getLibFunc to check for alloc/free calls
Sanjay Patel [Fri, 25 Jun 2021 15:36:28 +0000 (11:36 -0400)]
[Analysis] use better version of getLibFunc to check for alloc/free calls

There's no reason to use the weaker name-only analysis when we
have a function prototype to check (in fact, we probably should
not even have that name-only function exposed for general use,
but removing it requires auditing all of the callers).

The version of getLibFunc that takes a Function argument also
does some prototype checking to make sure the arguments/return
type match the expected signature of a real library call.

This is NFC-intended because the code in MemoryBuiltins does its
own function signature checking. For now, that means there may
be some redundancy in the checking, but that should not be above
the noise for compile-time. Ideally, we can move the checks to
a single location.

There's still a hole in the logic that allows the example in
https://llvm.org/PR50846 to cause a compiler crash.

3 years ago[GlobalISel] NFC: Have LLT::getSizeInBits/Bytes return a TypeSize.
Sander de Smalen [Fri, 25 Jun 2021 14:55:03 +0000 (15:55 +0100)]
[GlobalISel] NFC: Have LLT::getSizeInBits/Bytes return a TypeSize.

To reflect that the size may be scalable, a TypeSize is returned
instead of an unsigned. In places where the result is used,
it currently relies on an implicit cast of TypeSize -> uint64_t,
which asserts that the type is not scalable.

This patch is NFC for fixed-width vectors.

Reviewed By: aemerson

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