platform/upstream/llvm.git
3 years ago[Polly] Add TargetTransformInfo to ScopPass standard analysis results.
Michael Kruse [Wed, 10 Feb 2021 04:30:42 +0000 (22:30 -0600)]
[Polly] Add TargetTransformInfo to ScopPass standard analysis results.

TargetTransformInfo is required by IslScheduleOptimizer, as ScopPass.
Unfortunately it is not possible to get arbitrary larger-unit analyses
in for as ScopPass. Loop passes also already use TargetTransformInfo as
LoopStandardAnalysisResults, hence wei might expect it to be available
to Scop passes as well.

3 years ago[Polly] Register pass-instrumentation for NewPM's Scop level.
Michael Kruse [Wed, 10 Feb 2021 03:57:13 +0000 (21:57 -0600)]
[Polly] Register pass-instrumentation for NewPM's Scop level.

The pass-instrumentation pass is implicitly execute by the NewPM
whenever a new analysis runs. Not registering it will cause the crash
whenever a scop pass requests an analysis.

For instance this is the case for the IstAstAnalysis requesting the
DependenceAnalsis result.

3 years ago[Polly] Port PruneUnprofitable to the NewPM.
Michael Kruse [Wed, 10 Feb 2021 03:53:14 +0000 (21:53 -0600)]
[Polly] Port PruneUnprofitable to the NewPM.

3 years ago[Polly] Port DeLICM to the NewPM.
Michael Kruse [Wed, 10 Feb 2021 03:32:29 +0000 (21:32 -0600)]
[Polly] Port DeLICM to the NewPM.

3 years ago[Polly] Port ForwardOpTree to the NewPM.
Michael Kruse [Wed, 10 Feb 2021 03:19:47 +0000 (21:19 -0600)]
[Polly] Port ForwardOpTree to the NewPM.

3 years agoFix deprecated usage of `mallinfo`
Ta-Wei Tu [Wed, 10 Feb 2021 05:52:50 +0000 (13:52 +0800)]
Fix deprecated usage of `mallinfo`

glibc deprecates `mallinfo` in the latest version of 2.33. This patch replaces the usage of `mallinfo` with the new `mallinfo2` when it's available.

Reviewed By: lattner

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

3 years ago[Test] Two more tests on usub
Max Kazantsev [Wed, 10 Feb 2021 05:28:08 +0000 (12:28 +0700)]
[Test] Two more tests on usub

They are analogous to the existing tests, but use different starting offset
which can be important for some transforms.

3 years ago[clang][driver] Only warn once about invalid library values
Timm Bäder [Tue, 2 Feb 2021 17:25:36 +0000 (18:25 +0100)]
[clang][driver] Only warn once about invalid library values

Since ToolChain::GetCXXStdlibType() is a simple getter that might emit
the "invalid library name in argument" warning, it can conceivably be
called several times while initializing the build pipeline.

Before this patch, a simple 'clang++ -stdlib=foo ./test.cpp' would print
the warning twice, -rt=lib=foo would print 6 times.

Change this and always only print the warning once. Keep the rest of the
semantics of the functions.

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

3 years ago[MLIR] NFC Fix vector transforms build warnings
Uday Bondhugula [Wed, 10 Feb 2021 05:12:20 +0000 (10:42 +0530)]
[MLIR] NFC Fix vector transforms build warnings

Fix build warnings from VectorTransforms.cpp.

3 years ago[MLIR] Update affine.for unroll utility for iter_args support
Uday Bondhugula [Tue, 9 Feb 2021 12:36:12 +0000 (18:06 +0530)]
[MLIR] Update affine.for unroll utility for iter_args support

Update affine.for loop unroll utility for iteration arguments support.
Fix promoteIfSingleIteration as well.

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

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

3 years ago[libcxx] adds concept `std::convertible_to`
Christopher Di Bella [Thu, 4 Feb 2021 03:19:26 +0000 (03:19 +0000)]
[libcxx] adds concept `std::convertible_to`

Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

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

3 years ago[clang][cli] Fix gcc "enumeral and non-enumeral type in conditional expression" warni...
Yang Fan [Wed, 10 Feb 2021 03:15:39 +0000 (11:15 +0800)]
[clang][cli] Fix gcc "enumeral and non-enumeral type in conditional expression" warning (NFC)

3 years agoFix JSON formatting when converting to trace event format
Todd Lipcon [Wed, 10 Feb 2021 01:59:31 +0000 (12:59 +1100)]
Fix JSON formatting when converting to trace event format

Reviewed By: dberris

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

3 years agoFix xray fdr mode to allow multiple flushes
Todd Lipcon [Wed, 10 Feb 2021 01:54:00 +0000 (12:54 +1100)]
Fix xray fdr mode to allow multiple flushes

Reviewed By: dberris

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

3 years agoUse internal_dict everywhere we refer to the python session dict in docs.
Jim Ingham [Wed, 10 Feb 2021 01:48:04 +0000 (17:48 -0800)]
Use internal_dict everywhere we refer to the python session dict in docs.

3 years agoAdd LLVMIR Dialect counterparts of @llvm.maximum and @llvm.minimum.
Andrew Pritchard [Wed, 10 Feb 2021 00:57:40 +0000 (00:57 +0000)]
Add LLVMIR Dialect counterparts of @llvm.maximum and @llvm.minimum.

These are similar to maxnum and minnum, but they're defined to treat -0
as less than +0.  This behavior can't be expressed using float
comparisons and selects, since comparisons are defined to treat
different-signed zeros as equal.  So, the only way to communicate this
behavior into LLVM IR without defining target-specific intrinsics is to
add the corresponding ops.

