platform/upstream/llvm.git
7 years agoDo not assign new discriminator for all intrinsics.
Dehao Chen [Fri, 5 Aug 2016 17:56:49 +0000 (17:56 +0000)]
Do not assign new discriminator for all intrinsics.

Summary: We do not care about intrinsic calls when assigning discriminators.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 277843

7 years agoFix dumping of process module list and test it
Reid Kleckner [Fri, 5 Aug 2016 17:55:00 +0000 (17:55 +0000)]
Fix dumping of process module list and test it

I probably broke this a year ago in r243895.

llvm-svn: 277842

7 years agoGlobalISel: clear pending phis after MachineFunction translated
Tim Northover [Fri, 5 Aug 2016 17:50:36 +0000 (17:50 +0000)]
GlobalISel: clear pending phis after MachineFunction translated

Test is just reordering the existing functions (it would trigger for any
function after one with a phi).

llvm-svn: 277841

7 years ago[SemaOpenMP] Some miscellaneous cleanups
David Majnemer [Fri, 5 Aug 2016 17:44:54 +0000 (17:44 +0000)]
[SemaOpenMP] Some miscellaneous cleanups

Clean up some typos, follow the coding style a little more rigorously.

No functionality change is intended.

llvm-svn: 277840

7 years ago[X86][SSE] Add initial support for 2 input target shuffle combining.
Simon Pilgrim [Fri, 5 Aug 2016 17:36:14 +0000 (17:36 +0000)]
[X86][SSE] Add initial support for 2 input target shuffle combining.

At the moment only the INSERTPS matching can actually use 2 inputs but the plumbing is now in place.

llvm-svn: 277839

7 years agoCOFF ARM: Error out if 24 bit thumb branches are out of range
Saleem Abdulrasool [Fri, 5 Aug 2016 17:33:24 +0000 (17:33 +0000)]
COFF ARM: Error out if 24 bit thumb branches are out of range

In the ELF linker, the same situation already errors out with "relocation
R_ARM_THM_CALL out of range".

Patch by Martin Storsjö!

llvm-svn: 277838

7 years ago[asan] Remove unused include (NFC)
Vedant Kumar [Fri, 5 Aug 2016 17:28:28 +0000 (17:28 +0000)]
[asan] Remove unused include (NFC)

llvm-svn: 277837

7 years agoCOFF ARM: Clear the J1 and J2 bits when applying relocations to 24 bit branches
Saleem Abdulrasool [Fri, 5 Aug 2016 17:28:21 +0000 (17:28 +0000)]
COFF ARM: Clear the J1 and J2 bits when applying relocations to 24 bit branches

The opcode for the bl branches can initially be F000 F800, i.e.
the J1 and J2 bits are already set. Therefore mask these bits out
before or'ing in the new bits.

Patch by Martin Storsjö!

llvm-svn: 277836

7 years agoGlobalISel: IRTranslate PHI instructions
Tim Northover [Fri, 5 Aug 2016 17:16:40 +0000 (17:16 +0000)]
GlobalISel: IRTranslate PHI instructions

llvm-svn: 277835

7 years agobuiltins: windows has only one flavour on ARM
Saleem Abdulrasool [Fri, 5 Aug 2016 16:53:05 +0000 (16:53 +0000)]
builtins: windows has only one flavour on ARM

Windows on ARM is a hard-float only environment.  Don't try to build two copies
of the same library.

llvm-svn: 277834

7 years agoFix gdb pretty printers to work with Python 3.
Igor Kudrin [Fri, 5 Aug 2016 16:48:31 +0000 (16:48 +0000)]
Fix gdb pretty printers to work with Python 3.

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

llvm-svn: 277833

7 years ago[CodeGen] Use MapVector instead of DenseMap.
Michael Kruse [Fri, 5 Aug 2016 16:45:51 +0000 (16:45 +0000)]
[CodeGen] Use MapVector instead of DenseMap.

The map is iterated over when generating the values escaping the SCoP. The
indeterministic iteration order of DenseMap causes the output IR to change at
every compilation, adding noise to comparisons.

Replace DenseMap by a MapVector to ensure the same iteration order at every
compilation.

llvm-svn: 277832

7 years agoFix TargetParser unit tests for ARM / AArch64.
Zachary Turner [Fri, 5 Aug 2016 16:45:07 +0000 (16:45 +0000)]
Fix TargetParser unit tests for ARM / AArch64.

String pooling is not guaranteed by the standard, so if
you're comparing two different string literals for equality,
you have to use strcmp.

llvm-svn: 277831

7 years agoRevert "[Sema] Add sizeof diagnostics for bzero"
Bruno Cardoso Lopes [Fri, 5 Aug 2016 16:41:00 +0000 (16:41 +0000)]
Revert "[Sema] Add sizeof diagnostics for bzero"

This reverts commit r277787, which caused PR28870.

llvm-svn: 277830

7 years agoopt: Adding -O0 to opt tool
Gor Nishanov [Fri, 5 Aug 2016 16:27:33 +0000 (16:27 +0000)]
opt: Adding -O0 to opt tool

Summary:
Having -O0 in opt allows testing that -O0 optimization
pipeline is built correctly.

Reviewers: majnemer

Subscribers: llvm-commits

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

llvm-svn: 277829

7 years agobuiltins: better categorisation of Thumb1 builtins
Saleem Abdulrasool [Fri, 5 Aug 2016 16:24:56 +0000 (16:24 +0000)]
builtins: better categorisation of Thumb1 builtins

