platform/upstream/llvm.git
3 years agoRevert "[clangd] Provide a way to disable external index"
Sterling Augustine [Mon, 12 Apr 2021 21:17:49 +0000 (14:17 -0700)]
Revert "[clangd] Provide a way to disable external index"

This reverts commit 63bc9e443502ab6def2dec0b5ffe64a522f801cc.

This breaks llvm-project/clang-tools-extra/clangd/tool/ClangdMain.cpp:570:11:

with error: enumeration value 'None' not handled in switch [-Werror,-Wswitch]

3 years ago[PhaseOrdering] Add test for SimplifyCFG and LV interaction.
Florian Hahn [Mon, 12 Apr 2021 19:05:39 +0000 (20:05 +0100)]
[PhaseOrdering] Add test for SimplifyCFG and LV interaction.

3 years ago[SimplifyCFG] Add test requiring only hoisting a branch.
Florian Hahn [Mon, 12 Apr 2021 16:58:59 +0000 (17:58 +0100)]
[SimplifyCFG] Add test requiring only hoisting a branch.

3 years ago[ARM] Fix -Wmissing-field-initializers
Fangrui Song [Mon, 12 Apr 2021 21:28:23 +0000 (14:28 -0700)]
[ARM] Fix -Wmissing-field-initializers

3 years ago[mlir][spirv] Fix runtime array stride when emulating bitwidth
Lei Zhang [Mon, 12 Apr 2021 21:08:22 +0000 (17:08 -0400)]
[mlir][spirv] Fix runtime array stride when emulating bitwidth

The stride should be calculated with the converted array element
type, not the original input type.

Reviewed By: mravishankar

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

3 years agoFix up build failures after cfce5b26a888cb979d65252275df1f977dc1e6c8
Jian Cai [Mon, 12 Apr 2021 20:54:13 +0000 (13:54 -0700)]
Fix up build failures after cfce5b26a888cb979d65252275df1f977dc1e6c8

Build log: https://lab.llvm.org/buildbot/#/builders/37/builds/3538

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

3 years ago[mlir][spirv] Allow bitwidth emulation on runtime arrays
Lei Zhang [Mon, 12 Apr 2021 20:50:24 +0000 (16:50 -0400)]
[mlir][spirv] Allow bitwidth emulation on runtime arrays

Runtime arrays are converted from memrefs with unknown
dimensions.

Reviewed By: mravishankar

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

3 years agoRevert "[InstCombine] when calling conventions are compatible, don't convert the...
Nikita Popov [Mon, 12 Apr 2021 20:54:26 +0000 (22:54 +0200)]
Revert "[InstCombine] when calling conventions are compatible, don't convert the call to undef idiom"

This reverts commit f4d682d6ce6c5b3a41a0acf297507c82f5c21eef.

This caused a significant compile-time regression:
https://llvm-compile-time-tracker.com/compare.php?from=4b7bad9eaea2233521a94f6b096aaa88dc584e23&to=f4d682d6ce6c5b3a41a0acf297507c82f5c21eef&stat=instructions

Possibly this is due to overeager parsing of target triples.

3 years ago[mlir] Move memref.subview patterns to MemRef/Transforms/
Lei Zhang [Mon, 12 Apr 2021 20:38:04 +0000 (16:38 -0400)]
[mlir] Move memref.subview patterns to MemRef/Transforms/

These patterns have been used as a prerequisite step for lowering
to SPIR-V. But they don't involve SPIR-V dialect ops; they are
pure memref/vector op transformations. Given now we have a dedicated
MemRef dialect, moving them to Memref/Transforms/, which is a more
suitable place to host them, to allow used by others.

This commit just moves code around and renames patterns/passes
accordingly. CMakeLists.txt for existing MemRef libraries are
also improved along the way.

Reviewed By: mravishankar

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

3 years ago[TSan] Allow test contents to be copied before execution
Julian Lettner [Sat, 10 Apr 2021 01:02:39 +0000 (18:02 -0700)]
[TSan] Allow test contents to be copied before execution

Allow test contents to be copied before execution by using
`%ld_flags_rpath_so`, `%ld_flags_rpath_exe`, and `%dynamiclib`
substitutions.

rdar://76302416

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

3 years ago[InstCombine] fold shift+trunc signbit check
Sanjay Patel [Mon, 12 Apr 2021 20:16:19 +0000 (16:16 -0400)]
[InstCombine] fold shift+trunc signbit check

https://alive2.llvm.org/ce/z/6vQvrP

This solves:
https://llvm.org/PR49866

3 years ago[InstCombine] add tests for shift+trunc signbit check; NFC
Sanjay Patel [Mon, 12 Apr 2021 20:00:50 +0000 (16:00 -0400)]
[InstCombine] add tests for shift+trunc signbit check; NFC

3 years ago[clang-rename] Handle designated initializers.
Daniele Castagna [Mon, 12 Apr 2021 20:15:14 +0000 (13:15 -0700)]
[clang-rename] Handle designated initializers.

clang Tooling, and more specifically Refactoring/Rename, have support
code to extract source locations given a Unified Symbol Resolution set.
This support code is used by clang-rename and other tools that might not
be in the tree.

Currently field designated initializer are not supported.
So, renaming S::a to S::b in this code:

  S s = { .a = 10 };

will not extract the field designated initializer for a (the 'a' after the
dot).

This patch adds support for field designated initialized to
RecursiveSymbolVisitor and RenameLocFinder that is used in
createRenameAtomicChanges.

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

3 years ago[lldb] Disable Shell/Subporcess with reproducers
Jonas Devlieghere [Mon, 12 Apr 2021 18:25:24 +0000 (11:25 -0700)]
[lldb] Disable Shell/Subporcess with reproducers

3 years ago[flang] Correct TypeCode::IsLogical()
peter klausler [Mon, 12 Apr 2021 17:10:38 +0000 (10:10 -0700)]
[flang] Correct TypeCode::IsLogical()

