platform/upstream/llvm.git
4 years agoFix build errors caused by rL373914.
Wei Mi [Mon, 7 Oct 2019 16:45:47 +0000 (16:45 +0000)]
Fix build errors caused by rL373914.

llvm-svn: 373919

4 years agoCodegen - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Mon, 7 Oct 2019 16:42:25 +0000 (16:42 +0000)]
Codegen - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 373918

4 years ago[llvm-profdata] Minor format fix
Wenlei He [Mon, 7 Oct 2019 16:30:31 +0000 (16:30 +0000)]
[llvm-profdata] Minor format fix

Summary: Minor format fix for output of "llvm-profdata -show"

Reviewers: wmi

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373917

4 years ago[libTooling] Add `toString` method to the Stencil class
Yitzhak Mandelbaum [Mon, 7 Oct 2019 16:20:22 +0000 (16:20 +0000)]
[libTooling] Add `toString` method to the Stencil class

Summary:
`toString` generates a string representation of the stencil.

Patch by Harshal T. Lehri.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373916

4 years ago[X86][SSE] getTargetShuffleInputs - move VT.isSimple/isVector checks inside. NFCI.
Simon Pilgrim [Mon, 7 Oct 2019 16:15:20 +0000 (16:15 +0000)]
[X86][SSE] getTargetShuffleInputs - move VT.isSimple/isVector checks inside. NFCI.

Stop all the callers from having to check the value type before calling getTargetShuffleInputs.

llvm-svn: 373915

4 years ago[SampleFDO] Add compression support for any section in ExtBinary profile format
Wei Mi [Mon, 7 Oct 2019 16:12:37 +0000 (16:12 +0000)]
[SampleFDO] Add compression support for any section in ExtBinary profile format

Previously ExtBinary profile format only supports compression using zlib for
profile symbol list. In this patch, we extend the compression support to any
section. User can select some or all of the sections to compress. In an
experiment, for a 45M profile in ExtBinary format, compressing name table
reduced its size to 24M, and compressing all the sections reduced its size
to 11M.

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

llvm-svn: 373914

4 years ago[LoopVectorize] add test that asserted after cost model change (PR43582); NFC
Sanjay Patel [Mon, 7 Oct 2019 14:48:27 +0000 (14:48 +0000)]
[LoopVectorize] add test that asserted after cost model change (PR43582); NFC

llvm-svn: 373913

4 years agoAllow update_test_checks.py to not scrub names.
David Greene [Mon, 7 Oct 2019 14:37:20 +0000 (14:37 +0000)]
Allow update_test_checks.py to not scrub names.

Add a --preserve-names option to tell the script not to replace IR names.
Sometimes tests want those names.  For example if a test is looking for a
modification to an existing instruction we'll want to make the names.

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

llvm-svn: 373912

4 years agoSema - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Mon, 7 Oct 2019 14:25:46 +0000 (14:25 +0000)]
Sema - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 373911

4 years ago[clang] Add test for FindNextToken in Lexer.
Utkarsh Saxena [Mon, 7 Oct 2019 14:20:46 +0000 (14:20 +0000)]
[clang] Add test for FindNextToken in Lexer.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373910

4 years agoFix another sphinx warning.
Kevin P. Neal [Mon, 7 Oct 2019 14:14:46 +0000 (14:14 +0000)]
Fix another sphinx warning.

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

llvm-svn: 373909

4 years agoRegenerate ptr-rotate.ll . NFC
Amaury Sechet [Mon, 7 Oct 2019 14:10:21 +0000 (14:10 +0000)]
Regenerate ptr-rotate.ll . NFC

llvm-svn: 373908

4 years ago[Mips] Always save RA when disabling frame pointer elimination
Simon Atanasyan [Mon, 7 Oct 2019 14:01:37 +0000 (14:01 +0000)]
[Mips] Always save RA when disabling frame pointer elimination

This ensures that frame-based unwinding will continue to work when
calling a noreturn function; there is not much use having the caller's
frame pointer saved if you don't also have the caller's program counter.

Patch by James Clarke.

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

llvm-svn: 373907

4 years ago[Mips] Fix evaluating J-format branch targets
Simon Atanasyan [Mon, 7 Oct 2019 14:01:22 +0000 (14:01 +0000)]
[Mips] Fix evaluating J-format branch targets

J/JAL/JALX/JALS are absolute branches, but stay within the current
256 MB-aligned region, so we must include the high bits of the
instruction address when calculating the branch target.

Patch by James Clarke.

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

llvm-svn: 373906

4 years agoRewriteModernObjC - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Mon, 7 Oct 2019 13:58:15 +0000 (13:58 +0000)]
RewriteModernObjC - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 373905

4 years agoAST - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Mon, 7 Oct 2019 13:58:05 +0000 (13:58 +0000)]
AST - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 373904

4 years ago[LLVM-C] Add bindings to create macro debug info
whitequark [Mon, 7 Oct 2019 13:57:13 +0000 (13:57 +0000)]
[LLVM-C] Add bindings to create macro debug info

Summary: The C API doesn't have the bindings to create macro debug information.

Reviewers: whitequark, CodaFi, deadalnix

Reviewed By: whitequark

Subscribers: aprantl, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373903

4 years agoFix sphinx warnings.
Kevin P. Neal [Mon, 7 Oct 2019 13:39:56 +0000 (13:39 +0000)]
Fix sphinx warnings.

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

llvm-svn: 373902

4 years agoTest commit
Mirko Brkusanin [Mon, 7 Oct 2019 13:23:12 +0000 (13:23 +0000)]
Test commit

