platform/upstream/llvm.git
6 years agoUndo accidental commit
Philip Reames [Tue, 31 Oct 2017 00:04:09 +0000 (00:04 +0000)]
Undo accidental commit

These files shouldn't have been submitted in 316967

llvm-svn: 316968

6 years ago[CGP] Fix crash on i96 bit multiply
Philip Reames [Mon, 30 Oct 2017 23:59:51 +0000 (23:59 +0000)]
[CGP] Fix crash on i96 bit multiply

Issue found by llvm-isel-fuzzer on OSS fuzz, https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3725

If anyone actually cares about > 64 bit arithmetic, there's a lot more to do in this area.  There's a bunch of obviously wrong code in the same function.  I don't have the time to fix all of them and am just using this to understand what the workflow for fixing fuzzer cases might look like.

llvm-svn: 316967

6 years agoTypo correct the condition of 'do-while' before exiting its scope
Alex Lorenz [Mon, 30 Oct 2017 22:55:11 +0000 (22:55 +0000)]
Typo correct the condition of 'do-while' before exiting its scope

rdar://35172419

llvm-svn: 316966

6 years ago[modules] Retain multiple using-directives in the same scope even if they name the...
Richard Smith [Mon, 30 Oct 2017 22:38:20 +0000 (22:38 +0000)]
[modules] Retain multiple using-directives in the same scope even if they name the same namespace.

They might have different visibility, and thus discarding all but one of them
can result in rejecting valid code. Also fix name lookup to cope with multiple
using-directives being found that denote the same namespace, where some are not
visible -- don't cache an "already visited" state for a using-directive that we
didn't visit because it was hidden.

llvm-svn: 316965

6 years agoFix unused variable warnings. NFCI.
Simon Pilgrim [Mon, 30 Oct 2017 22:38:07 +0000 (22:38 +0000)]
Fix unused variable warnings. NFCI.

llvm-svn: 316964

6 years ago[analyzer] Use the same filename for the header and the implementation of BugReporter...
George Karpenkov [Mon, 30 Oct 2017 22:31:57 +0000 (22:31 +0000)]
[analyzer] Use the same filename for the header and the implementation of BugReporterVisitor

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

llvm-svn: 316963

6 years ago[SelectionDAG] Tidyup computeKnownBits extension/truncation cases. NFCI.
Simon Pilgrim [Mon, 30 Oct 2017 22:23:57 +0000 (22:23 +0000)]
[SelectionDAG] Tidyup computeKnownBits extension/truncation cases. NFCI.

We don't need to extend/truncate the Known structure before calling computeKnownBits - it will reset at the start of the function.

llvm-svn: 316962

6 years agoGive .note.gnu.build-id section alignment 4
Jake Ehrlich [Mon, 30 Oct 2017 22:08:11 +0000 (22:08 +0000)]
Give .note.gnu.build-id section alignment 4

All SHT_NOTE sections should have minimum alignment 4.

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

llvm-svn: 316961

6 years ago[AArch64]: range loopify frame-lowering
Javed Absar [Mon, 30 Oct 2017 22:00:06 +0000 (22:00 +0000)]
[AArch64]: range loopify frame-lowering

llvm-svn: 316960

6 years ago[sanitizer][Fuchsia] Add a missing semicolon
Petr Hosek [Mon, 30 Oct 2017 21:29:26 +0000 (21:29 +0000)]
[sanitizer][Fuchsia] Add a missing semicolon

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

llvm-svn: 316959

6 years agoFix -fuse-ld feature detection error.
Rui Ueyama [Mon, 30 Oct 2017 21:19:54 +0000 (21:19 +0000)]
Fix -fuse-ld feature detection error.

check_cxx_compiler_flag doesn't seem to try to link a program, so
the existing code doesn't correctly detect the availability of a given
linker.  This patch uses check_cxx_source_compiles instead.

I confirmed that cmake now reports this error

  Host compiler does not support '-fuse-ld=foo'

for -DLLVM_USE_LINKER=foo.

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

llvm-svn: 316958

6 years agoInferAddressSpaces: Fix bug about replacing addrspacecast
Yaxun Liu [Mon, 30 Oct 2017 21:19:41 +0000 (21:19 +0000)]
InferAddressSpaces: Fix bug about replacing addrspacecast

InferAddressSpaces assumes the pointee type of addrspacecast
is the same as the operand, which is not always true and causes
invalid IR.

This bug cause build failure in HCC.

This patch fixes that.

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

llvm-svn: 316957

6 years ago[CMake] Fix linker detection in AddLLVM.cmake
Tim Shen [Mon, 30 Oct 2017 21:12:14 +0000 (21:12 +0000)]
[CMake] Fix linker detection in AddLLVM.cmake

Fix linker not being correctly detected when a custom one is specified
through LLVM_USE_LINKER CMake variable.

In particular,

  cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold ../llvm

resulted into

  Linker detection: GNU ld

instead of

  Linker detection: GNU Gold

due to the construction not accounting for such variable. It led to the general
confusion and prevented setting linker-specific flags inside functions defined
in AddLLVM.cmake.

Thanks Oleksii Vilchanskyi for the patch!

llvm-svn: 316956

6 years ago[X86] Add AVX512 support to fast isel's X86ChooseCmpOpcode.
Craig Topper [Mon, 30 Oct 2017 21:09:19 +0000 (21:09 +0000)]
[X86] Add AVX512 support to fast isel's X86ChooseCmpOpcode.

llvm-svn: 316955

