platform/upstream/llvm.git
3 years ago[Hexagon] Reconsider getMask fix, return original mask, convert later
Krzysztof Parzyszek [Sat, 12 Dec 2020 19:19:36 +0000 (13:19 -0600)]
[Hexagon] Reconsider getMask fix, return original mask, convert later

The getPayload/getMask/getPassThrough functions should return values
that could be composed into a masked load/store without any additional
type casts. The previous fix violated that.
Instead, convert scalar mask to a vector right before rescaling.

3 years ago[AMDGPU] Add missing targets to target-invalid-cpu-note.c
Tony [Thu, 10 Dec 2020 10:01:14 +0000 (10:01 +0000)]
[AMDGPU] Add missing targets to target-invalid-cpu-note.c

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

3 years ago[AMDGPU] Add missing targets to amdgpu-features.cl
Tony [Thu, 10 Dec 2020 09:59:16 +0000 (09:59 +0000)]
[AMDGPU] Add missing targets to amdgpu-features.cl

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

3 years ago[NFC][AMDGPU] AMDGPUUsage updates
Tony [Thu, 10 Dec 2020 03:38:32 +0000 (03:38 +0000)]
[NFC][AMDGPU] AMDGPUUsage updates

- Document which processors are supported by which runtimes.
- Add missing mappings for code object V2 note records

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

3 years ago[mlir] Print bad size in AttrSizedOperandSegments
Brian Gesiak [Fri, 11 Dec 2020 22:57:34 +0000 (17:57 -0500)]
[mlir] Print bad size in AttrSizedOperandSegments

When printing verification errors for ops with the incorrect number of
operand segments, print the required number as well as the actual
number. Split off from D93005.

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

3 years ago[Analysis/Interval] Remove isLoop (NFC)
Kazu Hirata [Sat, 12 Dec 2020 18:09:35 +0000 (10:09 -0800)]
[Analysis/Interval] Remove isLoop (NFC)

The last use of isLoop was removed on Apr 29, 2002 in commit
09bbb5c015c6e40b3d45da057f955ddb7c8f8485 as part of an effort to
remove "old induction varaible cannonicalization pass built on top of
interval analysis".

3 years ago[Transforms] Use is_contained (NFC)
Kazu Hirata [Sat, 12 Dec 2020 17:37:49 +0000 (09:37 -0800)]
[Transforms] Use is_contained (NFC)

3 years ago[Hexagon] Create vector masks for scalar loads/stores
Krzysztof Parzyszek [Sat, 12 Dec 2020 16:05:30 +0000 (10:05 -0600)]
[Hexagon] Create vector masks for scalar loads/stores

AlignVectors treats all loaded/stored values as vectors of bytes,
and masks as corresponding vectors of booleans, so make getMask
produce a 1-element vector for scalars from the start.

3 years ago[UpdateTestChecks] Add --(no-)x86_scrub_sp option.
Harald van Dijk [Sat, 12 Dec 2020 17:11:13 +0000 (17:11 +0000)]
[UpdateTestChecks] Add --(no-)x86_scrub_sp option.

This makes it possible to use update_llc_test_checks to manage tests
that check for incorrect x86 stack offsets. It does not yet modify any
test to make use of this new option.

3 years ago[X86] Avoid data16 prefix for lea in x32 mode
Harald van Dijk [Sat, 12 Dec 2020 17:05:24 +0000 (17:05 +0000)]
[X86] Avoid data16 prefix for lea in x32 mode

The ABI demands a data16 prefix for lea in 64-bit LP64 mode, but not in
64-bit ILP32 mode. In both modes this prefix would ordinarily be
ignored, but the instructions may be changed by the linker to
instructions that are affected by the prefix.

Reviewed By: RKSimon

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

3 years ago[ARM] Add basic masked load/store costs
David Green [Sat, 12 Dec 2020 15:26:32 +0000 (15:26 +0000)]
[ARM] Add basic masked load/store costs

This adds some basic MVE masked load/store costs, notably changing the
cost of legal loads/stores to the MVECostFactor and the cost of
scalarized instructions to 8*NumElts.

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

3 years ago[LV] Fix scalar cost for tail predicated loops
David Green [Sat, 12 Dec 2020 14:21:40 +0000 (14:21 +0000)]
[LV] Fix scalar cost for tail predicated loops

When it comes to the scalar cost of any predicated block, the loop
vectorizer by default regards this predication as a sign that it is
looking at an if-conversion and divides the scalar cost of the block by
2, assuming it would only be executed half the time. This however makes
no sense if the predication has been introduced to tail predicate the
loop.

Original patch by Anna Welker

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

3 years ago[BasicAA] Make non-equal index handling simpler to extend (NFC)
Nikita Popov [Sat, 12 Dec 2020 12:23:49 +0000 (13:23 +0100)]
[BasicAA] Make non-equal index handling simpler to extend (NFC)

3 years ago[BasicAA] Add tests for non-zero var index (NFC)
Nikita Popov [Sat, 12 Dec 2020 12:19:23 +0000 (13:19 +0100)]
[BasicAA] Add tests for non-zero var index (NFC)

3 years agoCreate SPIRABIInfo to enable SPIR_FUNC calling convention.
Melanie Blower [Sat, 12 Dec 2020 13:18:00 +0000 (05:18 -0800)]
Create SPIRABIInfo to enable SPIR_FUNC calling convention.

Background: Call to library arithmetic functions for div is emitted by the
compiler and it set wrong “C” calling convention for calls to these functions,
whereas library functions are declared with `spir_function` calling convention.
InstCombine optimization replaces such calls with “unreachable” instruction.
It looks like clang lacks SPIRABIInfo class which should specify default
calling conventions for “system” function calls. SPIR supports only
SPIR_FUNC and SPIR_KERNEL calling convention.

