platform/upstream/llvm.git
7 years agoGPGPU: Do not run mostly sequential kernels in GPU
Tobias Grosser [Sun, 18 Sep 2016 08:31:09 +0000 (08:31 +0000)]
GPGPU: Do not run mostly sequential kernels in GPU

In case sequential kernels are found deeper in the loop tree than any parallel
kernel, the overall scop is probably mostly sequential. Hence, run it on the
CPU.

llvm-svn: 281849

7 years agoGPGPU: Dynamically ensure 'sufficient compute'
Tobias Grosser [Sun, 18 Sep 2016 06:50:35 +0000 (06:50 +0000)]
GPGPU: Dynamically ensure 'sufficient compute'

Offloading to a GPU is only beneficial if there is a sufficient amount of
compute that can be accelerated. Many kernels just have a very small number
of dynamic compute, which means GPU acceleration is not beneficial. We
compute at run-time an approximation of how many dynamic instructions will be
executed and fall back to CPU code in case this number is not sufficiently
large. To keep the run-time checking code simple, we over-approximate the
number of instructions executed in each statement by computing the volume of
the rectangular hull of its iteration space.

llvm-svn: 281848

7 years agoGPGPU: Make test cases independent of register numbering [NFC]
Tobias Grosser [Sun, 18 Sep 2016 06:50:28 +0000 (06:50 +0000)]
GPGPU: Make test cases independent of register numbering [NFC]

llvm-svn: 281847

7 years agoChange the order of the splitted store from high - low to low - high.
Wei Mi [Sun, 18 Sep 2016 06:10:32 +0000 (06:10 +0000)]
Change the order of the splitted store from high - low to low - high.
It is a trivial change which could make the testcase easier to be reused
for the store splitting in CodeGenPrepare.

llvm-svn: 281846

7 years ago[libFuzzer] use 'if guard' instead of 'if guard >= 0' with trace-pc; change the guard...
Kostya Serebryany [Sun, 18 Sep 2016 04:52:23 +0000 (04:52 +0000)]
[libFuzzer] use 'if guard' instead of 'if guard >= 0' with trace-pc; change the guard type to intptr_t; use separate array for 8-bit counters

llvm-svn: 281845

7 years ago[llvm-objump] Simplify the code. NFCI.
Davide Italiano [Sun, 18 Sep 2016 04:39:15 +0000 (04:39 +0000)]
[llvm-objump] Simplify the code. NFCI.

llvm-svn: 281844

7 years ago[lib/LTO] Try harder to reduce code duplication. NFCI.
Davide Italiano [Sat, 17 Sep 2016 22:32:42 +0000 (22:32 +0000)]
[lib/LTO] Try harder to reduce code duplication. NFCI.

llvm-svn: 281843

7 years ago[X86][SSE] Added vector udiv combine tests
Simon Pilgrim [Sat, 17 Sep 2016 22:02:23 +0000 (22:02 +0000)]
[X86][SSE] Added vector udiv combine tests

llvm-svn: 281842

7 years ago[X86][SSE] Added vector fcopysign combine tests
Simon Pilgrim [Sat, 17 Sep 2016 21:31:34 +0000 (21:31 +0000)]
[X86][SSE] Added vector fcopysign combine tests

Also demonstrating the poor lowering of fcopysign...

llvm-svn: 281841

7 years ago[ThinLTO] Ensure anonymous globals renamed even at -O0
Teresa Johnson [Sat, 17 Sep 2016 20:40:16 +0000 (20:40 +0000)]
[ThinLTO] Ensure anonymous globals renamed even at -O0

Summary:
This fixes an issue when files are compiled with -flto=thin
at default -O0. We need to rename anonymous globals before attempting
to write the module summary because all values need names for
the summary. This was happening at -O1 and above, but not before
the early exit when constructing the pipeline for -O0.

Also add an internal -prepare-for-thinlto option to enable this
to be tested via opt.

Fixes PR30419.

Reviewers: mehdi_amini

Subscribers: probinson, llvm-commits, mehdi_amini

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

llvm-svn: 281840

7 years ago[X86][SSE] Added vector mul combine tests
Simon Pilgrim [Sat, 17 Sep 2016 20:06:16 +0000 (20:06 +0000)]
[X86][SSE] Added vector mul combine tests

llvm-svn: 281839

7 years agoGPGPU: Store back non-read-only scalars
Tobias Grosser [Sat, 17 Sep 2016 19:22:31 +0000 (19:22 +0000)]
GPGPU: Store back non-read-only scalars

We may generate GPU kernels that store into scalars in case we run some
sequential code on the GPU because the remaining data is expected to already be
on the GPU. For these kernels it is important to not keep the scalar values
in thread-local registers, but to store them back to the corresponding device
memory objects that backs them up.

We currently only store scalars back at the end of a kernel. This is only
correct if precisely one thread is executed. In case more than one thread may
be run, we currently invalidate the scop. To support such cases correctly,
we would need to always load and store back from a corresponding global
memory slot instead of a thread-local alloca slot.