Fix comment.

llvm-svn: 373901

4 years ago[FPEnv] Add constrained intrinsics for lrint and lround
Kevin P. Neal [Mon, 7 Oct 2019 13:20:00 +0000 (13:20 +0000)]
[FPEnv] Add constrained intrinsics for lrint and lround

Earlier in the year intrinsics for lrint, llrint, lround and llround were
added to llvm. The constrained versions are now implemented here.

Reviewed by: andrew.w.kaylor, craig.topper, cameron.mcinally
Approved by: craig.topper
Differential Revision: https://reviews.llvm.org/D64746

llvm-svn: 373900

4 years agogn build: use better triple on windows
Nico Weber [Mon, 7 Oct 2019 13:13:31 +0000 (13:13 +0000)]
gn build: use better triple on windows

The CMake build uses "x86_64-pc-windows-msvc". The "-msvc" suffix is
important because e.g. clang/test/lit.cfg.py matches against the
suffix "windows-msvc" to compute the presence of the "ms-sdk" and
the absence of the "LP64" feature.

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

llvm-svn: 373899

4 years agoRevert r373888 "[IA] Recognize hexadecimal escape sequences"
Nico Weber [Mon, 7 Oct 2019 11:46:26 +0000 (11:46 +0000)]
Revert r373888 "[IA] Recognize hexadecimal escape sequences"

It broke MC/AsmParser/directive_ascii.s on all bots:

    Assertion failed: (Index < Length && "Invalid index!"), function operator[],
        file ../../llvm/include/llvm/ADT/StringRef.h, line 243.

llvm-svn: 373898

4 years ago[clangd] Catch an unchecked "Expected<T>" in HeaderSourceSwitch.
Haojian Wu [Mon, 7 Oct 2019 11:37:25 +0000 (11:37 +0000)]
[clangd] Catch an unchecked "Expected<T>" in HeaderSourceSwitch.

Summary: Also fixes a potential user-after-scope issue of "Path".

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

llvm-svn: 373897

4 years ago[ASTImporter][NFC] Enable disabled but passing test
Gabor Marton [Mon, 7 Oct 2019 11:34:54 +0000 (11:34 +0000)]
[ASTImporter][NFC] Enable disabled but passing test

RedeclChainShouldBeCorrectAmongstNamespaces

llvm-svn: 373896

4 years ago[ASTImporter][NFC] Update ASTImporter internals docs
Gabor Marton [Mon, 7 Oct 2019 11:15:18 +0000 (11:15 +0000)]
[ASTImporter][NFC] Update ASTImporter internals docs

llvm-svn: 373895

4 years ago[ASTImporter][NFC] Fix typo in user docs
Gabor Marton [Mon, 7 Oct 2019 11:14:53 +0000 (11:14 +0000)]
[ASTImporter][NFC] Fix typo in user docs

llvm-svn: 373894

4 years ago[AMDGPU] Fix test checks
Jay Foad [Mon, 7 Oct 2019 10:57:41 +0000 (10:57 +0000)]
[AMDGPU] Fix test checks

The GFX10-DENORM-STRICT checks were only passing by accident. Fix them
to make the test more robust in the face of scheduling or register
allocation changes.

llvm-svn: 373893

4 years ago[clangd] If an undocumented definition exists, don't accept documentation from other...
Sam McCall [Mon, 7 Oct 2019 10:53:56 +0000 (10:53 +0000)]
[clangd] If an undocumented definition exists, don't accept documentation from other forward decls.

Summary:
This fixes cases like:
  foo.h
    class Undocumented{}
  bar.h
    // break an include cycle. we should refactor this!
    class Undocumented;
Where the comment doesn't describe the class.

Note that a forward decl that is *visible to the definition* will still have
its doc comment used, by SymbolCollector: Merge isn't involved here.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

llvm-svn: 373892

4 years ago[lldb][ELF] Read symbols from .gnu_debugdata sect.
Konrad Kleine [Mon, 7 Oct 2019 10:32:16 +0000 (10:32 +0000)]
[lldb][ELF] Read symbols from .gnu_debugdata sect.

Summary:
If the .symtab section is stripped from the binary it might be that
there's a .gnu_debugdata section which contains a smaller .symtab in
order to provide enough information to create a backtrace with function
names or to set and hit a breakpoint on a function name.

This change looks for a .gnu_debugdata section in the ELF object file.
The .gnu_debugdata section contains a xz-compressed ELF file with a
.symtab section inside. Symbols from that compressed .symtab section
are merged with the main object file's .dynsym symbols (if any).
In addition we always load the .dynsym even if there's a .symtab
section.

For example, the Fedora and RHEL operating systems strip their binaries
but keep a .gnu_debugdata section. While gdb already can read this
section, LLDB until this patch couldn't. To test this patch on a
Fedora or RHEL operating system, try to set a breakpoint on the "help"
symbol in the "zip" binary. Before this patch, only GDB can set this
breakpoint; now LLDB also can do so without installing extra debug
symbols:

    lldb /usr/bin/zip -b -o "b help" -o "r" -o "bt" -- -h

The above line runs LLDB in batch mode and on the "/usr/bin/zip -h"
target:

    (lldb) target create "/usr/bin/zip"
    Current executable set to '/usr/bin/zip' (x86_64).
    (lldb) settings set -- target.run-args  "-h"