Reviewers: Erich Keane, Anastasia

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

3 years ago[lldb] Make CommandInterpreter's execution context the same as debugger's one.
Tatyana Krasnukha [Thu, 10 Dec 2020 16:30:04 +0000 (19:30 +0300)]
[lldb] Make CommandInterpreter's execution context the same as debugger's one.

Currently, the interpreter's context is not updated until a command is executed.
This has resulted in the behavior of SB-interface functions and some commands
depends on previous user actions. The interpreter's context can stay uninitialized,
point to a currently selected target, or point to one of previously selected targets.

This patch removes any usages of CommandInterpreter::UpdateExecutionContext.
CommandInterpreter::HandleCommand* functions still may override context temporarily,
but now they always restore it before exiting. CommandInterpreter saves overriden
contexts to the stack, that makes nesting commands possible.

Added test reproduces one of the issues. Without this fix, the last assertion fails
because interpreter's execution context is empty until running "target list", so,
the value of the global property was updated instead of process's local instance.

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

3 years ago[lldb] Modernize TargetList for-loops, NFC
Tatyana Krasnukha [Wed, 2 Dec 2020 15:52:50 +0000 (18:52 +0300)]
[lldb] Modernize TargetList for-loops, NFC

Replace loops with standard algorithms or range-based loops.

3 years ago[lldb] "target create" shouldn't save target if the command failed
Tatyana Krasnukha [Fri, 11 Dec 2020 08:09:39 +0000 (11:09 +0300)]
[lldb] "target create" shouldn't save target if the command failed

TargetList::CreateTarget automatically adds created target to the list, however,
CommandObjectTargetCreate does some additional preparation after creating a target
and which can fail. The command should remove created target if it failed. Since
the function has many ways to return, scope guard does this work safely.

Changes to the TargetList make target adding and selection more transparent.

Other changes remove unnecessary SetSelectedTarget after CreateTarget.

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

3 years ago[X86] Add chain in ISel for x86_tdpbssd_internal intrinsic.
Luo, Yuanke [Sat, 12 Dec 2020 12:21:43 +0000 (20:21 +0800)]
[X86] Add chain in ISel for x86_tdpbssd_internal intrinsic.

3 years ago[YAML] Support extended spellings when parsing bools.
Nathan James [Sat, 12 Dec 2020 12:50:33 +0000 (12:50 +0000)]
[YAML] Support extended spellings when parsing bools.

Support all the spellings of boolean datatypes according to https://yaml.org/type/bool.html

Reviewed By: silvas

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

3 years ago[ARM] Test for showing scalar vector costs. NFC
David Green [Sat, 12 Dec 2020 11:43:14 +0000 (11:43 +0000)]
[ARM] Test for showing scalar vector costs. NFC

3 years ago[clang][cli] Revert accidental access-control flag rename
Jan Svoboda [Fri, 11 Dec 2020 14:43:05 +0000 (15:43 +0100)]
[clang][cli] Revert accidental access-control flag rename

This commit <https://reviews.llvm.org/rGe5158b52730d323bb8cd2cba6dc6c89b90cba452> introduced an accidental change, which renames `-faccess-control` and `-fno-access-control` to `-fno-access-control` and `-fno-no-access-control`.

Reviewed By: dexonsmith, MaskRay

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

3 years ago[clang][cli] Add flexible TableGen multiclass for boolean options
Jan Svoboda [Tue, 8 Dec 2020 17:15:21 +0000 (18:15 +0100)]
[clang][cli] Add flexible TableGen multiclass for boolean options

This introduces more flexible multiclass for declaring two flags controlling the same boolean keypath.

Compared to existing Opt{In,Out}FFlag multiclasses, the new syntax makes it easier to read option declarations and reason about the keypath.

This also makes specifying common properties of both flags possible.

I'm open to suggestions on the class names. Not 100% sure the benefits are worth the added complexity.

Depends on D92774.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] Don't always emit -f[no-]legacy-pass-manager
Jan Svoboda [Tue, 8 Dec 2020 17:15:21 +0000 (18:15 +0100)]
[clang][cli] Don't always emit -f[no-]legacy-pass-manager

We don't need to always generate `-f[no-]experimental-new-pass-manager`.

This patch does not change the behavior of any other command line flag. (For example `-triple` is still being always generated.)

Reviewed By: dexonsmith, Bigcheese

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

3 years agoReland "[clang][cli] CompilerInvocationTest: add tests for boolean options"
Jan Svoboda [Fri, 11 Dec 2020 13:22:21 +0000 (14:22 +0100)]
Reland "[clang][cli] CompilerInvocationTest: add tests for boolean options"

Add more tests of the command line marshalling infrastructure.

The new tests now make a "round-trip": from arguments, to CompilerInvocation instance to arguments again in a single test case.

The TODOs are resolved in a follow-up patch.

Depends on D92830.

Reviewed By: dexonsmith

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

3 years ago[Analysis] Use is_contained (NFC)
Kazu Hirata [Sat, 12 Dec 2020 05:19:31 +0000 (21:19 -0800)]
[Analysis] Use is_contained (NFC)

3 years ago[MLGO] Fix build break as result of new InstructionCost (D91174)
Mircea Trofin [Sat, 12 Dec 2020 04:28:39 +0000 (20:28 -0800)]
[MLGO] Fix build break as result of new InstructionCost (D91174)

3 years ago[OpenMP] Add time profiling for libomptarget
Giorgis Georgakoudis [Thu, 10 Dec 2020 19:24:27 +0000 (11:24 -0800)]
[OpenMP] Add time profiling for libomptarget

Reviewed By: jdoerfert

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

3 years ago[llvm-cov gcov] Replace Donald B. Johnson's cycle enumeration with iterative cycle...
Fangrui Song [Sat, 12 Dec 2020 02:28:16 +0000 (18:28 -0800)]
[llvm-cov gcov] Replace Donald B. Johnson's cycle enumeration with iterative cycle finding