llvm-svn: 281838

7 years agoGPGPU: Detect read-only scalar arrays ...
Tobias Grosser [Sat, 17 Sep 2016 19:22:18 +0000 (19:22 +0000)]
GPGPU: Detect read-only scalar arrays ...

and pass these by value rather than by reference.

llvm-svn: 281837

7 years ago[ELF] - Fix comment. NFC.
George Rimar [Sat, 17 Sep 2016 19:21:05 +0000 (19:21 +0000)]
[ELF] - Fix comment. NFC.

llvm-svn: 281836

7 years ago[ELF] - Added comments. NFC.
George Rimar [Sat, 17 Sep 2016 19:17:25 +0000 (19:17 +0000)]
[ELF] - Added comments. NFC.

llvm-svn: 281835

7 years ago[X86][SSE] Improve target shuffle mask extraction
Simon Pilgrim [Sat, 17 Sep 2016 18:50:54 +0000 (18:50 +0000)]
[X86][SSE] Improve target shuffle mask extraction

Add ability to extract vXi64 'vzext_movl' masks on 32-bit targets

llvm-svn: 281834

7 years ago[X86][AVX] Test target shuffle combining on 32 and 64-bit targets
Simon Pilgrim [Sat, 17 Sep 2016 18:42:41 +0000 (18:42 +0000)]
[X86][AVX] Test target shuffle combining on 32 and 64-bit targets

llvm-svn: 281833

7 years ago[ELF] - Linkerscript: change locationcounter.s to use llvm-objdump
George Rimar [Sat, 17 Sep 2016 18:35:24 +0000 (18:35 +0000)]
[ELF] - Linkerscript: change locationcounter.s to use llvm-objdump

Previously it used llvm-readobj -s, now changed to llvm-objdump -section-headers,
that reduced the output significantly and helps to read/support it.

llvm-svn: 281832

7 years ago[ELF] - SEGMENT_START's default argument can be an expression
George Rimar [Sat, 17 Sep 2016 18:14:56 +0000 (18:14 +0000)]
[ELF] - SEGMENT_START's default argument can be an expression

Our implementation supported integer value previously.
ld can use expression,
for example, it is OK to write
 . = SEGMENT_START("foobar", .);

Patch implements that.

llvm-svn: 281831

7 years ago[X86][AVX2] Add target shuffle constant folding tests
Simon Pilgrim [Sat, 17 Sep 2016 17:42:15 +0000 (17:42 +0000)]
[X86][AVX2] Add target shuffle constant folding tests

llvm-svn: 281830

7 years ago[X86][AVX] Add target shuffle constant folding tests
Simon Pilgrim [Sat, 17 Sep 2016 17:41:14 +0000 (17:41 +0000)]
[X86][AVX] Add target shuffle constant folding tests

llvm-svn: 281829

7 years ago[X86][XOP] Add target shuffle constant folding tests
Simon Pilgrim [Sat, 17 Sep 2016 17:40:40 +0000 (17:40 +0000)]
[X86][XOP] Add target shuffle constant folding tests

llvm-svn: 281828

7 years ago[X86][SSSE3] Add target shuffle constant folding tests
Simon Pilgrim [Sat, 17 Sep 2016 17:40:08 +0000 (17:40 +0000)]
[X86][SSSE3] Add target shuffle constant folding tests

llvm-svn: 281827

7 years ago[clang-rename] Fix handling of unchanged files
Alexander Shaposhnikov [Sat, 17 Sep 2016 17:08:47 +0000 (17:08 +0000)]
[clang-rename] Fix handling of unchanged files

Fix the output of clang-rename for the files without modifications.
Update the code in clang-reorder-fields/tool/ClangReorderFields.cpp
to avoid inconsistency.

Example:
a.h:
struct A {};
a.cpp:
#include "a.h"
int main() { return 0; }

Before the changes the output looks like this:
clang-rename -qualified-name=A -new-name=B a.cpp
<<<<<INVALID SOURCE LOCATION>>>>>

Test plan: make -j8 check-clang-tools

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

llvm-svn: 281826

7 years ago[Hexagon] segv while processing SUnit with nullNodePtr
Ron Lieberman [Sat, 17 Sep 2016 16:21:09 +0000 (16:21 +0000)]
[Hexagon] segv while processing SUnit with nullNodePtr

Added BoundaryNode check to isBestZeroLatency function.

llvm-svn: 281825

7 years agoAMDGPU: Fix broken FrameIndex handling
Matt Arsenault [Sat, 17 Sep 2016 16:09:55 +0000 (16:09 +0000)]
AMDGPU: Fix broken FrameIndex handling

We were trying to avoid using a FrameIndex operand in non-pointer
operands in a convoluted way, and would break because of
using TargetFrameIndex. The TargetFrameIndex should only be used
in the case where it makes sense to fold it as part of the addressing
mode, otherwise it requires materialization like a normal constant.
This wasn't working reliably and failed in the added testcase, hitting
the assert when processing the frame index.