Before the program starts, we set a breakpoint on the "help" symbol:

    (lldb) b help
    Breakpoint 1: where = zip`help, address = 0x00000000004093b0

Once the program is run and has hit the breakpoint we ask for a
backtrace:

    (lldb) r
    Process 10073 stopped
    * thread #1, name = 'zip', stop reason = breakpoint 1.1
        frame #0: 0x00000000004093b0 zip`help
    zip`help:
    ->  0x4093b0 <+0>:  pushq  %r12
        0x4093b2 <+2>:  movq   0x2af5f(%rip), %rsi       ;  + 4056
        0x4093b9 <+9>:  movl   $0x1, %edi
        0x4093be <+14>: xorl   %eax, %eax

    Process 10073 launched: '/usr/bin/zip' (x86_64)
    (lldb) bt
    * thread #1, name = 'zip', stop reason = breakpoint 1.1
      * frame #0: 0x00000000004093b0 zip`help
        frame #1: 0x0000000000403970 zip`main + 3248
        frame #2: 0x00007ffff7d8bf33 libc.so.6`__libc_start_main + 243
        frame #3: 0x0000000000408cee zip`_start + 46

In order to support the .gnu_debugdata section, one has to have LZMA
development headers installed. The CMake section, that controls this
part looks for the LZMA headers and enables .gnu_debugdata support by
default if they are found; otherwise or if explicitly requested, the
minidebuginfo support is disabled.

GDB supports the "mini debuginfo" section .gnu_debugdata since v7.6
(2013).

Reviewers: espindola, labath, jankratochvil, alexshap

Reviewed By: labath

Subscribers: rnkovacs, wuzish, shafik, emaste, mgorny, arichardson, hiraditya, MaskRay, lldb-commits

Tags: #lldb, #llvm

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

llvm-svn: 373891

4 years ago[llvm-readelf/llvm-objdump] - Improve/refactor the implementation of SHT_LLVM_ADDRSIG...
George Rimar [Mon, 7 Oct 2019 10:29:38 +0000 (10:29 +0000)]
[llvm-readelf/llvm-objdump] - Improve/refactor the implementation of SHT_LLVM_ADDRSIG section dumping.

This patch:

* Adds a llvm-readobj/llvm-readelf test file for SHT_LLVM_ADDRSIG sections. (we do not have any)
* Enables dumping of SHT_LLVM_ADDRSIG with --all.
* Changes the logic to report a warning instead of an error when something goes wrong during dumping
  (allows to continue dumping SHT_LLVM_ADDRSIG and other sections on error).
* Refactors a piece of logic to a new toULEB128Array helper which might be used for GNU-style
  dumping implementation.

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

llvm-svn: 373890

4 years ago[clangd] Collect missing macro references.
Haojian Wu [Mon, 7 Oct 2019 10:10:31 +0000 (10:10 +0000)]
[clangd] Collect missing macro references.

Summary: Semantic highlghting is missing a few macro references.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

llvm-svn: 373889

4 years ago[IA] Recognize hexadecimal escape sequences
Bill Wendling [Mon, 7 Oct 2019 09:54:53 +0000 (09:54 +0000)]
[IA] Recognize hexadecimal escape sequences

Summary:
Implement support for hexadecimal escape sequences to match how GNU 'as'
handles them. I.e., read all hexadecimal characters and truncate to the
lower 16 bits.

Reviewers: nickdesaulniers

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373888

4 years agoclang-cl: Ignore the new /ZH options
Hans Wennborg [Mon, 7 Oct 2019 09:30:15 +0000 (09:30 +0000)]
clang-cl: Ignore the new /ZH options

