Commit graph

397908 commits

Author SHA1 Message Date
peter klausler d60a02201d [flang] Include default component initialization in static initializers
The combined initializers constructed from DATA statements and explicit
static initialization in declarations needs to include derived type
component default initializations, overriding those default values
without complaint with values from explicit DATA statement or declaration
initializations when they overlap.  This also has to work for objects
with storage association due to EQUIVALENCE.  When storage association causes
default component initializations to overlap, emit errors if and only
if the values differ (See Fortran 2018 subclause 19.5.3, esp. paragraph
10).

The f18 front-end has a module that analyzes and converts DATA statements
into equivalent static initializers for objects.  For storage-associated
objects, compiler-generated objects are created that overlay the entire
association and fill it with a combined initializer.  This "data-to-inits"
module already exists, and this patch is essentially extension and
clean-up of its machinery to complete the job.

Also: emit EQUIVALENCE to module files; mark compiler-created symbols
and *don't* emit those to module files; check non-static EQUIVALENCE
sets for conflicting default component initializations, so lowering
doesn't have to check them or emit diagnostics.

Differential Revision: https://reviews.llvm.org/D109022
2021-09-01 09:40:37 -07:00
hsmahesha 97688bfd3d Revert "Revert "Disable ReplaceLDS pass, patch up tests to match""
This reverts commit 5ae6804d17.
2021-09-01 21:52:50 +05:30
Hongtao Yu 7ca8030030 [CSSPGO] Enable loading MD5 CS profile.
Adding the compiler support of MD5 CS profile based on pervious context split work D107299. A MD5 CS profile is about 40% smaller than the string-based extbinary profile. As a result, the compilation is 15% faster.

There are a few conversion from real names to md5 names that have been made on the sample loader and context tracker side to get it work.

Reviewed By: wenlei, wmi

Differential Revision: https://reviews.llvm.org/D108342
2021-09-01 09:19:47 -07:00
Nikita Popov 9d720dcb89 [LoadStoreVectorizer] Make aliasing check more precise
The load store vectorizer currently uses isNoAlias() to determine
whether memory-accessing instructions should prevent vectorization.
However, this only works for loads and stores. Additionally, a
couple of intrinsics like assume are special-cased to be ignored.

