platform/upstream/llvm.git
2 years agoNFC: Remove wayward MIR tests from lib/Target
Jessica Paquette [Fri, 15 Oct 2021 16:59:00 +0000 (09:59 -0700)]
NFC: Remove wayward MIR tests from lib/Target

These were put in lib/Target instead of tests.

Thankfully dupes of them already existed in the tests directory.

So, just delete them.

2 years ago[lldb] Harden TestCompletion against new settings in 'target.process'
Raphael Isemann [Fri, 15 Oct 2021 16:48:17 +0000 (18:48 +0200)]
[lldb] Harden TestCompletion against new settings in 'target.process'

This test starts failing when people add a setting starting with
`target.process.t` which of course can easily happen. Make it a bit more
resistant by only requiring that `target.process.thr` has a unique completion.

2 years ago[SLP]Add a test for shrink shuffle after reorder, NFC.
Alexey Bataev [Fri, 15 Oct 2021 16:42:14 +0000 (09:42 -0700)]
[SLP]Add a test for shrink shuffle after reorder, NFC.

2 years ago[DebugInfo] retainedTypes should not have subprograms
Ellis Hoag [Fri, 15 Oct 2021 16:37:12 +0000 (12:37 -0400)]
[DebugInfo] retainedTypes should not have subprograms

After D80369, the retainedTypes in CU's should not have any subprograms
so we should not handle that case when emitting debug info.

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

2 years ago[DebugInfo] Limit the size of DIExpressions that we will salvage up to
Stephen Tozer [Tue, 21 Sep 2021 14:11:22 +0000 (15:11 +0100)]
[DebugInfo] Limit the size of DIExpressions that we will salvage up to

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

This patch places an arbitrary limit on the size of DIExpressions that
we will produce via salvaging, for performance reasons. This helps to
fix a performance issue observed in the bug above, in which debug values
would be salvaged hundreds of times, producing expressions with over
1000 elements and causing the compiler to hang. Limiting the size of
debug values that we will produce to 128 largely fixes this issue.

Reviewed By: dblaikie, jmorse

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

2 years ago[mlir][sparse] implement sparse tensor init operation
Aart Bik [Thu, 14 Oct 2021 01:33:53 +0000 (18:33 -0700)]
[mlir][sparse] implement sparse tensor init operation

Next step towards supporting sparse tensors outputs.
Also some minor refactoring of enum constants as well
as replacing tensor arguments with proper buffer arguments
(latter is required for more general sizes arguments for
the sparse_tensor.init operation, as well as more general
spares_tensor.convert operations later)

Reviewed By: wrengr

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

2 years ago[AIX] Enable int128 in 64 bit mode
Jinsong Ji [Fri, 15 Oct 2021 15:29:55 +0000 (15:29 +0000)]
[AIX] Enable int128 in 64 bit mode

This patch remove the override in AIX target,
so the int128 is enabled in 64 bit mode or with ForceEnableInt128.

Reviewed By: lkail

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

2 years ago[IR] Fix a few incorrect paths in file header comments. NFC
Craig Topper [Fri, 15 Oct 2021 16:14:04 +0000 (09:14 -0700)]
[IR] Fix a few incorrect paths in file header comments. NFC

2 years ago[clang] Capture Framework when HeaderSearch is resolved via headermap
Cyndy Ishida [Fri, 15 Oct 2021 15:12:54 +0000 (08:12 -0700)]
[clang] Capture Framework when HeaderSearch is resolved via headermap

When building frameworks, headermaps responsible for mapping angle-included headers to their source file location are passed via
`-I` and not `-index-header-map`. Also, `-index-header-map` is only used for indexing purposes and not during most builds.
This patch holds on to the framework's name in HeaderFileInfo as this is retrieveable for cases outside of IndexHeaderMaps and
still represents the framework that is being built.

resolves: rdar://84046893

Reviewed By: jansvoboda11

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

2 years ago[ARM] Don't use TARGET_HEADER_BUILTIN in arm_mve_builtins.inc or arm_cde_builtins.inc
Craig Topper [Fri, 15 Oct 2021 16:01:02 +0000 (09:01 -0700)]
[ARM] Don't use TARGET_HEADER_BUILTIN in arm_mve_builtins.inc or arm_cde_builtins.inc

The attributes string doesn't include 'f' or 'h'. I don't think
any code looks at the header name without those.

Reviewed By: simon_tatham

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

2 years ago[mlir][vector] NFC - Refactor and extract a helper StructuredGenerator class
Nicolas Vasilache [Fri, 15 Oct 2021 15:56:58 +0000 (15:56 +0000)]
[mlir][vector] NFC - Refactor and extract a helper StructuredGenerator class

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

2 years ago[libc++] LWG3266: delete the to_chars(bool) overload.
Konstantin Varlamov [Fri, 15 Oct 2021 15:40:42 +0000 (17:40 +0200)]
[libc++] LWG3266: delete the to_chars(bool) overload.