Adjust the builtins to better annotate the Thumb1 routines and their purpose.
Exclude the remaining thumb1 sources on Windows ARM.

llvm-svn: 277828

7 years ago[StreamExecutor] Add kernel types
Jason Henline [Fri, 5 Aug 2016 16:05:44 +0000 (16:05 +0000)]
[StreamExecutor] Add kernel types

Summary: Add StreamExecutor kernel types.

Reviewers: jlebar, tra

Subscribers: parallel_libs-commits

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

llvm-svn: 277827

7 years agoPrint a more useful BP value from MSVC-built ASan runtimes
Reid Kleckner [Fri, 5 Aug 2016 16:01:57 +0000 (16:01 +0000)]
Print a more useful BP value from MSVC-built ASan runtimes

MSVC doesn't have an exact equivalent for __builtin_frame_address, but
_AddressOfReturnAddress() + sizeof(void*) should be equivalent for all
frames build with -fno-omit-frame-pointer.

llvm-svn: 277826

7 years agoFixed x2APIC discovery for 256-processor architectures.
Andrey Churbanov [Fri, 5 Aug 2016 15:59:11 +0000 (15:59 +0000)]
Fixed x2APIC discovery for 256-processor architectures.

Mask for value read from ebx register returned by CPUID expanded to 0xFFFF.

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

llvm-svn: 277825

7 years agoAMDGPU : Add Clang builtin intrinsics for compare with the full
Wei Ding [Fri, 5 Aug 2016 15:38:46 +0000 (15:38 +0000)]
AMDGPU : Add Clang builtin intrinsics for compare with the full
wavefront result.

Differential Revision: http://reviews.llvm.org/D22934

llvm-svn: 277824

7 years ago[PowerPC] Wrong fast-isel codegen for VSX floating-point loads
Ulrich Weigand [Fri, 5 Aug 2016 15:22:05 +0000 (15:22 +0000)]
[PowerPC] Wrong fast-isel codegen for VSX floating-point loads

There were two locations where fast-isel would generate a LFD instruction
with a target register class VSFRC instead of F8RC when VSX was enabled.
This can ccause invalid registers to be used in certain cases, like:
   lfd 36, ...
instead of using a VSX load instruction.  The wrong register number gets
silently truncated, causing invalid code to be generated.

The first place is PPCFastISel::PPCEmitLoad, which had multiple problems:

1.) The IsVSSRC and IsVSFRC flags are not initialized correctly, since they
are computed from resultReg, which is still zero at this point in many cases.
Fixed by changing the helper routines to operate on a register class instead
of a register and passing in UseRC.

2.) Even with this fixed, Is64VSXLoad is still wrong due to a typo:

bool Is32VSXLoad = IsVSSRC && Opc == PPC::LFS;
bool Is64VSXLoad = IsVSSRC && Opc == PPC::LFD;

The second line needs to use isVSFRC (like PPCEmitStore does).

3.) Once both the above are fixed, we're now generating a VSX instruction --
but an incorrect one, since generation of an indexed instruction with null
index is wrong. Fixed by copying the code handling the same issue in
PPCEmitStore.

The second place is PPCFastISel::PPCMaterializeFP, where we would emit an
LFD to load a constant from the literal pool, and use the wrong result
register class. Fixed by hardcoding a F8RC class even on systems
supporting VSX.

Fixes: https://llvm.org/bugs/show_bug.cgi?id=28630

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

llvm-svn: 277823

7 years ago[SystemZ] Add missing classes and instructions
Zhan Jun Liau [Fri, 5 Aug 2016 15:14:34 +0000 (15:14 +0000)]
[SystemZ] Add missing classes and instructions

Summary:
Add instruction formats E, RSI, SSd, SSE, and SSF.

Added BRXH, BRXLE, PR, MVCK, STRAG, and ECTG instructions to test out
those formats.

Reviewers: uweigand

Subscribers: llvm-commits

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

llvm-svn: 277822

7 years agoActually, r277337 was fine. Just kill the DAGs that made the test allow nondeterminism.
Benjamin Kramer [Fri, 5 Aug 2016 14:58:34 +0000 (14:58 +0000)]
Actually, r277337 was fine. Just kill the DAGs that made the test allow nondeterminism.

llvm-svn: 277821

7 years ago[SimplifyCFG] Make range reduction code deterministic.
Benjamin Kramer [Fri, 5 Aug 2016 14:55:02 +0000 (14:55 +0000)]
[SimplifyCFG] Make range reduction code deterministic.

This generated IR based on the order of evaluation, which is different
between GCC and Clang. With that in mind you get bootstrap miscompares
if you compare a Clang built with GCC-built Clang vs. Clang built with
Clang-built Clang. Diagnosing that made my head hurt.

This also reverts commit r277337, which "fixed" the test case.

llvm-svn: 277820

7 years agoreduce tests; auto-generate checks
Sanjay Patel [Fri, 5 Aug 2016 14:50:11 +0000 (14:50 +0000)]
reduce tests; auto-generate checks

llvm-svn: 277819

7 years ago[OpenMP] Sema and parsing for 'teams distribute' pragma
Kelvin Li [Fri, 5 Aug 2016 14:37:37 +0000 (14:37 +0000)]
[OpenMP] Sema and parsing for 'teams distribute' pragma

This patch is to implement sema and parsing for 'teams distribute' pragma.

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

llvm-svn: 277818

