Jonas Devlieghere [Tue, 21 Jul 2020 17:14:30 +0000 (10:14 -0700)]
[lldb] Add missing member initialziation list
My previous commit added the default arguments but didn't use them in
the member initialization list...
Raphael Isemann [Tue, 21 Jul 2020 17:03:33 +0000 (19:03 +0200)]
Revert "[lldb] Unify type name matching in FormattersContainer"
This reverts commit
5b0de5756ccc7a540926e4eeaa3b398539d88cd8.
Apparently that caused some test to get stuck on Linuxx. Reverting for now.
Nico Weber [Tue, 21 Jul 2020 15:44:47 +0000 (11:44 -0400)]
Build: Move TF source file inclusion from build system to source files
Outside of compiler-rt (where it's arguably an anti-pattern too),
LLVM tries to keep its build files as simple as possible. See e.g.
llvm/docs/SupportLibrary.rst, "Code Organization".
Differential Revision: https://reviews.llvm.org/D84243
Kevin P. Neal [Tue, 21 Jul 2020 16:55:25 +0000 (12:55 -0400)]
[NFC] Make documentation for CallBase::hasFnAttr() more clear.
Arthur Eubanks [Tue, 21 Jul 2020 16:48:22 +0000 (09:48 -0700)]
[NewPM] Support optnone under new pass manager
OptNoneInstrumentation is part of StandardInstrumentations. It skips
functions (or loops) that are marked optnone.
The feature of skipping optional passes for optnone functions under NPM
is gated on a -enable-npm-optnone flag. Currently it is by default
false. That is because we still need to mark all required passes to be
required. Otherwise optnone functions will start having incorrect
semantics. After that is done in following changes, we can remove the
flag and always enable this.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D83519
Jonas Devlieghere [Tue, 21 Jul 2020 16:49:12 +0000 (09:49 -0700)]
[lldb] Change the CommandArgumentData ctor (NFC)
By using default arguments the caller can specify a subset without the
need for overloads. This is particularly useful in combination with
emplace_back as these objects are generally stored in a vector.
Raphael Isemann [Tue, 21 Jul 2020 16:44:16 +0000 (18:44 +0200)]
[lldb] Unify type name matching in FormattersContainer
Summary:
FormattersContainer stores LLDB's formatters. It's implemented as a templated
map-like data structures that supports any kind of value type and only allows
ConstString and RegularExpression as the key types. The keys are used for
matching type names (e.g., the ConstString key `std::vector` matches the type
with the same name while RegularExpression keys match any type where the
RegularExpression instance matches).
The fact that a single FormattersContainer can only match either by string
comparison or regex matching (depending on the KeyType) causes us to always have
two FormatterContainer instances in all the formatting code. This also leads to
us having every type name matching logic in LLDB twice. For example,
TypeCategory has to implement every method twice (one string matching one, one
regex matching one).
This patch changes FormattersContainer to instead have a single `TypeMatcher`
key that wraps the logic for string-based and regex-based type matching and is
now the only possible KeyType for the FormattersContainer. This means that a
single FormattersContainer can now match types with both regex and string
comparison.
To summarize the changes in this patch:
* Remove all the `*_Impl` methods from `FormattersContainer`
* Instead call the FormatMap functions from `FormattersContainer` with a
`TypeMatcher` type that does the respective matching.
* Replace `ConstString` with `TypeMatcher` in the few places that directly
interact with `FormattersContainer`.
I'm working on some follow up patches that I split up because they deserve their
own review:
* Unify FormatMap and FormattersContainer (they are nearly identical now).
* Delete the duplicated half of all the type matching code that can now use one
interface.
* Propagate TypeMatcher through all the formatter code interfaces instead of
always offering two functions for everything.
There is one ugly design part that I couldn't get rid of yet and that is that we
have to support getting back the string used to construct a `TypeMatcher` later
on. The reason for this is that LLDB only supports referencing existing type
matchers by just typing their respective input string again (without even
supplying if it's a regex or not).
Reviewers: davide, mib
Reviewed By: mib
Subscribers: mgorny, JDevlieghere
Differential Revision: https://reviews.llvm.org/D84151
Jordan Rupprecht [Tue, 21 Jul 2020 16:26:01 +0000 (09:26 -0700)]
[NFC] Fix unused var warning
Jonas Devlieghere [Tue, 21 Jul 2020 16:13:00 +0000 (09:13 -0700)]
[lldb] Fix typo that went unnoticed on my case insensitive FS
Logan Smith [Tue, 21 Jul 2020 16:11:53 +0000 (09:11 -0700)]
[clang-tools-extra] Disable -Wsuggest-override for unittests/
This avoids massive warning spam due to the unit tests' use of gtest and gmock, which do not use the 'override' keyword in their sources.
Differential Revision: https://reviews.llvm.org/D84213
Diego Caballero [Tue, 21 Jul 2020 15:34:09 +0000 (08:34 -0700)]
[MLIR][EDSC] Add fptrunc and fpext to EDSC
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D84216
Jonas Devlieghere [Tue, 21 Jul 2020 15:59:44 +0000 (08:59 -0700)]
[lldb/Reproducers] Don't recursively record everything in the CWD
RecordInterestingDirectory was added to collect dSYM bundles and their
content. For the current working directory we only want the directory to
be part of the VFS, not necessarily its contents. This patch renames the
current method to RecordInterestingDirectoryRecursively and adds a new
one that's not recursive.
Sidharth Baveja [Tue, 21 Jul 2020 15:59:14 +0000 (15:59 +0000)]
[Loop Fusion] Integrate Loop Peeling into Loop Fusion
Summary:
This patch adds the ability to peel off iterations of the first loop in loop
fusion. This can allow for both loops to have the same trip count, making it
legal for them to be fused together.
Here is a simple scenario peeling can be used in loop fusion:
for (i = 0; i < 10; ++i)
a[i] = a[i] + 3;
for (j = 1; j < 10; ++j)
b[j] = b[j] + 5;
Here is we can make use of peeling, and then fuse the two loops together. We can
peel off the 0th iteration of the loop i, and then combine loop i and j for
i = 1 to 10.
a[0] = a[0] +3;
for (i = 1; i < 10; ++i) {
a[i] = a[i] + 3;
b[i] = b[i] + 5;
}
Currently peeling with loop fusion is only supported for loops with constant
trip counts and a single exit point. Both unguarded and guarded loops are
supported.
Author: sidbav (Sidharth Baveja)
Reviewers: kbarton, Meinersbur, bkramer, Whitney, skatkov, ashlykov, fhahn, bmahjour
Reviewed By: bmahjour
Subscribers: bmahjour, mgorny, hiraditya, zzheng
Tags: LLVM
Differential Revision: https://reviews.llvm.org/D82927
Chris Gyurgyik [Tue, 21 Jul 2020 15:52:12 +0000 (11:52 -0400)]
[libc] [Obvious] Fix typo.
Fixes typo for strstr in entrypoints.
str -> src.
Fangrui Song [Tue, 21 Jul 2020 15:49:04 +0000 (08:49 -0700)]
[ELF] -r: rewrite SHT_GROUP content if some members are combined or discarded
* If two group members are combined, we should leave just one index in the SHT_GROUP content.
* If a group member is discarded (/DISCARD/ or upcoming -r --gc-sections combination),
we should drop its index in the SHT_GROUP content. LLD currently crashes (`getOutputSection()` is null).
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D84129
cgyurgyik [Tue, 21 Jul 2020 15:37:36 +0000 (11:37 -0400)]
[libc] Add strstr implementation.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D83956
Vince Bridgers [Thu, 16 Jul 2020 17:55:32 +0000 (12:55 -0500)]
[ASTImporter] Refactor ASTImporter to support custom downstream tests
Summary:
The purpose of this change is to do a small refactoring of code in
ASTImporterTest.cpp by moving it to ASTImporterFixtures.h in order to
support tests of downstream custom types and minimize the "living
downstream burden" of frequent integrations from community to a
downstream repo that implements custom AST import tests.
Reviewers: martong, a.sidorin, shafik
Reviewed By: martong
Subscribers: balazske, dkrupp, bjope, rnkovacs, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83970
Fangrui Song [Tue, 21 Jul 2020 15:24:42 +0000 (08:24 -0700)]
[llvm-readobj] Construct relocation-aware DWARFDataExtractor to decode .eh_frame addresses correctly
In an object file, a "PC Begin" field in a FDE is usually relocated by a
PC-relative relocation. Use a relocation-aware DWARFDataExtractor overload (with
DWARFContext and a reference to its internal .eh_frame representation) to decode
addresses correctly. In an object file, most sections have addresses of zero. So
the displayed addresses are almost always offsets relative to the start of the
associated text section.
DWARFContext::create handles .eh_frame and .rela.eh_frame by itself, so if there
are more than one .eh_frame (technically possible, but almost always erronerous
in practice), this will only handle the first one. Supporting multiple
.eh_frame is beyond the scope of this patch.
Reviewed By: grimar, jhenderson
Differential Revision: https://reviews.llvm.org/D84106
Saiyedul Islam [Tue, 21 Jul 2020 15:30:13 +0000 (15:30 +0000)]
[OpenMP] Temporarily disable failing runtime tests for clang-12
Following tests were disabled for clang-11 after upgrading to
version 5.0 in D82963:
1. openmp/runtime/test/env/kmp_set_dispatch_buf.c
2. openmp/runtime/test/worksharing/for/kmp_set_dispatch_buf.c
They are also failing for clang-12. Thus this temporary disabling
until they are fixed.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D84241
Jon Roelofs [Mon, 20 Jul 2020 14:47:07 +0000 (08:47 -0600)]
LoopIdiomRecognize: use ExpandedValuesCleaner in another place
This is a necessary cleanup after having expanded a SCEV.
See: https://reviews.llvm.org/D84071#inline-774728
Differential Revision: https://reviews.llvm.org/D84174
Jon Roelofs [Fri, 17 Jul 2020 20:58:44 +0000 (14:58 -0600)]
More conservatively report status from LoopIdiomRecognize
Being "precise" here is getting us into trouble with one of the
EXPENSIVE_CHECKS buildbots, see [1]. Rather than reporting IR additions that
later get rolled back as "no change", instead we now conservatively report that
there was.
1: http://lists.llvm.org/pipermail/llvm-dev/2020-July/143509.html
Differential Revision: https://reviews.llvm.org/D84071
Chris Morin [Mon, 20 Jul 2020 22:51:09 +0000 (15:51 -0700)]
Fix typo in tutorial
Mitch Phillips [Tue, 21 Jul 2020 15:19:02 +0000 (08:19 -0700)]
[GWP-ASan] Split the unwinder into segv/non-segv.
Note: Resubmission with frame pointers force-enabled to fix builds with
-DCOMPILER_RT_BUILD_BUILTINS=False
Summary:
Splits the unwinder into a non-segv (for allocation/deallocation traces) and a
segv unwinder. This ensures that implementations can select an accurate, slower
unwinder in the segv handler (if they choose to use the GWP-ASan provided one).
This is important as fast frame-pointer unwinders (like the sanitizer unwinder)
don't like unwinding through signal handlers.
Reviewers: morehouse, cryptoad
Reviewed By: morehouse, cryptoad
Subscribers: cryptoad, mgorny, eugenis, pcc, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D83994
Sander de Smalen [Mon, 20 Jul 2020 13:43:50 +0000 (14:43 +0100)]
[AArch64][SVE] Fix PCS for functions taking/returning scalable types.
The default calling convention needs to save/restore the SVE callee
saves according to the SVE PCS when the function takes or returns
scalable types, even when the `aarch64_sve_vector_pcs` CC is not
specified for the function.
Reviewers: efriedma, paulwalker-arm, david-arm, rengolin
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D84041
MaheshRavishankar [Tue, 21 Jul 2020 14:28:34 +0000 (07:28 -0700)]
[mlir][SPIR-V] Adding rationale for not using memref descriptors
SPIR-V lowering does not use `MemrefDescriptor`s when lowering memref
types. This adds rationale for the choice made.
Differential Revision: https://reviews.llvm.org/D84184
George Mitenkov [Tue, 21 Jul 2020 13:45:36 +0000 (16:45 +0300)]
[MLIR][LLVMDialect] SelectionOp conversion pattern
This patch introduces conversion pattern for `spv.selection` op.
The conversion can only be applied to selection with all blocks being
reachable. Moreover, selection with control attributes "Flatten" and
"DontFlatten" is not supported.
Since the `PatternRewriter` hook for block merging has not been implemented
for `ConversionPatternRewriter`, merge and continue blocks are kept
separately.
Reviewed By: antiagainst, ftynse
Differential Revision: https://reviews.llvm.org/D83860
Bruno Ricci [Tue, 21 Jul 2020 13:43:48 +0000 (14:43 +0100)]
[clang] Partially revert "Disable a few formatting options for test/"
The changes to "AlignTrailingComments" and "CommentPragmas" did not
result in what I expected (just leave the special comments alone).
Instead now the following:
void test() {
int i; // expected-error
// expected-warning
}
is formatted into:
void test() {
int i; // expected-error
// expected-warning
}
which is even worse.
AndreyChurbanov [Tue, 21 Jul 2020 13:31:17 +0000 (16:31 +0300)]
[OpenMP] add missed REQUIRES:ompt for 2 OMPT tests
Louis Dionne [Mon, 20 Jul 2020 17:13:38 +0000 (13:13 -0400)]
[compiler-rt] Use -nostdinc++ in clang_rt.profile to avoid including C++ headers
Most of the code in compiler_rt is C code. However, clang_rt.profile
contains the InstrProfilingRuntime.cpp file, which builds as C++. This
means that including e.g. <stdint.h> will actually include libc++'s
<stdint.h> and then #include_next the system's <stdint.h>. However, if
the target we're building compiler-rt for isn't supported by libc++,
this will lead to a failure since libc++'s <stdint.h> includes <__config>,
which performs various checks.
Since the goal seems to *not* be including any header from the C++ Standard
Library in clang_rt.profile, using -nostdinc++ to ensure that doesn't
happen unknowingly seems to make sense.
rdar://
65852694
Differential Revision: https://reviews.llvm.org/D84205
AndreyChurbanov [Tue, 21 Jul 2020 13:03:17 +0000 (16:03 +0300)]
[OpenMP] libomp build fix without OMPT_SUPPORT
Petre-Ionut Tudor [Tue, 14 Jul 2020 14:49:14 +0000 (15:49 +0100)]
[ARM] Generate [SU]HADD from ((a + b) >> 1)
Summary:
Teach LLVM to recognize the above pattern, where the operands are
either signed or unsigned types.
Subscribers: kristof.beyls, hiraditya, danielkiss, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83777
Raphael Isemann [Tue, 21 Jul 2020 11:00:17 +0000 (13:00 +0200)]
[lldb] Remove FormattersContainer's name member
Summary:
FormattersContainer currently has an unused `m_name` member. Usually LLDB allows
giving objects names, but for the FormattersContainer it seems excessive. There
are only 4 FormattersContainer variables in LLDB and they are not usually passed
around, so one can always just go up a few frames when debugging to find out
which FormattersContainer you're dealing with.
Reviewers: mib, davide
Reviewed By: mib
Subscribers: JDevlieghere
Differential Revision: https://reviews.llvm.org/D84154
Muhammad Omair Javaid [Tue, 21 Jul 2020 11:38:44 +0000 (16:38 +0500)]
[LLDB] Fix build on windows caused by LinuxPTraceDefines_arm64sve.h
This patch fixes build on lldb-x64-windows-ninja. The error is caused by
use of two leading underscores.
According to MSVC documentation:
In Microsoft C++, identifiers with two leading underscores are reserved
for compiler implementations.
https://docs.microsoft.com/en-us/cpp/cpp/keywords-cpp?view=vs-2019
Jay Foad [Mon, 18 May 2020 10:08:57 +0000 (11:08 +0100)]
[IR] Simplify Use::swap. NFCI.
The new implementation makes it clear that there are exactly two
conditional stores (after the initial no-op optimization). By contrast
the old implementation had seven conditionals, some hidden inside other
functions.
This commit can change the order of operands in operand lists, hence the
tweak to one test case.
Differential Revision: https://reviews.llvm.org/D80116
David Green [Tue, 21 Jul 2020 07:24:37 +0000 (08:24 +0100)]
[ARM] Constant fold VCTP intrinsics
We can sometimes get into the situation where the operand to a vctp
intrinsic becomes constant, such as after a loop is fully unrolled. This
adds the constant folding needed for them, allowing them to simplify
away and hopefully simplifying remaining instructions.
Differential Revision: https://reviews.llvm.org/D84110
Nico Weber [Tue, 21 Jul 2020 10:35:24 +0000 (06:35 -0400)]
[gn build] (manually) hack around
70f8d0ac8a3
Serge Pavlov [Tue, 14 Jul 2020 10:57:04 +0000 (17:57 +0700)]
[Windows] Fix limit on command line size
Documentation on CreateProcessW states that maximal size of command line
is 32767 characters including ternimation null character. In the
function llvm::sys::commandLineFitsWithinSystemLimits this limit was set
to 32768. As a result if command line was exactly 32768 characters long,
a response file was not created and CreateProcessW was called with
too long command line.
Differential Revision: https://reviews.llvm.org/D83772
Djordje Todorovic [Tue, 21 Jul 2020 10:12:19 +0000 (12:12 +0200)]
[NFC][Debugify] Rename OptCustomPassManager into DebugifyCustomPassManager
In addition, move the definition of the class into the Debugify.h,
so we can use it from different levels.
The motivation for this is D82547.
Differential Revision: https://reviews.llvm.org/D83391
Haojian Wu [Tue, 21 Jul 2020 10:11:52 +0000 (12:11 +0200)]
[clangd] Fix null check after D82739.
I hit the null-deference crash when opening ASTReaderDecl.cpp.
The BaseType can be a nullptr,
Nithin Vadukkumchery Rajendrakumar [Wed, 15 Jul 2020 00:54:44 +0000 (02:54 +0200)]
[Analyzer] Handle unique_ptr::swap() in SmartPtrModeling
Summary:
Implemented modeling for unique_ptr::swap() SmartPtrModeling
Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, martong, ASDenysPetrov, cfe-commits
Reviewers: NoQ, Szelethus, vsavchenko, xazax.hun
Reviewed By: NoQ, vsavchenko, xazax.hun
Tags: #clang
Differential Revision: https://reviews.llvm.org/D8387
Kirill Bobyrev [Tue, 21 Jul 2020 09:51:43 +0000 (11:51 +0200)]
[clangd] Complete the fix for (Local|Remote)IndexRoot confusion
Related revision: https://reviews.llvm.org/D83826
Muhammad Omair Javaid [Tue, 21 Jul 2020 09:27:06 +0000 (14:27 +0500)]
Revert "Revert "AArch64 SVE register infos and core file support""
This reverts commit
d9920e0199b48734ef305e69ecd5235fff72be25.
Muhammad Omair Javaid [Tue, 21 Jul 2020 09:02:06 +0000 (14:02 +0500)]
[LLDB] Fix LinuxPTraceDefines_arm64sve.h for AArch64 Linux host
LinuxPTraceDefines_arm64sve.h defines essential macros for manipulating
AArch64 SVE core dump registers. Add guard for aarch64/Linux hosts where
newer versions of ptrace.h or sigcontext.h might already define SVE macros.
Differential Revision: https://reviews.llvm.org/D83541
Kirill Bobyrev [Tue, 21 Jul 2020 09:16:43 +0000 (11:16 +0200)]
[clangd] Fix assertions for D83826
FuzzyFindRequest's toProtobuf is called on the client side (hence
LocalIndexRoot must be present) and fromProtobuf - on the server.
Hans Wennborg [Tue, 21 Jul 2020 09:06:33 +0000 (11:06 +0200)]
Revert
502f0cc0e38 "[GWP-ASan] Split the unwinder into segv/non-segv."
It was causing tests to fail in -DCOMPILER_RT_BUILD_BUILTINS=OFF builds:
GwpAsan-Unittest :: ./GwpAsan-x86_64-Test/BacktraceGuardedPoolAllocator.DoubleFree
GwpAsan-Unittest :: ./GwpAsan-x86_64-Test/BacktraceGuardedPoolAllocator.UseAfterFree
see comment on the code review.
> Summary:
> Splits the unwinder into a non-segv (for allocation/deallocation traces) and a
> segv unwinder. This ensures that implementations can select an accurate, slower
> unwinder in the segv handler (if they choose to use the GWP-ASan provided one).
> This is important as fast frame-pointer unwinders (like the sanitizer unwinder)
> don't like unwinding through signal handlers.
>
> Reviewers: morehouse, cryptoad
>
> Reviewed By: morehouse, cryptoad
>
> Subscribers: cryptoad, mgorny, eugenis, pcc, #sanitizers
>
> Tags: #sanitizers
>
> Differential Revision: https://reviews.llvm.org/D83994
This reverts commit
502f0cc0e3889229e923e187f38dda91324ae139.
Florian Hahn [Tue, 21 Jul 2020 09:01:42 +0000 (10:01 +0100)]
[SCCP] Add range metadata to call sites with known return ranges.
If we inferred a range for the function return value, we can add !range
at all call-sites of the function, if the range does not include undef.
Reviewers: efriedma, davide, nikic
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D83952
Kirill Bobyrev [Tue, 21 Jul 2020 09:04:53 +0000 (11:04 +0200)]
[clangd] Don't send invalid messages from remote index
Summary:
Remote server should not send messages that are invalid and will cause problems
on the client side. The client should not be affected by server's failures
whenever possible.
Also add more error messages and logs.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83826
Nathan James [Tue, 21 Jul 2020 08:55:14 +0000 (09:55 +0100)]
[ADT] use is_base_of inplace of is_same for random_access_iterator_tag checks
Replace `std::is_same<X, std::random_access_iterator_tag>` with `std::is_base_of<std::random_access_iterator_tag, X>` in STLExtra algos.
This doesn't have too much impact on LLVM internally as no structs derive from it.
However external projects embedding LLVM may use `std::contiguous_iterator_tag` which should be considered by these algorithms.
As well as any other potential tags people want to define derived from `std::random_access_iterator_tag`
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D84141
Muhammad Omair Javaid [Tue, 21 Jul 2020 08:34:08 +0000 (13:34 +0500)]
[LLDB] Fix Arm/AArch64 Linux broken build
This patch fixes build breakage on LLDB Arm/AArch64 Linux buildbots.
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/6649
http://lab.llvm.org:8011/builders/lldb-arm-ubuntu/builds/1919
This build breakage was introduces by commit:
001c8e1fd9f09d3de9ff6e64bdac4b8ca681dfb4
Alex Richardson [Tue, 21 Jul 2020 07:56:40 +0000 (08:56 +0100)]
[NFC] Use FileCheck for llvm-reduce interesness test
This makes the test added in
6187eeb683d8c639282d437e6af585e9b7f9c93e
easier to understand since you no longer have to look at another script
to see if it's doing the right thing.
Alex Richardson [Tue, 21 Jul 2020 07:35:47 +0000 (08:35 +0100)]
[libcxx][lit] Simplify parsing of trailing executor arguments
Adding a positional argparse.ONE_OR_MORE arguments will correctly remove
the "--" separator after --env and parse only the command. This also has
the advantage that misspelled flags raise an argparse error rather than
silently being added to the command to be executed.
I discovered this while adding a new commandline option to ssh.py to allow
passing additional arguments to the scp/ssh commands since this is required
for our CHERI CI where we need to pass `-F <custom_config_file>` to each
ssh/scp command to set various arguments such as the localhost port, usage
of controlmaster, etc. to speed up connections to our emulated QEMU systems.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D84096
Alex Zinenko [Tue, 21 Jul 2020 07:53:28 +0000 (09:53 +0200)]
[mlir] Fix undefined behavior in Linalg utils getViewSizes
The utility function getViewSizes in Linalg has been recently updated to
support a different form of Linalg operations. In doing so, the code looking
like `smallvector.push_back(smallvector[i])` was introduced. Unlike std
vectors, this can lead to undefined behavior if the vector must grow upon
insertion: `smallvector[i]` returns a reference to the element, `push_back`
takes a const reference to the element, and then grows the vector storage
before accessing the referenced value. After the resize, the reference may
become dangling, which leads to undefined behavior detected by ASAN as
use-after-free. Work around the issue by forcing the value to be copied by
putting it into a temporary variable.
George Mitenkov [Tue, 21 Jul 2020 07:25:32 +0000 (10:25 +0300)]
[MLIR][SPIRVToLLVM] Conversion of SPIR-V branch ops
This patch introduces conversion for `spv.Branch` and `spv.BranchConditional`
ops. Branch weigths for `spv.BranchConditional` are not supported at the
moment, and conversion in this case fails.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D83784
Haojian Wu [Tue, 21 Jul 2020 07:39:44 +0000 (09:39 +0200)]
[clang] Set the error-bit for ill-formed semantic InitListExpr.
When a semantic checking fails on a syntactic InitListExpr, we will
get an ill-formed semantic InitListExpr (e.g. some inits are nullptr),
using this semantic InitListExpr in clang (without setting the err-bits) is crashy.
Differential Revision: https://reviews.llvm.org/D84140
Haojian Wu [Tue, 21 Jul 2020 07:36:49 +0000 (09:36 +0200)]
[AST][RecoveryExpr] Preserve the invalid "undef_var" initializer.
And don't invalidate the VarDecl if the type is known.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D81395
Serge Pavlov [Mon, 20 Jul 2020 07:47:45 +0000 (14:47 +0700)]
Use typedef to represent storage type in FPOption and FPOptionsOverride
Size of FPOption is now 14 bit, which is closed to the current limit
of 16 bits. Adding new properties to FPOption would require change of
the types, which represent storage of FPOption and FPOptionsOverride.
To facilitate this change, the storage types were changed from standard
integer types to typedefs defined inside the proper classes. Checks for
size of these storage types were added.
No functional changes intended.
Differential Revision: https://reviews.llvm.org/D84147
Jared Wyles [Tue, 21 Jul 2020 07:19:48 +0000 (17:19 +1000)]
[jitlink] Updating test file for GOT relocations for elf x86
David Green [Tue, 21 Jul 2020 05:49:04 +0000 (06:49 +0100)]
[ARM] More unpredictable VCVT instructions.
These extra vcvt instructions were missed from
74ca67c109 because they
live in a different Domain, but should be treated in the same way.
Differential Revision: https://reviews.llvm.org/D83204
Jonas Devlieghere [Tue, 21 Jul 2020 06:13:01 +0000 (23:13 -0700)]
[lldb] Make TestOptionValueFileColonLine work on Windows
The colon in the file name is interpreted as a drive name and therefore
the path looks like foo:\\bar.c. Compare FileSpecs instead of their
string representation so we don't have to worry about that.
Jonas Devlieghere [Tue, 21 Jul 2020 06:10:29 +0000 (23:10 -0700)]
[lldb] Fix redundant newline in AppendError calls.
AppendError always appends a newline to the given argument, while
AppendErrorWithFormat does not. I've updated the calls to remove the
extra newline.
Nathan Ridge [Wed, 8 Jul 2020 06:51:34 +0000 (02:51 -0400)]
[clangd] Improve heuristic resolution of dependent types in TargetFinder
* Try to apply heuristic resolution recursively to the base
expression of a CXXDependentScopeMemberExpr.
* Try to apply heuristic resolution recursively to the callee
expression in a call expression.
Fixes https://github.com/clangd/clangd/issues/441
Subscribers: ilya-biryukov, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82739
Jonas Devlieghere [Tue, 21 Jul 2020 05:57:06 +0000 (22:57 -0700)]
[lldb] Remove redundant WithFormat suffixes (NFC)
Replace calls to FooWithFormat() with calls to Foo() when only one
argument is provided and the given string doesn't need to be formatted.
David Green [Mon, 20 Jul 2020 14:11:53 +0000 (15:11 +0100)]
[ARM] Predicated MVE reduction tests. NFC
Nathan Ridge [Sun, 19 Jul 2020 06:26:49 +0000 (02:26 -0400)]
[clangd] Handle deduction guides in TargetFinder and ExplicitReferenceCollector
Summary: Fixes https://github.com/clangd/clangd/issues/463.
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84122
Saiyedul Islam [Tue, 21 Jul 2020 05:23:38 +0000 (05:23 +0000)]
[OpenMP] Use common interface to access GPU Grid Values
Use common interface for accessing target specific GPU grid values in NVPTX
OpenMP codegen as proposed in https://reviews.llvm.org/D80917
Originally authored by Greg Rodgers (@gregrodgers).
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D83492
Logan Smith [Tue, 21 Jul 2020 05:03:19 +0000 (22:03 -0700)]
[NFC] Add another missing 'override'
This should be the last one needed to appease the -Werror bots (knock on wood).
Jonas Devlieghere [Tue, 21 Jul 2020 04:43:17 +0000 (21:43 -0700)]
[lldb] fix warnings in TestOptionValueFileColonLine.cpp
Jonas Devlieghere [Tue, 21 Jul 2020 04:25:32 +0000 (21:25 -0700)]
[lldb] Fix OptionValueFileColonLine to compile with MSVC
This should fix error C4716:
'lldb_private::OptionValueFileColonLine::Clear': must return a value
Logan Smith [Tue, 21 Jul 2020 02:52:36 +0000 (19:52 -0700)]
[NFC] Add missing 'override's
David Blaikie [Tue, 21 Jul 2020 02:06:20 +0000 (19:06 -0700)]
DebugInfo: Move getMD5AsBytes from DwarfUnit to DwarfDebug
It wasn't using any state from DwarfUnit anyway.
Matt Arsenault [Sat, 6 Jun 2020 23:37:43 +0000 (19:37 -0400)]
GlobalISel: Rewrite getLCMType
Try to make the behavior more consistent with getGCDType, and bias
towards returning something closer to the source type whenever there's
an ambiguity.
Matt Arsenault [Sun, 7 Jun 2020 01:24:02 +0000 (21:24 -0400)]
GlobalISel: Handle more cases in getGCDType
Try harder to find a canonical unmerge type when trying to cover the
desired target type. Handle finding a compatible unmerge type for two
vectors with different element types. This will return the largest
multiple of the source vector element that will evenly divide the
target vector type.
Also make the handling mixing scalars and vectors, and prefer the
source element type as the unmerge target type.
Matt Arsenault [Mon, 20 Jul 2020 23:40:15 +0000 (19:40 -0400)]
AMDGPU/GlobalISel: Remove unnecessary parameter
Logan Smith [Tue, 21 Jul 2020 00:39:14 +0000 (17:39 -0700)]
[compiler-rt] Disable -Wsuggest-override for unittests
This uses a special set of flags given to unittests to work around warnings raised by googletest and googlemock. This should bring the sanitizer bots back to green.
Jim Ingham [Thu, 16 Jul 2020 18:34:50 +0000 (11:34 -0700)]
Add an option (-y) to "break set" and "source list" that uses the same
file:line:column form that we use to print out locations. Since we
print them this way it makes sense we also accept that form.
Differential Revision: https://reviews.llvm.org/D83975
Jonas Devlieghere [Mon, 20 Jul 2020 23:57:40 +0000 (16:57 -0700)]
[lldb] Make sure we don't leak SBThreadPlan pointer (NFCI)
Make sure we don't accidentally leak the SBThreadPlan pointer when we
return before handing it off to Python to manage its lifetime.
Jonas Devlieghere [Mon, 20 Jul 2020 23:50:59 +0000 (16:50 -0700)]
[lldb] Use weak_ptr to hold on to the underlying thread plan in SBThreadPlan
Use a weak pointer to hold on to the the underlying thread plan in
SBThreadPlan. When the process continues, all the popped ThreadPlans get
discarded, and you can’t reuse them, so you have to create them anew.
Therefore the SBThreadPlan doesn’t need to keep the ThreadPlan alive.
This fixes the cleanup error in TestThreadPlanCommands.py and
TestStepScripted.py caused by the thread plans never being deleted.
Differential revision: https://reviews.llvm.org/D84210
Logan Smith [Mon, 20 Jul 2020 23:40:03 +0000 (16:40 -0700)]
[clang][NFC] Add missing 'override's
Artem Belevich [Wed, 8 Jul 2020 20:23:18 +0000 (13:23 -0700)]
[MC,NVPTX] Add MCAsmPrinter support for unsigned-only data directives.
PTX does not support negative values in .bNN data directives and we must
typecast such values to unsigned before printing them.
MCAsmInfo can now specify whether such casting is necessary for particular
target.
Differential Revision: https://reviews.llvm.org/D83423
Nithin Vadukkumchery Rajendrakumar [Wed, 15 Jul 2020 00:54:44 +0000 (02:54 +0200)]
[Analyzer] Add checkRegionChanges for SmartPtrModeling
Summary:
Implemented checkRegionChanges for SmartPtrModeling
Reviewers: NoQ, Szelethus, vsavchenko, xazax.hun
Reviewed By: NoQ, vsavchenko, xazax.hun
Subscribers: martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83836
shafik [Mon, 20 Jul 2020 23:09:18 +0000 (16:09 -0700)]
Fix how we handle bit-fields for Objective-C when creating an AST
Currently expressions dealing with bit-fields in Objective-C objects is pretty broken. When generating debug-info for Objective-C bit-fields DW_AT_data_bit_offset has a different meaning than it does to C and C++.
When we parse the DWARF we validate bit offsets for C and C++ correctly but not for ObjC. For ObjC in some cases we end up incorrectly flagging an error and we don't generate further bit-fields in the AST.
Later on when we do a name lookup we don't find the ObjCIvarDecl in the ObjCInterfaceDecl in some cases since we never added it and then we don't go to the runtime to obtain the offset.
This will fix how we handle bit-fields for the Objective-C case and add tests to verify this fix but also to documents areas that still don't work and will be addressed in follow-up PRs.
Note: we can never correctly calculate offsets statically because of how Objective-C deals with the fragile base class issue. Which means the runtime may need to shift fields over.
Differential Revision: https://reviews.llvm.org/D83433
Logan Smith [Mon, 20 Jul 2020 22:13:22 +0000 (15:13 -0700)]
Fix typo causing build failure
(facepalm)
Davide Italiano [Mon, 20 Jul 2020 21:50:36 +0000 (14:50 -0700)]
[PlatformMacOSX] Remove unused variable. NFC.
Lang Hames [Mon, 20 Jul 2020 21:31:48 +0000 (14:31 -0700)]
[ExecutionEngine] Initialize near block hint in SectionMemoryManager.
When allocating a new memory block in SectionMemoryManager, initialize
the Near hint for the other memory groups if they have not been set
already.
Patch by Dana Koch. Thanks Dana!
Logan Smith [Mon, 20 Jul 2020 21:38:10 +0000 (14:38 -0700)]
[NFC] Add missing 'override's
Davide Italiano [Mon, 20 Jul 2020 21:11:58 +0000 (14:11 -0700)]
[testsuite] Adapt lldb-server base test helper to run on arm64
Yitzhak Mandelbaum [Mon, 20 Jul 2020 21:24:58 +0000 (21:24 +0000)]
Revert "[libTooling] In Clang Transformer, change `Metadata` field to deferred evalutaion"
This reverts commit
c0b8954ecba500e3d9609152295b74ccd7d89d62.
The commit has broken various builds. Reverting while I investigate the cause.
Yitzhak Mandelbaum [Mon, 20 Jul 2020 21:16:39 +0000 (21:16 +0000)]
[libTooling] In Clang Transformer, change `Metadata` field to deferred evalutaion
`Metadata` is being changed from an `llvm::Any` to a `MatchConsumer<llvm;:Any>`, so that it's evaluation can be be dependent on `MatchResult`s passed in.
Reviewed By: ymandel, gribozavr2
Differential Revision: https://reviews.llvm.org/D83820
AndreyChurbanov [Mon, 20 Jul 2020 21:12:46 +0000 (00:12 +0300)]
[OpenMP] libomp cleanup: add checks of bad memory access
Add check of frm to prevent array out-of-bound access;
add check of new_nproc to prevent access of unallocated hot_teams array;
add check of location info pointer to prevent NULL dereference;
add check of d_tn pointer to prevent NULL dereference in release build.
These checks make static analyzers happier.
This is second part of the patch from https://reviews.llvm.org/D84062.
Davide Italiano [Mon, 20 Jul 2020 21:10:35 +0000 (14:10 -0700)]
[PlatformDarwin] Add support for Apple Silicon.
Gets another large chunk of the testsuite to pass.
Roman Lebedev [Mon, 20 Jul 2020 19:25:15 +0000 (22:25 +0300)]
[Reduce] Argument reduction: don't try to drop terminator instructions
Newly-added test previously crashed.
While it is up for debate whether or not instruction reduction
should be indiscriminate in instruction dropping (there you can
just ensure that the test case is still -verify'ies), here
if we drop terminator, CloneFunctionInto() will immediately crash.
So let's not do that :)
Vy Nguyen [Mon, 20 Jul 2020 20:59:46 +0000 (16:59 -0400)]
Disable trivial weak_ptr test on ARM because it is not expected to work.
Summary:
weak_ptr has two pointers (more than the 4 bytes limit), so it will not be returned in registers on ARM, even if it is trivial.
The test, therefore, will fail on ARM.
Reviewers: #libc!
Subscribers: kristof.beyls, danielkiss, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D84200
Logan Smith [Mon, 20 Jul 2020 20:59:34 +0000 (13:59 -0700)]
[llvm][unittest] Add -Wno-suggest-override to more infrastructure that includes googletest/googlemock headers
AndreyChurbanov [Mon, 20 Jul 2020 20:49:58 +0000 (23:49 +0300)]
[OpenMP] libomp cleanup: add check of input global tid parameter
Add check of negative gtid before indexing __kmp_threads.
This makes static analyzers happier.
This is the first part of the patch split in two parts.
Differential Revision: https://reviews.llvm.org/D84062
Gabor Marton [Tue, 7 Jul 2020 16:34:20 +0000 (18:34 +0200)]
[analyzer][StdLibraryFunctionsChecker] Add POSIX networking functions
Summary:
Adding networking functions from the POSIX standard (2017). This includes
functions that deal with sockets from socket.h, netdb.h.
In 'socket.h' of some libc implementations (e.g. glibc) with C99, sockaddr
parameter is a transparent union of the underlying sockaddr_ family of pointers
instead of being a pointer to struct sockaddr. In these cases, the standardized
signature will not match, thus we try to match with another signature that has
the joker Irrelevant type. In the case of transparent unions, we also not add
those constraints which require pointer types for the sockaddr param.
Interestingly, in 'netdb.h' sockaddr is not handled as a transparent union.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83407
Louis Dionne [Mon, 20 Jul 2020 20:15:49 +0000 (16:15 -0400)]
[NFC] Use std::free instead of ::free
Since we include <cstdlib> instead of <stdlib.h>, it makes sense to
use std::free.
Sanjay Patel [Mon, 20 Jul 2020 19:49:01 +0000 (15:49 -0400)]
[InstCombine] allow peeking through zext of shift amount to match rotate idioms (PR45701)
We might want to also allow trunc of the shift amount, but that seems less likely?
define i32 @src(i32 %x, i1 %y) {
%0:
%rem = and i1 %y, 1
%cmp = icmp eq i1 %rem, 0
%sh_prom = zext i1 %rem to i32
%sub = sub nsw nuw i1 0, %rem
%sh_prom1 = zext i1 %sub to i32
%shr = lshr i32 %x, %sh_prom1
%shl = shl i32 %x, %sh_prom
%or = or i32 %shl, %shr
%r = select i1 %cmp, i32 %x, i32 %or
ret i32 %r
}
=>
define i32 @tgt(i32 %x, i1 %y) {
%0:
%t = zext i1 %y to i32
%r = fshl i32 %x, i32 %x, i32 %t
ret i32 %r
}
Transformation seems to be correct!
https://alive2.llvm.org/ce/z/xgMvE3
http://bugs.llvm.org/PR45701
Sanjay Patel [Mon, 20 Jul 2020 19:31:24 +0000 (15:31 -0400)]
[InstCombine] add tests for funnel shift/rotate with narrow shift amount; NFC
Florian Hahn [Mon, 20 Jul 2020 19:50:49 +0000 (20:50 +0100)]
[Matrix] Use TileInfo to create tiled loop nest for matrix multiply.
This patch uses the TileInfo introduced in D77550 to generate a loop
nest for tiled matrix multiplication, instead of generating the
unrolled code for the whole multiplication. This makes code-generation
more scalable for larger matrixes.
Initially loops are only used if both the number of rows and columns are
divisible by the tile size. Other cases will be added as follow-up.
Reviewers: anemet, Gerolf, hfinkel, andrew.w.kaylor, LuoYuanke, nicolasvasilache
Reviewed By: anemet
Differential Revision: https://reviews.llvm.org/D81308
Eli Friedman [Tue, 14 Jul 2020 20:02:58 +0000 (13:02 -0700)]
[AArch64][SVE] Add support for trunc to <vscale x N x i1>.
This isn't a natively supported operation, so convert it to a
mask+compare.
In addition to the operation itself, fix up some surrounding stuff to
make the testcase work: we need concat_vectors on i1 vectors, we need
legalization of i1 vector truncates, and we need to fix up all the
relevant uses of getVectorNumElements().
Differential Revision: https://reviews.llvm.org/D83811