platform/upstream/llvm.git
8 years ago[FlattenCFG] Simplify + remove unused variable. NFCI.
Davide Italiano [Fri, 5 Aug 2016 20:53:35 +0000 (20:53 +0000)]
[FlattenCFG] Simplify + remove unused variable. NFCI.

llvm-svn: 277864

8 years agoRemove cold callsite heuristic that is not necessary because of cold callee heuristic.
Dehao Chen [Fri, 5 Aug 2016 20:49:04 +0000 (20:49 +0000)]
Remove cold callsite heuristic that is not necessary because of cold callee heuristic.

llvm-svn: 277863

8 years ago[sanitizers] remove failing test.
Mike Aizatsky [Fri, 5 Aug 2016 20:48:48 +0000 (20:48 +0000)]
[sanitizers] remove failing test.

The test often fails on Windows because there are more branches
in the code that is generated.

llvm-svn: 277862

8 years ago[SCEV] Un-grep'ify tests; NFC
Sanjoy Das [Fri, 5 Aug 2016 20:33:49 +0000 (20:33 +0000)]
[SCEV] Un-grep'ify tests; NFC

llvm-svn: 277861

8 years agoReplace hot-callsite based heuristic to use its own threshold parameter instead of...
Dehao Chen [Fri, 5 Aug 2016 20:28:41 +0000 (20:28 +0000)]
Replace hot-callsite based heuristic to use its own threshold parameter instead of share inline-hint parameter

Summary: Hot callsites should have higher threshold than inline hints. This patch uses separate threshold parameter for hot callsites.

Reviewers: davidxl, eraman

Subscribers: Prazek, llvm-commits

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

llvm-svn: 277860

8 years ago[sanitizers] trace buffer API to use user-allocated buffer.
Mike Aizatsky [Fri, 5 Aug 2016 20:09:53 +0000 (20:09 +0000)]
[sanitizers] trace buffer API to use user-allocated buffer.

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

llvm-svn: 277859

8 years ago[sanitizers] trace buffer API to use user-allocated buffer.
Mike Aizatsky [Fri, 5 Aug 2016 20:09:42 +0000 (20:09 +0000)]
[sanitizers] trace buffer API to use user-allocated buffer.

Subscribers: kubabrecka

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

llvm-svn: 277858

8 years agoUpdate outdated comments in the new PM internals (NFC)
Mehdi Amini [Fri, 5 Aug 2016 19:51:00 +0000 (19:51 +0000)]
Update outdated comments in the new PM internals (NFC)

The analysis manager was made not optional and turned into a
reference instead of a pointer in r272978. Some comments were
still refering to the previous behavior.

llvm-svn: 277857

8 years agoWholeProgramDevirt: print remarks with devirtualized method names.
Ivan Krasin [Fri, 5 Aug 2016 19:45:16 +0000 (19:45 +0000)]
WholeProgramDevirt: print remarks with devirtualized method names.

Summary:
Chrome on Linux uses WholeProgramDevirt for speed ups, and it's
important to detect regressions on both sides: the toolchain,
if fewer methods get devirtualized after an update, and Chrome,
if an innocently looking change caused many hot methods become
virtual again.

The need to track devirtualized methods is not Chrome-specific,
but it's probably the only user of the pass at this time.

Reviewers: kcc

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

llvm-svn: 277856

8 years ago[ADCE] Refactoring for new functionality (NFC)
David Callahan [Fri, 5 Aug 2016 19:38:11 +0000 (19:38 +0000)]
[ADCE] Refactoring for new functionality (NFC)

Summary:
This is another refactoring to break up the one function into three logical components functions.
Another non-functional change before we start added in features.

Reviewers: nadav, mehdi_amini, majnemer

Subscribers: twoh, freik, llvm-commits

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

llvm-svn: 277855

8 years ago[ConstantFolding] Don't create illegal (non-integral) inttoptrs
Sanjoy Das [Fri, 5 Aug 2016 19:23:29 +0000 (19:23 +0000)]
[ConstantFolding] Don't create illegal (non-integral) inttoptrs

