Commit Graph

414622 Commits

Author SHA1 Message Date
Konrad Kleine 32a0482a65 Add cmake to source release tarballs
I've split the git archive generation into three steps:

1. generate pure tarball
2. append top-level cmake directory to all tarballs
3. compress the archive

This was inspired by D118252 and can be considered an alternative
approach for all projects to have access to the shared cmake
directory when building in standalone mode.

When generating source tarballs on my local laptop it takes 9 minutes and 45 seconds WITH this patch applied. When this patch is not applied, it takes 9minutes and 38 seconds. That means, this patch introduces a slowdown of 7 seconds, which seems fair.

Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D118481
2022-02-11 11:54:44 +01:00
Simon Pilgrim 9ece72c159 [clang] VisitCastExpr - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is always dereferenced, so assert the cast is correct (which it should be as we just created that ScalableVectorType) instead of returning nullptr
2022-02-11 10:51:34 +00:00
Simon Pilgrim a5d6851489 LoopReroll::isLoopControlIV - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is always dereferenced by isCompareUsedByBranch, so assert the cast is correct instead of returning nullptr
2022-02-11 10:19:25 +00:00
Simon Pilgrim 37bd80cd98 [M68k] Add missing include
Fixup for experimental m68k target after D119359
2022-02-11 10:17:39 +00:00
Sven van Haastregt 50f8abb9f4 [OpenCL] Add OpenCL 3.0 atomics to -fdeclare-opencl-builtins
Add the atomic overloads for the `global` and `local` address spaces,
which are new in OpenCL 3.0.  Ensure the preexisting `generic`
overloads are guarded by the generic address space feature macro.

Ensure a subset of the atomic builtins are guarded by the
`__opencl_c_atomic_order_seq_cst` and `__opencl_c_atomic_scope_device`
feature macros, and enable those macros for SPIR/SPIR-V targets in
`opencl-c-base.h`.

Also guard the `cl_ext_float_atomics` builtins with the atomic order
and scope feature macros.

Differential Revision: https://reviews.llvm.org/D119420
2022-02-11 10:14:14 +00:00
Tim Northover 7605ca85f1 StackProtector: ignore debug insts when splitting blocks.
When deciding where to split a block to insert stack guard checks, we should
move past any debug instructions we see that might (e.g.) be separating a tail
call from its frame wrangling.
2022-02-11 10:13:50 +00:00
Nikita Popov 5d63903465 [SCCP] Check that load/store and global type match
SCCP requires that the load/store type and global type are the
same (it does not support bitcasts of tracked globals). With
typed pointers this was implicitly enforced.
2022-02-11 11:01:18 +01:00
Marek Kurdej a218706cba [clang-format] Add tests for spacing between ref-qualifier and `noexcept`. NFC.
Cf. https://github.com/llvm/llvm-project/issues/44542.
Cf. ae1b7859cb.
2022-02-11 10:50:05 +01:00
Balazs Benics abc873694f [analyzer] Restrict CallDescription fuzzy builtin matching
`CallDescriptions` for builtin functions relaxes the match rules
somewhat, so that the `CallDescription` will match for calls that have
some prefix or suffix. This was achieved by doing a `StringRef::contains()`.
However, this is somewhat problematic for builtins that are substrings
of each other.

Consider the following:

`CallDescription{ builtin, "memcpy"}` will match for
`__builtin_wmemcpy()` calls, which is unfortunate.

This patch addresses/works around the issue by checking if the
characters around the function's name are not part of the 'name'
semantically. In other words, to accept a match for `"memcpy"` the call
should not have alphanumeric (`[a-zA-Z]`) characters around the 'match'.

