platform/upstream/llvm.git
5 years ago[clangd] Added functionality for getting semantic highlights for variable and functio...
Johan Vikstrom [Wed, 26 Jun 2019 13:08:36 +0000 (13:08 +0000)]
[clangd] Added functionality for getting semantic highlights for variable and function declarations

llvm-svn: 364421

5 years ago[X86][Codegen] X86DAGToDAGISel::matchBitExtract(): consistently capture lambdas by...
Roman Lebedev [Wed, 26 Jun 2019 12:19:52 +0000 (12:19 +0000)]
[X86][Codegen] X86DAGToDAGISel::matchBitExtract(): consistently capture lambdas by value

llvm-svn: 364420

5 years ago[X86] X86DAGToDAGISel::matchBitExtract(): pattern c: truncation awareness
Roman Lebedev [Wed, 26 Jun 2019 12:19:47 +0000 (12:19 +0000)]
[X86] X86DAGToDAGISel::matchBitExtract(): pattern c: truncation awareness

Summary:
The one thing of note here is that the 'bitwidth' constant (32/64) was previously pessimistic.
Given `x & (-1 >> (C - z))`, we were taking `C` to be `bitwidth(x)`, but in reality
we want `(-1 >> (C - z))` pattern to mean "low z bits must be all-ones".
And for that, `C` should be `bitwidth(-1 >> (C - z))`, i.e. of the shift operation itself.

Last pattern D does not seem to exhibit any of these truncation issues.
Although it has the opposite problem - if we extract low bits (no shift) from i64,
and then truncate to i32, then we fail to shrink this 64-bit extraction into 32-bit extraction.

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 364419

5 years ago[X86] X86DAGToDAGISel::matchBitExtract(): pattern b: truncation awareness
Roman Lebedev [Wed, 26 Jun 2019 12:19:39 +0000 (12:19 +0000)]
[X86] X86DAGToDAGISel::matchBitExtract(): pattern b: truncation awareness

Summary:
(Not so) boringly identical to pattern a (D62786)
Not yet sure how do deal with the last pattern c.

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 364418

5 years ago[X86] X86DAGToDAGISel::matchBitExtract(): pattern a: truncation awareness
Roman Lebedev [Wed, 26 Jun 2019 12:19:11 +0000 (12:19 +0000)]
[X86] X86DAGToDAGISel::matchBitExtract(): pattern a: truncation awareness

Summary:
Finally tying up loose ends here.

The problem is quite simple:
If we have pattern `(x >> start) &  (1 << nbits) - 1`,
and then truncate the result, that truncation will be propagated upwards,
into the `and`. And that isn't currently handled.

I'm only fixing pattern `a` here,
the same fix will be needed for patterns `b`/`c` too.

I *think* this isn't missing any extra legality checks,
since we only look past truncations. Similary, i don't think
we can get any other truncation there other than i64->i32.

Reviewers: craig.topper, RKSimon, spatel

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 364417

5 years agoRevert "r364412 [ExpandMemCmp][MergeICmps] Move passes out of CodeGen into opt pipeline."
Clement Courbet [Wed, 26 Jun 2019 12:13:13 +0000 (12:13 +0000)]
Revert "r364412 [ExpandMemCmp][MergeICmps] Move passes out of CodeGen into opt pipeline."

Breaks sanitizers:
    libFuzzer :: cxxstring.test
    libFuzzer :: memcmp.test
    libFuzzer :: recommended-dictionary.test
    libFuzzer :: strcmp.test
    libFuzzer :: value-profile-mem.test
    libFuzzer :: value-profile-strcmp.test

llvm-svn: 364416

5 years ago[HardwareLoops] NFC - move loop with irreducible control flow checking logic to Harew...
Chen Zheng [Wed, 26 Jun 2019 12:02:43 +0000 (12:02 +0000)]
[HardwareLoops] NFC - move loop with irreducible control flow checking logic to HarewareLoopInfo.

llvm-svn: 364415

5 years agoFix the build after r364401
Hans Wennborg [Wed, 26 Jun 2019 11:56:38 +0000 (11:56 +0000)]
Fix the build after r364401

It was failing with:

