Commit Graph

385640 Commits

Author SHA1 Message Date
Jez Ng db7a413e51 [lld-macho] Re-root absolute input file paths if -syslibroot is specified
Reviewed By: #lld-macho, gkm

Differential Revision: https://reviews.llvm.org/D100147
2021-04-15 21:16:33 -04:00
Jez Ng eb5b7d4497 [lld-macho] LTO: Unset VisibleToRegularObj where possible
This allows LLVM's LTO to internalize symbols that are not referenced
directly by regular objects. Naturally, this means we need to track
which symbols are referenced by regular objects. The approach taken here
is similar to LLD-COFF's: like the COFF port, we extend
`SymbolTable::insert()` to set the isVisibleToRegularObj bit. (LLD-ELF
relies on the Symbol constructor and `Symbol::mergeProperties()`, but
the Mach-O port does not have a `mergeProperties()` equivalent.)

From what I can tell, ld64 (which uses libLTO) doesn't do this
optimization at all. I'm not even sure libLTO provides a way to do this.
Not having ld64's behavior as a reference implementation is unfortunate;
instead, I am relying on LLD-ELF/COFF's behavior as references while
erring on the conservative side. In particular, LLD-MachO will only do
this optimization for executables right now.

We also don't attempt it when `-flat_namespace` is used -- otherwise
we'd need scan the symbol table to find matches for every un-namespaced
symbol reference, which is expensive.

internalize.ll is based off the LLD-ELF tests `internalize-basic.ll` and
`internalize-undef.ll`. Looks like @davide added some of LLD-ELF's internalize
tests, so adding him as a reviewer...

Reviewed By: #lld-macho, gkm

Differential Revision: https://reviews.llvm.org/D99105
2021-04-15 21:16:33 -04:00
Richard Smith f7c9de0de5 Add triple to fix test failure.
This test uses `__regcall`, support for which is target-specific.
2021-04-15 18:08:35 -07:00
Juneyoung Lee 25e96dffac [LangRef] fix unexepcted unindent errror 2021-04-16 09:58:55 +09:00
Juneyoung Lee 1bcadb0984 [LangRef] clarify the semantics of nocapture
This patch clarifies the semantics of nocapture attribute.

A 'Pointer Capture' subsection is added to describe the semantics of pointer capture first.

For the nocapture example with two same pointer arguments, it is consistent with the semantics that Alive2 used to run lit tests.

Reviewed By: nlopes

Differential Revision: https://reviews.llvm.org/D97924
2021-04-16 09:48:42 +09:00
George Balatsouras 98b114d480 [dfsan] Remove hard-coded constant in release_shadow_space.c
Reviewed By: stephan.yichao.zhao

Differential Revision: https://reviews.llvm.org/D100608
2021-04-15 17:24:35 -07:00
Caroline Tice 042668d092 Revert "[LLDB] Use path relative to binary for finding .dwo files."
This reverts commit b241f3cb29.

Test case is breaking windows builder.
2021-04-15 17:17:44 -07:00
Joshua Haberman 8344675908 Implemented [[clang::musttail]] attribute for guaranteed tail calls.
This is a Clang-only change and depends on the existing "musttail"
support already implemented in LLVM.

The [[clang::musttail]] attribute goes on a return statement, not
a function definition. There are several constraints that the user
must follow when using [[clang::musttail]], and these constraints
are verified by Sema.

Tail calls are supported on regular function calls, calls through a
function pointer, member function calls, and even pointer to member.

Future work would be to throw a warning if a users tries to pass
a pointer or reference to a local variable through a musttail call.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D99517
2021-04-15 17:12:21 -07:00
Christopher Di Bella f280505aa0 [libcxx] adds `std::indirectly_readable_traits` to <iterator>
Implements parts of:
    * P0896R4 The One Ranges Proposal
    * LWG3446 `indirectly_readable_traits` ambiguity for types with both `value_type` and `element_type`

Depends on D99141.