These were added to the MS docs in
https://github.com/MicrosoftDocs/cpp-docs/commit/85b9b6967e58e485251450f7451673f6fc873e88
and are supposedly available in VS 2019 16.4 (though my 2019 Preview,
version 16.4.0-pre.1.0 don't seem to have them.)

llvm-svn: 373887

4 years ago[ELF][MIPS] De-template writeValue. NFC
Fangrui Song [Mon, 7 Oct 2019 08:52:07 +0000 (08:52 +0000)]
[ELF][MIPS] De-template writeValue. NFC

Depends on D68561.

llvm-svn: 373886

4 years ago[ELF] Wrap things in `namespace lld { namespace elf {`, NFC
Fangrui Song [Mon, 7 Oct 2019 08:31:18 +0000 (08:31 +0000)]
[ELF] Wrap things in `namespace lld { namespace elf {`, NFC

This makes it clear `ELF/**/*.cpp` files define things in the `lld::elf`
namespace and simplifies `elf::foo` to `foo`.

Reviewed By: atanasyan, grimar, ruiu

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

llvm-svn: 373885

4 years ago[ELF][MIPS] Use lld::elf::{read,write}* instead of llvm::support::endian::{read,write}*
Fangrui Song [Mon, 7 Oct 2019 08:30:46 +0000 (08:30 +0000)]
[ELF][MIPS] Use lld::elf::{read,write}* instead of llvm::support::endian::{read,write}*

This allows us to delete `using namespace llvm::support::endian` and
simplify D68323. This change adds runtime config->endianness check but
the overhead should be negligible.

Reviewed By: ruiu

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

llvm-svn: 373884

4 years ago[TableGen] Pacify gcc-5.4 more
James Molloy [Mon, 7 Oct 2019 08:23:20 +0000 (08:23 +0000)]
[TableGen] Pacify gcc-5.4 more

Followup to a previous pacification, this performs the same workaround
to the TableGen generated code for tuple automata.

llvm-svn: 373883

4 years agoRevert "[SLP] avoid reduction transform on patterns that the backend can load-combine"
Martin Storsjo [Mon, 7 Oct 2019 08:21:37 +0000 (08:21 +0000)]
Revert "[SLP] avoid reduction transform on patterns that the backend can load-combine"

This reverts SVN r373833, as it caused a failed assert "Non-zero loop
cost expected" on building numerous projects, see PR43582 for details
and reproduction samples.

llvm-svn: 373882

4 years ago[llvm-locstats] Fix a typo in the documentation; NFC
Djordje Todorovic [Mon, 7 Oct 2019 07:31:49 +0000 (07:31 +0000)]
[llvm-locstats] Fix a typo in the documentation; NFC

llvm-svn: 373880

4 years ago[X86] Autogenerate checks in leaFixup32.mir and leaFixup64.mir. NFC
Craig Topper [Mon, 7 Oct 2019 06:50:56 +0000 (06:50 +0000)]
[X86] Autogenerate checks in leaFixup32.mir and leaFixup64.mir. NFC

llvm-svn: 373878

4 years ago[X86] Support LEA64_32r in processInstrForSlow3OpLEA and use INC/DEC when possible.
Craig Topper [Mon, 7 Oct 2019 06:27:55 +0000 (06:27 +0000)]
[X86] Support LEA64_32r in processInstrForSlow3OpLEA and use INC/DEC when possible.

Move the erasing and iterator updating inside to match the
other slow LEA function.

I've adapted code from optTwoAddrLEA and basically rebuilt the
implementation here. We do lose the kill flags now just like
optTwoAddrLEA. This runs late enough in the pipeline that
shouldn't really be a problem.

llvm-svn: 373877

4 years ago[NFC][CGP] Tests for making ICMP_EQ use CR result of ICMP_S(L|G)T dominators
Yi-Hong Lyu [Mon, 7 Oct 2019 05:29:11 +0000 (05:29 +0000)]
[NFC][CGP] Tests for making ICMP_EQ use CR result of ICMP_S(L|G)T dominators

llvm-svn: 373876

4 years ago[c++20] Check for a class-specific operator delete when deleting an
Richard Smith [Mon, 7 Oct 2019 03:14:28 +0000 (03:14 +0000)]
[c++20] Check for a class-specific operator delete when deleting an
object of class type with a virtual destructor.

llvm-svn: 373875

4 years agoFix behavior of __builtin_bit_cast when the From and To types are the
Richard Smith [Mon, 7 Oct 2019 02:45:12 +0000 (02:45 +0000)]
Fix behavior of __builtin_bit_cast when the From and To types are the
same.

We were missing the lvalue-to-rvalue conversion entirely in this case,
and in fact still need the full CK_LValueToRValueBitCast conversion to
perform a load with no TBAA.

llvm-svn: 373874

4 years agogn build: no-op style tweak in sync script
Nico Weber [Mon, 7 Oct 2019 00:37:10 +0000 (00:37 +0000)]
gn build: no-op style tweak in sync script

llvm-svn: 373873

4 years ago[Docs] Removes Subsystem Documentation page
DeForest Richards [Sun, 6 Oct 2019 22:49:22 +0000 (22:49 +0000)]
[Docs] Removes Subsystem Documentation page

Removes Subsystem Documentation page. Also moves existing topics on Subsystem Documentation page to User Guides and Reference pages.

llvm-svn: 373872

4 years ago[X86][AVX] Access a scalar float/double as a free extract from a broadcast load ...
Simon Pilgrim [Sun, 6 Oct 2019 21:11:45 +0000 (21:11 +0000)]
[X86][AVX] Access a scalar float/double as a free extract from a broadcast load (PR43217)

If a fp scalar is loaded and then used as both a scalar and a vector broadcast, perform the load as a broadcast and then extract the scalar for 'free' from the 0th element.

This involved switching the order of the X86ISD::BROADCAST combines so we only convert to X86ISD::BROADCAST_LOAD once all other canonicalizations have been attempted.

Adds a DAGCombinerInfo::recursivelyDeleteUnusedNodes wrapper.

Fixes PR43217

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

llvm-svn: 373871

4 years agoFix signed/unsigned warning. NFCI
Simon Pilgrim [Sun, 6 Oct 2019 19:54:20 +0000 (19:54 +0000)]
Fix signed/unsigned warning. NFCI

llvm-svn: 373870

4 years ago[NFC][PowerPC] Reorganize CRNotPat multiclass patterns in PPCInstrInfo.td
Amy Kwan [Sun, 6 Oct 2019 19:45:53 +0000 (19:45 +0000)]
[NFC][PowerPC] Reorganize CRNotPat multiclass patterns in PPCInstrInfo.td

This is patch aims to group together the `CRNotPat` multi class instantiations
within the `PPCInstrInfo.td` file.

Integer instantiations of the multi class are grouped together into a section,
and the floating point patterns are separated into its own section.

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

llvm-svn: 373869

4 years ago[X86][SSE] Remove resolveTargetShuffleInputs and use getTargetShuffleInputs directly.
Simon Pilgrim [Sun, 6 Oct 2019 19:07:00 +0000 (19:07 +0000)]
[X86][SSE] Remove resolveTargetShuffleInputs and use getTargetShuffleInputs directly.

Move the resolveTargetShuffleInputsAndMask call to after the shuffle mask combine before the undef/zero constant fold instead.

llvm-svn: 373868

4 years ago[X86][SSE] Don't merge known undef/zero elements into target shuffle masks.
Simon Pilgrim [Sun, 6 Oct 2019 19:06:45 +0000 (19:06 +0000)]
[X86][SSE] Don't merge known undef/zero elements into target shuffle masks.

Replaces setTargetShuffleZeroElements with getTargetShuffleAndZeroables which reports the Zeroable elements but doesn't merge them into the decoded target shuffle mask (the merging has been moved up into getTargetShuffleInputs until we can get rid of it entirely).

This is part of the work to fix PR43024 and allow us to use SimplifyDemandedElts to simplify shuffle chains - we need to get to a point where the target shuffle mask isn't adjusted by its source inputs but instead we cache them in a parallel Zeroable mask.

llvm-svn: 373867

4 years agoImplements CWG 1601 in [over.ics.rank/4.2]
Richard Smith [Sun, 6 Oct 2019 18:50:40 +0000 (18:50 +0000)]
Implements CWG 1601 in [over.ics.rank/4.2]

Summary:
The overload resolution for enums with a fixed underlying type has changed in the C++14 standard. This patch implements the new rule.

Patch by Mark de Wever!

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373866

4 years ago[X86] Add custom type legalization for v16i64->v16i8 truncate and v8i64->v8i8 truncat...
Craig Topper [Sun, 6 Oct 2019 18:43:08 +0000 (18:43 +0000)]
[X86] Add custom type legalization for v16i64->v16i8 truncate and v8i64->v8i8 truncate when v8i64 isn't legal

Summary:
The default legalization for v16i64->v16i8 tries to create a multiple stage truncate concatenating after each stage and truncating again. But avx512 implements truncates with multiple uops. So it should be better to truncate all the way to the desired element size and then concatenate the pieces using unpckl instructions. This minimizes the number of 2 uop truncates. The unpcks are all single uop instructions.

I tried to handle this by just custom splitting the v16i64->v16i8 shuffle. And hoped that the DAG combiner would leave the two halves in the state needed to make D68374 do the job for each half. This worked for the first half, but the second half got messed up. So I've implemented custom handling for v8i64->v8i8 when v8i64 needs to be split to produce the VTRUNCs directly.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373864

4 years ago[LegalizeTypes][X86] When splitting a vselect for type legalization, don't split...
Craig Topper [Sun, 6 Oct 2019 18:43:03 +0000 (18:43 +0000)]
[LegalizeTypes][X86] When splitting a vselect for type legalization, don't split a setcc condition if the setcc input is legal and vXi1 conditions are supported

Summary: The VSELECT splitting code tries to split a setcc input as well. But on avx512 where mask registers are well supported it should be better to just split the mask and use a single compare.

Reviewers: RKSimon, spatel, efriedma

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373863

4 years ago[Sema] Avoids an assertion failure when an invalid conversion declaration is used
Richard Smith [Sun, 6 Oct 2019 18:40:59 +0000 (18:40 +0000)]
[Sema] Avoids an assertion failure when an invalid conversion declaration is used

Summary:
When using a user-defined conversion function template with a deduced return type the compiler gives a set of warnings:
```
bug.cc:252:44: error: cannot specify any part of a return type in the declaration of a conversion function; use an alias template to declare a conversion to 'auto (Ts &&...) const'
  template <typename... Ts> operator auto()(Ts &&... xs) const;
                                           ^~~~~~~~~~~~~~~~~~~
bug.cc:252:29: error: conversion function cannot convert to a function type
  template <typename... Ts> operator auto()(Ts &&... xs) const;
                            ^
error: pointer to function type cannot have 'const' qualifier
```
after which it triggers an assertion failure. It seems the last error is incorrect and doesn't have any location information. This patch stops the compilation after the second warning.

Fixes bug 31422.

Patch by Mark de Wever!

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: bbannier, cfe-commits

Tags: #clang

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

llvm-svn: 373862

4 years agogn build: make windows build less broken
Nico Weber [Sun, 6 Oct 2019 18:11:53 +0000 (18:11 +0000)]
gn build: make windows build less broken

llvm-svn: 373858

4 years ago[LOOPGUARD] Remove asserts in getLoopGuardBranch
Whitney Tsang [Sun, 6 Oct 2019 16:39:43 +0000 (16:39 +0000)]
[LOOPGUARD] Remove asserts in getLoopGuardBranch
Summary: The assertion in getLoopGuardBranch can be a 'return nullptr'
under if condition.
Authored By: DTharun
Reviewer: Whitney, fhahn
Reviewed By: Whitney, fhahn
Subscribers: fhahn, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D66084

llvm-svn: 373857

4 years ago[Docs] Removes Programming Documentation page
DeForest Richards [Sun, 6 Oct 2019 16:10:11 +0000 (16:10 +0000)]
[Docs] Removes Programming Documentation page

Removes Programming Documentation page. Also moves existing topics on Programming Documentation page to User Guides and Reference pages.

llvm-svn: 373856

4 years ago[X86][SSE] resolveTargetShuffleInputs - call getTargetShuffleInputs instead of using...
Simon Pilgrim [Sun, 6 Oct 2019 15:42:25 +0000 (15:42 +0000)]
[X86][SSE] resolveTargetShuffleInputs - call getTargetShuffleInputs instead of using setTargetShuffleZeroElements directly. NFCI.

llvm-svn: 373855

4 years ago[Docs] Adds new Getting Started/Tutorials page
DeForest Richards [Sun, 6 Oct 2019 15:36:37 +0000 (15:36 +0000)]
[Docs] Adds new Getting Started/Tutorials page

Adds a new page for Getting Started/Tutorials topics. Also updates existing topic categories on the User Guides and Reference pages.

llvm-svn: 373854

4 years agoRevert [DAGCombine] Match more patterns for half word bswap
Sanjay Patel [Sun, 6 Oct 2019 15:27:34 +0000 (15:27 +0000)]
Revert [DAGCombine] Match more patterns for half word bswap

This reverts r373850 (git commit 25ba49824d2d4f2347b4a7cb1623600a76ce9433)

This patch appears to cause multiple codegen regression test failures - http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/10680

llvm-svn: 373853

4 years ago[NFC] Replace 'isDarwin' with 'IsDarwin'
Xiangling Liao [Sun, 6 Oct 2019 14:44:22 +0000 (14:44 +0000)]
[NFC] Replace 'isDarwin' with 'IsDarwin'

Summary: Replace 'isDarwin' with 'IsDarwin' based on LLVM naming convention.

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

llvm-svn: 373852

4 years ago[InstCombine] fold fneg disguised as select+fmul (PR43497)
Sanjay Patel [Sun, 6 Oct 2019 14:15:48 +0000 (14:15 +0000)]
[InstCombine] fold fneg disguised as select+fmul (PR43497)

Extends rL373230 and solves the motivating bug (although in a narrow way):
https://bugs.llvm.org/show_bug.cgi?id=43497

llvm-svn: 373851

4 years ago[DAGCombine] Match more patterns for half word bswap
Amaury Sechet [Sun, 6 Oct 2019 14:14:55 +0000 (14:14 +0000)]
[DAGCombine] Match more patterns for half word bswap

Summary: It ensures that the bswap is generated even when a part of the subtree already matches a bswap transform.

Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 373850

4 years ago[X86][AVX] combineExtractSubvector - merge duplicate variables. NFCI.
Simon Pilgrim [Sun, 6 Oct 2019 13:25:10 +0000 (13:25 +0000)]
[X86][AVX] combineExtractSubvector - merge duplicate variables. NFCI.

llvm-svn: 373849

4 years ago[InstCombine] add fast-math-flags for better test coverage; NFC
Sanjay Patel [Sun, 6 Oct 2019 13:19:05 +0000 (13:19 +0000)]
[InstCombine] add fast-math-flags for better test coverage; NFC

llvm-svn: 373848

4 years ago[InstCombine] don't assume 'inbounds' for bitcast pointer to GEP transform (PR43501)
Sanjay Patel [Sun, 6 Oct 2019 13:08:08 +0000 (13:08 +0000)]
[InstCombine] don't assume 'inbounds' for bitcast pointer to GEP transform (PR43501)

https://bugs.llvm.org/show_bug.cgi?id=43501
We can't declare a GEP 'inbounds' in general. But we may salvage that information if
we have known dereferenceable bytes on the source pointer.

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

llvm-svn: 373847

4 years ago[X86][SSE] matchVectorShuffleAsBlend - use Zeroable element mask directly.
Simon Pilgrim [Sun, 6 Oct 2019 12:38:38 +0000 (12:38 +0000)]
[X86][SSE] matchVectorShuffleAsBlend - use Zeroable element mask directly.

We can make use of the Zeroable mask to indicate which elements we can safely set to zero instead of creating a target shuffle mask on the fly.

This allows us to remove createTargetShuffleMask.

This is part of the work to fix PR43024 and allow us to use SimplifyDemandedElts to simplify shuffle chains - we need to get to a point where the target shuffle masks isn't adjusted by its source inputs in setTargetShuffleZeroElements but instead we cache them in a parallel Zeroable mask.

llvm-svn: 373846

4 years ago[X86] Enable AVX512BW for memcmp()
David Zarzycki [Sun, 6 Oct 2019 10:25:52 +0000 (10:25 +0000)]
[X86] Enable AVX512BW for memcmp()

llvm-svn: 373845

4 years ago[clang-format][docs] Fix the Google C++ and Chromium style guide URLs
Paul Hoad [Sun, 6 Oct 2019 09:37:58 +0000 (09:37 +0000)]
[clang-format][docs] Fix the Google C++ and Chromium style guide URLs

Summary: The Google C++ and Chromium style guides are broken in the clang-format docs. This patch updates them.

Reviewers: djasper, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang

Patch by: m4tx

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

llvm-svn: 373844

4 years agoAMDGPU/GlobalISel: Fall back on weird G_EXTRACT offsets
Matt Arsenault [Sun, 6 Oct 2019 01:41:22 +0000 (01:41 +0000)]
AMDGPU/GlobalISel: Fall back on weird G_EXTRACT offsets

llvm-svn: 373842

4 years agoAMDGPU/GlobalISel: RegBankSelect mul24 intrinsics
Matt Arsenault [Sun, 6 Oct 2019 01:37:39 +0000 (01:37 +0000)]
AMDGPU/GlobalISel: RegBankSelect mul24 intrinsics

llvm-svn: 373841

4 years agoAMDGPU/GlobalISel: RegBankSelect DS GWS intrinsics
Matt Arsenault [Sun, 6 Oct 2019 01:37:38 +0000 (01:37 +0000)]
AMDGPU/GlobalISel: RegBankSelect DS GWS intrinsics

llvm-svn: 373840

4 years agoAMDGPU/GlobalISel: Lower G_ATOMIC_CMPXCHG_WITH_SUCCESS
Matt Arsenault [Sun, 6 Oct 2019 01:37:37 +0000 (01:37 +0000)]
AMDGPU/GlobalISel: Lower G_ATOMIC_CMPXCHG_WITH_SUCCESS

llvm-svn: 373839

4 years agoGlobalISel: Partially implement lower for G_EXTRACT
Matt Arsenault [Sun, 6 Oct 2019 01:37:35 +0000 (01:37 +0000)]
GlobalISel: Partially implement lower for G_EXTRACT

Turn into shift and truncate. Doesn't yet handle pointers.

llvm-svn: 373838

4 years agoAMDGPU/GlobalISel: Fix RegBankSelect for sendmsg intrinsics
Matt Arsenault [Sun, 6 Oct 2019 01:37:34 +0000 (01:37 +0000)]
AMDGPU/GlobalISel: Fix RegBankSelect for sendmsg intrinsics

This wasn't updated for the immarg handling change.

llvm-svn: 373837

4 years ago[FastISel] Copy the inline assembly dialect to the INLINEASM instruction.
Craig Topper [Sat, 5 Oct 2019 23:21:17 +0000 (23:21 +0000)]
[FastISel] Copy the inline assembly dialect to the INLINEASM instruction.

Fixes PR43575.

llvm-svn: 373836

4 years ago[X86][AVX] Push sign extensions of comparison bool results through bitops (PR42025)
Simon Pilgrim [Sat, 5 Oct 2019 20:49:34 +0000 (20:49 +0000)]
[X86][AVX] Push sign extensions of comparison bool results through bitops (PR42025)

As discussed on PR42025, with more complex boolean math we can end up with many truncations/extensions of the comparison results through each bitop.

This patch handles the cases introduced in combineBitcastvxi1 by pushing the sign extension through the AND/OR/XOR ops so its just the original SETCC ops that gets extended.

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

llvm-svn: 373834

4 years ago[SLP] avoid reduction transform on patterns that the backend can load-combine
Sanjay Patel [Sat, 5 Oct 2019 18:03:58 +0000 (18:03 +0000)]
[SLP] avoid reduction transform on patterns that the backend can load-combine

I don't see an ideal solution to these 2 related, potentially large, perf regressions:
https://bugs.llvm.org/show_bug.cgi?id=42708
https://bugs.llvm.org/show_bug.cgi?id=43146

We decided that load combining was unsuitable for IR because it could obscure other
optimizations in IR. So we removed the LoadCombiner pass and deferred to the backend.
Therefore, preventing SLP from destroying load combine opportunities requires that it
recognizes patterns that could be combined later, but not do the optimization itself (
it's not a vector combine anyway, so it's probably out-of-scope for SLP).

Here, we add a scalar cost model adjustment with a conservative pattern match and cost
summation for a multi-instruction sequence that can probably be reduced later.
This should prevent SLP from creating a vector reduction unless that sequence is
extremely cheap.

In the x86 tests shown (and discussed in more detail in the bug reports), SDAG combining
will produce a single instruction on these tests like:

  movbe   rax, qword ptr [rdi]

or:

  mov     rax, qword ptr [rdi]

Not some (half) vector monstrosity as we currently do using SLP:

  vpmovzxbq       ymm0, dword ptr [rdi + 1] # ymm0 = mem[0],zero,zero,..
  vpsllvq ymm0, ymm0, ymmword ptr [rip + .LCPI0_0]
  movzx   eax, byte ptr [rdi]
  movzx   ecx, byte ptr [rdi + 5]
  shl     rcx, 40
  movzx   edx, byte ptr [rdi + 6]
  shl     rdx, 48
  or      rdx, rcx
  movzx   ecx, byte ptr [rdi + 7]
  shl     rcx, 56
  or      rcx, rdx
  or      rcx, rax
  vextracti128    xmm1, ymm0, 1
  vpor    xmm0, xmm0, xmm1
  vpshufd xmm1, xmm0, 78          # xmm1 = xmm0[2,3,0,1]
  vpor    xmm0, xmm0, xmm1
  vmovq   rax, xmm0
  or      rax, rcx
  vzeroupper
  ret

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

llvm-svn: 373833

4 years ago[X86] lowerShuffleAsLanePermuteAndRepeatedMask - variable renames. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 16:08:30 +0000 (16:08 +0000)]
[X86] lowerShuffleAsLanePermuteAndRepeatedMask - variable renames. NFCI.