F18 is using the type codes for C's "least" int types to encode
the various kinds of Fortran's LOGICAL intrinsic type; update
the IsLogical() predicate accordingly.  (This member function
isn't yet used anywhere, so this patch is nearly an NFC.)

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

3 years ago[libc++] add `inline` for __open's definition in ifstream and ofstream
jasonliu [Mon, 12 Apr 2021 19:22:12 +0000 (19:22 +0000)]
[libc++] add `inline` for __open's definition in ifstream and ofstream

Summary:

When building with gcc on AIX, it seems that gcc does not like the
`always_inline` without the `inline` keyword.
So adding the inline keywords in for __open in ifstream and ofstream.
That will also make it consistent with __open in basic_filebuf
(it seems we added `inline` there before for gcc build as well).

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

3 years ago[mlir][spirv] Put debug-only variable in LLVM_DEBUG
Lei Zhang [Mon, 12 Apr 2021 19:09:49 +0000 (15:09 -0400)]
[mlir][spirv] Put debug-only variable in LLVM_DEBUG

This avoids paying the cost when building in release.

Reviewed By: hanchung

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

3 years ago[ARM] support symbolic expression as immediate in memory instructions
Jian Cai [Mon, 12 Apr 2021 19:00:01 +0000 (12:00 -0700)]
[ARM] support symbolic expression as immediate in memory instructions

Currently the ARM backend only accpets constant expressions as the
immediate operand in load and store instructions. This allows the
result of symbolic expressions to be used in memory instructions. For
example,

0:
.space 2048
strb r2, [r0, #(.-0b)]

would be assembled into the following instructions.

strb r2, [r0, #2048]

This only adds support to ldr, ldrb, str, and strb in arm mode to
address the build failure of Linux kernel for now, but should facilitate
adding support to similar instructions in the future if the need arises.

Link:
https://github.com/ClangBuiltLinux/linux/issues/1329

Reviewed By: peter.smith, nickdesaulniers

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

3 years ago[PassManager][PhaseOrdering] lower expects before running simplifyCFG
Sanjay Patel [Mon, 12 Apr 2021 18:51:51 +0000 (14:51 -0400)]
[PassManager][PhaseOrdering] lower expects before running simplifyCFG

Retry of 330619a3a623 that includes a clang test update.

Original commit message:

If we run passes before lowering llvm.expect intrinsics to metadata,
then those passes have no way to act on the hints provided by llvm.expect.
SimplifyCFG is the known offender, and we made it smarter about profile
metadata in D98898 <https://reviews.llvm.org/D98898>.

In the motivating example from https://llvm.org/PR49336 , this means we
were ignoring the recommended method for a programmer to tell the compiler
that a compare+branch is expensive. This change appears to solve that case -
the metadata survives to the backend, the compare order is as expected in IR,
and the backend does not do anything to reverse it.

We make the same change to the old pass manager to keep things synchronized.

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

3 years agoEnable creation of large response file on z/OS
Sean Perry [Mon, 12 Apr 2021 19:03:27 +0000 (15:03 -0400)]
Enable creation of large response file on z/OS

Most text processing commands (eg. grep, awk) have a maximum line length limit on z/OS.  The current method of using cc -E & grep fails on z/OS because of this limit.  I'm changing the command to create the long line in the response file to use python.  This avoids the possibility of any tools blocking the generation of the large response file.  This also eliminates the need for the extra file.

Reviewed By: abhina.sreeskantharajan

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

3 years ago[NewPM] Fix -print-changed when a -filter-print-funcs function is removed
Arthur Eubanks [Fri, 9 Apr 2021 21:13:29 +0000 (14:13 -0700)]
[NewPM] Fix -print-changed when a -filter-print-funcs function is removed

-filter-print-funcs -print-changed was crashing after the filter func
was removed by a pass with
  Assertion failed: After.find("*** IR Dump") == 0 && "Unexpected banner format."
We weren't printing the banner because when we have -filter-print-funcs,
we print each function separately, letting the print function filter out
unwanted functions.

Reviewed By: jamieschmeiser

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

3 years ago[AIX] Tweak test XFAIL from D99815
David Tenty [Mon, 12 Apr 2021 18:47:42 +0000 (14:47 -0400)]
[AIX] Tweak test XFAIL from D99815

the test fails on AIX host, not necessarily just the target.

3 years ago[compiler-rt] add SANITIZER_OSX
Emily Shi [Fri, 9 Apr 2021 00:49:22 +0000 (17:49 -0700)]
[compiler-rt] add SANITIZER_OSX

This will allow us to make osx specific changes easier. Because apple silicon macs also run on aarch64, it was easy to confuse it with iOS.

rdar://75302812

Reviewed By: yln

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

3 years ago[mlir][affine] Fix unfolded bounding maps for affine.for
eopXD [Mon, 12 Apr 2021 12:22:58 +0000 (17:52 +0530)]
[mlir][affine] Fix unfolded bounding maps for affine.for

Loop bounds of affine.for didn't perform foldings like affine.load, affine.store.
Bound maps shall be more composed, leaving most affine.apply become dead.

This resolves the bug listed on https://bugs.llvm.org/show_bug.cgi?id=45203

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

3 years agoFix documentation typo.
Richard Smith [Mon, 12 Apr 2021 18:39:08 +0000 (11:39 -0700)]
Fix documentation typo.

3 years ago[libc++] Move checks for newlib to actually work
Mara Sophie Grosch [Mon, 12 Apr 2021 18:19:51 +0000 (14:19 -0400)]
[libc++] Move checks for newlib to actually work

The checks did not work in __config, since no header defining
`_NEWLIB_VERSION` was included before. This patch moves the two
checks for newlib to the headers that actually need it - and after
they already include relevant headers.

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

3 years agoRevert "[PassManager][PhaseOrdering] lower expects before running simplifyCFG"
Sanjay Patel [Mon, 12 Apr 2021 17:58:01 +0000 (13:58 -0400)]
Revert "[PassManager][PhaseOrdering] lower expects before running simplifyCFG"

This reverts commit 330619a3a623d623944c58ebc06cbb83ac0e58af.
There are clang tests that also need to be updated.

3 years ago[Inliner] Propagate SROA analysis through invariant group intrinsics
Arthur Eubanks [Sat, 10 Apr 2021 18:59:04 +0000 (11:59 -0700)]
[Inliner] Propagate SROA analysis through invariant group intrinsics

SROA can handle invariant group intrinsics, let the inliner know that
for better heuristics when the intrinsics are present.

This fixes size issues in a couple files when turning on
-fstrict-vtable-pointers in Chrome.

Reviewed By: rnk, mtrofin

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

3 years agoReplace uses of std::iterator with explicit using
Hamza Sood [Mon, 12 Apr 2021 17:47:14 +0000 (10:47 -0700)]
Replace uses of std::iterator with explicit using

This patch removes all uses of `std::iterator`, which was deprecated in C++17.
While this isn't currently an issue while compiling LLVM, it's useful for those using LLVM as a library.

For some reason there're a few places that were seemingly able to use `std` functions unqualified, which no longer works after this patch. I've updated those places, but I'm not really sure why it worked in the first place.

Reviewed By: MaskRay

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

3 years ago[RISCV] Support vector SET[U]LT and SET[U]GE with splatted immediates
Fraser Cormack [Thu, 8 Apr 2021 10:22:46 +0000 (11:22 +0100)]
[RISCV] Support vector SET[U]LT and SET[U]GE with splatted immediates

This patch adds more optimized codegen for the above SETCC forms,
by matching the '.vi' vector forms when the immediate is a 5-bit signed
immediate plus 1. The immediate can be decremented and the corresponding
SET[U]LE or SET[U]GT forms can be matched.

This work was left as a TODO from D94168.

Reviewed By: craig.topper

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

3 years ago[MLIR] PresburgerSet emptiness check: remove assertions that there are no symbols
Arjun P [Mon, 12 Apr 2021 17:31:15 +0000 (23:01 +0530)]
[MLIR] PresburgerSet emptiness check: remove assertions that there are no symbols

Symbols are now supported in the integer emptiness check. Remove some outdated assertions checking that there are no symbols.

Reviewed By: ftynse

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

3 years ago[mlir] introduce "encoding" attribute to tensor type
Aart Bik [Mon, 12 Apr 2021 16:28:41 +0000 (09:28 -0700)]
[mlir] introduce "encoding" attribute to tensor type

This CL introduces a generic attribute (called "encoding") on tensors.
The attribute currently does not carry any concrete information, but the type
system already correctly determines that tensor<8xi1,123> != tensor<8xi1,321>.
The attribute will be given meaning through an interface in subsequent CLs.

See ongoing discussion on discourse:

[RFC] Introduce a sparse tensor type to core MLIR
https://llvm.discourse.group/t/rfc-introduce-a-sparse-tensor-type-to-core-mlir/2944

A sparse tensor will look something like this:

```
// named alias with all properties we hold dear:
#CSR = {
  // individual named attributes
}

// actual sparse tensor type:
tensor<?x?xf64, #CSR>
```

I see the following rough 5 step plan going forward:

(1) introduce this format attribute in this CL, currently still empty
(2) introduce attribute interface that gives it "meaning", focused on sparse in first phase
(3) rewrite sparse compiler to use new type, remove linalg interface and "glue"
(4) teach passes to deal with new attribute, by rejecting/asserting on non-empty attribute as simplest solution, or doing meaningful rewrite in the longer run
(5) add FE support, document, test, publicize new features, extend "format" meaning to other domains if useful

Reviewed By: stellaraccident, bondhugula

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

3 years ago[mlir] Rename AVX512 dialect to X86Vector
Emilio Cota [Mon, 12 Apr 2021 17:15:35 +0000 (19:15 +0200)]
[mlir] Rename AVX512 dialect to X86Vector

We will soon be adding non-AVX512 operations to MLIR, such as AVX's rsqrt. In https://reviews.llvm.org/D99818 several possibilities were discussed, namely to (1) add non-AVX512 ops to the AVX512 dialect, (2) add more dialects (e.g. AVX dialect for AVX rsqrt), and (3) expand the scope of the AVX512 to include these SIMD x86 ops, thereby renaming the dialect to something more accurate such as X86Vector.

Consensus was reached on option (3), which this patch implements.

Reviewed By: aartbik, ftynse, nicolasvasilache

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

3 years ago[mlir][Linalg] Disable const -> linalg.generic when fused op is illegal.
MaheshRavishankar [Mon, 12 Apr 2021 15:49:45 +0000 (08:49 -0700)]
[mlir][Linalg] Disable const -> linalg.generic when fused op is illegal.

Fusing a constant with a linalg.generic operation can result in the
fused operation being illegal since the loop bound computation
fails. Avoid such fusions.

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

3 years ago[asan] Replaceable new/delete is unsupported in Windows.
Mitch Phillips [Mon, 12 Apr 2021 16:49:28 +0000 (09:49 -0700)]
[asan] Replaceable new/delete is unsupported in Windows.

Mark the test as unsupported to bring the bot online. Could probably be
permanently fixed by using one of the workarounds already present in
compiler-rt.

3 years agoFix nits.
Alexander Kornienko [Mon, 12 Apr 2021 16:28:01 +0000 (18:28 +0200)]
Fix nits.

3 years ago[clang-tidy] Add option to ignore macros in readability-function-cognitive-complexity...
Jens Massberg [Mon, 12 Apr 2021 16:25:29 +0000 (18:25 +0200)]
[clang-tidy] Add option to ignore macros in readability-function-cognitive-complexity check.

(this was originally part of https://reviews.llvm.org/D96281 and has been split off into its own patch)

If a macro is used within a function, the code inside the macro
doesn't make the code less readable. Instead, for a reader a macro is
more like a function that is called. Thus the code inside a macro
shouldn't increase the complexity of the function in which it is called.
Thus the flag 'IgnoreMacros' is added. If set to 'true' code inside
macros isn't considered during analysis.

This isn't perfect, as now the code of a macro isn't considered at all,
even if it has a high cognitive complexity itself. It might be better if
a macro is considered in the analysis like a function and gets its own
cognitive complexity. Implementing such an analysis seems to be very
complex (if possible at all with the given AST), so we give the user the
option to either ignore macros completely or to let the expanded code
count to the calling function's complexity.

See the code example from vgeof (originally added as note in https://reviews.llvm.org/D96281)

   bool doStuff(myClass* objectPtr){
         if(objectPtr == nullptr){
             LOG_WARNING("empty object");
             return false;
         }
         if(objectPtr->getAttribute() == nullptr){
             LOG_WARNING("empty object");
             return false;
         }
         use(objectPtr->getAttribute());
     }

The LOG_WARNING macro itself might have a high complexity, but it do not make the
the function more complex to understand like e.g. a 'printf'.

By default 'IgnoreMacros' is set to 'false', which is the original behavior of the check.

Reviewed By: lebedev.ri, alexfh

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

3 years ago[flang] Fix narrowing warning on macos
Tim Keith [Mon, 12 Apr 2021 16:40:51 +0000 (09:40 -0700)]
[flang] Fix narrowing warning on macos

With clang 11 on macos we were getting this warning:
```
flang/runtime/random.cpp:61:30: error: non-constant-expression cannot be narrowed from type 'unsigned long long' to 'runtime::GeneratedWord' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
          GeneratedWord word{(generator() - generator.min()) & rangeMask};
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flang/runtime/random.cpp:99:5: note: in instantiation of function template specialization 'runtime::Generate<double, 53>' requested here
    Generate<CppTypeFor<TypeCategory::Real, 8>, 53>(harvest);
    ^
```

Changing the type of `rangeMask` fixes it.

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

3 years agoAllow applying attributes to subset of allowed subjects.
Artem Belevich [Thu, 8 Apr 2021 20:12:10 +0000 (13:12 -0700)]
Allow applying attributes to subset of allowed subjects.

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

3 years ago[InstCombine] when calling conventions are compatible, don't convert the call to...
Yuanfang Chen [Thu, 1 Apr 2021 07:10:43 +0000 (00:10 -0700)]
[InstCombine] when calling conventions are compatible, don't convert the call to undef idiom

D24453 enabled libcalls simplication for ARM PCS. This may cause
caller/callee calling conventions mismatch in some situations such as
LTO. This patch makes instcombine aware that the compatible calling
conventions differences are benign (not emitting undef idom).

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

3 years ago[libc++] Implement D2351R0 "Mark all library static cast wrappers as [[nodiscard]]"
Arthur O'Dwyer [Mon, 5 Apr 2021 18:56:03 +0000 (14:56 -0400)]
[libc++] Implement D2351R0 "Mark all library static cast wrappers as [[nodiscard]]"

These [[nodiscard]] annotations are added as a conforming extension;
it's unclear whether the paper will actually be adopted and make them
mandatory, but they do seem like good ideas regardless.

https://isocpp.org/files/papers/D2351R0.pdf

This patch implements the paper's effect on:
- std::to_integer, std::to_underlying
- std::forward, std::move, std::move_if_noexcept
- std::as_const
- std::identity

The paper also affects (but libc++ does not yet have an implementation of):
- std::bit_cast

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

3 years ago[libc++] [test] Detect an improperly noexcept'ed __decay_copy.
Arthur O'Dwyer [Sun, 11 Apr 2021 22:38:24 +0000 (18:38 -0400)]
[libc++] [test] Detect an improperly noexcept'ed __decay_copy.

`__decay_copy` is used by `std::thread`'s constructor to copy its arguments
into the new thread. If `__decay_copy` claims to be noexcept, but then
copying the argument does actually throw, we'd call std::terminate instead
of passing this test. (And I've verified that adding an unconditional `noexcept`
to `__decay_copy` does indeed fail this test.)

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

3 years ago[PassManager][PhaseOrdering] lower expects before running simplifyCFG
Sanjay Patel [Mon, 12 Apr 2021 16:20:32 +0000 (12:20 -0400)]
[PassManager][PhaseOrdering] lower expects before running simplifyCFG

If we run passes before lowering llvm.expect intrinsics to metadata,
then those passes have no way to act on the hints provided by llvm.expect.
SimplifyCFG is the known offender, and we made it smarter about profile
metadata in D98898.

In the motivating example from https://llvm.org/PR49336 , this means we
were ignoring the recommended method for a programmer to tell the compiler
that a compare+branch is expensive. This change appears to solve that case -
the metadata survives to the backend, the compare order is as expected in IR,
and the backend does not do anything to reverse it.

We make the same change to the old pass manager to keep things synchronized.

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

3 years ago[ARM] Add a number of intrinsics for MVE lane interleaving
David Green [Mon, 12 Apr 2021 16:23:02 +0000 (17:23 +0100)]
[ARM] Add a number of intrinsics for MVE lane interleaving

Add a number of intrinsics which natively lower to MVE operations to the
lane interleaving pass, allowing it to efficiently interleave the lanes
of chucks of operations containing these intrinsics.

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

3 years agoReapply "[DebugInfo] Use variadic debug values to salvage BinOps and GEP instrs with...
Stephen Tozer [Thu, 11 Mar 2021 15:01:37 +0000 (15:01 +0000)]
Reapply "[DebugInfo] Use variadic debug values to salvage BinOps and GEP instrs with non-const operands"

The causes of the previous build errors have been fixed in revisions
aa3e78a59fdf3b211be72f1b3221af831665e67d, and
140757bfaaa00110a92d2247a910c847e6e3bcc8

This reverts commit f40976bd01032f4905dde361e709166704581077.

3 years ago[libc++] Divorce the std Lit feature from the -std=XXX compiler flag
Louis Dionne [Fri, 9 Apr 2021 15:41:28 +0000 (11:41 -0400)]
[libc++] Divorce the std Lit feature from the -std=XXX compiler flag

After this patch, we can use `--param std=c++20` even if the compiler only
supports -std=c++2a. The test suite will handle that for us. The only Lit
feature that isn't fully baked will always be the "in development" one,
since we don't know exactly what year the standard will be ratified in.

This is another take on https://reviews.llvm.org/D99789.

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

3 years ago[gn build] Port 6a1ac88fc19a
LLVM GN Syncbot [Mon, 12 Apr 2021 15:51:13 +0000 (15:51 +0000)]
[gn build] Port 6a1ac88fc19a

3 years ago[gn build] Port 26beecfe470b
LLVM GN Syncbot [Mon, 12 Apr 2021 15:51:12 +0000 (15:51 +0000)]
[gn build] Port 26beecfe470b

3 years ago[gn build] Port 0b439e4cc9db
LLVM GN Syncbot [Mon, 12 Apr 2021 15:51:11 +0000 (15:51 +0000)]
[gn build] Port 0b439e4cc9db

3 years ago[libc++] NFC: Remove duplicate synopsis from <__string>
Louis Dionne [Mon, 12 Apr 2021 15:49:43 +0000 (11:49 -0400)]
[libc++] NFC: Remove duplicate synopsis from <__string>

3 years ago[libc++] Split std::get_temporary_buffer out of <memory>
Louis Dionne [Fri, 9 Apr 2021 16:58:00 +0000 (12:58 -0400)]
[libc++] Split std::get_temporary_buffer out of <memory>

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

3 years ago[libc++] Split std::allocator out of <memory>
Louis Dionne [Fri, 9 Apr 2021 16:48:34 +0000 (12:48 -0400)]
[libc++] Split std::allocator out of <memory>

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

3 years ago[libc++] Split auto_ptr out of <memory>
Louis Dionne [Fri, 9 Apr 2021 16:44:26 +0000 (12:44 -0400)]
[libc++] Split auto_ptr out of <memory>

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

3 years ago[docs] Add Windows/COFF call info
Kristof Beyls [Mon, 12 Apr 2021 15:07:02 +0000 (17:07 +0200)]
[docs] Add Windows/COFF call info

3 years ago[InstCombine] Regenerate select-ctlz-to-cttz.ll tests
Simon Pilgrim [Mon, 12 Apr 2021 14:31:48 +0000 (15:31 +0100)]
[InstCombine] Regenerate select-ctlz-to-cttz.ll tests

Correctly test !range metadata

3 years ago[X86] Fold cmpeq/ne(trunc(logic(x)),0) --> cmpeq/ne(logic(x),0)
Simon Pilgrim [Mon, 12 Apr 2021 13:56:10 +0000 (14:56 +0100)]
[X86] Fold cmpeq/ne(trunc(logic(x)),0) --> cmpeq/ne(logic(x),0)

Fixes the issues noted in PR48768, where the and/or/xor instruction had been promoted to avoid i8/i16 partial-dependencies, but the test against zero had not.

We can almost certainly relax this fold to work for any truncation, although it breaks a number of existing folds (notable movmsk folds which tend to rely on the truncate to determine the demanded bits/elts in the source vector).

There is a reverse combine in TargetLowering.SimplifySetCC so we must wait until after legalization before attempting this.

3 years ago[compiler-rt][aarch64] Add PAC-RET/BTI support to HWASAN.
Daniel Kiss [Mon, 12 Apr 2021 15:02:16 +0000 (17:02 +0200)]
[compiler-rt][aarch64] Add PAC-RET/BTI support to HWASAN.

Support for -mbranch-protection.

Reviewed By: eugenis

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

3 years ago[clangd] Provide a way to disable external index
Kadir Cetinkaya [Thu, 8 Apr 2021 13:50:50 +0000 (15:50 +0200)]
[clangd] Provide a way to disable external index

Users can reset any external index set by previous fragments by
putting a `None` for the external block, e.g:

```
Index:
  External: None
```

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

3 years ago[X86][AMX] Hoist ldtilecfg
Wang, Pengfei [Mon, 12 Apr 2021 14:08:27 +0000 (22:08 +0800)]
[X86][AMX] Hoist ldtilecfg

The previous code calculated the first ldtilecfg by dominating all AMX registers' def. This may result in the ldtilecfg being inserted into a loop.

This patch try to calculate the nearest point where all shapes of AMX registers are reachable.

Reviewed By: LuoYuanke

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

3 years ago[ARM] Add FP handling for MVE lane interleaving
David Green [Mon, 12 Apr 2021 14:28:13 +0000 (15:28 +0100)]
[ARM] Add FP handling for MVE lane interleaving

FP16 to FP32 converts can be handled in MVE lane interleaving, much like
the sext/zext lowering we do. This expands the pass with fpext and
fptrunc handling, and basic fp operations allowing more efficient
lowering of fp vectors.

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

3 years ago[NFC] Remove redundant string copy
Nathan James [Mon, 12 Apr 2021 14:13:59 +0000 (15:13 +0100)]
[NFC] Remove redundant string copy

3 years ago[ARM] Updates to arm-block-placement pass
Malhar Jajoo [Mon, 12 Apr 2021 13:46:23 +0000 (14:46 +0100)]
[ARM] Updates to arm-block-placement pass

The patch makes two updates to the arm-block-placement pass:
- Handle arbitrarily nested loops
- Extends the search (for t2WhileLoopStartLR) to the predecessor of the
  preHeader.

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

3 years ago[TableGen] Fix bug in recent change to ListInit::convertInitListSlice()
Paul C. Anagnostopoulos [Fri, 9 Apr 2021 15:59:18 +0000 (11:59 -0400)]
[TableGen] Fix bug in recent change to ListInit::convertInitListSlice()

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

3 years ago[mlir][linalg] adding operation to access the iteration index of enclosing linalg...
Tobias Gysi [Mon, 12 Apr 2021 13:13:27 +0000 (13:13 +0000)]
[mlir][linalg] adding operation to access the iteration index of enclosing linalg ops.

The `linalg.index` operation provides access to the iteration indexes of immediately enclosing linalg operations. It takes a dimension `dim` attribute and returns the iteration index in the given dimension. Having `linalg.index` allows us to unify `linalg.generic` and `linalg.indexed_generic` and also enables index access in named operations.

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

3 years agoRevert "[AArch64] Add Machine InstCombiner patterns for FMUL indexed variant"
Andrew Savonichev [Mon, 12 Apr 2021 13:28:49 +0000 (16:28 +0300)]
Revert "[AArch64] Add Machine InstCombiner patterns for FMUL indexed variant"

This reverts commit cca9b5985c0c7e3c34da7f2db7cc8e7e707b0e2e.

Buildbot reported an error for CodeGen/AArch64/machine-combiner-fmul-dup.mir:

*** Bad machine code: Virtual register killed in block, but needed live out. ***
- function:    indexed_2s
- basic block: %bb.0 entry (0x640fee8)
Virtual register %7 is used after the block.

*** Bad machine code: Virtual register defs don't dominate all uses. ***
- function:    indexed_2s
- v. register: %7
LLVM ERROR: Found 2 machine code errors.

3 years ago[AArch64] Add Machine InstCombiner patterns for FMUL indexed variant
Andrew Savonichev [Wed, 31 Mar 2021 12:25:27 +0000 (15:25 +0300)]
[AArch64] Add Machine InstCombiner patterns for FMUL indexed variant

This patch adds DUP+FMUL => FMUL_indexed pattern to InstCombiner.
FMUL_indexed is normally selected during instruction selection, but it
does not work in cases when VDUP and VMUL are in different basic
blocks.

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

3 years ago[lldb] Delete dead StackFrameList::Merge
Raphael Isemann [Mon, 12 Apr 2021 12:40:58 +0000 (14:40 +0200)]
[lldb] Delete dead StackFrameList::Merge

That code is unused since it's check-in in 2010 (and I believe it would leak
memory when called as it releases the passed unique_ptr), so let's delete it.

Reviewed By: vsk

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

3 years ago[lldb] Don't recursively load types of static member variables in the DWARF AST parser
Raphael Isemann [Mon, 12 Apr 2021 12:32:38 +0000 (14:32 +0200)]
[lldb] Don't recursively load types of static member variables in the DWARF AST parser

When LLDB's DWARF parser is parsing the member DIEs of a struct/class it
currently fully resolves the types of static member variables in a class before
adding the respective `VarDecl` to the record.

For record types fully resolving the type will also parse the member DIEs of the
respective class. The other way of resolving is just 'forward' resolving the type
which will try to load only the minimum amount of information about the type
(for records that would only be the name/kind of the type). Usually we always
resolve types on-demand so it's rarely useful to speculatively fully resolve
them on the first use.

This patch changes makes that we only 'forward' resolve the types of static
members. This solves the fact that LLDB unnecessarily loads debug information
to parse the type if it's maybe not needed later and it also avoids a crash where
the parsed type might in turn reference the surrounding class that is currently
being parsed.

The new test case demonstrates the crash that might happen. The crash happens
with the following steps:

1. We parse class `ToLayout` and it's members.

2. We parse the static class member and fully resolve its type
(`DependsOnParam2<ToLayout>`).

3. That type has a non-static class member `DependsOnParam1<ToLayout>` for which
LLDB will try to calculate the size.

4. The layout (and size)`DependsOnParam1<ToLayout>` turns depends on the
`ToLayout` size/layout.

5. Clang will calculate the record layout/size for `ToLayout` even though we are
currently parsing it and it's missing it's non-static member.

The created is missing the offset for the yet unparsed non-static member. If we
later try to get the offset we end up hitting different asserts. Most common is
the one in `TypeSystemClang::DumpValue` where it checks that the record layout
has offsets for the current FieldDecl.

```
        assert(field_idx < record_layout.getFieldCount());
```

Fixed rdar://67910011

Reviewed By: shafik

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

3 years agoFix chrome os failure after 021de7cf80268091cf13485a538b611b37d0b33e.
Alexey Lapshin [Mon, 12 Apr 2021 11:27:14 +0000 (14:27 +0300)]
Fix chrome os failure after 021de7cf80268091cf13485a538b611b37d0b33e.

chrome os build failed after D98511:
https://bugs.chromium.org/p/chromium/issues/detail?id=1197970

This patch fixes permission issue appeared after D98511.

3 years ago[AMDGPU] Kill temporary register after restoring
Sebastian Neubauer [Mon, 12 Apr 2021 12:20:03 +0000 (14:20 +0200)]
[AMDGPU] Kill temporary register after restoring

Not a correctness issue, but the temporary register is not used
afterwards and should be dead.

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

3 years ago[AArch64][SVE] Remove redundant PTEST of MATCH/NMATCH results
Bradley Smith [Tue, 30 Mar 2021 12:14:36 +0000 (13:14 +0100)]
[AArch64][SVE] Remove redundant PTEST of MATCH/NMATCH results

Co-authored-by: Paul Walker <paul.walker@arm.com>
Differential Revision: https://reviews.llvm.org/D99584

3 years agoReapply "[DebugInfo] Correctly track SDNode dependencies for list debug values"
Stephen Tozer [Thu, 8 Apr 2021 16:56:25 +0000 (17:56 +0100)]
Reapply "[DebugInfo] Correctly track SDNode dependencies for list debug values"

Fixed memory leak error by using BumpAllocator for SDDbgValue arrays.

This reverts commit 1b589172bd19b83e8137185ed11f50bba06e8766.

3 years agoReland [DebugInfo] Fix the mismatching between C++ language tags and Dwarf versions.""
Esme-Yi [Mon, 12 Apr 2021 11:05:55 +0000 (11:05 +0000)]
Reland [DebugInfo] Fix the mismatching between C++ language tags and Dwarf versions.""

This reverts commit c965e14a12955355ead9ea093989a8fcbf03a8c1.

3 years agoRevert "[DebugInfo] Fix the mismatching between C++ language tags and Dwarf versions."
Esme-Yi [Mon, 12 Apr 2021 10:36:46 +0000 (10:36 +0000)]
Revert "[DebugInfo] Fix the mismatching between C++ language tags and Dwarf versions."

This reverts commit 62fa9b9388aa114e3b1a58bbdbcd966ae3492ba5.

3 years ago[mlir][linalg] fixing hard-coded variable names in a test (NFC)
Tobias Gysi [Mon, 12 Apr 2021 09:35:26 +0000 (09:35 +0000)]
[mlir][linalg] fixing hard-coded variable names in a test (NFC)

The patch fixes hard-coded variable names in the vector-to-loops test.

3 years ago[AMDGPU][MC][NFC] Removed extra spaces
Dmitry Preobrazhensky [Mon, 12 Apr 2021 10:30:29 +0000 (13:30 +0300)]
[AMDGPU][MC][NFC] Removed extra spaces

Fixed bugs 49646, 49647.

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

3 years ago[IR] Fix Wdocumentation warning. NFCI.
Simon Pilgrim [Mon, 12 Apr 2021 10:20:32 +0000 (11:20 +0100)]
[IR] Fix Wdocumentation warning. NFCI.

3 years ago[AArch64] ACLE: Fix issue for mismatching enum types with builtins.
Sander de Smalen [Mon, 12 Apr 2021 08:49:00 +0000 (09:49 +0100)]
[AArch64] ACLE: Fix issue for mismatching enum types with builtins.

This patch fixes an issue with the SVE prefetch and qinc/qdec intrinsics
that take an `enum` argument, but where the builtin prototype encodes
these as `int`. Some code in SemaDecl found the mismatch and chose
to forget about the builtin altogether, which meant that any future
code using that builtin would fail. The code that forgets about the
builtin was actually obsolete after D77491 and should have been removed.
This patch now removes that code.

This patch also fixes another issue with the SVE prefetch intrinsic
when built with C++, where the builtin didn't accept the correct
pointer type, which should be `const void *`.

Reviewed By: tambre

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

3 years ago[AMDGPU] Fix ubsan error
Sebastian Neubauer [Mon, 12 Apr 2021 10:10:32 +0000 (12:10 +0200)]
[AMDGPU] Fix ubsan error

The RegScavenger can be null sometimes, so a pointer is needed.

Fixes UBSan error introduced in f9a8c6a0e505.

3 years ago[LLDB] Fix buildbots breakage due to TestGuessLanguage.py
Muhammad Omair Javaid [Mon, 12 Apr 2021 10:10:41 +0000 (15:10 +0500)]
[LLDB] Fix buildbots breakage due to TestGuessLanguage.py

Fix LLDB buidbot breakage due to D99250.

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

3 years ago[AMDGPU] Fix saving fp and bp
Sebastian Neubauer [Mon, 12 Apr 2021 09:47:16 +0000 (11:47 +0200)]
[AMDGPU] Fix saving fp and bp

Spilling the fp or bp to scratch could overwrite VGPRs of inactive
lanes. Fix that by using only the active lanes of the scavenged VGPR.

This builds on the assumptions that
1. a function is never called with exec=0
2. lanes do not die in a function, i.e. exec!=0 in the function epilog
3. no new lanes are active when exiting the function, i.e. exec in the
   epilog is a subset of exec in the prolog.

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

3 years ago[AMDGPU] Autogenerate test. NFC
Sebastian Neubauer [Mon, 12 Apr 2021 09:51:28 +0000 (11:51 +0200)]
[AMDGPU] Autogenerate test. NFC

3 years ago[AMDGPU] Unify spill code
Sebastian Neubauer [Mon, 12 Apr 2021 09:19:04 +0000 (11:19 +0200)]
[AMDGPU] Unify spill code

Instead of reimplementing spilling in prolog and epilog, reuse
buildSpillLoadStore.

Reviewed By: scott.linder

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

3 years ago[AMDGPU] Save VGPR of whole wave when spilling
Sebastian Neubauer [Mon, 12 Apr 2021 08:25:54 +0000 (10:25 +0200)]
[AMDGPU] Save VGPR of whole wave when spilling

Spilling SGPRs to scratch uses a temporary VGPR. LLVM currently cannot
determine if a VGPR is used in other lanes or not, so we need to save
all lanes of the VGPR. We even need to save the VGPR if it is marked as
dead.

The generated code depends on two things:
- Can we scavenge an SGPR to save EXEC?
- And can we scavenge a VGPR?

If we can scavenge an SGPR, we
- save EXEC into the SGPR
- set the needed lane mask
- save the temporary VGPR
- write the spilled SGPR into VGPR lanes
- save the VGPR again to the target stack slot
- restore the VGPR
- restore EXEC

If we were not able to scavenge an SGPR, we do the same operations, but
everytime the temporary VGPR is written to memory, we
- write VGPR to memory
- flip exec (s_not exec, exec)
- write VGPR again (previously inactive lanes)

Surprisingly often, we are able to scavenge an SGPR, even though we are
at the brink of running out of SGPRs.
Scavenging a VGPR does not have a great effect (saves three instructions
if no SGPR was scavenged), but we need to know if the VGPR we use is
live before or not, otherwise the machine verifier complains.

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

3 years ago[OpenCL] Accept .rgba in OpenCL 3.0
Sven van Haastregt [Mon, 12 Apr 2021 08:30:06 +0000 (09:30 +0100)]
[OpenCL] Accept .rgba in OpenCL 3.0

The .rgba vector component accessors are supported in OpenCL C 3.0.

Previously, the diagnostic would check `OpenCLVersion` for version 2.2
(value 220) and report those accessors are an OpenCL 2.2 feature.
However, there is no "OpenCL C version 2.2", so change the check and
diagnostic text to 3.0 only.

A spurious `OpenCLVersion` argument was passed into the diagnostic;
remove that.

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

3 years ago[AArch64] Adds memory operands for indexed loads.
Stelios Ioannou [Fri, 9 Apr 2021 16:36:20 +0000 (17:36 +0100)]
[AArch64] Adds memory operands for indexed loads.

This patch adds the memory operands for indexed loads so
that certain optimizations can take place.

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

Change-Id: I539fcf046ca4ad1e7df1d893f57d751419d8364d

3 years ago[DebugInfo] Fix the mismatching between C++ language tags and Dwarf versions.
Esme-Yi [Mon, 12 Apr 2021 07:42:54 +0000 (07:42 +0000)]
[DebugInfo] Fix the mismatching between C++ language tags and Dwarf versions.

Summary: The tags DW_LANG_C_plus_plus_14 and DW_LANG_C_plus_plus_11, introduced in Dwarf-5, are unexpected in previous versions. Fixing the mismathing doesn't have any drawbacks for any other debuggers, but helps dbx.

Reviewed By: aprantl, shchenz

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

3 years ago[clang][AST] Handle overload callee type in CallExpr::getCallReturnType.
Balázs Kéri [Mon, 12 Apr 2021 06:52:40 +0000 (08:52 +0200)]
[clang][AST] Handle overload callee type in CallExpr::getCallReturnType.

The function did not handle every case. In some cases this
caused assertion failure.
After the fix the function returns DependentTy if the exact
return type can not be determined.

It seems that clang itself does not call the function in the
affected cases but some checker or other code may call it.

Reviewed By: hokein

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

3 years ago[NFC][Debug] Fix unnecessary deep-copy for vector to save compiling time
Zhang Qing Shan [Mon, 12 Apr 2021 06:55:03 +0000 (14:55 +0800)]
[NFC][Debug] Fix unnecessary deep-copy for vector to save compiling time

We saw some big compiling time impact after enabling the debug entry value
feature for X86 platform(D73534). Compiling time goes from 900s->1600s with
our testcase. It is caused by allocating/freeing the memory busily.

'using FwdRegWorklist = MapVector<unsigned, SmallVector<FwdRegParamInfo, 2>>;'
The value for this map is vector, and we miss the reference when access the
element. The same happens for `auto CalleesMap = MF->getCallSitesInfo();` which is a DenseMap.

Reviewed by: djtodoro, flychen50

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

3 years ago[libtooling][clang-tidy] Fix compiler warnings in testcase [NFC]
Mikael Holmen [Mon, 12 Apr 2021 06:23:47 +0000 (08:23 +0200)]
[libtooling][clang-tidy] Fix compiler warnings in testcase [NFC]

Without the fix we get:

06:31:09 In file included from ../../clang-tools-extra/unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp:3:
06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1392:11: error: comparison of integers of different signs: 'const int' and 'const unsigned int' [-Werror,-Wsign-compare]
06:31:09   if (lhs == rhs) {
06:31:09       ~~~ ^  ~~~
06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1421:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<int, unsigned int>' requested here
06:31:09     return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
06:31:09            ^
06:31:09 ../../clang-tools-extra/unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp:60:3: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<int, unsigned int>' requested here
06:31:09   EXPECT_EQ(4, Errors[0].Message.FileOffset);
06:31:09   ^
06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1924:63: note: expanded from macro 'EXPECT_EQ'
06:31:09                       EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
06:31:09                                                               ^
06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1392:11: error: comparison of integers of different signs: 'const int' and 'const unsigned long' [-Werror,-Wsign-compare]
06:31:09   if (lhs == rhs) {
06:31:09       ~~~ ^  ~~~
06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1421:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<int, unsigned long>' requested here
06:31:09     return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
06:31:09            ^
06:31:09 ../../clang-tools-extra/unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp:64:3: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<int, unsigned long>' requested here
06:31:09   EXPECT_EQ(1, Errors[0].Message.Ranges.size());
06:31:09   ^
06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1924:63: note: expanded from macro 'EXPECT_EQ'
06:31:09                       EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
06:31:09                                                               ^
06:31:09 2 errors generated.

3 years ago[NFC] [Clang]: fix spelling mistake in assert message
Jim Lin [Mon, 12 Apr 2021 06:10:52 +0000 (14:10 +0800)]
[NFC] [Clang]: fix spelling mistake in assert message

Reviewed By: Jim

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

3 years agofix typo in a CMake SANITIZER_CAN_USE_CXXABI variable initial definition
Jim Lin [Mon, 12 Apr 2021 06:04:38 +0000 (14:04 +0800)]
fix typo in a CMake SANITIZER_CAN_USE_CXXABI variable initial definition

The current variable name isn't used anywhere else, which indicates it's
a typo.  Let's fix it before someone copy+pastes it somewhere else.

Reviewed By: Jim

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

3 years ago[X86] Pass to transform tdpbsud&tdpbusd&tdpbuud intrinsics to scalar operation
Bing1 Yu [Wed, 24 Mar 2021 08:53:12 +0000 (16:53 +0800)]
[X86] Pass to transform tdpbsud&tdpbusd&tdpbuud intrinsics to scalar operation

Reviewed By: pengfei

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

3 years ago[NARY] Don't optimize min/max if there are side uses
Evgeniy Brevnov [Fri, 9 Apr 2021 08:41:27 +0000 (15:41 +0700)]
[NARY] Don't optimize min/max if there are side uses

Say we have
%1=min(%a,%b)
%2=min(%b,%c)
%3=min(%2,%a)

The optimization will try to reassociate the later one so that we can rewrite it to %3=min(%1, %c) and remove %2.
But if %2 has another uses outside of %3 then we can't remove %2 and end up with:

%1=min(%a,%b)
%2=min(%b,%c)
%3=min(%1, %c)

This doesn't harm by itself except it is not profitable and changes IR for no good reason.
What is bad it triggers next iteration which finds out that optimization is applicable to %2 and %3 and generates:

%1=min(%a,%b)
%2=min(%b,%c)
%3=min(%1,%c)
%4=min(%2,%a)

and so on...

The solution is to prevent optimization in the first place if intermediate result (%2) has side uses and
known to be not removed.

Reviewed By: mkazantsev

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

3 years ago[X86] Remove FeatureCLWB from FeaturesICLClient
Freddy Ye [Mon, 12 Apr 2021 02:36:08 +0000 (10:36 +0800)]
[X86] Remove FeatureCLWB from FeaturesICLClient

Reviewed By: craig.topper

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

3 years ago[lld-macho][nfc] Convert tabs to spaces
Jez Ng [Mon, 12 Apr 2021 03:23:37 +0000 (23:23 -0400)]
[lld-macho][nfc] Convert tabs to spaces

3 years ago[Debug-Info] make fortran CHARACTER(1) type as valid unsigned type
Chen Zheng [Mon, 12 Apr 2021 03:13:17 +0000 (23:13 -0400)]
[Debug-Info] make fortran CHARACTER(1) type as valid unsigned type

This resolves https://bugs.llvm.org/show_bug.cgi?id=49872

Reviewed By: aprantl

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

3 years ago[Clang][Coroutine][DebugInfo] In c++ coroutine, clang will emit different debug info...
yifeng.dongyifeng [Mon, 12 Apr 2021 02:59:22 +0000 (10:59 +0800)]
[Clang][Coroutine][DebugInfo] In c++ coroutine, clang will emit different debug info variables for parameters and move-parameters.

The first one is the real parameters of the coroutine function, the
other one just for copying parameters to the coroutine frame.

Considering the following c++ code:
```
struct coro {
  ...
};

coro foo(struct test & t) {
  ...
  co_await suspend_always();
    ...
    co_await suspend_always();
    ...
    co_await suspend_always();
}

int main(int argc, char *argv[]) {
  auto c = foo(...);
    c.handle.resume();
      ...
  }
```

Function foo is the standard coroutine function, and it has only
one parameter named t (ignoring this at first),
when we use the llvm code to compile this function, we can get the
following ir:

```
!2921 = distinct !DISubprogram(name: "foo", linkageName:
"_ZN6Object3fooE4test", scope: !2211, file: !45, li\
ne: 48, type: !2329, scopeLine: 48, flags: DIFlagPrototyped |
DIFlagAllCallsDescribed, spFlags: DISPFlagDefi\
nition | DISPFlagOptimized, unit: !44, declaration: !2328,
retainedNodes: !2922)
!2924 = !DILocalVariable(name: "t", arg: 2, scope: !2921, file: !45,
line: 48, type: !838)
...
!2926 = !DILocalVariable(name: "t", scope: !2921, type: !838, flags:
DIFlagArtificial)
```
We can find there are two `the same` DIVariable named t in the same
dwarf scope for foo.resume.
And when we try to use llvm-dwarfdump to dump the dwarf info of this
elf, we get the following output:

```
0x00006684:   DW_TAG_subprogram
                DW_AT_low_pc    (0x00000000004013a0)
                DW_AT_high_pc   (0x00000000004013a8)
                DW_AT_frame_base        (DW_OP_reg7 RSP)
                DW_AT_object_pointer    (0x0000669c)
                DW_AT_GNU_all_call_sites        (true)
                DW_AT_specification     (0x00005b5c "_ZN6Object3fooE4test")

0x000066a5:     DW_TAG_formal_parameter
                DW_AT_name    ("t")
                DW_AT_decl_file       ("/disk1/yifeng.dongyifeng/my_code/llvm/build/bin/coro-debug-1.cpp")
                DW_AT_decl_line       (48)
                DW_AT_type    (0x00004146 "test")

0x000066ba:     DW_TAG_variable
                  DW_AT_name    ("t")
                  DW_AT_type    (0x00004146 "test")
                  DW_AT_artificial      (true)
```
The elf also has two 't' in the same scope.
But unluckily, it might let the debugger
confused. And failed to print parameters for O0 or above.
This patch will make coroutine parameters and move
parameters use the same DIVar and try to fix the problems
that I mentioned before.

Test Plan: check-clang

Reviewed By: aprantl, jmorse

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

3 years ago[PowerPC] Lower f128 SETCC/SELECT_CC as libcall if p9vector disabled
Qiu Chaofan [Mon, 12 Apr 2021 02:31:07 +0000 (10:31 +0800)]
[PowerPC] Lower f128 SETCC/SELECT_CC as libcall if p9vector disabled

XSCMPUQP is not available for pre-P9 subtargets. This patch will lower
them into libcall for correct behavior on power7/power8.

Reviewed By: steven.zhang

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

3 years ago[RISCV][Clang] Add some RVV Permutation intrinsic functions.
Zakk Chen [Thu, 8 Apr 2021 17:15:09 +0000 (10:15 -0700)]
[RISCV][Clang] Add some RVV Permutation intrinsic functions.

Support the following instructions.
1. Vector Slide Instructions
2. Vector Register Gather Instructions
3. Vector Compress Instruction

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>
Reviewed By: craig.topper

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