gcov computes the line execution count as the sum of (a) counts from
predecessors on other lines and (b) the sum of loop execution counts of blocks
on the same line (think of loops on one line).

For (b), we use Donald B. Johnson's cycle enumeration algorithm and perform
cycle cancelling for each cycle. This number of candidate cycles were
exponential and D93036 made it polynomial by skipping zero count cycles.  The
time complexity is high (O(V*E^2) (it could be O(E^2) but the linear `Blocks`
check made it higher) and the implementation is complex.

We could just identify loops and sum all back edges. However, this requires a
dominator tree construction which is more complex. The time complexity can be
decreased to almost linear, though.

This patch just performs cycle cancelling iteratively. Add two members
`traversable` and `incoming` to GCOVArc. There are 3 states:

* `!traversable`: blocks not on this line or explored blocks
* `traversable && incoming == nullptr`: unexplored blocks
* `traversable && incoming != nullptr`: blocks which are being explored (on the stack)

If an arc points to a block being explored, a cycle has been found.

Let E be the number of arcs. Every time a cycle is found, at least one arc is
saturated (`edgeCount` reduced to 0), so there are at most E cycles. Finding one
cycle takes O(E) time, so the overall time complexity is O(E^2). Note that we
always augment through a back edge and never need to augment its reverse edge so
reverse edges in traditional flow networks are not needed.

Reviewed By: xinhaoyuan

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

3 years ago[Kaleidoscope] Migrate DebugInfo::get to DILocation::get
Fangrui Song [Sat, 12 Dec 2020 02:01:04 +0000 (18:01 -0800)]
[Kaleidoscope] Migrate DebugInfo::get to DILocation::get

3 years ago[mlir][docs] Tidy up the pass infrastructure documentation
River Riddle [Sat, 12 Dec 2020 01:52:56 +0000 (17:52 -0800)]
[mlir][docs] Tidy up the pass infrastructure documentation

The doc has grown stale and is missing some recent changes to the infrastructure.

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

3 years agoFixup for 8c86197de3cba4257f26133e837d64e5f8ece210 to avoid making it platform-dependent
Duncan P. N. Exon Smith [Sat, 12 Dec 2020 01:33:07 +0000 (17:33 -0800)]
Fixup for 8c86197de3cba4257f26133e837d64e5f8ece210 to avoid making it platform-dependent

3 years agoclang-import-test: Clean up error output for files that cannot be found
Duncan P. N. Exon Smith [Wed, 9 Dec 2020 21:54:56 +0000 (13:54 -0800)]
clang-import-test: Clean up error output for files that cannot be found

Pass on the filesystem error string `FileManager::getFileRef` in
`clang-import-test`'s `ParseSource` function. Also include "error:" and
a newline in the output. As a side effect, migrate to the `FileEntryRef`
overload of `SourceManager::createFileID`.

No real functionality change here, just slightly better output on error.

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

3 years agoFrontend: Migrate to FileEntryRef in TextDiagnosticTest, NFC
Duncan P. N. Exon Smith [Wed, 9 Dec 2020 21:41:17 +0000 (13:41 -0800)]
Frontend: Migrate to FileEntryRef in TextDiagnosticTest, NFC

Migrate over to the `FileEntryRef` overloads of
`SourceManager::createFileID` and `overrideFileContents` (using
`getVirtualFileRef`) in `TextDiagnostic`'s `ShowLine` test.

No functionality change.

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

3 years agoReapply "[SystemZFrameLowering] Don't overrwrite R1D (backchain) when probing."
Jonas Paulsson [Fri, 11 Dec 2020 00:26:16 +0000 (01:26 +0100)]
Reapply "[SystemZFrameLowering] Don't overrwrite R1D (backchain) when probing."

Fixed to properly compute the live-in lists of new blocks.

Review: Ulrich Weigand

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

3 years ago[SystemZTTIImpl] Allow some non-prefetched accesses in getMinPrefetchStride().
Jonas Paulsson [Thu, 10 Dec 2020 00:56:45 +0000 (01:56 +0100)]
[SystemZTTIImpl] Allow some non-prefetched accesses in getMinPrefetchStride().

The performance improvement on LBM previously achieved with improved software
prefetching (36d4421) have gone lost recently with e00f189. There now is one
memory access in the loop that LoopDataPrefetch cannot handle (while before
there was none) which the heuristic rejects.

This patch adds a small margin by allowing 1 non-prefetched memory access for
every 32 prefetched ones, so that the heuristic doesn't bail in this type of
case.

Review: Ulrich Weigand

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

3 years ago[AIX] Fixed a link error.
diggerlin [Fri, 11 Dec 2020 23:53:10 +0000 (18:53 -0500)]
[AIX] Fixed a link error.

Summary:

link: http://lab.llvm.org:8011/#/builders/57/builds/2307/steps/6/logs/stdio".
PPCAsmPrinter.cpp:(.text._ZN12_GLOBAL__N_116PPCAIXAsmPrinter19emitFunctionBodyEndEv+0x2f8): undefined reference to `llvm::XCOFF::getNameForTracebackTableLanguageId(llvm::XCOFF::TracebackTable::LanguageID)'
PPCAsmPrinter.cpp:(.text._ZN12_GLOBAL__N_116PPCAIXAsmPrinter19emitFunctionBodyEndEv+0x2170): undefined reference to `llvm::XCOFF::parseParmsType(unsigned int, unsigned int)'

3 years ago[LoopIdiomRecognize] Autogenerate complete checks for the X86 ctlz/cttz tests. NFC
Craig Topper [Fri, 11 Dec 2020 23:24:18 +0000 (15:24 -0800)]
[LoopIdiomRecognize] Autogenerate complete checks for the X86 ctlz/cttz tests. NFC

Preparation for D92745 which will add more tests to these files.

3 years agoRevert "Consider reference, pointer, and pointer-to-member TemplateArguments to be...
Nikita Popov [Fri, 11 Dec 2020 23:04:10 +0000 (00:04 +0100)]
Revert "Consider reference, pointer, and pointer-to-member TemplateArguments to be different if they have different types."

This reverts commit 7b3470baf8bab1919e3ad4c18e2b776c1f7be2d5.

Causes a crash while building tramp3d-v4 from test-suite.

3 years ago[AIX][XCOFF] emit traceback table for function in aix
diggerlin [Fri, 11 Dec 2020 22:50:25 +0000 (17:50 -0500)]
[AIX][XCOFF] emit traceback table for function in aix

SUMMARY:
 1. added a new option -xcoff-traceback-table to control whether generate traceback table for function.
 2. implement the functionality of emit traceback table of a function.

Reviewers: hubert.reinterpretcast, Jason Liu
Differential Revision: https://reviews.llvm.org/D92398

3 years agoStore a MlirIdentifier instead of a MlirStringRef in MlirNameAttribute
Mehdi Amini [Fri, 11 Dec 2020 18:50:04 +0000 (18:50 +0000)]
Store a MlirIdentifier instead of a MlirStringRef in MlirNameAttribute

This mirror the C++ API for NamedAttribute, and has the advantage or
internalizing earlier in the Context and not requiring the caller to
keep the StringRef alive beyong this call.

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

3 years ago[libc] Let wrappergen pick LLVM libc mangled name from aliasee file.
Siva Chandra Reddy [Fri, 11 Dec 2020 21:17:33 +0000 (13:17 -0800)]
[libc] Let wrappergen pick LLVM libc mangled name from aliasee file.

Along the way, made a change to run tool unittests when the target
"check-libc" is run by introducing a libc testsuite for tool unittests.

Reviewed By: michaelrj

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

3 years agoRevert "Revert "[mlir] Start splitting the `tensor` dialect out of `std`.""
Sean Silva [Fri, 11 Dec 2020 22:20:03 +0000 (14:20 -0800)]
Revert "Revert "[mlir] Start splitting the `tensor` dialect out of `std`.""

This reverts commit 0d48d265db6633e4e575f81f9d3a52139b1dc5ca.

This reapplies the following commit, with a fix for CAPI/ir.c:

[mlir] Start splitting the `tensor` dialect out of `std`.

This starts by moving `std.extract_element` to `tensor.extract` (this
mirrors the naming of `vector.extract`).

Curiously, `std.extract_element` supposedly works on vectors as well,
and this patch removes that functionality. I would tend to do that in
separate patch, but I couldn't find any downstream users relying on
this, and the fact that we have `vector.extract` made it seem safe
enough to lump in here.

This also sets up the `tensor` dialect as a dependency of the `std`
dialect, as some ops that currently live in `std` depend on
`tensor.extract` via their canonicalization patterns.

Part of RFC: https://llvm.discourse.group/t/rfc-split-the-tensor-dialect-from-std/2347/2

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

3 years ago[InstCombine][x86] fix insertion point bug in vector demanded elts fold (PR48476)
Sanjay Patel [Fri, 11 Dec 2020 21:18:56 +0000 (16:18 -0500)]
[InstCombine][x86] fix insertion point bug in vector demanded elts fold (PR48476)

This transform was added at:
c63799fc52ff

From what I see, it's the first demanded elements transform that adds
a new instruction using the IRBuilder. There are similar folds in
the generic demanded bits chunk of instcombine that also use the
InsertPointGuard code pattern.

The tests here would assert/crash because the new instruction was
being added at the start of the demanded elements analysis rather
than at the instruction that is being replaced.

3 years agoRevert "[mlir] Start splitting the `tensor` dialect out of `std`."
Sean Silva [Fri, 11 Dec 2020 22:15:41 +0000 (14:15 -0800)]
Revert "[mlir] Start splitting the `tensor` dialect out of `std`."

This reverts commit cab8dda90f48e15ee94b0d55ceac5b6a812e4743.

I mistakenly thought that CAPI/ir.c failure was unrelated to this
change. Need to debug it.

3 years ago[flang] Removed an absolute path from the "flang" script
Peter Steinfeld [Fri, 11 Dec 2020 18:28:51 +0000 (10:28 -0800)]
[flang] Removed an absolute path from the "flang" script

The "flang" script that gets put into "install/bin" had an absolute path
in it.  This precuded moving the install directory to a new location.

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

3 years ago[mlir] Start splitting the `tensor` dialect out of `std`.
Sean Silva [Thu, 10 Dec 2020 01:50:03 +0000 (17:50 -0800)]
[mlir] Start splitting the `tensor` dialect out of `std`.

This starts by moving `std.extract_element` to `tensor.extract` (this
mirrors the naming of `vector.extract`).

Curiously, `std.extract_element` supposedly works on vectors as well,
and this patch removes that functionality. I would tend to do that in
separate patch, but I couldn't find any downstream users relying on
this, and the fact that we have `vector.extract` made it seem safe
enough to lump in here.

This also sets up the `tensor` dialect as a dependency of the `std`
dialect, as some ops that currently live in `std` depend on
`tensor.extract` via their canonicalization patterns.

Part of RFC: https://llvm.discourse.group/t/rfc-split-the-tensor-dialect-from-std/2347/2

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

3 years agoConsider reference, pointer, and pointer-to-member TemplateArguments to be different...
Richard Smith [Sun, 15 Nov 2020 01:37:25 +0000 (17:37 -0800)]
Consider reference, pointer, and pointer-to-member TemplateArguments to be different if they have different types.

For the Itanium ABI, this implements the mangling rule suggested in
https://github.com/itanium-cxx-abi/cxx-abi/issues/47, namely mangling
such template arguments as being cast to the parameter type in the case
where the template name is overloadable. This can cause a mangling
change for rare cases, where

 * the template argument declaration is converted from its declared type
   to the type of the template parameter, and
 * the template parameter either has a deduced type or is a parameter of
   a function template.

However, such changes are necessary to avoid mangling collisions. The
ABI changes can be reversed with -fclang-abi-compat=11 or earlier.

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

3 years ago[Hexagon] Workaround for compilation error with VS2017
Krzysztof Parzyszek [Fri, 11 Dec 2020 18:15:53 +0000 (12:15 -0600)]
[Hexagon] Workaround for compilation error with VS2017

3 years agoMigrate deprecated DebugLoc::get to DILocation::get
Fangrui Song [Fri, 11 Dec 2020 20:45:22 +0000 (12:45 -0800)]
Migrate deprecated DebugLoc::get to DILocation::get

This migrates all LLVM (except Kaleidoscope and
CodeGen/StackProtector.cpp) DebugLoc::get to DILocation::get.

The CodeGen/StackProtector.cpp usage may have a nullptr Scope
and can trigger an assertion failure, so I don't migrate it.

Reviewed By: #debug-info, dblaikie

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

3 years ago[BasicAA] Add extra check in phi-spec-order.ll (NFC)
Nikita Popov [Fri, 11 Dec 2020 20:17:54 +0000 (21:17 +0100)]
[BasicAA] Add extra check in phi-spec-order.ll (NFC)

The (scevgep, scevgep5) relation regressed with a patch I was
trying, but wasn't tested.

3 years agoRevert "[AArch64] Lower calls with rv_marker attribute ."
Florian Hahn [Fri, 11 Dec 2020 20:12:59 +0000 (20:12 +0000)]
Revert "[AArch64] Lower calls with rv_marker attribute ."

This reverts commit a87fccb3ff9c11986d3110d9f77fb0ccea0daf79.

A test appears to fail with expensive checks. Reverting while I
investigate.

3 years ago[LV] Precommit test for PR48429.
Florian Hahn [Fri, 11 Dec 2020 19:55:48 +0000 (19:55 +0000)]
[LV] Precommit test for PR48429.

3 years ago[lld][PowerPC][test] Avoid flaky failures
Jinsong Ji [Fri, 11 Dec 2020 19:32:18 +0000 (19:32 +0000)]
[lld][PowerPC][test] Avoid flaky failures

This test may fail if there is a new changes to this tests.

The archives are not deleted so the contents from the previous test run
may affect the contents for the current run,
so this will require cleaning up the Output dir or force build of buildbot.

The fix is to put all the objects in the temporary dir that we cleanup every run,
 to avoid run-2-run flaky failures.

Reviewed By: MaskRay

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

3 years ago[AArch64] Lower calls with rv_marker attribute .
Florian Hahn [Fri, 11 Dec 2020 19:37:14 +0000 (19:37 +0000)]
[AArch64] Lower calls with rv_marker attribute .

This patch adds support for lowering function calls with the
rv_marker attribute. The goal is to expand such calls to the
following sequence of instructions:

    BL @fn
    mov x29, x29

This sequence of instructions triggers Objective-C runtime optimizations,
hence we want to ensure no instructions get moved in between them.
This patch achieves that by adding a new CALL_RVMARKER ISD node,
which gets turned into the BLR_RVMARKER pseudo, which eventually gets
expanded into the sequence mentioned above. The sequence is then marked
as instruction bundle, to avoid anything being moved in between.

@ahatanak is working on using this attribute in the front- & middle-end.

Together with the front- & middle-end changes, this should address
PR31925 for AArch64.

Reviewed By: t.p.northover

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

3 years ago[SmallVector][NFC] Link to ProgrammersManual from SmallVector docs
Scott Linder [Fri, 11 Dec 2020 19:34:10 +0000 (19:34 +0000)]
[SmallVector][NFC] Link to ProgrammersManual from SmallVector docs

Add a "see also" link from the condensed doxygen description of
`SmallVector` to the more complete description in the ProgrammersManual.

3 years ago[libc++] Fix Docker image build after installing clang-format
Louis Dionne [Fri, 11 Dec 2020 19:12:59 +0000 (14:12 -0500)]
[libc++] Fix Docker image build after installing clang-format

3 years ago[libc] Add implementations of lround[f|l] and llround[f|l].
Siva Chandra Reddy [Wed, 9 Dec 2020 05:44:22 +0000 (21:44 -0800)]
[libc] Add implementations of lround[f|l] and llround[f|l].

A new function to MPFRWrapper has been added, which is used to set up
the unit tests.

Reviewed By: lntue

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

3 years ago[MCAsmInfo] Delete unused doesSupportExceptionHandling
Fangrui Song [Fri, 11 Dec 2020 19:08:16 +0000 (11:08 -0800)]
[MCAsmInfo] Delete unused doesSupportExceptionHandling

ExceptionHandling:: is a bit misleading - we actually use the term for both
exceptions and non-exception .eh_frame usage.

3 years ago[libc++] Install clang-format on CI nodes
Louis Dionne [Fri, 11 Dec 2020 19:06:24 +0000 (14:06 -0500)]
[libc++] Install clang-format on CI nodes

3 years ago[gn build] Port b577d2df7bd
LLVM GN Syncbot [Fri, 11 Dec 2020 18:37:39 +0000 (18:37 +0000)]
[gn build] Port b577d2df7bd

3 years ago[RISCV] Add a pass to remove duplicate VSETVLI instructions in a basic block.
Craig Topper [Fri, 11 Dec 2020 18:34:12 +0000 (10:34 -0800)]
[RISCV] Add a pass to remove duplicate VSETVLI instructions in a basic block.

Add simple pass for removing redundant vsetvli instructions within a basic block. This handles the case where the AVL register and VTYPE immediate are the same and no other instructions that change VTYPE or VL are between them.

There are going to be more opportunities for improvement in this space as we development more complex tests.

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

3 years ago[clang-tidy] false-positive for bugprone-redundant-branch-condition in case of passed...
Zinovy Nis [Sun, 15 Nov 2020 15:09:18 +0000 (18:09 +0300)]
[clang-tidy] false-positive for bugprone-redundant-branch-condition in case of passed-by-ref params

Inspired by discussion in https://reviews.llvm.org/D91037

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

3 years ago[tests][OpenMPIRBuilder] Use EXPECT_EQ instead ASSERT_EQ.
Michael Kruse [Fri, 11 Dec 2020 17:45:35 +0000 (11:45 -0600)]
[tests][OpenMPIRBuilder] Use EXPECT_EQ instead ASSERT_EQ.

Test execution can continue even if previous cases failed.

3 years ago[BasicAA] Handle two unknown sizes for GEPs
Nikita Popov [Tue, 1 Dec 2020 17:06:37 +0000 (18:06 +0100)]
[BasicAA] Handle two unknown sizes for GEPs

If we have two unknown sizes and one GEP operand and one non-GEP
operand, then we currently simply return MayAlias. The comment says
we can't do anything useful ... but we can! We can still check that
the underlying objects are different (and do so for the GEP-GEP case).

To reduce the compile-time impact, this a) checks this early, before
doing the relatively expensive GEP decomposition that will not be
used and b) doesn't do the check if the other operand is a phi or
select. In that case, the phi/select will already recurse, so this
would just do two slightly different recursive walks that arrive at
the same roots.