7 years ago[X86][SSE] Update the the target shuffle matches to use the effective mask's value...
Simon Pilgrim [Fri, 5 Aug 2016 14:33:11 +0000 (14:33 +0000)]
[X86][SSE] Update the the target shuffle matches to use the effective mask's value type directly instead of via the input value type.

Preparation for adding 2 input support so we want to avoid unnecessary references to the input value type.

llvm-svn: 277817

7 years agotesting commit access
Gor Nishanov [Fri, 5 Aug 2016 13:17:06 +0000 (13:17 +0000)]
testing commit access

llvm-svn: 277816

7 years ago[X86][SSE] Consistently use the target shuffle root value type for vector size calcul...
Simon Pilgrim [Fri, 5 Aug 2016 13:02:53 +0000 (13:02 +0000)]
[X86][SSE] Consistently use the target shuffle root value type for vector size calculations. NFCI.

Preparation for adding 2 input support so we want to avoid unnecessary references to the input value type.

llvm-svn: 277814

7 years agoLLLexer.cpp: Avoid using BitsToDouble() to preserve SNaN like "double 0x7FF4000000000...
NAKAMURA Takumi [Fri, 5 Aug 2016 11:59:49 +0000 (11:59 +0000)]
LLLexer.cpp: Avoid using BitsToDouble() to preserve SNaN like "double 0x7FF4000000000000".

We should not use double (or float) in the LLVM, unless it is really needed. x87 FP register doesn't preserve SNaN to move the value.

FIXME: APFloat() may have the constructor by raw bit.
llvm-svn: 277813

7 years agoReformat.
NAKAMURA Takumi [Fri, 5 Aug 2016 11:59:45 +0000 (11:59 +0000)]
Reformat.

llvm-svn: 277812

7 years ago[include-fixer] Correct some header mappings.
Haojian Wu [Fri, 5 Aug 2016 11:54:34 +0000 (11:54 +0000)]
[include-fixer] Correct some header mappings.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 277811

7 years ago[DependenceInfo] Reset operations counter when setting limit.
Michael Kruse [Fri, 5 Aug 2016 11:31:02 +0000 (11:31 +0000)]
[DependenceInfo] Reset operations counter when setting limit.

When entering the dependence computation and the max_operations is set, the
operations counter may have already exceeded the counter, thus aborting any ISL
computation from the start. The counter is reset at the end of the dependence
calculation such that a follow-up recomputation might succeed, ie. the success
of the first dependence calculation depends on unrelated ISL operations that
happened before, giving it a disadvantage to the following calculations.

This patch resets the operations counter at the beginning of the dependence
recalculation to not depend on previous actions. Otherwise additional
preprocessing of the Scop that aims to improve its schedulability (eg. DeLICM)
do have the effect that DependenceInfo and hence the scheduling fail more
likely, contraproductive to the goal of said preprocessing.

llvm-svn: 277810

7 years agoAdd a missing backslash to my previous commit
John Brawn [Fri, 5 Aug 2016 11:17:43 +0000 (11:17 +0000)]
Add a missing backslash to my previous commit

llvm-svn: 277809

7 years ago[X86][SSE] Added target shuffle combine binary compute matching function. NFCI.
Simon Pilgrim [Fri, 5 Aug 2016 11:16:53 +0000 (11:16 +0000)]
[X86][SSE] Added target shuffle combine binary compute matching function. NFCI.

Added matchBinaryPermuteVectorShuffle and moved the blend+zero and insertps matching code into it.

llvm-svn: 277808

7 years agoReapply r276973 "Adjust Registry interface to not require plugins to export a registry"
John Brawn [Fri, 5 Aug 2016 11:01:08 +0000 (11:01 +0000)]
Reapply r276973 "Adjust Registry interface to not require plugins to export a registry"

This differs from the previous version by being more careful about template
instantiation/specialization in order to prevent errors when building with
clang -Werror. Specifically:
 * begin is not defined in the template and is instead instantiated when Head
   is. I think the warning when we don't do that is wrong (PR28815) but for now
   at least do it this way to avoid the warning.
 * Instead of performing template specializations in LLVM_INSTANTIATE_REGISTRY
   instead provide a template definition then do explicit instantiation. No
   compiler I've tried has problems with doing it the other way, but strictly
   speaking it's not permitted by the C++ standard so better safe than sorry.

Original commit message:

Currently the Registry class contains the vestiges of a previous attempt to
allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a
plugin would have its own copy of a registry and export it to be imported by
the tool that's loading the plugin. This only works if the plugin is entirely
self-contained with the only interface between the plugin and tool being the
registry, and in particular this conflicts with how IR pass plugins work.

This patch changes things so that instead the add_node function of the registry
is exported by the tool and then imported by the plugin, which solves this
problem and also means that instead of every plugin having to export every
registry they use instead LLVM only has to export the add_node functions. This
allows plugins that use a registry to work on Windows if
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used.

llvm-svn: 277806

7 years ago[PowerPC] fix passing long double arguments to function (soft-float)
Strahinja Petrovic [Fri, 5 Aug 2016 08:47:26 +0000 (08:47 +0000)]
[PowerPC] fix passing long double arguments to function (soft-float)

This patch fixes passing long double type arguments to function in
soft float mode. If there is less than 4 argument registers free
(long double type is mapped in 4 gpr registers in soft float mode)
long double type argument must be passed through stack.
Differential Revision: https://reviews.llvm.org/D20114.

llvm-svn: 277804