Reviewed By: mehdi_amini

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

3 years agoFix side-effect detection in LLVMIRIntrinsicGen.
Andrew Pritchard [Wed, 10 Feb 2021 00:48:08 +0000 (00:48 +0000)]
Fix side-effect detection in LLVMIRIntrinsicGen.

Previously it reported an op had side-effects iff it declared that it
didn't have any side-effects.  This had the undesirable result that
canonicalization would always delete any intrinsic calls that did memory
stores and returned void.

Reviewed By: ftynse, mehdi_amini

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

3 years agoRevert "[InstCombine] convert assumes to operand bundles"
Tyker [Wed, 10 Feb 2021 00:32:00 +0000 (01:32 +0100)]
Revert "[InstCombine] convert assumes to operand bundles"

This reverts commit 5eb2e994f9b3a5aff0a156d0a1f7e6121342cc11.

3 years ago[Polly] Remove use of -O3 in regression test.
Michael Kruse [Wed, 10 Feb 2021 00:05:43 +0000 (18:05 -0600)]
[Polly] Remove use of -O3 in regression test.

In addition to that regression tests should not test the intire pass
pipeline (unless they are testing the pipeline itself), the Polly-ACC
currently does not support the new pass manager. If enabled by default,
such tests will therefore fail.

Use the -polly-gpu-runtime and -polly-gpu-arch options also as default
values for the PPCGCodeGeneration pass. This requires to move the option
to be moved from the pipeline-building Register passes to the
PPCGCodeGeneration implementation.

Fixes the spir-typesize.ll buildbot fail.

3 years ago[LLDB] Remove uneeded CopyType from BlockPointerSyntheticFrontEnd
Shafik Yaghmour [Wed, 10 Feb 2021 00:09:32 +0000 (16:09 -0800)]
[LLDB] Remove uneeded CopyType from BlockPointerSyntheticFrontEnd

BlockPointerSyntheticFrontEnd does a CopyType which results in it copying the type
back into its own context. This will result in a call to ASTImporterDelegate::setOrigin
with &decl->getASTContext() == origin.ctx this can result in an infinite recursion
later on in ASTImporter since it will attempt to find the decl in its origin which will be itself.

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

3 years agoRemove trailing spaces after \ in comments.
Jim Ingham [Wed, 10 Feb 2021 00:06:47 +0000 (16:06 -0800)]
Remove trailing spaces after \ in comments.

3 years agoAdd documentation for the extra_args parameter to breakpoint commands.
Jim Ingham [Tue, 9 Feb 2021 23:32:45 +0000 (15:32 -0800)]
Add documentation for the extra_args parameter to breakpoint commands.

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

3 years agoAdd NoSideEffect trait to shape.split_at and shape.concat
Jing Pu [Tue, 9 Feb 2021 23:19:13 +0000 (15:19 -0800)]
Add NoSideEffect trait to shape.split_at and shape.concat

Reviewed By: jpienaar, silvas

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

3 years ago[flang][fir] Updates to internal name uniquer.
Eric Schweitz [Tue, 9 Feb 2021 17:50:08 +0000 (09:50 -0800)]
[flang][fir] Updates to internal name uniquer.

https://github.com/flang-compiler/f18-llvm-project/pull/474

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

3 years ago[lld][WebAssembly] Fix segfault in map file support
Thomas Lively [Tue, 9 Feb 2021 22:42:43 +0000 (14:42 -0800)]
[lld][WebAssembly] Fix segfault in map file support

The code previously assumed that `getChunk` would return a non-null pointer for
every symbol, but in fact it only returns non-null pointers for DefinedFunction
and DefinedData symbols. This patch fixes the segfault by checking whether
`getChunk` returns a null for each symbol and skipping the mapping output for
any symbols for which it does.

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

3 years ago[mlir][OpFormatGen] Refactor `type_ref` into a more general `ref` directive
River Riddle [Tue, 9 Feb 2021 22:32:15 +0000 (14:32 -0800)]
[mlir][OpFormatGen] Refactor `type_ref` into a more general `ref` directive

This allows for referencing nearly every component of an operation from within a custom directive.

It also fixes a bug with the current type_ref implementation, PR48478

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

3 years ago[mlir] Add initial support for an alias analysis framework in MLIR
River Riddle [Tue, 9 Feb 2021 22:11:00 +0000 (14:11 -0800)]
[mlir] Add initial support for an alias analysis framework in MLIR

This revision adds a new `AliasAnalysis` class that represents the main alias analysis interface in MLIR. The purpose of this class is not to hold the aliasing logic itself, but to provide an interface into various different alias analysis implementations. As it evolves this should allow for users to plug in specialized alias analysis implementations for their own needs, and have them immediately usable by other analyses and transformations.

This revision also adds an initial simple generic alias, LocalAliasAnalysis, that provides support for performing stateless local alias queries between values. This class is similar in scope to LLVM's BasicAA.

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

3 years ago[llvm-objdump][test] Fix --prefix tests for system-windows
Vinicius Tinti [Tue, 9 Feb 2021 20:06:34 +0000 (20:06 +0000)]
[llvm-objdump][test] Fix --prefix tests for system-windows

Merging directories and files may produce different results on different
platforms.

Merging "./Inputs" and "source-interleave-x86_64.c" will use different
separators in POSIX and Windows.

