platform/upstream/llvm.git
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

4 years agoKeep import function list for inlinee profile update
Wenlei He [Fri, 1 Nov 2019 19:57:23 +0000 (12:57 -0700)]
Keep import function list for inlinee profile update

Summary:
When adjusting function entry counts after inlining, Funciton::setEntryCount is called without providing an import function list. The side effect of that is the previously set import function list will be dropped. The import function list is used by ThinLTO to help import hot cross module callee for LTO inlining, so dropping that during ThinLTO pre-link may adversely affect LTO inlining. The fix is to keep the list while updating entry counts for inlining.

Reviewers: wmi, davidxl, tejohnson

Subscribers: mehdi_amini, hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[AArch64][SVE] Add remaining patterns and intrinsics for add/sub/mad patterns
Danilo Carvalho Grael [Wed, 6 Nov 2019 22:02:58 +0000 (17:02 -0500)]
[AArch64][SVE] Add remaining patterns and intrinsics for add/sub/mad patterns

Add pattern matching and intrinsics for the following instructions:

predicated orr, eor, and, bic
predicated mul, smulh, umulh, sdiv, udiv, sdivr, udivr
predicated smax, umax, smin, umin, sabd, uabd
mad, msb, mla, mls

https://reviews.llvm.org/D69588

4 years agoRevert "gn build: (manually) merge b5913e6d2f"
Nico Weber [Thu, 7 Nov 2019 01:52:29 +0000 (20:52 -0500)]
Revert "gn build: (manually) merge b5913e6d2f"

This reverts commit c52efdc52cef2597a1d21595a9685e2f798025b8,
because b5913e6d2f got reverted.

4 years agoRevert "Introduce llvm-install-name-tool"
Alexander Shaposhnikov [Thu, 7 Nov 2019 01:04:04 +0000 (17:04 -0800)]
Revert "Introduce llvm-install-name-tool"

This reverts commit b5913e6d2f6d13fb753df701619731ca11936316.

4 years agoAMDGPU: Select global atomicrmw fadd
Matt Arsenault [Thu, 29 Aug 2019 18:53:17 +0000 (14:53 -0400)]
AMDGPU: Select global atomicrmw fadd

This only works if there is no use of the return value.

4 years agoTableGen: Remove assert that pattern results match input number
Matt Arsenault [Thu, 29 Aug 2019 19:10:12 +0000 (15:10 -0400)]
TableGen: Remove assert that pattern results match input number

AMDGPU has some atomic instructions that do not return the previous
result, and can only be selected if there are no uses. The source
pattern will only match if the use is empty, so it should be safe to
discard the result.

4 years agoTemporarily Revert:
Eric Christopher [Wed, 6 Nov 2019 23:56:41 +0000 (15:56 -0800)]
Temporarily Revert:

 "[SLP] Generalization of stores vectorization."
 "[SLP] Fix -Wunused-variable. NFC"
 "[SLP] Vectorize jumbled stores."

As they're causing significant (10-30x) compile time regressions on
vectorizable code.

The primary cause of the compile-time regression is f228b5371647f471853c5fb3e6719823a42fe451.

This reverts commits:

f228b5371647f471853c5fb3e6719823a42fe451
5503455ccb3f5fcedced158332c016c8d3a7fa81
21d498c9c0f32dcab5bc89ac593aa813b533b43a

4 years ago[LLDB] Adding caching to libc++ std::function formatter for lookups that require...
shafik [Wed, 6 Nov 2019 23:57:52 +0000 (15:57 -0800)]
[LLDB] Adding caching to libc++ std::function formatter for lookups that require scanning symbols

Performance issues lead to the libc++ std::function formatter to be disabled.
This change is the first of two changes that should address the performance issues and allow us to enable the formatter again.
In some cases we end up scanning the symbol table for the callable wrapped by std::function for those cases we will now cache the results and used the cache in subsequent look-ups. This still leaves a large cost for the initial lookup which will be addressed in the next change.

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

4 years ago[AMDGPU] Add handling of 160 bit registers in analyzeResourceUsage
Stanislav Mekhanoshin [Wed, 6 Nov 2019 20:39:38 +0000 (12:39 -0800)]
[AMDGPU] Add handling of 160 bit registers in analyzeResourceUsage

This was omitted. Also SReg_96Reg missed IsSGPR assignment.

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

4 years agounwind: restore the LINKER_LANGUAGE
Saleem Abdulrasool [Wed, 6 Nov 2019 23:40:07 +0000 (15:40 -0800)]
unwind: restore the LINKER_LANGUAGE