6 years agoRemove a stray space.
Jim Ingham [Mon, 30 Oct 2017 20:44:45 +0000 (20:44 +0000)]
Remove a stray space.

llvm-svn: 316954

6 years ago[NewGVN] Stop assuming PHI args ordering when looking at phi-of-ops.
Davide Italiano [Mon, 30 Oct 2017 20:20:16 +0000 (20:20 +0000)]
[NewGVN] Stop assuming PHI args ordering when looking at phi-of-ops.

It's not guaranteed. There's a bug open to sort them in predecessor
order, but it won't happen anytime soon. In the meanwhile, passes
will have to do an O(#preds) scan. Such is life.

llvm-svn: 316953

6 years agoRevert "[PowerPC] Try to simplify a Swap if it feeds a Splat"
Stefan Pintilie [Mon, 30 Oct 2017 19:55:38 +0000 (19:55 +0000)]
Revert "[PowerPC] Try to simplify a Swap if it feeds a Splat"

Revert r316478.
A test case has failed.
Will recommit this change once we find and fix the failure.

This reverts commit 7c330fabaedaba3d02c58bc3cc1198896c895f34.

llvm-svn: 316952

6 years agoAdd more fuzzing bits: partial_sort_copy, partition_copy, unique, unique_copy. No...
Marshall Clow [Mon, 30 Oct 2017 19:51:58 +0000 (19:51 +0000)]
Add more fuzzing bits: partial_sort_copy, partition_copy, unique, unique_copy. No functional change to libc++; this is all test infastructure

llvm-svn: 316951

6 years agoCreate instruction classes for identifying any atomicity of memory intrinsic. (NFC)
Daniel Neilson [Mon, 30 Oct 2017 19:51:48 +0000 (19:51 +0000)]
Create instruction classes for identifying any atomicity of memory intrinsic. (NFC)

Summary:
For reference, see: http://lists.llvm.org/pipermail/llvm-dev/2017-August/116589.html

This patch fleshes out the instruction class hierarchy with respect to atomic and
non-atomic memory intrinsics. With this change, the relevant part of the class
hierarchy becomes:

IntrinsicInst
  -> MemIntrinsicBase (methods-only class)
    -> MemIntrinsic (non-atomic intrinsics)
      -> MemSetInst
      -> MemTransferInst
        -> MemCpyInst
        -> MemMoveInst
    -> AtomicMemIntrinsic (atomic intrinsics)
      -> AtomicMemSetInst
      -> AtomicMemTransferInst
        -> AtomicMemCpyInst
        -> AtomicMemMoveInst
    -> AnyMemIntrinsic (both atomicities)
      -> AnyMemSetInst
      -> AnyMemTransferInst
        -> AnyMemCpyInst
        -> AnyMemMoveInst

This involves some class renaming:
    ElementUnorderedAtomicMemCpyInst -> AtomicMemCpyInst
    ElementUnorderedAtomicMemMoveInst -> AtomicMemMoveInst
    ElementUnorderedAtomicMemSetInst -> AtomicMemSetInst
A script for doing this renaming in downstream trees is included below.

An example of where the Any* classes should be used in LLVM is when reasoning
about the effects of an instruction (ex: aliasing).

---
Script for renaming AtomicMem* classes:
PREFIXES="[<,([:space:]]"
CLASSES="MemIntrinsic|MemTransferInst|MemSetInst|MemMoveInst|MemCpyInst"
SUFFIXES="[;)>,[:space:]]"

REGEX="(${PREFIXES})ElementUnorderedAtomic(${CLASSES})(${SUFFIXES})"
REGEX2="visitElementUnorderedAtomic(${CLASSES})"

FILES=$( grep -E "(${REGEX}|${REGEX2})" -r . | tr ':' ' ' | awk '{print $1}' | sort | uniq )

SED_SCRIPT="s~${REGEX}~\1Atomic\2\3~g"
SED_SCRIPT2="s~${REGEX2}~visitAtomic\1~g"

for f in $FILES; do
    echo "Processing: $f"
    sed  -i ".bak" -E "${SED_SCRIPT};${SED_SCRIPT2};${EA_SED_SCRIPT};${EA_SED_SCRIPT2}" $f
done

Reviewers: sanjoy, deadalnix, apilipenko, anna, skatkov, mkazantsev

Reviewed By: sanjoy

Subscribers: hfinkel, jholewinski, arsenm, sdardis, nhaehnle, JDevlieghere, javed.absar, llvm-commits

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

llvm-svn: 316950

6 years ago[GVNHoist] Fix non-deterministic sort order of PHIs for identical instructions
Mandeep Singh Grang [Mon, 30 Oct 2017 19:42:41 +0000 (19:42 +0000)]
[GVNHoist] Fix non-deterministic sort order of PHIs for identical instructions

Summary: This fixes failure in Transforms/GVNHoist/hoist.ll uncovered by D39245.

Reviewers: hiraditya, spop, dberlin

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 316949

6 years ago[analyzer] [tests] Remove empty folders in reference results, do not store diffs.txt
George Karpenkov [Mon, 30 Oct 2017 19:40:33 +0000 (19:40 +0000)]
[analyzer] [tests] Remove empty folders in reference results, do not store diffs.txt

Storing diffs.txt is now redundant, as we simply dump the CmpRuns output
to stdout (it is saved in CI and tends to be small).
Not generating those files enables us to remove empty folders, which
confuse git, as it would not add them with reference results.

llvm-svn: 316948

6 years ago[SelectionDAG] Add VSELECT demanded elts support to computeKnownBits
Simon Pilgrim [Mon, 30 Oct 2017 19:31:08 +0000 (19:31 +0000)]
[SelectionDAG] Add VSELECT demanded elts support to computeKnownBits

llvm-svn: 316947

6 years agoX86 Tests: Update the variable-index permute tests with FP types. NFC.
Zvi Rackover [Mon, 30 Oct 2017 19:29:15 +0000 (19:29 +0000)]
X86 Tests: Update the variable-index permute tests with FP types. NFC.

These cases will be addressed in a future update to D39126.

llvm-svn: 316946

6 years ago[X86][SSE] Add another computeKnownBits test showing missing VSELECT demandedelts...
Simon Pilgrim [Mon, 30 Oct 2017 19:19:58 +0000 (19:19 +0000)]
[X86][SSE] Add another computeKnownBits test showing missing VSELECT demandedelts support

llvm-svn: 316945

6 years ago[SelectionDAG] Add VSELECT support to computeKnownBits
Simon Pilgrim [Mon, 30 Oct 2017 19:08:21 +0000 (19:08 +0000)]
[SelectionDAG] Add VSELECT support to computeKnownBits

llvm-svn: 316944

6 years agoFix warning + death test + failing test on Windows (D39072).
Kostya Kortchinsky [Mon, 30 Oct 2017 19:06:59 +0000 (19:06 +0000)]
Fix warning + death test + failing test on Windows (D39072).

Summary: Fixes https://reviews.llvm.org/D39072

Reviewers: cryptoad

Reviewed By: cryptoad

Subscribers: kubamracek

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

llvm-svn: 316943

6 years agoChange unw_word_t to always have the same size as the pointer size
Martin Storsjo [Mon, 30 Oct 2017 19:06:34 +0000 (19:06 +0000)]
Change unw_word_t to always have the same size as the pointer size

This matches the original libunwind API. This also unifies the
type between ARM EHABI and the other configurations, and allows
getting rid of a number of casts in log messages.

The cursor size updates for ppc and or1k are untested, but
unw_proc_info_t shrinks by 4 uint64_t units on i386 at least.

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

llvm-svn: 316942

6 years agoImplement LWG 3013 - some filesystem members should not be noexcept.
Eric Fiselier [Mon, 30 Oct 2017 18:59:59 +0000 (18:59 +0000)]
Implement LWG 3013 - some filesystem members should not be noexcept.

LWG 3013 points out that the constructors and increment members
of the directory iterators need to allocate, and therefore cannot
be marked noexcept.

It also points out that `is_empty` and `copy` likely need to allocate
as well, and as such can also not be noexcept.

This patch speculatively implements the resolution removing noexcept,
because libc++ does indeed have the possibility of throwing on allocation
failure.

llvm-svn: 316941

6 years ago[X86][SSE] computeKnownBits tests showing missing VSELECT demandedelts support
Simon Pilgrim [Mon, 30 Oct 2017 18:48:31 +0000 (18:48 +0000)]
[X86][SSE] computeKnownBits tests showing missing VSELECT demandedelts support

llvm-svn: 316940

6 years agoFix PR35078 - recursive directory iterator's increment method throws incorrectly.
Eric Fiselier [Mon, 30 Oct 2017 18:43:21 +0000 (18:43 +0000)]
Fix PR35078 - recursive directory iterator's increment method throws incorrectly.

The guts of the increment method for recursive_directory_iterator
was failing to pass an error code object to calls to status/symlink_status,
which can throw under certain conditions.

This patch fixes the issues by correctly propagating the error codes.
However the noexcept still needs to be removed from the signature, as
mentioned in LWG 3014, but that change will be made in a separate commit.

llvm-svn: 316939

6 years ago[X86][AVX512] Cleanup scheduler tests - split GENERIC and SKX targets
Simon Pilgrim [Mon, 30 Oct 2017 18:37:27 +0000 (18:37 +0000)]
[X86][AVX512] Cleanup scheduler tests - split GENERIC and SKX targets

llvm-svn: 316938

6 years ago[sanitizer] Fixing an error introduced in D39072
Kostya Kortchinsky [Mon, 30 Oct 2017 18:16:05 +0000 (18:16 +0000)]
[sanitizer] Fixing an error introduced in D39072

Summary: This should fix the Windows bots after D39072.

Reviewers: alekseyshl, flowerhack

Reviewed By: flowerhack

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 316937

6 years agoUndo accidental language mode change in this test.
Richard Smith [Mon, 30 Oct 2017 18:06:18 +0000 (18:06 +0000)]
Undo accidental language mode change in this test.

llvm-svn: 316936

6 years agoAdd a test to make sure that -Wdeprecated doesn't warn on use of 'throw()' in system...
Richard Smith [Mon, 30 Oct 2017 18:05:10 +0000 (18:05 +0000)]
Add a test to make sure that -Wdeprecated doesn't warn on use of 'throw()' in system headers (deprecated in C++17).

llvm-svn: 316935

6 years agoIntroduce ReservedAddressRange to sanitizer_common.
Kostya Kortchinsky [Mon, 30 Oct 2017 17:56:24 +0000 (17:56 +0000)]
Introduce ReservedAddressRange to sanitizer_common.

Summary:
Fixed version of https://reviews.llvm.org/D38437 (fixes Win/Fuchsia failures).

Creating a new revision, since the old one was getting a bit old/crowded.

    In Fuchsia, MmapNoAccess/MmapFixedOrDie are implemented using a global
    VMAR, which means that MmapNoAccess can only be called once. This works
    for the sanitizer allocator but *not* for the Scudo allocator.

    Hence, this changeset introduces a new ReservedAddressRange object to
    serve as the new API for these calls. In this changeset, the object
    still calls into the old Mmap implementations.

    The next changeset two changesets will convert the sanitizer and scudo
    allocators to use the new APIs, respectively. (ReservedAddressRange will
    replace the SecondaryHeader in Scudo.)

    Finally, a last changeset will update the Fuchsia implementation.

Reviewers: alekseyshl, cryptoad, phosek

Reviewed By: alekseyshl, cryptoad

Subscribers: kubamracek

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

llvm-svn: 316934

6 years ago[SelectionDAG] Add SELECT demanded elts support to ComputeNumSignBits
Simon Pilgrim [Mon, 30 Oct 2017 17:53:51 +0000 (17:53 +0000)]
[SelectionDAG] Add SELECT demanded elts support to ComputeNumSignBits

llvm-svn: 316933

6 years ago[X86][SSE] ComputeNumSignBits tests showing missing VSELECT demandedelts support
Simon Pilgrim [Mon, 30 Oct 2017 17:46:50 +0000 (17:46 +0000)]
[X86][SSE] ComputeNumSignBits tests showing missing VSELECT demandedelts support

llvm-svn: 316932

6 years agoUse 64 bits for the shared symbol size again.
Rafael Espindola [Mon, 30 Oct 2017 17:43:16 +0000 (17:43 +0000)]
Use 64 bits for the shared symbol size again.

We might want to drop support for such large symbols, but that should
be an explicit decision with a testcase.

llvm-svn: 316931

6 years agoFix clang warnings in winasan code
Reid Kleckner [Mon, 30 Oct 2017 17:26:57 +0000 (17:26 +0000)]
Fix clang warnings in winasan code

There are two instances of -Wcast-qual and one of -Wsign-compare.

llvm-svn: 316930

6 years ago[asan] Intercept heap routines in VS2010 CRT
Reid Kleckner [Mon, 30 Oct 2017 17:26:13 +0000 (17:26 +0000)]
[asan] Intercept heap routines in VS2010 CRT

Users have requested that we add it to the list:
https://github.com/google/sanitizers/issues/864

llvm-svn: 316929

6 years agoSkip abs symbols when handling copy reloc aliases.
Rafael Espindola [Mon, 30 Oct 2017 17:26:12 +0000 (17:26 +0000)]
Skip abs symbols when handling copy reloc aliases.

Since we now only check st_value, we have to consider the case where
the section index is special.

llvm-svn: 316928

6 years ago[MC] Split out register def/use idx calls to make debugging simpler. NFCI.
Simon Pilgrim [Mon, 30 Oct 2017 17:24:40 +0000 (17:24 +0000)]
[MC] Split out register def/use idx calls to make debugging simpler. NFCI.

llvm-svn: 316927

6 years ago[X86][AVX] Add missing vcvtpd2dq/vcvtps2dq scheduling tests
Simon Pilgrim [Mon, 30 Oct 2017 17:23:17 +0000 (17:23 +0000)]
[X86][AVX] Add missing vcvtpd2dq/vcvtps2dq scheduling tests

llvm-svn: 316926

6 years ago[X86][SSE] Add clflush scheduling test
Simon Pilgrim [Mon, 30 Oct 2017 17:20:50 +0000 (17:20 +0000)]
[X86][SSE] Add clflush scheduling test

llvm-svn: 316925

6 years ago[analyzer] Left shifting a negative value is undefined
Gabor Horvath [Mon, 30 Oct 2017 17:06:42 +0000 (17:06 +0000)]
[analyzer] Left shifting a negative value is undefined

The analyzer did not return an UndefVal in case a negative value was left
shifted. I also altered the UndefResultChecker to emit a clear warning in this
case.

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

llvm-svn: 316924

6 years agoTest commit: sort names in CREDITS.txt
Joachim Protze [Mon, 30 Oct 2017 16:44:00 +0000 (16:44 +0000)]
Test commit: sort names in CREDITS.txt

llvm-svn: 316922

6 years ago[X86][AVX512] Adding a pattern for broadcastm intrinsic.
Jina Nahias [Mon, 30 Oct 2017 16:37:28 +0000 (16:37 +0000)]
[X86][AVX512] Adding a pattern for broadcastm intrinsic.

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

Change-Id: I71c8605a8e4c98013ef25289694afc5cfd46bb0b
llvm-svn: 316921

6 years agoMove isDSOLocal check and add a comment.
Rafael Espindola [Mon, 30 Oct 2017 16:32:31 +0000 (16:32 +0000)]
Move isDSOLocal check and add a comment.

llvm-svn: 316920

6 years agoFix windows build broken in r316915
Pavel Labath [Mon, 30 Oct 2017 16:21:18 +0000 (16:21 +0000)]
Fix windows build broken in r316915

I accidentally left a linux-specific include in generic code.

llvm-svn: 316919

6 years agoMark test as unsupported on C++98/03, since it uses move_iterator
Marshall Clow [Mon, 30 Oct 2017 16:07:59 +0000 (16:07 +0000)]
Mark test as unsupported on C++98/03, since it uses move_iterator

llvm-svn: 316917

6 years ago[PPC CodeGen] Fix the bitreverse.i64 intrinsic.
Fangrui Song [Mon, 30 Oct 2017 16:03:44 +0000 (16:03 +0000)]
[PPC CodeGen] Fix the bitreverse.i64 intrinsic.

Summary: The two 32-bit words were swapped. Update a test omitted in reverted r316270.

Reviewers: jtony, aaron.ballman

Subscribers: nemanjai, kbarton

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

llvm-svn: 316916

6 years agoMainLoop: work around an android libc bug
Pavel Labath [Mon, 30 Oct 2017 16:00:13 +0000 (16:00 +0000)]
MainLoop: work around an android libc bug

Versions of android before kitkat implemented pselect non-atomically,
which caused flakyness, as we were relying on it atomically setting the
signal mask to implement waiting for signals.

This patch implements a direct call to the the pselect kernel syscall,
which does not suffer from this problem. The code itself is not very
pretty, but fortunately the uglyness is contained in the
android version of the MainLoop::RunImpl::Poll function.

llvm-svn: 316915

6 years agoFix PR#35119 : set_union misbehaves with move_iterators. Thanks to Denis Yaroshevskiy...
Marshall Clow [Mon, 30 Oct 2017 15:50:00 +0000 (15:50 +0000)]
Fix PR#35119 : set_union misbehaves with move_iterators. Thanks to Denis Yaroshevskiy for both the bug report and the fix.

llvm-svn: 316914

6 years ago[X86] Make sure we don't create locked inc/dec instructions when the carry flag is...
Craig Topper [Mon, 30 Oct 2017 14:51:37 +0000 (14:51 +0000)]
[X86] Make sure we don't create locked inc/dec instructions when the carry flag is being used.

Summary:
INC/DEC don't update the carry flag so we need to make sure we don't try to use it.

This patch introduces new X86ISD opcodes for locked INC/DEC. Teaches lowerAtomicArithWithLOCK to emit these nodes if INC/DEC is not slow or the function is being optimized for size. An additional flag is added that allows the INC/DEC to be disabled if the caller determines that the carry flag is being requested.

The test_sub_1_cmp_1_setcc_ugt test is currently showing this bug. The other test case changes are recovering cases that were regressed in r316860.

This should fully fix PR35068 finishing the fix started in r316860.

Reviewers: RKSimon, zvi, spatel

Reviewed By: zvi

Subscribers: llvm-commits

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

llvm-svn: 316913

6 years ago[X86] Remove AVX512 early out from X86FastISel::X86SelectCmp.
Craig Topper [Mon, 30 Oct 2017 14:50:11 +0000 (14:50 +0000)]
[X86] Remove AVX512 early out from X86FastISel::X86SelectCmp.

This shouldn't be needed anymore since i1 isn't a legal type.

llvm-svn: 316912

6 years ago[X86] Regenerate test using update_llc_test_checks.py
Craig Topper [Mon, 30 Oct 2017 14:50:10 +0000 (14:50 +0000)]
[X86] Regenerate test using update_llc_test_checks.py

llvm-svn: 316911

6 years ago[clang-format] Handle CRLF correctly when formatting escaped newlines
Krasimir Georgiev [Mon, 30 Oct 2017 14:41:34 +0000 (14:41 +0000)]
[clang-format] Handle CRLF correctly when formatting escaped newlines

Subscribers: klimek

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

Contributed by @peterbudai!

llvm-svn: 316910

6 years agoCodeGen: Fix insertion position of addrspace cast for alloca
Yaxun Liu [Mon, 30 Oct 2017 14:38:30 +0000 (14:38 +0000)]
CodeGen: Fix insertion position of addrspace cast for alloca

For non-zero alloca addr space, alloca is usually casted to default addr
space immediately.

For non-vla, alloca is inserted at AllocaInsertPt, therefore the addr
space cast should also be insterted at AllocaInsertPt. However,
for vla, alloca is inserted at the current insertion point of IRBuilder,
therefore the addr space cast should also inserted at the current
insertion point of IRBuilder.

Currently clang always insert addr space cast at AllocaInsertPt, which
causes invalid IR.

This patch fixes that.

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

llvm-svn: 316909

6 years ago[PassManager, SimplifyCFG] add test for PR34603 / D38566; NFC
Sanjay Patel [Mon, 30 Oct 2017 14:34:30 +0000 (14:34 +0000)]
[PassManager, SimplifyCFG] add test for PR34603 / D38566; NFC

Sinking common insts and converting to select early can inhibit better folds in other passes.

llvm-svn: 316908

6 years ago[AMDGPU] Emit metadata for hidden arguments for kernel enqueue
Yaxun Liu [Mon, 30 Oct 2017 14:30:28 +0000 (14:30 +0000)]
[AMDGPU] Emit metadata for hidden arguments for kernel enqueue

Identifies kernels which performs device side kernel enqueues and emit
metadata for the associated hidden kernel arguments. Such kernels are
marked with calls-enqueue-kernel function attribute by
AMDGPUOpenCLEnqueueKernelLowering pass and later on
hidden kernel arguments metadata HiddenDefaultQueue and
HiddenCompletionAction are emitted for them.

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

llvm-svn: 316907

6 years agoKeep MSVC2015 happy after r316903
Krasimir Georgiev [Mon, 30 Oct 2017 14:30:14 +0000 (14:30 +0000)]
Keep MSVC2015 happy after r316903

llvm-svn: 316906

6 years ago[CodeGen][ExpandMemcmp] Allow memcmp to expand to vector loads (2).
Clement Courbet [Mon, 30 Oct 2017 14:19:33 +0000 (14:19 +0000)]
[CodeGen][ExpandMemcmp] Allow memcmp to expand to vector loads (2).

 - Targets that want to support memcmp expansions now return the list of
   supported load sizes.
 - Expansion codegen does not assume that all power-of-two load sizes
   smaller than the max load size are valid. For examples, this is not the
   case for x86(32bit)+sse2.

Fixes PR34887.

llvm-svn: 316905

6 years ago[Hexagon] Allow the RDF optimizations to be run in .mir testcases
Krzysztof Parzyszek [Mon, 30 Oct 2017 14:11:52 +0000 (14:11 +0000)]
[Hexagon] Allow the RDF optimizations to be run in .mir testcases

llvm-svn: 316904

6 years ago[clang-format] Format raw string literals
Krasimir Georgiev [Mon, 30 Oct 2017 14:01:50 +0000 (14:01 +0000)]
[clang-format] Format raw string literals

Summary:
This patch adds raw string literal formatting.

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: klimek, mgorny

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

llvm-svn: 316903

6 years ago[GlobalISel|ARM] : Allow legalizing G_FSUB
Javed Absar [Mon, 30 Oct 2017 13:51:56 +0000 (13:51 +0000)]
[GlobalISel|ARM] : Allow legalizing G_FSUB

Adding support for VSUB.
Reviewed by: @rovka
Differential Revision: https://reviews.llvm.org/D39261

llvm-svn: 316902

6 years ago[analyzer] Use the signature of the primary template for issue hash calculation
Gabor Horvath [Mon, 30 Oct 2017 12:16:07 +0000 (12:16 +0000)]
[analyzer] Use the signature of the primary template for issue hash calculation

Now when a template is instantiated more times and there is a bug found in the
instantiations the issue hash will be different for each instantiation even if
every other property of the bug (path, message, location) is the same.

This patch aims to resolve this issue. Note that explicit specializations still
generate different hashes but that is intended.

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

llvm-svn: 316900

6 years ago[analyzer] Make issue hash related tests more concise
Gabor Horvath [Mon, 30 Oct 2017 12:02:23 +0000 (12:02 +0000)]
[analyzer] Make issue hash related tests more concise

Extend ExprInspection checker to make it possible to dump the issue hash of
arbitrary expressions. This change makes it possible to make issue hash related
tests more concise and also makes debugging issue hash related problems easier.

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

llvm-svn: 316899

6 years agoInvalid used of 'w' suffix on push and pop using 64-bit register.
Andrew V. Tischenko [Mon, 30 Oct 2017 12:02:06 +0000 (12:02 +0000)]
Invalid used of 'w' suffix on push and pop using 64-bit register.
Differential Revision: https://reviews.llvm.org/D38626

llvm-svn: 316898

6 years ago[ARM GlobalISel] Fixup r316572. NFC
Diana Picus [Mon, 30 Oct 2017 11:58:09 +0000 (11:58 +0000)]
[ARM GlobalISel] Fixup r316572. NFC

Just missed a few spots...

llvm-svn: 316897

6 years ago[CodeGen] Generate TBAA info for reference loads
Ivan A. Kosarev [Mon, 30 Oct 2017 11:49:31 +0000 (11:49 +0000)]
[CodeGen] Generate TBAA info for reference loads

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

llvm-svn: 316896

6 years ago[refactor] Fix a clang-tidy warning.
Haojian Wu [Mon, 30 Oct 2017 11:17:09 +0000 (11:17 +0000)]
[refactor] Fix a clang-tidy warning.

NFC

llvm-svn: 316895

6 years agoRevert "[X86][AVX512] Adding a pattern for broadcastm intrinsic."
Jina Nahias [Mon, 30 Oct 2017 10:35:53 +0000 (10:35 +0000)]
Revert "[X86][AVX512] Adding a pattern for broadcastm intrinsic."

This reverts commit r316890.

Change-Id: I683cceee9848ef309b452293086b1f26a941950d
llvm-svn: 316894

6 years ago[ELF] - Stop sorting input sections in createSections().
George Rimar [Mon, 30 Oct 2017 10:12:49 +0000 (10:12 +0000)]
[ELF] - Stop sorting input sections in createSections().

It does not seem that createSections() is a good place for
applying sorting. Patch changes code to do that inside
sortSections(), which looks more appropriate place.

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

llvm-svn: 316893

6 years ago[analyzer] lock_guard and unique_lock extension for BlockInCriticalSection checker
Gabor Horvath [Mon, 30 Oct 2017 10:09:55 +0000 (10:09 +0000)]
[analyzer] lock_guard and unique_lock extension for BlockInCriticalSection checker

A patch by zdtorok (Zoltán Dániel Török)!

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

llvm-svn: 316892

6 years agoRecommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP.
Florian Hahn [Mon, 30 Oct 2017 10:07:42 +0000 (10:07 +0000)]
Recommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP.

This version of the patch includes a fix addressing a stage2 LTO buildbot
failure and addressed some additional nits.

Original commit message:
This updates the SCCP solver to use of the ValueElement lattice for
parameters, which provides integer range information. The range
information is used to remove unneeded icmp instructions.

For the following function, f() can be optimized to ret i32 2 with
this change

    source_filename = "sccp.c"
    target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
    target triple = "x86_64-unknown-linux-gnu"

    ; Function Attrs: norecurse nounwind readnone uwtable
    define i32 @main() local_unnamed_addr #0 {
    entry:
      %call = tail call fastcc i32 @f(i32 1)
      %call1 = tail call fastcc i32 @f(i32 47)
      %add3 = add nsw i32 %call, %call1
      ret i32 %add3
    }

    ; Function Attrs: noinline norecurse nounwind readnone uwtable
    define internal fastcc i32 @f(i32 %x) unnamed_addr #1 {
    entry:
      %c1 = icmp sle i32 %x, 100

      %cmp = icmp sgt i32 %x, 300
      %. = select i1 %cmp, i32 1, i32 2
      ret i32 %.
    }

    attributes #1 = { noinline }