7 years agoGPGPU: Sort dimension sizes of multi-dimensional shared memory arrays correctly
Tobias Grosser [Fri, 5 Aug 2016 08:27:24 +0000 (08:27 +0000)]
GPGPU: Sort dimension sizes of multi-dimensional shared memory arrays correctly

Before this commit we generated the array type in reverse order and we also
added the outermost dimension size to the new array declaration, which is
incorrect as Polly additionally assumed an additional unsized outermost
dimension, such that we had an off-by-one error in the linearization of access
expressions.

llvm-svn: 277802

7 years ago[InstCombine] try to fold (select C, (sext A), B) into logical ops
Nicolai Haehnle [Fri, 5 Aug 2016 08:22:29 +0000 (08:22 +0000)]
[InstCombine] try to fold (select C, (sext A), B) into logical ops

Summary:
Turn (select C, (sext A), B) into (sext (select C, A, B')) when A is i1 and
B is a compatible constant, also for zext instead of sext. This will then be
further folded into logical operations.

The transformation would be valid for non-i1 types as well, but other parts of
InstCombine prefer to have sext from non-i1 as an operand of select.

Motivated by the shader compiler frontend in Mesa for AMDGPU, which emits i32
for boolean operations. With this change, the boolean logic is fully
recovered.

Reviewers: majnemer, spatel, tstellarAMD

Subscribers: llvm-commits

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

llvm-svn: 277801

7 years agoAdd missing 'REQUIRES' line
Tobias Grosser [Fri, 5 Aug 2016 07:08:45 +0000 (07:08 +0000)]
Add missing 'REQUIRES' line

llvm-svn: 277800

7 years agoGPGPU: Add cuda annotations to specify maximal number of threads per block
Tobias Grosser [Fri, 5 Aug 2016 06:47:43 +0000 (06:47 +0000)]
GPGPU: Add cuda annotations to specify maximal number of threads per block

These annotations ensure that the NVIDIA PTX assembler limits the number of
registers used such that we can be certain the resulting kernel can be executed
for the number of threads in a thread block that we are planning to use.

llvm-svn: 277799

7 years agoReverting r277632 as it breaks the build on MacOS.
Ivan Krasin [Fri, 5 Aug 2016 03:18:27 +0000 (03:18 +0000)]
Reverting r277632 as it breaks the build on MacOS.

Reviewers: kcc

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

llvm-svn: 277798

7 years agoFix crash in template type diffing.
Richard Trieu [Fri, 5 Aug 2016 03:16:36 +0000 (03:16 +0000)]
Fix crash in template type diffing.

When the type being diffed is a type alias, and the orginal type is not a
templated type, then there will be no unsugared TemplateSpecializationType.
When this happens, exit early from the constructor.  Also add assertions to
the other iterator accessor to prevent the iterator from being used.

llvm-svn: 277797

7 years agoAllow -1 to assign max value to unsigned bitfields.
Richard Trieu [Fri, 5 Aug 2016 02:39:30 +0000 (02:39 +0000)]
Allow -1 to assign max value to unsigned bitfields.

Silence the -Wbitfield-constant-conversion warning for when -1 or other
negative values are assigned to unsigned bitfields, provided that the bitfield
is wider than the minimum number of bits needed to encode the negative value.

llvm-svn: 277796

7 years agoCFI: add XFAIL test for a future optimization of two vcalls.
Ivan Krasin [Fri, 5 Aug 2016 01:45:54 +0000 (01:45 +0000)]
CFI: add XFAIL test for a future optimization of two vcalls.

Summary:
Often, a code will call multiple virtual methods of a given object.
If they go in a linear block, it should be possible to check vtable
before the first call, then store vtable pointer and reuse it for
the second vcall without any additional checks.

This is expected to have a positive performance impact on a hot
path in Blink, see https://crbug.com/634139.

Reviewers: kcc

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

llvm-svn: 277795

7 years agoSimplify. NFC.
Rui Ueyama [Fri, 5 Aug 2016 01:25:45 +0000 (01:25 +0000)]
Simplify. NFC.

llvm-svn: 277794

7 years agoInstCombine: Clean up some trailing whitespace. NFC
Justin Bogner [Fri, 5 Aug 2016 01:09:48 +0000 (01:09 +0000)]
InstCombine: Clean up some trailing whitespace. NFC

llvm-svn: 277793

7 years agoInstCombine: Replace some never-null pointers with references. NFC
Justin Bogner [Fri, 5 Aug 2016 01:06:44 +0000 (01:06 +0000)]
InstCombine: Replace some never-null pointers with references. NFC

llvm-svn: 277792

7 years agoMove invariants outside of a lambda. NFC.
Rui Ueyama [Fri, 5 Aug 2016 01:05:01 +0000 (01:05 +0000)]
Move invariants outside of a lambda. NFC.

llvm-svn: 277791

7 years agoMake combine() non-member function.
Rui Ueyama [Fri, 5 Aug 2016 01:04:59 +0000 (01:04 +0000)]
Make combine() non-member function.

Because this function depends only on its arguments.

llvm-svn: 277790

7 years agoChange the indexing done for kernel/kext directories to be recursive.
Jason Molenda [Fri, 5 Aug 2016 00:44:34 +0000 (00:44 +0000)]
Change the indexing done for kernel/kext directories to be recursive.
Also re-write how most of the directory indexing is done - as it has
grown over the years, it has become a bit of a mess and was overdue
for a cleanup.

Most importantly, this allows you to specify a directory with the
platform.plugin.darwin-kernel.kext-directories setting and now lldb
will search for kexts and kernels in those directories recursively.

<rdar://problem/20754467>

llvm-svn: 277789

7 years ago[LIT][Darwin] Change %ld64 to be prefixed with DYLD_INSERT_LIBRARIES
Bruno Cardoso Lopes [Thu, 4 Aug 2016 23:58:30 +0000 (23:58 +0000)]
[LIT][Darwin] Change %ld64 to be prefixed with DYLD_INSERT_LIBRARIES

Followup from r277778, after Mehdi's comments.

Expand %ld64 to perform the necessary preload instead, that way new
tests do not need to worry about setting up DYLD_INSERT_LIBRARIES
themselves.

rdar://problem/24300926

llvm-svn: 277788

7 years ago[Sema] Add sizeof diagnostics for bzero
Bruno Cardoso Lopes [Thu, 4 Aug 2016 23:55:22 +0000 (23:55 +0000)]
[Sema] Add sizeof diagnostics for bzero

For memset (and others) we can get diagnostics like:

  struct stat { int x; };
  void foo(struct stat *stamps) {
    bzero(stamps, sizeof(stamps));
    memset(stamps, 0, sizeof(stamps));
  }

  t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess]
    memset(stamps, 0, sizeof(stamps));
           ~~~~~~            ^~~~~~
  t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
    memset(stamps, 0, sizeof(stamps));
                             ^~~~~~

This patch implements the same class of warnings for bzero.

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

rdar://problem/18963514

llvm-svn: 277787

7 years agoGVN-hoist: enable by default
Sebastian Pop [Thu, 4 Aug 2016 23:49:07 +0000 (23:49 +0000)]
GVN-hoist: enable by default

llvm-svn: 277786

7 years agoGVN-hoist: fix early exit logic
Sebastian Pop [Thu, 4 Aug 2016 23:49:05 +0000 (23:49 +0000)]
GVN-hoist: fix early exit logic

The patch splits a complex && if condition into easier to read and understand
logic.  That wrong early exit condition was letting some instructions with not
all operands available pass through when HoistingGeps was true.

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

llvm-svn: 277785

7 years agoIR: Provide an IRBuilder Inserter that calls a callback after insertion
Justin Bogner [Thu, 4 Aug 2016 23:41:01 +0000 (23:41 +0000)]
IR: Provide an IRBuilder Inserter that calls a callback after insertion

Add a generalized IRBuilderCallbackInserter, which is just given a
callback to execute after insertion. This can be used to get rid of
the custom inserter in InstCombine, which will in turn allow me to add
target specific InstCombineCalls API for intrinsics without horrible
layering violations.

llvm-svn: 277784

7 years ago[ADT] Migrate DepthFirstIterator to use NodeRef
Tim Shen [Thu, 4 Aug 2016 23:03:44 +0000 (23:03 +0000)]
[ADT] Migrate DepthFirstIterator to use NodeRef

Summary: The corresponding LLVM change is D23146.

Reviewers: dblaikie, chandlerc

Subscribers: cfe-commits

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

llvm-svn: 277783

7 years ago[LV, X86] Be more optimistic about vectorizing shifts.
Michael Kuperstein [Thu, 4 Aug 2016 22:48:03 +0000 (22:48 +0000)]
[LV, X86] Be more optimistic about vectorizing shifts.

Shifts with a uniform but non-constant count were considered very expensive to
vectorize, because the splat of the uniform count and the shift would tend to
appear in different blocks. That made the splat invisible to ISel, and we'd
scalarize the shift at codegen time.

Since r201655, CodeGenPrepare sinks those splats to be next to their use, and we
are able to select the appropriate vector shifts. This updates the cost model to
to take this into account by making shifts by a uniform cheap again.

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

llvm-svn: 277782

7 years agoSplit InputSectionDescription::Sort into SortInner and SortOuter.
Rui Ueyama [Thu, 4 Aug 2016 22:27:00 +0000 (22:27 +0000)]
Split InputSectionDescription::Sort into SortInner and SortOuter.

Summary:
The comparator function to compare input sections as instructed by
SORT command was a bit too complicated because it needed to handle
four different cases. This patch split it into two function calls.

This patch also simplifies the parser.

Reviewers: grimar

Subscribers: llvm-commits

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

llvm-svn: 277780

7 years ago[InstCombine] use m_APInt to allow icmp eq (mul X, C1), C2 folds for splat constant...
Sanjay Patel [Thu, 4 Aug 2016 22:19:27 +0000 (22:19 +0000)]
[InstCombine] use m_APInt to allow icmp eq (mul X, C1), C2 folds for splat constant vectors

This concludes the splat vector enhancements for foldICmpEqualityWithConstant().
Other commits in this series:
https://reviews.llvm.org/rL277762
https://reviews.llvm.org/rL277752
https://reviews.llvm.org/rL277738
https://reviews.llvm.org/rL277731
https://reviews.llvm.org/rL277659
https://reviews.llvm.org/rL277638
https://reviews.llvm.org/rL277629

llvm-svn: 277779

7 years ago[LIT][Darwin] Preload libclang_rt.asan_osx_dynamic.dylib when necessary
Bruno Cardoso Lopes [Thu, 4 Aug 2016 22:01:38 +0000 (22:01 +0000)]
[LIT][Darwin] Preload libclang_rt.asan_osx_dynamic.dylib when necessary

Green Dragon's darwin stage2 asan bot fails on some checks:
http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check

  test/tools/lto/hide-linkonce-odr.ll
  test/tools/lto/opt-level.ll

ERROR: Interceptors are not working. This may be because
AddressSanitizer is loaded too late (e.g. via dlopen)

To fix this, %ld64 needs to load 'libclang_rt.asan_osx_dynamic.dylib'
before libLTO.dylib, via DYLD_INSERT_LIBRARIES. This won't work by
updating config.environment, since some shim binary in the way scrubs
the env vars. Instead, provide the path to this lib through %asanrtlib,
which can then be used by tests directly with DYLD_INSERT_LIBRARIES.

rdar://problem/24300926

llvm-svn: 277778

7 years agobuiltins: split out the EABI and VFP ARM sources
Saleem Abdulrasool [Thu, 4 Aug 2016 21:58:39 +0000 (21:58 +0000)]
builtins: split out the EABI and VFP ARM sources

These are meant to only be included on certain targets.  This only disables it
for Windows ARM for now.  Ideally these would be conditionally included as
appropriate.

llvm-svn: 277777

7 years agoClean up the logic of the Archive::Child::Child() with an assert to know Err is not...
Kevin Enderby [Thu, 4 Aug 2016 21:54:19 +0000 (21:54 +0000)]
Clean up the logic of the Archive::Child::Child() with an assert to know Err is not a nullptr
when we are pointed at real data.

David Blaikie pointed out some odd logic in the case the Err value was a nullptr and
Lang Hames suggested it could be cleaned it up with an assert to know that Err is
not a nullptr when we are pointed at real data.  As only in the case of constructing
the sentinel value by pointing it at null data is Err is permitted to be a nullptr,
since no error could occur in that case.

With this change the testing for “if (Err)” is removed from the constructor’s logic
and *Err is used directly without any check after the assert().

llvm-svn: 277776

7 years agoGlobalISel: extend add widening to SUB, MUL, OR, AND and XOR.
Tim Northover [Thu, 4 Aug 2016 21:39:49 +0000 (21:39 +0000)]
GlobalISel: extend add widening to SUB, MUL, OR, AND and XOR.

These are the operations that are trivially identical. Division is omitted for
now because you need to use the correct sign/zero extension.

llvm-svn: 277775

7 years agoGlobalISel: add support for G_MUL
Tim Northover [Thu, 4 Aug 2016 21:39:44 +0000 (21:39 +0000)]
GlobalISel: add support for G_MUL

llvm-svn: 277774

7 years ago[CloneFunction] Add a testcase for r277691/r277693
David Majnemer [Thu, 4 Aug 2016 21:28:59 +0000 (21:28 +0000)]
[CloneFunction] Add a testcase for r277691/r277693

PR28848 had a very nice reduction of the underlying cause of the bug.
Our ValueMap had, in an entry for an Instruction, a ConstantInt.

This is not at all unexpected but should be handled properly.

llvm-svn: 277773

7 years agoUse "llvm-objdump -s" instead of hexdump command.
Rui Ueyama [Thu, 4 Aug 2016 21:23:30 +0000 (21:23 +0000)]
Use "llvm-objdump -s" instead of hexdump command.

llvm-svn: 277771

7 years ago[Mach0YAML] Change n_type from uint8_t to llvm::yaml::Hex8
Chris Bieneman [Thu, 4 Aug 2016 21:07:39 +0000 (21:07 +0000)]
[Mach0YAML] Change n_type from uint8_t to llvm::yaml::Hex8

Since this field is generally masked, it is way easier to understand it as a Hex value than decimal.

llvm-svn: 277770

7 years agoGlobalISel: implement narrowing for G_ADD.
Tim Northover [Thu, 4 Aug 2016 20:54:13 +0000 (20:54 +0000)]
GlobalISel: implement narrowing for G_ADD.

llvm-svn: 277769

7 years agoGlobalISel: refuse to halve size of 1-byte & odd-sized LLTs.
Tim Northover [Thu, 4 Aug 2016 20:54:05 +0000 (20:54 +0000)]
GlobalISel: refuse to halve size  of 1-byte & odd-sized LLTs.

llvm-svn: 277768

7 years agoGVNHoist: Don't hoist convergent calls
Matt Arsenault [Thu, 4 Aug 2016 20:52:57 +0000 (20:52 +0000)]
GVNHoist: Don't hoist convergent calls

llvm-svn: 277767

7 years ago[ExecutionEngine] Refactor - Roll JITSymbolFlags functionality into JITSymbol.h
Lang Hames [Thu, 4 Aug 2016 20:32:37 +0000 (20:32 +0000)]
[ExecutionEngine] Refactor - Roll JITSymbolFlags functionality into JITSymbol.h
and remove the JITSymbolFlags header.

llvm-svn: 277766

7 years ago[coroutines] Part 4[ab]: Coroutine Devirtualization: Lower coro.resume and coro.destroy.
David Majnemer [Thu, 4 Aug 2016 20:30:07 +0000 (20:30 +0000)]
[coroutines] Part 4[ab]: Coroutine Devirtualization: Lower coro.resume and coro.destroy.

This is the forth patch in the coroutine series. CoroEaly pass now lowers coro.resume
and coro.destroy intrinsics by replacing them with an indirect call to an address
returned by coro.subfn.addr intrinsic. This is done so that CGPassManager recognizes
devirtualization when CoroElide replaces a call to coro.subfn.addr with an appropriate
function address.

Patch by Gor Nishanov!

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

llvm-svn: 277765

7 years agoAvoid re-entrancy between __sanitizer::Report, OutputDebugString, and RtlRaiseException
Reid Kleckner [Thu, 4 Aug 2016 20:05:13 +0000 (20:05 +0000)]
Avoid re-entrancy between __sanitizer::Report, OutputDebugString, and RtlRaiseException

Our Report implementation calls OutputDebugString, which calls
RtlRaiseException, which can re-enter back into the ASan runtime and
cause a hang.

Don't treat this special debugger-only exception code as a noreturn
event, since the stack won't really unwind all the way.

llvm-svn: 277763

7 years ago[InstCombine] use m_APInt to allow icmp eq (and X, C1), C2 folds for splat constant...
Sanjay Patel [Thu, 4 Aug 2016 20:05:02 +0000 (20:05 +0000)]
[InstCombine] use m_APInt to allow icmp eq (and X, C1), C2 folds for splat constant vectors

llvm-svn: 277762

7 years ago[MachO] Factor out some common code in the Driver.
Davide Italiano [Thu, 4 Aug 2016 19:56:26 +0000 (19:56 +0000)]
[MachO] Factor out some common code in the Driver.

llvm-svn: 277761

7 years ago[MachO/Core] Remove (now) unused static member function. NFCI.
Davide Italiano [Thu, 4 Aug 2016 19:49:11 +0000 (19:49 +0000)]
[MachO/Core] Remove (now) unused static member function. NFCI.

llvm-svn: 277760

7 years ago[OpenCL] Add missing tests for getOCLTypeName
Yaxun Liu [Thu, 4 Aug 2016 19:45:00 +0000 (19:45 +0000)]
[OpenCL] Add missing tests for getOCLTypeName

Adding missing tests for OCL type names for half, float, double, char, short, long, and unknown.

Patch by Aaron En Ye Shi.

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

llvm-svn: 277759

7 years ago[CodeView] Use llvm::Error instead of std::error_code.
Zachary Turner [Thu, 4 Aug 2016 19:39:55 +0000 (19:39 +0000)]
[CodeView] Use llvm::Error instead of std::error_code.

This eliminates the remnants of std::error_code from the
DebugInfo libraries.

llvm-svn: 277758

7 years ago[analyzer] Make CloneDetector recognize different variable patterns.
Artem Dergachev [Thu, 4 Aug 2016 19:37:00 +0000 (19:37 +0000)]
[analyzer] Make CloneDetector recognize different variable patterns.

CloneDetector should be able to detect clones with renamed variables.
However, if variables are referenced multiple times around the code sample,
the usage patterns need to be recognized.

For example, (x < y ? y : x) and (y < x ? y : x) are no longer clones,
however (a < b ? b : a) is still a clone of the former.

Variable patterns are computed and compared during a separate filtering pass.

Patch by Raphael Isemann!

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

llvm-svn: 277757

7 years ago[OpenCL] Add the lit test for image size which was omitted by r277647.
Yaxun Liu [Thu, 4 Aug 2016 19:35:17 +0000 (19:35 +0000)]
[OpenCL] Add the lit test for image size which was omitted by r277647.

llvm-svn: 277756

7 years agoAArch64: don't assume all i128s are BUILD_PAIRs
Tim Northover [Thu, 4 Aug 2016 19:32:28 +0000 (19:32 +0000)]
AArch64: don't assume all i128s are BUILD_PAIRs

It leads to a crash when they're not. I'm *sure* I've made this mistake before,
at least once.

llvm-svn: 277755

7 years ago[OpenCL] Remove extra native_ functions from opencl-c.h
Yaxun Liu [Thu, 4 Aug 2016 19:30:54 +0000 (19:30 +0000)]
[OpenCL] Remove extra native_ functions from opencl-c.h

There should be no native_ builtin functions with double type arguments.

Patch by Aaron En Ye Shi.

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

llvm-svn: 277754

7 years ago[macho2yaml] String table can contain null strings
Chris Bieneman [Thu, 4 Aug 2016 19:19:25 +0000 (19:19 +0000)]
[macho2yaml] String table can contain null strings

Since the string table being read from the MachO is a properly bounded StringRef including null strings is safe and reasonable.

This occurs frequently with stripped binaries where the string table has been modified.

llvm-svn: 277753

7 years ago[InstCombine] use m_APInt to allow icmp eq (or X, C1), C2 folds for splat constant...
Sanjay Patel [Thu, 4 Aug 2016 19:12:12 +0000 (19:12 +0000)]
[InstCombine] use m_APInt to allow icmp eq (or X, C1), C2 folds for splat constant vectors

llvm-svn: 277752

7 years agoGlobalISel: also add G_TRUNC to IRTranslator.
Tim Northover [Thu, 4 Aug 2016 18:35:17 +0000 (18:35 +0000)]
GlobalISel: also add G_TRUNC to IRTranslator.

llvm-svn: 277749

7 years agoGlobalISel: add code to widen scalar G_ADD
Tim Northover [Thu, 4 Aug 2016 18:35:11 +0000 (18:35 +0000)]
GlobalISel: add code to widen scalar G_ADD

llvm-svn: 277747

7 years agofix whitespaces from https://reviews.llvm.org/D23170
Etienne Bergeron [Thu, 4 Aug 2016 18:30:41 +0000 (18:30 +0000)]
fix whitespaces from https://reviews.llvm.org/D23170

llvm-svn: 277746

7 years ago[compiler-rt] Fix memory allocator for dynamic address space
Etienne Bergeron [Thu, 4 Aug 2016 18:15:38 +0000 (18:15 +0000)]
[compiler-rt] Fix memory allocator for dynamic address space

Summary:
The sanitizer allocators can works with a dynamic address space
(i.e. specified with ~0ULL).

Unfortunately, the code was broken on GetMetadata and GetChunkIdx.

The current patch is moving the Win64 memory test to a dynamic
address space. There is a migration to move every concept to a
dynamic address space on windows.

To have a better coverage, the unittest are now testing
dynamic address space on other platforms too.

Reviewers: rnk, kcc

Subscribers: kubabrecka, dberris, llvm-commits, chrisha

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

llvm-svn: 277745

7 years agoremove FIXME comments (fixed with r277738)
Sanjay Patel [Thu, 4 Aug 2016 18:14:02 +0000 (18:14 +0000)]
remove FIXME comments (fixed with r277738)

llvm-svn: 277744

7 years ago[OpenCL] Added underscores to the names of 'to_addr' OpenCL built-ins.
Alexey Bader [Thu, 4 Aug 2016 18:06:27 +0000 (18:06 +0000)]
[OpenCL] Added underscores to the names of 'to_addr' OpenCL built-ins.

Summary:
In order to re-define OpenCL built-in functions
'to_{private,local,global}' in OpenCL run-time library LLVM names must
be different from the clang built-in function names.

Reviewers: yaxunl, Anastasia

Subscribers: cfe-commits

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

llvm-svn: 277743

7 years ago[WebAssembly] Check return value of getRegForValue in FastISel
Derek Schuff [Thu, 4 Aug 2016 18:01:52 +0000 (18:01 +0000)]
[WebAssembly] Check return value of getRegForValue in FastISel

Previously, FastISel for WebAssembly wasn't checking the return value of
`getRegForValue` in certain cases, which would generate instructions
referencing NoReg. This patch fixes this behavior.

Patch by Dominic Chen

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

llvm-svn: 277742

7 years ago[llvm-cov] Add some documentation for the -tab-size option
Vedant Kumar [Thu, 4 Aug 2016 18:00:42 +0000 (18:00 +0000)]
[llvm-cov] Add some documentation for the -tab-size option

Also, un-hide the cl::opt.

llvm-svn: 277741

7 years ago[Hexagon] Validate register class when doing bit simplification
Krzysztof Parzyszek [Thu, 4 Aug 2016 17:56:19 +0000 (17:56 +0000)]
[Hexagon] Validate register class when doing bit simplification

llvm-svn: 277740

7 years ago[InstCombine] use m_APInt to allow icmp eq (op X, Y), C folds for splat constant...
Sanjay Patel [Thu, 4 Aug 2016 17:48:04 +0000 (17:48 +0000)]
[InstCombine] use m_APInt to allow icmp eq (op X, Y), C folds for splat constant vectors

I'm removing a misplaced pair of more specific folds from InstCombine in this patch as well,
so we know where those folds are happening in InstSimplify.

llvm-svn: 277738

7 years ago[X86][SSE] Rename target shuffle unary permute matching function. NFCI.
Simon Pilgrim [Thu, 4 Aug 2016 17:16:50 +0000 (17:16 +0000)]
[X86][SSE] Rename target shuffle unary permute matching function. NFCI.

In preparation for adding a binary permute matching function.

llvm-svn: 277737

7 years agoadd tests for missing vector folds
Sanjay Patel [Thu, 4 Aug 2016 16:48:30 +0000 (16:48 +0000)]
add tests for missing vector folds

llvm-svn: 277736

7 years agoLoadStoreVectorizer: Remove TargetBaseAlign. Keep alignment for stack adjustments.
Alina Sbirlea [Thu, 4 Aug 2016 16:38:44 +0000 (16:38 +0000)]
LoadStoreVectorizer: Remove TargetBaseAlign. Keep alignment for stack adjustments.

Summary:
TargetBaseAlign is no longer required since LSV checks if target allows misaligned accesses.
A constant defining a base alignment is still needed for stack accesses where alignment can be adjusted.

Previous patch (D22936) was reverted because tests were failing. This patch also fixes the cause of those failures:
- x86 failing tests either did not have the right target, or the right alignment.
- NVPTX failing tests did not have the right alignment.
- AMDGPU failing test (merge-stores) should allow vectorization with the given alignment but the target info
  considers <3xi32> a non-standard type and gives up early. This patch removes the condition and only checks
  for a maximum size allowed and relies on the next condition checking for %4 for correctness.
  This should be revisited to include 3xi32 as a MVT type (on arsenm's non-immediate todo list).

Note that checking the sizeInBits for a MVT is undefined (leads to an assertion failure),
so we need to create an EVT, hence the interface change in allowsMisaligned to include the Context.

Reviewers: arsenm, jlebar, tstellarAMD

Subscribers: jholewinski, arsenm, mzolotukhin, llvm-commits

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

llvm-svn: 277735

7 years agoShamelessly add myself to CREDITS.TXT
Adrian Prantl [Thu, 4 Aug 2016 16:28:22 +0000 (16:28 +0000)]
Shamelessly add myself to CREDITS.TXT

llvm-svn: 277734

7 years ago[ASAN] Mark test/asan/TestCases/ill.cc as unsupported on darwin
Bruno Cardoso Lopes [Thu, 4 Aug 2016 15:57:30 +0000 (15:57 +0000)]
[ASAN] Mark test/asan/TestCases/ill.cc as unsupported on darwin

Introduced in r277621, this test is currently failing all around in
public bots: http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/20787
and internal bots. Mark it as unsupported on darwin until we figure
out how it should behave.

llvm-svn: 277733