Commit Graph

360932 Commits

Author SHA1 Message Date
cgyurgyik d080635bfc [libc] Add strstr implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D83956
2020-07-21 11:39:23 -04:00
Vince Bridgers 2015741086 [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
2020-07-21 10:34:17 -05:00
Fangrui Song 8c6d48baf6 [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
2020-07-21 08:33:19 -07:00
Saiyedul Islam 741e55aeed [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
2020-07-21 15:32:46 +00:00
Jon Roelofs dc09c65f63 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
2020-07-21 09:32:23 -06:00
Jon Roelofs 4d75cc4b0a 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
2020-07-21 09:32:22 -06:00
Chris Morin 28da5759bd Fix typo in tutorial 2020-07-21 17:28:24 +02:00
Mitch Phillips 4f029d1be4 [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
2020-07-21 08:25:37 -07:00
Sander de Smalen 9bacf15885 [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
2020-07-21 15:55:39 +01:00
MaheshRavishankar 44e1a93ccf [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
2020-07-21 07:28:59 -07:00
George Mitenkov 61dd481f11 [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
2020-07-21 17:11:46 +03:00
Bruno Ricci 7b5bddfd03
[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.
2020-07-21 14:53:37 +01:00
AndreyChurbanov 617787ea77 [OpenMP] add missed REQUIRES:ompt for 2 OMPT tests 2020-07-21 16:31:17 +03:00
Louis Dionne 14c4de13e9 [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
2020-07-21 09:14:33 -04:00
AndreyChurbanov 5a8779169e [OpenMP] libomp build fix without OMPT_SUPPORT 2020-07-21 16:03:17 +03:00
Petre-Ionut Tudor 1af9fc8213 [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
2020-07-21 13:22:07 +01:00
Raphael Isemann 5c15426d7c [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
2020-07-21 13:54:38 +02:00
Muhammad Omair Javaid b621e8c787 [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
2020-07-21 16:47:25 +05:00
Jay Foad 5e5bda74b6 [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
2020-07-21 12:15:12 +01:00
David Green becaa6803a [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
2020-07-21 11:39:31 +01:00
Nico Weber e37b220442 [gn build] (manually) hack around 70f8d0ac8a 2020-07-21 06:35:36 -04:00
Serge Pavlov d4020ef7c4 [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
2020-07-21 17:33:22 +07:00
Djordje Todorovic 30b015dbe9 [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
2020-07-21 12:16:07 +02:00
Haojian Wu 3ad0181169 [clangd] Fix null check after D82739.
I hit the null-deference crash when opening ASTReaderDecl.cpp.

The BaseType can be a nullptr,
2020-07-21 12:15:17 +02:00
Nithin Vadukkumchery Rajendrakumar 76c0577763 [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
2020-07-21 12:05:27 +02:00
Kirill Bobyrev 7d591e123e [clangd] Complete the fix for (Local|Remote)IndexRoot confusion
Related revision: https://reviews.llvm.org/D83826
2020-07-21 11:53:17 +02:00
Muhammad Omair Javaid 510e37c88c Revert "Revert "AArch64 SVE register infos and core file support""
This reverts commit d9920e0199.
2020-07-21 14:31:47 +05:00
Muhammad Omair Javaid 6960e39eff [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
2020-07-21 14:31:47 +05:00
Kirill Bobyrev 4470b8c6a6 [clangd] Fix assertions for D83826
FuzzyFindRequest's toProtobuf is called on the client side (hence
LocalIndexRoot must be present) and fromProtobuf - on the server.
2020-07-21 11:20:31 +02:00
Hans Wennborg ab6263c925 Revert 502f0cc0e3 "[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 502f0cc0e3.
2020-07-21 11:18:07 +02:00
Florian Hahn 752fea7c27 [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
2020-07-21 10:06:54 +01:00
Kirill Bobyrev eef162c330
[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
2020-07-21 11:05:03 +02:00
Nathan James 1890a65ca1
[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
2020-07-21 09:55:16 +01:00
Muhammad Omair Javaid 62ccfb6ed0 [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: 001c8e1fd9
2020-07-21 13:46:39 +05:00
Alex Richardson f5d4a58b4a [NFC] Use FileCheck for llvm-reduce interesness test
This makes the test added in 6187eeb683
easier to understand since you no longer have to look at another script
to see if it's doing the right thing.
2020-07-21 09:03:45 +01:00
Alex Richardson 3980e8956b [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
2020-07-21 09:03:45 +01:00
Alex Zinenko aa84e6e579 [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.
2020-07-21 09:57:41 +02:00
George Mitenkov 05d3160c9c [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
2020-07-21 10:52:20 +03:00
Haojian Wu 566b49884d [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
2020-07-21 09:39:44 +02:00
Haojian Wu 7af852dcbf [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
2020-07-21 09:38:09 +02:00
Serge Pavlov 21cd7b72a3 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
2020-07-21 14:35:50 +07:00
Jared Wyles b847859f37 [jitlink] Updating test file for GOT relocations for elf x86 2020-07-21 17:19:48 +10:00
David Green 30371df85f [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
2020-07-21 07:24:37 +01:00
Jonas Devlieghere cb5926795a [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.
2020-07-20 23:15:03 -07:00
Jonas Devlieghere 7926143fb0 [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.
2020-07-20 23:11:56 -07:00
Nathan Ridge 9946dcd3e9 [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
2020-07-21 02:03:06 -04:00
Jonas Devlieghere 8953376478 [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.
2020-07-20 23:00:32 -07:00
David Green 0ebdc3be41 [ARM] Predicated MVE reduction tests. NFC 2020-07-21 06:47:48 +01:00
Nathan Ridge 100dbd1562 [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
2020-07-21 01:44:48 -04:00
Saiyedul Islam fc7d2908ab [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
2020-07-21 05:25:46 +00:00