platform/upstream/llvm.git
7 years ago[APInt] Remove check for single word since single word was handled earlier in the...
Craig Topper [Wed, 10 May 2017 18:15:14 +0000 (18:15 +0000)]
[APInt] Remove check for single word since single word was handled earlier in the function. NFC

llvm-svn: 302701

7 years ago[ConstantRange] Add test case showing a case where we pick too large of a range for...
Craig Topper [Wed, 10 May 2017 18:15:06 +0000 (18:15 +0000)]
[ConstantRange] Add test case showing a case where we pick too large of a range for multiply after r271020.

llvm-svn: 302700

7 years agoSmall refactoring in DAGCombine. NFC
Amaury Sechet [Wed, 10 May 2017 17:58:28 +0000 (17:58 +0000)]
Small refactoring in DAGCombine. NFC

llvm-svn: 302699

7 years agoFix use of now removed %exec test substitution
Eric Fiselier [Wed, 10 May 2017 17:52:53 +0000 (17:52 +0000)]
Fix use of now removed %exec test substitution

llvm-svn: 302698

7 years agoRename variables to conform to LLVM naming conventions.
Zachary Turner [Wed, 10 May 2017 17:39:18 +0000 (17:39 +0000)]
Rename variables to conform to LLVM naming conventions.

llvm-svn: 302697

7 years ago[Fix] [Fortran Support] Fix variable name & make testcase activate on release
Siddharth Bhat [Wed, 10 May 2017 17:27:48 +0000 (17:27 +0000)]
[Fix] [Fortran Support] Fix variable name & make testcase activate on release

There was:
    #ifdef NDEBUG

This should be:
    #ifndef NDEBUG

Also, the variable name was incorrect. Fixed the variable name.

llvm-svn: 302696

7 years ago[Sema] Objective-C++ support for type trait __is_base_of
Erik Pilkington [Wed, 10 May 2017 17:18:56 +0000 (17:18 +0000)]
[Sema] Objective-C++ support for type trait __is_base_of

rdar://24308607

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

llvm-svn: 302695

7 years ago[ELF] Improve error message for incompatible section types
Rui Ueyama [Wed, 10 May 2017 16:57:50 +0000 (16:57 +0000)]
[ELF] Improve error message for incompatible section types

Previously we were not printing out the type of the incompatible section
which made it difficult to determine what the problem was.

The error message format has been change to the following:

  error: section type mismatch for .shstrtab
  >>> <internal>:(.shstrtab): SHT_STRTAB
  >>> output section .shstrtab: Unknown

Patch by Alexander Richardson.

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

llvm-svn: 302694

7 years agoRevert "Add dyld to sanitizer procmaps on darwin"
Francis Ricci [Wed, 10 May 2017 16:33:46 +0000 (16:33 +0000)]
Revert "Add dyld to sanitizer procmaps on darwin"

This breaks several tests because we don't always have
access to __cxa_guard functions

This reverts commit 45eb470c3e9e8f6993a204e247c33d4092237efe.

llvm-svn: 302693

7 years agoRevert "Disable static caching of dyld header on Go sanitizers"
Francis Ricci [Wed, 10 May 2017 16:33:43 +0000 (16:33 +0000)]
Revert "Disable static caching of dyld header on Go sanitizers"

This is a problem on more than just the go sanitizers, so it's
not a good enough fix for the issue.

llvm-svn: 302692

7 years ago[XRay] Fix XRay PPC return value bug.
Tim Shen [Wed, 10 May 2017 16:28:21 +0000 (16:28 +0000)]
[XRay] Fix XRay PPC return value bug.

Summary:
This bug is caused by the incorrect handling of return-value registers.

According to OpenPOWER 64-Bit ELF V2 ABI 2.2.5, up to 2 general-purpose
registers are going to be used for return values, and up to 8 floating
point registers or vector registers are going to be used for return
values.

Reviewers: dberris, echristo

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 302691

7 years agoFix -DLLVM_ENABLE_THREADS=OFF build of lld after r302613
Hans Wennborg [Wed, 10 May 2017 16:25:54 +0000 (16:25 +0000)]
Fix -DLLVM_ENABLE_THREADS=OFF build of lld after r302613

llvm-svn: 302690

7 years ago[AST] RecursiveASTVisitor should not crash on lambdas with type attributes
Alex Lorenz [Wed, 10 May 2017 16:21:00 +0000 (16:21 +0000)]
[AST] RecursiveASTVisitor should not crash on lambdas with type attributes

rdar://31960860

llvm-svn: 302689

7 years ago[clang-tidy][CMake] Make clang-tidy usable as distribution component
Petr Hosek [Wed, 10 May 2017 16:20:54 +0000 (16:20 +0000)]
[clang-tidy][CMake] Make clang-tidy usable as distribution component

Use add_clang_tool rather than add_clang_executable to support
clang-tidy as a distribution component.

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

llvm-svn: 302688

7 years ago[ELF] Define __ehdr_start unconditionally even when using linker script
Petr Hosek [Wed, 10 May 2017 16:20:33 +0000 (16:20 +0000)]
[ELF] Define __ehdr_start unconditionally even when using linker script

This behavior differs from the semantics implemented by GNU linkers
which only define this symbol iff ELF headers are in the memory
mapped segment.

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