Compile-time is still a bit of a mixed bag: https://llvm-compile-time-tracker.com/compare.php?from=624af932a808b363a888139beca49f57313d9a3b&to=845356e14adbe651a553ed11318ddb5e79a24bcd&stat=instructions
On average this is a small improvement, but sqlite with ThinLTO has
a 0.5% regression (lencod has a 1% improvement).

The BasicAA test case checks this by using two memsets with unknown
size. However, the more interesting case where this is useful is
the LoopVectorize test case, as analysis of accesses in loops tends
to always us unknown sizes.

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

3 years ago[PGO] Adjust -vp-counters-per-site under dynamic linking.
Hiroshi Yamauchi [Wed, 9 Dec 2020 23:04:55 +0000 (15:04 -0800)]
[PGO] Adjust -vp-counters-per-site under dynamic linking.

Addressing clang bootstrap under the dynamic linking mode running out of static
allocation of value profile nodes, reported in D81682.

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

3 years ago[OpenMPIRBuilder] Various changes required for tileLoops.
Michael Kruse [Fri, 11 Dec 2020 16:55:58 +0000 (10:55 -0600)]
[OpenMPIRBuilder] Various changes required for tileLoops.

Extract some changes not directly related to tileLoops out of D92974:
 * Refactor `createLoopSkeleton` out of `createCanonicalLoop`.
 * Introduce `ComputeIP` parameter to the `createCanonicalLoop` overload inserts instructions to compute the trip count. Specifying the location is necessary to make these instructions appear before the outermost loop of a loop nest that is tiled.
 * Introduce `Name` parameter to `createCanonicalLoop`. This can help better understanding the origin of values of basic blocks with many loops. The default value is "loop" instead of "for" which could be confused with the "for directive" (aka worksharing-loop) and does not apply to Fortran.
 * Remove `CanonicalLoopInfo::eraseFromParent` which is currently unused and untested and was added in anticipation to be used by `tileLoops`. `eraseFromParent` has shown to be insufficient when more than a single loop is involved and is replaced by `removeUnusedBlocksFromParent` in D92974.

