platform/upstream/llvm.git
4 years ago[Analyzer] Checker for Debugging Iterator Checkers
Adam Balogh [Fri, 8 Nov 2019 07:56:31 +0000 (08:56 +0100)]
[Analyzer] Checker for Debugging Iterator Checkers

For white-box testing correct container and iterator modelling it is essential
to access the internal data structures stored for container and iterators. This
patch introduces a simple debug checkers called debug.IteratorDebugging to
achieve this.

Differential Revision: https://reviews.llvm.org/D67156

4 years ago[NFC][IndVarS] Adjust a comment
Daniil Suchkov [Fri, 8 Nov 2019 07:51:36 +0000 (14:51 +0700)]
[NFC][IndVarS] Adjust a comment

(test commit)

4 years ago[CR] ConstantRange::sshl_sat(): check sigdness of the min/max, not ranges
Roman Lebedev [Fri, 8 Nov 2019 07:32:56 +0000 (10:32 +0300)]
[CR] ConstantRange::sshl_sat(): check sigdness of the min/max, not ranges

This was pointed out in review,
but forgot to stage this change into the commit itself..

4 years ago[ConstantRange] Add `ushl_sat()`/`sshl_sat()` methods.
Roman Lebedev [Fri, 8 Nov 2019 07:24:46 +0000 (10:24 +0300)]
[ConstantRange] Add `ushl_sat()`/`sshl_sat()` methods.

Summary:
To be used in `ConstantRange::shlWithNoOverflow()`,
may in future be useful for when saturating shift/mul ops are added.

Unlike `ConstantRange::shl()`, these are precise.

Reviewers: nikic, spatel, reames

Reviewed By: nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69960

4 years ago[BPF] turn on -mattr=+alu32 for cpu version v3 and later
Yonghong Song [Thu, 7 Nov 2019 18:55:59 +0000 (10:55 -0800)]
[BPF] turn on -mattr=+alu32 for cpu version v3 and later

-mattr=+alu32 has shown good performance vs. without this attribute.
Based on discussion at
  https://lore.kernel.org/bpf/1ec37838-966f-ec0b-5223-ca9b6eb0860d@fb.com/T/#t
cpu version v3 should support -mattr=+alu32.
This patch enabled alu32 if cpu version is v3, either specified by user
or probed by the llvm.

Differential Revision: https://reviews.llvm.org/D69957

4 years agoReordering KextImageInfo::LoadImageUsingMemoryModule
Jason Molenda [Fri, 8 Nov 2019 03:34:09 +0000 (19:34 -0800)]
Reordering KextImageInfo::LoadImageUsingMemoryModule
so we only call ModulesDidLoad at the end of the method
after the new module has been added to the target and
the sections have all been adjusted to their actual
load addresses.  Solves a problem where an operating
system plugin in the kernel could be loaded multiple
times; the first before the binary had even been
added to the target.

<rdar://problem/50523558>

4 years ago[PowerPC][Altivec] Fix offsets for vec_xl and vec_xst
Nemanja Ivanovic [Fri, 8 Nov 2019 02:58:11 +0000 (20:58 -0600)]
[PowerPC][Altivec] Fix offsets for vec_xl and vec_xst

As we currently have it implemented in altivec.h, the offsets for these two
intrinsics are element offsets. The documentation in the ABI (as well as the
implementation in both XL and GCC) states that these should be byte offsets.

Differential revision: https://reviews.llvm.org/D63636

4 years ago[PowerPC][Altivec] Emit correct builtin for single precision vec_all_ne
Nemanja Ivanovic [Fri, 8 Nov 2019 02:40:32 +0000 (20:40 -0600)]
[PowerPC][Altivec] Emit correct builtin for single precision vec_all_ne

We currently emit a double precision comparison instruction for this, whereas we
need to emit the single precision version.

Differential revision: https://reviews.llvm.org/D64024

4 years ago[PowerPC] Option for enabling absolute jumptables with command line
Nemanja Ivanovic [Fri, 8 Nov 2019 01:31:00 +0000 (19:31 -0600)]
[PowerPC] Option for enabling absolute jumptables with command line

This option allows the user to specify the use of absolute jumptables instead
of relative which is the default on most PPC subtargets.

Patch by Kamauu Bridgeman

Differential revision: https://reviews.llvm.org/D69108

4 years ago[creduce] Fixed a typo in the error message we're looking for.
Artem Belevich [Fri, 8 Nov 2019 01:16:12 +0000 (17:16 -0800)]
[creduce] Fixed a typo in the error message we're looking for.

4 years ago[analyzer] Add test cases for the unsupported C++ constructor modeling.
Artem Dergachev [Fri, 8 Nov 2019 00:17:39 +0000 (16:17 -0800)]
[analyzer] Add test cases for the unsupported C++ constructor modeling.

Namely, for the following items:
- Handle constructors within new[];
- Handle constructors for default arguments.

Update the open projects page with a link to the newly added tests
and more hints for potential contributors.

Patch by Daniel Krupp!

Differential Revision: https://reviews.llvm.org/D69308

4 years ago[analyzer] PR41729: CStringChecker: Improve strlcat and strlcpy modeling.
Artem Dergachev [Thu, 7 Nov 2019 23:58:01 +0000 (15:58 -0800)]
[analyzer] PR41729: CStringChecker: Improve strlcat and strlcpy modeling.

- Fix false positive reports of strlcat.
- The return value of strlcat and strlcpy is now correctly calculated.
- The resulting string length of strlcat and strlcpy is now correctly
  calculated.

Patch by Daniel Krupp!

Differential Revision: https://reviews.llvm.org/D66049

4 years ago[llvm/test] Update test comments
Shu-Chun Weng [Thu, 7 Nov 2019 23:47:41 +0000 (15:47 -0800)]
[llvm/test] Update test comments

4 years ago[MC] Delete defaulted constructor llvm::AsmCond::AsmCond
Fangrui Song [Fri, 8 Nov 2019 00:02:32 +0000 (16:02 -0800)]
[MC] Delete defaulted constructor llvm::AsmCond::AsmCond