Reviewers: davide, sanjoy, efriedma, dberlin

Reviewed By: davide, dberlin

Subscribers: mcrosier, gberry, mssimpso, dberlin, llvm-commits

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

llvm-svn: 316891

6 years ago[X86][AVX512] Adding a pattern for broadcastm intrinsic.
Jina Nahias [Mon, 30 Oct 2017 09:59:52 +0000 (09:59 +0000)]
[X86][AVX512] Adding a pattern for broadcastm intrinsic.

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

Change-Id: I6551fb13879e098aed74de410e29815cf37d9ab5
llvm-svn: 316890

6 years ago[IRCE][NFC] Store Length as SCEV in RangeCheck instead of Value
Max Kazantsev [Mon, 30 Oct 2017 09:35:16 +0000 (09:35 +0000)]
[IRCE][NFC] Store Length as SCEV in RangeCheck instead of Value

llvm-svn: 316889

6 years agoRevert r316887 to fix buildbot failures.
Florian Hahn [Mon, 30 Oct 2017 09:21:50 +0000 (09:21 +0000)]
Revert r316887 to fix buildbot failures.

llvm-svn: 316888

6 years agoRecommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP.
Florian Hahn [Mon, 30 Oct 2017 09:04:18 +0000 (09:04 +0000)]
Recommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP.