/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/lib/Target/X86/X86ISelLowering.cpp:18772:66:
error: call of overloaded 'makeArrayRef(<brace-enclosed initializer list>)' is ambiguous
     scaleShuffleMask<int>(Scale, makeArrayRef<int>({ 0, 2, 1, 3 }), Mask);
                                                                  ^
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/lib/Target/X86/X86ISelLowering.cpp:18772:66: note: candidates are:
In file included from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/CodeGen/MachineFunction.h:20:0,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/CodeGen/CallingConvLower.h:19,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/lib/Target/X86/X86ISelLowering.h:17,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/lib/Target/X86/X86ISelLowering.cpp:14:
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/ArrayRef.h:480:15:
note: llvm::ArrayRef<T> llvm::makeArrayRef(const std::vector<_RealType>&) [with T = int]
   ArrayRef<T> makeArrayRef(const std::vector<T> &Vec) {
               ^
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/ArrayRef.h:485:37:
note: llvm::ArrayRef<T> llvm::makeArrayRef(const llvm::ArrayRef<T>&) [with T = int]
   template <typename T> ArrayRef<T> makeArrayRef(const ArrayRef<T> &Vec) {
                                     ^

llvm-svn: 364414

5 years ago[clangd] Disable failing unittest on non-x86 platforms
Kadir Cetinkaya [Wed, 26 Jun 2019 11:52:20 +0000 (11:52 +0000)]
[clangd] Disable failing unittest on non-x86 platforms

llvm-svn: 364413

5 years ago[ExpandMemCmp][MergeICmps] Move passes out of CodeGen into opt pipeline.
Clement Courbet [Wed, 26 Jun 2019 11:50:18 +0000 (11:50 +0000)]
[ExpandMemCmp][MergeICmps] Move passes out of CodeGen into opt pipeline.

This allows later passes (in particular InstCombine) to optimize more
cases.

One that's important to us is `memcmp(p, q, constant) < 0` and memcmp(p, q, constant) > 0.

llvm-svn: 364412

5 years agogn build: Merge r364387
Nico Weber [Wed, 26 Jun 2019 11:44:54 +0000 (11:44 +0000)]
gn build: Merge r364387

llvm-svn: 364411

5 years ago[docs][llvm-symbolizer] Improve llvm-symbolizer documentation
James Henderson [Wed, 26 Jun 2019 11:42:03 +0000 (11:42 +0000)]
[docs][llvm-symbolizer] Improve llvm-symbolizer documentation

As detailed in https://bugs.llvm.org/show_bug.cgi?id=42253, there were a
number of issues in the llvm-symbolizer documentation. This patch fixes
them by:

 1. Adding [addresses...] to the synopsis, and matching the formatting
    of other tools.
 2. Rewriting the description to fix grammar issues and mention other
    usage options.
 3. Rewriting the examples to be easier to read.
 4. Re-ordering the options into alphabetical order.
 5. Improving the text of some of the option descriptions, and adding
    some examples to individual options.
 6. Splitting the Mach-O options into a separate section of the
    document.
 7. Standardizing on double dashes for long options throughout the file.
 8. Adding a reference to the llvm-addr2line document.

Reviewed by: mtrent, ikudrin

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

llvm-svn: 364410

5 years agogn build: Merge r364386
Nico Weber [Wed, 26 Jun 2019 11:35:28 +0000 (11:35 +0000)]
gn build: Merge r364386

llvm-svn: 364409

5 years agogn build: Merge r364389
Nico Weber [Wed, 26 Jun 2019 11:33:56 +0000 (11:33 +0000)]
gn build: Merge r364389

llvm-svn: 364408

5 years ago[X86][AVX] combineExtractSubvector - 'little to big' extract_subvector(bitcast()...
Simon Pilgrim [Wed, 26 Jun 2019 11:21:09 +0000 (11:21 +0000)]
[X86][AVX] combineExtractSubvector - 'little to big' extract_subvector(bitcast()) support

Ideally this needs to be a generic combine in DAGCombiner::visitEXTRACT_SUBVECTOR but there's some nasty regressions in aarch64 due to neon shuffles not handling bitcasts at all.....

llvm-svn: 364407

5 years ago[IR/DIVar] Add the flag for params that have unmodified value
Djordje Todorovic [Wed, 26 Jun 2019 11:19:26 +0000 (11:19 +0000)]
[IR/DIVar] Add the flag for params that have unmodified value

Introduce the debug info flag that indicates that a parameter has unchanged
value throughout a function. This info will be used to emit the expressions
with DW_OP_entry_value.

([4/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>
Differential Revision: https://reviews.llvm.org/D58034

llvm-svn: 364406

5 years ago[DAGCombine] visitEXTRACT_SUBVECTOR - add TODO for extract_subvector(bitcast()) support
Simon Pilgrim [Wed, 26 Jun 2019 11:17:38 +0000 (11:17 +0000)]
[DAGCombine] visitEXTRACT_SUBVECTOR - add TODO for extract_subvector(bitcast()) support

We support 'big to little' (e.g. extract_subvector(v16i8 bitcast(v2i64))) but not 'little to big' cases  (e.g. extract_subvector(v2i64 bitcast(v16i8)))

llvm-svn: 364405

5 years ago[ARM] Handle fixup_arm_pcrel_9 correctly on big-endian targets
Mikhail Maltsev [Wed, 26 Jun 2019 10:48:40 +0000 (10:48 +0000)]
[ARM] Handle fixup_arm_pcrel_9 correctly on big-endian targets

Summary:
The getFixupKindContainerSizeBytes function returns the size of the
instruction containing a given fixup. Currently fixup_arm_pcrel_9 is
not handled in this function, this causes an assertion failure in
the debug build and incorrect codegen in the release build.

This patch fixes the problem.

Reviewers: ostannard, simon_tatham

Reviewed By: ostannard

Subscribers: javed.absar, kristof.beyls, hiraditya, pbarrio, llvm-commits

Tags: #llvm

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

llvm-svn: 364404

5 years ago[RISCV] Add pseudo instruction for calls with explicit register
Lewis Revill [Wed, 26 Jun 2019 10:35:58 +0000 (10:35 +0000)]
[RISCV] Add pseudo instruction for calls with explicit register

This patch adds the PseudoCALLReg instruction which allows using an
explicit register operand as the destination for the return address.

GCC can successfully parse this form of the call instruction, which
would be used for calls to functions which do not use ra as the return
address register, such as the __riscv_save libcalls. This patch forms
the first part of an implementation of -msave-restore for RISC-V.

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

llvm-svn: 364403

5 years ago[clang] Fix test failures after the rL364399
Djordje Todorovic [Wed, 26 Jun 2019 10:23:25 +0000 (10:23 +0000)]
[clang] Fix test failures after the rL364399

llvm-svn: 364402

5 years ago[X86][AVX] truncateVectorWithPACK - avoid bitcasted shuffles
Simon Pilgrim [Wed, 26 Jun 2019 09:50:11 +0000 (09:50 +0000)]
[X86][AVX] truncateVectorWithPACK - avoid bitcasted shuffles

truncateVectorWithPACK is often used in conjunction with ComputeNumSignBits which struggles when peeking through bitcasts.

This fix tries to avoid bitcast(shuffle(bitcast())) patterns in the 256-bit 64-bit sublane shuffles so we can still see through at least until lowering when the shuffles will need to be bitcasted to widen the shuffle type.

llvm-svn: 364401

5 years agoRevert r364332 "[scudo][standalone] Introduce the C & C++ wrappers"
Hans Wennborg [Wed, 26 Jun 2019 09:46:26 +0000 (09:46 +0000)]
Revert r364332 "[scudo][standalone] Introduce the C & C++ wrappers"

Makes the build fail with e.g.

  llvm/projects/compiler-rt/lib/scudo/standalone/wrappers_c.inc:20:68: error:
  declaration of 'void* calloc(size_t, size_t)' has a different exception
  specifier
   INTERFACE WEAK void *SCUDO_PREFIX(calloc)(size_t nmemb, size_t size) {
                                                                      ^

See llvm-commits thread.

> Summary:
> This CL adds C & C++ wrappers and associated tests. Those use default
> configurations for a Scudo combined allocator that will likely be
> tweaked in the future.
>
> This is the final CL required to have a functional C & C++ allocator
> based on Scudo.
>
> The structure I have chosen is to define the core C allocation
> primitives in an `.inc` file that can be customized through defines.
> This allows to easily have 2 (or more) sets of wrappers backed by
> different combined allocators, as demonstrated by the `Bionic`
> wrappers: one set for the "default" allocator, one set for the "svelte"
> allocator.
>
> Currently all the tests added have been gtests, but I am planning to
> add some more lit tests as well.
>
> Reviewers: morehouse, eugenis, vitalybuka, hctim, rengolin
>
> Reviewed By: morehouse
>
> Subscribers: srhines, mgorny, delcypher, jfb, #sanitizers, llvm-commits
>
> Tags: #llvm, #sanitizers
>
> Differential Revision: https://reviews.llvm.org/D63612

llvm-svn: 364400

5 years ago[CC1Option] Add the option to enable the debug entry values
Djordje Todorovic [Wed, 26 Jun 2019 09:38:09 +0000 (09:38 +0000)]
[CC1Option] Add the option to enable the debug entry values

The option enables debug info about parameter's entry values.

The example of using the option:

clang -g -O2 -Xclang -femit-debug-entry-values test.c

In addition, when the option is set add the flag all_call_sites
in a subprogram in order to support GNU extension as well.

([3/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>
Differential Revision: https://reviews.llvm.org/D58033

llvm-svn: 364399

5 years ago[LoopUnroll] Add support for loops with exiting headers and uncond latches.
Florian Hahn [Wed, 26 Jun 2019 09:16:57 +0000 (09:16 +0000)]
[LoopUnroll] Add support for loops with exiting headers and uncond latches.

This patch generalizes the UnrollLoop utility to support loops that exit
from the header instead of the latch. Usually, LoopRotate would take care
of must of those cases, but in some cases (e.g. -Oz), LoopRotate does
not kick in.

Codesize impact looks relatively neutral on ARM64 with -Oz + LTO.

Program                                         master     patch     diff
 External/S.../CFP2006/447.dealII/447.dealII   629060.00  627676.00  -0.2%
 External/SPEC/CINT2000/176.gcc/176.gcc        1245916.00 1244932.00 -0.1%
 MultiSourc...Prolangs-C/simulator/simulator   86100.00   86156.00    0.1%
 MultiSourc...arks/Rodinia/backprop/backprop   66212.00   66252.00    0.1%
 MultiSourc...chmarks/Prolangs-C++/life/life   67276.00   67312.00    0.1%
 MultiSourc...s/Prolangs-C/compiler/compiler   69824.00   69788.00   -0.1%
 MultiSourc...Prolangs-C/assembler/assembler   86672.00   86696.00    0.0%

Reviewers: efriedma, vsk, paquette

Reviewed By: paquette

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

llvm-svn: 364398

5 years ago[HardwareLoops] NFC - move loop with irreducible control flow checking logic to isHar...
Chen Zheng [Wed, 26 Jun 2019 09:12:52 +0000 (09:12 +0000)]
[HardwareLoops] NFC - move loop with irreducible control flow checking logic to isHardwareLoopProfitable()

llvm-svn: 364397

5 years ago[clang][Tooling] Fix windows build-bots after rL364386
Kadir Cetinkaya [Wed, 26 Jun 2019 08:39:42 +0000 (08:39 +0000)]
[clang][Tooling] Fix windows build-bots after rL364386

llvm-svn: 364396

5 years ago[TargetOption] Add option to ebanble the debug entry values
Djordje Todorovic [Wed, 26 Jun 2019 08:35:43 +0000 (08:35 +0000)]
[TargetOption] Add option to ebanble the debug entry values

The option enables debug info about parameter's entry values.

([2/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>
Differential Revision: https://reviews.llvm.org/D60961

llvm-svn: 364395

5 years ago[compiler-rt][test] Set shared_libasan_path in test/asan/lit.cfg on Solaris
Rainer Orth [Wed, 26 Jun 2019 08:19:57 +0000 (08:19 +0000)]
[compiler-rt][test] Set shared_libasan_path in test/asan/lit.cfg on Solaris

While checking warnings from the Solaris buildbots, I noticed

  llvm-lit: /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/projects/compiler-rt/test/asan/lit.cfg:119: warning: %shared_libasan substitution not set but dynamic ASan is available.

Fixed as follows.  Tested on x86_64-pc-solaris2.11.

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

llvm-svn: 364394

5 years ago[NFC][InstCombine] Add shift amount reassociation tests (PR42391)
Roman Lebedev [Wed, 26 Jun 2019 08:17:05 +0000 (08:17 +0000)]
[NFC][InstCombine] Add shift amount reassociation tests (PR42391)

https://bugs.llvm.org/show_bug.cgi?id=42391
https://rise4fun.com/Alive/9E2

llvm-svn: 364393

5 years ago[clangd] Don't rename the namespace.
Haojian Wu [Wed, 26 Jun 2019 08:10:26 +0000 (08:10 +0000)]
[clangd] Don't rename the namespace.

Summary:
Also fix a small bug -- the extra argument "-xc++" doesn't overwrite the
language if the argument is present after the file name in the compiler
command.

Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 364392

5 years agoReland D61583 [ELF] Error on relocations to STT_SECTION symbols if the sections were...
Fangrui Song [Wed, 26 Jun 2019 08:09:08 +0000 (08:09 +0000)]
Reland D61583 [ELF] Error on relocations to STT_SECTION symbols if the sections were discarded

This restores r361830 "[ELF] Error on relocations to STT_SECTION symbols if the sections were discarded"
and dependent commits (r362218, r362497) which were reverted by r364321, with a fix of a --gdb-index issue.

.rela.debug_ranges contains relocations of range list entries:

    // start address of a range list entry
    // old: 0; after r361830: 0
    00000000000033a0 R_X86_64_64 .text._ZN2v88internal7Isolate7factoryEv + 0
    // end address of a range list entry
    // old: 0xe; after r361830: 0
    00000000000033a8 R_X86_64_64 .text._ZN2v88internal7Isolate7factoryEv + e

If both start and end addresses of a range list entry resolve to 0,
DWARFDebugRangeList::isEndOfListEntry() will return true, then the
.debug_range decoding loop will terminate prematurely:

    while (true) {
      decode StartAddress
      decode EndAddress
      if (Entry.isEndOfListEntry()) // prematurely
        break;
      Entries.push_back(Entry);
    }

In lld/ELF/SyntheticSections.cpp, readAddressAreas() will read
incomplete address ranges and the resulting .gdb_index will be
incomplete. For files that gdb hasn't loaded their debug info, gdb uses
.gdb_index to map addresses to CUs. The absent entries make gdb fail to
symbolize some addresses.

To address this issue, we simply allow relocations to undefined symbols
in DWARF.cpp:findAux() and let RelocationResolver resolve them.

This patch should fix:

[1] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190603/659848.html
[2] https://bugs.chromium.org/p/chromium/issues/detail?id=978067

llvm-svn: 364391

5 years ago[clangd] Add Value field to HoverInfo
Kadir Cetinkaya [Wed, 26 Jun 2019 08:00:24 +0000 (08:00 +0000)]
[clangd] Add Value field to HoverInfo

Summary:
Put a symbols value information which is deduced from initializer
expression into HoverInfo struct.

Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 364390

5 years ago[clangd] Enable extraction of system includes from custom toolchains
Kadir Cetinkaya [Wed, 26 Jun 2019 07:45:27 +0000 (07:45 +0000)]
[clangd] Enable extraction of system includes from custom toolchains

Summary:
Some custom toolchains come with their own header files and compiler
drivers. Those compiler drivers implicitly know about include search path for
those headers. This patch aims to extract that information from drivers and add
it to the command line when invoking clang frontend.

Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 364389

5 years ago[clangd] Link and initialize target infos
Kadir Cetinkaya [Wed, 26 Jun 2019 07:39:14 +0000 (07:39 +0000)]
[clangd] Link and initialize target infos

llvm-svn: 364387

5 years ago[clang][Tooling] Infer target and mode from argv[0] when using JSONCompilationDatabase
Kadir Cetinkaya [Wed, 26 Jun 2019 07:39:03 +0000 (07:39 +0000)]
[clang][Tooling] Infer target and mode from argv[0] when using JSONCompilationDatabase

Summary:
Wraps JSON compilation database with a target and mode adding database
wrapper. So that driver can correctly figure out which toolchain to use.

Note that clients that wants to make use of this target discovery mechanism
needs to link in TargetsInfos and initialize them at startup.

Reviewers: ilya-biryukov

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 364386

5 years ago[Metadata] Add GNU extensions for call site DWARF symbols
Djordje Todorovic [Wed, 26 Jun 2019 07:31:09 +0000 (07:31 +0000)]
[Metadata] Add GNU extensions for call site DWARF symbols

As discussed on RFC
(http://lists.llvm.org/pipermail/llvm-dev/2019-February/130094.html), this
is set of patches that introduces debug information about call site and
call site parameters. Since the LLVM has portion of this support (dumping
DWARF 5 symbols for calls), we generate GNU extensions as well. All of that
will be restricted under an option.

([1/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>
Differential Revision: https://reviews.llvm.org/D60712

llvm-svn: 364385

5 years ago[ExpandMemCmp] Honor prefer-vector-width.
Clement Courbet [Wed, 26 Jun 2019 07:06:49 +0000 (07:06 +0000)]
[ExpandMemCmp] Honor prefer-vector-width.

Reviewers: gchatelet, echristo, spatel, atdt

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 364384

5 years ago[PowerPC] Fixed missing change flag of emitRLDICWhenLoweringJumpTables
Kai Luo [Wed, 26 Jun 2019 05:25:16 +0000 (05:25 +0000)]
[PowerPC] Fixed missing change flag of emitRLDICWhenLoweringJumpTables

PPCMIPeephole::emitRLDICWhenLoweringJumpTables should return a bool
value to indicate optimization is conducted or not.

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

llvm-svn: 364383

5 years agoTeach the DAGCombine to fold this pattern(c1 and c2 is constant).
QingShan Zhang [Wed, 26 Jun 2019 05:12:53 +0000 (05:12 +0000)]
Teach the DAGCombine to fold this pattern(c1 and c2 is constant).

// fold (sext (select cond, c1, c2)) -> (select cond, sext c1, sext c2)
// fold (zext (select cond, c1, c2)) -> (select cond, zext c1, zext c2)
// fold (aext (select cond, c1, c2)) -> (select cond, sext c1, sext c2)
Sign extend the operands if it is any_extend, to keep the signess of the operands that, the other combine rule would apply. The any_extend is handled as zero extend for constants. i.e.

t1: i8 = select t0, Constant:i8<-1>, Constant:i8<0>
t2: i64 = any_extend t1
 -->
t3: i64 = select t0, Constant:i64<-1>, Constant:i64<0>
 -->
t4: i64 = sign_extend_inreg t3

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

llvm-svn: 364382

5 years ago[HIP] Support attribute hip_pinned_shadow
Yaxun Liu [Wed, 26 Jun 2019 03:47:37 +0000 (03:47 +0000)]
[HIP] Support attribute hip_pinned_shadow

This patch introduces support of hip_pinned_shadow variable for HIP.

A hip_pinned_shadow variable is a global variable with attribute hip_pinned_shadow.
It has external linkage on device side and has no initializer. It has internal
linkage on host side and has initializer or static constructor. It can be accessed
in both device code and host code.

This allows HIP runtime to implement support of HIP texture reference.

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

llvm-svn: 364381

5 years agoFix build failure due to missing break
Yaxun Liu [Wed, 26 Jun 2019 03:33:03 +0000 (03:33 +0000)]
Fix build failure due to missing break

llvm-svn: 364380

5 years agoRevert [llvm-objcopy][NFC] Refactor output target parsing
Rumeet Dhindsa [Wed, 26 Jun 2019 03:00:57 +0000 (03:00 +0000)]
Revert [llvm-objcopy][NFC] Refactor output target parsing

This reverts r364254 (git commit 545f001d1b9a7b58a68d75e70bfc36c841de8999)

This change causes some llvm-obcopy tests to fail with valgrind.

Following is the output for basic-keep.test
Command Output (stderr):
--

==107406== Conditional jump or move depends on uninitialised value(s)
==107406==    at 0x1A30DD: executeObjcopy(llvm::objcopy::CopyConfig const&) (llvm-objcopy.cpp:235)
==107406==    by 0x1A3935: main (llvm-objcopy.cpp:294)

llvm-svn: 364379

5 years agoRevert [llvm-objcopy][NFCI] Fix build failure with GCC
Rumeet Dhindsa [Wed, 26 Jun 2019 02:57:34 +0000 (02:57 +0000)]
Revert [llvm-objcopy][NFCI] Fix build failure with GCC

This reverts r364263 (git commit 81eb82840524818ec0ec14285c866c09b9634df0)

This commit is related to r364254 which is causing some llvm-objcopy tests
to fail with valgrind.

Error:
Conditional jump or move depends on uninitialised value(s)

llvm-svn: 364378

5 years ago[NFC] Fix buildbot breaks due to r364375
Nemanja Ivanovic [Wed, 26 Jun 2019 02:46:03 +0000 (02:46 +0000)]
[NFC] Fix buildbot breaks due to r364375

For some reason, the update_llc_checks.py script produces checks for
empty lines which cause failures. Corrected that to check for actual
text produced by llc.

llvm-svn: 364377

5 years ago[ARM] Fix -Wimplicit-fallthrough after D60709/r364331
Fangrui Song [Wed, 26 Jun 2019 02:34:10 +0000 (02:34 +0000)]
[ARM] Fix -Wimplicit-fallthrough after D60709/r364331

llvm-svn: 364376

5 years ago[PowerPC][NFC] Add a TOC save test case prior to posting a related patch
Nemanja Ivanovic [Wed, 26 Jun 2019 02:01:11 +0000 (02:01 +0000)]
[PowerPC][NFC] Add a TOC save test case prior to posting a related patch

An upcoming patch will modify the behaviour with respect to saving the TOC
in functions with indirect calls.
Adding a test case so the patch will show the difference in codegen.

llvm-svn: 364375

5 years agogn build: Merge r364288.
Peter Collingbourne [Wed, 26 Jun 2019 01:52:22 +0000 (01:52 +0000)]
gn build: Merge r364288.

llvm-svn: 364374

5 years ago[PowerPC] Mark FCOPYSIGN legal for FP vectors
Nemanja Ivanovic [Wed, 26 Jun 2019 01:48:57 +0000 (01:48 +0000)]
[PowerPC] Mark FCOPYSIGN legal for FP vectors

This was just an omission in the back end. We have had the instructions for both
single and double precision for a few HW generations, but never got around to
legalizing these.

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

llvm-svn: 364373

5 years ago[PowerPC][NFC] Move peephole optimization of RLDICR into a method.
Kai Luo [Wed, 26 Jun 2019 01:34:37 +0000 (01:34 +0000)]
[PowerPC][NFC] Move peephole optimization of RLDICR into a method.

llvm-svn: 364372

5 years ago[WebAssembly] Fix accidental omission from rLLD364367
Keno Fischer [Wed, 26 Jun 2019 01:26:53 +0000 (01:26 +0000)]
[WebAssembly] Fix accidental omission from rLLD364367

There was another place where handling for this relocation was missing
that was accidentally omitted from rLLD364367, causing the newly added
test to fail on the buildbots.

llvm-svn: 364371

5 years agoMC: correct the emission of weak aliases in COFF
Saleem Abdulrasool [Wed, 26 Jun 2019 01:09:52 +0000 (01:09 +0000)]
MC: correct the emission of weak aliases in COFF

The weak alias should have the characteristics set to
`IMAGE_EXTERN_WEAK_SEARCH_ALIAS` to indicate that the weak external here
is a symbol alias and that the symbol is aliased to a locally defined
symbol.  We were previously setting the characteristics to
`IMAGE_EXTERN_WEAK_SEARCH_LIBRARY` which indicates that the symbol
should be looked for in the libraries.

llvm-svn: 364370

5 years agoFollow up fix for r364366.
Dan Liew [Wed, 26 Jun 2019 00:54:06 +0000 (00:54 +0000)]
Follow up fix for r364366.

When setting the parallelism group support MSan and use a syntactically
compact condition.

rdar://problem/51754620

llvm-svn: 364369

5 years ago[lld/WebAssembly] Slightly nicer error message for malformed input files
Keno Fischer [Wed, 26 Jun 2019 00:52:46 +0000 (00:52 +0000)]
[lld/WebAssembly] Slightly nicer error message for malformed input files

Summary:
Before:
```
wasm-ld: error: Relocations not in offset order
```
After
```
wasm-ld: error: While processing `libjulia.so`: Relocations not in offset order
```

At least this way you get to find out which input file is malformed.

Reviewers: sbc100
Differential Revision: https://reviews.llvm.org/D63694

llvm-svn: 364368

5 years ago[WebAssembly] Fix list of relocations with addends in lld
Keno Fischer [Wed, 26 Jun 2019 00:52:42 +0000 (00:52 +0000)]
[WebAssembly] Fix list of relocations with addends in lld

Summary:
The list of relocations with addend in lld was missing `R_WASM_MEMORY_ADDR_REL_SLEB`,
causing `wasm-ld` to generate corrupted output. This fixes that problem and while
we're at it pulls the list of such relocations into the Wasm.h header, to avoid
duplicating it in multiple places.

Reviewers: sbc100
Differential Revision: https://reviews.llvm.org/D63696

llvm-svn: 364367

5 years agoAdd USan+ASan and UBSan+TSan tests to shadow-memory lit parallelism group.
Dan Liew [Wed, 26 Jun 2019 00:35:51 +0000 (00:35 +0000)]
Add USan+ASan and UBSan+TSan tests to shadow-memory lit parallelism group.

Summary:
Previously we were running these tests without the "shadow-memory"
lit parallelism group even though we run the ASan and TSan tests in
this group to avoid problems with many processes using shadow memory
in parallel.

On my local machine the UBSan+TSan tests would previously timeout
if I set a 30 second per test limit. With this change I no longer
see individual test timeouts.

This change was made in response to the greendragon build bot reporting
individual test timeouts for these tests. Given that the UBSan+ASan and
UBSan+TSan tests did not have a parallelism group previously it's likely
that some other change has caused the performance degradation. However
I haven't been able to track down the cause so until we do, this change
seems reasonable and is in line with what we already do with ASan and
TSan tests.

rdar://problem/51754620

Reviewers: yln, kubamracek, vsk, samsonov

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 364366

5 years ago[analyzer] exploded-graph-rewriter: Prettier location context dumps.
Artem Dergachev [Wed, 26 Jun 2019 00:14:49 +0000 (00:14 +0000)]
[analyzer] exploded-graph-rewriter: Prettier location context dumps.

Make them span wider.

llvm-svn: 364365

5 years agoTeach TableGen Intrin Emitter to handle LLVMPointerType<llvm_any_ty>
Erich Keane [Wed, 26 Jun 2019 00:08:22 +0000 (00:08 +0000)]
Teach TableGen Intrin Emitter to handle LLVMPointerType<llvm_any_ty>

r363233 rewrote a bunch of the Intrin Emitter code, however the new
function to update the arg codes did not properly consider a pointer to
an any.  This patch adds that logic.

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

llvm-svn: 364364

5 years agoRevert "Change the ABI version and ABI namespace to be `_LIBCPP_VERSION`"
Eric Fiselier [Wed, 26 Jun 2019 00:05:14 +0000 (00:05 +0000)]
Revert "Change the ABI version and ABI namespace to be `_LIBCPP_VERSION`"

There are some suspicious bot failures that I want to ensure aren't
caused by this patch.

I'll recommit tomorrow.

llvm-svn: 364363

5 years agoprint-supported-cpus quality of life patch.
Ziang Wan [Tue, 25 Jun 2019 23:57:14 +0000 (23:57 +0000)]
print-supported-cpus quality of life patch.

Claim all input files so that clang does not give a warning. Add two
short-cut aliases: -mcpu=? and -mtune=?.

llvm-svn: 364362

5 years agoFix a typo in help text.
Adrian McCarthy [Tue, 25 Jun 2019 23:13:16 +0000 (23:13 +0000)]
Fix a typo in help text.

llvm-svn: 364361

5 years ago[WebAssembly] Remove catch_all from AsmParser
Heejin Ahn [Tue, 25 Jun 2019 23:04:12 +0000 (23:04 +0000)]
[WebAssembly] Remove catch_all from AsmParser

Summary:
`catch_all` is from the first version of EH proposal and now has been
removed. There were no tests covering this, and thus no tests to remove
or fix.

Reviewers: aardappel

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 364360

5 years agoRevert Devirtualize destructor of final class.
Rumeet Dhindsa [Tue, 25 Jun 2019 22:58:25 +0000 (22:58 +0000)]
Revert Devirtualize destructor of final class.

This reverts r364100 (git commit 405c2b16225fc6eaf5eb8ba3ce584699a3b159ef)

llvm-svn: 364359

5 years agoAdd github lockdown app to auto-close pull requests.
Tom Stellard [Tue, 25 Jun 2019 22:51:46 +0000 (22:51 +0000)]
Add github lockdown app to auto-close pull requests.

llvm-svn: 364358

5 years agoDump what value failed byval attribute verification
Reid Kleckner [Tue, 25 Jun 2019 22:33:32 +0000 (22:33 +0000)]
Dump what value failed byval attribute verification

This verifier check is failing for us while doing ThinLTO on Chrome for
x86, see https://crbug.com/978218, and this helps to debug the problem.

llvm-svn: 364357

5 years ago[GWP-ASan] Guard against recursive allocs. Pack TLS for perf.
Mitch Phillips [Tue, 25 Jun 2019 22:29:05 +0000 (22:29 +0000)]
[GWP-ASan] Guard against recursive allocs. Pack TLS for perf.

Summary:
Add a recursivity guard for GPA::allocate(). This means that any
recursive allocations will fall back to the supporting allocator. In future
patches, we will introduce stack trace collection support. The unwinder will be
provided by the supporting allocator, and we can't guarantee they don't call
malloc() (e.g. backtrace() on posix may call dlopen(), which may call malloc().

Furthermore, this patch packs the new TLS recursivity guard into a thread local
struct, so that TLS variables should be hopefully not fall across cache lines.

Reviewers: vlad.tsyrklevich, morehouse, eugenis

Reviewed By: eugenis

Subscribers: kubamracek, #sanitizers, llvm-commits, eugenis

Tags: #sanitizers, #llvm

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

llvm-svn: 364356

5 years agoRevert "Add ReadCStringFromMemory for faster string reads"
Antonio Afonso [Tue, 25 Jun 2019 22:22:13 +0000 (22:22 +0000)]
Revert "Add ReadCStringFromMemory for faster string reads"

This reverts commit a7335393f50246b59db450dc6005f7c8f29e73a6.

It seems this is breaking a bunch of tests (https://reviews.llvm.org/D62503#1549874) so reverting until I find the time to repro and fix.

llvm-svn: 364355

5 years agoChange the ABI version and ABI namespace to be `_LIBCPP_VERSION`
Eric Fiselier [Tue, 25 Jun 2019 22:13:39 +0000 (22:13 +0000)]
Change the ABI version and ABI namespace to be `_LIBCPP_VERSION`
when _LIBCPP_ABI_UNSTABLE is defined.

User defined _LIBCPP_ABI_NAMESPACE will still be respected,
but the default version namespace in unstable mode will be the libc++ version
(Currently '__9000').

Previously  `_LIBCPP_ABI_VERSION` and `_LIBCPP_ABI_NAMESPACE` were
`1` and `__1` respectively, whuch conflicted with the stable ABI

llvm-svn: 364354

5 years ago[MachinePipeliner] Fix risky iterator usage R++, --R
Jinsong Ji [Tue, 25 Jun 2019 21:50:56 +0000 (21:50 +0000)]
[MachinePipeliner] Fix risky iterator usage R++, --R

When we calculate MII, we use two loops, one with iterator R++ to
check whether we can reserve the resource, then --R to move back
the iterator to do reservation.

This is risky, as R++, --R may not point to the same element at all.
The can cause wrong MII.

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

llvm-svn: 364353

5 years agoandroid: enable double-word CAS on x64
Saleem Abdulrasool [Tue, 25 Jun 2019 21:43:34 +0000 (21:43 +0000)]
android: enable double-word CAS on x64

The android target assumes that for the x86_64 target, the CPU supports SSE4.2
and popcnt. This implies that the CPU is Nehalem or newer. This should be
sufficiently new to provide the double word compare and exchange instruction.
This allows us to directly lower `__sync_val_compare_and_swap_16` to a `cmpxchg16b`.
It appears that the libatomic in android's NDK does not provide the
implementation for lowering calls to the library function.

llvm-svn: 364352

5 years ago[dotest] Remove unused function
Jonas Devlieghere [Tue, 25 Jun 2019 21:19:44 +0000 (21:19 +0000)]
[dotest] Remove unused function

The function `EnvArray` has no used.

llvm-svn: 364351

5 years ago[PowerPC][NFC]Add a test for MachinePipeliner bug
Jinsong Ji [Tue, 25 Jun 2019 20:56:17 +0000 (20:56 +0000)]
[PowerPC][NFC]Add a test for MachinePipeliner bug

llvm-svn: 364350

5 years agoDon't look for the TargetFrameLowering in the implementation
Matt Arsenault [Tue, 25 Jun 2019 20:53:35 +0000 (20:53 +0000)]
Don't look for the TargetFrameLowering in the implementation

The same oddity was apparently copy-pasted between multiple targets.

llvm-svn: 364349

5 years ago[InstCombine] Simplify icmp ult/uge (shl %x, C2), C1 iff C1 is power of two -> icmp...
Huihui Zhang [Tue, 25 Jun 2019 20:44:52 +0000 (20:44 +0000)]
[InstCombine] Simplify icmp ult/uge (shl %x, C2), C1 iff C1 is power of two -> icmp eq/ne (and %x, (lshr -C1, C2)), 0.

Simplify 'shl' inequality test into 'and' equality test.

This pattern happens in the middle-end while simplifying bitfield access,
Exposed in https://reviews.llvm.org/D63505

https://rise4fun.com/Alive/6uz

Reviewers: lebedev.ri, efriedma

Reviewed By: lebedev.ri

Subscribers: spatel, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 364348

5 years agoRemove redundant expression evaluation context when substituting into a
Richard Smith [Tue, 25 Jun 2019 20:40:27 +0000 (20:40 +0000)]
Remove redundant expression evaluation context when substituting into a
template argument.

We do need one of these but we don't need two.

llvm-svn: 364347

5 years ago[LFTR] Adjust debug output to include extensions (if any)
Philip Reames [Tue, 25 Jun 2019 20:14:08 +0000 (20:14 +0000)]
[LFTR] Adjust debug output to include extensions (if any)

llvm-svn: 364346

5 years ago[scudo] Correct a behavior on the shared TSD registry
Kostya Kortchinsky [Tue, 25 Jun 2019 19:58:11 +0000 (19:58 +0000)]
[scudo] Correct a behavior on the shared TSD registry

Summary:
There is an error in the shared TSD registry logic when looking for a
TSD in the slow path. There is an unlikely event when a TSD's precedence
was 0 after attempting a `tryLock` which indicated that it was grabbed
by another thread in between. We dealt with that case by continuing to
the next iteration, but that meant that the `Index` was not increased
and we ended up trying to lock the same TSD.
This would manifest in heavy contention, and in the end we would still
lock a TSD, but that was a wasted iteration.
So, do not `continue`, just skip the TSD as a potential candidate.

This is in both the standalone & non-standalone versions.

Reviewers: morehouse, eugenis, vitalybuka, hctim

Reviewed By: morehouse

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 364345

5 years agoAdd a defensive check for nullptr as in the block above.
Adrian Prantl [Tue, 25 Jun 2019 19:50:12 +0000 (19:50 +0000)]
Add a defensive check for nullptr as in the block above.

Unfortunately I had to work backwards from a crash log,
so I don't have a good testcase at this point in time.

rdar://problem/51874647

llvm-svn: 364344

5 years ago[llvm-shlib] Do not use version script when building with MinGW
Pirama Arumuga Nainar [Tue, 25 Jun 2019 19:34:52 +0000 (19:34 +0000)]
[llvm-shlib] Do not use version script when building with MinGW

Summary:
The MinGW driver for lld does not support the --version-script option.
For GNU ld, it's a no-op since LLVM.dll exports all symbols.

Reviewers: srhines, mstorsjo

Subscribers: mgorny, fedor.sergeev, llvm-commits

Tags: #llvm

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

llvm-svn: 364343

5 years agoUpdate phis in AMDGPUUnifyDivergentExitNodes
Diego Novillo [Tue, 25 Jun 2019 18:55:16 +0000 (18:55 +0000)]
Update phis in AMDGPUUnifyDivergentExitNodes

Original patch https://reviews.llvm.org/D63659 from
Steven Perron <stevenperron@google.com>

The pass AMDGPUUnifyDivergentExitNodes does not update the phi nodes in
the successors of blocks that is splits. This is fixed by calling
BasicBlock::splitBasicBlock to split the block instead of doing it
manually. This does extra work because a new conditional branch is
created in BB which is immediately replaced, but I think the simplicity
is worth it. It also helps make the code more future proof in case other
things need to be updated.

llvm-svn: 364342

5 years ago[InstCombine] reduce checks for power-of-2-or-zero using ctpop
Sanjay Patel [Tue, 25 Jun 2019 18:51:44 +0000 (18:51 +0000)]
[InstCombine] reduce checks for power-of-2-or-zero using ctpop

This follows up the transform from rL363956 to use the ctpop intrinsic when checking for power-of-2-or-zero.

This is matching the isPowerOf2() patterns used in PR42314:
https://bugs.llvm.org/show_bug.cgi?id=42314

But there's at least 1 instcombine follow-up needed to match the alternate form:

(v & (v - 1)) == 0;

We should have all of the backend expansions handled with:
rL364319
(x86-specific changes still needed for optimal code based on subtarget)

And the larger patterns to exclude zero as a power-of-2 are joining with this change after:
rL364153 ( D63660 )
rL364246

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

llvm-svn: 364341

5 years agoAdd regression test for PR41576 (which is already fixed in trunk,
Richard Smith [Tue, 25 Jun 2019 18:42:53 +0000 (18:42 +0000)]
Add regression test for PR41576 (which is already fixed in trunk,
perhaps by r361300).

llvm-svn: 364340

5 years ago[AMDGPU] Removed dead SIMachineFunctionInfo::getWorkItemIDVGPR()
Stanislav Mekhanoshin [Tue, 25 Jun 2019 18:33:53 +0000 (18:33 +0000)]
[AMDGPU] Removed dead SIMachineFunctionInfo::getWorkItemIDVGPR()

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

llvm-svn: 364339

5 years ago[WebAssembly] Error on archives without a symbol index
Sam Clegg [Tue, 25 Jun 2019 17:49:35 +0000 (17:49 +0000)]
[WebAssembly] Error on archives without a symbol index

This is fairly common with wasm since GNU ar (most likely the system ar)
doesn't support the wasm object format so user who don't override AR
will end up with archives without an index.  We don't want to silently
ignore this issue.

In the future we could choose to instead behave like the ELF backend and
read the symbols from each object file in the archive if they are all of
the same type.  However, error'ing out seem like a conservative approach
for now.

Fixes: PR42376

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

llvm-svn: 364338

5 years ago[X86] Remove isel patterns that look for (vzext_movl (scalar_to_vector (load)))
Craig Topper [Tue, 25 Jun 2019 17:31:52 +0000 (17:31 +0000)]
[X86] Remove isel patterns that look for (vzext_movl (scalar_to_vector (load)))

I believe these all get canonicalized to vzext_movl. The only case where that wasn't true was when the load was loadi32 and the load was an extload aligned to 32 bits. But that was fixed in r364207.

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

llvm-svn: 364337

5 years ago[Peephole] Allow folding loads into instructions w/multiple uses (such as test64rr)
Philip Reames [Tue, 25 Jun 2019 17:29:18 +0000 (17:29 +0000)]
[Peephole] Allow folding loads into instructions w/multiple uses (such as test64rr)

Peephole opt has a one use limitation which appears to be accidental. The function being used was incorrectly documented as returning whether the def had one *user*, but instead returned true only when there was one *use*. Add a corresponding hasOneNonDbgUser helper, and adjust peephole-opt to use the appropriate one.

All of the actual folding code handles multiple uses within a single instruction. That codepath is well exercised through instruction selection.

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

llvm-svn: 364336

5 years ago[Python] Flush prompt before reading input
Jonas Devlieghere [Tue, 25 Jun 2019 17:27:38 +0000 (17:27 +0000)]
[Python] Flush prompt before reading input

Make sure the prompt has been flushed before reading commands. Buffering
is different in Python 3, which led to the prompt not being displayed in
the Xcode console.

llvm-svn: 364335

5 years ago[CMake] Check that a certificate for lldb is present at build time.
Davide Italiano [Tue, 25 Jun 2019 17:13:24 +0000 (17:13 +0000)]
[CMake] Check that a certificate for lldb is present at build time.

Reviewers: JDevlieghere, sgraenitz, aprantl, friss

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 364334

5 years ago[X86] Add a DAG combine to turn vzmovl+load into vzload if the load isn't volatile...
Craig Topper [Tue, 25 Jun 2019 17:08:26 +0000 (17:08 +0000)]
[X86] Add a DAG combine to turn vzmovl+load into vzload if the load isn't volatile. Remove isel patterns for vzmovl+load

We currently have some isel patterns for treating vzmovl+load the same as vzload, but that shrinks the load which we shouldn't do if the load is volatile.

Rather than adding isel checks for volatile. This patch removes the patterns and teachs DAG combine to merge them into vzload when its legal to do so.

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

llvm-svn: 364333

5 years ago[scudo][standalone] Introduce the C & C++ wrappers
Kostya Kortchinsky [Tue, 25 Jun 2019 16:51:27 +0000 (16:51 +0000)]
[scudo][standalone] Introduce the C & C++ wrappers

Summary:
This CL adds C & C++ wrappers and associated tests. Those use default
configurations for a Scudo combined allocator that will likely be
tweaked in the future.

This is the final CL required to have a functional C & C++ allocator
based on Scudo.

The structure I have chosen is to define the core C allocation
primitives in an `.inc` file that can be customized through defines.
This allows to easily have 2 (or more) sets of wrappers backed by
different combined allocators, as demonstrated by the `Bionic`
wrappers: one set for the "default" allocator, one set for the "svelte"
allocator.

Currently all the tests added have been gtests, but I am planning to
add some more lit tests as well.

Reviewers: morehouse, eugenis, vitalybuka, hctim, rengolin

Reviewed By: morehouse

Subscribers: srhines, mgorny, delcypher, jfb, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 364332

5 years ago[ARM] Support inline assembler constraints for MVE.
Simon Tatham [Tue, 25 Jun 2019 16:49:32 +0000 (16:49 +0000)]
[ARM] Support inline assembler constraints for MVE.

"To" selects an odd-numbered GPR, and "Te" an even one. There are some
8.1-M instructions that have one too few bits in their register fields
and require registers of particular parity, without necessarily using
a consecutive even/odd pair.

Also, the constraint letter "t" should select an MVE q-register, when
MVE is present. This didn't need any source changes, but some extra
tests have been added.

Reviewers: dmgreen, samparker, SjoerdMeijer

Subscribers: javed.absar, eraman, kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 364331

5 years ago[AVR] Adjust to Register class change
Ayke van Laethem [Tue, 25 Jun 2019 16:49:22 +0000 (16:49 +0000)]
[AVR] Adjust to Register class change

A refactor in r364191 changed register types from an unsigned int to the
llvm:Register class. Adjust the AVR backend to this change.

This fixes build errors when building with the experimental AVR backend
enabled.

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

llvm-svn: 364330

5 years ago[ARM] Code-generation infrastructure for MVE.
Simon Tatham [Tue, 25 Jun 2019 16:48:46 +0000 (16:48 +0000)]
[ARM] Code-generation infrastructure for MVE.

This provides the low-level support to start using MVE vector types in
LLVM IR, loading and storing them, passing them to __asm__ statements
containing hand-written MVE vector instructions, and *if* you have the
hard-float ABI turned on, using them as function parameters.

(In the soft-float ABI, vector types are passed in integer registers,
and combining all those 32-bit integers into a q-reg requires support
for selection DAG nodes like insert_vector_elt and build_vector which
aren't implemented yet for MVE. In fact I've also had to add
`arm_aapcs_vfpcc` to a couple of existing tests to avoid that
problem.)

Specifically, this commit adds support for:

 * spills, reloads and register moves for MVE vector registers

 * ditto for the VPT predication mask that lives in VPR.P0

 * make all the MVE vector types legal in ISel, and provide selection
   DAG patterns for BITCAST, LOAD and STORE

 * make loads and stores of scalar FP types conditional on
   `hasFPRegs()` rather than `hasVFP2Base()`. As a result a few
   existing tests needed their llc command lines updating to use
   `-mattr=-fpregs` as their method of turning off all hardware FP
   support.

Reviewers: dmgreen, samparker, SjoerdMeijer

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 364329

5 years ago[FPEnv] A missing crucial step was undocumented.
Kevin P. Neal [Tue, 25 Jun 2019 16:09:39 +0000 (16:09 +0000)]
[FPEnv] A missing crucial step was undocumented.

llvm-svn: 364328

5 years ago[OPENMP]Fix PR41966: type mismatch in runtime functions.
Alexey Bataev [Tue, 25 Jun 2019 16:00:43 +0000 (16:00 +0000)]
[OPENMP]Fix PR41966: type mismatch in runtime functions.

Target-based runtime functions use int64_t type for sizes, while the
compiler uses size_t type. It leads to miscompilation in 32 bit mode.

llvm-svn: 364327

5 years ago[DAGCombine] combineRepeatedFPDivisors - recognize -1.0 / X as a reciprocal
Simon Pilgrim [Tue, 25 Jun 2019 16:00:16 +0000 (16:00 +0000)]
[DAGCombine] combineRepeatedFPDivisors - recognize -1.0 / X as a reciprocal

Fixes issue identified by @nemanjai (Nemanja Ivanovic) in D62963 / rL363040 - infinite loop due to GetNegatedExpression fighting combineRepeatedFPDivisors resulting in fneg(fdiv(x,splat)) -> fneg(fmul(x,1.0/splat)) -> fmul(x,-1.0/splat) -> fmul(x,(-1.0 * 1.0)/splat) ......

llvm-svn: 364326

5 years ago[Python 3] Decode check_ouput result as UTF-8
Jonas Devlieghere [Tue, 25 Jun 2019 15:58:32 +0000 (15:58 +0000)]
[Python 3] Decode check_ouput result as UTF-8

llvm-svn: 364325

5 years ago[PPC32] Support PLT calls for -msecure-plt -fpic
Fangrui Song [Tue, 25 Jun 2019 15:56:32 +0000 (15:56 +0000)]
[PPC32] Support PLT calls for -msecure-plt -fpic

Summary:
In Secure PLT ABI, -fpic is similar to -fPIC. The differences are that:

* -fpic stores the address of _GLOBAL_OFFSET_TABLE_ in r30, while -fPIC stores .got2+0x8000.
* -fpic uses an addend of 0 for R_PPC_PLTREL24, while -fPIC uses 0x8000.

Reviewers: hfinkel, jhibbits, joerg, nemanjai, spetrovic

Reviewed By: jhibbits

Subscribers: adalava, kbarton, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 364324

5 years ago[ARM] Fix for DLS/LE CodeGen
Sam Parker [Tue, 25 Jun 2019 15:11:17 +0000 (15:11 +0000)]
[ARM] Fix for DLS/LE CodeGen

The expensive buildbots highlighted the mir tests were broken, which
I've now updated and added --verify-machineinstrs to them. This also
uncovered a couple of bugs in the backend pass, so these have also
been fixed.

llvm-svn: 364323

5 years agoImprove zero-size allocation with safe_malloc, etc.
Xing Xue [Tue, 25 Jun 2019 15:08:28 +0000 (15:08 +0000)]
Improve zero-size allocation with safe_malloc, etc.

Summary:
The current implementations of the memory allocation functions mistake a nullptr returned from std::malloc, std::calloc, or std::realloc as a failure. The behaviour for each of std::malloc, std::calloc, and std::realloc when the size is 0 is implementation defined (ISO/IEC 9899:2018 7.22.3), and may return a nullptr.

This patch checks if space requested is zero when a nullptr is returned, retry requesting non-zero if it is.

Authored By: andusy

Reviewers: hubert.reinterpretcast, xingxue, jasonliu

Reviewed By: hubert.reinterpretcast, xingxue, abrachet

Subscribers: abrachet, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 364322

5 years agoRevert r362743 "Revert "Revert "Reland D61583 [ELF] Error on relocations to STT_SECTI...
Hans Wennborg [Tue, 25 Jun 2019 14:58:46 +0000 (14:58 +0000)]
Revert r362743 "Revert "Revert "Reland D61583 [ELF] Error on relocations to STT_SECTION symbols if the sections were discarded"""

(In effect, reverting "[ELF] Error on relocations to STT_SECTION symbols if the sections were discarded".)

It caused debug info problems in LibreOffice [1] and Chromium/V8 [2].
Reverting until those can be fixed.

It also reverts r362497 "STT_SECTION symbol should be defined" on .eh_frame, .debug*, .zdebug* and .gcc_except_table"
which was landed as a follow-up to the above.

> With -r or --emit-relocs, we warn `STT_SECTION symbol should be defined`
> on relocations to discarded section symbol. This was added as an error
> in rLLD319404, but was not so effective before D61583 (it turned the
> error to a warning).
>
> Relocations from .eh_frame .debug* .zdebug* .gcc_except_table to
> discarded .text are very common and somewhat expected. Don't warn/error
> on them. As a reference, ld.bfd has a similar logic in
> _bfd_elf_default_action_discarded() to allow these cases.
>
> Delete invalid-undef-section-symbol.test because what it intended to
> check is now covered by the updated comdat-discarded-reloc.s
>
> Delete relocatable-eh-frame.s because we allow relocations from
> .eh_frame as a special case now.

And finally it reverts r362218 "[ELF] Replace a dead test in getSymVA() with assert()"
as that also depended on the main change reverted here.

> Symbols relative to discarded comdat sections are Undefined instead of
> Defined now (after D59649 and D61583). The `== &InputSection::Discarded`
> test becomes dead. I cannot find a test related to this behavior.

 [1] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190603/659848.html
 [2] https://bugs.chromium.org/p/chromium/issues/detail?id=978067

llvm-svn: 364321