Dedicated tests are needed for dealing with removing trailing separators
for POSIX (consider only '/') and Windows (consider '/' and '\').

Fixes D85024.
Fixes PR46368.

Reviewed By: jhenderson, MaskRay

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

3 years ago[VPlan] Use VPUser to manage CondBit
Florian Hahn [Tue, 9 Feb 2021 17:56:05 +0000 (17:56 +0000)]
[VPlan] Use VPUser to manage CondBit

VP blocks keep track of a condition, which is a VPValue. This patch
updates VPBlockBase to manage the value using VPUser, so
replaceAllUsesWith properly updates the condition bit as well.

This is required to enable VP2VP transformations and it helps with
simplifying some of the code required to manage condition bits.

Reviewed By: gilr

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

3 years ago[AArch64][GlobalISel] Allow vector load legalization into 128-bit-wide types
Jessica Paquette [Mon, 8 Feb 2021 20:27:13 +0000 (12:27 -0800)]
[AArch64][GlobalISel] Allow vector load legalization into 128-bit-wide types

Similar to 3d25fdc5c21f174d38ac78dd01ccaf6eec655bc0

This fixes bad codegen in cases like so:

https://godbolt.org/z/hePhz1

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

3 years ago[AIX][llvm][support] Implement getHostCPUName
David Tenty [Tue, 9 Feb 2021 20:56:47 +0000 (15:56 -0500)]
[AIX][llvm][support] Implement getHostCPUName

We implement getHostCPUName() for AIX via systemcfg interfaces since access to the processor version register is a privileged operation. We return a value based on the  current processor implementation mode.

This fixes the cpu detection used by clang for `-mcpu=native`.

Reviewed By: hubert.reinterpretcast

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

3 years agoPR48545: Access check the inherited constructor, not the inheriting
Richard Smith [Tue, 9 Feb 2021 21:25:52 +0000 (13:25 -0800)]
PR48545: Access check the inherited constructor, not the inheriting
constructor.

We got this wrong only when forming a CXXTemporaryObjectExpr, which
caused the bug to only appear for certain syntactic forms.

3 years ago[MLIR] Add context accessor to identifier
George [Tue, 9 Feb 2021 20:59:52 +0000 (12:59 -0800)]
[MLIR] Add context accessor to identifier

I knew I would miss one...

Reviewed By: stellaraccident

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

3 years ago[lld][WebAssembly] Allow --export of optional start/stop symbols
Sam Clegg [Tue, 9 Feb 2021 01:16:15 +0000 (17:16 -0800)]
[lld][WebAssembly] Allow --export of optional start/stop symbols

This moves the error checking until after all optional
symbols (including the section start/end symbols) have
been created.

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

3 years ago[libc++] [LWG2993] reference_wrapper<T> conversion from U&&
Arthur O'Dwyer [Sun, 6 Dec 2020 00:37:41 +0000 (19:37 -0500)]
[libc++] [LWG2993] reference_wrapper<T> conversion from U&&

Implement the resolution of LWG2993. Replace a deleted constructor
with a constructor that SFINAEs away in appropriate circumstances.
Also, now that the constructor is templated, we must have an
explicit deduction guide to make CTAD work.

Some tests have been merged in from Agustín Bergé's D40259.

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

3 years ago[lldb] [Process/FreeBSDRemote] Introduce powerpc support
Michał Górny [Tue, 2 Feb 2021 17:29:06 +0000 (18:29 +0100)]
[lldb] [Process/FreeBSDRemote] Introduce powerpc support

Introduce a minimal support for the 32-bit powerpc platform.  This
includes support for GPR and FPR registers.  I also needed to add
software breakpoint opcode for PPC32/PPC64 (big endian), and to fix
offsets in RegisterInfos_powerpc.h (used only by FreeBSD register
context to be globally unique rather than relative to each struct).

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

3 years ago[mlir][IR] Remove the concept of `OperationProperties`
River Riddle [Tue, 9 Feb 2021 19:41:10 +0000 (11:41 -0800)]
[mlir][IR] Remove the concept of `OperationProperties`

These properties were useful for a few things before traits had a better integration story, but don't really carry their weight well these days. Most of these properties are already checked via traits in most of the code. It is better to align the system around traits, and improve the performance/cost of traits in general.

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

3 years ago[libc++] Add `noexcept` to `string::find` and similar members.
zoecarver [Fri, 5 Feb 2021 19:54:47 +0000 (11:54 -0800)]
[libc++] Add `noexcept` to `string::find` and similar members.

Adds `noexcept` to `string_view`/`string::find` and similar members
(`rfind`, etc.). See discussion in D95251. Refs D95821.

Reviewed By: curdeius, ldionne

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

3 years ago[clangd] Expose more dependent-name detail via semanticTokens
Sam McCall [Sat, 30 Jan 2021 00:12:36 +0000 (01:12 +0100)]
[clangd] Expose more dependent-name detail via semanticTokens

This change makes dependentName a modifier, rather than a token type.
It can be combined with:
- type (new, standard) - this combination replaces dependentType like T::typename Foo
- unknown (new, nonstandard) - for general dependent names
- Field, etc - when the name is dependent but we heuristically resolve it

While here, fix cases where template-template-parameter cases were
incorrectly flagged as type-dependent.
And the merging of modifiers when resolving conflicts accidentally
happens to work around a bug that showed up in a test.

The behavior observed through the pre-standard protocol should be mostly
unchanged (it'll see the bugfixes only). This is done in a somehat
fragile way but it's not expected to live long.

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

3 years ago[mlir][spirv] Add support for sampled image type
Weiwei Li [Tue, 9 Feb 2021 18:47:12 +0000 (13:47 -0500)]
[mlir][spirv] Add support for sampled image type

co-authored-by: Alan Liu <alanliu.yf@gmail.com>

Reviewed By: antiagainst

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

3 years ago[WebAssembly] Use data sections by default
Sam Clegg [Mon, 8 Feb 2021 04:22:07 +0000 (20:22 -0800)]
[WebAssembly] Use data sections by default

This allows data sections that don't start with `.data` to be
used/created.

Without this, clang's `__attribute__((section("foo")))` would
generate assembly that would not parse.

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

3 years ago[Attributor][FIX] Do not create UB by introducing a `noundef undef`
Johannes Doerfert [Tue, 9 Feb 2021 04:09:32 +0000 (22:09 -0600)]
[Attributor][FIX] Do not create UB by introducing a `noundef undef`

This was reported as PR49104. The reproducer uses varargs but the issue
is the same, we know an argument is dead but can't change the signature
for some reason. The PR49104 situation was: We are in an CG-SCC
traversal and we remove all the uses of an argument and proof it thereby
dead. However, if we do not remove the argument, via signature rewrite,
we need to ensure that the `undef` we introduce at the call site doesn't
clash with a `noundef` attribute.

3 years ago[CUDA, NVPTX] Allow targeting sm_86 GPUs.
Artem Belevich [Wed, 3 Feb 2021 21:26:00 +0000 (13:26 -0800)]
[CUDA, NVPTX] Allow targeting sm_86 GPUs.

The patch only plumbs through the option necessary for targeting sm_86 GPUs w/o
adding any new functionality.

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

3 years agoRevert "[libc++] Require C++20 to build the benchmarks."
Mark de Wever [Tue, 9 Feb 2021 18:59:34 +0000 (19:59 +0100)]
Revert "[libc++] Require C++20 to build the benchmarks."

There are build bots without C++20 support building the benchmarks.

This reverts commit 34acc91642440b8e4bad17acfdbb1314c8f2043e.

3 years agoAMDGPU: Fix verifier error with argument passed in CSR SGPR
Matt Arsenault [Thu, 4 Feb 2021 22:12:46 +0000 (17:12 -0500)]
AMDGPU: Fix verifier error with argument passed in CSR SGPR

We need to avoid setting the kill flag on the CSR spill if there's an
additional use of the register after the spill.

This does rely on consistency between the entry block liveins and the
MRI's function live ins, which is not something the verifier checks
now.

3 years agoGlobalISel: Fix using wrong calling convention for callees
Matt Arsenault [Mon, 8 Feb 2021 22:15:29 +0000 (17:15 -0500)]
GlobalISel: Fix using wrong calling convention for callees

This was taking the calling convention from the parent function,
instead of the callee. Avoids regressions in a future patch when the
caller and callee have different type breakdowns.

For some reason AArch64's lowerFormalArguments seems to intentionally
ignore the parent isVarArg.

3 years ago[RISCV] Make the min and max vector width command line options more consistent and...
Craig Topper [Tue, 9 Feb 2021 18:47:19 +0000 (10:47 -0800)]
[RISCV] Make the min and max vector width command line options more consistent and check their relationship to each other.

3 years ago[InstCombine] convert assumes to operand bundles
Tyker [Tue, 9 Feb 2021 18:20:50 +0000 (19:20 +0100)]
[InstCombine] convert assumes to operand bundles

Instcombine will convert the nonnull and alignment assumption that use the boolean condtion
to an assumption that uses the operand bundles when knowledge retention is enabled.

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

3 years ago[mlir][Linalg] Add a build method for linalg.pad_tensor
Hanhan Wang [Tue, 9 Feb 2021 18:19:06 +0000 (10:19 -0800)]
[mlir][Linalg] Add a build method for linalg.pad_tensor

Add a build method that pads the source with a scalar value.

Reviewed By: nicolasvasilache, antiagainst

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

3 years agoRevert "[mlir] add support for verification in integration tests"
Tobias Gysi [Tue, 9 Feb 2021 18:09:40 +0000 (19:09 +0100)]
Revert "[mlir] add support for verification in integration tests"

This reverts commit 5fa893c.
Windows build bot fails due to missing header
https://reviews.llvm.org/D96326

3 years ago[IROutliner] Adding instruction strings to IRSimilarityPrinting diagnostics.
Andrew Litteken [Thu, 31 Dec 2020 20:37:33 +0000 (14:37 -0600)]
[IROutliner] Adding instruction strings to IRSimilarityPrinting diagnostics.

When doing some recent debugging of the IROutliner, and using the similarity pass for debugging, just having the basic block and function isn't really enough to get all the information. This adds the first and last instruction to the output of the IRSimilarityPrinting pass to give better information to a user.

Reviewer: paquette

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

3 years ago[ValueTracking] improve analysis for "C << X" and "C >> X"
Sanjay Patel [Tue, 9 Feb 2021 17:36:17 +0000 (12:36 -0500)]
[ValueTracking] improve analysis for "C << X" and "C >> X"

This is based on the example/comments in:
https://llvm.org/PR48984

I tried just lifting the restriction in computeKnownBitsFromShiftOperator()
as suggested in the bug report, but that doesn't catch all of the cases
shown here. I didn't step through to see exactly why that happened. But it
seems like a reasonable compromise to cheaply check the special-case of
shifting a constant.

There's a slight regression on a cmp transform as noted, but this is likely
the more important/common pattern, so we can fix that icmp pattern later if
needed.

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

3 years ago[RISCV] Remove SRO* and SLO* instructions from bitmanip.
Craig Topper [Tue, 9 Feb 2021 17:28:06 +0000 (09:28 -0800)]
[RISCV] Remove SRO* and SLO* instructions from bitmanip.

As of the current draft these are no longer being considered
for the bitmanip spec. It wasn't clear what sub extension they
belonged in in the 0.93 spec.

So remove them. They can always be added back if something changes.

Reviewed By: frasercrmck

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

3 years ago[libc++] Require C++20 to build the benchmarks.
Mark de Wever [Thu, 4 Feb 2021 17:35:26 +0000 (18:35 +0100)]
[libc++] Require C++20 to build the benchmarks.

Some work-in-progress patches for the format header contain benchmarks.
The format header requires C++20 to build. This is a preparation to make
it easy to add these benchmarks.

Reviewed By: ldionne, #libc

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

3 years ago[libc++] Remove C++11 work-arounds in src.
Mark de Wever [Sat, 6 Feb 2021 12:53:37 +0000 (13:53 +0100)]
[libc++] Remove C++11 work-arounds in src.

Building libcxx requires at least C++17 so remove the old work-arounds.

Reviewed By: ldionne, #libc

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

3 years ago[dfsan] Refactor loadShadow
Jianzhou Zhao [Fri, 5 Feb 2021 22:16:23 +0000 (22:16 +0000)]
[dfsan] Refactor loadShadow

To simplify the review of https://reviews.llvm.org/D95835.

Reviewed-by: gbalats, morehouse
Differential Revision: https://reviews.llvm.org/D96180

3 years ago[MLIR] Replace dialect registration hooks with dialect handle
George [Tue, 9 Feb 2021 17:00:22 +0000 (09:00 -0800)]
[MLIR] Replace dialect registration hooks with dialect handle

Replace MlirDialectRegistrationHooks with MlirDialectHandle, which under-the-hood is an opaque pointer to MlirDialectRegistrationHooks. Then we expose the functionality previously directly on MlirDialectRegistrationHooks, as functions which take the opaque MlirDialectHandle struct. This makes the actual structure of the registration hooks an implementation detail, and happens to avoid this issue: https://llvm.discourse.group/t/strange-swift-issues-with-dialect-registration-hooks/2759/3

Reviewed By: stellaraccident

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

3 years ago[llvm-readobj] Add support for decoding FreeBSD ELF notes
Alex Richardson [Tue, 9 Feb 2021 16:46:29 +0000 (16:46 +0000)]
[llvm-readobj] Add support for decoding FreeBSD ELF notes

The current support only printed coredump notes, but most binaries also
contain notes. This change adds names for four FreeBSD-specific notes and
pretty-prints three of them:

NT_FREEBSD_ABI_TAG:
This note holds a 32-bit (decimal) integer containing the value of the
__FreeBSD_version macro, which is defined in crt1.o and will hold a value
such as 1300076 for a binary build on a FreeBSD 13 system.

NT_FREEBSD_ARCH_TAG:
A string containing the value of the build-time MACHINE_ARCH

NT_FREEBSD_FEATURE_CTL: A 32-bit flag that indicates to the kernel that
the binary wants certain bevahiour. Examples include setting
NT_FREEBSD_FCTL_ASLR_DISABLE which tells the kernel to disable ASLR.

After this change llvm-readobj also no longer decodes coredump-only
FreeBSD notes in non-coredump files. I've also converted the
note-freebsd.s test to use yaml2obj instead of llvm-mc.

Reviewed By: jhenderson

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

3 years ago[llvm-readelf] Print raw ELF note contents if we can't parse it
Alex Richardson [Tue, 9 Feb 2021 16:21:25 +0000 (16:21 +0000)]
[llvm-readelf] Print raw ELF note contents if we can't parse it

Currently, if the note name is known, but the value isn't we don't print
the contents.

Reviewed By: jhenderson

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

3 years ago[yaml2obj] Handle NT_* string values in for ELF note types
Alex Richardson [Tue, 9 Feb 2021 16:23:46 +0000 (16:23 +0000)]
[yaml2obj] Handle NT_* string values in for ELF note types

This is required for D74393.

Reviewed By: jhenderson

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

3 years ago[llvm-readobj] Print empty line between note sections in GNU mode
Alex Richardson [Tue, 9 Feb 2021 16:19:55 +0000 (16:19 +0000)]
[llvm-readobj] Print empty line between note sections in GNU mode

This matches GNU binutils.

Reviewed By: rupprecht, jhenderson, MaskRay

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

3 years ago[clangd] Add semanticTokens modifiers for function/class/file/global scope
Sam McCall [Fri, 29 Jan 2021 22:18:34 +0000 (23:18 +0100)]
[clangd] Add semanticTokens modifiers for function/class/file/global scope

These allow (function-) local variables to be distinguished, but also a
bunch more cases.
It's not quite independent with existing information (e.g. the
field/variable distinction is redundant if you have class-scope + static
attributes) but I don't think this is terribly important.

Depends on D77811

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

3 years ago[flang][fir] Add shape, shape_shift, and slice types.
Eric Schweitz [Fri, 5 Feb 2021 20:40:39 +0000 (12:40 -0800)]
[flang][fir] Add shape, shape_shift, and slice types.

Adding the FIR types used to describe the Fortran semantics of indexing
FIR arrays.

https://github.com/flang-compiler/f18-llvm-project/pull/267

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

3 years ago[mlir] add support for verification in integration tests
Tobias Gysi [Tue, 9 Feb 2021 16:43:11 +0000 (17:43 +0100)]
[mlir] add support for verification in integration tests

The patch extends the runner utils by verification methods that compare two memrefs. The methods compare the content of the two memrefs and print success if the data is identical up to a small numerical error. The methods are meant to simplify the development of integration tests that for example compare optimized and unoptimized code paths (cf. the updates to the linalg matmul integration tests).

Reviewed By: nicolasvasilache

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

3 years ago[libomptarget][amdgcn] Tolerate deadstripped device_state variable
Jon Chesterfield [Tue, 9 Feb 2021 16:29:52 +0000 (16:29 +0000)]
[libomptarget][amdgcn] Tolerate deadstripped device_state variable

[libomptarget][amdgcn] Tolerate deadstripped device_state variable

The device_state variable may have been deadstripped. Similar to
device_environment, leave detection of missing but used symbol to loader.

Reviewed By: pdhaliwal

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

3 years agoRevert "[ObjC][ARC] Use operand bundle 'clang.arc.rv' instead of explicitly"
Nico Weber [Tue, 9 Feb 2021 16:00:50 +0000 (11:00 -0500)]
Revert "[ObjC][ARC] Use operand bundle 'clang.arc.rv' instead of explicitly"

This reverts commit 4a64d8fe392449b205e59031aad5424968cf7446.
Makes clang crash when buildling trivial iOS programs, see comment
after https://reviews.llvm.org/D92808#2551401

3 years ago[lldb] Inline invariant params to AppleThreadPlanStepThrough (NFC)
Dave Lee [Mon, 8 Feb 2021 04:19:07 +0000 (20:19 -0800)]
[lldb] Inline invariant params to AppleThreadPlanStepThrough (NFC)

These two `AppleThreadPlanStepThrough` thread plans have parameterized behavior
that is unutilized. To make their interface and implementation simpler, this
change inlines those outside parameters.

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

3 years ago[clang][cli] Generate and round-trip Frontend options
Jan Svoboda [Tue, 9 Feb 2021 15:30:14 +0000 (16:30 +0100)]
[clang][cli] Generate and round-trip Frontend options

This patch implements generation of remaining frontend options and tests it by performing parse-generate-parse round trip.

Depends on D96269.

Reviewed By: dexonsmith

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

3 years ago[clangd] Implement semanticTokens modifiers
Sam McCall [Wed, 27 Jan 2021 08:47:17 +0000 (09:47 +0100)]
[clangd] Implement semanticTokens modifiers

- Infrastructure to support modifiers (protocol etc)
- standard modifiers:
  - declaration (but no definition, yet)
  - deprecated
  - readonly (based on a fairly fuzzy const checking)
  - static (for class members and locals, but *not* file-scope things!)
  - abstract (for C++ classes, and pure-virtual methods)
- nonstandard modifier:
  - deduced (on "auto" whose Kind is Class etc)
    Happy to drop this if it's controversial at all.
- While here, update sample tweak to use our internal names, in
  anticipation of theia TM scopes going away.

This addresses some of the goals of D77702, but leaves some things undone.
Mostly because I think these will want some discussion.
 - no split between dependent type/name.
   (We may want to model this as a modifier, type+dependent vs ???+dependent)
 - no split between primitive/typedef.
   (Is introducing a nonstandard kind is worth this distinction?)
 - no nonstandard local attribute
   This probably makes sense, I'm wondering if we want others and how
   they fit together.

There's one minor regression in explicit template specialization declarations
due to a latent bug in findExplicitReferences, but fixing it after seems OK.

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

3 years ago[OpenCL] Fix types with signed prefix in arginfo metadata.
Anastasia Stulova [Tue, 9 Feb 2021 15:08:46 +0000 (15:08 +0000)]
[OpenCL] Fix types with signed prefix in arginfo metadata.

Signed prefix is removed and the single word spelling is
printed for the scalar types.

Tags: #clang

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

3 years ago[mlir][linalg] Fix depthwise conv C++ symbol to be consistent
Lei Zhang [Tue, 9 Feb 2021 15:04:43 +0000 (10:04 -0500)]
[mlir][linalg] Fix depthwise conv C++ symbol to be consistent

The assembly mnemonic includes information about input/filter
data format. The C++ symbol should be consistent.

3 years ago[mlir][linalg] Fix one more missing NoSideEffect in linalg tensor op
Thomas Raoux [Tue, 9 Feb 2021 05:20:08 +0000 (21:20 -0800)]
[mlir][linalg] Fix one more missing NoSideEffect in linalg tensor op

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

3 years ago[clang][cli] Store unsigned instead of OptSpecifier in table
Jan Svoboda [Tue, 9 Feb 2021 14:46:10 +0000 (15:46 +0100)]
[clang][cli] Store unsigned instead of OptSpecifier in table

This fixes some buildbot failures with ambiguous call to OptSpecifier constructor.

3 years ago[clang][cli] Look up program action argument in a table
Jan Svoboda [Tue, 9 Feb 2021 14:20:09 +0000 (15:20 +0100)]
[clang][cli] Look up program action argument in a table

This patch extracts the mapping between command line option and frontend::ActionKind into a table. The table can be reused when parsing and also generating command line options.

Reviewed By: dexonsmith

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

3 years agoTry to fix compiler-rt tests after 87dbdd2e3bb63b on mac and win
Nico Weber [Tue, 9 Feb 2021 14:17:23 +0000 (09:17 -0500)]
Try to fix compiler-rt tests after 87dbdd2e3bb63b on mac and win

These tests use `--check-prefix=CHECK-%os` but then didn't have
a CHECK line for every os.

In most tests, the linux expectations were sufficient (they match
the "wrap_" prefix with .*), so just remove the check-prefix there.
In the places where this didn't easily work, make sure there are
at least CHECK-Windows and CHECK-Darwin lines.

3 years ago[clang][cli] Store InputKind in FrontendOptions
Jan Svoboda [Tue, 9 Feb 2021 14:08:31 +0000 (15:08 +0100)]
[clang][cli] Store InputKind in FrontendOptions

This patch stores the `InputKind` (parsed mainly from `-x`) to `FrontendOptions`. This is necessary for command line generation.

Reviewed By: dexonsmith

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

3 years ago[X86][SSE] foldShuffleOfHorizOp - add SHUFPS v4f32 handling
Simon Pilgrim [Tue, 9 Feb 2021 11:07:35 +0000 (11:07 +0000)]
[X86][SSE] foldShuffleOfHorizOp - add SHUFPS v4f32 handling

Fold shufps(hop(x,y),hop(z,w)) -> permute(hop(x,z)) - this is very similar to the equivalent unpack fold.

I did start trying to convert foldShuffleOfHorizOp to handle generic shuffle masks but we're relying on a lot of special cases at the moment.

3 years ago[mlir] Add stacksave, stackrestore to llvm dialect
Denys Shabalin [Tue, 9 Feb 2021 14:09:02 +0000 (15:09 +0100)]
[mlir] Add stacksave, stackrestore to llvm dialect

Reviewed By: ftynse

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

3 years ago[clang-tidy] fix modernize-use-nullptr false positive with spaceship operator comparisons
poelmanc [Tue, 9 Feb 2021 14:02:12 +0000 (14:02 +0000)]
[clang-tidy] fix modernize-use-nullptr false positive with spaceship operator comparisons

`clang-tidy -std=c++20` with `modernize-use-nullptr` mistakenly inserts `nullptr` in place of the comparison operator if the comparison internally expands in the AST to a rewritten spaceship operator. This can be reproduced by running the new `modernize-use-nullptr-cxx20.cpp` test without applying the supplied patch to `UseNullptrCheck.cpp`; the current clang-tidy will mistakenly replace:
```result = (a1 < a2);```
with
```result = (a1 nullptr a2);```

Reviewed By: njames93

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

3 years ago[mlir][linalg] Define a depthwise 2-D convolution op
Lei Zhang [Tue, 9 Feb 2021 13:51:55 +0000 (08:51 -0500)]
[mlir][linalg] Define a depthwise 2-D convolution op

This commit defines linalg.depthwise_conv_2d_nhwc for depthwise
2-D convolution with NHWC input/output data format.

This op right now only support channel multiplier == 1, which is
the most common case.

Reviewed By: nicolasvasilache

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

3 years ago[mlir][linalg] Verify indexing map required attributes
Lei Zhang [Tue, 9 Feb 2021 13:47:21 +0000 (08:47 -0500)]
[mlir][linalg] Verify indexing map required attributes

Indexing maps for named ops can reference attributes so that
we can synthesize the indexing map dynamically. This supports
cases like strides for convolution ops. However, it does cause
an issue: now the indexing_maps() function call is dependent
on those attributes.

Linalg ops inherit LinalgOpInterfaceTraits, which calls
verifyStructuredOpInterface() to verify the interface.
verifyStructuredOpInterface() further calls indexing_maps().
Note that trait verification is done before the op itself,
where ODS generates the verification for those attributes.
So we can have indexing_maps() referencing non-existing or
invalid attribute, before the ODS-generated verification
kick in.

There isn't a dependency handling mechansim for traits.
This commit adds new interface methods to query whether an
op hasDynamicIndexingMaps() and then perform
verifyIndexingMapRequiredAttributes() in
verifyStructuredOpInterface() to handle the dependency issue.

Reviewed By: nicolasvasilache

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

3 years ago[lld/mac] Implement -u flag
Nico Weber [Tue, 9 Feb 2021 13:18:23 +0000 (08:18 -0500)]
[lld/mac] Implement -u flag

Since we emit diagnostics for undefineds in Writer::scanRelocations()
and symbols referenced by -u flags aren't referenced by any relocations,
this needs some manual code (similar to the entry point).

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

3 years ago[X86] Always assign reassoc flag for intrinsics *reduce_add/mul_ps/pd.
Wang, Pengfei [Tue, 9 Feb 2021 13:12:59 +0000 (21:12 +0800)]
[X86] Always assign reassoc flag for intrinsics *reduce_add/mul_ps/pd.

Intrinsics *reduce_add/mul_ps/pd have assumption that the elements in
the vector are reassociable. So we need to always assign the reassoc
flag when we call _mm_reduce_* intrinsics.

Reviewed By: spatel

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

3 years ago[DAGCombine] Do not remove masking argument to FP16_TO_FP for some targets
Nemanja Ivanovic [Tue, 9 Feb 2021 12:33:48 +0000 (06:33 -0600)]
[DAGCombine] Do not remove masking argument to FP16_TO_FP for some targets

As of commit 284f2bffc9bc5, the DAG Combiner gets rid of the masking of the
input to this node if the mask only keeps the bottom 16 bits. This is because
the underlying library function does not use the high order bits. However, on
PowerPC's ELFv2 ABI, it is the caller that is responsible for clearing the bits
from the register. Therefore, the library implementation of __gnu_h2f_ieee will
return an incorrect result if the bits aren't cleared.

This combine is desired for ARM (and possibly other targets) so this patch adds
a query to Target Lowering to check if this zeroing needs to be kept.

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

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

3 years ago[RISCV] Fix shared libs build
Nemanja Ivanovic [Tue, 9 Feb 2021 12:11:45 +0000 (06:11 -0600)]
[RISCV] Fix shared libs build

Commit a2d19bad07454ae7936d8f2b8482e24d57954fc4 introduced a
dependency in the RISCV disassembler on two additional libraries
(MC, RISCVDesc) which wasn't added to the CMakeLists.txt. This
causes shared library builds to break. This patch just adds them
to fix failures seen on some bots, such as the PPC64LE Multistage.

3 years ago[libomptarget][amdgcn] Tolerate deadstripped env variable
Jon Chesterfield [Tue, 9 Feb 2021 11:58:37 +0000 (11:58 +0000)]
[libomptarget][amdgcn] Tolerate deadstripped env variable

[libomptarget][amdgcn] Tolerate deadstripped env variable

Discovered by Pushpinder. If the device_environment variable is unused
it can be deadstripped, in which case we should not abort due to it
missing. This change is safe in that a missing symbol which is actually
used can be reported by both linker and loader, and a missing unused
symbol is better deadstripped than left in the image.

Reviewed By: pdhaliwal

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

3 years ago[AVR] Fix global references to function symbols
Dylan McKay [Tue, 9 Feb 2021 10:08:19 +0000 (23:08 +1300)]
[AVR] Fix global references to function symbols

References to functions are in program memory and need a `pm()` fixup. This should fix trait objects for Rust on AVR.

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

Patch by Alex Mikhalev.

3 years agoRevert STRICT_FCMP nonan optimisation
Thomas Preud'homme [Tue, 9 Feb 2021 11:27:35 +0000 (11:27 +0000)]
Revert STRICT_FCMP nonan optimisation

Summary: This reverts commit b7b61a7b5bc63df0d84f3722a1dcfa375c35ba30 which fails on some of the builders: http://lab.llvm.org:8011/#/builders/14/builds/5806

Reviewers:

Subscribers:

3 years agoImprove STRICT_FSETCC codegen in absence of no NaN
Thomas Preud'homme [Thu, 19 Nov 2020 23:38:42 +0000 (23:38 +0000)]
Improve STRICT_FSETCC codegen in absence of no NaN

As for SETCC, use a less expensive condition code when generating
STRICT_FSETCC if the node is known not to have Nan.

Reviewed By: SjoerdMeijer

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

3 years ago[NFC,Clang] Add more Asan Driver tests
Vitaly Buka [Tue, 9 Feb 2021 10:59:59 +0000 (02:59 -0800)]
[NFC,Clang] Add more Asan Driver tests

3 years ago[NFC,Clang] Add SanCov Driver tests
Vitaly Buka [Tue, 9 Feb 2021 10:56:57 +0000 (02:56 -0800)]
[NFC,Clang] Add SanCov Driver tests

3 years ago[NFC,Clang] Add LTO Driver MSan,KMsan tests
Vitaly Buka [Tue, 9 Feb 2021 10:55:33 +0000 (02:55 -0800)]
[NFC,Clang] Add LTO Driver MSan,KMsan tests

3 years ago[NFC,Clang] Add LTO Driver DFsan tests
Vitaly Buka [Tue, 9 Feb 2021 10:51:19 +0000 (02:51 -0800)]
[NFC,Clang] Add LTO Driver DFsan tests

3 years ago[NFC,Clang] Add LTO Driver Tsan tests
Vitaly Buka [Tue, 9 Feb 2021 10:49:51 +0000 (02:49 -0800)]
[NFC,Clang] Add LTO Driver Tsan tests

3 years ago[clangd] Fix false positive in local rename collision detetction
Kirill Bobyrev [Tue, 9 Feb 2021 10:46:22 +0000 (11:46 +0100)]
[clangd] Fix false positive in local rename collision detetction

Fixes https://github.com/clangd/clangd/issues/685

Reviewed By: hokein

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

3 years ago[-Wcompletion-handler][NFC] Remove unexpected warnings on Windows
Valeriy Savchenko [Tue, 9 Feb 2021 10:48:24 +0000 (13:48 +0300)]
[-Wcompletion-handler][NFC] Remove unexpected warnings on Windows

3 years ago[clang][cli] Generate and round-trip CodeGen options
Jan Svoboda [Tue, 9 Feb 2021 10:42:01 +0000 (11:42 +0100)]
[clang][cli] Generate and round-trip CodeGen options

This patch implements generation of remaining codegen options and tests it by performing parse-generate-parse round trip.

Reviewed By: dexonsmith

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

3 years ago[clang][codegen] Remember string used to create llvm::Regex for optimization remarks
Jan Svoboda [Tue, 9 Feb 2021 10:06:03 +0000 (11:06 +0100)]
[clang][codegen] Remember string used to create llvm::Regex for optimization remarks

Regular expression patterns passed through the command line are being used to create an instances of `llvm::Regex` and thrown away.

There is no API to serialize `Regex` back to the original pattern. This means we have no way to reconstruct the original pattern from command line. This is necessary for serializing `CompilerInvocation`.

This patch stores the original pattern string in `CodeGenOptions` alongside the `llvm::Regex` instance.

Reviewed By: dexonsmith, thegameg

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

3 years agoRevert "[DebugInfo] Re-engineer a test to be stricter, add XFails"
Jeremy Morse [Tue, 9 Feb 2021 09:48:22 +0000 (09:48 +0000)]
Revert "[DebugInfo] Re-engineer a test to be stricter, add XFails"

This reverts commit e05c10380ce7c18d1a232dcc5baa7c10d8bd2bf6.

See parent commit, there's a bot which isn't captured in the XFail list,
reverting til I work out what it is.

3 years agoRevert "Follow up to e05c10380ce7: add aarch64 to test XFails"
Jeremy Morse [Tue, 9 Feb 2021 09:46:32 +0000 (09:46 +0000)]
Revert "Follow up to e05c10380ce7: add aarch64 to test XFails"

This reverts commit 4fd29e4fd3c5490b658f4b467d94aeed6b3d1ac3.

There's a report in D95617 that this is failing on what (I think?) is an
aarch64 bot, which should be covered by the XFail list... reverting this
follow-up and the base patch until I work out what's wrong here.