This version of the patch includes a fix addressing a stage2 LTO buildbot
failure and addressed some additional nits.

Original commit message:
This updates the SCCP solver to use of the ValueElement lattice for
parameters, which provides integer range information. The range
information is used to remove unneeded icmp instructions.

For the following function, f() can be optimized to ret i32 2 with
this change

    source_filename = "sccp.c"
    target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
    target triple = "x86_64-unknown-linux-gnu"

    ; Function Attrs: norecurse nounwind readnone uwtable
    define i32 @main() local_unnamed_addr #0 {
    entry:
      %call = tail call fastcc i32 @f(i32 1)
      %call1 = tail call fastcc i32 @f(i32 47)
      %add3 = add nsw i32 %call, %call1
      ret i32 %add3
    }

    ; Function Attrs: noinline norecurse nounwind readnone uwtable
    define internal fastcc i32 @f(i32 %x) unnamed_addr #1 {
    entry:
      %c1 = icmp sle i32 %x, 100

      %cmp = icmp sgt i32 %x, 300
      %. = select i1 %cmp, i32 1, i32 2
      ret i32 %.
    }

    attributes #1 = { noinline }

Reviewers: davide, sanjoy, efriedma, dberlin

Reviewed By: davide, dberlin

Subscribers: mcrosier, gberry, mssimpso, dberlin, llvm-commits

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