Reviewed By: SouraVX

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

3 years ago[libc++] Use TARGET_FILE instead of TARGET_SONAME_FILE when generating ABI lists
Louis Dionne [Tue, 8 Dec 2020 17:15:44 +0000 (12:15 -0500)]
[libc++] Use TARGET_FILE instead of TARGET_SONAME_FILE when generating ABI lists

TARGET_SONAME_FILE isn't valid on Windows, and TARGET_FILE should achieve
the same results.

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

3 years ago[libc++] NFCI: Implement make_shared as allocate_shared with std::allocator
Louis Dionne [Wed, 9 Dec 2020 21:57:28 +0000 (16:57 -0500)]
[libc++] NFCI: Implement make_shared as allocate_shared with std::allocator

This simplifies the implementation, and it appears to be equivalent since
make_shared was allocating memory with std::allocator anyway.

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

3 years ago[MC][ELF] Accept abbreviated form with sh_flags and sh_entsize
Tobias Burnus [Fri, 11 Dec 2020 16:43:06 +0000 (16:43 +0000)]
[MC][ELF] Accept abbreviated form with sh_flags and sh_entsize

D73999 / commit 75af9da755721123e62b45cd0bc0c5e688a9722a
added for LLVM 11 a check that sh_flags and sh_entsize (and sh_type)
changes are an error, in line with GNU assembler.