4 years ago[InstCombine] Don't transform bitcasts between x86_mmx and v1i64 into insertelement...
Craig Topper [Thu, 7 Nov 2019 22:59:14 +0000 (14:59 -0800)]
[InstCombine] Don't transform bitcasts between x86_mmx and v1i64 into insertelement/extractelement

x86_mmx is conceptually a vector already. Don't introduce an extra conversion between it and scalar i64.

I'm using VectorType::isValidElementType which checks for floating point, integer, and pointers to hopefully make this more readable than just blacklisting x86_mmx.

Differential Revision: https://reviews.llvm.org/D69964

4 years ago[InstCombine] auto-generate complete checks; NFC
Sanjay Patel [Thu, 7 Nov 2019 23:06:26 +0000 (18:06 -0500)]
[InstCombine] auto-generate complete checks; NFC

4 years agoModernize TestWeakSymbols Makefile
Fred Riss [Thu, 7 Nov 2019 22:03:07 +0000 (14:03 -0800)]
Modernize TestWeakSymbols Makefile

4 years ago[SEH] Defer checking filter expression types until instantiaton
Reid Kleckner [Thu, 7 Nov 2019 22:13:26 +0000 (14:13 -0800)]
[SEH] Defer checking filter expression types until instantiaton

While here, wordsmith the error a bit. Now clang says:
  error: filter expression has non-integral type 'Foo'

Fixes PR43779

Reviewers: amccarth

Differential Revision: https://reviews.llvm.org/D69969

4 years agoCorrectly update isSignalFrame when unwinding the stack via dwarf.
Sterling Augustine [Thu, 31 Oct 2019 19:45:20 +0000 (12:45 -0700)]
Correctly update isSignalFrame when unwinding the stack via dwarf.

A "signal frame" is a function or block of code where execution arrives via a signal or interrupt, rather than via a normal call instruction. In fact, a particular instruction is interrupted by the signal and needs to be restarted. Therefore, when the signal handler is complete, execution needs to return to the interrupted instruction, rather than the instruction immediately following the call instruction, as in a normal call.

Stack unwinders need to know this to correctly unwind signal frames. Dwarf handily provides an "S" in the CIE augmentation string to describe this case, and the libunwind API provides various functions to for unwinders to determine it,.

The llvm libunwind implementation correctly sets it's internal variable "isSignalFrame" when initializing an unwind context. However, upon stepping up the stack, the current implementation correctly reads the augmentation string and sets it in the CIE info (which it then discards), libunwind doesn't update it's internal unwind context data structure.

This change fixes that, and provides compatibility with both the canonical libunwind and the libgcc implementation.

Reviewers: jfb

Subscribers: christof, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D69677

4 years agogn build: Merge 25ee861372f
LLVM GN Syncbot [Thu, 7 Nov 2019 22:43:50 +0000 (22:43 +0000)]
gn build: Merge 25ee861372f

4 years ago[debugify] Move the Debugify pass from tools/opt to lib/Transform/Utils
Daniel Sanders [Thu, 7 Nov 2019 00:08:01 +0000 (16:08 -0800)]
[debugify] Move the Debugify pass from tools/opt to lib/Transform/Utils

Summary:
I need to make use of this pass from a driver program that isn't opt.
Therefore this patch moves this pass into the LLVM library so that it is
available for use elsewhere.

There was one function I kept in tools/opt which is exportDebugifyStats()
this is because it's serializing the statistics into a human readable
format and this seemed more in keeping with opt than a library function

Reviewers: vsk, aprantl

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69926

4 years ago[compiler-rt] Fix tests after 03b84e4f6d0
Jan Korous [Thu, 7 Nov 2019 22:40:22 +0000 (14:40 -0800)]
[compiler-rt] Fix tests after 03b84e4f6d0

Fallout from:
[clang] Report sanitizer blacklist as a dependency in cc1

Default blacklists are now passed via -fsanitize-system-blacklist from driver to cc1.

4 years agoBreakpointDummyOptionGroup was using g_breakpoint_modify_options rather than g_breakp...
Jim Ingham [Thu, 7 Nov 2019 20:44:03 +0000 (12:44 -0800)]
BreakpointDummyOptionGroup was using g_breakpoint_modify_options rather than g_breakpoint_dummy_options
causing the -D option for breakpoint set command to be incorrectly parsed.

Patch by Martin Svensson.

Differential Revision: https://reviews.llvm.org/D69425

4 years ago[clang] Report sanitizer blacklist as a dependency in cc1
Jan Korous [Thu, 7 Nov 2019 21:56:14 +0000 (13:56 -0800)]
[clang] Report sanitizer blacklist as a dependency in cc1

Previously these were reported from the driver which blocked clang-scan-deps from getting the full set of dependencies from cc1 commands.

Also the default sanitizer blacklist that is added in driver was never reported as a dependency. I introduced -fsanitize-system-blacklist cc1 option to keep track of which blacklists were user-specified and which were added by driver and clang -MD now also reports system blacklists as dependencies.

Differential Revision: https://reviews.llvm.org/D69290

4 years agoRevert "[MachineVerifier] Improve verification of live-in lists.
Galina Kistanova [Thu, 7 Nov 2019 22:02:13 +0000 (14:02 -0800)]
Revert "[MachineVerifier] Improve verification of live-in lists.

This reverts commit b7b170c to give the author more time to address failing tests on the expensive checks buildbots.

4 years ago[codeview] Reference types in type parent scopes
Reid Kleckner [Wed, 6 Nov 2019 23:04:52 +0000 (15:04 -0800)]
[codeview] Reference types in type parent scopes

Without this change, when a nested tag type of any kind (enum, class,
struct, union) is used as a variable type, it is emitted without
emitting the parent type. In CodeView, parent types point to their inner
types, and inner types do not point back to their parents. We already
walk over all of the parent scopes to build the fully qualified name.
This change simply requests their type indices as we go along to enusre
they are all emitted.