The TargetFrameIndex was coming from trying to produce an AssertZext
limiting the maximum stack size. I'm not sure this was correct to begin
with, because it is apparently possible to have a single workitem
dispatch that requires all 4G of private memory.

llvm-svn: 281824

7 years agoAMDGPU: Rename spill operands to match real instruction
Matt Arsenault [Sat, 17 Sep 2016 15:52:37 +0000 (15:52 +0000)]
AMDGPU: Rename spill operands to match real instruction

llvm-svn: 281823

7 years agoAMDGPU: Push bitcasts through build_vector
Matt Arsenault [Sat, 17 Sep 2016 15:44:16 +0000 (15:44 +0000)]
AMDGPU: Push bitcasts through build_vector

This reduces the number of copies and reg_sequences
when using fp constant vectors. This significantly
reduces the code size in local-stack-alloc-bug.ll

llvm-svn: 281822

7 years ago[tsan] Update fork_atexit.cc to consistently print to stderr (and not stdout)
Kuba Brecka [Sat, 17 Sep 2016 14:39:53 +0000 (14:39 +0000)]
[tsan] Update fork_atexit.cc to consistently print to stderr (and not stdout)

llvm-svn: 281821

7 years ago[tsan] Update signal_cond.cc to write to stderr intead of stdout
Kuba Brecka [Sat, 17 Sep 2016 14:33:36 +0000 (14:33 +0000)]
[tsan] Update signal_cond.cc to write to stderr intead of stdout

llvm-svn: 281820

7 years agoWhen replacements have the same offset, make replacements with smaller length order...
Eric Liu [Sat, 17 Sep 2016 12:26:42 +0000 (12:26 +0000)]
When replacements have the same offset, make replacements with smaller length order first in the set.

Summary:
No behavioral change intended. The change makes iterating the replacements set more intuitive in Replacements class implementation. Previously, insertion is ordered before an deletion/replacement with the same offset, which is counter-intuitive for implementation, especially for a followup patch to support adding insertions around replacements.

With the current ordering, we only need to make `applyAllReplacements` iterate the replacements set reversely when applying them so that deletion/replacement is still applied before insertion with the same offset.

Reviewers: klimek, djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 281819

7 years ago[ELF] Linkerscript: fixed bug about commands processing.
George Rimar [Sat, 17 Sep 2016 09:50:10 +0000 (09:50 +0000)]
[ELF] Linkerscript: fixed bug about commands processing.

It was possible situation about some commands just were not processed
(were skipped) because of a bug appeared when constraint checking used.

Testcase is attached.

llvm-svn: 281818

7 years ago[ELF] - Fixed mistypes in comments. NFC.
George Rimar [Sat, 17 Sep 2016 07:31:49 +0000 (07:31 +0000)]
[ELF] - Fixed mistypes in comments. NFC.

llvm-svn: 281817

7 years agoclang-format: [JS] Fix a crash in handledTemplateStrings.
Daniel Jasper [Sat, 17 Sep 2016 07:20:36 +0000 (07:20 +0000)]
clang-format: [JS] Fix a crash in handledTemplateStrings.

llvm-svn: 281816

7 years ago[compiler-rt] Disable building of profiling runtime when LLVM_USE_SANITIZER is set
Kuba Brecka [Sat, 17 Sep 2016 06:31:23 +0000 (06:31 +0000)]
[compiler-rt] Disable building of profiling runtime when LLVM_USE_SANITIZER is set

Currently, when doing a ASanified build of LLVM (with Clang, compiler-rt and libcxx) via -DLLVM_USE_SANITIZER=Address and not using any other options, we already disable building of sanitizer runtimes (because they themselves can’t be sanitized) and also exclude the sanitizer tests. However, the same is not done for the profiling runtime, which will build fine, but then all the tests fail due to linking errors. Let’s disable the profiling runtime as well (when LLVM_USE_SANITIZER is set).

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

llvm-svn: 281815

7 years ago[libFuzzer] properly reset the guards when reseting the coverage. Also try to fix...
Kostya Serebryany [Sat, 17 Sep 2016 06:01:55 +0000 (06:01 +0000)]
[libFuzzer] properly reset the guards when reseting the coverage. Also try to fix check-fuzzer on the bot

llvm-svn: 281814

7 years agoDon't create a SymbolTable in Function when the LLVMContext discards value names...
Mehdi Amini [Sat, 17 Sep 2016 06:00:02 +0000 (06:00 +0000)]
Don't create a SymbolTable in Function when the LLVMContext discards value names (NFC)

The ValueSymbolTable is used to detect name conflict and rename
instructions automatically. This is not needed when the value
names are automatically discarded by the LLVMContext.
No functional change intended, just saving a little bit of memory.

This is a recommit of r281806 after fixing the accessor to return
a pointer instead of a reference and updating all the call-sites.

