platform/upstream/llvm.git
6 years ago[Tooling] Clear the PreambleSrcLocCache when preamble is discarded during reparsing
Alex Lorenz [Mon, 12 Mar 2018 19:36:29 +0000 (19:36 +0000)]
[Tooling] Clear the PreambleSrcLocCache when preamble is discarded during reparsing

This ensures that diagnostics are not remapped to incorrect preamble locations after
the second reparse with a remapped header file occurs.

rdar://37502480

llvm-svn: 327322

6 years ago[scudo] Secondary allocator overhaul to support Windows
Kostya Kortchinsky [Mon, 12 Mar 2018 19:29:38 +0000 (19:29 +0000)]
[scudo] Secondary allocator overhaul to support Windows

Summary:
The need for this change stems from the fact that Windows doesn't support
partial unmapping (`MEM_RELEASE` implies the entire allocated region). So we
now have to keep track of the reserved region and the committed region, so that
we can function without the trimming we did when dealing with larger alignments.

Instead of just having a `ReservedAddressRange` per chunk, we introduce a
`LargeChunkHeader` (and `LargeChunk` namespace) that additionally holds the
committed size and the usable size. The former is needed for stats purposes,
the latter is used by the frontend. Requiring both is debatable, we could only
work with the usable size but then be off by up to a page per chunk when
dealing with stats.

Additionally, we introduce more stats since they turned out to be useful for
experiments, and a `PrintStats` function that will be used by the combined
allocator in later patch.

Reviewers: alekseyshl, flowerhack

Reviewed By: alekseyshl

Subscribers: delcypher, #sanitizers, llvm-commits

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

llvm-svn: 327321

6 years ago[llvm-readobj][ELF] Move ELF note parsing into libObject
Scott Linder [Mon, 12 Mar 2018 19:28:50 +0000 (19:28 +0000)]
[llvm-readobj][ELF] Move ELF note parsing into libObject

Clean up the parsing of notes in llvm-readobj, improve bounds checking, and
allow the parsing code to be reused.

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

llvm-svn: 327320

6 years ago[PowerPC][NFC] Explicitly state types on FP SDAG patterns in anticipation of adding...
Lei Huang [Mon, 12 Mar 2018 19:26:18 +0000 (19:26 +0000)]
[PowerPC][NFC] Explicitly state types on FP SDAG patterns in anticipation of adding the f128 type

llvm-svn: 327319

6 years agoImprove prologue handling to support functions with multiple entry points.
Jim Ingham [Mon, 12 Mar 2018 19:21:59 +0000 (19:21 +0000)]
Improve prologue handling to support functions with multiple entry points.

https://reviews.llvm.org/D42582

Patch from Leandro Lupori.

llvm-svn: 327318

6 years agoCheck that ubsan is the only supported sanitizer on OpenBSD
Vedant Kumar [Mon, 12 Mar 2018 19:18:51 +0000 (19:18 +0000)]
Check that ubsan is the only supported sanitizer on OpenBSD

Patch by David Carlier!

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

llvm-svn: 327317

6 years ago[AArch64] Fold adds with tprel_lo12_nc and secrel_lo12 into a following ldr/str
Martin Storsjo [Mon, 12 Mar 2018 18:47:43 +0000 (18:47 +0000)]
[AArch64] Fold adds with tprel_lo12_nc and secrel_lo12 into a following ldr/str

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

llvm-svn: 327316

6 years ago[InstCombine] Replace calls to getNumUses with hasNUses or hasNUsesOrMore
Craig Topper [Mon, 12 Mar 2018 18:46:05 +0000 (18:46 +0000)]
[InstCombine] Replace calls to getNumUses with hasNUses or hasNUsesOrMore

getNumUses is a linear time operation. It traverses the user linked list to the end and counts as it goes. Since we are only interested in small constant counts, we should use hasNUses or hasNUsesMore more that terminate the traversal as soon as it can provide the answer.

There are still two other locations in InstCombine, but changing those would force a rebase of D44266 which if accepted would remove them.

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

llvm-svn: 327315

6 years ago[CallSiteSplitting] Use !Instruction::use_empty instead of checking for a non-zero...
Craig Topper [Mon, 12 Mar 2018 18:40:59 +0000 (18:40 +0000)]
[CallSiteSplitting] Use !Instruction::use_empty instead of checking for a non-zero return from getNumUses

getNumUses is a linear operation. It walks a linked list to get a count. So in this case its better to just ask if there are any users rather than how many.

llvm-svn: 327314

6 years ago[Driver] Add text description of --help-hidden so it is shown in help
Jan Korous [Mon, 12 Mar 2018 18:33:55 +0000 (18:33 +0000)]
[Driver] Add text description of --help-hidden so it is shown in help

llvm-svn: 327313

6 years ago[NFC] Replace iterators in PrintHelp with range-based for
Jan Korous [Mon, 12 Mar 2018 18:31:07 +0000 (18:31 +0000)]
[NFC] Replace iterators in PrintHelp with range-based for

llvm-svn: 327312

6 years ago[NFC] PrintHelp cleanup
Jan Korous [Mon, 12 Mar 2018 18:30:47 +0000 (18:30 +0000)]
[NFC] PrintHelp cleanup

llvm-svn: 327311

6 years ago[Hexagon] Fix typo in testcase
Krzysztof Parzyszek [Mon, 12 Mar 2018 18:29:47 +0000 (18:29 +0000)]
[Hexagon] Fix typo in testcase

llvm-svn: 327310

6 years ago[analyzer] Move the GCDAsyncSemaphoreChecker to optin.performance
George Karpenkov [Mon, 12 Mar 2018 18:27:36 +0000 (18:27 +0000)]
[analyzer] Move the GCDAsyncSemaphoreChecker to optin.performance

rdar://38383753

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

llvm-svn: 327309