Fixes PR43905

Reviewers: akhuang, amccarth

Differential Revision: https://reviews.llvm.org/D69924

4 years ago[Diagnostics] Teach -Wnull-dereference about address_space attribute
Dávid Bolvanský [Thu, 7 Nov 2019 19:47:09 +0000 (20:47 +0100)]
[Diagnostics] Teach -Wnull-dereference about address_space attribute

Summary:
Clang should not warn for:

> test.c:2:12: warning: indirection of non-volatile null pointer will be deleted,
>       not trap [-Wnull-dereference]
>     return *(int __attribute__((address_space(256))) *) 0;
>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Solves PR42292.

Reviewers: aaron.ballman, rsmith

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69664

4 years ago[CodeGenModule] Group blocks runtime globals together, NFC
Vedant Kumar [Thu, 7 Nov 2019 20:46:26 +0000 (12:46 -0800)]
[CodeGenModule] Group blocks runtime globals together, NFC

4 years ago[lldb] Improve assert in GDBRemoteCommunicationReplayServer
Jonas Devlieghere [Thu, 7 Nov 2019 19:13:47 +0000 (11:13 -0800)]
[lldb] Improve assert in GDBRemoteCommunicationReplayServer

While investigating an issue where a different packet was sent during
replay I noticed how annoying it is that the existing assert doesn't
specify what packet is actually different. It's printed to the log, but
enabling logging has the potential to change LLDB's behavior. The same
is true when debugging LLDB while it's replaying the reproducer.

I replaced the assert with a printf of the unexpected packet followed by
a fatal_error wrapped in ifndef NDEBUG. The behavior is the same as the
previous assert, just with more/better context.

4 years ago[InstCombine] Add test cases to show bad canonicalization of bitcasts between x86_mmx...
Craig Topper [Thu, 7 Nov 2019 20:37:24 +0000 (12:37 -0800)]
[InstCombine] Add test cases to show bad canonicalization of bitcasts between x86_mmx and <1 x i64>.

As the test cases show, we end up with an insert/extract and a
bitcast to/from i64. x86_mmx is for some purposes conceptually a
vector. We shouldn't be adding scalar conversions around it.

Since _m64 is defined as <1 x i64> and intrinsics use x86_mmx
as their input/output these extra scalar operations prevent
the X86 backend from generating good code especially on 32-bit
targets where i64 gets split.

4 years ago[Sema] Fixes a crash with a templated destructor
Mark de Wever [Thu, 7 Nov 2019 20:22:03 +0000 (21:22 +0100)]
[Sema] Fixes a crash with a templated destructor

The issue was introduced by D33189 which fixed PR33189.

Fixes PR38671: "destructor cannot be declared as a template" leads to segfault in Sema::LookupSpecialMember

Differential Revision: https://reviews.llvm.org/D69225

4 years ago[clang] Add -fdebug-default-version for specifying the default DWARF version
David Blaikie [Thu, 7 Nov 2019 20:00:22 +0000 (12:00 -0800)]
[clang] Add -fdebug-default-version for specifying the default DWARF version

This flag decouples specifying the DWARF version from enabling/disabling
DWARF in general (or the gN level - gmlt/limited/standalone, etc) while
still allowing existing -gdwarf-N flags to override this default.

Patch by Caroline Tice!

Differential Revision: https://reviews.llvm.org/D69822

4 years agoWrong debug info generated at -O2 (-O0 is correct)
Vedant Kumar [Thu, 7 Nov 2019 19:19:41 +0000 (11:19 -0800)]
Wrong debug info generated at -O2 (-O0 is correct)

Instcombiner pass was erasing trivially dead instruction without updating dependent llvm.dbg.value.
which was not showing programmer current state of variables while debugging.
As a part of this fix I did following,
Iterate throught all the users (llvm.dbg) of a instruction which is trivially dead and set each if them undef, Before deleting the instruction.
Now user will see optimized out, when try to print those variables.
This fixes
https://bugs.llvm.org/show_bug.cgi?id=43893

This is my first fix to llvm.

Patch by kamlesh kumar!

Differential Revision: https://reviews.llvm.org/D69809

4 years agocrashlog.py: Improve regular expressions
Adrian Prantl [Thu, 7 Nov 2019 18:50:37 +0000 (10:50 -0800)]
crashlog.py: Improve regular expressions

This is yet another change to the regular expressions in crashlog.py
that fix a few edge cases, and attempt to improve the readability
quite a bit in the process. My last change to support spaces in
filenames introduced a bug that caused the version/archspec field to
be parsed as part of the image name.

For example, in "0x1111111 - 0x22222 +MyApp Pro arm64 <01234>", the
name of the image was recognized as "MyApp Pro arm64" instead of
"MyApp Pro" with a "version" of arm64.

The bugfix makes the space following an optional field mandatory
*inside* the optional group.

rdar://problem/56883435

Differential Revision: https://reviews.llvm.org/D69871

4 years agoRevert "[Sema] Suppress -Wchar-subscripts if the index is a literal char"
Edward Jones [Thu, 7 Nov 2019 18:19:09 +0000 (18:19 +0000)]
Revert "[Sema] Suppress -Wchar-subscripts if the index is a literal char"

This reverts commit 7adab7719e55e1b29bfd521dcc73f202139e8f41.

4 years agoFDRRecords - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 18:41:49 +0000 (18:41 +0000)]
FDRRecords - fix uninitialized variable warnings. NFCI.

4 years agoImutAVLTree::validateTree - fix null dereference typo warning. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 18:41:01 +0000 (18:41 +0000)]
ImutAVLTree::validateTree - fix null dereference typo warning. NFCI.

Noticed by static analyzer.

4 years agocanFoldMergeOpcode returns a bool result not an unsigned. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 18:00:43 +0000 (18:00 +0000)]
canFoldMergeOpcode returns a bool result not an unsigned. NFCI.