Have CMake treat the unwind libraries as C libraries rather than C++.
There is no C++ runtime dependency at runtime.  This ensures that we do
not accidentally end up with a link against the C++ runtime.

We need to explicitly reset the implicitly linked libraries for C++ to
ensure that we do not have CMake force the link against the C++ runtime.
This adjustment should enable the NetBSD bots to be happy with this
change.

4 years agounwind: reflow some of the build rules (NFC)
Saleem Abdulrasool [Wed, 6 Nov 2019 23:38:25 +0000 (15:38 -0800)]
unwind: reflow some of the build rules (NFC)

Reflow the CMake properties to take less vertical space.  This just
makes it easier to read.  NFC.

4 years ago[LoopPred] Enable new transformation by default
Philip Reames [Wed, 6 Nov 2019 23:30:47 +0000 (15:30 -0800)]
[LoopPred] Enable new transformation by default

The basic idea of the transform is to convert variant loop exit conditions into invariant exit conditions by changing the iteration on which the exit is taken when we know that the trip count is unobservable.  See the original patch which introduced the code for a more complete explanation.

The individual parts of this have been reviewed, the result has been fuzzed, and then further analyzed by hand, but despite all of that, I will not be suprised to see breakage here.  If you see problems, please don't hesitate to revert - though please do provide a test case.  The most likely class of issues are latent SCEV bugs and without a reduced test case, I'll be essentially stuck on reducing them.

(Note: A bunch of tests were opted out of the new transform to preserve coverage.  That landed in a previous commit to simplify revert cycles if they turn out to be needed.)

4 years ago[LoopPred] Selectively disable to preserve test cases
Philip Reames [Wed, 6 Nov 2019 23:16:43 +0000 (15:16 -0800)]
[LoopPred] Selectively disable to preserve test cases

I'm about to enable the new loop predication transform by default.  It has the effect of completely destroying many read only loops - which happen to be a super common idiom in our test cases.  So as to preserve test coverage of other transforms, disable the new transform where it would cause sharp test coverage regressions.

(This is semantically part of the enabling commit.  It's committed separate to ease revert if the actual flag flip gets reverted.)

4 years agogn build: (manually) merge b5913e6d2f
Nico Weber [Wed, 6 Nov 2019 23:26:36 +0000 (18:26 -0500)]
gn build: (manually) merge b5913e6d2f

4 years agoWhen lowering calls and tail calls in AArch64, the register mask and
Eric Christopher [Wed, 6 Nov 2019 23:16:19 +0000 (15:16 -0800)]
When lowering calls and tail calls in AArch64, the register mask and
return value location depends on the calling convention of the callee.
`F.getCallingConv()`, however, is the caller CC. Correct it to the
callee CC from `CallLoweringInfo`.

Fixes PR43449

Patch by Shu-Chun Weng!

4 years ago[lldb] Mark ASan & TSan as test dependencies
Jonas Devlieghere [Wed, 6 Nov 2019 23:22:17 +0000 (15:22 -0800)]
[lldb] Mark ASan & TSan as test dependencies

Without asan and tsan as test dependencies, you might end up with a
clang that points to sanitizer runtime library that hasn't been build
yet.

4 years ago[test] Fix apple_simulator_test decorator when simulators are unavailable
Alex Langford [Wed, 6 Nov 2019 23:12:31 +0000 (15:12 -0800)]
[test] Fix apple_simulator_test decorator when simulators are unavailable

In the case where xcodebuild fails as you set up simulator tests, you
would fail because `feature` is never defined.

4 years ago[lldb] Remove dead code from STLUtils.h
Jonas Devlieghere [Wed, 6 Nov 2019 22:44:39 +0000 (14:44 -0800)]
[lldb] Remove dead code from STLUtils.h

4 years ago[docs] Fix references to a renamed flag.
Lang Hames [Wed, 6 Nov 2019 22:37:04 +0000 (14:37 -0800)]
[docs] Fix references to a renamed flag.

The -use-mcjit option was replaced with -jit-kind=mcjit a while back. This patch
updates the docs to reflect that.

Patch by Yu Jian. Thanks Jian!

4 years ago[ConstantRange] Add `subWithNoWrap()` method
Roman Lebedev [Wed, 6 Nov 2019 22:21:29 +0000 (01:21 +0300)]
[ConstantRange] Add `subWithNoWrap()` method

Summary:
Much like D67339, adds ConstantRange handling for
when we know no-wrap behavior of the `sub`.

Unlike addWithNoWrap(), we only get lucky re returning empty set
for signed wrap. For unsigned, we must perform overflow check manually.

A patch that makes use of this in LVI (CVP) to be posted later.

Reviewers: nikic, shchenz, efriedma

Reviewed By: nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ConstantRange] Cleanup addWithNoWrap() by just piggybacking on sadd_sat()/uadd_sat()
Roman Lebedev [Wed, 6 Nov 2019 22:19:54 +0000 (01:19 +0300)]
[ConstantRange] Cleanup addWithNoWrap() by just piggybacking on sadd_sat()/uadd_sat()