llvm-svn: 281813

7 years ago[MIR Parser] Fix Build!
Mehdi Amini [Sat, 17 Sep 2016 05:41:02 +0000 (05:41 +0000)]
[MIR Parser] Fix Build!

Last-second refactoring before push was bad idea...

llvm-svn: 281812

7 years agoMIR Parser: issue an error when the Context discard value names.
Mehdi Amini [Sat, 17 Sep 2016 05:33:58 +0000 (05:33 +0000)]
MIR Parser: issue an error when the Context discard value names.

This is in line with the LLParser behavior

llvm-svn: 281811

7 years ago[libFuzzer] change trace-pc to use 8-byte guards
Kostya Serebryany [Sat, 17 Sep 2016 05:04:47 +0000 (05:04 +0000)]
[libFuzzer] change trace-pc to use 8-byte guards

llvm-svn: 281810

7 years ago[sanitizer-coverage] change trace-pc to use 8-byte guards
Kostya Serebryany [Sat, 17 Sep 2016 05:03:05 +0000 (05:03 +0000)]
[sanitizer-coverage] change trace-pc to use 8-byte guards

llvm-svn: 281809

7 years agoRevert "Don't create a SymbolTable in Function when the LLVMContext discards value...
Mehdi Amini [Sat, 17 Sep 2016 04:36:46 +0000 (04:36 +0000)]
Revert "Don't create a SymbolTable in Function when the LLVMContext discards value names (NFC)"

This reverts commit r281806. It introduces undefined behavior as an
API is returning a reference to the Symtab

llvm-svn: 281808

7 years agoDon't create a SymbolTable in Function when the LLVMContext discards value names...
Mehdi Amini [Sat, 17 Sep 2016 03:39:01 +0000 (03:39 +0000)]
Don't create a SymbolTable in Function when the LLVMContext discards value names (NFC)

The ValueSymbolTable is used to detect name conflict and rename
instructions automatically. This is not needed when the value
names are automatically discarded by the LLVMContext.
No functional change intended, just saving a little bit of memory.

llvm-svn: 281806

7 years agoAttempt to fix buildbot.
Rui Ueyama [Sat, 17 Sep 2016 02:34:50 +0000 (02:34 +0000)]
Attempt to fix buildbot.

llvm-svn: 281805

7 years agoFix boolean logic error in BreakpointID.
Zachary Turner [Sat, 17 Sep 2016 02:34:40 +0000 (02:34 +0000)]
Fix boolean logic error in BreakpointID.

llvm-svn: 281804

7 years agoUse named struct instead of unnamed std::pair.
Rui Ueyama [Sat, 17 Sep 2016 02:23:40 +0000 (02:23 +0000)]
Use named struct instead of unnamed std::pair.

It is important to give members names for readability.

llvm-svn: 281803

7 years agoDefine a versatile utility function and use it instead of a single purpose one.
Rui Ueyama [Sat, 17 Sep 2016 02:15:28 +0000 (02:15 +0000)]
Define a versatile utility function and use it instead of a single purpose one.

llvm-svn: 281802

7 years agoRemove unnecessary namespace specifiers.
Rui Ueyama [Sat, 17 Sep 2016 02:10:15 +0000 (02:10 +0000)]
Remove unnecessary namespace specifiers.

llvm-svn: 281801

7 years agoAMDGPU: Use i64 scalar compare instructions
Matt Arsenault [Sat, 17 Sep 2016 02:02:19 +0000 (02:02 +0000)]
AMDGPU: Use i64 scalar compare instructions

VI added eq/ne for i64, so use them.

llvm-svn: 281800

7 years agoConvert many functions to use StringRefs.
Zachary Turner [Sat, 17 Sep 2016 02:00:02 +0000 (02:00 +0000)]
Convert many functions to use StringRefs.

Where possible, remove the const char* version.  To keep the
risk and impact here minimal, I've only done the simplest
functions.

In the process, I found a few opportunities for adding some
unit tests, so I added those as well.

Tested on Windows, Linux, and OSX.

llvm-svn: 281799

7 years agoCodeGen: refactor the ObjC cstring literal creation
Saleem Abdulrasool [Fri, 16 Sep 2016 23:41:13 +0000 (23:41 +0000)]
CodeGen: refactor the ObjC cstring literal creation

This refactors the cstring literal creation as mentioned in the couple of FIXMEs
littered in the various invocations to CreateMetadataVar.  This centralises the
definition of the literals, and will enable changing the literal creation to a
single site.  NFC.

llvm-svn: 281798

7 years agoFix a couple of wrong-code bugs in switch-on-constant optimization:
Richard Smith [Fri, 16 Sep 2016 23:30:39 +0000 (23:30 +0000)]
Fix a couple of wrong-code bugs in switch-on-constant optimization:

 * recurse through intermediate LabelStmts and AttributedStmts when checking
   whether a statement inside a switch declares a variable
 * if the end of a compound statement is reachable from the chosen case label,
   and the compound statement contains a variable declaration, it's not valid
   to just emit the contents of the compound statement -- we must emit the
   statement itself or we lose the scope (and thus end lifetimes at the wrong
   point)