Rename some variables to match lowerShuffleAsRepeatedMaskAndLanePermute - prep work toward adding some equivalent sublane functionality.

llvm-svn: 373832

4 years agoTry to fix sphinx indentation error
Simon Pilgrim [Sat, 5 Oct 2019 16:08:17 +0000 (16:08 +0000)]
Try to fix sphinx indentation error

llvm-svn: 373831

4 years ago[SelectionDAG] Add tests for LKK algorithm
David Bolvansky [Sat, 5 Oct 2019 14:29:25 +0000 (14:29 +0000)]
[SelectionDAG] Add tests for LKK algorithm

Added some tests testing urem and srem operations with a constant divisor.

Patch by TG908 (Tim Gymnich)

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

llvm-svn: 373830

4 years agoRewriteObjC - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:42:14 +0000 (13:42 +0000)]
RewriteObjC - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 373829

4 years ago[Diagnostics] Highlight expr's source range for -Wbool-operation
David Bolvansky [Sat, 5 Oct 2019 13:28:15 +0000 (13:28 +0000)]
[Diagnostics] Highlight expr's source range for -Wbool-operation

Warning message looks better; and GCC adds it too.

llvm-svn: 373828

4 years agoSemaTemplate - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:21:08 +0000 (13:21 +0000)]
SemaTemplate - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 373827