llvm-svn: 302687

7 years ago[XRay] Fix the test func-id-utils.cc on PPC.
Tim Shen [Wed, 10 May 2017 16:07:03 +0000 (16:07 +0000)]
[XRay] Fix the test func-id-utils.cc on PPC.

Summary:
The test fails on PPC, because the address of a function may vary
depending on whether the "taker" shares the same ToC (roughly, in the
same "module") as the function.

Therefore the addresses of the functions taken in func-id-utils.cc may be
different from the addresses taken in xray runtime.

Change the test to be permissive on address comparison.

Reviewers: dberris, echristo

Subscribers: llvm-commits

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

llvm-svn: 302686

7 years agoBuild the Apple-style stage2 with full debug info
Adrian Prantl [Wed, 10 May 2017 15:58:22 +0000 (15:58 +0000)]
Build the Apple-style stage2 with full debug info

Green dragon had a green stage2 modules bot for a long time now[1] and
it is time to retire it and make a modules build the default for
Apple-style stage2 builds.

This patch switches the debug info generation from -gline-tables-only
to -g since full debug info does no longer cause any memory issues
even for full LTO builds [2].

[1] http://green.lab.llvm.org/green/job/clang-stage2-cmake-modulesRDA_build/
[2] http://llvm.org/devmtg/2015-10/#talk19
rdar://problem/28672159

llvm-svn: 302685

7 years ago[InstSimplify, InstCombine] move 'or' simplification tests; NFC
Sanjay Patel [Wed, 10 May 2017 15:57:47 +0000 (15:57 +0000)]
[InstSimplify, InstCombine] move 'or' simplification tests; NFC

Surprisingly, I don't think these are redundant for InstSimplify.
They were just misplaced as InstCombine tests.

llvm-svn: 302684

7 years ago[X86][SSE] Check vec_set BUILD_VECTOR tests on both 32 and 64-bit targets
Simon Pilgrim [Wed, 10 May 2017 15:52:59 +0000 (15:52 +0000)]
[X86][SSE] Check vec_set BUILD_VECTOR tests on both 32 and 64-bit targets

llvm-svn: 302683

7 years ago[libclang] Fix typo in doc-comment, NFC
Argyrios Kyrtzidis [Wed, 10 May 2017 15:48:16 +0000 (15:48 +0000)]
[libclang] Fix typo in doc-comment, NFC

llvm-svn: 302682

7 years agoDisable static caching of dyld header on Go sanitizers
Francis Ricci [Wed, 10 May 2017 15:40:29 +0000 (15:40 +0000)]
Disable static caching of dyld header on Go sanitizers

This causes buildbot failures due to undefined __cxa_guard_acquire

llvm-svn: 302681

7 years ago[cmake] Disable building enable_execute_stack.c for baremetal targets.
Catherine Moore [Wed, 10 May 2017 15:34:25 +0000 (15:34 +0000)]
[cmake] Disable building enable_execute_stack.c for baremetal targets.

Disable building enable_execute_stack.c for targets that do not have
support for mprotect().

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

llvm-svn: 302680

7 years ago[AArch64][RegisterBankInfo] Change the default mapping of fp stores.
Quentin Colombet [Wed, 10 May 2017 15:19:41 +0000 (15:19 +0000)]
[AArch64][RegisterBankInfo] Change the default mapping of fp stores.

For stores, check if the stored value is defined by a floating point
instruction and if yes, we return a default mapping with FPR instead
of GPR.

llvm-svn: 302679

7 years ago[AArch64] Enable use of reduction intrinsics.
Amara Emerson [Wed, 10 May 2017 15:15:38 +0000 (15:15 +0000)]
[AArch64] Enable use of reduction intrinsics.

The new experimental reduction intrinsics can now be used, so I'm enabling this
for AArch64. We will need this for SVE anyway, so it makes sense to do this for
NEON reductions as well.

The existing code to match shufflevector patterns are replaced with a direct
lowering of the reductions to AArch64-specific nodes. Tests updated with the
new, simpler, representation.

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

llvm-svn: 302678

7 years ago[libclang] Introduce clang_Cursor_isExternalSymbol that provides info about decls...
Argyrios Kyrtzidis [Wed, 10 May 2017 15:10:36 +0000 (15:10 +0000)]
[libclang] Introduce clang_Cursor_isExternalSymbol that provides info about decls marked with external_source_symbol attribute

llvm-svn: 302677

7 years ago[InstCombine] remove redundant tests
Sanjay Patel [Wed, 10 May 2017 14:54:49 +0000 (14:54 +0000)]
[InstCombine] remove redundant tests

The first test in this file is duplicated exactly in and.ll -> test33.
We have commuted and vector variants there too.

The second test is a composite of 2 folds. The first fold is tested
independently in add.ll -> flip_and_mask (including vector variant).
After that transform fires, the IR is identical to the first transform.

llvm-svn: 302676

7 years agoMark LinkerScript as final.
Rafael Espindola [Wed, 10 May 2017 14:45:15 +0000 (14:45 +0000)]
Mark LinkerScript as final.

We used to inherit from it, but don't need it anymore.

llvm-svn: 302675

7 years ago[InstCombine] fix auto-generated FileCheck-captured variable refs
Sanjay Patel [Wed, 10 May 2017 14:40:04 +0000 (14:40 +0000)]
[InstCombine] fix auto-generated FileCheck-captured variable refs