llvm-svn: 316887

6 years agoAdd missing expected-no-diagnostics comment to test.
Gabor Horvath [Mon, 30 Oct 2017 09:01:48 +0000 (09:01 +0000)]
Add missing expected-no-diagnostics comment to test.

llvm-svn: 316886

6 years ago[analyzer] Handle ObjC messages conservatively in CallDescription
Gabor Horvath [Mon, 30 Oct 2017 08:47:13 +0000 (08:47 +0000)]
[analyzer] Handle ObjC messages conservatively in CallDescription

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

llvm-svn: 316885

6 years ago[GVN][NFC] Mark instruction for deletion instead of immediate erasing in LoadPRE
Max Kazantsev [Mon, 30 Oct 2017 04:48:34 +0000 (04:48 +0000)]
[GVN][NFC] Mark instruction for deletion instead of immediate erasing in LoadPRE

It is done to uniformly handle instructions removal.

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

llvm-svn: 316884

6 years ago[X86] Rearrange code in X86InstrInfo.cpp to put all the foldMemoryOperandImpl methods...
Craig Topper [Mon, 30 Oct 2017 04:39:18 +0000 (04:39 +0000)]
[X86] Rearrange code in X86InstrInfo.cpp to put all the foldMemoryOperandImpl methods together without partial/undef register handling in the middle. NFC