As discussed in https://reviews.llvm.org/D69918
that happens to work as intended, and returns empty set if
there is always an overflow because we get lucky with intersection.
Since there's now an explicit test for that, let's prefer cleaner code.

4 years ago[ConstantRange] TestAddWithNo*WrapExhaustive: check that all overflow means empty set
Roman Lebedev [Wed, 6 Nov 2019 22:16:01 +0000 (01:16 +0300)]
[ConstantRange] TestAddWithNo*WrapExhaustive: check that all overflow means empty set

As disscussed in https://reviews.llvm.org/D69918 / https://reviews.llvm.org/D67339
that is an implied postcondition, but it's not really fully tested.

4 years ago[JITLink] Refactor EH-frame handling to support eh-frames with existing relocs.
Lang Hames [Tue, 5 Nov 2019 00:00:09 +0000 (16:00 -0800)]
[JITLink] Refactor EH-frame handling to support eh-frames with existing relocs.

Some targets (E.g. MachO/arm64) use relocations to fix some CFI record fields
in the eh-frame section. When relocations are used the initial (pre-relocation)
content of the eh-frame section can no longer be interpreted by following the
eh-frame specification. This causes errors in the existing eh-frame parser.

This patch moves eh-frame handling into two LinkGraph passes that are run after
relocations have been parsed (but before they are applied). The first] pass
breaks up blocks in the eh-frame section into per-CFI-record blocks, and the
second parses blocks of (potentially multiple) CFI records and adds the
appropriate edges to any CFI fields that do not have existing relocations.
These passes can be run independently of one another. By handling eh-frame
splitting/fixing with LinkGraph passes we can both re-use existing relocations
for CFI record fields and avoid applying eh-frame fixups before parsing the
section (which would complicate the linker and require extra temporary
allocations of working memory).

4 years agoTestuite: Support Asan test with remote testing
Fred Riss [Wed, 6 Nov 2019 21:53:14 +0000 (13:53 -0800)]
Testuite: Support Asan test with remote testing

To do so, we need to register the sanitizer libraries with the target
so that they get uploaded before running. This patch adds a helper to
the test class to this effect.

4 years ago[LLDB] Fix handling for the clang name mangling extension for block invocations
shafik [Wed, 6 Nov 2019 22:06:56 +0000 (14:06 -0800)]
[LLDB] Fix handling for the clang name mangling extension for block invocations

Add support for clangs  mangling extension for block invocations.

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

4 years ago[Orc] Fix iterator usage after remove
Alexandre Ganea [Wed, 6 Nov 2019 22:11:12 +0000 (17:11 -0500)]
[Orc] Fix iterator usage after remove

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

4 years ago[JumpThreading] Factor out code to clone instructions (NFC)
Kazu Hirata [Wed, 6 Nov 2019 22:16:48 +0000 (14:16 -0800)]
[JumpThreading] Factor out code to clone instructions (NFC)

Summary:
This patch factors out code to clone instructions -- partly for
readability and partly to facilitate an upcoming patch of my own.

Reviewers: wmi

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

4 years ago[WC] Fix a subtle bug in our definition of widenable branch
Philip Reames [Wed, 6 Nov 2019 22:05:59 +0000 (14:05 -0800)]
[WC] Fix a subtle bug in our definition of widenable branch

We had a subtle, but nasty bug in our definition of a widenable branch, and thus in the transforms which used that utility. Specifically, we returned true for any branch which included a widenable condition within it's condition, regardless of whether that widenable condition also had other uses.

The problem is that the result of the WC() call is defined to be one particular value. As such, all users must agree as to what that value is. If we widen a branch without also updating *all other users* of the WC in the same way, we have broken the required semantics.

Most of the textual diff is updating existing transforms not to leave dead uses hanging around. They're largely NFC as the dead instructions would be immediately deleted by other passes. The reason to make these changes is so that the transforms preserve the widenable branch form.

In practice, we don't get bitten by this only because it isn't profitable to CSE WC() calls and the lowering pass from guards uses distinct WC calls per branch.

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