Differential Revision: https://reviews.llvm.org/D99461
2021-04-15 23:59:02 +00:00
Arthur Eubanks 9c776c2fa2 [NFC][NewPM] Remove some AnalysisManager invalidate methods
These were misleading, they're more of a "clear" than an "invalidate".

We shouldn't be individually clearing analysis results. Either we clear
all analyses when some IR becomes invalid, or we properly go through
invalidation.

There was only one use of this, which can be simulated with
AM.invalidate(F, PA).

Reviewed By: mtrofin

Differential Revision: https://reviews.llvm.org/D100519
2021-04-15 16:51:26 -07:00
Prashant Kumar 102fd1cb8b Add support for numpy arrays to memref conversions.
This offers the ability to pass numpy arrays to the corresponding
memref argument.

Reviewed By: mehdi_amini, nicolasvasilache

Differential Revision: https://reviews.llvm.org/D100077
2021-04-15 23:41:26 +00:00
George Balatsouras b2b59f622e [dfsan] Add test for origin tracking stack traces
Reviewed By: stephan.yichao.zhao

Differential Revision: https://reviews.llvm.org/D100518
2021-04-15 16:22:47 -07:00
River Riddle 706c9c5ce0 [mlir] Add support for walking locations similarly to Operations
This allows for walking all nested locations of a given location, and is generally useful when processing locations.

Differential Revision: https://reviews.llvm.org/D100437
2021-04-15 16:09:34 -07:00
River Riddle 4efb7754e0 [mlir][NFC] Add a using directive for llvm::SetVector
Differential Revision: https://reviews.llvm.org/D100436
2021-04-15 16:09:34 -07:00
Jon Roelofs 0bae93771d s/setGenerator/addGenerator/ in the JIT docs. NFC 2021-04-15 15:54:28 -07:00
Stephen Kelly f62ad15cd7 NFC: Add a simple test for introspection call formatting 2021-04-15 23:45:54 +01:00
Joseph Huber 83d4b2e2e0 [OpenMP] Add info for device table changes
Summary:
This patch adds a feature to print information whenever the host-device pointer
mapping table is changed by inserting or removing an entry. This introduces a
new bit field for LIBOMPTARGET_INFO at position 0x8.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D100600
2021-04-15 18:39:48 -04:00
Fangrui Song afec953857 [sanitizer] Simplify GetTls with dl_iterate_phdr on Linux and use it on musl/FreeBSD
... so that FreeBSD specific GetTls/glibc specific pthread_self code can be
removed. This also helps FreeBSD arm64/powerpc64 which don't have GetTls
implementation yet.

GetTls is the range of

* thread control block and optional TLS_PRE_TCB_SIZE
* static TLS blocks plus static TLS surplus

On glibc, lsan requires the range to include
`pthread::{specific_1stblock,specific}` so that allocations only referenced by
`pthread_setspecific` can be scanned.

This patch uses `dl_iterate_phdr` to collect TLS blocks. Find the one
with `dlpi_tls_modid==1` as one of the initially loaded module, then find
consecutive ranges. The boundaries give us addr and size.

This allows us to drop the glibc internal `_dl_get_tls_static_info` and
`InitTlsSize`. However, huge glibc x86-64 binaries with numerous shared objects
may observe time complexity penalty, so exclude them for now. Use the simplified
method with non-Android Linux for now, but in theory this can be used with *BSD
and potentially other ELF OSes.

This removal of RISC-V `__builtin_thread_pointer` makes the code compilable with
more compiler versions (added in Clang in 2020-03, added in GCC in 2020-07).

This simplification enables D99566 for TLS Variant I architectures.

Note: as of musl 1.2.2 and FreeBSD 12.2, dlpi_tls_data returned by
dl_iterate_phdr is not desired: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254774
This can be worked around by using `__tls_get_addr({modid,0})` instead
of `dlpi_tls_data`. The workaround can be shared with the workaround for glibc<2.25.

This fixes some tests on Alpine Linux x86-64 (musl)

```
test/lsan/Linux/cleanup_in_tsd_destructor.c
test/lsan/Linux/fork.cpp
test/lsan/Linux/fork_threaded.cpp
test/lsan/Linux/use_tls_static.cpp
test/lsan/many_tls_keys_thread.cpp

test/msan/tls_reuse.cpp
```