llvm-svn: 281797

7 years agoAdd REQUIRES line.
Peter Collingbourne [Fri, 16 Sep 2016 22:56:12 +0000 (22:56 +0000)]
Add REQUIRES line.

llvm-svn: 281796

7 years agoPartially fill Info stream with proper values.
Rui Ueyama [Fri, 16 Sep 2016 22:51:17 +0000 (22:51 +0000)]
Partially fill Info stream with proper values.

llvm-svn: 281795

7 years agoTry to fix a few bots.
Rafael Espindola [Fri, 16 Sep 2016 22:47:34 +0000 (22:47 +0000)]
Try to fix a few bots.

llvm-svn: 281794

7 years agoconfigure: Add amdgcn-mesa-mesa3d target
Tom Stellard [Fri, 16 Sep 2016 22:43:33 +0000 (22:43 +0000)]
configure: Add amdgcn-mesa-mesa3d target

llvm-svn: 281793

7 years agoamdgcn-amdhsa: Add get_num_groups implementation
Tom Stellard [Fri, 16 Sep 2016 22:43:31 +0000 (22:43 +0000)]
amdgcn-amdhsa: Add get_num_groups implementation

llvm-svn: 281792

7 years agoamdgcn-amdhsa: Add get_global_size() implementation
Tom Stellard [Fri, 16 Sep 2016 22:43:29 +0000 (22:43 +0000)]
amdgcn-amdhsa: Add get_global_size() implementation

llvm-svn: 281791

7 years agoAdd target triples to fix test on non-x86.
Peter Collingbourne [Fri, 16 Sep 2016 22:26:45 +0000 (22:26 +0000)]
Add target triples to fix test on non-x86.

llvm-svn: 281790

7 years agoAMDGPU/SI: Fix kernel argument ABI for HSA
Tom Stellard [Fri, 16 Sep 2016 22:20:24 +0000 (22:20 +0000)]
AMDGPU/SI: Fix kernel argument ABI for HSA

Summary: i8, i16, and f16 values are not extended to 32-bit in the HSA kernel ABI.

Reviewers: arsenm

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, llvm-commits, yaxunl

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

llvm-svn: 281789

7 years ago[CMake] Support symlinks with the same name as the binary
Chris Bieneman [Fri, 16 Sep 2016 22:19:19 +0000 (22:19 +0000)]
[CMake] Support symlinks with the same name as the binary

This supports creating symlinks to tools in different directories than
the tool is built to. This is useful for the LLDB framework build which
I’m sending patches for shortly.

llvm-svn: 281788

7 years ago[InstCombine] canonicalize vector select with constant vector condition to shuffle
Sanjay Patel [Fri, 16 Sep 2016 22:16:18 +0000 (22:16 +0000)]
[InstCombine] canonicalize vector select with constant vector condition to shuffle