The script at utils/update_test_checks.py has (had?) a bug when variables
start with the same sequence of letters (clearly, not all of the time).

llvm-svn: 302674

7 years agoAdd dyld to sanitizer procmaps on darwin
Francis Ricci [Wed, 10 May 2017 14:38:04 +0000 (14:38 +0000)]
Add dyld to sanitizer procmaps on darwin

Summary:
Sanitizer procmaps uses dyld apis to iterate over the list of images
in the process. This is much more performan than manually recursing
over all of the memory regions in the process, however, dyld does
not report itself in the list of images. In order to prevent reporting
leaks from dyld globals and to symbolize dyld functions in stack traces,
this patch special-cases dyld and ensures that it is added to the
list of modules.

This is accomplished by recursing through the memory map of the process
until a dyld Mach header is found. While this recursion is expensive,
it is run before the full set of images has been loaded in the process,
so only a few calls are required. The result is cached so that it never
needs to be searched for when the full process memory map exists, as this
would be incredibly slow, on the order of minutes for leak sanitizer with
only 25 or so libraries loaded.

Reviewers: alekseyshl, kubamracek

Subscribers: llvm-commits

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

llvm-svn: 302673

7 years agoRemove one more use of section names.
Rafael Espindola [Wed, 10 May 2017 14:35:20 +0000 (14:35 +0000)]
Remove one more use of section names.

llvm-svn: 302672

7 years agoRemove another use of section names. NFC.
Rafael Espindola [Wed, 10 May 2017 14:28:31 +0000 (14:28 +0000)]
Remove another use of section names. NFC.

llvm-svn: 302671

7 years agoReland: [mips] Impose a threshold for coercion of aggregates
Petar Jovanovic [Wed, 10 May 2017 14:28:18 +0000 (14:28 +0000)]
Reland: [mips] Impose a threshold for coercion of aggregates

    Modified MipsABIInfo::classifyArgumentType so that it now coerces
    aggregate structures only if the size of said aggregate is less than
    16/64 bytes, depending on the ABI.

    Patch by Stefan Maksimovic.

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

with minor changes (use regexp instead of the hardcoded values) to the test.

llvm-svn: 302670

7 years ago[InstCombine] fix typo in test comment; NFC
Sanjay Patel [Wed, 10 May 2017 14:25:23 +0000 (14:25 +0000)]
[InstCombine] fix typo in test comment; NFC

llvm-svn: 302669

7 years ago[ELF] - Don't segfault when assigning non-calculatable absolute symbol value.
George Rimar [Wed, 10 May 2017 14:23:33 +0000 (14:23 +0000)]
[ELF] - Don't segfault when assigning non-calculatable absolute symbol value.

This is PR32664.

Issue was revealed by linux kernel script which was:

SECTIONS {
 . = (0xffffffff80000000 + ALIGN(0x1000000, 0x200000));
 phys_startup_64 = ABSOLUTE(startup_64 - 0xffffffff80000000);

 .text : AT(ADDR(.text) - 0xffffffff80000000) {
.....
  *(.head.text)
Where startup_64 is in .head.text.

At the place of assignment to phys_startup_64 we can not calculate absolute value for startup_64
because .text section has no VA assigned. Two patches were prepared earlier to address this: D32173 and D32174.

And in comments for D32173 was suggested not try to support this case, but error out.

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

llvm-svn: 302668

7 years ago[SystemZ] Add miscellaneous instructions
Ulrich Weigand [Wed, 10 May 2017 14:20:15 +0000 (14:20 +0000)]
[SystemZ] Add miscellaneous instructions

This adds a few missing instructions for the assembler and
disassembler.  Those should be the last missing general-
purpose (Chapter 7) instructions for the z10 ISA.

llvm-svn: 302667

7 years ago[ELF] - Use LLVM_FALLTHROUGH in code.
George Rimar [Wed, 10 May 2017 14:19:59 +0000 (14:19 +0000)]
[ELF] - Use LLVM_FALLTHROUGH in code.

When compiling LLD using GCC 7 it reports warnings like:
"warning: this statement may fall through [-Wimplicit-fallthrough=]"

LLVM has LLVM_FALLTHROUGH macro which can be used to avoid such warnings.
Together with D33036 this patch fixes them.

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

llvm-svn: 302666

7 years ago[SystemZ] Add missing arithmetic instructions
Ulrich Weigand [Wed, 10 May 2017 14:18:47 +0000 (14:18 +0000)]
[SystemZ] Add missing arithmetic instructions

This adds the remaining general arithmetic instructions
for assembler / disassembler use.  Most of these are not
useful for codegen; a few might be, and those are listed
in the README.txt for future improvements.

llvm-svn: 302665

7 years ago[llvm-readobj] Improve errors on invalid binary
Sam Clegg [Wed, 10 May 2017 14:18:11 +0000 (14:18 +0000)]
[llvm-readobj] Improve errors on invalid binary

The previous code was discarding the error message from
createBinary() by calling errorToErrorCode().
This meant that such error were always reported unhelpfully
as "Invalid data was encountered while parsing the file".

Other tools such as llvm-objdump already produce a more
the error message in this case.

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

llvm-svn: 302664

7 years ago[OpenMP] Changes in the plugin interface
George Rokos [Wed, 10 May 2017 14:12:36 +0000 (14:12 +0000)]
[OpenMP] Changes in the plugin interface

This patch chagnes the plugin interface so that:
1) future plugins can take advantage of systems with shared CPU/device storage
2) instead of using base addresses, target regions are launched by providing target addresseds and base offsets explicitly.

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