4 years agoTreeTransform - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:20:59 +0000 (13:20 +0000)]
TreeTransform - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 373826

4 years agoRemove redundant !HasDependentValue check. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:20:51 +0000 (13:20 +0000)]
Remove redundant !HasDependentValue check. NFCI.

Fixes cppcheck warning.

llvm-svn: 373825

4 years agoSemaStmt - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:20:42 +0000 (13:20 +0000)]
SemaStmt - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 373824

4 years agoBranchFolding - IsBetterFallthrough - assert non-null pointers. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:20:30 +0000 (13:20 +0000)]
BranchFolding - IsBetterFallthrough - assert non-null pointers. NFCI.

Silences static analyzer null dereference warnings.

llvm-svn: 373823

4 years ago[clang-format] SpacesInSquareBrackets should affect lambdas with parameters too
Paul Hoad [Sat, 5 Oct 2019 09:55:23 +0000 (09:55 +0000)]
[clang-format] SpacesInSquareBrackets should affect lambdas with parameters too

Summary:
This patch makes the `SpacesInSquareBrackets` setting also apply to C++ lambdas with parameters.

Looking through the revision history, it appears support for only array brackets was added, and lambda brackets were ignored. Therefore, I am inclined to think it was simply an omission, rather than a deliberate choice.