Instead use getModRefInfo() to generically determine whether the
instruction accesses/modifies the relevant location. This will
automatically handle all inaccessiblememonly intrinsics correctly
(as well as other calls that don't modref for other reasons).
This requires generalizing the code a bit, as it was previously
only considering loads and stored in particular.

Differential Revision: https://reviews.llvm.org/D109020
2021-09-01 18:10:09 +02:00
serge-sans-paille 02df443d28 Fine grain control over some symbol visibility
Setting -fvisibility=hidden when compiling Target libs has the advantage of
not being intrusive on the codebase, but it also sets the visibility of all
functions within header-only component like ADT. In the end, we end up with
some symbols with hidden visibility within llvm dylib (through the target libs),
and some with external visibility (through other libs). This paves the way for
subtle bugs like https://reviews.llvm.org/D101972

This patch explicitly set the visibility of some classes to `default` so that
`llvm::Any` related symbols keep a `default` visibility. Indeed a template
function with `default` visibility parametrized by a type with `hidden`
visibility is granted `hidden` visibility, and we don't want this for the
uniqueness of `llvm::Any::TypeId`.

Differential Revision: https://reviews.llvm.org/D108943
2021-09-01 17:53:03 +02:00
hsmahesha 5ae6804d17 Revert "Disable ReplaceLDS pass, patch up tests to match"
This reverts commit 50ad3478bd.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D109062
2021-09-01 21:19:39 +05:30
Kazu Hirata d8afa5777b [clang-tidy] Fix documentation typos (NFC) 2021-09-01 08:48:31 -07:00
Louis Dionne a4cb5aefd5 [libc++] Remove some workarounds for unsupported GCC and Clang versions
There is a lot more we can do, in particular in <type_traits>, but this
removes some workarounds that were gated on checking a specific compiler
version.

Differential Revision: https://reviews.llvm.org/D108923
2021-09-01 10:57:14 -04:00
Louis Dionne 9d7ae0acde [libc++][NFC] Correct comment about P0600 missing node_handle bits
Differential Revision: https://reviews.llvm.org/D109027
2021-09-01 10:51:55 -04:00
Louis Dionne 3557c7c122 [libc++] Remove workarounds for [[nodebug]] not working properly on typedefs in older Clangs
Clang used to support [[nodebug]] everywhere except on typedefs. Since
we don't support such old Clangs anymore, we can get rid of _LIBCPP_NODEBUG_TYPE
in favour of always using _LIBCPP_NODEBUG.

Differential Revision: https://reviews.llvm.org/D108996
2021-09-01 10:51:09 -04:00
Louis Dionne 8f9cc3bc29 [libc++][NFC] Use std::enable_if instead of _EnableB helper in pair
This doesn't impact the compile-time efficiency, but we get better
diagnostics when an overload is disabled.
2021-09-01 10:48:09 -04:00
Teresa Johnson badcd58589 [DIArgList] Re-unique after changing operands to fix non-determinism
We have a large compile showing occasional non-deterministic behavior
that is due to DIArgList not being properly uniqued in some cases. I
tracked this down to handleChangedOperands, for which there is a custom
implementation for DIArgList, that does not take care of re-uniquing
after updating the DIArgList Args, unlike the default version of
handleChangedOperands for MDNode.

Since the Args in the DIArgList form the key for the store, this seems
to be occasionally breaking the lookup in that DenseSet. Specifically,
when invoking DIArgList::get() from replaceVariableLocationOp, very
occasionally it returns a new DIArgList object, when one already exists
having the same exact Args pointers. This in turn causes a subsequent
call to Instruction::isIdenticalToWhenDefined on those two otherwise
identical DIArgList objects during a later pass to return false, leading
to different IR in those rare cases.

I modified DIArgList::handleChangedOperands to perform similar
re-uniquing as the MDNode version used by other metadata node types.
This also necessitated a change to the context destructor, since in some
cases we end up with DIArgList as distinct nodes: DIArgList is the only
metadata node type to have a custom dropAllReferences, so we need to
invoke that version on DIArgList in the DistinctMDNodes store to clean
it up properly.

Differential Revision: https://reviews.llvm.org/D108968
2021-09-01 07:04:02 -07:00
Ivan Zhechev 5a3a126618 [Flang] test_symbols.py module file fix
Due to how the LIT deals with module files,
this change stores and runs the scripts in
their own temporary directory to prevent
interference in-between different tests.
It also makes ``test_symbols.py`` be more
consistent with the other scripts.

Reviewed By: Meinersbur, awarzynski

Differential Revision: https://reviews.llvm.org/D107953
2021-09-01 15:02:41 +01:00
Jon Chesterfield f8bcbb82a7 [libomptarget] Normalise a cmake debug string, checking it triggers CI 2021-09-01 14:24:28 +01:00
Andrej Korman eee687a66d [lldb] Add minidump save-core functionality to ELF object files
This change adds save-core functionality into the ObjectFileELF that enables
saving minidump of a stopped process. This change is mainly targeting Linux
running on x86_64 machines. Minidump should contain basic information needed
to examine state of threads, local variables and stack traces. Full support
for other platforms is not so far implemented. API tests are using LLDB's
MinidumpParser.

This relands commit aafa05e, reverted in 1f986f6.
Failed tests were fixed.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D108233
2021-09-01 15:14:29 +02:00
Erich Keane 42ae7eb581 Ensure field-annotations on pointers properly match the AS of the field.
Discovered in SYCL, the field annotations were always cast to an i8*,
which is an invalid bitcast for a pointer type with an address space.
This patch makes sure that we create an intrinsic that takes a pointer
to the correct address-space and properly do our casts.

Differential Revision: https://reviews.llvm.org/D109003
2021-09-01 06:12:24 -07:00
Nico Weber 9b6c8132d3 Revert "Reland "[clang-repl] Re-implement clang-interpreter as a test case.""
This reverts commit f0514a4d26.
Test fails on macOS: https://reviews.llvm.org/D107049#2976603
2021-09-01 08:35:33 -04:00
Joe Loser 2d400db63c
[libcxx] contiguous iterator concept: don't require pointer or complete element types
`contiguous_iterator` requires the iterator type passed is either a
pointer type or that the element type of the iterator is a complete
object type. These constraints are not part of the current wording in
defining the `contiguous_iterator` concept - adjust the concept to
reflect this.

Inspired from discussion at https://reviews.llvm.org/D108645.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D108855
2021-09-01 08:32:41 -04:00
Florian Hahn a3d357e504
[FileCheck] Use StringRef for MatchRegexp to fix crash.
If MatchRegexp is an invalid regex, an error message will be printed
using SourceManager::PrintMessage via AddRegExToRegEx.

PrintMessage relies on the input being a StringRef into a string managed
by SourceManager. At the moment, a StringRef to a std::string
allocated in the caller of AddRegExToRegEx is passed. If the regex is
invalid, this StringRef is passed to PrintMessage, where it will crash,
because it does not point to a string managed via SourceMgr.

This patch fixes the crash by turning MatchRegexp into a StringRef If
we use MatchStr, we directly use that StringRef, which points into a
string from SourceMgr. Otherwise, MatchRegexp gets assigned
Format.getWildcardRegex(), which returns a std::string. To extend the
lifetime, assign it to a std::string variable WildcardRegexp and assign
MatchRegexp to a stringref to WildcardRegexp. WildcardRegexp should
always be valid, so we should never have to print an error message
via the SoureMgr I think.

Fixes PR49319.

Reviewed By: thopre

Differential Revision: https://reviews.llvm.org/D109050
2021-09-01 14:27:14 +02:00
Joe Loser 2498f8fd76
[libcxx][docs] Remove completed issues from TODO.TXT
Remove tasks listed that refer to papers or issues that are marked complete in
`libcxx/docs/Status/Cxx17Papers.csv` or `libcxx/docs/Status/Cxx17Issues.csv`

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D108856
2021-09-01 08:22:23 -04:00
Joe Loser f76bdb9b82
[libcxx][docs] Mark LWG3356 as complete
Feature test macro for `__cpp_lib_is_nothrow_convertible` was introduced in
466df1718e but the LWG issue was not marked as
`Complete` in the docs. Also, fix the formatting of `Complete` for
LWG 3348.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D108964
2021-09-01 08:20:03 -04:00
Zahira Ammarguellat cec7c2b32e Revert "[CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly"
The intent of this patch is to add support of -fp-model=[source|double|extended] to allow
the compiler to use a wider type for intermediate floating point calculations. As a side
effect to that, the value of FLT_EVAL_METHOD is changed according to the pragma
float_control.
Unfortunately some issue was uncovered with this change in preprocessing. See details in
https://reviews.llvm.org/D93769 . We are therefore reverting this patch until we find a way
to reconcile the value of FLT_EVAL_METHOD, the pragma and the -E flow.

This reverts commit 66ddac22e2.
2021-09-01 04:48:50 -07:00
David Sherwood f024a4818d [NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve-intrinsics.ll 2021-09-01 12:09:58 +01:00
David Sherwood 930d5077f4 Revert "[NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve-intrinsics.ll"
This reverts commit aeb2bd68dc.
2021-09-01 11:52:29 +01:00
David Sherwood aeb2bd68dc [NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve-intrinsics.ll 2021-09-01 11:44:02 +01:00
Saiyedul Islam 83f3782c61 [clang-nvlink-wrapper] Wrapper around nvlink for archive files
nvlink does not support linking of cubin files archived in an archive.
 This tool extracts all the cubin files in the given device specific archive
 and pass them to nvlink. It is required for linking static device libraries
 for nvptx.

 Reviewed By: ye-luo

 Differential Revision: https://reviews.llvm.org/D108291
2021-09-01 16:00:29 +05:30
Vassil Vassilev f0514a4d26 Reland "[clang-repl] Re-implement clang-interpreter as a test case."
Original commit message:"
  The current infrastructure in lib/Interpreter has a tool, clang-repl, very
  similar to clang-interpreter which also allows incremental compilation.

  This patch moves clang-interpreter as a test case and drops it as conditionally
  built example as we already have clang-repl in place.

  Differential revision: https://reviews.llvm.org/D107049
"

This patch also ignores ppc due to missing weak symbol for __gxx_personality_v0
which may be a feature request for the jit infrastructure. Also, adds a missing
build system dependency to the orc jit.
2021-09-01 10:21:38 +00:00
Alexander Kornienko 893ac53afc Fix -Wunused-variable 2021-09-01 11:29:30 +02:00
Vignesh Balasubramanian b9a27908f9 [OpenMP][OMPD] Implementation of OMPD debugging library - libompd.
This is a continuation of the review: https://reviews.llvm.org/D100181
Creates a new directory "libompd" under openmp.

"TargetValue" provides operational access to the OpenMP runtime memory
 for OMPD APIs.
With TargetValue, using "pointer" a user can do multiple operations
from casting, dereferencing to accessing an element for structure.
The member functions are designed to concatenate the operations that
are needed to access values from structures.

e.g., _a[6]->_b._c would read like :
TValue(ctx, "_a").cast("A",2)
	.getArrayElement(6).access("_b").cast("B").access("_c")
For example:
If you have a pointer "ThreadHandle" of a running program then you can
access/retrieve "threadID" from the memory using TargetValue as below.

  TValue(context, thread_handle->th) /*__kmp_threads[t]->th*/
    .cast("kmp_base_info_t")
    .access("th_info") /*__kmp_threads[t]->th.th_info*/
    .cast("kmp_desc_t")
    .access("ds") /*__kmp_threads[t]->th.th_info.ds*/
    .cast("kmp_desc_base_t")
    .access("ds_thread") /*__kmp_threads[t]->th.th_info.ds.ds_thread*/
                .cast("kmp_thread_t")
.getRawValue(thread_id, 1);

Reviewed By: @hbae
Differential Revision: https://reviews.llvm.org/D100182
2021-09-01 14:50:16 +05:30
Justas Janickas fb321c2ea2 [OpenCL] Define OpenCL 3.0 optional core features in C++ for OpenCL 2021
Modifies OpenCL 3.0 optional core feature macro definitions so that
they are set analogously in C++ for OpenCL 2021.

This change aims to achieve compatibility between C++ for OpenCL
2021 and OpenCL 3.0.

Differential Revision: https://reviews.llvm.org/D108704
2021-09-01 10:15:17 +01:00
Michał Górny c568985845 [lldb] [gdb-remote client] Remove breakpoints throughout vfork
Temporarily remove breakpoints for the duration of vfork, in order
to prevent them from triggering in the child process.  Restore them
once the server reports that vfork has finished and it is ready to
resume execution.

Differential Revision: https://reviews.llvm.org/D100267
2021-09-01 10:33:48 +02:00
Fangrui Song 4852c770fe [SCEV] Fix GCC -Wnon-virtual-dtor
SCEVPredicate has a friend declaration. The friend can technically call the
protected destructor, so the warning is legitimate. Clang simply doesn't implement
the friend check.

Make the dtor virtual to fix the issue.
2021-09-01 01:12:32 -07:00
Fraser Cormack 85fd44d7fe [SelectionDAG][NFC] Fix typo in assertion message
s/Uexpected/Unexpected.
2021-09-01 08:55:06 +01:00
Christudasan Devadasan 4dab15288d [AMDGPU] Introduce RC flags for vector register classes
Configure and use the TSFlags in TargetRegisterClass to
have unique flags for VGPR and AGPR register classes.
The vector register class queries like `hasVGPRs` will
now become more efficient with just a bitwise operation.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D108815
2021-09-01 02:55:45 -04:00
Kai Luo 5eaebd5d64 [PowerPC] Implement quadword atomic load/store
Add support to load/store i128 atomically.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D105612
2021-09-01 06:55:40 +00:00
Michał Górny ceccbb8145 Revert "[lldb] [gdb-remote client] Remove breakpoints throughout vfork"
This reverts commit 199344d832.
It caused regressions on arm, as reported by lldb-arm-ubuntu buildbot.
2021-09-01 08:53:35 +02:00
Vassil Vassilev 04bbd189a9 Revert "[clang-repl] Re-implement clang-interpreter as a test case."
This reverts commit 319ce98011 because it fails
on various platforms.
2021-09-01 06:49:52 +00:00
Sylvestre Ledru d396d09fc2 Document LLVM_ENABLE_RUNTIMES
Reviewed By: phosek, MaskRay

Differential Revision: https://reviews.llvm.org/D108890
2021-09-01 08:45:40 +02:00
Jean Perier c5729f2e63 [flang] Set default form if unspecified at end of OPEN statement
The standard specifies that the form must be set to a default at the
end of an open statement (C.7.4 point 2) where it was not specified.
Only in the case of a pre-connected unit can the form be deferred
until the first data transfer statement.

Set back the default form setting in OpenStatementState::EndIoStatement
that had been removed when deferring the pre-connected unit from setting
in 199a623ebf.

Also return "UNDEFINED" instead of "UNKNOWN" to the FORM inquiry when the
form was not yet specified as defined in 12.10.2.12.

Related test: syntax 215a216.

Differential Revision: https://reviews.llvm.org/D108990
2021-09-01 08:40:43 +02:00
Luke a78dd726f4 [SLP][RISCV] Implement unsigned getMinVectorRegisterBitWidth() for RISCV
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D108973
2021-09-01 14:25:15 +08:00
Michał Górny 199344d832 [lldb] [gdb-remote client] Remove breakpoints throughout vfork
Temporarily remove breakpoints for the duration of vfork, in order
to prevent them from triggering in the child process.  Restore them
once the server reports that vfork has finished and it is ready to
resume execution.

Differential Revision: https://reviews.llvm.org/D100267
2021-09-01 08:16:12 +02:00
Anton Afanasyev ff780014b2 [Test][Time profiler] Fix test time checking
This test sometimes triggers failures during build testing. For instance, see:
https://lab.llvm.org/buildbot/#/builders/52/builds/10161, details: https://lab.llvm.org/buildbot/#/builders/52/builds/10161/steps/5/logs/FAIL__Clang__check-time-trace-sections_cpp .
AFAICT the time between driver calling and checking its time tracker output
is not guaranteed to be stable and small:
```
> head -2 check-time-trace-sections.cpp
// RUN: %clangxx -S -ftime-trace -ftime-trace-granularity=0 -o %T/check-time-trace-sections %s
// RUN: cat %T/check-time-trace-sections.json | %python %S/check-time-trace-sections.py
> clang -S -ftime-trace -ftime-trace-granularity=0 -o /tmp/check check-time-trace-sections.cpp
> cat /tmp/check.json | python check-time-trace-sections.py
> sleep 10
> cat /tmp/check.json | python check-time-trace-sections.py
'beginningOfTime' should represent the absolute time when the process has started
>
```
The attribute `beginningOfTime` was introduced here: https://reviews.llvm.org/D78030
One can change "10 sec" value to something longer, but I believe
it's enough just to check that `beginningOfTime` exists and is
not later than current time.

Differential Revision: https://reviews.llvm.org/D108625
2021-09-01 09:11:36 +03:00
Fangrui Song 01152626ab [Linker] Handle comdat nodeduplicate
For a variable in a comdat nodeduplicate, its initializer may be significant.
E.g. its content may be implicitly referenced by another comdat member (or
required to parallel to another comdat member by the runtime when explicit
section is used). We can clone it into an unnamed private linkage variable to
preserve its content.

This partially fixes PR51394 (Sony's proprietary linker using LTO): no error
will be reported. This is partial because we do not guarantee the global
variable order if the runtime has parallel section requirement.

---

There is a similar issue for regular LTO, but unrelated to PR51394:

with lib/LTO (using either ld.lld or LLVMgold.so), linking two modules
with a weak function of the same name, can leave one weak profc and two
private profd, due to lib/LTO's current deficiency that it mixes the two
concepts together: comdat selection and symbol resolution. If the issue
is considered important, we should suppress private profd for the weak+
regular LTO case.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D108879
2021-08-31 22:32:20 -07:00
Vassil Vassilev 319ce98011 [clang-repl] Re-implement clang-interpreter as a test case.
The current infrastructure in lib/Interpreter has a tool, clang-repl, very
similar to clang-interpreter which also allows incremental compilation.

This patch moves clang-interpreter as a test case and drops it as conditionally
built example as we already have clang-repl in place.

Differential revision: https://reviews.llvm.org/D107049
2021-09-01 05:23:21 +00:00
hsmahesha 98f4713122 [AMDGPU] Split entry basic block after alloca instructions.
While initializing the LDS pointers within entry basic block of kernel(s), make
sure that the entry basic block is split after alloca instructions.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D108971
2021-09-01 10:18:44 +05:30
Christudasan Devadasan 6a75041a16 [TableGen] Allow target specific flags for RegisterClass
Analogous to the TSFlags for machine instructions, this
patch introduces a bit vector for register classes to have
target specific flags that become a tablegened value in
TargetRegisterClass.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D108767
2021-08-31 22:29:11 -04:00
Yonghong Song 89424a829f [DWARF] Support new TAG DW_TAG_LLVM_annotation
A new LLVM specific TAG DW_TAG_LLVM_annotation is added.
The name is suggested by Paul Robinson ([1]).
Currently, this tag is used to output __attribute__((btf_tag("string")))
annotations in dwarf. The following is an example for a global
variable with two btf_tag attributes:
  0x0000002a:   DW_TAG_variable
                  DW_AT_name      ("g1")
                  DW_AT_type      (0x00000052 "int")
                  DW_AT_external  (true)
                  DW_AT_decl_file ("/tmp/home/yhs/work/tests/llvm/btf_tag/t.c")
                  DW_AT_decl_line (8)
                  DW_AT_location  (DW_OP_addr 0x0)

  0x0000003f:     DW_TAG_LLVM_annotation
                    DW_AT_name    ("btf_tag")
                    DW_AT_const_value     ("tag1")

  0x00000048:     DW_TAG_LLVM_annotation
                    DW_AT_name    ("btf_tag")
                    DW_AT_const_value     ("tag2")

  0x00000051:     NULL

In the future, DW_TAG_LLVM_annotation may encode other type
of non-string const value.

 [1] https://lists.llvm.org/pipermail/llvm-dev/2021-June/151250.html

Differential Revision: https://reviews.llvm.org/D106621
2021-08-31 19:22:17 -07:00
Joel E. Denny 1688b4cf8e [OpenMP][AMDGPU] XFAIL test where kernels call printf 2021-08-31 22:11:28 -04:00
Michael Kruse c62d9a5ca0 [Polly] Use subtyped isl::schedule_nodes for ScheduleTreeVisitor. NFC.
Change pass-by-const-ref to pass-by-value as objects are recreated
due to custom up-/down-casting anwyway.
2021-08-31 20:54:12 -05:00
Michael Kruse c6913905d1 [Polly] Mention correct flag in debug output. NFCI. 2021-08-31 20:54:12 -05:00