llvm-svn: 302663

7 years agoRemove another use of section names. NFC.
Rafael Espindola [Wed, 10 May 2017 14:12:02 +0000 (14:12 +0000)]
Remove another use of section names. NFC.

llvm-svn: 302662

7 years agoDon't use section names in getFiller. NFC.
Rafael Espindola [Wed, 10 May 2017 14:01:13 +0000 (14:01 +0000)]
Don't use section names in getFiller. NFC.

This is just faster and avoids using names.

llvm-svn: 302661

7 years agochang type from 'int' to 'size_t'. This will fix revision number 302652
Michael Zuckerman [Wed, 10 May 2017 14:00:57 +0000 (14:00 +0000)]
chang type from 'int' to 'size_t'. This will fix revision number 302652

llvm-svn: 302660

7 years ago[InstCombine] add (ashr (shl i32 X, 31), 31), 1 --> and (not X), 1
Sanjay Patel [Wed, 10 May 2017 13:56:52 +0000 (13:56 +0000)]
[InstCombine] add (ashr (shl i32 X, 31), 31), 1 --> and (not X), 1

This is another step towards favoring 'not' ops over random 'xor' in IR:
https://bugs.llvm.org/show_bug.cgi?id=32706

This transformation may have occurred in longer IR sequences using computeKnownBits,
but that could be much more expensive to calculate.

As the scalar result shows, we do not currently favor 'not' in all cases. The 'not'
created by the transform is transformed again (unnecessarily). Vectors don't have
this problem because vectors are (wrongly) excluded from several other combines.

llvm-svn: 302659

7 years agoclang-format: refine calculating brace types.
Martin Probst [Wed, 10 May 2017 13:53:29 +0000 (13:53 +0000)]
clang-format: refine calculating brace types.

Summary:
For C++ code, opening parenthesis following a } indicate a braced init. For JavaScript and other languages, this is an invalid syntactical construct, unless the closing parenthesis belongs to a function - in which situation its a BK_Block.

This fixes indenting IIFEs following top level functions:

    function foo() {}
    (function() { codeHere(); }());

clang-format used to collapse these lines together.

Subscribers: klimek

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

llvm-svn: 302658

7 years ago[Polly][CMake] Fix syntactical errors in the exported config
Philip Pfaffe [Wed, 10 May 2017 13:51:30 +0000 (13:51 +0000)]
[Polly][CMake] Fix syntactical errors in the exported config

llvm-svn: 302657

7 years agoUse explicit false instead of casted nullptr. NFC.
Serge Guelton [Wed, 10 May 2017 13:24:17 +0000 (13:24 +0000)]
Use explicit false instead of casted nullptr. NFC.

llvm-svn: 302656

7 years agoUse clang++-3.5 compatible initializer_list constructor
Serge Guelton [Wed, 10 May 2017 13:23:47 +0000 (13:23 +0000)]
Use clang++-3.5 compatible initializer_list constructor

Otherwise, a warning is issued.

llvm-svn: 302655

7 years agoUse clang++-3.5 compatible initializer_list constructor
Serge Guelton [Wed, 10 May 2017 13:22:11 +0000 (13:22 +0000)]
Use clang++-3.5 compatible initializer_list constructor

Otherwise, a warning is issued.

llvm-svn: 302654

7 years ago[Fortran Support] Detect Fortran arrays & metadata from dragonegg output
Siddharth Bhat [Wed, 10 May 2017 13:11:20 +0000 (13:11 +0000)]
[Fortran Support] Detect Fortran arrays & metadata from dragonegg output

Add the ability to tag certain memory accesses as those belonging to
Fortran arrays. We do this by pattern matching against known patterns
of Dragonegg's LLVM IR output from Fortran code.

Fortran arrays have metadata stored with them in a struct. This struct
is called the "Fortran array descriptor", and a reference to this is
stored in each MemoryAccess.

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

llvm-svn: 302653

7 years ago[LLVM][inline-asm] Altmacro string escape character '!'
Michael Zuckerman [Wed, 10 May 2017 13:08:11 +0000 (13:08 +0000)]
[LLVM][inline-asm] Altmacro string escape character '!'

This patch is the fourth patch in a series of reviews for the Altmacro feature.
This patch introduces a new escape character '!' and it depends on D32701.

