Arthur Eubanks [Fri, 20 Aug 2021 17:49:36 +0000 (10:49 -0700)]
[NFC] Use newly introduced *AtIndex methods
Introduced in D108788. These are clearer.
Adrian Prantl [Wed, 1 Sep 2021 18:09:16 +0000 (11:09 -0700)]
Tighten heuristic for coroutine debug info workaround.
The OutermostLoad condition is supposed to strip the outermost
DW_OP_deref operation because dbg.declares are implicitly
indirect. This patch makes sure the heuristic is only applied to
dbg.declare intrinsics and only if the outermost instruction is a
load.
This was found while qualifying the latest Swift compiler rebranch.
rdar://
82037764
Craig Topper [Wed, 1 Sep 2021 16:48:46 +0000 (09:48 -0700)]
[RISCV] Add a test case showing an extra sext.w near a sh2add with multiple uses. NFC
See description in test.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D108965
LLVM GN Syncbot [Wed, 1 Sep 2021 17:49:53 +0000 (17:49 +0000)]
[gn build] Port
0922ce56f4f0
Jon Chesterfield [Wed, 1 Sep 2021 17:47:55 +0000 (18:47 +0100)]
[libomptarget] Set runpath on libomptarget, use that to drop LD_LIBRARY_PATH from test runner
Using rpath instead of LD_LIBRARY_PATH to find libomp.so and
libomptarget.so lets one rerun the already built test executables without
setting environment variables and removes the risk of the test runner picking
up different libraries to the developer debugging the failure.
rpath usually means runpath, which is not transitive, so set runpath on
libomptarget itself so that it can find the plugins located next to it,
spelled $ORIGIN. This provides sufficient functionality to drop D102043
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D109071
Artem Belevich [Fri, 27 Aug 2021 18:18:11 +0000 (11:18 -0700)]
[IRLinker] Suppress linker warnings when linking with CUDA libdevice.
libdevice bitcode provided by NVIDIA is linked with clang/LLVM-generated IR
which uses nvptx*-nvidia-cuda triple. We need to mark them as compatible.
Differential Revision: https://reviews.llvm.org/D108835
Mark de Wever [Sat, 5 Dec 2020 10:45:21 +0000 (11:45 +0100)]
[libc++][format] Add __format_arg_store.
This implements the struct `__format_arg_store` and its dependencies:
* the class basic_format_arg,
* the class basic_format_args,
* the class basic_format_context,
* the function make_format_args,
* the function wmake_format_args,
* the function visit_format_arg,
* several Standard required typedefs.
The following parts will be implemented in a later patch:
* the child class `basic_format_arg::handle`,
* the function `basic_format_arg::basic_format_arg(const T* p)`.
The following extension has been implemented:
* the class basic_format_arg supports `__[u]int128_t` on platform where libc++ supports 128 bit integrals.
Implements parts of:
* P0645 Text Formatting
Completes:
* LWG3371 visit_format_arg and make_format_args are not hidden friends
* LWG3542 basic_format_arg mishandles basic_string_view with custom traits
Note https://mordante.github.io/blog/2021/06/05/format.html gives a bit more information about the goals and non-goals of this initial patch series.
Reviewed By: #libc, ldionne, vitaut
Differential Revision: https://reviews.llvm.org/D103357
Arthur Eubanks [Fri, 20 Aug 2021 17:49:36 +0000 (10:49 -0700)]
[NFC] Rename attribute methods that work with indexes
This is part one of a couple of patches to fully rename these methods.
I've made the mistake of assuming that these indexes are for parameters
multiple times, but actually they're based off of a weird indexing
scheme AttributeList::AttrIndex where 0 is the return value and ~0 is
the function. Hopefully renaming these methods will make this clearer.
Ideally users should use more specific methods like
AttributeList::getFnAttr().
This patch simply adds the name that we want in the end. This is so the
removal of the methods with the original names happens in a separate
change to make it easier for downstream users.
This touches all relevant methods in AttributeList, CallBase, and Function.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D108788
Thomas Lively [Wed, 1 Sep 2021 17:27:41 +0000 (10:27 -0700)]
[WebAssembly] Lower v2f32 to v2f64 extending loads with promote_low
Previously extra wide v4f32 to v4f64 extending loads would be legalized to v2f32
to v2f64 extending loads, which would then be scalarized by legalization. (v2f32
to v2f64 extending loads not produced by legalization were already being emitted
correctly.) Instead, mark v2f32 to v2f64 extending loads as legal and explicitly
lower them using promote_low. This regresses the addressing modes supported for
the extloads not produced by legalization, but that's a fine trade off for now.
Differential Revision: https://reviews.llvm.org/D108496
Hongtao Yu [Wed, 1 Sep 2021 17:19:39 +0000 (10:19 -0700)]
[CSSPGO] Fix an access violation due to invalided std::vector pointer invalidation.
std::vector pointers can be invalided while growing. Using std::list instead.
Amara Emerson [Wed, 1 Sep 2021 00:22:39 +0000 (17:22 -0700)]
[AArch64][GlobalISel] Handle any-extending FPR loads in manual selection code.
When we have an any-extending FPR bank load, none of the tablegen patterns
match and we fall back to the C++ selector. Like with the truncating stores
that were fixed recently, the C++ wasn't able to handle it and ended up
generating invalid copies between different size regclasses.
This change adds handling for this case, splitting the load into a regular
load and a SUBREG_TO_REG to extend it into the original wide destination reg.
natashaknk [Wed, 1 Sep 2021 17:00:30 +0000 (10:00 -0700)]
[mlir][tosa] Small refactor to the functionality of Depthwise_Conv2D to add the bias at the end of the convolution
Follow-up to the Conv2d and fully_connected lowering adjustments
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D108949
Tyler Augustine [Wed, 1 Sep 2021 16:54:04 +0000 (16:54 +0000)]
Support alias.scope and noalias metadata lowering on intrinsics.
Builds on https://reviews.llvm.org/D107870 to support annotating intrinsics with alias.scope and noalias metadata.
Reviewed By: arpith-jacob, ftynse
Differential Revision: https://reviews.llvm.org/D109025
peter klausler [Tue, 10 Aug 2021 17:22:39 +0000 (10:22 -0700)]
[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
hsmahesha [Wed, 1 Sep 2021 16:22:20 +0000 (21:52 +0530)]
Revert "Revert "Disable ReplaceLDS pass, patch up tests to match""
This reverts commit
5ae6804d179edd29ac822c2e34a5cee7053793e1.
Hongtao Yu [Mon, 30 Aug 2021 17:31:47 +0000 (10:31 -0700)]
[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
Nikita Popov [Tue, 31 Aug 2021 20:02:08 +0000 (22:02 +0200)]
[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
serge-sans-paille [Mon, 30 Aug 2021 20:21:39 +0000 (22:21 +0200)]
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
hsmahesha [Wed, 1 Sep 2021 15:48:00 +0000 (21:18 +0530)]
Revert "Disable ReplaceLDS pass, patch up tests to match"
This reverts commit
50ad3478bdd3f0643ee94f6663293af5b3c27afe.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D109062
Kazu Hirata [Wed, 1 Sep 2021 15:48:31 +0000 (08:48 -0700)]
[clang-tidy] Fix documentation typos (NFC)
Louis Dionne [Tue, 31 Aug 2021 14:49:06 +0000 (10:49 -0400)]
[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
Louis Dionne [Tue, 31 Aug 2021 21:46:01 +0000 (17:46 -0400)]
[libc++][NFC] Correct comment about P0600 missing node_handle bits
Differential Revision: https://reviews.llvm.org/D109027
Louis Dionne [Tue, 31 Aug 2021 14:32:11 +0000 (10:32 -0400)]
[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
Louis Dionne [Wed, 1 Sep 2021 14:47:03 +0000 (10:47 -0400)]
[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.
Teresa Johnson [Tue, 31 Aug 2021 03:07:01 +0000 (20:07 -0700)]
[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
Ivan Zhechev [Wed, 1 Sep 2021 13:07:32 +0000 (14:07 +0100)]
[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
Jon Chesterfield [Wed, 1 Sep 2021 13:23:14 +0000 (14:23 +0100)]
[libomptarget] Normalise a cmake debug string, checking it triggers CI
Andrej Korman [Wed, 1 Sep 2021 13:13:56 +0000 (15:13 +0200)]
[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
Erich Keane [Tue, 31 Aug 2021 16:50:01 +0000 (09:50 -0700)]
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
Nico Weber [Wed, 1 Sep 2021 12:32:00 +0000 (08:32 -0400)]
Revert "Reland "[clang-repl] Re-implement clang-interpreter as a test case.""
This reverts commit
f0514a4d26100239088f08d618f2ba100f59958e.
Test fails on macOS: https://reviews.llvm.org/D107049#2976603
Joe Loser [Wed, 1 Sep 2021 12:32:34 +0000 (08:32 -0400)]
[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
Florian Hahn [Wed, 1 Sep 2021 11:41:20 +0000 (13:41 +0200)]
[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
Joe Loser [Wed, 1 Sep 2021 12:22:16 +0000 (08:22 -0400)]
[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
Joe Loser [Wed, 1 Sep 2021 12:19:30 +0000 (08:19 -0400)]
[libcxx][docs] Mark LWG3356 as complete
Feature test macro for `__cpp_lib_is_nothrow_convertible` was introduced in
466df1718e41fe2fca6ce6bd98c01b18f42c05e4 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
Zahira Ammarguellat [Wed, 1 Sep 2021 11:48:50 +0000 (04:48 -0700)]
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
66ddac22e2a7f268e91c26d694112970dfa607ae.
David Sherwood [Wed, 1 Sep 2021 11:09:58 +0000 (12:09 +0100)]
[NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve-intrinsics.ll
David Sherwood [Wed, 1 Sep 2021 10:52:29 +0000 (11:52 +0100)]
Revert "[NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve-intrinsics.ll"
This reverts commit
aeb2bd68dcb1df682ad549b4033cfad072efabd4.
David Sherwood [Wed, 1 Sep 2021 10:37:20 +0000 (11:37 +0100)]
[NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve-intrinsics.ll
Saiyedul Islam [Wed, 18 Aug 2021 11:43:30 +0000 (17:13 +0530)]
[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
Vassil Vassilev [Wed, 1 Sep 2021 08:02:46 +0000 (08:02 +0000)]
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.
Alexander Kornienko [Wed, 1 Sep 2021 09:27:33 +0000 (11:27 +0200)]
Fix -Wunused-variable
Vignesh Balasubramanian [Wed, 1 Sep 2021 08:13:13 +0000 (13:43 +0530)]
[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
Justas Janickas [Wed, 25 Aug 2021 14:19:42 +0000 (15:19 +0100)]
[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
Michał Górny [Sun, 11 Apr 2021 15:16:43 +0000 (17:16 +0200)]
[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
Fangrui Song [Wed, 1 Sep 2021 08:12:32 +0000 (01:12 -0700)]
[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.
Fraser Cormack [Wed, 1 Sep 2021 07:55:06 +0000 (08:55 +0100)]
[SelectionDAG][NFC] Fix typo in assertion message
s/Uexpected/Unexpected.
Christudasan Devadasan [Fri, 27 Aug 2021 04:05:41 +0000 (00:05 -0400)]
[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
Kai Luo [Wed, 1 Sep 2021 06:54:59 +0000 (06:54 +0000)]
[PowerPC] Implement quadword atomic load/store
Add support to load/store i128 atomically.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D105612
Michał Górny [Wed, 1 Sep 2021 06:53:11 +0000 (08:53 +0200)]
Revert "[lldb] [gdb-remote client] Remove breakpoints throughout vfork"
This reverts commit
199344d832c1bed1d75b1db2c1493e5a3e5c5544.
It caused regressions on arm, as reported by lldb-arm-ubuntu buildbot.
Vassil Vassilev [Wed, 1 Sep 2021 06:49:17 +0000 (06:49 +0000)]
Revert "[clang-repl] Re-implement clang-interpreter as a test case."
This reverts commit
319ce98011742141dad8dd95a2f9de9c0449be5c because it fails
on various platforms.
Sylvestre Ledru [Wed, 1 Sep 2021 06:45:15 +0000 (08:45 +0200)]
Document LLVM_ENABLE_RUNTIMES
Reviewed By: phosek, MaskRay
Differential Revision: https://reviews.llvm.org/D108890
Jean Perier [Wed, 1 Sep 2021 06:39:39 +0000 (08:39 +0200)]
[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
199a623ebf808a01e920ebd9904c99e633c33a1f.
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
Luke [Wed, 1 Sep 2021 05:08:13 +0000 (13:08 +0800)]
[SLP][RISCV] Implement unsigned getMinVectorRegisterBitWidth() for RISCV
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D108973
Michał Górny [Sun, 11 Apr 2021 15:16:43 +0000 (17:16 +0200)]
[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
Anton Afanasyev [Wed, 25 Aug 2021 22:32:39 +0000 (01:32 +0300)]
[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
Fangrui Song [Wed, 1 Sep 2021 05:32:20 +0000 (22:32 -0700)]
[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
Vassil Vassilev [Thu, 29 Jul 2021 07:30:06 +0000 (07:30 +0000)]
[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
hsmahesha [Wed, 1 Sep 2021 04:48:21 +0000 (10:18 +0530)]
[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
Christudasan Devadasan [Thu, 26 Aug 2021 13:42:06 +0000 (09:42 -0400)]
[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
Yonghong Song [Mon, 19 Jul 2021 16:54:33 +0000 (09:54 -0700)]
[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
Joel E. Denny [Wed, 1 Sep 2021 02:11:28 +0000 (22:11 -0400)]
[OpenMP][AMDGPU] XFAIL test where kernels call printf
Michael Kruse [Wed, 1 Sep 2021 01:20:12 +0000 (20:20 -0500)]
[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.
Michael Kruse [Wed, 1 Sep 2021 01:47:42 +0000 (20:47 -0500)]
[Polly] Mention correct flag in debug output. NFCI.
Wang, Pengfei [Wed, 1 Sep 2021 00:26:26 +0000 (08:26 +0800)]
[X86] Enable half type support in inline assembly constraints
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D105799
Petr Hosek [Wed, 25 Aug 2021 08:12:19 +0000 (01:12 -0700)]
[Linker] Support weak symbols in nodeduplicate COMDAT group
When a nodeduplicate COMDAT group contains a weak symbol, choose
a non-weak symbol (or one of the weak ones) rather than reporting
an error. This should address issue PR51394.
With the current IR representation, a generic comdat nodeduplicate
semantics is not representable for LTO. In the linker, sections and
symbols are separate concepts. A dropped weak symbol does not force the
defining input section to be dropped as well (though it can be collected
by GC). In the IR, when a weak linkage symbol is dropped, its associate
section content is dropped as well.
For InstrProfiling, which is where ran into this issue in PR51394, the
deduplication semantic is a sufficient workaround.
Differential Revision: https://reviews.llvm.org/D108689
Sanjay Patel [Tue, 31 Aug 2021 20:22:17 +0000 (16:22 -0400)]
[InstCombine] add tests for min/max intrinsics with not ops; NFC
Alexandre Ganea [Tue, 31 Aug 2021 23:03:44 +0000 (19:03 -0400)]
[LLD][COFF] Clean paths in PDB even when /pdbsourcepath is omitted
Differential Revision: https://reviews.llvm.org/D109030
Joseph Huber [Tue, 31 Aug 2021 19:03:33 +0000 (15:03 -0400)]
[OpenMP] Add an option to always inline OpenMP device functions.
Performance on GPU targets can be highly variable, sometimes inlining
everything hurts performance and sometimes it greatly improves it. Add
an option to toggle this behaviour to better investigate it.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D109014
Alex Langford [Tue, 31 Aug 2021 18:44:34 +0000 (11:44 -0700)]
[lldb] Tighten lock in Language::ForEach
It is easy to accidentally introduce a deadlock by having the callback
passed to Language::ForEach also attempt to acquire the same lock. It
is easy enough to disallow the callback from calling anything in
Language directly, but it may happen through a series of other
function/method calls.
The solution I am proposing is to tighten the lock in Language::ForEach
so that it is only held as we gather the currently loaded language
plugins. We store them in a vector and then iterate through them with
the callback so that the callback can't introduce a deadlock.
Differential Revision: https://reviews.llvm.org/D109013
wren romano [Mon, 30 Aug 2021 23:47:09 +0000 (16:47 -0700)]
[mlir][sparse] Rename the public SparseTensorStorage::asCOO to toCOO
Trying to reduce confusion by having the name of the public method match that of the private method for handling the recursion. Also adding some comments to SparseTensorStorage::fromCOO to help clarify what the recursive calls are doing in the dense case.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D108954
Andrew Browne [Tue, 31 Aug 2021 22:35:08 +0000 (15:35 -0700)]
[DFSan][NFC] Fix comment formatting.
Vy Nguyen [Tue, 31 Aug 2021 19:52:17 +0000 (15:52 -0400)]
[llvm-ar][nfc] Reword help message to be less ambiguous on what p and t do.
The current help msg isn't super clear on whether t prints the content of the files or just the list of files.
(I'd certainly thought it'd print the list of files, and accidentally had a bunch of "gargabe" printed to my terminal).
Similarly, t sounded like it'd do what p actually did.
Differential Revision: https://reviews.llvm.org/D109018
Kevin Athey [Tue, 31 Aug 2021 21:00:30 +0000 (14:00 -0700)]
Revert "[OptTable] Improve error message output for grouped short options"
This reverts commit
71d7fed3bc2ad6c22729d446526a59fcfd99bd03.
Reason: broke sanitizer bots
more info: https://reviews.llvm.org/D108770
Louis Dionne [Tue, 31 Aug 2021 20:43:06 +0000 (16:43 -0400)]
[libc++][NFC] Remove redundant friend declaration for operator==
This must have been meant to be friend-declaring operator!=, but it
turns out that it's not even necessary to make it a friend since it
does not access any private state.
rdar://
82568613
Stanislav Mekhanoshin [Mon, 30 Aug 2021 21:49:50 +0000 (14:49 -0700)]
[RegAlloc] Immediately delete dead instructions with live uses
When RA eliminated a dead def it can either immediately delete
the instruction itself or replace it with KILL to defer the
actual removal. If this instruction has a virtual register use
killing the register it will shrink the LI of the use. However,
if the LI covers the instruction and extends beyond it the
shrink will not happen. In fact that is impossible to shrink
such use because of the KILL still using it.
If later the LI of the use will be split at the KILL and the
KILL itself is eliminated after that point the new live segment
ends up at an invalid slot index.
This extremely rare condition was hit after D106408 which has
enabled rematerialization of such instructions. The replacement
with KILL is only done for rematerialized defs which became dead
and such rematerialization did not generally happen before.
The patch deletes an instruction immediately if it is a result
of rematerialization and has such use. An alternative would be
to prohibit a split at a KILL instruction, but it looks like it
is better to split a live range rather then keeping a killed
instruction just in case it can be rematerialized further.
Fixes PR51655.
Differential Revision: https://reviews.llvm.org/D108951
Nikita Popov [Tue, 31 Aug 2021 18:10:50 +0000 (20:10 +0200)]
[SLPVectorizer] Make aliasing check more precise
SLPVectorizer currently uses AA::isNoAlias() to determine whether
two locations alias. This does not work if one of the instructions
is a call. Instead, we should check getModRefInfo(), which
determines whether an arbitrary instruction modifies or references
a given location.
Among other things, this prevents @llvm.experimental.noalias.scope.decl()
and other inaccessiblmemonly intrinsics from interfering with SLP
vectorization.
Differential Revision: https://reviews.llvm.org/D109012
wlei [Tue, 31 Aug 2021 20:27:42 +0000 (13:27 -0700)]
[llvm-profgen] Support LBR only perf script
This change aims at supporting LBR only sample perf script which is used for regular(Non-CS) profile generation. A LBR perf script includes a batch of LBR sample which starts with a frame pointer and a group of 32 LBR entries is followed. The FROM/TO LBR pair and the range between two consecutive entries (the former entry's TO and the latter entry's FROM) will be used to infer function profile info.
An example of LBR perf script(created by `perf script -F ip,brstack -i perf.data`)
```
40062f 0x40062f/0x4005b0/P/-/-/9 0x400645/0x4005ff/P/-/-/1 0x400637/0x400645/P/-/-/1 ...
4005d7 0x4005d7/0x4005e5/P/-/-/8 0x40062f/0x4005b0/P/-/-/6 0x400645/0x4005ff/P/-/-/1 ...
...
```
For implementation:
- Extended a new child class `LBRPerfReader` for the sample parsing, reused all the functionalities in `extractLBRStack` except for an extension to parsing leading instruction pointer.
- `HybridSample` is reused(just leave the call stack empty) and the parsed samples is still aggregated in `AggregatedSamples`. After that, range samples, branch sample, address samples are computed and recorded.
- Reused `ContextSampleCounterMap` to store the raw profile, since it's no need to aggregation by context, here it just registered one sample counter with a fake context key.
- Unified to use `show-raw-profile` instead of `show-unwinder-output` to dump the intermediate raw profile, see the comments of the format of the raw profile. For CS profile, it remains to output the unwinder output.
Profile generation part will come soon.
Differential Revision: https://reviews.llvm.org/D108153
peter klausler [Thu, 26 Aug 2021 23:01:03 +0000 (16:01 -0700)]
[flang] Fold UNPACK and TRANSPOSE
Implement constant folding for the transformational intrinsic
functions UNPACK and TRANSPOSE.
Differential Revision: https://reviews.llvm.org/D109010
Joel E. Denny [Tue, 31 Aug 2021 19:21:16 +0000 (15:21 -0400)]
[OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in runtime (2/2)
This patch implements OpenMP runtime support for an original OpenMP
extension we have developed to support OpenACC: the `ompx_hold` map
type modifier. The previous patch in this series, D106509, implements
Clang support and documents the new functionality in detail.
Reviewed By: grokos
Differential Revision: https://reviews.llvm.org/D106510
Joel E. Denny [Tue, 31 Aug 2021 19:17:07 +0000 (15:17 -0400)]
[OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2)
This patch implements Clang support for an original OpenMP extension
we have developed to support OpenACC: the `ompx_hold` map type
modifier. The next patch in this series, D106510, implements OpenMP
runtime support.
Consider the following example:
```
#pragma omp target data map(ompx_hold, tofrom: x) // holds onto mapping of x
{
foo(); // might have map(delete: x)
#pragma omp target map(present, alloc: x) // x is guaranteed to be present
printf("%d\n", x);
}
```
The `ompx_hold` map type modifier above specifies that the `target
data` directive holds onto the mapping for `x` throughout the
associated region regardless of any `target exit data` directives
executed during the call to `foo`. Thus, the presence assertion for
`x` at the enclosed `target` construct cannot fail. (As usual, the
standard OpenMP reference count for `x` must also reach zero before
the data is unmapped.)
Justification for inclusion in Clang and LLVM's OpenMP runtime:
* The `ompx_hold` modifier supports OpenACC functionality (structured
reference count) that cannot be achieved in standard OpenMP, as of
5.1.
* The runtime implementation for `ompx_hold` (next patch) will thus be
used by Flang's OpenACC support.
* The Clang implementation for `ompx_hold` (this patch) as well as the
runtime implementation are required for the Clang OpenACC support
being developed as part of the ECP Clacc project, which translates
OpenACC to OpenMP at the directive AST level. These patches are the
first step in upstreaming OpenACC functionality from Clacc.
* The Clang implementation for `ompx_hold` is also used by the tests
in the runtime implementation. That syntactic support makes the
tests more readable than low-level runtime calls can. Moreover,
upstream Flang and Clang do not yet support OpenACC syntax
sufficiently for writing the tests.
* More generally, the Clang implementation enables a clean separation
of concerns between OpenACC and OpenMP development in LLVM. That
is, LLVM's OpenMP developers can discuss, modify, and debug LLVM's
extended OpenMP implementation and test suite without directly
considering OpenACC's language and execution model, which can be
handled by LLVM's OpenACC developers.
* OpenMP users might find the `ompx_hold` modifier useful, as in the
above example.
See new documentation introduced by this patch in `openmp/docs` for
more detail on the functionality of this extension and its
relationship with OpenACC. For example, it explains how the runtime
must support two reference counts, as specified by OpenACC.
Clang recognizes `ompx_hold` unless `-fno-openmp-extensions`, a new
command-line option introduced by this patch, is specified.
Reviewed By: ABataev, jdoerfert, protze.joachim, grokos
Differential Revision: https://reviews.llvm.org/D106509
Nikita Popov [Tue, 31 Aug 2021 20:12:13 +0000 (22:12 +0200)]
[LoadStoreVectorizer] Add test for inaccessiblememonly call (NFC)
Fangrui Song [Tue, 31 Aug 2021 20:09:54 +0000 (13:09 -0700)]
[ELF][test] Fix R_AARCH64_ADR_PREL_PG_HI21 typo
Found by redfast00
Louis Dionne [Mon, 30 Aug 2021 20:01:38 +0000 (16:01 -0400)]
[libc++][NFC] Rename _LIBCPP_NODISCARD_ATTRIBUTE to _LIBCPP_NODISCARD
Differential Revision: https://reviews.llvm.org/D108940
Louis Dionne [Tue, 31 Aug 2021 14:41:13 +0000 (10:41 -0400)]
[libc++] Remove workaround for broken __is_trivially_copyable on old GCC
All supported versions of GCC now do the right thing.
Differential Revision: https://reviews.llvm.org/D108997
Sylvestre Ledru [Tue, 31 Aug 2021 19:30:22 +0000 (21:30 +0200)]
Fix some typos in the llvm docs
Michał Górny [Tue, 31 Aug 2021 19:18:40 +0000 (21:18 +0200)]
[lldb] [test] Mark fork-follow-parent-softbp.test as darwin-unsupported
Mehdi Amini [Tue, 31 Aug 2021 18:49:47 +0000 (18:49 +0000)]
Fix MLIR python binding test after changes in ASM printer
Chih-Ping Chen [Mon, 30 Aug 2021 20:38:40 +0000 (16:38 -0400)]
Moved the test to X86 as it's x86 specific.
Arthur O'Dwyer [Tue, 31 Aug 2021 18:29:24 +0000 (14:29 -0400)]
[libc++] Add missing space in (__map_value_compare&__y) etc. NFCI.
peter klausler [Fri, 27 Aug 2021 20:38:06 +0000 (13:38 -0700)]
[flang] Downgrade inappropriate error message to a warning
It may not be great practice to pass a procedure (or procedure pointer)
with an implicit interface as an actual argument to correspond with
a dummy procedure (pointer), but it's not an error. Change to a
warning, and modify tests accordingly.
Differential Revision: https://reviews.llvm.org/D108932
Nick Desaulniers [Tue, 31 Aug 2021 18:11:40 +0000 (11:11 -0700)]
[RISCVISelLowering] avoid emitting libcalls to __mulodi4() and __multi3()
Similar to D108842, D108844, D108926, D108928, and D108936.
__has_builtin(builtin_mul_overflow) returns true for 32b RISCV targets,
but Clang is deferring to compiler RT when encountering long long types.
If the semantics of __has_builtin mean "the compiler resolves these,
always" then we shouldn't conditionally emit a libcall.
Link: https://bugs.llvm.org/show_bug.cgi?id=28629
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D108939
Nikita Popov [Tue, 31 Aug 2021 18:22:47 +0000 (20:22 +0200)]
[SLPVectorizer] Add test for inaccessiblememonly call (NFC)
Fangrui Song [Tue, 31 Aug 2021 18:19:04 +0000 (11:19 -0700)]
[CMake] Remove unneeded -Wdelete-non-virtual-dtor availability check
Available and good in Clang 3.5/GCC 5.
MaheshRavishankar [Tue, 31 Aug 2021 18:10:59 +0000 (11:10 -0700)]
[mlir][Linalg] Drop output tensor from `linalg.pad_tensor` op.
The output tensor was added for tiling purposes. With use of
`TilingInterface` for tiling pad operations, there is no need for an
explicit operand for the shape of result of `linalg.pad_tensor`
op. The interface allows the tiling pattern to query the value that
can be used for the "init" needed for tiling dynamically.
Differential Revision: https://reviews.llvm.org/D108613
Nick Desaulniers [Tue, 31 Aug 2021 18:00:08 +0000 (11:00 -0700)]
[PPCISelLowering] avoid emitting libcalls to __mulodi4()
Similar to D108842, D108844, and D108926.
__has_builtin(builtin_mul_overflow) returns true for 32b PPC targets,
but Clang is deferring to compiler RT when encountering long long types.
This breaks ppc44x_defconfig + CONFIG_BLK_DEV_NBD=y builds of the Linux
kernel that are using builtin_mul_overflow with these types for these
targets.
If the semantics of __has_builtin mean "the compiler resolves these,
always" then we shouldn't conditionally emit a libcall.
This will still need to be worked around in the Linux kernel in order to
continue to support these builds of the Linux kernel for this
target with older releases of clang.
Link: https://bugs.llvm.org/show_bug.cgi?id=28629
Link: https://github.com/ClangBuiltLinux/linux/issues/1438
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D108936
Philip Reames [Tue, 31 Aug 2021 17:59:02 +0000 (10:59 -0700)]
[SCEV] Add a testcase for zero max btc with non-constant exact btc
Reduced from the ArchiveCommandLine.ll case seen in D108848.
Fangrui Song [Tue, 31 Aug 2021 18:00:16 +0000 (11:00 -0700)]
[CMake] Remove unneeded -Wnon-virtual-dtor availability check
For Clang, 3.5 is the minimum requirement which has fixed the bug.
GCC 5 is good as well.
Joe Loser [Tue, 31 Aug 2021 17:41:47 +0000 (13:41 -0400)]
[libcxx][docs] Mark LWG3153 as complete
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D108967
Mehdi Amini [Sat, 28 Aug 2021 03:03:49 +0000 (03:03 +0000)]
Add a new interface allowing to set a default dialect to be used for printing/parsing regions
Currently the builtin dialect is the default namespace used for parsing
and printing. As such module and func don't need to be prefixed.
In the case of some dialects that defines new regions for their own
purpose (like SpirV modules for example), it can be beneficial to
change the default dialect in order to improve readability.
Differential Revision: https://reviews.llvm.org/D107236
Mehdi Amini [Sat, 28 Aug 2021 03:03:15 +0000 (03:03 +0000)]
Change ASM Op printer to print the operation name in the framework instead of leaving it up to each individual operation
This aligns the printer with the parser contract: the operation isn't part of the user-controllable part of the syntax.
Differential Revision: https://reviews.llvm.org/D108804