and `test/lsan/TestCases/many_tls_keys_pthread.cpp` on glibc aarch64.

The number of sanitizer test failures does not change on FreeBSD/amd64 12.2.

Differential Revision: https://reviews.llvm.org/D98926
2021-04-15 15:34:43 -07:00
Jonas Devlieghere 8639e2aaaf [lldb] Raise a CrashLogParseException when failing to parse JSON crashlog
Throw an exception with an actually helpful message when we fail to
parse a JSON crashlog.
2021-04-15 15:28:23 -07:00
Stephen Kelly be65347326 NFC: Add missing matcher for test method
The intention is to match the definition.
2021-04-15 23:26:00 +01:00
cchen 924cdff0ae [OpenMP5][DOCS] Update status of masked construct and correct the color
for omp_target_is_present, NFC.
2021-04-15 17:19:04 -05:00
Stephen Kelly 4f6d698467 [AST] Fix location call storage with common last-invocation
Differential Revision: https://reviews.llvm.org/D100548
2021-04-15 23:15:11 +01:00
Aart Bik 916f3e16bd [mlir][vector][avx] add AVX dot product to X86Vector dialect with lowering
In the long run, we want to unify the dot product codegen solutions between
all target architectures, but this intrinsic enables experimenting with AVX
specific implementations in the meantime.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D100593
2021-04-15 15:01:39 -07:00
Florian Hahn 3e7ee5428d
[InferAttrs] Do not mark first argument of str(n)cat as writeonly.
str(n)cat appends a copy of the second argument to the end of the first
argument. To find the end of the first argument, str(n)cat has to read
from it until it finds the terminating 0. So it should not be marked as
writeonly. I think this means the argument should not be marked as
writeonly.

(This is causing a mis-compile with legacy DSE, before it got removed)

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D100601
2021-04-15 23:00:21 +01:00
Momchil Velikov f9d932e673 [clang][AArch64] Correctly align HFA arguments when passed on the stack
When we pass a AArch64 Homogeneous Floating-Point
Aggregate (HFA) argument with increased alignment
requirements, for example

    struct S {
      __attribute__ ((__aligned__(16))) double v[4];
    };