I have a future patch that wants to make use of the one of the partial functions in one of the earlier memory folding methods and the current ordering prevents that.

llvm-svn: 316883

6 years ago[X86] Simplify code by removing an unnecessary temporary variable. NFC
Craig Topper [Mon, 30 Oct 2017 03:35:44 +0000 (03:35 +0000)]
[X86] Simplify code by removing an unnecessary temporary variable. NFC

llvm-svn: 316882

6 years ago[X86] Move some EVEX->VEX code to a helper function to prepare for a future patch...
Craig Topper [Mon, 30 Oct 2017 03:35:43 +0000 (03:35 +0000)]
[X86] Move some EVEX->VEX code to a helper function to prepare for a future patch. NFC

llvm-svn: 316881

6 years agoRemove unnecessary code.
Rui Ueyama [Sun, 29 Oct 2017 23:41:16 +0000 (23:41 +0000)]
Remove unnecessary code.

Discarded section's Repl always points to itself, so returning
Sec is not different from returning Sec->Repl.

llvm-svn: 316880

6 years agoMove "Assigned" bit from SectionBase to InputSectionBase.
Rui Ueyama [Sun, 29 Oct 2017 23:32:23 +0000 (23:32 +0000)]
Move "Assigned" bit from SectionBase to InputSectionBase.

