Simon Pilgrim [Tue, 24 Sep 2019 13:57:38 +0000 (13:57 +0000)]
[COFF] Silence static analyzer null dereference warning. NFCI.
Assert that the COFFSymbolRef is correct.
llvm-svn: 372757
Ilya Biryukov [Tue, 24 Sep 2019 13:48:02 +0000 (13:48 +0000)]
Revert r372333: [DAG][X86] Convert isNegatibleForFree/GetNegatedExpression to a target hook (PR42863)
Reason: this caused severe compile time regressions in JAX.
See email thread of original revision on llvm-commits for details:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20190923/697042.html
llvm-svn: 372756
Michal Gorny [Tue, 24 Sep 2019 13:41:54 +0000 (13:41 +0000)]
[lldb] [Process/NetBSD] Fix handling LLDB_INVALID_SIGNAL_NUMBER
Fix NativeProcessNetBSD::Resume() to handle LLDB_INVALID_SIGNAL_NUMBER
correctly. Fixes breakage caused by r372090 and r372300. I have major
rewrite of that function pending; however, the fixes to gdb-remote
were committed prior to that.
llvm-svn: 372755
James Henderson [Tue, 24 Sep 2019 13:41:39 +0000 (13:41 +0000)]
[docs][llvm-strip][llvm-objcopy] Improve wording and fix highlighting
llvm-svn: 372754
Utkarsh Saxena [Tue, 24 Sep 2019 13:38:33 +0000 (13:38 +0000)]
[clangd] Add semantic selection to ClangdLSPServer.
Summary:
This adds semantic selection to the LSP Server.
Adds support for serialization of input request and the output reply.
Also adds regression tests for the feature.
Currently we do not support multi cursor.The LSP Server only accepts single position in the request as opposed to many position in the spec.
Spec:
https://github.com/microsoft/language-server-protocol/blob/dbaeumer/3.15/specification.md#textDocument_selectionRange
Reviewers: hokein
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67720
llvm-svn: 372753
Haojian Wu [Tue, 24 Sep 2019 13:25:38 +0000 (13:25 +0000)]
[clangd] Save an unnecessary copy, NFC.
llvm-svn: 372752
James Henderson [Tue, 24 Sep 2019 13:14:22 +0000 (13:14 +0000)]
[docs][llvm-size] Fix typo
llvm-svn: 372750
David Bolvansky [Tue, 24 Sep 2019 13:14:18 +0000 (13:14 +0000)]
[Diagnostics] Handle tautological left shifts in boolean context
llvm-svn: 372749
George Rimar [Tue, 24 Sep 2019 12:53:53 +0000 (12:53 +0000)]
[LLD][ELF][MIPS] - Inline the short helper function. NFC.
It was requested in a post-commit comment for r372570.
llvm-svn: 372747
Simon Pilgrim [Tue, 24 Sep 2019 12:43:55 +0000 (12:43 +0000)]
[Orc] Silence static analyzer dyn_cast<ConstantInt> null dereference warning. NFCI.
llvm-svn: 372746
Michael Liao [Tue, 24 Sep 2019 12:43:44 +0000 (12:43 +0000)]
[llvm-objcopy] Fix a warningon unused variable. NFC.
llvm-svn: 372745
Pavel Labath [Tue, 24 Sep 2019 12:36:54 +0000 (12:36 +0000)]
Enhance SymbolFileDWARF::ParseDeclsForContext performance
This implements
DWARFASTParserClang::EnsureAllDIEsInDeclContextHaveBeenParsed so as to
provide a faster way to ensure all DIEs linked to a certain declaration
context have been parsed.
Currently, we rely on SymbolFileDWARF::ParseDeclsForContext calling
DWARFASTParserClang::GetDIEForDeclContext, and only then
DWARFASTParserClang::GetDeclForUIDFromDWARF. This change shortcuts that
logic and removes redundant calls to DWARFASTParserClang::
GetClangDeclForDIE by deleting DIEs from the m_decl_ctx_to_die map once
they have been parsed.
Differential Revision: https://reviews.llvm.org/D67760
Patch by Guilherme Andrade <guiandrade@google.com>.
llvm-svn: 372744
Simon Pilgrim [Tue, 24 Sep 2019 12:30:13 +0000 (12:30 +0000)]
ConstantFold - silence static analyzer dyn_cast<> null dereference warning. NFCI.
Early out if the vector element is not Constant.
llvm-svn: 372743
Simon Pilgrim [Tue, 24 Sep 2019 12:30:07 +0000 (12:30 +0000)]
Fix cppcheck "reduce variable scope" warning. NFCI.
llvm-svn: 372742
Martin Storsjo [Tue, 24 Sep 2019 12:20:52 +0000 (12:20 +0000)]
[LLDB] Add tests for PECOFF arm architecture identification
Add a test case for the change from SVN r372657, and for the
preexisting ARM identification.
Add a missing ArchDefinitionEntry for PECOFF/arm64, and tweak
the ArmNt case to set the architecture to armv7 (ArmNt never ran
on anything lower than that). (This avoids a case where
ArchSpec::MergeFrom would override the arch from arm to armv7 and
ArchSpec::CoreUpdated would reset the OS to unknown at the same time.)
Differential Revision: https://reviews.llvm.org/D67951
llvm-svn: 372741
Martin Storsjo [Tue, 24 Sep 2019 12:20:38 +0000 (12:20 +0000)]
[LLDB] [test] Allow differing order of some matches
These can appear in a different order depending on the relative
layout of the source and build trees.
Differential Revision: https://reviews.llvm.org/D67953
llvm-svn: 372740
Martin Storsjo [Tue, 24 Sep 2019 12:20:33 +0000 (12:20 +0000)]
[LLDB] [test] Add a few missing cases of REQUIRES: python
Differential Revision: https://reviews.llvm.org/D67952
llvm-svn: 372739
Martin Storsjo [Tue, 24 Sep 2019 12:20:21 +0000 (12:20 +0000)]
[LLDB] Fix typo in RegisterContextDarwin_arm64
In these cases, the register number should be calculated from
fpu_d0, not fpu_s0.
Differential Revision: https://reviews.llvm.org/D67892
llvm-svn: 372738
Raphael Isemann [Tue, 24 Sep 2019 12:13:35 +0000 (12:13 +0000)]
[lldb] Also force posix paths in CppModuleConfigurationTest
llvm-svn: 372737
Raphael Isemann [Tue, 24 Sep 2019 12:01:15 +0000 (12:01 +0000)]
[lldb][NFC] Use default member initializers in ReadStringAndDumpToStreamOptions
llvm-svn: 372736
Fangrui Song [Tue, 24 Sep 2019 11:48:46 +0000 (11:48 +0000)]
[ELF] Delete SectionBase::assigned
D67504 removed uses of `assigned` from OutputSection::addSection, which
makes `assigned` purely used in processSectionCommands() and its
callees. By replacing its references with `parent`, we can remove
`assigned`.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D67531
llvm-svn: 372735
Fangrui Song [Tue, 24 Sep 2019 11:48:31 +0000 (11:48 +0000)]
[ELF] Make MergeInputSection merging aware of output sections
Fixes PR38748
mergeSections() calls getOutputSectionName() to get output section
names. Two MergeInputSections may be merged even if they are made
different by SECTIONS commands.
This patch moves mergeSections() after processSectionCommands() and
addOrphanSections() to fix the issue. The new pass is renamed to
OutputSection::finalizeInputSections().
processSectionCommands() and addorphanSections() are changed to add
sections to InputSectionDescription::sectionBases.
finalizeInputSections() merges MergeInputSections and migrates
`sectionBases` to `sections`.
For the -r case, we drop an optimization that tries keeping sh_entsize
non-zero. This is for the simplicity of addOrphanSections(). The
updated merge-entsize2.s reflects the change.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D67504
llvm-svn: 372734
Simon Pilgrim [Tue, 24 Sep 2019 11:40:45 +0000 (11:40 +0000)]
[IR] IntrinsicInst - silence static analyzer dyn_cast<> null dereference warnings. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<> directly and if not assert will fire for us.
llvm-svn: 372733
Simon Pilgrim [Tue, 24 Sep 2019 11:27:38 +0000 (11:27 +0000)]
LoopVectorize - silence static analyzer dyn_cast<CmpInst> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<CmpInst> directly and if not assert will fire for us.
llvm-svn: 372732
Kamil Rytarowski [Tue, 24 Sep 2019 11:22:34 +0000 (11:22 +0000)]
[tblgen] Disable Leak detection for ASan/GCC and LSan/LLVM
Summary: Add support for sanitizing TableGen.cpp with ASan/GCC and LSan/LLVM.
Reviewers: fjricci, kcc, aaron.ballman, mgorny
Reviewed By: fjricci
Subscribers: jakubjelinek, llvm-commits, #llvm
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67908
llvm-svn: 372731
Joachim Protze [Tue, 24 Sep 2019 11:19:02 +0000 (11:19 +0000)]
[TSAN] Add read/write range interface functions with PC
Adding annotation function variants __tsan_write_range_pc and
__tsan_read_range_pc to annotate ranged access to memory while providing a
program counter for the access.
Differential Revision: https://reviews.llvm.org/D66885
llvm-svn: 372730
Raphael Isemann [Tue, 24 Sep 2019 11:17:38 +0000 (11:17 +0000)]
[lldb] Use convert_to_slash in CppModuleConfiguration
That's what we actually want to do. Might fix the Windows bot.
llvm-svn: 372729
Simon Pilgrim [Tue, 24 Sep 2019 11:17:20 +0000 (11:17 +0000)]
[SimplifyCFG] FoldTwoEntryPHINode - silence static analyzer null dereference warning. NFCI.
Assert that we've found the DomBlock.
llvm-svn: 372728
Simon Pilgrim [Tue, 24 Sep 2019 11:17:13 +0000 (11:17 +0000)]
SimplifyCFG - silence static analyzer dyn_cast<LandingPadInst> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<LandingPadInst> directly and if not assert will fire for us.
llvm-svn: 372727
Simon Pilgrim [Tue, 24 Sep 2019 11:17:06 +0000 (11:17 +0000)]
SimplifyCFG - silence static analyzer dyn_cast<Instruction> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<Instruction> directly and if not assert will fire for us.
llvm-svn: 372726
Haojian Wu [Tue, 24 Sep 2019 11:14:06 +0000 (11:14 +0000)]
[clangd] Collect macros in the preamble region of the main file
Summary:
- store all macro references in the ParsedAST;
- unify the two variants of CollectMainFileMacros;
Reviewers: ilya-biryukov
Subscribers: MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67496
llvm-svn: 372725
Raphael Isemann [Tue, 24 Sep 2019 11:00:37 +0000 (11:00 +0000)]
[lldb][NFC] Use llvm::StringRef in formatters::NSStringSummaryProvider
llvm-svn: 372724
Simon Pilgrim [Tue, 24 Sep 2019 10:58:42 +0000 (10:58 +0000)]
[ModuloSchedule] KernelRewriter::rewrite - silence static analyzer dyn_cast<> null dereference warning. NFCI.
Assert that we've found the start of the MI schedule list.
llvm-svn: 372723
David Green [Tue, 24 Sep 2019 10:53:09 +0000 (10:53 +0000)]
[ARM] Split large widening MVE loads
Similar to rL372717, we can force the splitting of extends of vector loads in
MVE, in order to use the better widening loads as opposed to going through
expensive extends. This adds a combine to early-on detect extends of loads and
split the load in two, from where normal legalisation will kick in and we get a
series of widening loads.
Differential Revision: https://reviews.llvm.org/D67909
llvm-svn: 372721
Simon Pilgrim [Tue, 24 Sep 2019 10:46:30 +0000 (10:46 +0000)]
lowerObjCCall - silence static analyzer dyn_cast<CallInst> null dereference warnings. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<CallInst> directly and if not assert will fire for us.
llvm-svn: 372720
David Green [Tue, 24 Sep 2019 10:39:58 +0000 (10:39 +0000)]
[ARM] MVE sext and widen/narrow tests from larger types. NFC
llvm-svn: 372719
David Green [Tue, 24 Sep 2019 10:10:41 +0000 (10:10 +0000)]
[ARM] Split large truncating MVE stores
MVE does not have a simple sign extend instruction that can move elements
across lanes. We currently often end up moving each lane into and out of a GPR,
in order to get elements into the correct places. When we have a store of a
trunc (or a extend of a load), we can instead just split the store/load in two,
using the narrowing/widening load/store instructions from each half of the
vector.
This does that for stores. It happens very early in a store combine, so as to
easily detect the truncates. (It would be possible to do this later, but that
would involve looking through a buildvector of extract elements. Not impossible
but this way seemed simpler).
By enabling store combines we also get a vmovdrr combine for free, helping some
other tests.
Differential Revision: https://reviews.llvm.org/D67828
llvm-svn: 372717
Raphael Isemann [Tue, 24 Sep 2019 10:08:18 +0000 (10:08 +0000)]
[lldb] Decouple importing the std C++ module from the way the program is compiled
Summary:
At the moment, when trying to import the `std` module in LLDB, we look at the imported modules used in the compiled program
and try to infer the Clang configuration we need from the DWARF module-import. That was the initial idea but turned out to
cause a few problems or inconveniences:
* It requires that users compile their programs with C++ modules. Given how experimental C++ modules are makes this feature inaccessible
for many users. Also it means that people can't just get the benefits of this feature for free when we activate it by default
(and we can't just close all the associated bug reports).
* Relying on DWARF's imported module tags (that are only emitted by default on macOS) means this can only be used when using DWARF (and with -glldb on Linux).
* We essentially hardcoded the C standard library paths on some platforms (Linux) or just couldn't support this feature on other platforms (macOS).
This patch drops the whole idea of looking at the imported module DWARF tags and instead just uses the support files of the compilation unit.
If we look at the support files and see file paths that indicate where the C standard library and libc++ are, we can just create the module
configuration this information. This fixes all the problems above which means we can enable all the tests now on Linux, macOS and with other debug information
than what we currently had. The only debug information specific code is now the iteration over external type module when -gmodules is used (as `std` and also the
`Darwin` module are their own external type module with their own files).
The meat of this patch is the CppModuleConfiguration which looks at the file paths from the compilation unit and then figures out the include paths
based on those paths. It's quite conservative in that it only enables modules if we find a single C library and single libc++ library. It's still missing some
test mode where we try to compile an expression before we actually activate the config for the user (which probably also needs some caching mechanism),
but for now it works and makes the feature usable.
Reviewers: aprantl, shafik, jdoerfert
Reviewed By: aprantl
Subscribers: mgorny, abidh, JDevlieghere, lldb-commits
Tags: #c_modules_in_lldb, #lldb
Differential Revision: https://reviews.llvm.org/D67760
llvm-svn: 372716
Fangrui Song [Tue, 24 Sep 2019 09:55:35 +0000 (09:55 +0000)]
[clang-tidy][test] Add -fexceptions to bugprone-infinite-loop.test
This fixes llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast.
-fexceptions is disabled by default on XCore and PS4.
llvm-svn: 372715
Mikael Holmen [Tue, 24 Sep 2019 09:44:55 +0000 (09:44 +0000)]
[modularize] Fix compilation warning after r372681
In r372681 lang_cxx_11 and lang_cxx_14 were added to LanguageIDs
but they were not handled in the switch in VisitLinkageSpecDecl in
Modularize.cpp so at clang 8 complained with
/data/repo/master/clang-tools-extra/modularize/Modularize.cpp:583:13: error: enumeration values 'lang_cxx_11' and 'lang_cxx_14' not handled in switch [-Werror,-Wswitch]
switch (D->getLanguage()) {
^
1 error generated.
With this patch we now treat lang_cxx, lang_cxx_11 and lang_cxx_14 the
same way in the switch in VisitLinkageSpecDecl.
llvm-svn: 372714
GN Sync Bot [Tue, 24 Sep 2019 09:43:29 +0000 (09:43 +0000)]
gn build: Merge r372712
llvm-svn: 372713
Seiya Nuta [Tue, 24 Sep 2019 09:38:23 +0000 (09:38 +0000)]
[llvm-objcopy] Refactor ELF-specific config out to ELFCopyConfig. NFC.
Summary:
This patch splits the command-line parsing into two phases:
First, parse cross-platform options and leave ELF-specific options unparsed.
Second, in the ELF implementation, parse ELF-specific options and construct ELFCopyConfig.
Reviewers: espindola, alexshap, rupprecht, jhenderson, jakehehrlich, MaskRay
Reviewed By: alexshap, jhenderson, jakehehrlich, MaskRay
Subscribers: mgorny, emaste, arichardson, jakehehrlich, MaskRay, abrachet, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67139
llvm-svn: 372712
Fangrui Song [Tue, 24 Sep 2019 09:32:00 +0000 (09:32 +0000)]
[clang-tidy] Add bugprone-infinite-loop.rst from D64736 to fix buildbot
llvm-svn: 372711
Pavel Labath [Tue, 24 Sep 2019 09:31:02 +0000 (09:31 +0000)]
MCRegisterInfo: Merge getLLVMRegNum and getLLVMRegNumFromEH
Summary:
The functions different in two ways:
- getLLVMRegNum could return both "eh" and "other" dwarf register
numbers, while getLLVMRegNumFromEH only returned the "eh" number.
- getLLVMRegNum asserted if the register was not found, while the second
function returned -1.
The second distinction was pretty important, but it was very hard to
infer that from the function name. Aditionally, for the use case of
dumping dwarf expressions, we needed a function which can work with both
kinds of number, but does not assert.
This patch solves both of these issues by merging the two functions into
one, returning an Optional<unsigned> value. While the same thing could
be achieved by adding an "IsEH" argument to the (renamed)
getLLVMRegNumFromEH function, it seemed better to avoid the confusion of
two functions and put the choice of asserting into the hands of the
caller -- if he checks the Optional value, he can safely process
"untrusted" input, and if he blindly dereferences the Optional, he gets
the assertion.
I've updated all call sites to the new API, choosing between the two
options according to the function they were calling originally, except
that I've updated the usage in DWARFExpression.cpp to use the "safe"
method instead, and added a test case which would have previously
triggered an assertion failure when processing (incorrect?) dwarf
expressions.
Reviewers: dsanders, arsenm, JDevlieghere
Subscribers: wdng, aprantl, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67154
llvm-svn: 372710
David Bolvansky [Tue, 24 Sep 2019 09:24:48 +0000 (09:24 +0000)]
[NFC] Update test after r372708
llvm-svn: 372709
David Bolvansky [Tue, 24 Sep 2019 09:14:33 +0000 (09:14 +0000)]
[Diagnostics] Do not diagnose unsigned shifts in boolean context (-Wint-in-bool-context)
I was looking at old GCC's patch. Current "trunk" version avoids warning for unsigned case, GCC warns only for signed shifts.
llvm-svn: 372708
GN Sync Bot [Tue, 24 Sep 2019 09:11:31 +0000 (09:11 +0000)]
gn build: Merge r372706
llvm-svn: 372707
Fangrui Song [Tue, 24 Sep 2019 09:06:31 +0000 (09:06 +0000)]
[clang-tidy] Add missing InfiniteLoopCheck.h, InfiniteLoopCheck.cpp and test from D64736
llvm-svn: 372706
Gabor Marton [Tue, 24 Sep 2019 09:00:46 +0000 (09:00 +0000)]
[ASTImporter] 4th attempt to fix Windows buildbot test errors
llvm-svn: 372705
Simon Pilgrim [Tue, 24 Sep 2019 08:56:44 +0000 (08:56 +0000)]
Revert rL372693 : [clang-tidy] New bugprone-infinite-loop check for detecting obvious infinite loops
Finding infinite loops is well-known to be impossible (halting problem).
However, it is possible to detect some obvious infinite loops, for example,
if the loop condition is not changed. Detecting such loops is beneficial
since the tests will hang on programs containing infinite loops so
testing-time detection may be costly in large systems. Obvious cases are
where the programmer forgets to increment/decrement the counter or
increments/decrements the wrong variable.
Differential Revision: https://reviews.llvm.org/D64736
-------
Broke some buildbots "No SOURCES given to target: obj.clangTidyBugproneModule"
llvm-svn: 372704
Alexey Lapshin [Tue, 24 Sep 2019 08:47:03 +0000 (08:47 +0000)]
[Debuginfo] dbg.value points to undef value after Induction Variable Simplification.
Induction Variable Simplification pass does not update dbg.value intrinsic.
Before:
%add = add nuw nsw i32 %ArgIndex.06, 1
call void @llvm.dbg.value(metadata i32 %add, metadata !17, metadata !DIExpression())
After:
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
call void @llvm.dbg.value(metadata i64 undef, metadata !17, metadata !DIExpression())
There should be:
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
call void @llvm.dbg.value(metadata i64 %indvars.iv.next, metadata !17, metadata !DIExpression())
Differential Revision: https://reviews.llvm.org/D67770
llvm-svn: 372703
Raphael Isemann [Tue, 24 Sep 2019 08:41:10 +0000 (08:41 +0000)]
[lldb][NFC] Relax completion tests for log command to make them pass on Linux
The log channels change depending on platform, so listing them breaks on
some platforms. Let's just check that the 'lldb' and 'dwarf' channels are
there which are independent of platform.
llvm-svn: 372701
Martin Storsjo [Tue, 24 Sep 2019 08:39:12 +0000 (08:39 +0000)]
[LLDB] Avoid warnings about redefining posix mode defines on MinGW
Since these defines were added in LLVM SVN r189364 in 2013,
mingw-w64 got defines for S_I?GRP, S_IRWXG, S_I?OTH and S_IRWXO
in 2015.
Also change the existing defined(_MSC_VER) into ifndef S_IRUSR, for
consistency.
Differential Revision: https://reviews.llvm.org/D67910
llvm-svn: 372700
Martin Storsjo [Tue, 24 Sep 2019 08:39:06 +0000 (08:39 +0000)]
[LLDB] [Windows] Add missing ifdefs to fix building for non-x86 architectures
While debugging on those architectures might not be supported yet,
the generic code should still be buildable. This file accesses x86
specific fields in the CONTEXT struct.
Differential Revision: https://reviews.llvm.org/D67911
llvm-svn: 372699
Dmitry Vyukov [Tue, 24 Sep 2019 08:27:51 +0000 (08:27 +0000)]
sanitizer_common: fix freebsd build error
Variable flags is not used. Remove it.
Suggested-by: randall77 (Keith Randall)
Review: https://reviews.llvm.org/D67928
llvm-svn: 372698
Raphael Isemann [Tue, 24 Sep 2019 08:20:05 +0000 (08:20 +0000)]
[lldb] Fix log output and UtilityTests/LogChannelTest.List
I refactored this code in 372691 and it seems I didn't fully
replicate the original log output, so that test was failing.
llvm-svn: 372696
Sjoerd Meijer [Tue, 24 Sep 2019 08:03:34 +0000 (08:03 +0000)]
[LV] Forced vectorization with runtime checks and OptForSize
When vectorisation is forced with a pragma, we optimise for min size, and we
need to emit runtime memory checks, then allow this code growth and don't run
in an assert like we currently do.
This is the result of D65197 and D66803, and was a use-case not really
considered before. If this now happens, we emit an optimisation remark warning
about the code-size expansion, which can be avoided by not forcing
vectorisation or possibly source-code modifications.
Differential Revision: https://reviews.llvm.org/D67764
llvm-svn: 372694
Adam Balogh [Tue, 24 Sep 2019 07:43:26 +0000 (07:43 +0000)]
[clang-tidy] New bugprone-infinite-loop check for detecting obvious infinite loops
Finding infinite loops is well-known to be impossible (halting problem).
However, it is possible to detect some obvious infinite loops, for example,
if the loop condition is not changed. Detecting such loops is beneficial
since the tests will hang on programs containing infinite loops so
testing-time detection may be costly in large systems. Obvious cases are
where the programmer forgets to increment/decrement the counter or
increments/decrements the wrong variable.
Differential Revision: https://reviews.llvm.org/D64736
llvm-svn: 372693
Raphael Isemann [Tue, 24 Sep 2019 07:22:44 +0000 (07:22 +0000)]
[lldb] Remove redundant argument lists in CompletionRequest
We currently have two lists in the CompletionRequest that we
inherited from the old API: The complete list of arguments ignoring
where the user requested completion and the list of arguments that
stops at the cursor. Having two lists of arguments is confusing
and can lead to subtle errors, so let's remove the complete list
until we actually need it.
llvm-svn: 372692
Raphael Isemann [Tue, 24 Sep 2019 07:18:09 +0000 (07:18 +0000)]
[lldb] Add completion support for log enable/disable/list
Reviewers: #lldb, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D67903
llvm-svn: 372691
Raphael Isemann [Tue, 24 Sep 2019 06:58:39 +0000 (06:58 +0000)]
Ignore generated @import statements in the expression evaluator
Summary:
The ClangModulesDeclVendor is currently interpreting all injected `@import` statements in our expression
wrapper as modules that the user has explicitly requested to be persistently loaded. As we inject
`@import` statements with our std module prototype, the ClangModulesDeclVendor will start compiling
and loading unrelated C++ modules because it thinks the user has requested that it should load them. As
the ClangModulesDeclVendor is lacking the setup to compile these modules (e.g. it lacks the include paths),
it will then actually just fail to compile them and cause the whole expression evaluation to fail. This causes
these tests to fail on systems that enable the ClangModulesDeclVendor (such as macOS).
This patch fixes this by preventing the ClangModulesDeclVendor from interpreting `@import` statements
in the wrapper source code. This is done by check if the import happens in the fake source file containing
our wrapper code (which implies it was generated by LLDB).
This patch doesn't reenable the tests as there is more work needed to get the tests running on macOS (D67760)
Reviewers: aprantl, shafik, jingham
Subscribers: lldb-commits
Tags: #c_modules_in_lldb, #lldb
Differential Revision: https://reviews.llvm.org/D61565
llvm-svn: 372690
Paul Hoad [Tue, 24 Sep 2019 06:35:37 +0000 (06:35 +0000)]
[clang-format] NFC clang-format the clang-format unit tests
Summary:
It is annoying that the clang-format tests aren't themselves clang-formatted, if you use a format on save option in VS or vim this file gets massively changed then you have to `git difftool` all the other changes back out, which is risky.
I know people don't like mass clang-format changes but sometimes it becomes unmanageable to not. There are no other changes here other than just the reformat.
clang-format tests all pass.
```
[==========] 691 tests from 21 test cases ran. (55990 ms total)
[ PASSED ] 691 tests.
```
Reviewers: klimek, owenpan, timwoj
Reviewed By: owenpan
Subscribers: cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D67888
llvm-svn: 372689
Gabor Marton [Tue, 24 Sep 2019 05:50:02 +0000 (05:50 +0000)]
[ASTImporter] 3rd attempt to fix Windows buildbot test errors
llvm-svn: 372688
Jan Korous [Tue, 24 Sep 2019 03:21:22 +0000 (03:21 +0000)]
Revert "[static analyzer] Define __clang_analyzer__ macro in driver"
This reverts commit
fbd13570b0d5f92ef2cf6bcfe7cc2f6178500187.
llvm-svn: 372687
Jan Korous [Tue, 24 Sep 2019 03:20:59 +0000 (03:20 +0000)]
Revert "[lit] Add -D__clang_analyzer__ to clang_analyze_cc1"
This reverts commit
4185460f758b98ea5b898c04c179704756ca8f53.
llvm-svn: 372686
Jan Korous [Tue, 24 Sep 2019 03:19:20 +0000 (03:19 +0000)]
Revert "[static analyzer][test] Test directly that driver sets D__clang_analyzer__"
This reverts commit
c7541903d72765a38808e9973572a8d50c9d94fb.
llvm-svn: 372685
Rumeet Dhindsa [Tue, 24 Sep 2019 02:59:02 +0000 (02:59 +0000)]
Fix int to bool errors exposed due to r372612.
Differential Revision: https://reviews.llvm.org/D67937
M lib/builtins/fp_add_impl.inc
M lib/builtins/fp_lib.h
M lib/builtins/fp_trunc_impl.inc
llvm-svn: 372684
Jan Korous [Tue, 24 Sep 2019 02:06:59 +0000 (02:06 +0000)]
[static analyzer][test] Test directly that driver sets D__clang_analyzer__
Follow-up to
fbd13570b0d
llvm-svn: 372683
Jan Korous [Tue, 24 Sep 2019 01:59:20 +0000 (01:59 +0000)]
[lit] Add -D__clang_analyzer__ to clang_analyze_cc1
Fixup after
fbd13570b0d
llvm-svn: 372682
Adrian Prantl [Tue, 24 Sep 2019 00:38:49 +0000 (00:38 +0000)]
Support for DWARF-5 C++ language tags.
This patch provides support for DW_LANG_C_plus_plus_11,
DW_LANG_C_plus_plus_14 tags in the Clang C++ frontend.
Patch by Sourabh Singh Tomar!
Differential Revision: https://reviews.llvm.org/D67613
Reapplies r372663 after adapting a failing test in the LLDB testsuite.
llvm-svn: 372681
Jan Korous [Tue, 24 Sep 2019 00:37:25 +0000 (00:37 +0000)]
[static analyzer] Remove --analyze-auto
Differential Revision: https://reviews.llvm.org/D67934
llvm-svn: 372680
Jan Korous [Tue, 24 Sep 2019 00:33:47 +0000 (00:33 +0000)]
[static analyzer] Define __clang_analyzer__ macro in driver
Differential Revision: https://reviews.llvm.org/D67938
llvm-svn: 372679
Huihui Zhang [Tue, 24 Sep 2019 00:30:09 +0000 (00:30 +0000)]
[InstCombine] Fold a shifty implementation of clamp-to-allones.
Summary:
Fold
or(ashr(subNSW(Y, X), ScalarSizeInBits(Y)-1), X)
into
X s> Y ? -1 : X
https://rise4fun.com/Alive/d8Ab
clamp255 is a common operator in image processing, can be implemented
in a shifty way "(255 - X) >> 31 | X & 255". Fold shift into select
enables more optimization, e.g., vmin generation for ARM target.
Reviewers: lebedev.ri, efriedma, spatel, kparzysz, bcahoon
Reviewed By: lebedev.ri
Subscribers: kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67800
llvm-svn: 372678
Adrian Prantl [Tue, 24 Sep 2019 00:27:13 +0000 (00:27 +0000)]
Adapt test to upstream clang compiler changes.
Clang now emits the correct C++ language version in DWARF.
llvm-svn: 372677
Huihui Zhang [Tue, 24 Sep 2019 00:15:03 +0000 (00:15 +0000)]
[InstCombine] Fold a shifty implementation of clamp-to-zero.
Summary:
Fold
and(ashr(subNSW(Y, X), ScalarSizeInBits(Y)-1), X)
into
X s> Y ? X : 0
https://rise4fun.com/Alive/lFH
Fold shift into select enables more optimization,
e.g., vmax generation for ARM target.
Reviewers: lebedev.ri, efriedma, spatel, kparzysz, bcahoon
Reviewed By: lebedev.ri
Subscribers: xbolva00, andreadb, craig.topper, RKSimon, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67799
llvm-svn: 372676
Amara Emerson [Tue, 24 Sep 2019 00:09:23 +0000 (00:09 +0000)]
[GlobalISel][IRTranslator] Fix switch table lowering to use signed LE not unsigned.
We were miscompiling switch value comparisons with the wrong signedness, which
shows up when we have things like switch case values with i1 types, which end up
being legalized incorrectly.
Fixes PR43383
llvm-svn: 372675
Artem Dergachev [Tue, 24 Sep 2019 00:01:51 +0000 (00:01 +0000)]
[llvm-cov] NFC: Specify a specific C++ standard in the test.
Makes life easier for downstream users with customized default standard.
llvm-svn: 372674
Alina Sbirlea [Mon, 23 Sep 2019 23:50:16 +0000 (23:50 +0000)]
[MemorySSA] Update Phi insertion.
Summary:
MemoryPhis may be needed following a Def insertion inthe IDF of all the
new accesses added (phis + potentially a def). Ensure this also occurs when
only the new MemoryPhis are the defining accesses.
Note: The need for computing IDF here is because of new Phis added with
edges incoming from unreachable code, Phis that had previously been
simplified. The preferred solution is to not reintroduce such Phis.
This patch is the needed fix while working on the preferred solution.
Reviewers: george.burgess.iv
Subscribers: Prazek, sanjoy.google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67927
llvm-svn: 372673
Jonas Devlieghere [Mon, 23 Sep 2019 23:49:36 +0000 (23:49 +0000)]
Revert "Support for DWARF-5 C++ language tags."
This reverts commit
bf9c8ffb54943c6d77398adbedddf05ef9724007.
llvm-svn: 372672
Huihui Zhang [Mon, 23 Sep 2019 23:48:32 +0000 (23:48 +0000)]
[NFC][InstCombine] Add tests for shifty implementation of clamping.
Summary:
Clamp negative to zero and clamp positive to allOnes are common
operation in image saturation.
Add tests for shifty implementation of clamping, as prepare work for
folding:
and(ashr(subNSW(Y, X), ScalarSizeInBits(Y)-1), X) --> X s> 0 ? X : 0;
or(ashr(subNSW(Y, X), ScalarSizeInBits(Y)-1), X) --> X s> Y ? allOnes : X.
Reviewers: lebedev.ri, efriedma, spatel, kparzysz, bcahoon
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67798
llvm-svn: 372671
Jonas Devlieghere [Mon, 23 Sep 2019 22:31:16 +0000 (22:31 +0000)]
[Make] Add support for building NeXT-style frameworks
This patch extends the Makefile.rules to build NeXT-style frameworks. It
also fixes a bug in the clean logic that would accidentally delete the
.mm source file instead of the .o object file.
Thanks a lot to Adrian who was instrumental is getting this to work!
llvm-svn: 372669
Alex Langford [Mon, 23 Sep 2019 22:24:47 +0000 (22:24 +0000)]
[NFCI] Return PathSensitiveBugReport where appropriate
Some compilers have trouble converting unique_ptr<PathSensitiveBugReport> to
unique_ptr<BugReport> causing some functions to fail to compile.
Changing the return type of the functions that fail to compile does not
appear to have any issues.
I ran into this issue building with clang 3.8 on Ubuntu 16.04.
llvm-svn: 372668
Saleem Abdulrasool [Mon, 23 Sep 2019 22:23:01 +0000 (22:23 +0000)]
HotColdSplitting: invalidate the AssumptionCache on split
When a cold path is outlined, the value tracking in the assumption cache may be
invalidated due to the code motion. We would previously trip an assertion in
subsequent passes (but required the passes to happen in a single run as the
assumption cache is shared across the passes). Invalidating the cache ensures
that we get the correct information when needed with the legacy pass manager as
well.
llvm-svn: 372667
Alexander Shaposhnikov [Mon, 23 Sep 2019 22:22:55 +0000 (22:22 +0000)]
[llvm-lipo] Add support for archives
Add support for creating universal binaries which
can contain an archive.
Differential revision: https://reviews.llvm.org/D67758
Test plan: make check-all
llvm-svn: 372666
Wei Mi [Mon, 23 Sep 2019 22:11:35 +0000 (22:11 +0000)]
[SampleFDO] Treat names in profile as not cold only when profile symbol list
is available
In rL372232, we treated names showing up in profile as not cold when
profile-sample-accurate is enabled. This caused 70k size regression in
Chrome/Android. The patch put a guard and only enable the change when
profile symbol list is available, i.e., keep the old behavior when profile
symbol list is not available.
Differential Revision: https://reviews.llvm.org/D67931
llvm-svn: 372665
David Bolvansky [Mon, 23 Sep 2019 22:09:49 +0000 (22:09 +0000)]
[Diagnostics] Warn for enum constants in bool context (-Wint-in-bool-context; GCC compatibility)
Extracted from D63082.
llvm-svn: 372664
Adrian Prantl [Mon, 23 Sep 2019 22:01:49 +0000 (22:01 +0000)]
Support for DWARF-5 C++ language tags.
This patch provides support for DW_LANG_C_plus_plus_11,
DW_LANG_C_plus_plus_14 tags in the Clang C++ frontend.
Patch by Sourabh Singh Tomar!
Differential Revision: https://reviews.llvm.org/D67613
llvm-svn: 372663
Simon Pilgrim [Mon, 23 Sep 2019 21:32:38 +0000 (21:32 +0000)]
Fix uninitialized variable warning. NFCI.
llvm-svn: 372662
Craig Topper [Mon, 23 Sep 2019 21:29:28 +0000 (21:29 +0000)]
[X86] Reduce the number of unique check prefixes in memset-nonzero.ll. NFC
The avx512 with prefer-256-bit generates the same code as AVX2 so
just reuse that prefix.
llvm-svn: 372661
Sam Clegg [Mon, 23 Sep 2019 21:28:29 +0000 (21:28 +0000)]
[lld][WebAssembly] Preserve symbol flags in --relocatable output
Fixes https://github.com/emscripten-core/emscripten/issues/8879
Differential Revision: https://reviews.llvm.org/D67729
llvm-svn: 372660
Martin Storsjo [Mon, 23 Sep 2019 20:43:22 +0000 (20:43 +0000)]
[LLDB] [Windows] Map COFF ARM machine ids to the right triple architectures
Differential Revision: https://reviews.llvm.org/D67913
llvm-svn: 372658
Martin Storsjo [Mon, 23 Sep 2019 20:43:16 +0000 (20:43 +0000)]
[LLDB] [PECOFF] Recognize arm64 executables
Differential Revision: https://reviews.llvm.org/D67912
llvm-svn: 372657
Martin Storsjo [Mon, 23 Sep 2019 20:43:11 +0000 (20:43 +0000)]
[LLDB] Rework a MinGW build fix from D65691
That change didn't contain any explanation for this bit. There shouldn't
be any need for a check for MinGW ifdefs here, as long as the include
uses lowercase windows.h (as is used consistently elsewhere in
the llvm projects).
Differential Revision: https://reviews.llvm.org/D67894
llvm-svn: 372656
Thomas Lively [Mon, 23 Sep 2019 20:42:12 +0000 (20:42 +0000)]
[WebAssembly] vNxM.load_splat instructions
Summary:
Adds the new load_splat instructions as specified at
https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#load-and-splat.
DAGISel does not allow matching multiple copies of the same load in a
single pattern, so we use a new node in WebAssemblyISD to wrap loads
that should be splatted.
Depends on D67783.
Reviewers: aheejin
Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67784
llvm-svn: 372655
Roman Lebedev [Mon, 23 Sep 2019 20:40:47 +0000 (20:40 +0000)]
[InstCombine] foldOrOfICmps(): Acquire SimplifyQuery with set CxtI
Extracted from https://reviews.llvm.org/D67849#inline-610377
llvm-svn: 372654
Roman Lebedev [Mon, 23 Sep 2019 20:40:40 +0000 (20:40 +0000)]
[InstCombine] foldAndOfICmps(): Acquire SimplifyQuery with set CxtI
Extracted from https://reviews.llvm.org/D67849#inline-610377
llvm-svn: 372653
Jonas Devlieghere [Mon, 23 Sep 2019 20:36:46 +0000 (20:36 +0000)]
File::SetDescriptor() should require options
lvm_private::File::GetStream() can fail if m_options == 0
It's not clear from the header a File created with a descriptor will be
not be usable by many parts of LLDB unless SetOptions is also called,
but it is.
This is because those parts of LLDB rely on GetStream() to use the
file, and that in turn relies on calling fdopen on the descriptor. When
calling fdopen, GetStream relies on m_options to determine the access
mode. If m_options has never been set, GetStream() will fail.
This patch adds options as a required argument to File::SetDescriptor
and the corresponding constructor.
Patch by: Lawrence D'Anna
Differential revision: https://reviews.llvm.org/D67792
llvm-svn: 372652
Simon Atanasyan [Mon, 23 Sep 2019 20:32:43 +0000 (20:32 +0000)]
[mips] Support elf32btsmipn32_fbsd / elf32ltsmipn32_fbsd emulations
Patch by Kyle Evans.
llvm-svn: 372651
Simon Atanasyan [Mon, 23 Sep 2019 20:32:33 +0000 (20:32 +0000)]
[mips] Add tests to check MIPS FreeBSD emulations. NFC
llvm-svn: 372650
Simon Atanasyan [Mon, 23 Sep 2019 20:32:27 +0000 (20:32 +0000)]
[mips] Reformat test case to simplify addition new tests. NFC
llvm-svn: 372649