So, `CallDescription{ builtin, "memcpy"}` will not match on:

 - `__builtin_wmemcpy: there is a `w` alphanumeric character before the match.
 - `__builtin_memcpyFOoBar_inline`: there is a `F` character after the match.
 - `__builtin_memcpyX_inline`: there is an `X` character after the match.

But it will still match for:
 - `memcpy`: exact match
 - `__builtin_memcpy`: there is an _ before the match
 - `__builtin_memcpy_inline`: there is an _ after the match
 - `memcpy_inline_builtinFooBar`: there is an _ after the match

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D118388
2022-02-11 10:45:18 +01:00
serge-sans-paille 06943537d9 Cleanup MCParser headers
As usual with that header cleanup series, some implicit dependencies now need to
be explicit:

llvm/MC/MCParser/MCAsmParser.h no longer includes llvm/MC/MCParser/MCAsmLexer.h

Preprocessed lines to build llvm on my setup:
after:  1068185081
before: 1068324320

So no compile time benefit to expect, but we still get the looser coupling
between files which is great.

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D119359
2022-02-11 10:39:29 +01:00
Markus Böck 1bf7921374 [mlir][LLVM] Add support for adding a garbage collector to a LLVM function
This patch simply adds an optional garbage collector attribute to LLVMFuncOp which maps 1:1 to the "gc" property of functions in LLVM.

Differential Revision: https://reviews.llvm.org/D119492
2022-02-11 10:23:51 +01:00
Nikita Popov e714b98fff [InstCombine] Check type compatibility in indexed load fold
This fold could use a rewrite to an offset-based implementation,
but for now make sure it doesn't crash with opaque pointers.
2022-02-11 10:16:27 +01:00
Florian Hahn 9474c3009e
[LV] Move unrelated tests from first-order-recurrence-chains.ll 2022-02-11 09:15:42 +00:00
Sander de Smalen 0b41238ae7 [AArch64] Emit TBAA metadata for SVE load/store intrinsics
In Clang we can attach TBAA metadata based on the load/store intrinsics
based on the operation's element type.

This also contains changes to InstCombine where the AArch64-specific
intrinsics are transformed into generic LLVM load/store operations,
to ensure that all metadata is transferred to the new instruction.

There will be some further work after this patch to also emit TBAA
metadata for SVE's gather/scatter- and struct load/store intrinsics.

Reviewed By: paulwalker-arm

Differential Revision: https://reviews.llvm.org/D119319
2022-02-11 09:00:29 +00:00
Mehdi Amini b055e6d313 Add a new interface method `getAsmBlockName()` on OpAsmOpInterface to control block names
This allows operations to control the block ids used by the printer in nested regions.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D115849
2022-02-11 08:46:08 +00:00
Nikita Popov 3571bdb4f3 [InstCombine] Require equal source element type in icmp of gep fold
Without opaque pointers, this is implicitly enforced. This previously
resulted in a miscompile.
2022-02-11 09:38:28 +01:00
Nikita Popov c28b0b9d18 [Bitcode] Add partial support for opaque pointer auto-upgrade
Auto-upgrades that rely on the pointer element type do not work in
opaque pointer mode. The idea behind this patch is that we can
instead work with type IDs, for which we can retain the pointer
element type. For typed pointer bitcode, we will have a distinct
type ID for pointers with distinct element type, even if there will
only be a single corresponding opaque pointer type.

The disclaimer here is that this is only the first step of the change,
and there are still more getPointerElementType() calls to remove.
I expect that two more patches will be needed:
1. Track all "contained" type IDs, which will allow us to handle
function params (which are contained in the function type) and GEPs
(which may use vectors of pointers)
2. Track type IDs for values, which is e.g. necessary to handle loads.

Differential Revision: https://reviews.llvm.org/D118694
2022-02-11 09:32:46 +01:00
Nikita Popov e24067819f [ArgPromotion] Protect harder against recursive promotion (PR42028)
In addition to the self-recursion check, also check whether there
is more than one node in the SCC, which implies that there is a
larger cycle. I believe checking SCC structure (rather than
something like norecurse) is the right thing to do here, because
this is specifically about preventing infinite loops over the SCC.

Fixes https://github.com/llvm/llvm-project/issues/42028.

Differential Revision: https://reviews.llvm.org/D119418
2022-02-11 09:30:39 +01:00
gysit a3655de2c8 [mlir][OpDSL] Add support for basic rank polymorphism.
Previously, OpDSL did not support rank polymorphism, which required a separate implementation of linalg.fill. This revision extends OpDSL to support rank polymorphism for a limited class of operations that access only scalars and tensors of rank zero. At operation instantiation time, it scales these scalar computations to multi-dimensional pointwise computations by replacing the empty indexing maps with identity index maps. The revision does not change the DSL itself, instead it adapts the Python emitter and the YAML generator to generate different indexing maps and and iterators depending on the rank of the first output.

Additionally, the revision introduces a `linalg.fill_tensor` operation that in a future revision shall replace the current handwritten `linalg.fill` operation. `linalg.fill_tensor` is thus only temporarily available and will be renamed to `linalg.fill`.

Reviewed By: nicolasvasilache, stellaraccident

Differential Revision: https://reviews.llvm.org/D119003
2022-02-11 08:27:49 +00:00
Jay Foad b21f497a78 [AArch64] Add a special case for shifting by (BitWidth - 1) - X
Differential Revision: https://reviews.llvm.org/D77316
2022-02-11 08:23:33 +00:00
Jay Foad 8dca5217dc [AArch64] Pre-commit multi use shift amount tests for D77316
Differential Revision: https://reviews.llvm.org/D119423
2022-02-11 08:23:33 +00:00
Weining Lu 1e8ff9b40a [LoongArch] Include missing header files after D119244
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D119514
2022-02-11 00:14:59 -08:00
Mehdi Amini 4e58cb18d3 Remove spurious includes and dependencies from Bazel files (NFC)
Differential Revision: https://reviews.llvm.org/D119526
2022-02-11 07:57:17 +00:00
Bill Wendling 74aa44a887 [X86] Zero out the 32-bit GPRs explicitly
This should ensure that only the 32-bit xors are emitted, and not the
64-bit xors.

Differential Revision: https://reviews.llvm.org/D119523
2022-02-10 23:09:00 -08:00
Shubham Rastogi 0e263f1775 [NFC] Sort textual headers by alphabetical order
Differential Revision: https://reviews.llvm.org/D119519
2022-02-10 22:34:37 -08:00
Uday Bondhugula f2ff8a8e83 [MLIR] Add result status for normalizeAffineFor
Add result status for normalizeAffineFor utility.

Differential Revision: https://reviews.llvm.org/D119413
2022-02-11 11:29:52 +05:30
Konstantin Varlamov aff115420d [libc++][ranges][NFC] Fix a typo in links on the Ranges status page. 2022-02-10 20:55:27 -08:00
Fangrui Song ffa6262cb4 [Object] Include llvm/Support/MemoryBuffer.h after D119457
libc++ -DLLVM_ENABLE_MODULES=on build needs the complete type. This fixes

error: invalid application of 'sizeof' to an incomplete type 'llvm::MemoryBuffer'
2022-02-10 20:23:22 -08:00
Fangrui Song 8eb750189c [RISCV] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds 2022-02-10 20:10:12 -08:00
ZezhengLi d7969012e4 [C++20] [Modules] Check if modulemap exists to avoid crash in implicit used C++ module
An impilt used of C++ module without prebuild path may cause crash.

For example:

```
// ./dir1/C.cppm
export module C;
// ./dir2/B.cppm
export module B;
import C;
// ./A.cpp
import B;
import C;
```

When we compile A.cpp without the prebuild path of C.pcm, the compiler
will crash.

```
clang++ -std=c++20 --precompile -c ./dir1/C.cppm -o ./dir1/C.pcm
clang++ -std=c++20 --precompile -fprebuilt-module-path=./dir2  -c
./dir2/B.cppm -o ./dir2/B.pcm
clang++ -std=c++20 -fprebuilt-module-path=./dir2 A.cpp