However, GNU assembler accepts and GCC generates an abbreviated form:
while the first .section contains the flags and entsize, subsequent
sections simply contain the name without repeating entsize or flags.

Do likewise for better compatibility.

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

Reviewed By: jhenderson, MaskRay

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

3 years agoRevert [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC
Sam McCall [Fri, 11 Dec 2020 16:35:50 +0000 (17:35 +0100)]
Revert [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC

This reverts commit 8a4390dc4768fcd929a7231717980ccb28f124f7.

(The reland did not have the bugfix, just trying to get more details
from the buildbots)

3 years agoReland [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC
Sam McCall [Fri, 11 Dec 2020 15:47:17 +0000 (16:47 +0100)]
Reland [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC

This reverts commit de4f5519015cc97f28718d90cc6dac73c0a15161.

More debug output to try to pin down an impossible condition.

3 years ago[YAML] Use correct source location for unknown key errors.
Nathan James [Fri, 11 Dec 2020 16:34:06 +0000 (16:34 +0000)]
[YAML] Use correct source location for unknown key errors.

Currently unknown keys when inputting mapping traits have the location set to the Value.
Example:
```
YAML:1:14: error: unknown key 'UnknownKey'
{UnknownKey: SomeValue}
             ^~~~~~~~~
```
This is unhelpful for a user as it draws them to fix the wrong item.

Reviewed By: silvas

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

3 years ago[PowerPC] Remove duplicate layout
Jinsong Ji [Fri, 11 Dec 2020 15:47:42 +0000 (15:47 +0000)]
[PowerPC] Remove duplicate layout

3 years ago[mlir] Support inlining into affine operations
Alex Zinenko [Wed, 9 Dec 2020 08:51:15 +0000 (09:51 +0100)]
[mlir] Support inlining into affine operations

Introduce support for inlining into affine operations. This uses the generic
inline infrastructure and boils down to checking that, if applied, the inlining
doesn't violate the affine dimension/symbol value categorization. Given valid
IR, only the values that are valid dimensions/symbols thanks to being top-level
in their affine scope need special handling.

Reviewed By: rriddle

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

3 years ago[clangd] Use enumMember instead of enumConstant
Nathan James [Fri, 11 Dec 2020 14:46:12 +0000 (14:46 +0000)]
[clangd] Use enumMember instead of enumConstant

We should be using enumMember as thats defined in LSP, enumConstant is non standard so clients aren't likely to support it
Fixes https://github.com/clangd/clangd/issues/622n

Reviewed By: sammccall

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

3 years ago[DFSan] Add custom wrapper for recvmmsg.
Matt Morehouse [Fri, 11 Dec 2020 14:24:43 +0000 (06:24 -0800)]
[DFSan] Add custom wrapper for recvmmsg.

Uses the recvmsg wrapper logic in a loop.

Reviewed By: stephan.yichao.zhao

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

3 years ago[AMDGPU] Make use of emitRemovedIntrinsicError. NFC.
Jay Foad [Fri, 11 Dec 2020 14:02:14 +0000 (14:02 +0000)]
[AMDGPU] Make use of emitRemovedIntrinsicError. NFC.

Change-Id: I482bbf528255f2eacd3878ddfe7edb9a8f63d5c2

3 years ago[mlir][ArmNeon][RFC] Add a Neon dialect
Nicolas Vasilache [Fri, 11 Dec 2020 12:53:49 +0000 (12:53 +0000)]
[mlir][ArmNeon][RFC] Add a Neon dialect

This revision starts an Arm-specific ArmNeon dialect discussed in the [discourse RFC thread](https://llvm.discourse.group/t/rfc-vector-dialects-neon-and-sve/2284).

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

3 years ago[mlir] Expose target configuration for lowering to ROCDL.
Adrian Kuegel [Thu, 10 Dec 2020 13:02:06 +0000 (14:02 +0100)]
[mlir] Expose target configuration for lowering to ROCDL.

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

3 years agoAdd rsqrt lowering from standard to ROCDL.
Adrian Kuegel [Thu, 10 Dec 2020 09:47:53 +0000 (10:47 +0100)]
Add rsqrt lowering from standard to ROCDL.

Add a lowering for rsqrt from standard dialect to ROCDL.

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

3 years agoRemove references to the ast_type_traits namespace
Alexander Kornienko [Fri, 11 Dec 2020 01:26:21 +0000 (02:26 +0100)]
Remove references to the ast_type_traits namespace

Follow up to https://reviews.llvm.org/D92994

3 years ago[KernelAddressSanitizer] Fix globals exclusion for indirect aliases
Marco Elver [Fri, 11 Dec 2020 11:20:40 +0000 (12:20 +0100)]
[KernelAddressSanitizer] Fix globals exclusion for indirect aliases

GlobalAlias::getAliasee() may not always point directly to a
GlobalVariable. In such cases, try to find the canonical GlobalVariable
that the alias refers to.

Link: https://github.com/ClangBuiltLinux/linux/issues/1208
Reviewed By: dvyukov, nickdesaulniers

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

3 years ago[SelectionDAG] Implement SplitVecOp_INSERT_SUBVECTOR
Joe Ellis [Wed, 9 Dec 2020 10:06:52 +0000 (10:06 +0000)]
[SelectionDAG] Implement SplitVecOp_INSERT_SUBVECTOR

This function is needed for when it is necessary to split the subvector
operand of an llvm.experimental.vector.insert call. Splitting the
subvector operand means performing two insertions: one inserting the
lower part of the split subvector into the destination vector, and
another for inserting the upper part.

Through experimenting, it seems quite rare to need split the subvector
operand, but this is necessary to avoid assertion errors.

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

3 years ago[NFC][Test] Add a test to verify the instruction form we got from isel
QingShan Zhang [Fri, 11 Dec 2020 10:36:46 +0000 (10:36 +0000)]
[NFC][Test] Add a test to verify the instruction form we got from isel

3 years ago[NFC][Test] Format the PowerPC test for incoming patch
QingShan Zhang [Fri, 11 Dec 2020 09:50:59 +0000 (09:50 +0000)]
[NFC][Test] Format the PowerPC test for incoming patch

3 years ago[clangd] Reorder the class field to avoid -Wreorder-ctor warning, NFC.
Haojian Wu [Fri, 11 Dec 2020 09:45:50 +0000 (10:45 +0100)]
[clangd] Reorder the class field to avoid -Wreorder-ctor warning, NFC.

3 years agoFix build issue caused by 9b76160e53f67008ff21095098129a2949595a06
David Sherwood [Fri, 11 Dec 2020 09:43:13 +0000 (09:43 +0000)]
Fix build issue caused by 9b76160e53f67008ff21095098129a2949595a06

3 years ago[AST][RecoveryAST] Preserve type for member call expr if argments are not matched.
Haojian Wu [Sun, 29 Nov 2020 21:31:42 +0000 (22:31 +0100)]
[AST][RecoveryAST] Preserve type for member call expr if argments are not matched.

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

3 years ago[ARM] Make t2DoLoopStartTP a terminator
David Green [Fri, 11 Dec 2020 09:23:57 +0000 (09:23 +0000)]
[ARM] Make t2DoLoopStartTP a terminator

Although this was something that I was hoping we would not have to do,
this patch makes t2DoLoopStartTP a terminator in order to keep it at the
end of it's block, so not allowing extra MVE instruction between it and
the end. With t2DoLoopStartTP's also starting tail predication regions,
it also marks them as having side effects. The t2DoLoopStart is still
not a terminator, giving it the extra scheduling freedom that can be
helpful, but now that we have a TP version they can be treated
differently.

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

3 years ago[VE] Add vgt and vsc intrinsic instructions
Kazushi (Jam) Marukawa [Wed, 9 Dec 2020 16:20:40 +0000 (01:20 +0900)]
[VE] Add vgt and vsc intrinsic instructions

Add vgt and vsc intrinsic instructions and regression tests.

Reviewed By: simoll

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

3 years ago[gn build] Port 5663bf201f5
LLVM GN Syncbot [Fri, 11 Dec 2020 09:17:05 +0000 (09:17 +0000)]
[gn build] Port 5663bf201f5

3 years agoRevert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis."
Haojian Wu [Fri, 11 Dec 2020 08:59:37 +0000 (09:59 +0100)]
Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis."

The patch introduced a cycle dependency:

clangAnalysis -> clangFrontend -> clangSema -> clangAnalysis

This reverts commit 00ffea77ad887b576e9db82d98c97a31fee172cb.
This reverts commit ea6641085d025ca0a5cef940465ef14d0ccace02.

3 years ago[gn build] Port 9b76160e53f
LLVM GN Syncbot [Fri, 11 Dec 2020 08:40:54 +0000 (08:40 +0000)]
[gn build] Port 9b76160e53f

3 years ago[Support] Introduce a new InstructionCost class
David Sherwood [Tue, 10 Nov 2020 11:09:20 +0000 (11:09 +0000)]
[Support] Introduce a new InstructionCost class

This is the first in a series of patches that attempts to migrate
existing cost instructions to return a new InstructionCost class
in place of a simple integer. This new class is intended to be
as light-weight and simple as possible, with a full range of
arithmetic and comparison operators that largely mirror the same
sets of operations on basic types, such as integers. The main
advantage to using an InstructionCost is that it can encode a
particular cost state in addition to a value. The initial
implementation only has two states - Normal and Invalid - but these
could be expanded over time if necessary. An invalid state can
be used to represent an unknown cost or an instruction that is
prohibitively expensive.

This patch adds the new class and changes the getInstructionCost
interface to return the new class. Other cost functions, such as
getUserCost, etc., will be migrated in future patches as I believe
this to be less disruptive. One benefit of this new class is that
it provides a way to unify many of the magic costs in the codebase
where the cost is set to a deliberately high number to prevent
optimisations taking place, e.g. vectorization. It also provides
a route to represent the extremely high, and unknown, cost of
scalarization of scalable vectors, which is not currently supported.

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

3 years ago[libc++] Remove invalid use of `#if _LIBCPP_STD_VER >= 11`, as `_LIBCPP_STD_VER`...
Marek Kurdej [Fri, 11 Dec 2020 07:31:04 +0000 (08:31 +0100)]
[libc++] Remove invalid use of `#if _LIBCPP_STD_VER >= 11`, as `_LIBCPP_STD_VER` can never be less than 11.

The relevant part of `__config` is:
```
#ifndef _LIBCPP_STD_VER
#  if  __cplusplus <= 201103L
#    define _LIBCPP_STD_VER 11
```

Reviewed By: ldionne, #libc

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

3 years ago[OpenMPIRBuilder] Fix typo. NFC.
Michael Kruse [Fri, 11 Dec 2020 06:04:12 +0000 (00:04 -0600)]
[OpenMPIRBuilder] Fix typo. NFC.

3 years ago[NFC] Inline maxDevirtIterationsReached()
Arthur Eubanks [Fri, 11 Dec 2020 06:04:49 +0000 (22:04 -0800)]
[NFC] Inline maxDevirtIterationsReached()

This was separated in the past because the cl::opt was in the .cpp file
but DevirtSCCRepeatedPass::run() was in the .h file. Now that
DevirtSCCRepeatedPass::run() is in the .cpp file, get rid of the tiny
maxDevirtIterationsReached(), it's bad for readability.

3 years ago[RISCV] Separate masked and unmasked definitions for pseudo instructions.
Hsiangkai Wang [Thu, 10 Dec 2020 09:06:22 +0000 (17:06 +0800)]
[RISCV] Separate masked and unmasked definitions for pseudo instructions.

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

3 years ago[MemorySSA] Remove unused declaration optimizeUses (NFC)
Kazu Hirata [Fri, 11 Dec 2020 04:54:37 +0000 (20:54 -0800)]
[MemorySSA] Remove unused declaration optimizeUses (NFC)

The declaration was introduced on Aug 2, 2016 in commit
c43aa5a5b62b21c1d38cd3d2ece7d0d5124d5180 without a corresponding
definition.

Note that we do have a definition for
MmeorySSA::OptimizeUses::optimizeUses but not for
MmeorySSA::optimizeUses.