Commit Graph

385640 Commits

Author SHA1 Message Date
Lei Zhang 0deeaaca39 [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
2021-04-12 16:38:22 -04:00
Julian Lettner 05df5c54e8 [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
2021-04-12 13:30:06 -07:00
Sanjay Patel 5354a213a0 [InstCombine] fold shift+trunc signbit check
https://alive2.llvm.org/ce/z/6vQvrP

This solves:
https://llvm.org/PR49866
2021-04-12 16:19:43 -04:00
Sanjay Patel 58ad2b9e06 [InstCombine] add tests for shift+trunc signbit check; NFC 2021-04-12 16:19:43 -04:00
Daniele Castagna 7dd6068899
[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
2021-04-12 13:15:14 -07:00
Jonas Devlieghere ba62ebc48e [lldb] Disable Shell/Subporcess with reproducers 2021-04-12 13:08:14 -07:00
peter klausler 5fe83b048a [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
2021-04-12 12:57:22 -07:00
jasonliu 52e9d80d5d [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
2021-04-12 19:25:49 +00:00
Lei Zhang fd91f81c85 [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
2021-04-12 15:14:43 -04:00
Jian Cai cfce5b26a8 [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
2021-04-12 12:13:55 -07:00
Sanjay Patel 661cc71a1c [PassManager][PhaseOrdering] lower expects before running simplifyCFG
Retry of 330619a3a6 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
2021-04-12 15:07:53 -04:00
Sean Perry 06c8b29d23 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
2021-04-12 15:06:05 -04:00
Arthur Eubanks be00edfee5 [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
2021-04-12 11:55:17 -07:00
David Tenty 0788cdf2e3 [AIX] Tweak test XFAIL from D99815
the test fails on AIX host, not necessarily just the target.
2021-04-12 14:48:56 -04:00
Emily Shi 20f38d0142 [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
2021-04-12 11:45:45 -07:00
eopXD 9cc417cbca [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
2021-04-13 00:12:43 +05:30
Richard Smith fc1e146e44 Fix documentation typo. 2021-04-12 11:39:08 -07:00
Mara Sophie Grosch 8deaa4a147 [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
2021-04-12 14:20:36 -04:00
Sanjay Patel 23ac9d1e6e Revert "[PassManager][PhaseOrdering] lower expects before running simplifyCFG"
This reverts commit 330619a3a6.
There are clang tests that also need to be updated.
2021-04-12 13:58:54 -04:00
Arthur Eubanks 269b335bd7 [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
2021-04-12 10:54:22 -07:00
Hamza Sood 0a92aff721 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
2021-04-12 10:47:14 -07:00
Fraser Cormack d737c47137 [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
2021-04-12 18:36:45 +01:00
Arjun P 7f9e36b209 [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
2021-04-12 23:11:06 +05:30
Aart Bik 7714b405a0 [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
2021-04-12 10:37:15 -07:00
Emilio Cota 8508a63b88 [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
2021-04-12 19:20:04 +02:00
MaheshRavishankar b0fc712b14 [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
2021-04-12 10:15:54 -07:00
Mitch Phillips 15689f3af0 [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.
2021-04-12 09:50:34 -07:00
Alexander Kornienko 8883cb3e40 Fix nits. 2021-04-12 18:46:13 +02:00
Jens Massberg 8a944d82cd [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
2021-04-12 18:46:12 +02:00
Tim Keith 50386fe1db [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
2021-04-12 09:40:52 -07:00
Artem Belevich 38cf112a6b Allow applying attributes to subset of allowed subjects.
Differential Revision: https://reviews.llvm.org/D100136
2021-04-12 09:33:33 -07:00
Yuanfang Chen f4d682d6ce [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
2021-04-12 09:32:23 -07:00
Arthur O'Dwyer 4b7bad9eae [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
2021-04-12 12:29:15 -04:00
Arthur O'Dwyer d7eb797ea5 [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
2021-04-12 12:28:01 -04:00
Sanjay Patel 330619a3a6 [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
2021-04-12 12:23:31 -04:00
David Green dd31b2c6e5 [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
2021-04-12 17:23:02 +01:00
Stephen Tozer f2e4f3eff3 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
aa3e78a59f, and
140757bfaa

This reverts commit f40976bd01.
2021-04-12 16:57:29 +01:00
Louis Dionne 8508b1c133 [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
2021-04-12 11:55:39 -04:00
LLVM GN Syncbot 9f64e6ce76 [gn build] Port 6a1ac88fc1 2021-04-12 15:51:13 +00:00
LLVM GN Syncbot 07274e3238 [gn build] Port 26beecfe47 2021-04-12 15:51:12 +00:00
LLVM GN Syncbot db51d5968c [gn build] Port 0b439e4cc9 2021-04-12 15:51:11 +00:00
Louis Dionne 344d381d9f [libc++] NFC: Remove duplicate synopsis from <__string> 2021-04-12 11:49:43 -04:00
Louis Dionne 6a1ac88fc1 [libc++] Split std::get_temporary_buffer out of <memory>
Differential Revision: https://reviews.llvm.org/D100216
2021-04-12 11:46:31 -04:00
Louis Dionne 0b439e4cc9 [libc++] Split std::allocator out of <memory>
Differential Revision: https://reviews.llvm.org/D100216
2021-04-12 11:46:29 -04:00
Louis Dionne 26beecfe47 [libc++] Split auto_ptr out of <memory>
Differential Revision: https://reviews.llvm.org/D100216
2021-04-12 11:46:25 -04:00
Kristof Beyls 28dc50c4b7 [docs] Add Windows/COFF call info 2021-04-12 17:11:25 +02:00
Simon Pilgrim 9c9df05750 [InstCombine] Regenerate select-ctlz-to-cttz.ll tests
Correctly test !range metadata
2021-04-12 16:05:34 +01:00
Simon Pilgrim baadbe04bf [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.
2021-04-12 16:05:34 +01:00
Daniel Kiss a46effbd2a [compiler-rt][aarch64] Add PAC-RET/BTI support to HWASAN.
Support for -mbranch-protection.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D100143
2021-04-12 17:02:45 +02:00
Kadir Cetinkaya 63bc9e4435
[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
2021-04-12 16:43:23 +02:00