As discussed on llvm-dev ( http://lists.llvm.org/pipermail/llvm-dev/2016-August/104210.html ):
turn a vector select with constant condition operand into a shuffle as a canonicalization step.
Shuffles may be easier to reason about in conjunction with other shuffles and insert/extract.

Possible known (minor?) regressions from this change are filed as:
https://llvm.org/bugs/show_bug.cgi?id=28530
https://llvm.org/bugs/show_bug.cgi?id=28531
https://llvm.org/bugs/show_bug.cgi?id=30371

If something terrible happens to perf after this commit, feel free to revert until a backend
fix is in place.

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

llvm-svn: 281787

7 years agoAMDGPU: Allow some control flow intrinsics to be CSEd
Matt Arsenault [Fri, 16 Sep 2016 22:11:18 +0000 (22:11 +0000)]
AMDGPU: Allow some control flow intrinsics to be CSEd

These clean up some unnecessary or instructions in
cases with complex loops.

In the original testcase I noticed this, the same
or with exec was repeated 5 or 6 times in a row. With
this only one is emitted or sometimes a copy.

llvm-svn: 281786

7 years agoCodeGen: Add more checks to nobuiltin.c test, add a negative test.
Peter Collingbourne [Fri, 16 Sep 2016 22:05:53 +0000 (22:05 +0000)]
CodeGen: Add more checks to nobuiltin.c test, add a negative test.

llvm-svn: 281785

7 years ago[safestack] Fix assertion failure in stack coloring.
Evgeniy Stepanov [Fri, 16 Sep 2016 22:04:10 +0000 (22:04 +0000)]
[safestack] Fix assertion failure in stack coloring.

This is a fix for PR30318.

Clang may generate IR where an alloca is already live when entering a
BB with lifetime.start. In this case, conservatively extend the
alloca lifetime all the way back to the block entry.

llvm-svn: 281784

7 years ago[RegAllocGreedy] Fix the list of NewVRegs for last chance recoloring.
Quentin Colombet [Fri, 16 Sep 2016 22:00:50 +0000 (22:00 +0000)]
[RegAllocGreedy] Fix the list of NewVRegs for last chance recoloring.

When trying to recolor a register we may split live-ranges in the
process. When we create new live-ranges we will have to process them,
but when we move a register from Assign to Split, the allocation is not
changed until the whole recoloring session is successful.
Therefore, only push the live-ranges that changed from Assign to
Split when the recoloring is successful.

Same as the previous commit, I was not able to produce a test case that
reproduce the problem with in-tree targets.

Note: The bug has been here since the recoloring scheme has been added
back in r200883 (Feb 2014).

llvm-svn: 281783

7 years ago[RegAllocGreedy] Fix an assertion and condition when last chance recoloring is used.
Quentin Colombet [Fri, 16 Sep 2016 22:00:42 +0000 (22:00 +0000)]
[RegAllocGreedy] Fix an assertion and condition when last chance recoloring is used.

When last chance recoloring is used, the list of NewVRegs may not be
empty when calling selectOrSplitImpl. Indeed, another coloring may have
taken place with splitting/spilling in the same recoloring session.

Relax an assertion to take this into account and adapt a condition to
act as if the NewVRegs were local to this selectOrSplitImpl instance.

Unfortunately I am unable to produce a test case for this, I was only
able to reproduce the conditions on an out-of-tree target.

llvm-svn: 281782

7 years agoAMDGPU: Refactor kernel argument lowering
Tom Stellard [Fri, 16 Sep 2016 21:53:00 +0000 (21:53 +0000)]
AMDGPU: Refactor kernel argument lowering

Summary:
The main challenge in lowering kernel arguments for AMDGPU is determing the
memory type of the argument.  The generic calling convention code assumes
that only legal register types can be stored in memory, but this is not the
case for AMDGPU.

This consolidates all the logic AMDGPU uses for deducing memory types into a single
function.  This will make it much easier to support different ABIs in the future.

Reviewers: arsenm

Subscribers: arsenm, wdng, nhaehnle, llvm-commits, yaxunl

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

llvm-svn: 281781

7 years agoAMDGPU: Use SOPK compare instructions
Matt Arsenault [Fri, 16 Sep 2016 21:41:16 +0000 (21:41 +0000)]
AMDGPU: Use SOPK compare instructions

llvm-svn: 281780

7 years agoAMDGPU/SI: Add support for triples with the mesa3d operating system
Tom Stellard [Fri, 16 Sep 2016 21:34:26 +0000 (21:34 +0000)]
AMDGPU/SI: Add support for triples with the mesa3d operating system

Summary:
mesa3d will use the same kernel calling convention as amdhsa, but it will
handle everything else like the default 'unknown' OS type.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits, kzhuravl

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

llvm-svn: 281779

7 years agoPut SHF_ALLOC sections first, even with linker scripts.
Rafael Espindola [Fri, 16 Sep 2016 21:29:07 +0000 (21:29 +0000)]
Put SHF_ALLOC sections first, even with linker scripts.

This matches gold and bfd, and is pretty much required by some linker
scripts. They end with commands like

foo   0 : { *(bar) }

if we put any SHF_ALLOC sections after they can have an address that
is too low.

llvm-svn: 281778

7 years ago[InstCombine] allow vector types for constant folding / computeKnownBits (PR24942)
Sanjay Patel [Fri, 16 Sep 2016 21:20:36 +0000 (21:20 +0000)]
[InstCombine] allow vector types for constant folding / computeKnownBits (PR24942)

computeKnownBits() already works for integer vectors, so allow vector types when calling that from InstCombine.

I don't think the change to use m_APInt in computeKnownBits is strictly necessary because we do check for
ConstantVector later, but it's more efficient to handle the splat case without needing to loop on vector elements.

This should work with InstSimplify, but doesn't yet, so I made that a FIXME comment on the test for PR24942:
https://llvm.org/bugs/show_bug.cgi?id=24942

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

llvm-svn: 281777

7 years agoRename SortSectionPolicy::IgnoreConfig to None.
Rui Ueyama [Fri, 16 Sep 2016 21:14:55 +0000 (21:14 +0000)]
Rename SortSectionPolicy::IgnoreConfig to None.

Because it corresponds to SORT_NONE. None was renamed Default.

llvm-svn: 281776

7 years agoOnly process commands in a ONLY_IF_RO if it matches.
Rafael Espindola [Fri, 16 Sep 2016 21:05:36 +0000 (21:05 +0000)]
Only process commands in a ONLY_IF_RO if it matches.

This matches bfd behavior. It also makes future changes simpler as we
don't have to worry about ignoring these commands in multiple places

llvm-svn: 281775

7 years ago[LTO] Add ability to parse AA pipelines.
Davide Italiano [Fri, 16 Sep 2016 21:03:21 +0000 (21:03 +0000)]
[LTO] Add ability to parse AA pipelines.

This is supposed to be a drop in replacement for what lld
provides via --lto-newpm-aa-pipeline.

llvm-svn: 281774

7 years ago[WebAssembly] Fix function types of CFGStackify tests
Derek Schuff [Fri, 16 Sep 2016 20:58:31 +0000 (20:58 +0000)]
[WebAssembly] Fix function types of CFGStackify tests

Make the function's declared type match its (lack of) return type

llvm-svn: 281773

7 years agoFix constraint checking in ONLY_IF_RO.
Rafael Espindola [Fri, 16 Sep 2016 20:34:02 +0000 (20:34 +0000)]
Fix constraint checking in ONLY_IF_RO.

We have to look at all the relevant input sections at once.

llvm-svn: 281772

7 years ago[ELF] - Implemented --sort-section cmd line option and SORT_NONE script command.
George Rimar [Fri, 16 Sep 2016 20:21:55 +0000 (20:21 +0000)]
[ELF] - Implemented --sort-section cmd line option and SORT_NONE script command.

This fixes Bug 30385 - SORT_NONE not implemented,

`SORT_NONE' disables section sorting by ignoring the command line
section sorting option.

That is why this patch also implements --sort-section option.

Description of sorting rules
available at https://sourceware.org/binutils/docs/ld/Input-Section-Wildcards.html

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

llvm-svn: 281771

7 years agoFix compiler warnings where two values weren't being initialized.
Greg Clayton [Fri, 16 Sep 2016 20:10:02 +0000 (20:10 +0000)]
Fix compiler warnings where two values weren't being initialized.

llvm-svn: 281770

7 years ago[X86][SSE] Added vector sub combine tests
Simon Pilgrim [Fri, 16 Sep 2016 20:00:51 +0000 (20:00 +0000)]
[X86][SSE] Added vector sub combine tests

llvm-svn: 281769

7 years ago[X86][SSE] Added vector add combine tests
Simon Pilgrim [Fri, 16 Sep 2016 19:20:41 +0000 (19:20 +0000)]
[X86][SSE] Added vector add combine tests

Some work great and others currently demonstrate the anti-vector bias prevalent in DAGCombiner

llvm-svn: 281768

7 years ago[libc++] Fix inline attribute for non-MSVC Windows
Shoaib Meenai [Fri, 16 Sep 2016 19:12:54 +0000 (19:12 +0000)]
[libc++] Fix inline attribute for non-MSVC Windows

gcc and clang in gcc compatibility mode do not accept __forceinline. Use
the gcc attribute for them instead.

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

llvm-svn: 281766

7 years agoSet the correct triple when creating an ArchSpec for Windows.
Zachary Turner [Fri, 16 Sep 2016 19:09:19 +0000 (19:09 +0000)]
Set the correct triple when creating an ArchSpec for Windows.

Patch by Walter Erquinigo
Differential Revision: https://reviews.llvm.org/D24283

llvm-svn: 281765

7 years agoAdd unit tests for a few string conversion functions in Args.
Zachary Turner [Fri, 16 Sep 2016 19:09:12 +0000 (19:09 +0000)]
Add unit tests for a few string conversion functions in Args.

Also provided a StringRef overload for these functions and have
the const char* overloads delegate to the StringRef overload.

llvm-svn: 281764

7 years agoInstall libLLVM if needed with LLVM_INSTALL_TOOLCHAIN_ONLY
Derek Schuff [Fri, 16 Sep 2016 18:50:39 +0000 (18:50 +0000)]
Install libLLVM if needed with LLVM_INSTALL_TOOLCHAIN_ONLY

Summary:
When LLVM_LINK_LLVM_DYLIB is set, the libLLVM shared
library needs to be installed in the toolchain.  Without
this chanage LLVM_INSTALL_TOOLCHAIN_ONLY combined with
LLVM_LINK_LLVM_DYLIB results in a broken install.

Patch by Sam Clegg

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

llvm-svn: 281763

7 years agoDefer asm errors to post-statement failure
Nirav Dave [Fri, 16 Sep 2016 18:30:20 +0000 (18:30 +0000)]
Defer asm errors to post-statement failure

Recommitting after fixing AsmParser initialization and X86 inline asm
error cleanup.

Allow errors to be deferred and emitted as part of clean up to simplify
and shorten Assembly parser code. This will allow error messages to be
emitted in helper functions and be modified by the caller which has
better context.

As part of this many minor cleanups to the Parser:

* Unify parser cleanup on error
* Add Workaround for incorrect return values in ParseDirective instances
* Tighten checks on error-signifying return values for parser functions
  and fix in-tree TargetParsers to be more consistent with the changes.
* Fix AArch64 test cases checking for spurious error messages that are
  now fixed.

These changes should be backwards compatible with current Target Parsers
so long as the error status are correctly returned in appropriate
functions.

Reviewers: rnk, majnemer

Subscribers: aemerson, jyknight, llvm-commits

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

llvm-svn: 281762

7 years agoChange extractProfMetadata and extractProfTotalWeight to const member function.
Dehao Chen [Fri, 16 Sep 2016 18:27:20 +0000 (18:27 +0000)]
Change extractProfMetadata and extractProfTotalWeight to const member function.

llvm-svn: 281760

7 years agoMake test slightly more explicit. NFC.
Michael Kuperstein [Fri, 16 Sep 2016 18:20:43 +0000 (18:20 +0000)]
Make test slightly more explicit. NFC.

llvm-svn: 281759

7 years agoLoopDistribute should preserve GlobalsAA.
Eli Friedman [Fri, 16 Sep 2016 18:01:48 +0000 (18:01 +0000)]
LoopDistribute should preserve GlobalsAA.

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

llvm-svn: 281758

7 years agoLoopLoadElimination should preserve GlobalsAA.
Eli Friedman [Fri, 16 Sep 2016 17:58:07 +0000 (17:58 +0000)]
LoopLoadElimination should preserve GlobalsAA.

Avoids losing GlobalsAA in the standard pass pipeline.

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

llvm-svn: 281757

7 years agoauto-generate checks
Sanjay Patel [Fri, 16 Sep 2016 17:54:52 +0000 (17:54 +0000)]
auto-generate checks

llvm-svn: 281756

7 years agoauto-generate checks
Sanjay Patel [Fri, 16 Sep 2016 17:48:16 +0000 (17:48 +0000)]
auto-generate checks

llvm-svn: 281755

7 years agoRecommit r281721 "[ELF] - Linkerscript: implement EXCLUDE_FILE in the middle of a...
George Rimar [Fri, 16 Sep 2016 17:42:10 +0000 (17:42 +0000)]
Recommit r281721 "[ELF] - Linkerscript: implement EXCLUDE_FILE in the middle of a input section description."

With fix for 2 bots. Details about the fix performed is on a review page.

Initial commit message:
This is PR30387:

From PR description:
We fail to parse

SECTIONS
{
  foo :
  {
    *(sec0 EXCLUDE_FILE (zed1.o) sec1  EXCLUDE_FILE (zed2.o) sec2 )
  }
}
The semantics according to bfd are:

Include sec1 from every file but zed1.o
Include sec2 from every file but zed2.o
Include sec0 from every file

Patch implements the support.

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

llvm-svn: 281754

7 years agoIntroduce inline assembly parsing test is PR30372.
Nirav Dave [Fri, 16 Sep 2016 17:42:02 +0000 (17:42 +0000)]
Introduce inline assembly parsing test is PR30372.

llvm-svn: 281753

7 years agoFix test after renaming -name-anon-functions pass to -name-anon-globals
Mehdi Amini [Fri, 16 Sep 2016 17:18:16 +0000 (17:18 +0000)]
Fix test after renaming -name-anon-functions pass to -name-anon-globals

llvm-svn: 281752

7 years ago[LTO] Use llvm-nm instead of nm in new tests
Teresa Johnson [Fri, 16 Sep 2016 17:12:48 +0000 (17:12 +0000)]
[LTO] Use llvm-nm instead of nm in new tests

The use of nm in the new tests added with r281725 caused a couple
of bot failures:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15701
http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/6939

Use llvm-nm instead.

llvm-svn: 281750

7 years agoActually remove the Mangler from the AsmPrinter and clean up the places it was "used...
Eric Christopher [Fri, 16 Sep 2016 17:07:23 +0000 (17:07 +0000)]
Actually remove the Mangler from the AsmPrinter and clean up the places it was "used" but not used.

llvm-svn: 281749

7 years agoFix a hidden use of grabbing the Mangler from the AsmPrinter and update
Eric Christopher [Fri, 16 Sep 2016 17:07:13 +0000 (17:07 +0000)]
Fix a hidden use of grabbing the Mangler from the AsmPrinter and update
accordingly.

llvm-svn: 281748

7 years agoRemove undefined weak hooks from dll thunk export list to really fix windows build
Reid Kleckner [Fri, 16 Sep 2016 17:05:40 +0000 (17:05 +0000)]
Remove undefined weak hooks from dll thunk export list to really fix windows build

llvm-svn: 281747

7 years ago[compiler-rt] Don't force ASAN_HAS_EXCEPTIONS to be true for all builds
Francis Ricci [Fri, 16 Sep 2016 16:59:31 +0000 (16:59 +0000)]
[compiler-rt] Don't force ASAN_HAS_EXCEPTIONS to be true for all builds

Summary:
This value is already defaulted to true in asan_internal.h.
Allow the value to be overriden in cases where exceptions are unavailable.

Reviewers: kcc, samsonov, compnerd

Subscribers: kubabrecka, dberris, beanz, mgorny, llvm-commits

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

llvm-svn: 281746