This bit is to manage whether an input section has already been assigned
to some output section by linker scripts or not. So it logically belongs
to InputSectionBase. SectionBase is a common base class for input and
output sections, so that wasn't the right place to define the bit.

llvm-svn: 316879

6 years agoRemove an obscure comment.
Rui Ueyama [Sun, 29 Oct 2017 22:38:00 +0000 (22:38 +0000)]
Remove an obscure comment.

llvm-svn: 316878

6 years agoELF: Correctly set edata if there are no .bss sections.
Peter Collingbourne [Sun, 29 Oct 2017 22:31:48 +0000 (22:31 +0000)]
ELF: Correctly set edata if there are no .bss sections.

edata needs to be set to the end of the last mapped initialized
section. We were previously mishandling the case where there were no
non-mapped sections by setting it to the end of the last section in
the output file.

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

llvm-svn: 316877

6 years agoInitialize members not by assignment but by the member initializer list.
Rui Ueyama [Sun, 29 Oct 2017 22:26:52 +0000 (22:26 +0000)]
Initialize members not by assignment but by the member initializer list.

llvm-svn: 316876

6 years ago[SelectionDAG] Add SEXT/AND/XOR/Or demanded elts support to ComputeNumSignBits
Simon Pilgrim [Sun, 29 Oct 2017 22:03:37 +0000 (22:03 +0000)]
[SelectionDAG] Add SEXT/AND/XOR/Or demanded elts support to ComputeNumSignBits