See https://bugs.llvm.org/show_bug.cgi?id=17887 and https://reviews.llvm.org/D4944.

Reviewers: MyDeveloperDay, reuk, owenpan

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Patch by: mitchell-stellar

Tags: #clang-format, #clang

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

llvm-svn: 373821

4 years ago[UnitTests] Try and pacify gcc-5
James Molloy [Sat, 5 Oct 2019 08:57:17 +0000 (08:57 +0000)]
[UnitTests] Try and pacify gcc-5

This looks like a defect in gcc-5 where it chooses a constexpr
constructor from the initializer-list that it considers to be explicit.

I've tried to reproduce but I can't install anything prior to gcc-6 easily
on my system, and that doesn't have the error. So this is speculative
pacification.

Reported by Steven Wan.

llvm-svn: 373820

4 years agoDo not install lit-cpuid
Sylvestre Ledru [Sat, 5 Oct 2019 08:22:40 +0000 (08:22 +0000)]
Do not install lit-cpuid

Summary:
AFAIK, lit-cpuid is used by the tests.
Installing it causes LLVMExports*.cmake files to depend
on this program.
It causes some serious packaging issues as it would means
that llvm-dev depends on lldb.

See:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=941082
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=941306

See also https://bugs.llvm.org/show_bug.cgi?id=43035
for a similar issue caused by
https://reviews.llvm.org/D56606