4 years agoFix warning about unused std::unique result, erase shifted elements
Reid Kleckner [Thu, 7 Nov 2019 18:37:04 +0000 (10:37 -0800)]
Fix warning about unused std::unique result, erase shifted elements

This is actually a functional change. I haven't added any new test
coverage. I'm just trying to fix the warning and hoping for the best.

4 years ago[AsmWritter] Fixed "null check after dereferencing" warning
Dávid Bolvanský [Wed, 6 Nov 2019 18:20:48 +0000 (19:20 +0100)]
[AsmWritter] Fixed "null check after dereferencing" warning

Summary: The 'BB->getParent()' pointer was utilized before it was verified against nullptr. Check lines: 3567, 3581.

Reviewers: jyknight, RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69751

4 years ago[RISCV] Fix up tests on Windows after new usage of sys::path::append
Reid Kleckner [Thu, 7 Nov 2019 17:53:56 +0000 (09:53 -0800)]
[RISCV] Fix up tests on Windows after new usage of sys::path::append

4 years ago[XCOFF] Add back extern template declarations
Reid Kleckner [Thu, 7 Nov 2019 17:42:25 +0000 (09:42 -0800)]
[XCOFF] Add back extern template declarations

The extern template declarations were fine. The duplicate explicit
instantiations were both in the .cpp file.

4 years agoRevert "[XCOFF] Fix link errors from explicit template instantiation"
Reid Kleckner [Thu, 7 Nov 2019 17:39:13 +0000 (09:39 -0800)]
Revert "[XCOFF] Fix link errors from explicit template instantiation"

This reverts commit c989993ba1a666f04f7aee7df51d9f4de0588b71.

maskray already fixed the explicit instantiation definition in the .cpp
file, and these extern template declarations seem to be causing
warnings that I don't understand.

4 years ago[XCOFF] Fix link errors from explicit template instantiation
Reid Kleckner [Thu, 7 Nov 2019 17:27:43 +0000 (09:27 -0800)]
[XCOFF] Fix link errors from explicit template instantiation

I happen to be using clang-cl+lld-link locally, and I get these link
errors:

lld-link: error: undefined symbol: public: unsigned short __cdecl llvm::object::XCOFFSectionHeader<struct llvm::object::XCOFFSectionHeader64>::getSectionType(void) const
>>> referenced by C:\src\llvm-project\llvm\tools\llvm-readobj\XCOFFDumper.cpp:106
>>>               tools\llvm-readobj\CMakeFiles\llvm-readobj.dir\XCOFFDumper.cpp.obj:(public: virtual void __cdecl `anonymous namespace'::XCOFFDumper::printSectionHeaders(void))

I suspect this is because the explicit template instaniation appears
before the inline method definitions in the .cpp file, so they aren't
available at the point of instantiation. Move the explicit instantiation
later.

Also, forward declare the explicit instantiation for good measure.

4 years ago[llvm-ar] Support verbose mode for operation 'x'
Fangrui Song [Wed, 6 Nov 2019 18:19:30 +0000 (10:19 -0800)]
[llvm-ar] Support verbose mode for operation 'x'

Reviewed By: jhenderson, kongyi

Differential Revision: https://reviews.llvm.org/D69911

4 years ago[XCOFF] Move explicit instantions after member function definitions to fix clang...
Fangrui Song [Thu, 7 Nov 2019 17:25:31 +0000 (09:25 -0800)]
[XCOFF] Move explicit instantions after member function definitions to fix clang builds

4 years ago[InstCombine] canonicalize shift+logic+shift to reduce dependency chain
Sanjay Patel [Thu, 7 Nov 2019 17:08:10 +0000 (12:08 -0500)]
[InstCombine] canonicalize shift+logic+shift to reduce dependency chain

shift (logic (shift X, C0), Y), C1 --> logic (shift X, C0+C1), (shift Y, C1)

This is an IR translation of an existing SDAG transform added here:
rL370617

So we again have 9 possible patterns with a commuted IR variant of each pattern:
https://rise4fun.com/Alive/VlI
https://rise4fun.com/Alive/n1m
https://rise4fun.com/Alive/1Vn

Part of the motivation is to allow easier recognition and subsequent
canonicalization of bswap patterns as discussed in PR43146:
https://bugs.llvm.org/show_bug.cgi?id=43146

We had to delay this transform because it used to allow the SLP vectorizer
to create awful reductions out of simple load-combines.
That problem was fixed with:
rL375025
(we'll bring back load combining in IR someday...)

The backend is also better equipped to deal with these patterns now
using hooks like TLI.getShiftAmountThreshold().

The only remaining potential controversy is that the -reassociate pass
tends to reverse this kind of pattern (to help GVN?). But since -reassociate
doesn't do anything with these specific patterns, there is no conflict currently.

Finally, there's a new pass proposal at D67383 for general tree-height-reduction
reassociation, and it could use a cost model to decide how to optimally rearrange
these kinds of ops for a target. That patch appears to be stalled.

Differential Revision: https://reviews.llvm.org/D69842

4 years agoX86FrameLowering - fix bool to unsigned cast static analyzer warnings. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 16:48:35 +0000 (16:48 +0000)]
X86FrameLowering - fix bool to unsigned cast static analyzer warnings. NFCI.

4 years agoMachineMemOperand::getBaseAlignment() - fix "shift of i32 then extended to i64" stati...
Simon Pilgrim [Thu, 7 Nov 2019 16:46:55 +0000 (16:46 +0000)]
MachineMemOperand::getBaseAlignment() - fix "shift of i32 then extended to i64" static analyzer warning. NFCI.

4 years agoTypeRecord - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 16:45:36 +0000 (16:45 +0000)]
TypeRecord - fix uninitialized variable warnings. NFCI.

4 years agoPostRAScheduler - fix uninitialized variable warning. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 16:45:01 +0000 (16:45 +0000)]
PostRAScheduler - fix uninitialized variable warning. NFCI.

4 years agoManagedStringPool - pre-increment iterator. NFC.
Simon Pilgrim [Thu, 7 Nov 2019 16:43:47 +0000 (16:43 +0000)]
ManagedStringPool - pre-increment iterator. NFC.

4 years agoX86CondBrFolding - remove non-existent fixBranchProb function. NFC.
Simon Pilgrim [Thu, 7 Nov 2019 16:41:48 +0000 (16:41 +0000)]
X86CondBrFolding - remove non-existent fixBranchProb function. NFC.

4 years agoAsmWriterOperand - fix uninitialized variable warning. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 15:35:07 +0000 (15:35 +0000)]
AsmWriterOperand - fix uninitialized variable warning. NFCI.

4 years agoUsing crtp to refactor the xcoff section header
diggerlin [Thu, 7 Nov 2019 16:51:34 +0000 (11:51 -0500)]
Using crtp to refactor the xcoff section header

SUMMARY:
According to https://reviews.llvm.org/D68575#inline-617586, Create a NFC patch for it.

Using crtp to refactor the xcoff section header
Move the define of SectionFlagsReservedMask and SectionFlagsTypeMask from XCOFFDumper.cpp to XCOFFObjectFile.h

Reviewers: hubert.reinterpretcast,jasonliu
Subscribers: rupprecht, seiyai,hiraditya

Differential Revision: https://reviews.llvm.org/D69131

4 years ago[lldb] Comment typo fix
Jan Kratochvil [Thu, 7 Nov 2019 16:48:25 +0000 (17:48 +0100)]
[lldb] Comment typo fix

4 years agocomment shiftamountthreshold
joanlluch [Thu, 7 Nov 2019 16:41:05 +0000 (17:41 +0100)]
comment shiftamountthreshold

4 years ago[openmp] [test] Skip one more test that kills NetBSD buildbot
Michał Górny [Thu, 7 Nov 2019 16:29:13 +0000 (17:29 +0100)]
[openmp] [test] Skip one more test that kills NetBSD buildbot

4 years ago[OPENMP][DOCS] Update OpenMP status (NFC)
Alexey Bataev [Thu, 7 Nov 2019 16:07:56 +0000 (11:07 -0500)]
[OPENMP][DOCS] Update OpenMP status (NFC)

Summary: This is updating the OpenMP status table. Cray has volunteered for `defaultmap` and supporting `in_reduction` on the `target` construct, so the status on those entries from was changed from "unclaimed". Also, a new entry was added for supporting non-contiguous arrays sections on the `target update` directive.

Reviewers: ABataev, hfinkel, jdoerfert, kkwli0

Reviewed By: ABataev

Subscribers: guansong, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69923

4 years ago[Sema] Suppress -Wchar-subscripts if the index is a literal char
Edward Jones [Thu, 7 Nov 2019 15:44:38 +0000 (15:44 +0000)]
[Sema] Suppress -Wchar-subscripts if the index is a literal char

Assume that the user knows what they're doing if they provide a char
literal as an array index. This more closely matches the behavior of
GCC.

Differential Revision: https://reviews.llvm.org/D58896

4 years ago[GWP-ASan] Respect compiler-rt's -fno-lto
Mitch Phillips [Thu, 7 Nov 2019 15:41:08 +0000 (07:41 -0800)]
[GWP-ASan] Respect compiler-rt's -fno-lto

https://bugs.llvm.org/show_bug.cgi?id=43722

GWP-ASan didn't include SANITIZER_COMMON_CFLAGS, and thus would produce
LLVM bitcode files, when compiler-rt is generally built without LTO.

4 years ago[RISCV] Add riscv{32,64} to ALL_CRT_SUPPORTED_ARCH list
Edward Jones [Thu, 3 Oct 2019 14:00:55 +0000 (15:00 +0100)]
[RISCV] Add riscv{32,64} to ALL_CRT_SUPPORTED_ARCH list

This allows crtbegin and crtend to be built, allowing RISC-V
to no longer rely on implementations from libgcc.

Differential revision: https://reviews.llvm.org/D68393

4 years ago[SDAG] reduce code duplication; NFC
Sanjay Patel [Thu, 7 Nov 2019 15:28:25 +0000 (10:28 -0500)]
[SDAG] reduce code duplication; NFC

4 years agoAdd support for options -frounding-math, ftrapping-math, -ffp-model=, and -ffp-except...
Melanie Blower [Tue, 5 Nov 2019 21:41:21 +0000 (13:41 -0800)]
Add support for options -frounding-math, ftrapping-math, -ffp-model=, and -ffp-exception-behavior=

    Add options to control floating point behavior: trapping and
    exception behavior, rounding, and control of optimizations that affect
    floating point calculations. More details in UsersManual.rst.

    Reviewers: rjmccall

    Differential Revision: https://reviews.llvm.org/D62731

4 years ago[RISCV] Improve sysroot computation if no GCC install detected
Edward Jones [Thu, 3 Oct 2019 13:49:08 +0000 (14:49 +0100)]
[RISCV] Improve sysroot computation if no GCC install detected

If a GCC installed is not detected, the driver would default to
the root of the filesystem. This is not ideal when this doesn't
match the install directory of the toolchain and can cause
undesireable behavior such as picking up system libraries or
the system linker when cross-compiling.

Differential Revision: https://reviews.llvm.org/D68391

4 years ago[SDAG] reduce code duplication; NFC
Sanjay Patel [Thu, 7 Nov 2019 15:14:49 +0000 (10:14 -0500)]
[SDAG] reduce code duplication; NFC

4 years ago[OpenCL] Add geometric and relational builtin functions
Sven van Haastregt [Thu, 7 Nov 2019 15:00:19 +0000 (15:00 +0000)]
[OpenCL] Add geometric and relational builtin functions

Add the geometric and relational builtin functions from the OpenCL C
specification.

Patch by Pierre Gondois and Sven van Haastregt.

Differential Revision: https://reviews.llvm.org/D69908

4 years ago[OpenCL] Add integer builtin functions
Sven van Haastregt [Wed, 6 Nov 2019 11:53:19 +0000 (11:53 +0000)]
[OpenCL] Add integer builtin functions

This patch adds the integer builtin functions from the OpenCL C
specification.

Patch by Pierre Gondois and Sven van Haastregt.

Differential Revision: https://reviews.llvm.org/D69901

4 years ago[lldb] Add -m option to 'target modules dump symtab' to disable demangling
Raphael Isemann [Thu, 7 Nov 2019 14:47:01 +0000 (15:47 +0100)]
[lldb] Add -m option to 'target modules dump symtab' to disable demangling

Summary: This option was added downstream in swift-lldb. This upstreams this option as it seems useful and also adds the missing tests.

Reviewers: #lldb, kwk, labath

Reviewed By: kwk, labath

Subscribers: labath, kwk, abidh, JDevlieghere, lldb-commits

Tags: #lldb, #upstreaming_lldb_s_downstream_patches

Differential Revision: https://reviews.llvm.org/D69944

4 years agoSampleProfWriter - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 13:51:35 +0000 (13:51 +0000)]
SampleProfWriter - fix uninitialized variable warnings. NFCI.

4 years agoCodeGen: set correct result for atomic compound expressions
Tim Northover [Thu, 7 Nov 2019 13:36:03 +0000 (13:36 +0000)]
CodeGen: set correct result for atomic compound expressions

Atomic compound expressions try to use atomicrmw if possible, but this
path doesn't set the Result variable, leaving it to crash in later code
if anything ever tries to use the result of the expression. This fixes
that issue by recalculating the new value based on the old one
atomically loaded.

4 years ago[libc++] Fix potential OOB in poisson_distribution
Louis Dionne [Thu, 7 Nov 2019 12:06:14 +0000 (12:06 +0000)]
[libc++] Fix potential OOB in poisson_distribution

See details in the original Chromium bug report:
    https://bugs.chromium.org/p/chromium/issues/detail?id=994957

4 years ago[ConstantRange][LVI] Use overflow flags from `sub` to constrain the range
Roman Lebedev [Thu, 7 Nov 2019 13:18:03 +0000 (16:18 +0300)]
[ConstantRange][LVI] Use overflow flags from `sub` to constrain the range

Summary:
This notably improves non-negativity deduction:
```
| statistic                              |     old |     new | delta | % change |
| correlated-value-propagation.NumAShrs  |     209 |     227 |    18 |  8.6124% |
| correlated-value-propagation.NumAddNSW |    4972 |    4988 |    16 |  0.3218% |
| correlated-value-propagation.NumAddNUW |    7141 |    7148 |     7 |  0.0980% |
| correlated-value-propagation.NumAddNW  |   12113 |   12136 |    23 |  0.1899% |
| correlated-value-propagation.NumAnd    |     442 |     445 |     3 |  0.6787% |
| correlated-value-propagation.NumNSW    |    7160 |    7176 |    16 |  0.2235% |
| correlated-value-propagation.NumNUW    |   13306 |   13316 |    10 |  0.0752% |
| correlated-value-propagation.NumNW     |   20466 |   20492 |    26 |  0.1270% |
| correlated-value-propagation.NumSDivs  |     207 |     212 |     5 |  2.4155% |
| correlated-value-propagation.NumSExt   |    6279 |    6679 |   400 |  6.3704% |
| correlated-value-propagation.NumSRems  |      28 |      29 |     1 |  3.5714% |
| correlated-value-propagation.NumShlNUW |    2793 |    2796 |     3 |  0.1074% |
| correlated-value-propagation.NumShlNW  |    3964 |    3967 |     3 |  0.0757% |
| correlated-value-propagation.NumUDivs  |     353 |     358 |     5 |  1.4164% |
| instcount.NumAShrInst                  |   13763 |   13741 |   -22 | -0.1598% |
| instcount.NumAddInst                   |  277349 |  277348 |    -1 | -0.0004% |
| instcount.NumLShrInst                  |   27437 |   27463 |    26 |  0.0948% |
| instcount.NumOrInst                    |  102677 |  102678 |     1 |  0.0010% |
| instcount.NumSDivInst                  |    8732 |    8727 |    -5 | -0.0573% |
| instcount.NumSExtInst                  |   80872 |   80468 |  -404 | -0.4996% |
| instcount.NumSRemInst                  |    1679 |    1678 |    -1 | -0.0596% |
| instcount.NumTruncInst                 |   62154 |   62153 |    -1 | -0.0016% |
| instcount.NumUDivInst                  |    2526 |    2527 |     1 |  0.0396% |
| instcount.NumURemInst                  |    1589 |    1590 |     1 |  0.0629% |
| instcount.NumZExtInst                  |   69405 |   69809 |   404 |  0.5821% |
| instcount.TotalInsts                   | 7439575 | 7439574 |    -1 |  0.0000% |
```

Reviewers: nikic, reames, spatel

Reviewed By: nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69942

4 years ago[OpenCL] Add math and common builtin functions
Sven van Haastregt [Tue, 5 Nov 2019 19:47:21 +0000 (19:47 +0000)]
[OpenCL] Add math and common builtin functions

Add the remaining math and common builtin functions from the OpenCL C
specification.

Patch by Pierre Gondois and Sven van Haastregt.

Differential Revision: https://reviews.llvm.org/D69883

4 years ago[libc++] Fixed copy/copy_n/copy_backward for compilers that do not support is_constan...
Louis Dionne [Thu, 7 Nov 2019 12:30:32 +0000 (12:30 +0000)]
[libc++] Fixed copy/copy_n/copy_backward for compilers that do not support is_constant_evaluated.

Differential Revision: https://reviews.llvm.org/D69940

4 years ago[libc++] Fix some constexpr tests broken by D68837
Louis Dionne [Wed, 6 Nov 2019 14:52:26 +0000 (14:52 +0000)]
[libc++] Fix some constexpr tests broken by D68837

This doesn't fix all the issues with D68837

4 years ago[ThinLTO] Import readonly vars with refs
evgeny [Thu, 7 Nov 2019 12:13:35 +0000 (15:13 +0300)]
[ThinLTO] Import readonly vars with refs

Patch allows importing declarations of functions and variables, referenced
by the initializer of some other readonly variable.
Differential revision: https://reviews.llvm.org/D69561

4 years ago[SLP] allow forming 2-way reduction patterns
Sanjay Patel [Wed, 6 Nov 2019 22:24:09 +0000 (17:24 -0500)]
[SLP] allow forming 2-way reduction patterns

We have a vector compare reduction problem seen in PR39665 comment 2:
https://bugs.llvm.org/show_bug.cgi?id=39665#c2

Or slightly reduced here:

define i1 @cmp2(<2 x double> %a0) {
  %a = fcmp ogt <2 x double> %a0, <double 1.0, double 1.0>
  %b = extractelement <2 x i1> %a, i32 0
  %c = extractelement <2 x i1> %a, i32 1
  %d = and i1 %b, %c
  ret i1 %d
}

SLP would not attempt to turn this into a vector reduction because there is an
artificial lower limit on that transform. We can not completely remove that limit
without inducing regressions though, so this patch just hacks an extra attempt at
creating a 2-way reduction to the end of the analysis.

As shown in the test file, we are still not getting some of the motivating cases,
so follow-on patches will be needed to solve those cases.

Differential Revision: https://reviews.llvm.org/D59710

4 years ago[NFC][CVP] Add some tests for `sub` with preexisting no-wrap flags
Roman Lebedev [Thu, 7 Nov 2019 10:59:26 +0000 (13:59 +0300)]
[NFC][CVP] Add some tests for `sub` with preexisting no-wrap flags

We can use those to further limit the ranges in LVI.

4 years ago[mips] Set macros for Octeon+ CPU
Simon Atanasyan [Tue, 5 Nov 2019 08:21:04 +0000 (11:21 +0300)]
[mips] Set macros for Octeon+ CPU

4 years ago[mips] Add `octeon+` to the list of CPUs accepted by the driver
Simon Atanasyan [Mon, 4 Nov 2019 23:21:16 +0000 (02:21 +0300)]
[mips] Add `octeon+` to the list of CPUs accepted by the driver

4 years ago[mips] Write `AFL_EXT_OCTEONP` flag to the `.MIPS.abiflags` section
Simon Atanasyan [Mon, 4 Nov 2019 22:26:24 +0000 (01:26 +0300)]
[mips] Write `AFL_EXT_OCTEONP` flag to the `.MIPS.abiflags` section

Differential Revision: https://reviews.llvm.org/D69851

4 years ago[mips] Support `octeon+` CPU in the `.set arch=` directive
Simon Atanasyan [Mon, 4 Nov 2019 22:23:59 +0000 (01:23 +0300)]
[mips] Support `octeon+` CPU in the `.set arch=` directive

Differential Revision: https://reviews.llvm.org/D69850

4 years ago[mips] Implement Octeon+ `saa` and `saad` instructions
Simon Atanasyan [Mon, 4 Nov 2019 22:12:10 +0000 (01:12 +0300)]
[mips] Implement Octeon+ `saa` and `saad` instructions

`saa` and `saad` are 32-bit and 64-bit store atomic add instructions.

   memory[base] = memory[base] + rt

These instructions are available for "Octeon+" CPU. The patch adds support
for both instructions to MIPS assembler and diassembler and introduces new
CPU type - "octeon+".

Next patches will implement `.set arch=octeon+` directive and `AFL_EXT_OCTEONP`
ISA extension flag support.

Differential Revision: https://reviews.llvm.org/D69849

4 years agoRevert f0c2a5a "[LV] Generalize conditions for sinking instrs for first order recurre...
Hans Wennborg [Thu, 7 Nov 2019 10:00:02 +0000 (11:00 +0100)]
Revert f0c2a5a "[LV] Generalize conditions for sinking instrs for first order recurrences."

It broke Chromium, causing "Instruction does not dominate all uses!" errors.
See https://bugs.chromium.org/p/chromium/issues/detail?id=1022297#c1 for a
reproducer.

> If the recurrence PHI node has a single user, we can sink any
> instruction without side effects, given that all users are dominated by
> the instruction computing the incoming value of the next iteration
> ('Previous'). We can sink instructions that may cause traps, because
> that only causes the trap to occur later, but not on any new paths.
>
> With the relaxed check, we also have to make sure that we do not have a
> direct cycle (meaning PHI user == 'Previous), which indicates a
> reduction relation, which potentially gets missed by
> ReductionDescriptor.
>
> As follow-ups, we can also sink stores, iff they do not alias with
> other instructions we move them across and we could also support sinking
> chains of instructions and multiple users of the PHI.
>
> Fixes PR43398.
>
> Reviewers: hsaito, dcaballe, Ayal, rengolin
>
> Reviewed By: Ayal
>
> Differential Revision: https://reviews.llvm.org/D69228

4 years ago[clangd] NFC, hide the internal-only utility function lex.
Haojian Wu [Thu, 7 Nov 2019 09:53:19 +0000 (10:53 +0100)]
[clangd] NFC, hide the internal-only utility function lex.

To avoid any potential ODR violations.

4 years ago[lldb-server] Add setting to force 'g' packet use
Guilherme Andrade [Thu, 7 Nov 2019 09:38:25 +0000 (10:38 +0100)]
[lldb-server] Add setting to force 'g' packet use

Following up on https://reviews.llvm.org/D62221, this change introduces
the settings plugin.process.gdb-remote.use-g-packet-for-reading.  When
they are on, 'g' packets are used for reading registers.

Using 'g' packets can improve performance by reducing the number of
packets exchanged between client and server when a large number of
registers needs to be fetched.

Differential revision: https://reviews.llvm.org/D62931

4 years ago[clang-rename] Respect the traversal scope when traversing the entire AST.
Haojian Wu [Wed, 6 Nov 2019 14:21:40 +0000 (15:21 +0100)]
[clang-rename] Respect the traversal scope when traversing the entire AST.

Summary:
This should be NFC to clang-rename, by default the traversal scope is
TUDecl. Traversing the TUDecl in clangd is a performance cliff, we should
avoid it.

Reviewers: ilya-biryukov

Subscribers: kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69892

4 years agoRevert a5c8ec4 "[CGDebugInfo] Emit subprograms for decls when AT_tail_call is understood"
Hans Wennborg [Thu, 7 Nov 2019 09:23:24 +0000 (10:23 +0100)]
Revert a5c8ec4 "[CGDebugInfo] Emit subprograms for decls when AT_tail_call is understood"

This caused Chromium builds to fail with "inlinable function call in a function
with debug info must have a !dbg location" errors. See
https://bugs.chromium.org/p/chromium/issues/detail?id=1022296#c1 for a
reproducer.

> Currently, clang emits subprograms for declared functions when the
> target debugger or DWARF standard is known to support entry values
> (DW_OP_entry_value & the GNU equivalent).
>
> Treat DW_AT_tail_call the same way to allow debuggers to follow cross-TU
> tail calls.
>
> Pre-patch debug session with a cross-TU tail call:
>
> ```
>   * frame #0: 0x0000000100000fa4 main`target at b.c:4:3 [opt]
>     frame #1: 0x0000000100000f99 main`main at a.c:8:10 [opt]
> ```
>
> Post-patch (note that the tail-calling frame, "helper", is visible):
>
> ```
>   * frame #0: 0x0000000100000fa4 main`target at b.c:4:3 [opt]
>     frame #1: 0x0000000100000f80 main`helper [opt] [artificial]
>     frame #2: 0x0000000100000f99 main`main at a.c:8:10 [opt]
> ```
>
> rdar://46577651
>
> Differential Revision: https://reviews.llvm.org/D69743

4 years ago[clangd] Add unit tests for comments in system headers
Ilya Biryukov [Thu, 7 Nov 2019 08:59:36 +0000 (09:59 +0100)]
[clangd] Add unit tests for comments in system headers

4 years ago[clang-format] Make '.clang-format' variants finding a loop (NFC)
Anders Waldenborg [Thu, 7 Nov 2019 08:59:34 +0000 (09:59 +0100)]
[clang-format] Make '.clang-format' variants finding a loop (NFC)

This simplifies logic making it trivial to add searching for other
files later.

Differential revision: https://reviews.llvm.org/D68568

4 years ago[clangd] Set RetainCommentsFromSystemHeaders to true
Ilya Biryukov [Thu, 7 Nov 2019 08:53:07 +0000 (09:53 +0100)]
[clangd] Set RetainCommentsFromSystemHeaders to true

clangd should retain comments from system headers.

fixes https://github.com/clangd/clangd/issues/96

Patch by lh123!

Differential revision: https://reviews.llvm.org/D69928

4 years ago[AMDGPU] Fix bug introduced in 47a5c36b37f0
dfukalov [Wed, 6 Nov 2019 19:05:58 +0000 (22:05 +0300)]
[AMDGPU] Fix bug introduced in 47a5c36b37f0

Summary: [AMDGPU] Fix bug introduced in 47a5c36b37f0

Reviewers: foad, arsenm

Reviewed By: arsenm

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69915

4 years ago[Syntax] Silence "unused function" warning in no-assert builds. NFC
Ilya Biryukov [Thu, 7 Nov 2019 08:37:25 +0000 (09:37 +0100)]
[Syntax] Silence "unused function" warning in no-assert builds. NFC

A helper `isImpicitExpr` is only used inside assert.

4 years ago[llvm-readobj] - Simplify elf-hash-symbols.test. NFCI.
Georgii Rymar [Wed, 6 Nov 2019 09:11:44 +0000 (12:11 +0300)]
[llvm-readobj] - Simplify elf-hash-symbols.test. NFCI.

It converts binary contents of .hash and .gnu.hash that were generated by a linker
to YAML descriptions.
I've also dropped Shift2 and BloomFilter values because they are not needed here.

Differential revision: https://reviews.llvm.org/D69881

4 years ago[X86] Remove unused variable. NFC
Craig Topper [Thu, 7 Nov 2019 06:53:48 +0000 (22:53 -0800)]
[X86] Remove unused variable. NFC

4 years ago[X86] Remove dead code from combineStore.
Craig Topper [Thu, 7 Nov 2019 06:24:05 +0000 (22:24 -0800)]
[X86] Remove dead code from combineStore.

Leftovers from before we switched to widening legalization.

Fixes PR43919.

4 years ago[Clang] Add ENABLE_LINKER_BUILD_ID to Hurd driver.
kristina [Thu, 7 Nov 2019 05:38:24 +0000 (05:38 +0000)]
[Clang] Add ENABLE_LINKER_BUILD_ID to Hurd driver.

This was added for Linux toolchains in rC271692, this
patch extends this to the Hurd toolchain.

Patch by sthibaul (Samuel Thibault)

Differential Revision: https://reviews.llvm.org/D69754

4 years agoTemporarily Revert "[LV] Apply sink-after & interleave-groups as VPlan transformation...
Eric Christopher [Thu, 7 Nov 2019 05:58:28 +0000 (21:58 -0800)]
Temporarily Revert "[LV] Apply sink-after & interleave-groups as VPlan transformations (NFC)"
as it's causing assert failures.

This reverts commit 100e797adb433724a17c9b42b6533cd634cb796b.

4 years ago[OPENMP] [DOCS] fix section formatting issues [NFC]
Kelvin Li [Wed, 6 Nov 2019 18:25:16 +0000 (13:25 -0500)]
[OPENMP] [DOCS] fix section formatting issues [NFC]

Differential Revision: https://reviews.llvm.org/D69909