llvm-svn: 316875

6 years agoInitial triage
Marshall Clow [Sun, 29 Oct 2017 21:57:58 +0000 (21:57 +0000)]
Initial triage

llvm-svn: 316874

6 years agoUpdate status of 2950
Marshall Clow [Sun, 29 Oct 2017 21:43:30 +0000 (21:43 +0000)]
Update status of 2950

llvm-svn: 316873

6 years ago[Acc] Do not statically dispatch into IslNodeBuilder's createFor
Philip Pfaffe [Sun, 29 Oct 2017 21:36:34 +0000 (21:36 +0000)]
[Acc] Do not statically dispatch into IslNodeBuilder's createFor

Summary:
When GPUNodeBuilder creates loops inside the kernel, it dispatches to
IslNodeBuilder. This however is surprisingly dangerous, since it accesses the
AST Node's user through the wrong type. This patch fixes this problem by
overriding createFor correctly.

This fixes PR35010.

Reviewers: grosser, bollu, Meinersbur

Reviewed By: Meinersbur

Subscribers: Meinersbur, nemanjai, pollydev, llvm-commits, kbarton

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

llvm-svn: 316872

6 years ago[X86][SSE] Split ComputeNumSignBits SEXT/AND/XOR/OR demandedelts test
Simon Pilgrim [Sun, 29 Oct 2017 21:35:28 +0000 (21:35 +0000)]
[X86][SSE] Split ComputeNumSignBits SEXT/AND/XOR/OR demandedelts test

Max depth was being exceeded which could prevent some combines working

llvm-svn: 316871

6 years agoFix two testcases. NFC intended.
Philip Pfaffe [Sun, 29 Oct 2017 21:00:48 +0000 (21:00 +0000)]
Fix two testcases. NFC intended.

Add missing %loadPolly directive to support out of tree builds. One of
the changes is somewhat bigger, because the directive turns on LLVM
names, and the testcase deosn't use those.

llvm-svn: 316870

6 years ago[(new) Pass Manager] instantiate SimplifyCFG with the same options as the old PM
Sanjay Patel [Sun, 29 Oct 2017 20:49:31 +0000 (20:49 +0000)]
[(new) Pass Manager] instantiate SimplifyCFG with the same options as the old PM

The old PM sets the options of what used to be known as "latesimplifycfg" on the
instantiation after the vectorizers have run, so that's what we'redoing here.

FWIW, there's a later SimplifyCFGPass instantiation in both PMs where we do not
set the "late" options. I'm not sure if that's intentional or not.

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

llvm-svn: 316869

6 years ago[X86][SSE] ComputeNumSignBits tests showing missing SEXT/AND/XOR/OR demandedelts...
Simon Pilgrim [Sun, 29 Oct 2017 20:49:27 +0000 (20:49 +0000)]
[X86][SSE] ComputeNumSignBits tests showing missing SEXT/AND/XOR/OR demandedelts support

llvm-svn: 316868

6 years agoIssues to be voted on in ABQ
Marshall Clow [Sun, 29 Oct 2017 19:02:00 +0000 (19:02 +0000)]
Issues to be voted on in ABQ

llvm-svn: 316867

6 years ago[SelectionDAG] Add SRA/SHL demanded elts support to ComputeNumSignBits
Simon Pilgrim [Sun, 29 Oct 2017 18:19:37 +0000 (18:19 +0000)]
[SelectionDAG] Add SRA/SHL demanded elts support to ComputeNumSignBits

Introduce a isConstOrDemandedConstSplat helper function that can recognise a constant splat build vector for at least the demanded elts we care about.

llvm-svn: 316866