```

The prebuilt path of module C is cached when import module B, and in the
function HeaderSearch::getCachedModuleFileName, the compiler try to get
the filename by modulemap without check if modulemap exists, and there
is no modulemap in C++ module.

Reviewed By: ChuanqiXu

Differential review: https://reviews.llvm.org/D119426
2022-02-11 11:22:50 +08:00
Rashmi Mudduluru ce420820c8 [Analyzer] Re-enables trustnonnullchecker_test.m
Differential review: https://reviews.llvm.org/D119270
2022-02-10 18:52:48 -08:00
Konstantin Varlamov 2151b3d093 [libc++][ranges][NFC] Update the status of predefined iterators.
`{back,front}_insert_iterator` and `ostream{,buf}_iterator` effectively
fully implement the One Ranges Proposal already, so mark them as done:
- the change to `difference_type` was made by D103273;
- default constructors and the associated default member initializers
  were removed by wg21.link/P2325 (implemented by D102468).

Also fix a stale template signature in the `<iterator>` synopsis.
2022-02-10 18:49:52 -08:00
Chris Bieneman 6d8e5c9685 [NFC] Make file offsets a regex to handle CRLF
None of these tests are really intended to test the file offset as much
as to test the structure. Making the regex allows this test to work
even if the file is checked out with CRLF line endings.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D119362
2022-02-10 20:39:20 -06:00
Arthur Eubanks e487ddc5c6 [clang][OpaquePtr] Use proper Address constructor in AtomicInfo::getAtomicAddress() 2022-02-10 18:29:51 -08:00
Ben Shi fa2d31e9e6 [AVR] Fix a potential assert failure
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D119416
2022-02-11 02:25:58 +00:00
Nico Weber e76037db44 [llvm] Remove unused file MaximumSpanningTree.h
The last use of this file was removed in late 2013 in ea56494625.
The last use was in PathProfiling.cpp, which had an overview comment
of the overall approach.

Similar functionality lives in the slight more cryptically named
CFGMST.h in this same directory. A similar overview comment is
in PGOInstrumentation.cpp.

No behavior change.
2022-02-10 21:01:24 -05:00
Nico Weber 4f52f7373f [llvm] add missing word in a comment 2022-02-10 20:57:13 -05:00
Nico Weber 90ca7b3bca [runtimes] rewrap a comment to 80 columns 2022-02-10 20:57:13 -05:00
Vincent Lee ef764ee207 [lld-macho][nfc] Centralize usages of ld64.lld in tests
We have a mix of substituted lld (`%lld`) and hard-coded lld (`ld64.lld`) commands.
When testing with different versions of LLD, this would require going into every place
where lld is hard-coded and changing that. If we centralize it, this'll only  require us
to modify it in only one place and will make it easy to run the same test suite. Plus,
this will make it be consistent with how we write other tests.

Reviewed By: #lld-macho, int3, oontvoo

Differential Revision: https://reviews.llvm.org/D119394
2022-02-10 17:27:07 -08:00
Thomas Raoux 5ab04bc068 [mlir][gpu] Add device side async copy operations
Add new operations to the gpu dialect to represent device side
asynchronous copies. This also add the lowering of those operations to
nvvm dialect.
Those ops are meant to be low level and map directly to llvm dialects
like nvvm or rocdl.

We can further add higher level of abstraction by building on top of
those operations.
This has been discuss here:
https://discourse.llvm.org/t/modeling-gpu-async-copy-ampere-feature/4924

Differential Revision: https://reviews.llvm.org/D119191
2022-02-10 17:25:59 -08:00
River Riddle ceb5dc55c2 [PDLL] Attempt to fix the gcc5 build by adding this-> to auto lambda 2022-02-10 16:59:03 -08:00
Philip Reames 5ba115031d [PSE] Remove assumption that top level predicate is union from public interface [NFC*]
Note that this doesn't actually cause the top level predicate to become a non-union just yet.

The * above comes from a case in the LoopVectorizer where a predicate which is later proven no longer blocks vectorization due to a change from checking if predicates exists to whether the predicate is possibly false.
2022-02-10 16:14:52 -08:00
Sam Clegg ecbcefd693 [clang][WebAssemmbly] Call TargetInfo::adjust in derived method.
The superclass method handles a bunch of useful things. For example
it applies flags such as `-fnew-alignment` which doesn't work without
this patch.

Differential Revision: https://reviews.llvm.org/D118573
2022-02-10 16:04:06 -08:00
David Blaikie 389f67b35b DebugInfo: Don't simplify names referencing local enums
Due to the way type units work, this would lead to a declaration in a
type unit of a local type in a CU - which is ambiguous. Rather than
trying to resolve that relative to the CU that references the type unit,
let's just not try to simplify these names.

Longer term this should be fixed by not putting the template
instantiation in a type unit to begin with - since it references an
internal linkage type, it can't legitimately be duplicated/in more than
one translation unit, so skip the type unit overhead. (but the right fix
for that is to move type unit management into a DICompositeType flag
(dropping the "identifier" field is not a perfect solution since it
breaks LLVM IR linking decl/def merging during IR linking))
2022-02-10 15:51:47 -08:00
Philip Reames 01b56b8bdd [SCEVPredicateRewriter] Remove assumption top level predicate is a union [NFC] 2022-02-10 15:51:15 -08:00
Arthur Eubanks 2fa87ab524 [docs] Replace `opt -analyze` with better alternatives.
`opt -analyze` is legacy PM-specific. Show better ways of doing the same
thing, generally with some sort of `-passes=print<foo>`.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D119486
2022-02-10 15:38:31 -08:00
Adrian Prantl 4ef02cba2e Revert "Add -fmodules-local-submodule-visibility to MANDATORY_MODULE_BUILD_CFLAGS"
This reverts commit 547a667cee.
2022-02-10 15:37:11 -08:00
LLVM GN Syncbot d2a4f813e4 [gn build] Port f927021410 2022-02-10 23:27:43 +00:00
David Blaikie 26c5cf8fa0 Fix Windows build that fails if a class has a member with the same naem 2022-02-10 15:27:31 -08:00
Shilei Tian 702a976c12 [OpenMP][Offloading] Change the way to compare floating point values in bug49334.cpp
`bug49334.cpp` directly uses `!=` to compare two floating point values,
which is almost wrong.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D119485
2022-02-10 18:20:36 -05:00