according to https://sourceware.org/binutils/docs/as/Altmacro.html:
"single-character string escape
To include any single character literally in a string (even if the character would otherwise have some special meaning), you can prefix the character with !' (an exclamation mark). For example, you can write <4.3 !> 5.4!!>' to get the literal text `4.3 > 5.4!'. "

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

llvm-svn: 302652

7 years ago[DAGCombiner] Dropped explicit (sra 0, x) -> 0 and (sra -1, x) -> 0 folds.
Simon Pilgrim [Wed, 10 May 2017 13:06:26 +0000 (13:06 +0000)]
[DAGCombiner] Dropped explicit (sra 0, x) -> 0 and (sra -1, x) -> 0 folds.

These are both handled (and tested) by the earlier ComputeNumSignBits == EltSizeInBits fold.

llvm-svn: 302651

7 years ago[IfConversion] Add missing check in IfConversion/canFallThroughTo
Mikael Holmen [Wed, 10 May 2017 13:06:13 +0000 (13:06 +0000)]
[IfConversion] Add missing check in IfConversion/canFallThroughTo

Summary:
When trying to figure out if MBB could fallthrough to ToMBB (possibly by
falling through a bunch of other MBBs) we didn't actually check if there
was fallthrough between the last two blocks in the chain.

Reviewers: kparzysz, iteratee, MatzeB

Reviewed By: kparzysz, iteratee

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 302650

7 years ago[SystemZ] Implement getRepRegClassFor()
Jonas Paulsson [Wed, 10 May 2017 13:03:25 +0000 (13:03 +0000)]
[SystemZ]  Implement getRepRegClassFor()

This method must return a valid register class, or the list-ilp isel
scheduler will crash. For MVT::Untyped nullptr was previously returned, but
now ADDR128BitRegClass is returned instead. This is needed just as long as
list-ilp (and probably also list-hybrid) is still there.

Review: Ulrich Weigand, A Trick
https://reviews.llvm.org/D32802

llvm-svn: 302649

7 years ago[AMDGPU][MC] Corrected v_madak/madmk to avoid printing "_e32" in disassembler output
Dmitry Preobrazhensky [Wed, 10 May 2017 13:00:28 +0000 (13:00 +0000)]
[AMDGPU][MC] Corrected v_madak/madmk to avoid printing "_e32" in disassembler output

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

Reviewers: vpykhtin, artem.tamazov, arsenm

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

llvm-svn: 302648

7 years ago[GlobalISel][X86] Split test file. NFC
Igor Breger [Wed, 10 May 2017 12:58:31 +0000 (12:58 +0000)]
[GlobalISel][X86] Split test file. NFC

llvm-svn: 302647

7 years ago[SystemZ] Add decimal integer instructions
Ulrich Weigand [Wed, 10 May 2017 12:42:45 +0000 (12:42 +0000)]
[SystemZ] Add decimal integer instructions

This adds the set of decimal integer (BCD) instructions for
assembler / disassembler use.

llvm-svn: 302646

7 years ago[SystemZ] Add crypto instructions
Ulrich Weigand [Wed, 10 May 2017 12:42:00 +0000 (12:42 +0000)]
[SystemZ] Add crypto instructions

This adds the set of message-security assist instructions for
assembler / disassembler use.

llvm-svn: 302645

7 years ago[SystemZ] Add translate/convert instructions
Ulrich Weigand [Wed, 10 May 2017 12:41:12 +0000 (12:41 +0000)]
[SystemZ] Add translate/convert instructions

This adds the set of character-set translate and convert instructions
for assembler / disassembler use.

llvm-svn: 302644

7 years ago[SystemZ] Add missing memory/string instructions
Ulrich Weigand [Wed, 10 May 2017 12:40:15 +0000 (12:40 +0000)]
[SystemZ] Add missing memory/string instructions

This adds a number of missing memory and string instructions
for assembler / disassembler use.

llvm-svn: 302643

7 years ago[SystemZ] Reformat assembler/disassembler tests
Ulrich Weigand [Wed, 10 May 2017 12:39:11 +0000 (12:39 +0000)]
[SystemZ] Reformat assembler/disassembler tests

The assembler and disassmebler test cases started out formatted and
sorted in a particular way, but this got lost over time as patches
were added.  Reformat them again.  NFC.

llvm-svn: 302642

7 years ago[DAGCombiner] Add vector support to fold (shl/srl 0, x) -> 0
Simon Pilgrim [Wed, 10 May 2017 12:34:27 +0000 (12:34 +0000)]
[DAGCombiner] Add vector support to fold (shl/srl 0, x) -> 0

llvm-svn: 302641

7 years agoRevert r301950: SpeculativeExecution: Stop using whitelist for costs
Chandler Carruth [Wed, 10 May 2017 12:30:07 +0000 (12:30 +0000)]
Revert r301950: SpeculativeExecution: Stop using whitelist for costs

This pass doesn't correctly handle testing for when it is legal to hoist
arbitrary instructions. The whitelist happens to make it safe, so before
it is removed the pass's legality checks will need to be enhanced.

Details have been added to the code review thread for the patch.

llvm-svn: 302640

7 years ago[msan] Fix getmntent{_r} for empty /etc/fstab
Adhemerval Zanella [Wed, 10 May 2017 12:18:25 +0000 (12:18 +0000)]
[msan] Fix getmntent{_r} for empty /etc/fstab

Some configuration (for instance default docker ubuntu images) uses
a default empty and invalid /etc/fstab configuration file.  It makes
any call to getmntent return NULL and it leads to failures on
Msan-aarch64{-with-call}-Test/MemorySanitizer.getmntent{_r}.

This patch fixes it by creating a temporary file with some valid
entries (although not valid for the system) to use along with
setmntent/getmntent.

llvm-svn: 302639

7 years ago[GPUJIT] Disabled gcc's -Wpedantic for use of dlsym
Siddharth Bhat [Wed, 10 May 2017 11:51:44 +0000 (11:51 +0000)]
[GPUJIT] Disabled gcc's -Wpedantic for use of dlsym

GCC's ISO C standard does not strictly define the bahavior of converting
a `void*` pointer to a function pointer, but dlsym's POSIX standard
does.

The retrieval of function pointers through dlsym in this case
generates an unnecessary amount of warnings for every API function
assignment, bloating the output.

This patch removes GCC's `-Wpedantic` flag for retrieval and assignment
of these functions. This simplifies debugging the output of GPUJIT.

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

llvm-svn: 302638

7 years ago[clang-tidy] Add new cert-dcl21-cpp check
Gabor Horvath [Wed, 10 May 2017 11:16:55 +0000 (11:16 +0000)]
[clang-tidy] Add new cert-dcl21-cpp check

This check flags postfix operator++/-- declarations,
where the return type is not a const object.

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

llvm-svn: 302637

7 years ago[Polly] Canonicalize arrays according to base-ptr equivalence class
Tobias Grosser [Wed, 10 May 2017 10:59:58 +0000 (10:59 +0000)]
[Polly] Canonicalize arrays according to base-ptr equivalence class

Summary:
    In case two arrays share base pointers in the same invariant load equivalence
    class, we canonicalize all memory accesses to the first of these arrays
    (according to their order in the equivalence class).

    This enables us to optimize kernels such as boost::ublas by ensuring that
    different references to the C array are interpreted as accesses to the same
    array. Before this change the runtime alias check for ublas would fail, as it
    would assume models of the C array with differing (but identically valued) base
    pointers would reference distinct regions of memory whereas the referenced
    memory regions were indeed identical.

    As part of this change we remove most of the MemoryAccess::get*BaseAddr
    interface. We removed already all references to get*BaseAddr in previous
    commits to ensure that no code relies on matching base pointers between
    memory accesses and scop arrays -- except for three remaining uses where we
    need the original base pointer. We document for these situations that
    MemoryAccess::getOriginalBaseAddr may return a base pointer that is distinct
    to the base pointer of the scop array referenced by this memory access.

Reviewers: sebpop, Meinersbur, zinob, gareevroman, pollydev, huihuiz, efriedma, jdoerfert

Reviewed By: Meinersbur

Subscribers: etherzhhb

Tags: #polly

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

llvm-svn: 302636

7 years ago[mips] XFAIL getpwnam_r_invalid_user.cc test
Simon Dardis [Wed, 10 May 2017 10:58:11 +0000 (10:58 +0000)]
[mips] XFAIL getpwnam_r_invalid_user.cc test

XFAIL this test while we investigate the root cause.

llvm-svn: 302635

7 years ago[AArch64] Fix a comment to match the code. NFC.
Martin Storsjo [Wed, 10 May 2017 10:51:32 +0000 (10:51 +0000)]
[AArch64] Fix a comment to match the code. NFC.

For the ELF case, the default/preferred form is the generic one, not
the short one as used for Apple - fix the comment to say so. Currently
it is a copy-paste typo.

Make the comments on the darwin default a bit more verbose.

Use enum names instead of literal 0/1 to further increase readability
and reduce fragility.

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

llvm-svn: 302634

7 years ago[OpenCL] Handle OpenCL specific subelement types
Egor Churaev [Wed, 10 May 2017 10:28:34 +0000 (10:28 +0000)]
[OpenCL] Handle OpenCL specific subelement types

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

llvm-svn: 302633

7 years ago[index] Index simple dependent declaration references
Alex Lorenz [Wed, 10 May 2017 09:47:41 +0000 (09:47 +0000)]
[index] Index simple dependent declaration references

This commit implements basic support for indexing of dependent declaration
references. Now the indexer tries to find a suitable match in the base template
for a dependent member ref/decl ref/dependent type.

rdar://29158210

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

llvm-svn: 302632

7 years agoAdd a late IR expansion pass for the experimental reduction intrinsics.
Amara Emerson [Wed, 10 May 2017 09:42:49 +0000 (09:42 +0000)]
Add a late IR expansion pass for the experimental reduction intrinsics.

This pass uses a new target hook to decide whether or not to expand a particular
intrinsic to the shuffevector sequence.

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

llvm-svn: 302631

7 years ago[OpenCL] Added checking OpenCL version for cl_khr_mipmap_image built-ins
Egor Churaev [Wed, 10 May 2017 08:23:01 +0000 (08:23 +0000)]
[OpenCL] Added checking OpenCL version for cl_khr_mipmap_image built-ins

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

llvm-svn: 302630

7 years agoFix use of removed SH test replacement %exec
Eric Fiselier [Wed, 10 May 2017 08:15:40 +0000 (08:15 +0000)]
Fix use of removed SH test replacement %exec

llvm-svn: 302629

7 years ago[Safestack] Fix the canary test to catch the libc's message regarding stack smashing
Ivan A. Kosarev [Wed, 10 May 2017 08:06:42 +0000 (08:06 +0000)]
[Safestack] Fix the canary test to catch the libc's message regarding stack smashing

By default glibc writes its diagnostics directly to tty so the `2>&1 |`
redirection in the test doesn't catch the *** stack smashing detected ***
message, which in turn breaks printing the lit's progress bar. By defining
the LIBC_FATAL_STDERR_ environment variable we force glibc to direct
diagnostic messages to stderr.

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

llvm-svn: 302628

7 years agoAttempt to speculatively unbreak Apple build bots
Eric Fiselier [Wed, 10 May 2017 08:04:50 +0000 (08:04 +0000)]
Attempt to speculatively unbreak Apple build bots

llvm-svn: 302627

7 years ago[APInt] Fix indentation of tcDivide. Combine variable declaration and initialization.
Craig Topper [Wed, 10 May 2017 07:50:17 +0000 (07:50 +0000)]
[APInt] Fix indentation of tcDivide. Combine variable declaration and initialization.

llvm-svn: 302626

7 years ago[APInt] Use getNumWords function in udiv/urem/udivrem instead of reimplementinging it.
Craig Topper [Wed, 10 May 2017 07:50:15 +0000 (07:50 +0000)]
[APInt] Use getNumWords function in udiv/urem/udivrem instead of reimplementinging it.

llvm-svn: 302625

7 years agoAdd ASTMatchRefactorer and ReplaceNodeWithTemplate to RefactoringCallbacks
Eric Liu [Wed, 10 May 2017 07:48:45 +0000 (07:48 +0000)]
Add ASTMatchRefactorer and ReplaceNodeWithTemplate to RefactoringCallbacks

Summary: This is the first change as part of developing a clang-query based search and replace tool.

Reviewers: klimek, bkramer, ioeric, sbenza, jbangert

Reviewed By: ioeric, jbangert

Subscribers: sbenza, ioeric, cfe-commits

Patch by Julian Bangert!

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

llvm-svn: 302624

7 years ago[GlobalISel][X86] G_ZEXT i1 to i32/i64 support.
Igor Breger [Wed, 10 May 2017 06:52:58 +0000 (06:52 +0000)]
[GlobalISel][X86] G_ZEXT i1 to i32/i64 support.

Summary: Support G_ZEXT i1 to i32/i64 instruction selection.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, llvm-commits, kristof.beyls

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

llvm-svn: 302623

7 years ago[UnreachableBlockElim] Check return value of constrainRegClass().
Mikael Holmen [Wed, 10 May 2017 06:33:43 +0000 (06:33 +0000)]
[UnreachableBlockElim] Check return value of constrainRegClass().

Summary:
MachineRegisterInfo::constrainRegClass() can fail if two register classes
don't have a common subclass or if the register class doesn't contain
enough registers. Check the return value before trying to remove Phi nodes,
and if we can't constrain, we output a COPY instead of simply replacing
registers.

Reviewers: kparzysz, david2050, wmi

Reviewed By: kparzysz

Subscribers: llvm-commits

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

llvm-svn: 302622

7 years agoAdd noreturn attribute to avoid warnings about missing initialization
Tobias Grosser [Wed, 10 May 2017 05:20:56 +0000 (05:20 +0000)]
Add noreturn attribute to avoid warnings about missing initialization

Before this change we saw warnings such as:

  tools/GPURuntime/GPUJIT.c:1566:3:
  warning: variable 'DevPtr' is used uninitialized whenever switch default is
  taken [-Wsometimes-uninitialized]
    default:

llvm-svn: 302621

7 years agoFix formatting in Polly
Tobias Grosser [Wed, 10 May 2017 04:53:59 +0000 (04:53 +0000)]
Fix formatting in Polly

llvm-svn: 302620

7 years agoRename Appveyor install helper script.
Eric Fiselier [Wed, 10 May 2017 02:43:02 +0000 (02:43 +0000)]
Rename Appveyor install helper script.

I'm really lazy and the old name for the helper script
killed 2 letter tab completion for the include directory.
This patch renames it to avoid that problem and enable
lazyness.

llvm-svn: 302619

7 years agoUpdate Polly for LLVM API change r302571 that removed varargs functions
Chandler Carruth [Wed, 10 May 2017 02:39:35 +0000 (02:39 +0000)]
Update Polly for LLVM API change r302571 that removed varargs functions
with a nullptr sentinel in favor of nicely typed variadic templates.

llvm-svn: 302618

7 years agoSupport using MinGW POSIX threads on Windows
Eric Fiselier [Wed, 10 May 2017 02:36:48 +0000 (02:36 +0000)]
Support using MinGW POSIX threads on Windows

llvm-svn: 302617

7 years agoattempt to fix appveyor syntax error
Eric Fiselier [Wed, 10 May 2017 02:34:56 +0000 (02:34 +0000)]
attempt to fix appveyor syntax error

llvm-svn: 302616

7 years agoWhen we see a '<' operator, check whether it's a probable typo for a template-id.
Richard Smith [Wed, 10 May 2017 02:30:28 +0000 (02:30 +0000)]
When we see a '<' operator, check whether it's a probable typo for a template-id.

The heuristic that we use here is:
 * the left-hand side must be a simple identifier or a class member access
 * the right-hand side must be '<' followed by either a '>' or by a type-id that
   cannot be an expression (in particular, not followed by '(' or '{')
 * there is a '>' token matching the '<' token

The second condition guarantees the expression would otherwise be ill-formed.

If we're confident that the user intended the name before the '<' to be
interpreted as a template, diagnose the fact that we didn't interpret it
that way, rather than diagnosing that the template arguments are not valid
expressions.

llvm-svn: 302615

7 years agoAdd MinGW64 builder to Appveyor.
Eric Fiselier [Wed, 10 May 2017 02:30:16 +0000 (02:30 +0000)]
Add MinGW64 builder to Appveyor.

With the amount of work happening on Windows we should
have a MinGW bot to make sure we don't regress that functionality.
Currently it doesn't build :-(

llvm-svn: 302614

7 years ago[Core] Make parallel algorithms match C++ Parallelism TS.
Zachary Turner [Wed, 10 May 2017 01:16:22 +0000 (01:16 +0000)]
[Core] Make parallel algorithms match C++ Parallelism TS.

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

llvm-svn: 302613

7 years ago[CodeGen] Don't require AA in TwoAddress at -O0.
Ahmed Bougacha [Wed, 10 May 2017 00:56:00 +0000 (00:56 +0000)]
[CodeGen] Don't require AA in TwoAddress at -O0.

This is a follow-up to r302611, which moved an -O0 computation of DT
from SDAGISel to TwoAddress.

Don't use it here either, and avoid computing it completely.  The only
use was forwarding the analysis as an optional argument to utility
functions.

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

llvm-svn: 302612

7 years ago[CodeGen] Don't require AA in SDAGISel at -O0.
Ahmed Bougacha [Wed, 10 May 2017 00:39:30 +0000 (00:39 +0000)]
[CodeGen] Don't require AA in SDAGISel at -O0.

Before r247167, the pass manager builder controlled which AA
implementations were used, exporting them all in the AliasAnalysis
analysis group.

Now, AAResultsWrapperPass always uses BasicAA, but still uses other AA
implementations if made available in the pass pipeline.

But regardless, SDAGISel is required at O0, and really doesn't need to
be doing fancy optimizations based on useful AA results.

Don't require AA at CodeGenOpt::None, and only use it otherwise.

This does have a functional impact (and one testcase is pessimized
because we can't reuse a load).  But I think that's desirable no matter
what.

Note that this alone doesn't result in less DT computations: TwoAddress
was previously able to reuse the DT we computed for SDAG.  That will be
fixed separately.

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

llvm-svn: 302611

7 years ago[CodeGen] Compute DT/LI lazily in SafeStackLegacyPass. NFC.
Ahmed Bougacha [Wed, 10 May 2017 00:39:25 +0000 (00:39 +0000)]
[CodeGen] Compute DT/LI lazily in SafeStackLegacyPass. NFC.

We currently require SCEV, which requires DT/LI.  Those are expensive to
compute, but the pass only runs for functions that have the safestack
attribute.

Compute DT/LI to build SCEV lazily, only when the pass is actually going
to transform the function.

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

llvm-svn: 302610

7 years ago[CodeGen] Split SafeStack into a LegacyPass and a utility. NFC.
Ahmed Bougacha [Wed, 10 May 2017 00:39:22 +0000 (00:39 +0000)]
[CodeGen] Split SafeStack into a LegacyPass and a utility. NFC.

This lets the pass focus on gathering the required analyzes, and the
utility class focus on the transformation.

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

llvm-svn: 302609

7 years ago[CodeGen] Add an -O0 backend pipeline test. NFC.
Ahmed Bougacha [Wed, 10 May 2017 00:39:17 +0000 (00:39 +0000)]
[CodeGen] Add an -O0 backend pipeline test. NFC.

This should hopefully makes changes to the O0 pipeline obvious; it's
easy to require expensive passes, and this helps make informed
decisions.

Case in point: in the few weeks separating the time when I initially
wrote this patch to the time when I committed, the test regressed as
r302103 added another use of DT!

llvm-svn: 302608

7 years agoImprove how LIT reports the added environment variables
Eric Fiselier [Wed, 10 May 2017 00:23:58 +0000 (00:23 +0000)]
Improve how LIT reports the added environment variables

llvm-svn: 302607

7 years ago[WebAssembly] Fix build error in wasm YAML code
Sam Clegg [Wed, 10 May 2017 00:14:04 +0000 (00:14 +0000)]
[WebAssembly] Fix build error in wasm YAML code

This warning didn't show up on my local build
but is causing the bots to fail.  Seems like a
bad idea to have types and variables with the
same name anyhow.

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

llvm-svn: 302606

7 years ago[InstCombine] add helper function for add X, C folds; NFCI
Sanjay Patel [Wed, 10 May 2017 00:07:16 +0000 (00:07 +0000)]
[InstCombine] add helper function for add X, C folds; NFCI

llvm-svn: 302605

7 years agoAttempt to unbreak Libc++ test configuration
Eric Fiselier [Wed, 10 May 2017 00:05:04 +0000 (00:05 +0000)]
Attempt to unbreak Libc++ test configuration

llvm-svn: 302604

7 years agoWhen instantiating a friend function template, don't forget to inherit default templa...
Richard Smith [Wed, 10 May 2017 00:01:13 +0000 (00:01 +0000)]
When instantiating a friend function template, don't forget to inherit default template arguments from other declarations.

llvm-svn: 302603

7 years agoFix test runtime environment on Windows
Eric Fiselier [Tue, 9 May 2017 23:57:22 +0000 (23:57 +0000)]
Fix test runtime environment on Windows

llvm-svn: 302602