Clang uses `[4 x double]` for the parameter, which is passed
on the stack at alignment 8, whereas it should be at
alignment 16, following Rule C.4 in
AAPCS (https://github.com/ARM-software/abi-aa/blob/master/aapcs64/aapcs64.rst#642parameter-passing-rules)

Currently we don't have a way to express in LLVM IR the
alignment requirements of the function arguments. The align
attribute is applicable to pointers only, and only for some
special ways of passing arguments (e..g byval). When
implementing AAPCS32/AAPCS64, clang resorts to dubious hacks
of coercing to types, which naturally have the needed
alignment. We don't have enough types to cover all the
cases, though.

This patch introduces a new use of the stackalign attribute
to control stack slot alignment, when and if an argument is
passed in memory.

The attribute align is left as an optimizer hint - it still
applies to pointer types only and pertains to the content of
the pointer, whereas the alignment of the pointer itself is
determined by the stackalign attribute.

For byval arguments, the stackalign attribute assumes the
role, previously perfomed by align, falling back to align if
stackalign` is absent.

On the clang side, when passing arguments using the "direct"
style (cf. `ABIArgInfo::Kind`), now we can optionally
specify an alignment, which is emitted as the new
`stackalign` attribute.

Patch by Momchil Velikov and Lucas Prates.

Differential Revision: https://reviews.llvm.org/D98794
2021-04-15 22:58:14 +01:00
Nicolas Vasilache 4b414b84a9 [mlir][scf] NFC - Add a getIterOpOperands helper to scf::ForOp 2021-04-15 21:46:10 +00:00
Caroline Tice b241f3cb29 [LLDB] Use path relative to binary for finding .dwo files.
DWARF allows .dwo file paths to be relative rather than absolute. When
they are relative, DWARF uses DW_AT_comp_dir to find the .dwo
file. DW_AT_comp_dir can also be relative, making the entire search
patch for the .dwo file relative. In this case, LLDB currently
searches relative to its current working directory, i.e. the directory
from which the debugger was launched. This is not right, as the
compiler, which generated the relative paths, can have no idea where
the debugger will be launched. The correct thing is to search relative
to the location of the executable binary. That is what this patch
does.

Differential Revision: https://reviews.llvm.org/D97786
2021-04-15 14:43:47 -07:00
Nathan James f019e5f73e
[AST][Introspection] Add a check to detect if introspection is supported.
This could probably be made into a compile time constant, but that would involve generating a second inc file.

Reviewed By: steveire

Differential Revision: https://reviews.llvm.org/D100530
2021-04-15 22:21:41 +01:00
Nathan James 542e7806e6
[AST] Add a print method to Introspection LocationCall
Add a print method that takes a raw_ostream.
Change LocationCallFormatterCpp::format to call that method.

Reviewed By: steveire

Differential Revision: https://reviews.llvm.org/D100423
2021-04-15 22:18:29 +01:00
Kostya Kortchinsky 3f97c66b00 [scudo][standalone] Fuchsia related fixes
While attempting to roll the latest Scudo in Fuchsia, some issues
arose. While trying to debug them, it appeared that `DCHECK`s were
also never exercised in Fuchsia. This CL fixes the following
problems:
- the size of a block in the TransferBatch class must be a multiple
  of the compact pointer scale. In some cases, it wasn't true, which
  lead to obscure crashes. Now, we round up `sizeof(TransferBatch)`.
  This only materialized in Fuchsia due to the specific parameters
  of the `DefaultConfig`;
- 2 `DCHECK` statements in Fuchsia were incorrect;
- `map()` & co. require a size multiple of a page (as enforced in
  Fuchsia `DCHECK`s), which wasn't the case for `PackedCounters`.
- In the Secondary, a parameter was marked as `UNUSED` while it is
  actually used.

Differential Revision: https://reviews.llvm.org/D100524
2021-04-15 13:26:23 -07:00
Craig Topper 07edd78993 [TableGen] Reduce the number of map lookups in TypeSetByHwMode::getOrCreate. NFCI
hasMode was looking up the map once. Then we'd either call get which
would look up again, or we'd insert into the map which requires
walking the map to find the insertion point.

I believe the hasMode was needed because get has a special case
to look for DefaultMode if the mode being asked for doesn't exist.
We don't want that here so we were using hasMode to make sure we
wouldn't hit that case.

Simplify to a regular operator[] access which will default
construct a SetType if the lookup fails.
2021-04-15 12:32:21 -07:00
Stanislav Mekhanoshin 13015ebd6f [AMDGPU] Factor out predicate FmaakFmamkF32Insts
Differential Revision: https://reviews.llvm.org/D100409
2021-04-15 12:29:16 -07:00
Christopher Di Bella 6f3bce911e [libcxx][NFC] removes IndentRequires from .clang-format
IndentRequires is apparently breaking CI because it uses an older clang-format.

Partially rolls back 2e3a78b8ca.
2021-04-15 19:28:45 +00:00
River Riddle b1260109fb [mlir][AsmPrinter] Fix multi-threaded segfault by using explicit null stream per thread
We were using llvm::nulls, but that isn't thread safe so we switch to giving each thread it's own null stream.

Differential Revision: https://reviews.llvm.org/D100578
2021-04-15 12:26:59 -07:00
Martin Storsjö 8e0f2e89ff [clang] [AArch64] Fix handling of HFAs passed to Windows variadic functions
The documentation says that for variadic functions, all composites
are treated similarly, no special handling of HFAs/HVAs, not even
for the fixed arguments of a variadic function.

Differential Revision: https://reviews.llvm.org/D100467
2021-04-15 22:21:27 +03:00
Florian Hahn 49999d4364 [VPlan] Replace a few unnecessary includes with forward decls. 2021-04-15 20:08:31 +01:00
Stanislav Mekhanoshin d4385e483d [AMDGPU] Add new EmitDstSel field to VOPPofile. NFC.
Differential Revision: https://reviews.llvm.org/D100589
2021-04-15 12:07:08 -07:00
Max Sagebaum dda978eef8 [clang-format] Option for empty lines after an access modifier.
The current logic for access modifiers in classes ignores the option 'MaxEmptyLinesToKeep=1'. It is therefore impossible to have a coding style that requests one empty line after an access modifier. The patch allows the user to configure how many empty lines clang-format should add after an access modifier. This will remove lines if there are to many and will add them if there are missing.

Reviewed By: MyDeveloperDay, curdeius

Differential Revision: https://reviews.llvm.org/D98237
2021-04-15 21:03:07 +02:00
LLVM GN Syncbot 915a778098 [gn build] Port 82787eb228 2021-04-15 18:54:08 +00:00
Alexander Belyaev cf761904a2 [mlir] Add verification for `linalg.tiled_loop` op.
Differential Revision: https://reviews.llvm.org/D100555
2021-04-15 20:50:36 +02:00
Alexander Belyaev 67f60bcc75 [mlir] Expose `updateBoundsForCyclicDistribution` in Linalg/Utils.h.
Differential Revision: https://reviews.llvm.org/D100580
2021-04-15 20:47:37 +02:00
hsmahesha 82787eb228 [AMDGPU] Move LDS lowering related utility functions to a separate utils file.
Move some utility functions which are used within LDS lowering pass to a separate utils
file so that other LDS related passes can make use of them when required.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D100526
2021-04-16 00:15:48 +05:30
Alexander Belyaev 3c982a6e54 [mlir] Add helpers to set lbs, ubs, steps for linalg.tiled_loop.
Differential Revision: https://reviews.llvm.org/D100579
2021-04-15 20:44:38 +02:00
River Riddle 94662ee0c1 [mlir] Add support for adding attribute+type traits/interfaces to tablegen defs
This matches the current support provided to operations, and allows attaching traits, interfaces, and using the DeclareInterfaceMethods utility. This was missed when attribute/type generation was first added.

Differential Revision: https://reviews.llvm.org/D100233
2021-04-15 11:41:51 -07:00
Krzysztof Parzyszek 280678122d [Hexagon] Avoid infinite loops in type legalization when lowering SETCC
Only widen SETCC if the operands can be widened. Not checking that caused
infinite widen-split loops in legalization.
2021-04-15 13:34:37 -05:00
Sourabh Singh Tomar 5064a34165 [flang][OpenMP] Remove `OmpEndLoopDirective` handles from code.
This directive is currently lowered as NOP.

Patch is an attempt upstream code from:
PR: https://github.com/flang-compiler/f18-llvm-project/pull/573

Reviewed By: kiranchandramohan, schweitz, clementval

Differential Revision: https://reviews.llvm.org/D100576
2021-04-16 00:00:07 +05:30
Craig Topper 1656df13da [RISCV] Share RVInstIShift and RVInstIShiftW instruction format classes with the B extension.
This generalizes RVInstIShift/RVInstIShiftW to take the upper
5 or 7 bits of the immediate as an input instead of only bit 30. Then
we can share them.

For RVInstIShift I left a hardcoded 0 at bit 26 where RV128 gets
a 7th bit for the shift amount.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D100424
2021-04-15 11:08:28 -07:00
cchen e0c2125d1d [OpenMP] Added codegen for masked directive
Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D100514
2021-04-15 12:55:07 -05:00
Aart Bik 92b0a9d7d4 [mlir][sparse] remove restriction on vectorization of index type
Rationale:
Now that vector<?xindex> is allowed, the restriction on vectorization
of index types in the sparse compiler can be removed. Also needs
generalization of scatter/gather index types.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D100522
2021-04-15 10:27:04 -07:00
Melanie Blower 938b863bb5 [clang][patch] Modify diagnostic level from err to warn: anyx86_interrupt_regsave
Reviewed By: Aaron Ballman

Differential Revision: https://reviews.llvm.org/D100511
2021-04-15 13:11:33 -04:00