This PR only updates the synopsis in `<charconv>` -- the current
implementation already [deletes](https://github.com/llvm/llvm-project/blob/e9e6266c704df43e2c52308e1b653dccefa89e04/libcxx/include/charconv#L108)
the overload and has a [test](https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/utilities/charconv/charconv.to.chars/integral.bool.fail.cpp)
for it (and this has been the case from the first [commit](https://reviews.llvm.org/D41458)
where `<charconv>` was added).

Reviewed By: #libc, Mordante

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

2 years ago[OpenMP][Tools][NFC] Make an Archer test more robust
Joachim Protze [Fri, 15 Oct 2021 15:16:07 +0000 (17:16 +0200)]
[OpenMP][Tools][NFC] Make an Archer test more robust

The execution order of the tasks is not fixed, so there is no ordering
for the write accesses. Enforce the ordering that is expected in the check.

2 years ago[libc++][doc] Use issue labels.
Mark de Wever [Fri, 8 Oct 2021 19:01:55 +0000 (21:01 +0200)]
[libc++][doc] Use issue labels.

During the review of D111166 I had a private discussion with @ldionne to
avoid the duplication of the C++2b issues in the Ranges and Format
status pages. The main reason for duplicating them is to make it easier to
find them. The title of the paper may not always make it clear to which
project the paper belongs.

This commit removes all LWG-issues from the Ranges and Format status page
and adds labels for these issue in the C++20/C++23 issues list.

A quick scan revealed there are some issues that are missing a label since
they weren't on the ranges issue list. These can be labelled in a separate
commit. In that commit I'll also look for issues for the spaceship operator
and chrono.

Reviewed By: Quuxplusone, ldionne, #libc

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

2 years ago[llvm-readelf] Make -W an alias of --wide
gbreynoo [Fri, 15 Oct 2021 15:27:53 +0000 (16:27 +0100)]
[llvm-readelf] Make -W an alias of --wide

Currently -W and --wide are treated as two options as they are only
included for gnu readelf compatibility and ignored. This change makes -W
an alias of --wide to be consistent with other option aliases.

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

2 years ago[VectorCombine] add tests for shuffle of binops; NFC
Sanjay Patel [Fri, 15 Oct 2021 12:37:33 +0000 (08:37 -0400)]
[VectorCombine] add tests for shuffle of binops; NFC

2 years ago[lldb] Add test for struct merging in scratch ASTContext
Raphael Isemann [Fri, 15 Oct 2021 13:01:27 +0000 (15:01 +0200)]
[lldb] Add test for struct merging in scratch ASTContext

2 years ago[AArch64] Fix failing test target-invalid-cpu-note.c
Tomas Matheson [Fri, 15 Oct 2021 15:09:54 +0000 (16:09 +0100)]
[AArch64] Fix failing test target-invalid-cpu-note.c

2 years ago[Driver][NetBSD] Use Triple reference instead of ToolChain.getTriple().
Frederic Cambus [Fri, 15 Oct 2021 14:36:19 +0000 (16:36 +0200)]
[Driver][NetBSD] Use Triple reference instead of ToolChain.getTriple().

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

2 years ago[AMDGPU] Avoid redundant calls to numBits in AMDGPUCodeGenPrepare::replaceMulWithMul24().
Abinav Puthan Purayil [Fri, 15 Oct 2021 03:59:58 +0000 (09:29 +0530)]
[AMDGPU] Avoid redundant calls to numBits in AMDGPUCodeGenPrepare::replaceMulWithMul24().

The isU24() and isI24() calls numBits to make its decision. This change
replaces them with the internal numBits call so that we can use its
result for the > 32 bit width cases.

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

2 years ago[Polly] Remove checkIslAstExprInt and use RAII instead of manually freeing Expr....
Max Fan [Fri, 15 Oct 2021 13:45:28 +0000 (08:45 -0500)]
[Polly] Remove checkIslAstExprInt and use RAII instead of manually freeing Expr. NFC.

Polly is trying to move towards using isl::ast_expr / isl-noexceptions.h
(which implements RAII) where possible instead of manually managing memory.
checkIslAstExprInt manually frees Expr, so it has been removed to be
more idiomatic and consistent.

Reviewed By: Meinersbur

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

2 years ago[lldb] [test] Add TestGDBServerTargetXML tests for x86 duplicate subregs
Michał Górny [Fri, 15 Oct 2021 14:03:44 +0000 (16:03 +0200)]
[lldb] [test] Add TestGDBServerTargetXML tests for x86 duplicate subregs

2 years agoFix a crash on an invalid templated UDL declaration
Aaron Ballman [Fri, 15 Oct 2021 13:56:54 +0000 (09:56 -0400)]
Fix a crash on an invalid templated UDL declaration

We were missing a null pointer check that a template parameter existed
at all.

2 years ago[libc] Memory function benchmarks: rename MemcmpConfiguration in MemcmpOrBcmpConfigur...
Guillaume Chatelet [Fri, 15 Oct 2021 09:26:12 +0000 (09:26 +0000)]
[libc] Memory function benchmarks: rename MemcmpConfiguration in MemcmpOrBcmpConfiguration

This will help make sense of the double use of the same type in https://reviews.llvm.org/D111622#inline-1065560.

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

2 years ago[X86] Enable promotion of i16 popcnt (PR52056)
Dávid Bolvanský [Fri, 15 Oct 2021 13:37:11 +0000 (15:37 +0200)]
[X86] Enable promotion of i16 popcnt (PR52056)

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

Reviewed By: RKSimon

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

2 years ago[AArch64]Enabling Cortex-A510 Support
Mubashar Ahmad [Fri, 15 Oct 2021 13:29:57 +0000 (14:29 +0100)]
[AArch64]Enabling Cortex-A510 Support

This patch enables support for Cortex-A510 CPUs.

Reviewed By: MarkMurrayARM, dmgreen

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

2 years ago[AMDGPU] Fix width check for signed mul24 generation.
Abinav Puthan Purayil [Thu, 14 Oct 2021 17:03:24 +0000 (22:33 +0530)]
[AMDGPU] Fix width check for signed mul24 generation.

This changes fixes a case in which the highest set bit of the original
result is at bit 31 and sign-extending the mul24 for it would make the
result negative.

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

2 years ago[pstl] Initial implementation of OpenMP backend, on behalf of Christopher Nelson...
Mikhail Dvorskiy [Fri, 15 Oct 2021 12:36:07 +0000 (15:36 +0300)]
[pstl] Initial implementation of OpenMP backend, on behalf of Christopher Nelson nadiasvertex@gmail.com

Phabricator Review:
https://reviews.llvm.org/D99836

A couple of parallel patterns still remains serial - "Parallel partial sort", and "Parallel transform scan" - there are //TODOs in the code.

2 years ago[lldb] [test] Simplify X86 TestGDBServerTargetXML logic to match AArch64
Michał Górny [Fri, 15 Oct 2021 12:15:50 +0000 (14:15 +0200)]
[lldb] [test] Simplify X86 TestGDBServerTargetXML logic to match AArch64

2 years ago[lldb] [ABI/AArch64] Do not add subregs if some of them are present
Michał Górny [Fri, 15 Oct 2021 11:58:27 +0000 (13:58 +0200)]
[lldb] [ABI/AArch64] Do not add subregs if some of them are present

Fix a bug introduced while refactoring ABIAArch64::AugmentRegisterInfo()
that caused subregisters to be added even if they were already present.
Instead, abort immediately if at least one subregister is found
(following ABIX86).  While at it, add a test for that.

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

2 years agoAdds //mlir:GPUTransforms dependency to //llvm:MC as the former includes
Bogdan Graur [Fri, 15 Oct 2021 10:29:48 +0000 (12:29 +0200)]
Adds //mlir:GPUTransforms dependency to //llvm:MC as the former includes
headers from the latter.

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

2 years agoReland [clang] Check unsupported types in expressions
Andrew Savonichev [Wed, 10 Mar 2021 17:23:41 +0000 (20:23 +0300)]
Reland [clang] Check unsupported types in expressions

This was committed as ec6c847179fd, but then reverted after a failure
in: https://lab.llvm.org/buildbot/#/builders/84/builds/13983

I was not able to reproduce the problem, but I added an extra check
for a NULL QualType just in case.

Original comit message:

The patch adds missing diagnostics for cases like:

  float F3 = ((__float128)F1 * (__float128)F2) / 2.0f;

Sema::checkDeviceDecl (renamed to checkTypeSupport) is changed to work
with a type without the corresponding ValueDecl. It is also refactored
so that host diagnostics for unsupported types can be added here as
well.

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

2 years ago[lldb] [ABI/X86] Add pseudo-registers if missing
Michał Górny [Wed, 25 Aug 2021 19:59:27 +0000 (21:59 +0200)]
[lldb] [ABI/X86] Add pseudo-registers if missing

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

2 years ago[lldb] [DynamicRegisterInfo] Support value_regs with offset
Michał Górny [Sat, 9 Oct 2021 13:16:49 +0000 (15:16 +0200)]
[lldb] [DynamicRegisterInfo] Support value_regs with offset

Support specifying an offset for value_regs[0], and add the offset
to the computed derived register offset.  This makes it possible to
e.g. create the "ah" register on x86.

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

2 years ago[InstCombine] Support arbitrary const shift amount for `lshr (sext i1 ...)`
Anton Afanasyev [Sat, 9 Oct 2021 08:18:31 +0000 (11:18 +0300)]
[InstCombine] Support arbitrary const shift amount for `lshr (sext i1 ...)`

Add lshr (sext i1 X to iN), C --> select (X, -1 >> C, 0) case. This expands
C == N-1 case to arbitrary C.

Fixes PR52078.

Reviewed By: spatel, RKSimon, lebedev.ri

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

2 years ago[Test][InstCombine] Precommit tests for PR52078
Anton Afanasyev [Sat, 9 Oct 2021 08:16:25 +0000 (11:16 +0300)]
[Test][InstCombine] Precommit tests for PR52078

2 years ago[AArch64] Improve fptosi.sat vector lowering
David Green [Fri, 15 Oct 2021 10:37:53 +0000 (11:37 +0100)]
[AArch64] Improve fptosi.sat vector lowering

Similar to D111236, this improves the lowering of vector fptosi.sat and
fptoui.sat, using legal converts and further saturating from there with
min/max. f64 are excluded for the moment due to producing worse code in
places compared to the unrolling.

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

2 years ago[llvm-dwarfdump] Fix unsigned overflow when calculating stats
djtodoro [Fri, 15 Oct 2021 09:20:36 +0000 (11:20 +0200)]
[llvm-dwarfdump] Fix unsigned overflow when calculating stats

This fixes https://bugs.llvm.org/show_bug.cgi?id=51652.

The idea is to bump all the stat fields to 64-bit wide
unsigned integers. I've confirmed this resolves
the use case for chromium.

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

2 years ago[AArch64] Improve fptosi.sat lowering
David Green [Fri, 15 Oct 2021 10:12:23 +0000 (11:12 +0100)]
[AArch64] Improve fptosi.sat lowering

Improve the lowering of scalar fptosi.sat and fptoui.sat for saturating
widths smaller than legal types by using the fact that the legal type
will saturate under aarch64, and saturating the result further using
min/max.

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

2 years ago[libc++] Use apple-install-libcxx.sh in the Apple/system CI job
Louis Dionne [Fri, 15 Oct 2021 04:21:26 +0000 (00:21 -0400)]
[libc++] Use apple-install-libcxx.sh in the Apple/system CI job

That script is what we (need to) use to build libc++ for the system
configuration, so that's what we should test against. At some point
we may be able to fold all of that logic into the CMake build, and
when that happens the CI can go back to running CMake directly.

As a fly-by fix, stop mentioning x86_64 in the names of the Apple
jobs since they are not truly tied to any architecture.

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

2 years ago[ARM] Fix MOVCC peephole to not use an incorrect register class
John Brawn [Wed, 13 Oct 2021 12:59:42 +0000 (13:59 +0100)]
[ARM] Fix MOVCC peephole to not use an incorrect register class

The MOVCC peephole eliminates a MOVCC by making one of its inputs a
conditional instruction, but when doing this it should be using both
inputs of the MOVCC to decide on the register class to use as
otherwise we can get an error when using -verify-machineinstrs.

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

2 years ago[JSON] Handle uint64_t type
djtodoro [Mon, 13 Sep 2021 08:15:45 +0000 (10:15 +0200)]
[JSON] Handle uint64_t type

There was no handling of uint64_t in the LLVM JSON library.
This patch adds support for that. The motivation is
the https://reviews.llvm.org/D109217.

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

2 years ago[lldb] Fix an include in HostTest.cpp
Pavel Labath [Fri, 15 Oct 2021 09:03:18 +0000 (11:03 +0200)]
[lldb] Fix an include in HostTest.cpp

The previous include was too broad, and its better if the host tests do
not depend on non-host libraries.

2 years ago[git-clang-format] Add --diffstat parameter
Roland Fischer [Fri, 15 Oct 2021 08:56:20 +0000 (09:56 +0100)]
[git-clang-format] Add --diffstat parameter

[git-clang-format][PR46815] Add diffstat functionality

Adding a --diffstat parameter to git-clang-format that essentially uses git diff --stat, i.e. lists the files needing
formatting. This is useful for CI integration or manual usage where one wants to list the files not properly formatted.

I use it for the Suricata project's github action (CI) integration that verifies proper formatting of a pull request
according to project guidelines where it's very helpful to say which files are not properly formatted. I find the list
of files much more useful than e.g. showing the diff in this case using git-clang-format --diff.

An alternative would be to take an additional parameter to diff, e.g. git-clang-format --diff --stat

The goal is not to provide the whole git diff --stat=... parameter functionality, just plain git diff --stat.

Reviewed By: MyDeveloperDay, JakeMerdichAMD

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

2 years ago[clang-format] [PR42014,PR52021] don't let clang-format assert/crash when file being...
mydeveloperday [Fri, 15 Oct 2021 08:46:35 +0000 (09:46 +0100)]
[clang-format] [PR42014,PR52021] don't let clang-format assert/crash when file being formatted is read-only/locked

This is a bug which gets reported from time to time and we've had multiple attempts to fix it, but don't want to fix it by adding frontEnd to the mix.

This patch aim to find a trivial, but not that sophisticated way of emitting the error without the additional impact of adding libFrontEnd to clang-format.
See {D90121} for analysis of why we don't want those previous attempts

Reviewed By: HazardyKnusperkeks

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

2 years ago[AArch64ISelLowering] Avoid duplane in some cases when sve enabled
guopeilin [Fri, 15 Oct 2021 07:32:41 +0000 (15:32 +0800)]
[AArch64ISelLowering] Avoid duplane in some cases when sve enabled

Reviewed By: david-arm, sdesmalen

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

2 years agoFix another test not using the standard separator for sanitizer options.
Dan Liew [Fri, 15 Oct 2021 07:19:56 +0000 (00:19 -0700)]
Fix another test not using the standard separator for sanitizer options.

rdar://83637067

2 years ago[RISCV] Add invalid match case for uimm2, uimm3 and uimm7
Jim Lin [Fri, 15 Oct 2021 06:54:47 +0000 (14:54 +0800)]
[RISCV] Add invalid match case for uimm2, uimm3 and uimm7

Reviewed By: craig.topper, jrtc27

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

2 years ago[MLIR] Add `KeywordOrString` handling to AsmParser
Andrew Young [Tue, 12 Oct 2021 20:29:29 +0000 (13:29 -0700)]
[MLIR] Add `KeywordOrString` handling to AsmParser

This adds a new parser and printer for text which may be a keyword or a
string. When printing, it will attempt to print the text as a keyword,
but if it has any special or non-printable characters, it will be
printed as an escaped string.  When parsing, it will parse either a
valid keyword or a potentially escaped string. The printer allows for an
empty string, in which case it prints `""`.

This new function is used for printing the name in NamedAttributes, and
for printing the symbol name after the `@`. In CIRCT we are using this
to print module port names, which are conceptually similar to named
function arguments.

Reviewed By: rriddle

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

2 years agoUse Module's FileSpec for limiting binaries to set dyld breakpoint in
Jason Molenda [Fri, 15 Oct 2021 06:55:37 +0000 (23:55 -0700)]
Use Module's FileSpec for limiting binaries to set dyld breakpoint in

When DynamicLoaderMacOS::SetNotificationBreakpoint sets the breakpoint
for new binaries being loaded/unloaded, it limits the scope of that
breakpoint to just dyld, so we don't re-evaluate the breakpoint for
every new binary loaded.  I wrote this to get the module's ObjectFile
FileSpec in an earlier change, but this is not correct.  If lldb
is debugging a remote system, and it had to read dyld out of memory
from the remote system, it will have no FileSpec on the lldb debugger
host.  We need to grab the Module's FileSpec, which in this case is
actually falling back to the PlatformFileSpec, the binary path on the
target system.

rdar://84199646

2 years ago[NFC] fix a typo
Shao-Ce SUN [Fri, 15 Oct 2021 06:51:49 +0000 (14:51 +0800)]
[NFC] fix a typo

2 years ago[RISCV] Optimize immediate materialisation with SH*ADD
Ben Shi [Fri, 15 Oct 2021 06:44:28 +0000 (06:44 +0000)]
[RISCV] Optimize immediate materialisation with SH*ADD

Use SH1ADD/SH2ADD/SH3ADD along with LUI+ADDI to compose int32*3,
int32*5 and int32*9.

Reviewed By: craig.topper, luismarques

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

2 years ago[llvm] Use llvm::is_contained (NFC)
Kazu Hirata [Fri, 15 Oct 2021 05:44:08 +0000 (22:44 -0700)]
[llvm] Use llvm::is_contained (NFC)

2 years ago[SCEV] Prove implication of predicates to their sign-flipped counterparts
Max Kazantsev [Fri, 15 Oct 2021 04:01:28 +0000 (11:01 +0700)]
[SCEV] Prove implication of predicates to their sign-flipped counterparts

This patch teaches SCEV two implication rules:

  x <u y && y >=s 0 --> x <s y,
  x <s y && y <s 0 --> x <u y.

And all equivalents with signs/parts swapped.

Differential Revision: https://reviews.llvm.org/D110517
Reviewed By: nikic

2 years ago[PowerPC] Support ppc-asm-full-reg-names for AIX
Qiu Chaofan [Fri, 15 Oct 2021 04:22:44 +0000 (12:22 +0800)]
[PowerPC] Support ppc-asm-full-reg-names for AIX

Reviewed By: jsji

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

2 years ago[analyzer] Fix property access kind detection inside parentheses.
Artem Dergachev [Fri, 15 Oct 2021 03:32:54 +0000 (20:32 -0700)]
[analyzer] Fix property access kind detection inside parentheses.

'(self.prop)' produces a surprising AST where ParenExpr
resides inside `PseudoObjectExpr.

This breaks ObjCMethodCall::getMessageKind() which in turn causes us
to perform unnecessary dynamic dispatch bifurcation when evaluating
body-farmed property accessors, which in turn causes us
to explore infeasible paths.

2 years agoPR52183: Don't emit code for a void-typed constant expression.
Richard Smith [Fri, 15 Oct 2021 02:20:01 +0000 (19:20 -0700)]
PR52183: Don't emit code for a void-typed constant expression.

This is unnecessary in general, and wrong when the expression invokes a
consteval function.

2 years ago[SCEV][NFC] Reduce memory footprint & compile time via DFS refactoring
Max Kazantsev [Fri, 15 Oct 2021 03:19:15 +0000 (10:19 +0700)]
[SCEV][NFC] Reduce memory footprint & compile time via DFS refactoring

Current implementations of DFS in SCEV check unique-visited of traversed
values on pop, and not on push. As result, the same value may be pushed
multiple times just to be thrown away when popped. These operations are
meaningless and only waste time and increase memory footprint of the
worklist.

This patch reworks the DFS strategy to check uniqueness before push.
Should be NFC.

Differential Revision: https://reviews.llvm.org/D111774
Reviewed By: nikic, reames

2 years ago[MLIR][ODS] default-valued strings should be in quotes
Mogball [Fri, 15 Oct 2021 00:00:54 +0000 (00:00 +0000)]
[MLIR][ODS] default-valued strings should be in quotes

`DefaultValuedAttr<StrAttr, "">` and `ConstantAttr<StrAttr, "">`
result in bugs in which TableGen will not recognize that the attribute
has a default value, because `""` is an empty TableGen string.

Strings no longer have special treatment. Instead, string values must be
wrapped in quotes: "\"foo\"". Two helpers, `DefaultValuedStrAttr` and
`ConstantStrAttr` have been added to keep code clean.

Reviewed By: rriddle

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

2 years ago[mlir][linalg][bufferize] Handle scf::ForOp correctly in bufferizesToMemoryRead
Matthias Springer [Fri, 15 Oct 2021 02:17:23 +0000 (11:17 +0900)]
[mlir][linalg][bufferize] Handle scf::ForOp correctly in bufferizesToMemoryRead

From the perspective of analysis, scf::ForOp is treated as a black box. Basic block arguments do not alias with their respective OpOperands on the ForOp, so they do not participate in conflict analysis with ops defined outside of the loop.

However, bufferizesToMemoryRead and bufferizesToMemoryWrite on the scf::ForOp itself are used to determine how the scf::ForOp interacts with its surrounding ops.

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

2 years ago[mlir][linalg][bufferize] Rewrite conflict detection
Matthias Springer [Fri, 15 Oct 2021 01:19:14 +0000 (10:19 +0900)]
[mlir][linalg][bufferize] Rewrite conflict detection

For each memory read, follow SSA use-def chains to find the op that produces the data being read (i.e., the most recent write). A memory write to an alias is a conflict if it takes places after the "most recent write" but before the read.

This CL introduces two main changes:
* There is a concise definition of a conflict. Given a piece of IR with InPlaceSpec annotations and a computes alias set, it is easy to compute whether this program has a conflict. No need to consider multiple cases such as "read of operand after in-place write" etc.
* No need to check for clobbering.

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

2 years agoFix getInlineCost with ComputeFullInlineCost enabled
Artur Pilipenko [Wed, 13 Oct 2021 00:53:59 +0000 (17:53 -0700)]
Fix getInlineCost with ComputeFullInlineCost enabled

Fix a bug when getInlineCost incorrectly returns a
cost/threshold pair instead of an explicit never inline.

Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D111687

2 years ago[CSSPGO] Turn off PseudoProbeUpdatePass for non-FDO builds.
Hongtao Yu [Thu, 14 Oct 2021 18:37:44 +0000 (11:37 -0700)]
[CSSPGO] Turn off PseudoProbeUpdatePass for non-FDO builds.

PseudoProbeUpdatePass is used to distribute sample counts among dulplicated probes.  It doesn't make sense for it to run without a sample profile. The pass takes 1% of the build time.

Reviewed By: wenlei

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

2 years ago[NFC][asan] Speedup uar_signals.cpp test
Vitaly Buka [Fri, 15 Oct 2021 00:03:00 +0000 (17:03 -0700)]
[NFC][asan] Speedup uar_signals.cpp test

It was the slowest test:
--------------------------------------------------------------------------
41.77s: AddressSanitizer-x86_64-linux :: TestCases/Linux/uar_signals.cpp
26.64s: AddressSanitizer-i386-linux :: TestCases/Linux/uar_signals.cpp
14.82s: AddressSanitizer-x86_64-linux :: TestCases/Posix/current_allocated_bytes.cpp
14.79s: AddressSanitizer-i386-linux :: TestCases/Posix/current_allocated_bytes.cpp
11.55s: AddressSanitizer-x86_64-linux :: TestCases/scariness_score_test.cpp
10.15s: AddressSanitizer-x86_64-linux :: TestCases/Posix/stack-use-after-return.cpp

2 years ago[NFC][sanitizer] Remove %stdcxx11
Vitaly Buka [Thu, 14 Oct 2021 22:37:04 +0000 (15:37 -0700)]
[NFC][sanitizer] Remove %stdcxx11

-std=c++14 is a default for a while.

Reviewed By: kstoimenov

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

2 years ago[NFC][asan] Use more common socket type in test
Vitaly Buka [Thu, 14 Oct 2021 22:27:03 +0000 (15:27 -0700)]
[NFC][asan] Use more common socket type in test

2 years ago[libc] add memccpy and mempcpy
Michael Jones [Tue, 12 Oct 2021 23:05:56 +0000 (23:05 +0000)]
[libc] add memccpy and mempcpy

Add an implementation for memccpy and mempcpy. These functions are
posix extensions for the moment.

Reviewed By: lntue

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

2 years ago[flang] Admit NULL() in generic procedure resolution cases
peter klausler [Thu, 14 Oct 2021 17:32:59 +0000 (10:32 -0700)]
[flang] Admit NULL() in generic procedure resolution cases

Semantics is rejecting valid programs with NULL() actual arguments
to generic interfaces, including user-defined operators.  Subclause
16.9.144(para 6) makes clear that NULL() can be a valid actual
argument to a generic interface so long as it does not produce
ambiguity.  This patch handles those cases, revises existing
tests, and adjust an error message about NULL() operands to
appear less like a blanket prohibition.

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

2 years ago[mlir][ods] Enable emitting getter/setter prefix
Jacques Pienaar [Thu, 14 Oct 2021 22:58:44 +0000 (15:58 -0700)]
[mlir][ods] Enable emitting getter/setter prefix

Allow emitting get & set prefix for accessors generated for ops. If
enabled, then the argument/return/region name gets converted from
snake_case to UpperCamel and prefix added. The attribute also allows
generating both the current "raw" method along with the prefix'd one to
make it easier to stage changes.

The option is added on the dialect and currently defaults to existing
raw behavior. The expectation is that the staging where both are
generated would be short lived and so optimized to keeping the changes
local/less invasive (it just generates two functions for each accessor
with the same body - most of these internally again call a helper
function). But generation can be optimized if needed.

I'm unsure about OpAdaptor classes as there it is all get methods (it is
a named view into raw data structures), so prefix doesn't add much.

This starts with emitting raw-only form (as current behavior) as
default, then one can opt-in to raw & prefixed, then just prefixed. The
default in OpBase will switch to prefixed-only to be consistent with
MLIR style guide. And the option potentially removed later (considered
enabling specifying prefix but current discussion more pro keeping it
limited and stuck with that).

Also add more explicit checking for pruned functions to avoid emitting
where no function was added (and so avoiding dereferencing nullptr)
during op def/decl generation.

See https://bugs.llvm.org/show_bug.cgi?id=51916 for further discussion.

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

2 years ago[flang] Fold LGE/LGT/LLE/LLT intrinsic functions
peter klausler [Wed, 13 Oct 2021 21:42:21 +0000 (14:42 -0700)]
[flang] Fold LGE/LGT/LLE/LLT intrinsic functions

Fold the legacy intrinsic functions LGE, LGT, LLE, & LLT
by rewriting them into character relational expressions and
then folding those.  Also fix folding of comparisons of
character values of distinct lengths: the shorter value must
be padded with blanks.  (This fix exposed some bad test cases,
which are also fixed.)

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

2 years ago[NFC][Interpreter] Remove unused CompilerInvocation
Arthur Eubanks [Thu, 14 Oct 2021 22:10:32 +0000 (15:10 -0700)]
[NFC][Interpreter] Remove unused CompilerInvocation

2 years ago[scudo] Fix running tests under hwasan.
Evgenii Stepanov [Thu, 14 Oct 2021 21:56:29 +0000 (14:56 -0700)]
[scudo] Fix running tests under hwasan.

When built with hwasan, assume that the target architecture does not
support TBI. HWASan uses that byte for its own purpose, and changing it
breaks things.

Reviewed By: hctim

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

2 years ago[hwasan] Fix TestCases/thread-uaf.c.
Evgenii Stepanov [Thu, 14 Oct 2021 21:56:38 +0000 (14:56 -0700)]
[hwasan] Fix TestCases/thread-uaf.c.

On newer glibc, this test detects an extra match somewhere under
pthread_getattr_np. This results in Thread: lines getting spread out in
the report and failing to match the CHECKs.

Fix the CHECKs to allow this possibility.

Reviewed By: fmayer

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

2 years ago[hwasan] Add default "/" prefix.
Evgenii Stepanov [Thu, 14 Oct 2021 21:49:07 +0000 (14:49 -0700)]
[hwasan] Add default "/" prefix.

Add a default "/" prefix to the symbol search path in the
symbolization script. Without this, the binary itself is not considered
a valid source of symbol info.

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

2 years ago[OpenMP][host runtime] Add initial hybrid CPU support
Peyton, Jonathan L [Thu, 14 Oct 2021 21:41:38 +0000 (16:41 -0500)]
[OpenMP][host runtime] Add initial hybrid CPU support

Detect, through CPUID.1A, and show user different core types through
KMP_AFFINITY=verbose mechanism. Offer future runtime optimizations
 __kmp_is_hybrid_cpu() to know whether running on a hybrid system or not.

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

2 years ago[OpenMP][host runtime] small fixup of RTM CPUID bit check
Peyton, Jonathan L [Thu, 14 Oct 2021 21:37:52 +0000 (16:37 -0500)]
[OpenMP][host runtime] small fixup of RTM CPUID bit check

2 years agoRevert "Compress formatting of array type names (int [4] -> int[4])"
David Blaikie [Thu, 14 Oct 2021 21:48:17 +0000 (14:48 -0700)]
Revert "Compress formatting of array type names (int [4] -> int[4])"

Looks like lldb has some issues with this - somehow it causes lldb to
treat a "char[N]" type as an array of chars (prints them out
individually) but a "char [N]" is printed as a string. (even though the
DWARF doesn't have this string in it - it's something to do with the
string lldb generates for itself using clang)

This reverts commit 277623f4d5a672d707390e2c3eaf30a9eb4b075c.

2 years ago[flang] Expunge bogus semantic check for ELEMENTAL without dummies
peter klausler [Tue, 12 Oct 2021 23:20:35 +0000 (16:20 -0700)]
[flang] Expunge bogus semantic check for ELEMENTAL without dummies

Semantics refuses valid ELEMENTAL subprograms without dummy arguments,
but there's no such constraint in the standard; indeed, subclause
15.8.2 discusses the meaning of calls to ELEMENTAL functions with
arguments.  Remove the check and its test.

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

2 years agoDisable add_mlir_aggregate() debug file generation.
Stella Laurenzo [Thu, 14 Oct 2021 21:31:09 +0000 (14:31 -0700)]
Disable add_mlir_aggregate() debug file generation.

* Leaves it as a commented out area with a note on how to debug.

2 years ago[OpenMP][host runtime] Add support for teams affinity
Peyton, Jonathan L [Wed, 15 Sep 2021 17:52:14 +0000 (12:52 -0500)]
[OpenMP][host runtime] Add support for teams affinity

This patch implements teams affinity on the host.
The default is spread. A user can specify either spread, close, or
primary using KMP_TEAMS_PROC_BIND environment variable. Unlike
OMP_PROC_BIND, KMP_TEAMS_PROC_BIND is only a single value and is not a
list of values. The values follow the same semantics under the OpenMP
specification for parallel regions except T is the number of teams in
a league instead of the number of threads in a parallel region.

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

2 years ago[SLP]Fix PR52090: clang crashes: Assertion `Index < Length && "Invalid index!"' failed.
Alexey Bataev [Thu, 14 Oct 2021 13:40:06 +0000 (06:40 -0700)]
[SLP]Fix PR52090: clang crashes: Assertion `Index < Length && "Invalid index!"' failed.

Need to check that either Idx is UndefMaskElem and value is UndefValue
or Idx is valid and value is the same as the scalar value in the node.

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

2 years agoCompress formatting of array type names (int [4] -> int[4])
David Blaikie [Thu, 14 Oct 2021 21:07:51 +0000 (14:07 -0700)]
Compress formatting of array type names (int [4] -> int[4])

Based on post-commit review discussion on
2bd84938470bf2e337801faafb8a67710f46429d with Richard Smith.

Other uses of forcing HasEmptyPlaceHolder to false seem OK to me -
they're all around pointer/reference types where the pointer/reference
token will appear at the rightmost side of the left side of the type
name, so they make nested types (eg: the "int" in "int *") behave as
though there is a non-empty placeholder (because the "*" is essentially
the placeholder as far as the "int" is concerned).

2 years ago[bazel] Move MC header usage from Support to tblgen
Reid Kleckner [Thu, 14 Oct 2021 20:34:15 +0000 (13:34 -0700)]
[bazel] Move MC header usage from Support to tblgen

After the TargetRegistry.h move, nothing in Support includes headers
from MC. However, files in tablegen use MC headers, so we must add an
entry for them in tblgen srcs.

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

2 years ago[test] Fix asan dynamic unit tests with per-target runtime dirs
Collin Baker [Thu, 14 Oct 2021 20:47:25 +0000 (16:47 -0400)]
[test] Fix asan dynamic unit tests with per-target runtime dirs

When LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on
Asan-i386-calls-Dynamic-Test and Asan-i386-inline-Dynamic-Test fail to
run on a x86_64 host. This is because asan's unit test lit files are
configured once, rather than per target arch as with the non-unit
tests. LD_LIBRARY_PATH ends up incorrect, and the tests try linking
against the x86_64 runtime which fails.

This changes the unit test CMake machinery to configure the default
and dynamic unit tests once per target arch, similar to the other asan
tests. Then the fix from https://reviews.llvm.org/D108859 is adapted
to the unit test Lit files with some modifications.

Fixes PR52158.

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

2 years ago[clang] Support -clear-ast-before-backend without -disable-free
Arthur Eubanks [Wed, 13 Oct 2021 18:51:45 +0000 (11:51 -0700)]
[clang] Support -clear-ast-before-backend without -disable-free

Previously without -disable-free, -clear-ast-before-backend would crash in ~ASTContext() due to various reasons.
This works around that by doing a lot of the cleanup ahead of the destructor so that the destructor doesn't actually do any manual cleanup if we've already cleaned up beforehand.

This actually does save a measurable amount of memory with -clear-ast-before-backend, although at an almost unnoticeable runtime cost:
https://llvm-compile-time-tracker.com/compare.php?from=5d755b32f2775b9219f6d6e2feda5e1417dc993b&to=58ef1c7ad7e2ad45f9c97597905a8cf05a26258c&stat=max-rss

Previously we weren't doing any cleanup with -disable-free, so I tried measuring the impact of always doing the cleanup and didn't measure anything noticeable on llvm-compile-time-tracker.

Reviewed By: dblaikie

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

2 years ago[TableGen][PGO] Disable profile instrumentation for printInstruction function
Rong Xu [Thu, 14 Oct 2021 20:33:37 +0000 (13:33 -0700)]
[TableGen][PGO] Disable profile instrumentation for printInstruction function

We are seeing extremely long time in building AMDGPUInstPrinter.cpp
when profile instrumentation is enabled: It takes more than 5 minutes
(compared to ~8 seconds in non-instrument build).

This caused by the huge statements in printInstruction functions. In
profile instrumentation build, we need have extra control flow to
differentiate each case statement. This in turn adds significant
compile time in block placement and branch folding.

Function printInstruction is not likely to benefit from PGO build
as it's rarely executed in a typical compilation. So here I disable
the profile instrumentation for this function.

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

2 years ago[MLIR][arith] fix references to std.constant in comments
Mogball [Thu, 14 Oct 2021 16:55:33 +0000 (16:55 +0000)]
[MLIR][arith] fix references to std.constant in comments

Reviewed By: jpienaar

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

2 years ago[mlir][vector] Refactor linalg vectorization for reductions
thomasraoux [Thu, 14 Oct 2021 17:39:15 +0000 (10:39 -0700)]
[mlir][vector] Refactor linalg vectorization for reductions

Emit reduction during op vectorization instead of doing it when creating the
transfer write. This allow us to not broadcast output arguments for reduction
initial value.

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

2 years ago[tests] Add indvars tests showing missing transforms with small IVs
Philip Reames [Thu, 14 Oct 2021 20:26:59 +0000 (13:26 -0700)]
[tests] Add indvars tests showing missing transforms with small IVs

This shows the transform side of D109457, but also lets us try other approaches to the same problem.  The common trend to all is that we need to explicit reason about UB to disallow possibility of infinite loops.

2 years ago[AArch64] Add extra tests for fptosisat vector variants
David Green [Thu, 14 Oct 2021 20:26:24 +0000 (21:26 +0100)]
[AArch64] Add extra tests for fptosisat vector variants

2 years ago[X86][Costmodel] Improve cost modelling for not-fully-interleaved load
Roman Lebedev [Thu, 14 Oct 2021 20:07:59 +0000 (23:07 +0300)]
[X86][Costmodel] Improve cost modelling for not-fully-interleaved load

While i've modelled most of the relevant tuples for AVX2,
that only covered fully-interleaved groups.

By definition, interleaving load of stride N means:
load N*VF elements, and shuffle them into N VF-sized vectors,
with 0'th vector containing elements `[0, VF)*stride + 0`,
and 1'th vector containing elements `[0, VF)*stride + 1`.
Example: https://godbolt.org/z/df561Me5E (i64 stride 4 vf 2 => cost 6)

Now, not fully interleaved load, is when not all of these vectors is demanded.
So at worst, we could just pretend that everything is demanded,
and discard the non-demanded vectors. What this means is that the cost
for not-fully-interleaved group should be not greater than the cost
for the same fully-interleaved group, but perhaps somewhat less.
Examples:
https://godbolt.org/z/a78dK5Geq (i64 stride 4 (indices 012u) vf 2 => cost 4)
https://godbolt.org/z/G91ceo8dM (i64 stride 4 (indices 01uu) vf 2 => cost 2)
https://godbolt.org/z/5joYob9rx (i64 stride 4 (indices 0uuu) vf 2 => cost 1)

As we have established over the course of last ~70 patches, (wow)
`BaseT::getInterleavedMemoryOpCos()` is absolutely bogus,
it is usually almost an order of magnitude overestimation,
so i would claim that we should at least use the hardcoded costs
of fully interleaved load groups.

We could go further and adjust them e.g. by the number of demanded indices,
but then i'm somewhat fearful of underestimating the cost.

Reviewed By: RKSimon

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

2 years agoautogen tests for ease of update
Philip Reames [Thu, 14 Oct 2021 00:11:45 +0000 (17:11 -0700)]
autogen tests for ease of update

2 years ago[RISCV] Remove unused member variable. NFC
Craig Topper [Thu, 14 Oct 2021 19:56:42 +0000 (12:56 -0700)]
[RISCV] Remove unused member variable. NFC

2 years ago[IVUsers] Move preheader check into SCEVExpander
Nikita Popov [Tue, 12 Oct 2021 21:23:22 +0000 (23:23 +0200)]
[IVUsers] Move preheader check into SCEVExpander

Rather than checking for loop nest preheaders upfront in IVUsers,
move this requirement into isSafeToExpand() from SCEVExpander.

Historically, LSR did not check whether SCEVs are safe to expand
and fully relied on IVUsers to validate this. Later, support for
non-expandable SCEVs was added via rigid formulas.

Checking this in isSafeToExpand() makes it more obvious what
exactly this check is guarding against, and avoids the awkward
loop nest scan.

This is a followup to https://reviews.llvm.org/D111493#3055286.

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

2 years agoFix a crash on valid consteval code.
Aaron Ballman [Thu, 14 Oct 2021 19:46:22 +0000 (15:46 -0400)]
Fix a crash on valid consteval code.

Not all constants are emitted within the context of a function, so use
the module's ASTContext instead because 1) that's the same as the
current function ASTContext, and 2) the module can never be null.

Fixes PR50787.

2 years ago[lldb] Move ~Platform to source file
Raphael Isemann [Thu, 14 Oct 2021 19:36:10 +0000 (21:36 +0200)]
[lldb] Move ~Platform to source file

The called destructors of the members require the includes that are only
in the source file.

2 years ago[Driver][Darwin] Use T reference instead of getToolChain().getTriple().
Frederic Cambus [Thu, 14 Oct 2021 19:30:39 +0000 (21:30 +0200)]
[Driver][Darwin] Use T reference instead of getToolChain().getTriple().

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

2 years ago[X86] Use CMOVNS for abs instead of CMOVGE.
Craig Topper [Thu, 14 Oct 2021 18:23:42 +0000 (11:23 -0700)]
[X86] Use CMOVNS for abs instead of CMOVGE.

CMOVGE reads SF and OF. CMOVNS only reads SF. This matches with
other recent changes to use a single flag where possible. It also
matches gcc codegen.

I believe this technically changes whether the conditioanl move happens
on INT_MIN, but for INT_MIN both registers are the same so it doesn't
matter.

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

2 years ago[Polly] Remove support for code generated by gfortran+DragonEgg.
Michael Kruse [Thu, 14 Oct 2021 19:06:20 +0000 (14:06 -0500)]
[Polly] Remove support for code generated by gfortran+DragonEgg.

DragonEgg is not maintained anymore, hence there is no need for this
functionality.

Fixes llvm.org/PR52173

2 years ago[Polly][docs] Fix itemize list for release notes.
Michael Kruse [Thu, 14 Oct 2021 18:47:12 +0000 (13:47 -0500)]
[Polly][docs] Fix itemize list for release notes.

Make the changes top-level items, instead of subitems of the
"Changes..." placeholder.