Reviewers: mgorny

Reviewed By: mgorny

Subscribers: delcypher, lldb-commits

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

llvm-svn: 373819

4 years ago[NFCI] Slightly improve warning message
David Bolvansky [Sat, 5 Oct 2019 08:09:06 +0000 (08:09 +0000)]
[NFCI] Slightly improve warning message

llvm-svn: 373818

4 years ago[Diagnostics] Use Expr::isKnownToHaveBooleanValue() to check bitwise negation of...
David Bolvansky [Sat, 5 Oct 2019 08:02:11 +0000 (08:02 +0000)]
[Diagnostics] Use Expr::isKnownToHaveBooleanValue() to check bitwise negation of bool in languages without a bool type

Thanks for this advice, Richard Trieu!

llvm-svn: 373817

4 years agoExpose ProvidePositionalOption as a public API
Mehdi Amini [Sat, 5 Oct 2019 01:37:04 +0000 (01:37 +0000)]
Expose ProvidePositionalOption as a public API

The motivation is to reuse the key value parsing logic here to
parse instance specific pass options within the context of MLIR.
The primary functionality exposed is the "," splitting for
arrays and the logic for properly handling duplicate definitions
of a single flag.

Patch by: Parker Schuh <parkers@google.com>

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

llvm-svn: 373815

4 years agoFix a *nasty* miscompile in experimental unordered atomic lowering
Philip Reames [Sat, 5 Oct 2019 00:32:10 +0000 (00:32 +0000)]
Fix a *nasty* miscompile in experimental unordered atomic lowering

This is an omission in rL371441.  Loads which happened to be unordered weren't being added to the PendingLoad set, and thus weren't be ordered w/respect to side effects which followed before the end of the block.

Included test case is how I spotted this.  We had an atomic load being folded into a using instruction after a fence that load was supposed to be ordered with.  I'm sure it showed up a bunch of other ways as well.

Spotted via manual inspecting of assembly differences in a corpus w/and w/o the new experimental mode.  Finding this with testing would have been "unpleasant".

llvm-svn: 373814

4 years ago[Test] Add a test case fo a missed oppurtunity in implicit null checking
Philip Reames [Fri, 4 Oct 2019 23:46:26 +0000 (23:46 +0000)]
[Test] Add a test case fo a missed oppurtunity in implicit null checking

llvm-svn: 373813

4 years ago[RISCV] Added missing ImmLeaf predicates
Ana Pazos [Fri, 4 Oct 2019 23:42:07 +0000 (23:42 +0000)]
[RISCV] Added missing ImmLeaf predicates

simm9_lsb0 and simm12_lsb0 operand types were missing predicates.

llvm-svn: 373812

4 years agoAdd a unittest to verify for assumption cache
Aditya Kumar [Fri, 4 Oct 2019 23:36:59 +0000 (23:36 +0000)]
Add a unittest to verify for assumption cache

Reviewers: vsk, tejohnson

Reviewed By: vsk

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

llvm-svn: 373811

4 years ago[MachO] Reduce indentation further in ParseSymtab (NFC)
Jonas Devlieghere [Fri, 4 Oct 2019 23:09:55 +0000 (23:09 +0000)]
[MachO] Reduce indentation further in ParseSymtab (NFC)

llvm-svn: 373810