Reviewers: majnemer, arsenm

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 277854

8 years agofix documentation comments; NFC
Sanjay Patel [Fri, 5 Aug 2016 19:09:25 +0000 (19:09 +0000)]
fix documentation comments; NFC

llvm-svn: 277853

8 years agoPR26423: Assert on valid use of using declaration of a function with an undeduced...
David Blaikie [Fri, 5 Aug 2016 19:03:01 +0000 (19:03 +0000)]
PR26423: Assert on valid use of using declaration of a function with an undeduced auto return type

For now just disregard the using declaration in this case. Suboptimal,
but wiring up the ability to have declarations of functions that are
separate from their definition (we currently only do that for member
functions) and have differing return types (we don't have any support
for that) is more work than seems reasonable to at least fix this crash.

llvm-svn: 277852

8 years agofix random typos [NFC]
Etienne Bergeron [Fri, 5 Aug 2016 18:49:08 +0000 (18:49 +0000)]
fix random typos [NFC]

llvm-svn: 277850

8 years ago[AutoFDO] Fix handling of empty profiles
David Callahan [Fri, 5 Aug 2016 18:38:19 +0000 (18:38 +0000)]
[AutoFDO] Fix handling of empty profiles

Summary:
If a profile has no samples for a function, then the function "entry count" is set to the value 0. Several places in the code test that if the Function::getEntryCount is defined at all. Here we change to treat a 0 entry count the same as undefined.

In particular, this fixes a problem in getLayoutSuccessorProbThreshold in MachineBlockPlacement.cpp where we use a different and inferior heuristic for laying out basic blocks.

Reviewers: danielcdh, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 277849

8 years ago[SCEV] Don't infinitely recurse on unreachable code
Sanjoy Das [Fri, 5 Aug 2016 18:34:14 +0000 (18:34 +0000)]
[SCEV] Don't infinitely recurse on unreachable code

llvm-svn: 277848

8 years ago[ORC] Change LogicalDylib::LogicalModuleHandle from an iterator to an index.
Lang Hames [Fri, 5 Aug 2016 18:26:56 +0000 (18:26 +0000)]
[ORC] Change LogicalDylib::LogicalModuleHandle from an iterator to an index.

This prevents handles from being invalidated (through iterator invalidation)
when new modules are added.

No test-case yet: This bug was uncovered during work on an upcoming patch for
weak symbol support and the testcase for that feature will implicitly test for
correct behavior here.

llvm-svn: 277847

8 years agoCOFF ARM: Apply an existing offset in MOV32T relocations
Saleem Abdulrasool [Fri, 5 Aug 2016 18:20:31 +0000 (18:20 +0000)]
COFF ARM: Apply an existing offset in MOV32T relocations

Don't blindly OR in the new value, but clear the existing one, since it can be
nonzero. Read out the existing value before, and add into the desired offset.
(The add is done outside of the applyMOV, to handle potential overflow between
the two.)

Patch by Martin Storsjö!

llvm-svn: 277846

8 years agoAdd the first of what will be a long line of additional error checks for invalid...
Kevin Enderby [Fri, 5 Aug 2016 18:19:40 +0000 (18:19 +0000)]
Add the first of what will be a long line of additional error checks for invalid Mach-O files.

This is where an LC_SEGMENT load command has a fileoff field that
extends past the end of the file.

Also fix llvm-nm and llvm-size to remove the errorToErrorCode() call so error messages are printed.
And needed to update a few test cases now that they do print the error messages just a
bit differently.

llvm-svn: 277845

8 years agoTweaks to the reporting of "missing dyld shared cached" that make it easier to grab...
Enrico Granata [Fri, 5 Aug 2016 18:09:50 +0000 (18:09 +0000)]
Tweaks to the reporting of "missing dyld shared cached" that make it easier to grab logs when such issues occur, make the logs more helpful, and also tweaks to the user messaging to make it easier to pinpoint an investigation avenue early on

llvm-svn: 277844

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

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

llvm-svn: 277816

8 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

8 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

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

llvm-svn: 277812

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

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

llvm-svn: 277794

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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