6 years ago[Hexagon] Counting leading/trailing bits is cheap
Krzysztof Parzyszek [Mon, 12 Mar 2018 18:18:23 +0000 (18:18 +0000)]
[Hexagon] Counting leading/trailing bits is cheap

llvm-svn: 327308

6 years ago[PatternMatch, InstSimplify] allow undef elements when matching vector -0.0
Sanjay Patel [Mon, 12 Mar 2018 18:17:01 +0000 (18:17 +0000)]
[PatternMatch, InstSimplify] allow undef elements when matching vector -0.0

This is the FP equivalent of D42818. Use it for the few cases in InstSimplify
with -0.0 folds (that's the only current use of m_NegZero()).

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

llvm-svn: 327307

6 years ago[X86][Btver2] FSqrt/FDiv reg-reg instructions don't use the AGU.
Simon Pilgrim [Mon, 12 Mar 2018 18:12:46 +0000 (18:12 +0000)]
[X86][Btver2] FSqrt/FDiv reg-reg instructions don't use the AGU.

I love you llvm-mca.

llvm-svn: 327306

6 years agoupdate_mir_test_checks: Fix handling of IR input after r326284
Justin Bogner [Mon, 12 Mar 2018 18:06:58 +0000 (18:06 +0000)]
update_mir_test_checks: Fix handling of IR input after r326284

llvm-svn: 327305

6 years ago[libcxx][test] Adding apple-clang-9 to UNSUPPORTED in iter_alloc_deduction.fail.cpp.
Mike Edwards [Mon, 12 Mar 2018 18:06:37 +0000 (18:06 +0000)]
[libcxx][test] Adding apple-clang-9 to UNSUPPORTED in iter_alloc_deduction.fail.cpp.

After two failed attempts last week to make this work I am
going back to a known good method of making this test pass on
macOS...adding the current apple-clang version to the
UNSUPPORTED list.

During a previous patch review (https://reviews.llvm.org/D44103)
it was suggested to just XFAIL libcpp-no-deduction-guides
as was done to iter_alloc_deduction.pass.cpp. However
this caused a an unexpected pass on:
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc-tot-latest-std/builds/214

I then attempted to just mark libcpp-no-deduction-guides
as UNSUPPORTED, however this caused an additional bot
failure.  So I reverted everything (https://reviews.llvm.org/rCXX327191).

To solve this and get work unblocked I am adding
apple-clang-9 to the original UNSUPPORTED list.

llvm-svn: 327304

6 years ago[SelectionDAG] Improve handling of dangling debug info
Bjorn Pettersson [Mon, 12 Mar 2018 18:02:39 +0000 (18:02 +0000)]
[SelectionDAG] Improve handling of dangling debug info

Summary:
1) Make sure to discard dangling debug info if the variable (or
variable fragment) is mapped to something new before we had a
chance to resolve the dangling debug info.

2) When resolving debug info, make sure to bump the associated
SDNodeOrder to ensure that the DBG_VALUE is emitted after the
instruction that defines the value used in the DBG_VALUE.
This will avoid a debug-use before def scenario as seen in
https://bugs.llvm.org/show_bug.cgi?id=36417.

The new test case, test/DebugInfo/X86/sdag-dangling-dbgvalue.ll,
show some other limitations in how dangling debug info is
handled in the SelectionDAG. Since we currently only support
having one dangling dbg.value per Value, we will end up dropping
debug info when there are more than one variable that is described
by the same "dangling value".

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: aprantl, eraman, llvm-commits, JDevlieghere

Tags: #debug-info

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

llvm-svn: 327303

6 years ago[Hexagon] Subtarget feature to emit one instruction per packet
Krzysztof Parzyszek [Mon, 12 Mar 2018 17:47:46 +0000 (17:47 +0000)]
[Hexagon] Subtarget feature to emit one instruction per packet

This adds two features: "packets", and "nvj".

Enabling "packets" allows the compiler to generate instruction packets,
while disabling it will prevent it and disable all optimizations that
generate them. This feature is enabled by default on all subtargets.
The feature "nvj" allows the compiler to generate new-value jumps and it
implies "packets". It is enabled on all subtargets.

The exception is made for packets with endloop instructions, since they
require a certain minimum number of instructions in the packets to which
they apply. Disabling "packets" will not prevent hardware loops from
being generated.

llvm-svn: 327302

6 years ago[InstCombine] [NFC] Add tests for peeking through FP casts for sign-bit compares...
Roman Lebedev [Mon, 12 Mar 2018 17:43:02 +0000 (17:43 +0000)]
[InstCombine] [NFC] Add tests for peeking through FP casts for sign-bit compares (PR36682)

Summary:
This pattern came up in PR36682:
https://bugs.llvm.org/show_bug.cgi?id=36682
https://godbolt.org/g/LhuD9A

Tests for proposed fix in D44367.

Looking at the IR pattern in question, as per [[ https://github.com/rutgers-apl/alive-nj | alive-nj ]], for all the type combinations i checked
(input: `i16`, `i32`, `i64`; intermediate: `half`/`i16`, `float`/`i32`, `double`/`i64`)
for the following `icmp` comparisons the `sitofp`+`bitcast` can be dropped:
* `eq 0`
* `ne 0`
* `slt 0`
* `sle 0`
* `sge 0`
* `sgt 0`
* `slt 1`
* `sge 1`
* `sle -1`
* `sgt -1`
I did not check vectors, but i'm guessing it's the same there.
{F5887419}

Thus all these cases are in the testcase (along with the vector variant with additional `undef` element in the middle).
There are no negative patterns here (unless alive-nj lied/is broken), all of these should be optimized.

Generated with {F5887551}

Reviewers: spatel, majnemer, efriedma, arsenm

Reviewed By: spatel

Subscribers: nlopes, wdng, llvm-commits

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

llvm-svn: 327301

6 years ago[X86] Deleting README-MMX.txt now that all tasks have been completed.
Simon Pilgrim [Mon, 12 Mar 2018 17:29:54 +0000 (17:29 +0000)]
[X86] Deleting README-MMX.txt now that all tasks have been completed.

MMX buildvectors were improved at rL327247 - new MMX bugs should be raised on bugzilla

llvm-svn: 327300

6 years ago[AMDGPU][MC][GFX8] Added BUFFER_STORE_LDS_DWORD Instruction
Dmitry Preobrazhensky [Mon, 12 Mar 2018 17:29:24 +0000 (17:29 +0000)]
[AMDGPU][MC][GFX8] Added BUFFER_STORE_LDS_DWORD Instruction

See bug 36558: https://bugs.llvm.org/show_bug.cgi?id=36558

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

Reviewers: artem.tamazov, arsenm
llvm-svn: 327299

6 years ago[X86] Add all of the MRM_C0-MRM_FF forms to the switch in RecognizableInstr::emitInst...
Craig Topper [Mon, 12 Mar 2018 17:24:50 +0000 (17:24 +0000)]
[X86] Add all of the MRM_C0-MRM_FF forms to the switch in RecognizableInstr::emitInstructionSpecifier. NFC

Remove the special casing for MRM_F8 by using HANDLE_OPTIONAL.

This should be NFC as the forms that were missing aren't used by any instructions today. They exist in the enum so that we didn't have to put them in one at a time when instructions are added. But looks like we failed here.

llvm-svn: 327298

6 years ago[sanitizer] Align & pad the allocator structures to the cacheline size v2
Kostya Kortchinsky [Mon, 12 Mar 2018 17:18:26 +0000 (17:18 +0000)]
[sanitizer] Align & pad the allocator structures to the cacheline size v2

Summary:
This is a new version of D44261, which broke some builds with older gcc, as
they can't align on a constexpr, but rather require an integer (see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56859) among others.

We introduce `SANITIZER_CACHE_LINE_SIZE` in `sanitizer_platform.h` to be
used in `ALIGNED` attributes instead of using directly `kCacheLineSize`.

Reviewers: alekseyshl, thakis

Reviewed By: alekseyshl

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

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

llvm-svn: 327297

6 years ago[X86][Btver2] Prefix all scheduler defs. NFCI.
Simon Pilgrim [Mon, 12 Mar 2018 17:07:08 +0000 (17:07 +0000)]
[X86][Btver2] Prefix all scheduler defs. NFCI.

These are all global, so prefix with 'J' to help prevent accidental name clashes with other models.

llvm-svn: 327296

6 years agoReland "[clang-doc] Setup clang-doc frontend framework"
Julie Hockett [Mon, 12 Mar 2018 17:05:14 +0000 (17:05 +0000)]
Reland "[clang-doc] Setup clang-doc frontend framework"

There was a missing newline in the docs, and a static_assert that needed
to be a normal assert.

llvm-svn: 327295

6 years agoRevert "[ObjC] Allow declaring __weak pointer fields in C structs in
Akira Hatanaka [Mon, 12 Mar 2018 17:05:06 +0000 (17:05 +0000)]
Revert "[ObjC] Allow declaring __weak pointer fields in C structs in
ARC."

This reverts commit r327206 as there were test failures caused by this
patch.

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180312/221427.html

llvm-svn: 327294

6 years ago[clangd] Fix diagnostic errors in the test code, NFC.
Haojian Wu [Mon, 12 Mar 2018 16:49:24 +0000 (16:49 +0000)]
[clangd] Fix diagnostic errors in the test code, NFC.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, jkorous-apple, cfe-commits, ioeric

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

llvm-svn: 327293

6 years ago[X86] Remove use of MVT class from the ShuffleDecode library.
Craig Topper [Mon, 12 Mar 2018 16:43:11 +0000 (16:43 +0000)]
[X86] Remove use of MVT class from the ShuffleDecode library.

MVT belongs to the CodeGen layer, but ShuffleDecode is used by the X86 InstPrinter which is part of the MC layer. This only worked because MVT is completely implemented in a header file with no other library dependencies.

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

llvm-svn: 327292

6 years ago[AMDGPU] Fix lowering enqueue kernel when kernel has no name
Yaxun Liu [Mon, 12 Mar 2018 16:34:06 +0000 (16:34 +0000)]
[AMDGPU] Fix lowering enqueue kernel when kernel has no name

Since the enqueued kernels have internal linkage, their names may be dropped.
In this case, give them unique names __amdgpu_enqueued_kernel or
__amdgpu_enqueued_kernel.n where n is a sequential number starting from 1.

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

llvm-svn: 327291

6 years ago[WebAssembly] Add test for imported ctor and fix indexing bug found
Nicholas Wilson [Mon, 12 Mar 2018 16:04:04 +0000 (16:04 +0000)]
[WebAssembly] Add test for imported ctor and fix indexing bug found

This bug was found by accident while trying to expand out testcases
for imported symbols, and is covered by the additional test case.

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

llvm-svn: 327290

6 years ago[X86][Btver2] Extend JWriteResFpuPair to accept resource/uop counts. NFCI.
Simon Pilgrim [Mon, 12 Mar 2018 16:02:56 +0000 (16:02 +0000)]
[X86][Btver2] Extend JWriteResFpuPair to accept resource/uop counts. NFCI.

This allows the single resource classes (VarBlend, MPSAD, VarVecShift) to use the JWriteResFpuPair macro.

llvm-svn: 327289

6 years ago[AMDGPU][MC][DOC] Updated AMD GPU assembler description
Dmitry Preobrazhensky [Mon, 12 Mar 2018 15:55:08 +0000 (15:55 +0000)]
[AMDGPU][MC][DOC] Updated AMD GPU assembler description

See bug 36572: https://bugs.llvm.org/show_bug.cgi?id=36572

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

Reviewers: artem.tamazov, vpykhtin
llvm-svn: 327288

6 years ago[InstSimplify] add test for m_NegZero with undef elt; NFC
Sanjay Patel [Mon, 12 Mar 2018 15:47:32 +0000 (15:47 +0000)]
[InstSimplify] add test for m_NegZero with undef elt; NFC

llvm-svn: 327287

6 years ago[WebAssembly] Reorder synthetic functions to come first
Nicholas Wilson [Mon, 12 Mar 2018 15:44:07 +0000 (15:44 +0000)]
[WebAssembly] Reorder synthetic functions to come first

This matches the existing ordering that's been there for globals
for a while (__stack_pointer coming first).

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

llvm-svn: 327286

6 years ago[clang-format] Improve detection of Objective-C block types
Ben Hamilton [Mon, 12 Mar 2018 15:42:40 +0000 (15:42 +0000)]
[clang-format] Improve detection of Objective-C block types

Summary:
Previously, clang-format would detect the following as an
Objective-C block type:

  FOO(^);

when it actually must be a C or C++ macro dealing with an XOR
statement or an XOR operator overload.

According to the Clang Block Language Spec:

https://clang.llvm.org/docs/BlockLanguageSpec.html

block types are of the form:

  int (^)(char, float)

and block variables of block type are of the form:

  void (^blockReturningVoidWithVoidArgument)(void);
  int (^blockReturningIntWithIntAndCharArguments)(int, char);
  void (^arrayOfTenBlocksReturningVoidWithIntArgument[10])(int);

This tightens up the detection so we don't unnecessarily detect
C macros which pass in the XOR operator.

Depends On D43904

Test Plan: New tests added. Ran tests with:
  make -j12 FormatTests &&
  ./tools/clang/unittests/Format/FormatTests

Reviewers: krasimir, jolesiak, djasper

Reviewed By: djasper

Subscribers: djasper, cfe-commits, klimek

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

llvm-svn: 327285

6 years ago[clang-format] Don't detect C++11 attribute specifiers as ObjC
Ben Hamilton [Mon, 12 Mar 2018 15:42:38 +0000 (15:42 +0000)]
[clang-format] Don't detect C++11 attribute specifiers as ObjC

Summary:
Previously, clang-format would detect C++11 and C++17 attribute
specifiers like the following as Objective-C method invocations:

  [[noreturn]];
  [[clang::fallthrough]];
  [[noreturn, deprecated("so sorry")]];
  [[using gsl: suppress("type")]];

To fix this, I ported part of the logic from
tools/clang/lib/Parse/ParseTentative.cpp into TokenAnnotator.cpp so we
can explicitly parse and identify C++11 attribute specifiers.

This allows the guessLanguage() and getStyle() APIs to correctly
guess files containing the C++11 attribute specifiers as C++,
not Objective-C.

Test Plan: New tests added. Ran tests with:
  make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: krasimir, jolesiak, djasper

Reviewed By: djasper

Subscribers: aaron.ballman, cfe-commits, klimek

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

llvm-svn: 327284

6 years ago[X86][Btver2] Use JWriteResFpuPair wrapper for AES/CLMUL/HADD scheduler cases. NFCI.
Simon Pilgrim [Mon, 12 Mar 2018 15:29:00 +0000 (15:29 +0000)]
[X86][Btver2] Use JWriteResFpuPair wrapper for AES/CLMUL/HADD scheduler cases. NFCI.

These are single pipe and have the default resource/uop counts like JWriteResFpuPair so there's no need to handle them separately.

llvm-svn: 327283

6 years ago[clangd] Revamp handling of diagnostics.
Ilya Biryukov [Mon, 12 Mar 2018 15:28:22 +0000 (15:28 +0000)]
[clangd] Revamp handling of diagnostics.

Summary:
The new implementation attaches notes to diagnostic message and shows
the original diagnostics in the message of the note.

Reviewers: hokein, ioeric, sammccall

Reviewed By: sammccall

Subscribers: klimek, mgorny, cfe-commits, jkorous-apple

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

llvm-svn: 327282

6 years ago[Hexagon] Add REQUIRES: asserts to testcases that use -stats
Krzysztof Parzyszek [Mon, 12 Mar 2018 15:20:36 +0000 (15:20 +0000)]
[Hexagon] Add REQUIRES: asserts to testcases that use -stats

llvm-svn: 327281

6 years ago[ELF] - Formatted comment, fixed mistype. NFC.
George Rimar [Mon, 12 Mar 2018 15:18:35 +0000 (15:18 +0000)]
[ELF] - Formatted comment, fixed mistype. NFC.

llvm-svn: 327280

6 years ago[Hexagon] Add REQUIRES: asserts to testcases that use -debug-only
Krzysztof Parzyszek [Mon, 12 Mar 2018 15:11:16 +0000 (15:11 +0000)]
[Hexagon] Add REQUIRES: asserts to testcases that use -debug-only

llvm-svn: 327279

6 years ago[AMDGPU][MC] Corrected GATHER4 opcodes
Dmitry Preobrazhensky [Mon, 12 Mar 2018 15:03:34 +0000 (15:03 +0000)]
[AMDGPU][MC] Corrected GATHER4 opcodes

See bug 36252: https://bugs.llvm.org/show_bug.cgi?id=36252

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

Reviewers: artem.tamazov, arsenm
llvm-svn: 327278

6 years ago[llvm-readobj] Make header self-contained
Benjamin Kramer [Mon, 12 Mar 2018 15:02:59 +0000 (15:02 +0000)]
[llvm-readobj] Make header self-contained

Patch by Dean Sturtevant!

llvm-svn: 327277

6 years agoUpdating MIR Language Reference to include new syntax for symbols and physregs.
Puyan Lotfi [Mon, 12 Mar 2018 14:51:19 +0000 (14:51 +0000)]
Updating MIR Language Reference to include new syntax for symbols and physregs.

External symbols now get the sigil '&' while physical registers get the sigil
'$' for their prefix.

llvm-svn: 327276

6 years ago[clangd] Collect the number of files referencing a symbol in the static index.
Sam McCall [Mon, 12 Mar 2018 14:49:09 +0000 (14:49 +0000)]
[clangd] Collect the number of files referencing a symbol in the static index.

Summary:
This is an important ranking signal.
It's off for the dynamic index for now. Correspondingly, tell the index
infrastructure only to report declarations for the dynamic index.

Reviewers: ioeric, hokein

Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits

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

llvm-svn: 327275

6 years ago[DebugInfo] Replace unreachable with None
Jonas Devlieghere [Mon, 12 Mar 2018 14:45:08 +0000 (14:45 +0000)]
[DebugInfo] Replace unreachable with None

Invalid user input should not trigger assertions and unreachables. We
already return an Option so we should just return None here.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5532

llvm-svn: 327274

6 years ago[Hexagon] fix 'must explicitly initialize the const member' error which clang 3.8...
Sam McCall [Mon, 12 Mar 2018 14:40:48 +0000 (14:40 +0000)]
[Hexagon] fix 'must explicitly initialize the const member' error which clang 3.8 emits

llvm-svn: 327273

6 years ago[ELF] - Removed excessive lookup. NFC.
George Rimar [Mon, 12 Mar 2018 14:15:38 +0000 (14:15 +0000)]
[ELF] - Removed excessive lookup. NFC.

llvm-svn: 327272

6 years ago[Hexagon] Add more lit tests
Krzysztof Parzyszek [Mon, 12 Mar 2018 14:01:28 +0000 (14:01 +0000)]
[Hexagon] Add more lit tests

llvm-svn: 327271

6 years ago[analyzer] Trying to fix Windows buildbots after r327258
Maxim Ostapenko [Mon, 12 Mar 2018 13:44:19 +0000 (13:44 +0000)]
[analyzer] Trying to fix Windows buildbots after r327258

llvm-svn: 327270

6 years agoAMDGPU/GlobalISel: Legality and RegBankInfo for G_{INSERT|EXTRACT}_VECTOR_ELT
Matt Arsenault [Mon, 12 Mar 2018 13:35:53 +0000 (13:35 +0000)]
AMDGPU/GlobalISel: Legality and RegBankInfo for G_{INSERT|EXTRACT}_VECTOR_ELT

llvm-svn: 327269

6 years agoAMDGPU/GlobalISel: InstrMapping for G_MERGE_VALUES
Matt Arsenault [Mon, 12 Mar 2018 13:35:49 +0000 (13:35 +0000)]
AMDGPU/GlobalISel: InstrMapping for G_MERGE_VALUES

llvm-svn: 327268

6 years agoAMDGPU/GlobalISel: Make some G_MERGE_VALUEs legal
Matt Arsenault [Mon, 12 Mar 2018 13:35:43 +0000 (13:35 +0000)]
AMDGPU/GlobalISel: Make some G_MERGE_VALUEs legal

llvm-svn: 327267

6 years agoRevert r326710 "Fuzzer: remove temporary files after we're done with them."
Hans Wennborg [Mon, 12 Mar 2018 13:22:12 +0000 (13:22 +0000)]
Revert r326710 "Fuzzer: remove temporary files after we're done with them."

This broke some Windows buildbots; see llvm-commits thread.

> These were just copies of the relevant fuzzer binary with (presumably)
> meaningful suffixes, but accounted for more than 10% of my build
> directory (> 8GB). Hard drive space is cheap, but not that cheap.

(Also reverts follow-up r326710 which didn't help.)

llvm-svn: 327266

6 years ago[mips] Split out ASEPredicate from InsnPredicates (NFC)
Simon Dardis [Mon, 12 Mar 2018 13:16:12 +0000 (13:16 +0000)]
[mips] Split out ASEPredicate from InsnPredicates (NFC)

This simplifies tagging instructions with the correct ISA and ASE, albeit making
instruction definitions a bit more verbose.

Reviewers: atanasyan, abeserminji

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

llvm-svn: 327265

6 years agoUpdate the supported C language standards in the user manual.
Aaron Ballman [Mon, 12 Mar 2018 13:09:13 +0000 (13:09 +0000)]
Update the supported C language standards in the user manual.

Remove mention of -std=c94 (it is spelled iso9899:1994, not c94) and add mention of -std=c17 and -std=gnu17.

llvm-svn: 327264

6 years ago[analyzer] Trying to fix buildbots after r327258
Maxim Ostapenko [Mon, 12 Mar 2018 13:07:54 +0000 (13:07 +0000)]
[analyzer] Trying to fix buildbots after r327258

llvm-svn: 327263

6 years agoMC intel asm parser: Allow @ at the start of function names.
Nico Weber [Mon, 12 Mar 2018 12:47:27 +0000 (12:47 +0000)]
MC intel asm parser: Allow @ at the start of function names.

Ports parts of r193000 to the intel parser. Fixes part of PR36676.

https://reviews.llvm.org/D44359

llvm-svn: 327262

6 years agoMake lld-link shout at me less.
Nico Weber [Mon, 12 Mar 2018 12:45:40 +0000 (12:45 +0000)]
Make lld-link shout at me less.

This makes the output of some flag names in warning messages consistent with
the output of /? and the output of flags in most other diagnostics.

https://reviews.llvm.org/D44307

llvm-svn: 327261

6 years ago[ELF] - Change consume()->expect() in INSERT AFTER parsing.
George Rimar [Mon, 12 Mar 2018 12:34:43 +0000 (12:34 +0000)]
[ELF] - Change consume()->expect() in INSERT AFTER parsing.

AFTER keyword is mandatory and consume() was
used by mistake here. We accepted broken script before
this patch, testcase shows the issue.

llvm-svn: 327260

6 years ago[X86][SSE] createVariablePermute - PSHUFB requires SSSE3 not just SSE3
Simon Pilgrim [Mon, 12 Mar 2018 12:30:04 +0000 (12:30 +0000)]
[X86][SSE] createVariablePermute - PSHUFB requires SSSE3 not just SSE3

llvm-svn: 327259

6 years ago[analyzer] Add scope information to CFG
Maxim Ostapenko [Mon, 12 Mar 2018 12:26:15 +0000 (12:26 +0000)]
[analyzer] Add scope information to CFG

This patch adds two new CFG elements CFGScopeBegin and CFGScopeEnd that indicate
when a local scope begins and ends respectively. We use first VarDecl declared
in a scope to uniquely identify it and add CFGScopeBegin and CFGScopeEnd elements
into corresponding basic blocks.

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

llvm-svn: 327258

6 years ago[lld-link] For suppressible warnings, print the warning number.
Nico Weber [Mon, 12 Mar 2018 12:04:17 +0000 (12:04 +0000)]
[lld-link] For suppressible warnings, print the warning number.

The warning can be suppressed by passing the number to /ignore:.
https://reviews.llvm.org/D44297

llvm-svn: 327257

6 years agoFix compilation on Darwin with expensive checks.
Jonas Devlieghere [Mon, 12 Mar 2018 11:01:05 +0000 (11:01 +0000)]
Fix compilation on Darwin with expensive checks.

After r327219 was landed, the bot with expensive checks on GreenDragon
started failing. The problem was missing symbols `regex_t` and
`regmatch_t` in `xlocale/_regex.h`. The latter was included because
after the change in r327219, `random` is needed, which transitively
includes `xlocale.h.` which in turn conditionally includes
`xlocale/_regex.h` when _REGEX_H_ is defined. Because this is the header
guard in `regex_impl.h` and because `regex_impl.h` was included before
the other LLVM includes, `xlocale/_regex.h` was included without the
necessary types being available.

This commit fixes this by moving the include of `regex_impl.h` all the
way down. I also added a comment to stress the significance of its
position.

llvm-svn: 327256

6 years agoclang-format: Properly handle implicit string concatenation in text protos
Daniel Jasper [Mon, 12 Mar 2018 10:32:18 +0000 (10:32 +0000)]
clang-format: Properly handle implicit string concatenation in text protos

Three issues to fix:
- char_constants weren't properly treated as string literals
- Prevening the break after "label: " does not make sense in concunction
  with AlwaysBreakBeforeMultilineStrings. It leads to situations where
  clang-format just cannot find a viable format (it must break and yet
  it must not break).
- AlwaysBreakBeforeMultilineStrings should not be on for LK_TextProto in
  Google style.

llvm-svn: 327255

6 years ago[ThinLTO] Recommit of import global variables
Eugene Leviant [Mon, 12 Mar 2018 10:30:50 +0000 (10:30 +0000)]
[ThinLTO] Recommit of import global variables

This wasreverted in r326638 due to link problems and fixed
afterwards

llvm-svn: 327254

6 years agoDon't re-format raw string literal contents when formatting is disable
Daniel Jasper [Mon, 12 Mar 2018 10:11:30 +0000 (10:11 +0000)]
Don't re-format raw string literal contents when formatting is disable

Not entirely sure this is the best place to put this check, but it fixes
the immediate issue.

llvm-svn: 327253

6 years agoBack out "Re-land: Teach CorrelatedValuePropagation to reduce the width of udiv/urem...
Justin Lebar [Mon, 12 Mar 2018 09:26:09 +0000 (09:26 +0000)]
Back out "Re-land: Teach CorrelatedValuePropagation to reduce the width of udiv/urem instructions."

This reverts r326908, originally landed as D44102.

Reverted for causing performance regressions on x86.  (These regressions
are not yet understood.)

llvm-svn: 327252

6 years ago[X86] Don't compute known bits twice for the same SDValue in LowerMUL.
Craig Topper [Mon, 12 Mar 2018 05:35:02 +0000 (05:35 +0000)]
[X86] Don't compute known bits twice for the same SDValue in LowerMUL.

We called MaskedValueIsZero with two different masks, but underneath that calls computeKnownBits before applying the mask. This means we compute the same known bits twice due to the two calls. Instead just call computeKnownBits directly and apply the two masks ourselves.

llvm-svn: 327251

6 years ago[CGP] Fix the remove of matched phis in complex addressing mode
Serguei Katkov [Mon, 12 Mar 2018 03:50:07 +0000 (03:50 +0000)]
[CGP] Fix the remove of matched phis in complex addressing mode

When we replace the Phi we created with matched ones it is possible that
there are two identical phi nodes in IR. And matcher is smart enough to find that
new created phi matches both of them. So we try to replace our phi node with
matched ones twice and what is bad we delete our phi node twice causing a crash.

As soon as we found that we have two identical Phi nodes it makes sense to do
a clean-up and replace one phi node by other one.
The patch implements it.

Reviewers: john.brawn, reames
Reviewed By: john.brawn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D43758

llvm-svn: 327250

6 years ago[Driver] Update the comment about incompatible sanitizers
Petr Hosek [Mon, 12 Mar 2018 00:23:37 +0000 (00:23 +0000)]
[Driver] Update the comment about incompatible sanitizers

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

llvm-svn: 327249

6 years agoFor most Targets the _GLOBAL_OFFSET_TABLE_ symbol is expected to be at
Peter Smith [Sun, 11 Mar 2018 20:58:18 +0000 (20:58 +0000)]
For most Targets the _GLOBAL_OFFSET_TABLE_ symbol is expected to be at
the start of the .got.plt section so that _GLOBAL_OFFSET_TABLE_[0] =
reserved value that is by convention the address of the dynamic section.
Previously we had defined _GLOBAL_OFFSET_TABLE_ as either the start or end
of the .got section with the intention that the .got.plt section would
follow the .got. However this does not always hold with the current
default section ordering so _GLOBAL_OFFSET_TABLE_[0] may not be consistent
with the reserved first entry of the .got.plt.

X86, X86_64, Arm and AArch64 will use the .got.plt. Mips and Power use .got

Fixes PR36555

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

llvm-svn: 327248

6 years ago[X86][MMX] Support MMX build vectors to avoid SSE usage (PR29222)
Simon Pilgrim [Sun, 11 Mar 2018 19:22:13 +0000 (19:22 +0000)]
[X86][MMX] Support MMX build vectors to avoid SSE usage (PR29222)

64-bit MMX vector generation usually ends up lowering into SSE instructions before being spilled/reloaded as a MMX type.

This patch creates a MMX vector from MMX source values, taking the lowest element from each source and constructing broadcasts/build_vectors with direct calls to the MMX PUNPCKL/PSHUFW intrinsics.

We're missing a few consecutive load combines that could be handled in a future patch if that would be useful - my main interest here is just avoiding a lot of the MMX/SSE crossover.

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

llvm-svn: 327247

6 years ago[X86][AVX512] Added more non-VLX test cases
Simon Pilgrim [Sun, 11 Mar 2018 18:28:37 +0000 (18:28 +0000)]
[X86][AVX512] Added more non-VLX test cases

Cleaned up check prefixes so that they actually share a bit more

llvm-svn: 327246

6 years ago[X86][AVX] createVariablePermute - scale v16i16 variable permutes to use v32i8 codegen
Simon Pilgrim [Sun, 11 Mar 2018 17:23:54 +0000 (17:23 +0000)]
[X86][AVX] createVariablePermute - scale v16i16 variable permutes to use v32i8 codegen

XOP was already doing this, and now AVX performs v32i8 variable permutes as well.

llvm-svn: 327245

6 years ago[X86][AVX] createVariablePermute - widen permutes for cases where the source vector...
Simon Pilgrim [Sun, 11 Mar 2018 17:00:46 +0000 (17:00 +0000)]
[X86][AVX] createVariablePermute - widen permutes for cases where the source vector is wider than the destination type

llvm-svn: 327244

6 years ago[InstCombine] add tests for casted sign-bit cmp (PR36682); NFC
Sanjay Patel [Sun, 11 Mar 2018 16:45:31 +0000 (16:45 +0000)]
[InstCombine] add tests for casted sign-bit cmp (PR36682); NFC

llvm-svn: 327243

6 years ago[X86][AVX] createVariablePermute - use PSHUFB+PCMPGT+SELECT for v32i8 variable permutes
Simon Pilgrim [Sun, 11 Mar 2018 16:28:11 +0000 (16:28 +0000)]
[X86][AVX] createVariablePermute - use PSHUFB+PCMPGT+SELECT for v32i8 variable permutes

Same as the VPERMILPS/VPERMILPD approach for v8f32/v4f64 cases, rely on PSHUFB using bits[3:0] for indexing - we can ignore the sign bit (zero element) as those index vector values are considered undefined. The select between the lo/hi permute results based on the index size.

llvm-svn: 327242

6 years agoFix for buildbots which didn't like makeArrayRef with initializer lists.
Simon Pilgrim [Sun, 11 Mar 2018 14:31:55 +0000 (14:31 +0000)]
Fix for buildbots which didn't like makeArrayRef with initializer lists.

llvm-svn: 327241

6 years ago[X86][SSE] Generalized SplitBinaryOpsAndApply to SplitOpsAndApply to support any...
Simon Pilgrim [Sun, 11 Mar 2018 14:04:53 +0000 (14:04 +0000)]
[X86][SSE] Generalized SplitBinaryOpsAndApply to SplitOpsAndApply to support any number of ops.

I've kept SplitBinaryOpsAndApply as a wrapper to avoid a lot of makeArrayRef code.

llvm-svn: 327240

6 years ago[X86][AVX] createVariablePermute - use 2xVPERMIL+PCMPGT+SELECT for v8i32/v8f32 and...
Simon Pilgrim [Sun, 11 Mar 2018 11:52:26 +0000 (11:52 +0000)]
[X86][AVX] createVariablePermute - use 2xVPERMIL+PCMPGT+SELECT for v8i32/v8f32 and v4i64/v4f64 variable permutes

As VPERMILPS/VPERMILPD only selects elements based on the bits[1:0]/bit[1] then we can permute both the (repeated) lo/hi 128-bit vectors in each case and then select between these results based on whether the index was for for lo/hi.

For v4i64/v4f64 this avoids some rather nasty v4i64 multiples on the AVX2 implementation, which seems to be worse than the extra port5 pressure from the additional shuffles/blends.

llvm-svn: 327239

6 years ago[X86][AVX512] createVariablePermute - Non-VLX targets can widen v4i64/v8f64 variable...
Simon Pilgrim [Sun, 11 Mar 2018 11:19:19 +0000 (11:19 +0000)]
[X86][AVX512] createVariablePermute - Non-VLX targets can widen v4i64/v8f64 variable permutes to v8i64/v8f64

Permutes in the upper elements will be undefined, but they will be discarded anyway.

llvm-svn: 327238

6 years agofix a typo on the website
Sylvestre Ledru [Sun, 11 Mar 2018 10:53:40 +0000 (10:53 +0000)]
fix a typo on the website

llvm-svn: 327237

6 years ago[x86][SSE] Add widenSubVector helper. NFCI.
Simon Pilgrim [Sun, 11 Mar 2018 10:50:48 +0000 (10:50 +0000)]
[x86][SSE] Add widenSubVector helper. NFCI.

Helper function to insert a subvector into the bottom elements of a larger zero/undef vector with the same scalar type.

I've converted a couple of INSERT_SUBVECTOR calls to use it, there are plenty more although in some cases I was worried it might make the code more ambiguous.

llvm-svn: 327236

6 years ago[MemorySSA] Fix comment + remove redundant dyn_casts; NFC
George Burgess IV [Sun, 11 Mar 2018 04:16:12 +0000 (04:16 +0000)]
[MemorySSA] Fix comment + remove redundant dyn_casts; NFC

StartingAccess is already a MemoryUseOrDef.

llvm-svn: 327235

6 years agoTest commit - change comment slightly.
Michael Bedy [Sun, 11 Mar 2018 03:27:50 +0000 (03:27 +0000)]
Test commit - change comment slightly.

llvm-svn: 327234

6 years agoAdd REQUIRES: arm-registered-target to test using an arm-apple-ios triple.
Nico Weber [Sun, 11 Mar 2018 03:17:34 +0000 (03:17 +0000)]
Add REQUIRES: arm-registered-target to test using an arm-apple-ios triple.

Else, the test fails in LLVM_TARGETS_TO_BUILD=X86 builds like so:
bin/llvm-mc: : error: unable to get target for 'arm64-apple-ios7.0.0'

llvm-svn: 327233

6 years ago[WebAssembly] Improve logging and comments around relocations. NFC.
Sam Clegg [Sun, 11 Mar 2018 01:35:02 +0000 (01:35 +0000)]
[WebAssembly] Improve logging and comments around relocations. NFC.

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

llvm-svn: 327232

6 years ago[TargetSchedule] Minor refactor in computeInstrLatency. NFC
Andrea Di Biagio [Sun, 11 Mar 2018 00:51:33 +0000 (00:51 +0000)]
[TargetSchedule] Minor refactor in computeInstrLatency. NFC

The intent of revision r300311 was to add a check for invalid scheduling class
descriptors. However, it ended up adding a redundant call in a basic block that
should not be reachable.

llvm-svn: 327231

6 years agoRevert r327199: "Clean up a temp file on the buildbots"
George Burgess IV [Sat, 10 Mar 2018 23:22:46 +0000 (23:22 +0000)]
Revert r327199: "Clean up a temp file on the buildbots"

"I'll revert this tomorrow," I said yesterday. This should've reached
all the bots it can by now.

llvm-svn: 327230

6 years ago[CodeGen] Eagerly emit lifetime.end markers for calls
George Burgess IV [Sat, 10 Mar 2018 23:06:31 +0000 (23:06 +0000)]
[CodeGen] Eagerly emit lifetime.end markers for calls

In C, we'll wait until the end of the scope to clean up aggregate
temporaries used for returns from calls. This means in cases like:

{
  // Assuming that `Bar` is large enough to warrant indirect returns
  struct Bar b = {};
  b = foo(&b);
  b = foo(&b);
  b = foo(&b);
  b = foo(&b);
}

...We'll allocate space for 5 Bars on the stack (`b`, and 4
temporaries). This becomes painful in things like large switch
statements.

If cleaning up sooner is trivial, we should do it.

llvm-svn: 327229

6 years ago[demangler] Simplify printing of structured bindings.
Erik Pilkington [Sat, 10 Mar 2018 22:33:49 +0000 (22:33 +0000)]
[demangler] Simplify printing of structured bindings.

Thanks to Richard Smith for the post-commit review!

llvm-svn: 327228

6 years ago[demangler] Support for sequence numbers on lifetime extended temporaries.
Erik Pilkington [Sat, 10 Mar 2018 21:31:22 +0000 (21:31 +0000)]
[demangler] Support for sequence numbers on lifetime extended temporaries.

llvm-svn: 327227

6 years ago[demangler] Support for structured bindings.
Erik Pilkington [Sat, 10 Mar 2018 21:31:15 +0000 (21:31 +0000)]
[demangler] Support for structured bindings.

llvm-svn: 327226

6 years ago[X86] Add comments to the end of FMA3 instructions to make the operation clear
Craig Topper [Sat, 10 Mar 2018 21:30:46 +0000 (21:30 +0000)]
[X86] Add comments to the end of FMA3 instructions to make the operation clear

Summary:
There are 3 different operand orders for FMA instructions so figuring out the exact operation being performed requires a lot of thought.

This patch adds a comment to the end of the assembly line to print the exact operation.

I think I've got all the instructions in here except the ones with builtin rounding.

I didn't update all tests, but I assume we can get them as we regenerate tests in the future.

Reviewers: spatel, v_klochkov, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 327225

6 years ago[lldb] Unbreak lldb builds due to r327219
Mandeep Singh Grang [Sat, 10 Mar 2018 21:13:55 +0000 (21:13 +0000)]
[lldb] Unbreak lldb builds due to r327219

Summary:
r327219 adds wrappers to sort which shuffle the container before sorting.
This causes lldb bots to break as the call to sort is now ambiguous:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/20725/steps/ninja%20build%20local/logs/stdio

So we need use llvm::sort instead of sort to avoid ambiguity with std::sort.

Note: This patch is just to unbreak the bots. I plan to have subsequent patches which will convert all
calls to std::sort to llvm::sort.

Reviewers: RKSimon, k8stone, jingham, labath, zturner

Subscribers: andreadb, lldb-commits

Tags: #lldb

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

llvm-svn: 327224

6 years ago[llvm-mca] Fix use-of-uninitialized-value error reported by the MemorySanitizer.
Andrea Di Biagio [Sat, 10 Mar 2018 20:52:59 +0000 (20:52 +0000)]
[llvm-mca] Fix use-of-uninitialized-value error reported by the MemorySanitizer.

This should make the buildbots green again.

llvm-svn: 327223