platform/upstream/llvm.git
9 years ago[lldb-mi] Simplify MICmnMIResultRecord implementation.
Bruce Mitchener [Tue, 21 Jul 2015 11:30:39 +0000 (11:30 +0000)]
[lldb-mi] Simplify MICmnMIResultRecord implementation.

Summary:
* Remove extraneous members that were just storing temporary
  values.
* ResultClass_e parameters don't need to be const as they are
  scalars.
* Switch from a map with CMIUtilString values to using a mapping
  function. This uses a switch statement which will generate
  a warning if a new result class is added.
* Make BuildRecordResult a static function rather than a private
  member function so that we can construct the result text
  correctly and avoid having extra stuff in the header.
* Don't need (void) parameter lists in C++.

Reviewers: abidh, ki.stfu, domipheus

Subscribers: lldb-commits

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

llvm-svn: 242769

9 years ago[lldb-mi] Remove unused portions of MIDataTypes.h.
Bruce Mitchener [Tue, 21 Jul 2015 11:27:40 +0000 (11:27 +0000)]
[lldb-mi] Remove unused portions of MIDataTypes.h.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 242768

9 years agoRevert "Add Pipe::WriteWithTimeout method"
Pavel Labath [Tue, 21 Jul 2015 11:04:52 +0000 (11:04 +0000)]
Revert "Add Pipe::WriteWithTimeout method"

I have observed an increased flakyness in the buildbots. I suspect something was relying on the
fact that Pipe::Write had an implicit timeout of 1s, which this commit has removed. Reverting
while I investigate.

llvm-svn: 242767

9 years agoFix mingw toolchain to honor sysroot on Linux and add tests.
Yaron Keren [Tue, 21 Jul 2015 11:01:00 +0000 (11:01 +0000)]
Fix mingw toolchain to honor sysroot on Linux and add tests.

It should now support three mingw distributions running on Windows
and three Linux distributions. The include directories for each are
listed in the comments.

llvm-svn: 242766

9 years agoFix incorrect documentation directives and some parameters
Pavel Labath [Tue, 21 Jul 2015 09:37:43 +0000 (09:37 +0000)]
Fix incorrect documentation directives and some parameters

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

Patch by Eugene Zelenko.

llvm-svn: 242765

9 years agoAdd Pipe::WriteWithTimeout method
Pavel Labath [Tue, 21 Jul 2015 09:23:34 +0000 (09:23 +0000)]
Add Pipe::WriteWithTimeout method

Summary:
This commit adds a WriteWithTimeout method to time Pipe class, analogous to the existing
ReadWithTimeout(). It also changes the meaning of passing zero as a timeout value. Previously,
zero was used as an infinite timeout value. Now, the meaning of zero timeout to return the data
avaiable without sleeping (basically, a non-blocking operation). This makes the behaviour of Pipe
consistent with the Communication/Connection classes. For blocking operatios with infinite
timeout, I introduce a special constant for this purpose.

Reviewers: ovyalov, zturner

Subscribers: lldb-commits

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

llvm-svn: 242764

9 years agoConstfold trunc,rint,nearbyint,ceil and floor using APFloat
Karthik Bhat [Tue, 21 Jul 2015 08:52:23 +0000 (08:52 +0000)]
Constfold trunc,rint,nearbyint,ceil and floor using APFloat
A patch by Chakshu Grover!
This patch allows constfolding of trunc,rint,nearbyint,ceil and floor intrinsics using APFloat class.
Differential Revision: http://reviews.llvm.org/D11144

llvm-svn: 242763

9 years ago[lldb-mi] size_t rather than MIuint for arg counts.
Bruce Mitchener [Tue, 21 Jul 2015 08:07:27 +0000 (08:07 +0000)]
[lldb-mi] size_t rather than MIuint for arg counts.

Summary: [lldb-mi] size_t rather than MIuint for arg counts.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 242762

9 years agoAVX512 : Implemented VPMADDUBSW and VPMADDWD instruction ,
Igor Breger [Tue, 21 Jul 2015 07:11:28 +0000 (07:11 +0000)]
AVX512 : Implemented VPMADDUBSW and VPMADDWD instruction ,
Added tests for intrinsics and encoding.

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

llvm-svn: 242761

9 years ago[Mips] Fix addend writing for R_MIPS_REL32 relocation
Simon Atanasyan [Tue, 21 Jul 2015 05:54:30 +0000 (05:54 +0000)]
[Mips] Fix addend writing for R_MIPS_REL32 relocation

llvm-svn: 242760

9 years ago[Mips] Handle R_MIPS_JALR relocation to omptimize jalr/jr instructions
Simon Atanasyan [Tue, 21 Jul 2015 05:54:22 +0000 (05:54 +0000)]
[Mips] Handle R_MIPS_JALR relocation to omptimize jalr/jr instructions

llvm-svn: 242759

9 years ago[LIT] Fix discovery.py test once again
Eric Fiselier [Tue, 21 Jul 2015 04:25:13 +0000 (04:25 +0000)]
[LIT] Fix discovery.py test once again

llvm-svn: 242758

9 years agoResolve DW_AT_comp_dir path if it contains a symlink
Oleksiy Vyalov [Tue, 21 Jul 2015 02:09:42 +0000 (02:09 +0000)]
Resolve DW_AT_comp_dir path if it contains a symlink

http://reviews.llvm.org/D11357

llvm-svn: 242757

9 years ago[ARM] Define subtarget feature "reserve-r9", which is used to decide
Akira Hatanaka [Tue, 21 Jul 2015 01:42:02 +0000 (01:42 +0000)]
[ARM] Define subtarget feature "reserve-r9", which is used to decide
whether register r9 should be reserved.

This recommits r242737, which broke bots because the number of subtarget
features went over the limit of 64.

This change is needed because we cannot use a backend option to set
cl::opt "arm-reserve-r9" when doing LTO.

Out-of-tree projects currently using cl::opt option "-arm-reserve-r9" to
reserve r9 should make changes to add subtarget feature "reserve-r9" to
the IR.

rdar://problem/21529937

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

llvm-svn: 242756

9 years ago[ARM] Pass subtarget feature "+reserve-r9" instead of passing backend
Akira Hatanaka [Tue, 21 Jul 2015 01:41:08 +0000 (01:41 +0000)]
[ARM] Pass subtarget feature "+reserve-r9" instead of passing backend
option "-arm-reserve-r9".

This recommits r242736, which had to be reverted because the llvm-side
change that was committed in r242737 caused the number of subtarget
features to go over the limit of 64.

This change is needed since backend options do not make it to the backend
when doing LTO and are not capable of changing the behavior of code-gen
passes on a per-function basis.

rdar://problem/21529937

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

llvm-svn: 242755

9 years agoBump the size of FeatureBitset up to 96-bits.
Akira Hatanaka [Tue, 21 Jul 2015 01:39:22 +0000 (01:39 +0000)]
Bump the size of FeatureBitset up to 96-bits.

This should avoid exceeding the maximum size when I add another subtarget
feature to ARM's subtarget.

llvm-svn: 242754

9 years agoFix FileSpec::IsSymlink implementation.
Oleksiy Vyalov [Tue, 21 Jul 2015 01:28:22 +0000 (01:28 +0000)]
Fix FileSpec::IsSymlink implementation.

http://reviews.llvm.org/D11356

llvm-svn: 242753

9 years agoDon't do a walk over the dynamic table just to find DT_SONAME.
Rafael Espindola [Tue, 21 Jul 2015 01:01:29 +0000 (01:01 +0000)]
Don't do a walk over the dynamic table just to find DT_SONAME.

llvm-svn: 242752

9 years ago[RewriteStatepointsForGC] Minor code cleanup [NFC]
Philip Reames [Tue, 21 Jul 2015 00:49:55 +0000 (00:49 +0000)]
[RewriteStatepointsForGC] Minor code cleanup [NFC]

We can use builders to simplify part of the code and we only check for the existance of the metadata value; this enables us to delete some redundant code.

llvm-svn: 242751

9 years ago[llgo] build llgoi by default
Andrew Wilkins [Tue, 21 Jul 2015 00:47:18 +0000 (00:47 +0000)]
[llgo] build llgoi by default

Summary:
As llgoi is installed, it must be built or the install
target will fail; there is no implicit dependency.
Adding llgoi to "ALL" makes building llgo as part of an
entire LLVM distribution a bit friendlier: you can then
just do the typical "make && make install".

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 242750

9 years ago[cmake] pass GO_EXECUTABLE to llgo-go
Andrew Wilkins [Tue, 21 Jul 2015 00:46:23 +0000 (00:46 +0000)]
[cmake] pass GO_EXECUTABLE to llgo-go

Summary:
When calling llgo-go from the llvm_add_go_executable
cmake function, specify $GO_EXECUTABLE as the go
command to call. Without this, llgo-go searches $PATH
which may be inconsistent with $GO_EXECUTABLE.

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 242749

9 years ago[CMake] Fixing inconsistency caused by copy-pasta.
Chris Bieneman [Tue, 21 Jul 2015 00:44:47 +0000 (00:44 +0000)]
[CMake] Fixing inconsistency caused by copy-pasta.

This will actually fix the PR 24194.

llvm-svn: 242748

9 years agoAMDGPU: Set isMoveImm on s_movk_i32
Matt Arsenault [Tue, 21 Jul 2015 00:40:08 +0000 (00:40 +0000)]
AMDGPU: Set isMoveImm on s_movk_i32

llvm-svn: 242747

9 years ago[CMake] Fixing a problem with external projects that aren't getting enabled properly.
Chris Bieneman [Tue, 21 Jul 2015 00:39:53 +0000 (00:39 +0000)]
[CMake] Fixing a problem with external projects that aren't getting enabled properly.

This should address PR 24194, and some builedbot failures.

llvm-svn: 242746

9 years agoThe session dictionary attached to a Python interpeter holds variables the user creat...
Enrico Granata [Tue, 21 Jul 2015 00:38:25 +0000 (00:38 +0000)]
The session dictionary attached to a Python interpeter holds variables the user creates in the script interpreter
This can include objects that have complex state and need to be torn down intelligently (e.g. our SB* objects)

This will fail if the Python interpreter does not hold a valid thread state. So, acquire one, delete the session dictionary, and then let go of it on destruction

This fixes rdar://20960843

llvm-svn: 242745

9 years agoFix crash-on-invalid: don't look ahead past an unknown token, it might be EOF.
Richard Smith [Tue, 21 Jul 2015 00:23:34 +0000 (00:23 +0000)]
Fix crash-on-invalid: don't look ahead past an unknown token, it might be EOF.

llvm-svn: 242744

9 years agoARMLoadStoreOpt: Merge subs/adds into LDRD/STRD; Factor out common code
Matthias Braun [Tue, 21 Jul 2015 00:19:01 +0000 (00:19 +0000)]
ARMLoadStoreOpt: Merge subs/adds into LDRD/STRD; Factor out common code

Re-apply of r241928 which had to be reverted because of the r241926
revert.

This commit factors out common code from MergeBaseUpdateLoadStore() and
MergeBaseUpdateLSMultiple() and introduces a new function
MergeBaseUpdateLSDouble() which merges adds/subs preceding/following a
strd/ldrd instruction into an strd/ldrd instruction with writeback where
possible.

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

llvm-svn: 242743

9 years agoARMLoadStoreOptimizer: Create LDRD/STRD on thumb2
Matthias Braun [Tue, 21 Jul 2015 00:18:59 +0000 (00:18 +0000)]
ARMLoadStoreOptimizer: Create LDRD/STRD on thumb2

Re-apply r241926 with an additional check that r13 and r15 are not used
for LDRD/STRD. See http://llvm.org/PR24190. This also already includes
the fix from r241951.

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

llvm-svn: 242742

9 years agoRevert r242736.
Akira Hatanaka [Mon, 20 Jul 2015 23:53:02 +0000 (23:53 +0000)]
Revert r242736.

r242737 caused builds to fail with the following error message, so I'm
reverting the clang side change too:

error:Too many subtarget features! Bump MAX_SUBTARGET_FEATURES.

llvm-svn: 242741

9 years agoRevert r242737.
Akira Hatanaka [Mon, 20 Jul 2015 23:51:12 +0000 (23:51 +0000)]
Revert r242737.

This caused builds to fail with the following error message:

error:Too many subtarget features! Bump MAX_SUBTARGET_FEATURES.

llvm-svn: 242740

9 years agoclang-format: Fix crasher when a UTF8 character is found in an escape
Daniel Jasper [Mon, 20 Jul 2015 23:28:07 +0000 (23:28 +0000)]
clang-format: Fix crasher when a UTF8 character is found in an escape
sequence. Discovered by the fuzzer.

llvm-svn: 242738

9 years ago[ARM] Define subtarget feature "reserve-r9", which is used to decide
Akira Hatanaka [Mon, 20 Jul 2015 23:21:30 +0000 (23:21 +0000)]
[ARM] Define subtarget feature "reserve-r9", which is used to decide
whether register r9 should be reserved.

This change is needed because we cannot use a backend option to set
cl::opt "arm-reserve-r9" when doing LTO.

Out-of-tree projects currently using cl::opt option "-arm-reserve-r9" to
reserve r9 should make changes to add subtarget feature "reserve-r9" to
the IR.

rdar://problem/21529937

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

llvm-svn: 242737

9 years ago[ARM] Pass subtarget feature "+reserve-r9" instead of passing backend
Akira Hatanaka [Mon, 20 Jul 2015 23:20:53 +0000 (23:20 +0000)]
[ARM] Pass subtarget feature "+reserve-r9" instead of passing backend
option "-arm-reserve-r9".

This change is needed since backend options do not make it to the backend
when doing LTO and are not capable of changing the behavior of code-gen
passes on a per-function basis.

rdar://problem/21529937

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

llvm-svn: 242736

9 years agoRevert "ARMLoadStoreOptimizer: Create LDRD/STRD on thumb2"
Matthias Braun [Mon, 20 Jul 2015 23:17:20 +0000 (23:17 +0000)]
Revert "ARMLoadStoreOptimizer: Create LDRD/STRD on thumb2"

This reverts commit r241926. This caused http://llvm.org/PR24190

llvm-svn: 242735

9 years agoRevert "ARMLoadStoreOpt: Merge subs/adds into LDRD/STRD; Factor out common code"
Matthias Braun [Mon, 20 Jul 2015 23:17:16 +0000 (23:17 +0000)]
Revert "ARMLoadStoreOpt: Merge subs/adds into LDRD/STRD; Factor out common code"

This reverts commit r241928. This caused http://llvm.org/PR24190

llvm-svn: 242734

9 years agoRevert "ARM: Use SpecificBumpPtrAllocator to fix leak introduced in r241920"
Matthias Braun [Mon, 20 Jul 2015 23:17:14 +0000 (23:17 +0000)]
Revert "ARM: Use SpecificBumpPtrAllocator to fix leak introduced in r241920"

This reverts commit r241951. It caused http://llvm.org/PR24190

llvm-svn: 242733

9 years agoAArch64: Restrict macroop fusion heuristics to cyclone.
Matthias Braun [Mon, 20 Jul 2015 23:11:42 +0000 (23:11 +0000)]
AArch64: Restrict macroop fusion heuristics to cyclone.

Even though this is just some hinting for the scheduler it doesn't make
sense to do that unless you know the target can perform the fusion.

llvm-svn: 242732

9 years agoRefactor TableGen backend for ClangAttrEmitter to avoid duplication.
Bob Wilson [Mon, 20 Jul 2015 22:57:36 +0000 (22:57 +0000)]
Refactor TableGen backend for ClangAttrEmitter to avoid duplication.

GenerateHasAttrSpellingStringSwitch and GenerateTargetRequirements had
duplicated code to check the conditions for target-specific attributes.
Refactor the duplicated code into a separate function. NFC.

llvm-svn: 242731

9 years agoIgnore the "novtable" declspec when not using the Microsoft C++ ABI.
Bob Wilson [Mon, 20 Jul 2015 22:57:31 +0000 (22:57 +0000)]
Ignore the "novtable" declspec when not using the Microsoft C++ ABI.

Clang used to silently ignore __declspec(novtable). It is implemented
now, but leaving the vtable uninitialized does not work when using the
Itanium ABI, where the class layout for complex class hierarchies is
stored in the vtable. It might be possible to honor the novtable
attribute in some simple cases and either report an error or ignore
it in more complex situations, but it’s not clear if that would be
worthwhile. There is also value in having a simple and predictable
behavior, so this changes clang to simply ignore novtable when not using
the Microsoft C++ ABI.

llvm-svn: 242730

9 years agoCorrectly get the arguments and environment, even for processes that have a large...
Greg Clayton [Mon, 20 Jul 2015 22:52:13 +0000 (22:52 +0000)]
Correctly get the arguments and environment, even for processes that have a large amount or arguments and/or environment variables.

We previously passed in a 8192 byte buffer but this wasn't large enough. We now calculate the size we need and then add 128 to it and get the environment. If we pass exactly the number of bytes it says is needs, the sysctl() returns junk. Adding 1 seemed to do the trick, but to err on the side of caution, I added a few bytes more.

<rdar://problem/21883842>

llvm-svn: 242729

9 years ago[MS Compat] Add support for __declspec(noalias)
David Majnemer [Mon, 20 Jul 2015 22:51:52 +0000 (22:51 +0000)]
[MS Compat] Add support for __declspec(noalias)

The attribute '__declspec(noalias)' communicates that the function only
accesses memory pointed to by its pointer-typed arguments.

llvm-svn: 242728

9 years agoTargets: commonize some stack realignment code
JF Bastien [Mon, 20 Jul 2015 22:51:32 +0000 (22:51 +0000)]
Targets: commonize some stack realignment code

This patch does the following:
* Fix FIXME on `needsStackRealignment`: it is now shared between multiple targets, implemented in `TargetRegisterInfo`, and isn't `virtual` anymore. This will break out-of-tree targets, silently if they used `virtual` and with a build error if they used `override`.
* Factor out `canRealignStack` as a `virtual` function on `TargetRegisterInfo`, by default only looks for the `no-realign-stack` function attribute.

Multiple targets duplicated the same `needsStackRealignment` code:
 - Aarch64.
 - ARM.
 - Mips almost: had extra `DEBUG` diagnostic, which the default implementation now has.
 - PowerPC.
 - WebAssembly.
 - x86 almost: has an extra `-force-align-stack` option, which the default implementation now has.

The default implementation of `needsStackRealignment` used to just return `false`. My current patch changes the behavior by simply using the above shared behavior. This affects:
 - AMDGPU
 - BPF
 - CppBackend
 - MSP430
 - NVPTX
 - Sparc
 - SystemZ
 - XCore
 - Out-of-tree targets
This is a breaking change! `make check` passes.

The only implementation of the `virtual` function (besides the slight different in x86) was Hexagon (which did `MF.getFrameInfo()->getMaxAlignment() > 8`), and potentially some out-of-tree targets. Hexagon now uses the default implementation.

`needsStackRealignment` was being overwritten in `<Target>GenRegisterInfo.inc`, to return `false` as the default also did. That was odd and is now gone.

Reviewers: sunfish

Subscribers: aemerson, llvm-commits, jfb

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

llvm-svn: 242727

9 years agoDon't try to instrument allocas used by outlined SEH funclets
Reid Kleckner [Mon, 20 Jul 2015 22:49:44 +0000 (22:49 +0000)]
Don't try to instrument allocas used by outlined SEH funclets

Summary:
Arguments to llvm.localescape must be static allocas. They must be at
some statically known offset from the frame or stack pointer so that
other functions can access them with localrecover.

If we ever want to instrument these, we can use more indirection to
recover the addresses of these local variables. We can do it during
clang irgen or with the asan module pass.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 242726

9 years agoRemove duplicated code.
Rafael Espindola [Mon, 20 Jul 2015 22:41:44 +0000 (22:41 +0000)]
Remove duplicated code.

Both ELFObjectFile and ELFFile had an implementation of getLoadName.

llvm-svn: 242725

9 years agoAArch64: Add aditional Cyclone macroop fusion opportunities
Matthias Braun [Mon, 20 Jul 2015 22:34:47 +0000 (22:34 +0000)]
AArch64: Add aditional Cyclone macroop fusion opportunities

Related to rdar://19205407

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

llvm-svn: 242724

9 years agoMachineScheduler: Restrict macroop fusion to data-dependent instructions.
Matthias Braun [Mon, 20 Jul 2015 22:34:44 +0000 (22:34 +0000)]
MachineScheduler: Restrict macroop fusion to data-dependent instructions.

Before creating a schedule edge to encourage MacroOpFusion check that:
- The predecessor actually writes a register that the branch reads.
- The predecessor has no successors in the ScheduleDAG so we can
  schedule it in front of the branch.

This avoids skewing the scheduling heuristic in cases where macroop
fusion cannot happen.

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

llvm-svn: 242723

9 years agoAvoid early pipefail exits due to grep failures in stage comparisons.
Dimitry Andric [Mon, 20 Jul 2015 22:24:40 +0000 (22:24 +0000)]
Avoid early pipefail exits due to grep failures in stage comparisons.

If objects or executables did not contain any RPATH, grep would return
nonzero, and the whole stage comparison loop would unexpectedly exit.
Fix this by checking the grep result explicitly.

llvm-svn: 242722

9 years agoSince BSD cmp(1) does not support the --ignore-initial option, use the
Dimitry Andric [Mon, 20 Jul 2015 22:07:27 +0000 (22:07 +0000)]
Since BSD cmp(1) does not support the --ignore-initial option, use the
more portable 3rd and 4th arguments to skip the first 16 bytes during
the comparison of Phase2 and Phase3 objects.

llvm-svn: 242721

9 years agoAdd 'const' to a few more functions in MachineFrameInfo
Krzysztof Parzyszek [Mon, 20 Jul 2015 22:05:38 +0000 (22:05 +0000)]
Add 'const' to a few more functions in MachineFrameInfo

Reviewer: Eric Christopher
http://reviews.llvm.org/D11372

llvm-svn: 242720

9 years agoFix comment typo (test commit). NFC
Geoff Berry [Mon, 20 Jul 2015 22:03:52 +0000 (22:03 +0000)]
Fix comment typo (test commit). NFC

llvm-svn: 242719

9 years ago[CUDA] Moved device-side triple calculation to buildCudaActions().
Artem Belevich [Mon, 20 Jul 2015 21:59:31 +0000 (21:59 +0000)]
[CUDA] Moved device-side triple calculation to buildCudaActions().

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

llvm-svn: 242718

9 years agoFix whitespace in Android.cmake.
Chaoren Lin [Mon, 20 Jul 2015 21:46:23 +0000 (21:46 +0000)]
Fix whitespace in Android.cmake.

llvm-svn: 242717

9 years ago[Android] Only enable evil libdl.a hack when building statically.
Chaoren Lin [Mon, 20 Jul 2015 21:46:20 +0000 (21:46 +0000)]
[Android] Only enable evil libdl.a hack when building statically.

llvm-svn: 242716

9 years agoSimplify now that we can iterate backwards. NFC.
Rafael Espindola [Mon, 20 Jul 2015 21:45:56 +0000 (21:45 +0000)]
Simplify now that we can iterate backwards. NFC.

llvm-svn: 242715

9 years ago[ARM] Refactor the prologue/epilogue emission to be more robust.
Quentin Colombet [Mon, 20 Jul 2015 21:42:14 +0000 (21:42 +0000)]
[ARM] Refactor the prologue/epilogue emission to be more robust.

This is the first step toward supporting shrink-wrapping for this target.

The changes could be summarized by these items:
- Expand the tail-call return as part of the expand pseudo pass.
- Get rid of the assumptions that the epilogue is the exit block:
  * Do not assume which registers are free in the epilogue. (This indirectly
    improve the lowering of the code for the segmented stacks, see the test
    cases.)
  * Take into account that the basic block can be empty.

Related to <rdar://problem/20821730>

llvm-svn: 242714

9 years ago[NVPTX] make load on global readonly memory to use ldg
Jingyue Wu [Mon, 20 Jul 2015 21:28:54 +0000 (21:28 +0000)]
[NVPTX] make load on global readonly memory to use ldg

Summary:
[NVPTX] make load on global readonly memory to use ldg

Summary:
As describe in [1], ld.global.nc may be used to load memory by nvcc when
__restrict__ is used and compiler can detect whether read-only data cache
is safe to use.

This patch will try to check whether ldg is safe to use and use them to
replace ld.global when possible. This change can improve the performance
by 18~29% on affected kernels (ratt*_kernel and rwdot*_kernel) in
S3D benchmark of shoc [2].

Patched by Xuetian Weng.

[1] http://docs.nvidia.com/cuda/kepler-tuning-guide/#read-only-data-cache
[2] https://github.com/vetter/shoc

Test Plan: test/CodeGen/NVPTX/load-with-non-coherent-cache.ll

Reviewers: jholewinski, jingyue

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 242713

9 years agoSimplify iterating over the dynamic section and report broken ones.
Rafael Espindola [Mon, 20 Jul 2015 21:23:29 +0000 (21:23 +0000)]
Simplify iterating over the dynamic section and report broken ones.

llvm-svn: 242712

9 years ago[Hexagon] Generate MUX from conditional transfers when dot-new not possible
Krzysztof Parzyszek [Mon, 20 Jul 2015 21:23:25 +0000 (21:23 +0000)]
[Hexagon] Generate MUX from conditional transfers when dot-new not possible

llvm-svn: 242711

9 years agoFix code completion tests to use an explicit modules cache path
Reid Kleckner [Mon, 20 Jul 2015 21:22:46 +0000 (21:22 +0000)]
Fix code completion tests to use an explicit modules cache path

Otherwise the stale module cache data may cause the test to fail.  These
two tests are new and are the only instances of c-index-test with
-fmodules that doesn't have an explicit module cache path.

llvm-svn: 242710

9 years agoFix the yellow colorizing and fix some logic in the "A" packet dumper.
Greg Clayton [Mon, 20 Jul 2015 21:22:18 +0000 (21:22 +0000)]
Fix the yellow colorizing and fix some logic in the "A" packet dumper.

llvm-svn: 242709

9 years agoSuppress two warnings from MSVC 2015 that are triggered under /W4. Since we turn...
Aaron Ballman [Mon, 20 Jul 2015 21:14:14 +0000 (21:14 +0000)]
Suppress two warnings from MSVC 2015 that are triggered under /W4. Since we turn off exceptions in the code base, C4577 is moot. C4091 triggers on system headers and is a benign construct.

llvm-svn: 242708

9 years agoMIR Serialization: Initial serialization of machine constant pools.
Alex Lorenz [Mon, 20 Jul 2015 20:51:18 +0000 (20:51 +0000)]
MIR Serialization: Initial serialization of machine constant pools.

This commit implements the initial serialization of machine constant pools and
the constant pool index machine operands. The constant pool is serialized using
a YAML sequence of YAML mappings that represent the constant values.
The target-specific constant pool items aren't serialized by this commit.

Reviewers: Duncan P. N. Exon Smith
llvm-svn: 242707

9 years agotest-release.sh: don't include /usr/local prefix in the tarball
Hans Wennborg [Mon, 20 Jul 2015 20:36:21 +0000 (20:36 +0000)]
test-release.sh: don't include /usr/local prefix in the tarball

llvm-svn: 242706

9 years ago[CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registration that...
Chris Bieneman [Mon, 20 Jul 2015 20:36:06 +0000 (20:36 +0000)]
[CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registration that was already partially working.

Re-landing r242059 which re-landed r241621... I'm really bad at this.

Summary (r242059):
This change re-lands r241621, with an additional fix that was required to allow tool sources to live outside the llvm checkout. It also no longer renames LLVM_EXTERNAL_*_SOURCE_DIR. This change was reverted in r241663, because it renamed several variables of the format LLVM_EXTERNAL_*_* to LLVM_TOOL_*_*.

Summary (r241621):
The tools CMakeLists file already had implicit tool registration, but there were a few things off about it that needed to be altered to make it work. This change addresses all that. The changes in this patch are:

* factored out canonicalizing tool names from paths to CMake variables * removed the LLVM_IMPLICIT_PROJECT_IGNORE mechanism in favor of LLVM_EXTERNAL_${nameUPPER}_BUILD which I renamed to LLVM_TOOL_${nameUPPER}_BUILD because it applies to internal and external tools
* removed ignore_llvm_tool_subdirectory() in favor of just setting LLVM_TOOL_${nameUPPER}_BUILD to Off
* Added create_llvm_tool_options() to resolve a bug in add_llvm_external_project() - the old LLVM_EXTERNAL_${nameUPPER}_BUILD would not work on a clean CMake directory because the option could be created after it was set in code.
* Removed all but the minimum required calls to add_llvm_external_project from tools/CMakeLists.txt

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

llvm-svn: 242705

9 years agoFix a case where we forgot to make a static local variable comdat
Reid Kleckner [Mon, 20 Jul 2015 20:35:30 +0000 (20:35 +0000)]
Fix a case where we forgot to make a static local variable comdat

Sometimes we can provide an initializer for static locals, in which case
we sometimes might need to change the type. Changing the type requires
making a new LLVM GlobalVariable, and in this codepath we were
forgetting to transfer the comdat.

Fixes PR23838.

Patch by Ivan Garramona.

llvm-svn: 242704

9 years ago[ImplicitNullChecks] Work with implicit defs.
Sanjoy Das [Mon, 20 Jul 2015 20:31:39 +0000 (20:31 +0000)]
[ImplicitNullChecks] Work with implicit defs.

Summary:
This change generalizes the implicit null checks pass to work with
instructions that don't have any explicit register defs.  This lets us
use X86's `cmp` against memory as faulting load instructions.

Reviewers: reames, JosephTremoulet

Subscribers: llvm-commits

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

llvm-svn: 242703

9 years agoMIR Parser: Add support for quoted named global value operands.
Alex Lorenz [Mon, 20 Jul 2015 20:31:01 +0000 (20:31 +0000)]
MIR Parser: Add support for quoted named global value operands.

This commit extends the machine instruction lexer and implements support for
the quoted global value tokens. With this change the syntax for the global value
identifier tokens becomes identical to the syntax for the global identifier
tokens from the LLVM's assembly language.

Reviewers: Duncan P. N. Exon Smith
llvm-svn: 242702

9 years agoUpdate for llvm api change.
Rafael Espindola [Mon, 20 Jul 2015 20:08:04 +0000 (20:08 +0000)]
Update for llvm api change.

llvm-svn: 242701

9 years agoRemove Elf_Rela_Iter and Elf_Rel_Iter.
Rafael Espindola [Mon, 20 Jul 2015 20:07:50 +0000 (20:07 +0000)]
Remove Elf_Rela_Iter and Elf_Rel_Iter.

Use just the pointers and check for invalid relocation sections.

llvm-svn: 242700

9 years agoEnable timeout on Windows
Ying Chen [Mon, 20 Jul 2015 20:04:22 +0000 (20:04 +0000)]
Enable timeout on Windows

Summary: - launch dotest with gtimeout if found on Windows

Reviewers: chaoren

Subscribers: lldb-commits

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

llvm-svn: 242699

9 years agoFixed style issues pointed out by Justin Bogner.
Artem Belevich [Mon, 20 Jul 2015 20:02:54 +0000 (20:02 +0000)]
Fixed style issues pointed out by Justin Bogner.

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

llvm-svn: 242698

9 years ago[lit] Implement 'env' in the internal shell
Reid Kleckner [Mon, 20 Jul 2015 19:42:08 +0000 (19:42 +0000)]
[lit] Implement 'env' in the internal shell

The MSys 2 version of 'env' cannot be used to set 'TZ' in the
environment due to some portability hacks in the process spawning
compatibility layer[1]. This affects test/Object/archive-toc.test, which
tries to set TZ in the environment.

Other than that, this saves a subprocess invocation of a small unix
utility, which is makes the tests faster.

The internal shell does not support shell variable expansion, so this
idiom in the ASan tests isn't supported yet:
  RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:opt=1 ...

[1] https://github.com/Alexpux/MSYS2-packages/issues/294

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

llvm-svn: 242696

9 years agoMark new tests as unsupported before C++11
Marshall Clow [Mon, 20 Jul 2015 19:27:47 +0000 (19:27 +0000)]
Mark new tests as unsupported before C++11

llvm-svn: 242695

9 years ago[AArch64] Change EON pattern to match more often.
Chad Rosier [Mon, 20 Jul 2015 18:42:27 +0000 (18:42 +0000)]
[AArch64] Change EON pattern to match more often.

Phabricator: http://reviews.llvm.org/D11359
Patch by Geoff Berry <gberry@codeaurora.org>

llvm-svn: 242694

9 years agoMiscellaneous Fixes for SparseBitVector
Daniel Berlin [Mon, 20 Jul 2015 18:26:23 +0000 (18:26 +0000)]
Miscellaneous Fixes for SparseBitVector

Summary:

1. Fix return value in `SparseBitVector::operator&=`.
2. Add checks if SBV is being assigned is invoking SBV.

Reviewers: dberlin

Subscribers: llvm-commits

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

Committed on behalf of sl@

llvm-svn: 242693

9 years agoFix quoting of #pragma comment for PS4.
Yunzhong Gao [Mon, 20 Jul 2015 17:46:56 +0000 (17:46 +0000)]
Fix quoting of #pragma comment for PS4.

This is the PS4 counterpart to r229376, which quotes the library name if the
name contains space. It was discovered that if a library name contains both
double-quote and space characters, quoting the name might produce unexpected
results, but we are mostly concerned with a Windows host environment, which
does not allow double-quote or slashes in file/folder names.

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

llvm-svn: 242689

9 years agoRevert static Android build until build master restarts.
Chaoren Lin [Mon, 20 Jul 2015 17:35:52 +0000 (17:35 +0000)]
Revert static Android build until build master restarts.

llvm-svn: 242688

9 years agoEliminated a potential infinite recursion in structure layout when the origin
Sean Callanan [Mon, 20 Jul 2015 16:55:19 +0000 (16:55 +0000)]
Eliminated a potential infinite recursion in structure layout when the origin
for a CXXRecordDecl gets pointed at that record.  This can happen when a type is
imported out of and then into the target's AST context without being laid out.

Also added a testcase that covers this scenario.

<rdar://problem/21844453>

llvm-svn: 242687

9 years agoImplement the default searcher for std::experimental::search.
Marshall Clow [Mon, 20 Jul 2015 16:39:28 +0000 (16:39 +0000)]
Implement the default searcher for std::experimental::search.

llvm-svn: 242682

9 years ago[NativeProcessLinux] Bugfix in the monitor thread
Pavel Labath [Mon, 20 Jul 2015 16:14:46 +0000 (16:14 +0000)]
[NativeProcessLinux] Bugfix in the monitor thread

Make sure we dont treat EINTR as a fatal error. I was getting this when trying to profile the
debugger. I'm not sure why this wasn't surfacing before, it could be that the profiler is using
some signals internally.

llvm-svn: 242681

9 years agoAdd missing test for r242296 (vec_sld)
Bill Schmidt [Mon, 20 Jul 2015 15:43:21 +0000 (15:43 +0000)]
Add missing test for r242296 (vec_sld)

llvm-svn: 242680

9 years agoImplement the plugin-based version of std::search. There are no searchers yet; those...
Marshall Clow [Mon, 20 Jul 2015 15:40:27 +0000 (15:40 +0000)]
Implement the plugin-based version of std::search. There are no searchers yet; those are coming soon.

llvm-svn: 242679

9 years ago[CodeGen] Flip lanes when lowering __builtin_palignr with one lane
Benjamin Kramer [Mon, 20 Jul 2015 15:31:17 +0000 (15:31 +0000)]
[CodeGen] Flip lanes when lowering __builtin_palignr with one lane

Otherwise we'd pick the wrong lane for the resulting shuffle and
miscompile code. PR24187.

llvm-svn: 242678

9 years ago[asan] Speed up ASan unit tests by turning off symbolication
Kuba Brecka [Mon, 20 Jul 2015 15:03:39 +0000 (15:03 +0000)]
[asan] Speed up ASan unit tests by turning off symbolication

ASan unit tests don't depend on the symbolizer and they never test its output, but currently they still run it for every crash. This patch simply disables the symbolizer for unit tests, which provides some speed up. On my system (OS X) that's about 1.4x faster, but this could be potentially much more e.g. when using atos on OS X.

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

llvm-svn: 242677

9 years agoReport errors an invalid virtual addresses.
Rafael Espindola [Mon, 20 Jul 2015 14:45:03 +0000 (14:45 +0000)]
Report errors an invalid virtual addresses.

llvm-svn: 242676

9 years agoAdd some missing 'F' flags to libm/libc builtins.
Charlie Turner [Mon, 20 Jul 2015 14:36:59 +0000 (14:36 +0000)]
Add some missing 'F' flags to libm/libc builtins.

More discussion available in http://reviews.llvm.org/D9913

llvm-svn: 242675

9 years agoRemove unnecessary code.
Rafael Espindola [Mon, 20 Jul 2015 14:29:00 +0000 (14:29 +0000)]
Remove unnecessary code.

We were locating the dynamic string table via both the section and segment
headers.

llvm-svn: 242674

9 years agoAMDGPU/SI: Add VI patterns to select FLAT instructions for global memory ops
Tom Stellard [Mon, 20 Jul 2015 14:28:41 +0000 (14:28 +0000)]
AMDGPU/SI: Add VI patterns to select FLAT instructions for global memory ops

Summary:
The MUBUF addr64 bit has been removed on VI, so we must use FLAT
instructions when the pointer is stored in VGPRs.

Reviewers: arsenm

Subscribers: llvm-commits

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

llvm-svn: 242673

9 years agoSimplify the search for which segment has a virtual address. NFC.
Rafael Espindola [Mon, 20 Jul 2015 14:15:38 +0000 (14:15 +0000)]
Simplify the search for which segment has a virtual address. NFC.

llvm-svn: 242672

9 years agoImprove aarch64 instruction emulation
Tamas Berghammer [Mon, 20 Jul 2015 13:52:50 +0000 (13:52 +0000)]
Improve aarch64 instruction emulation

* Add emulation for STR/LDR immediate instructions
* Cleanup existing emulation code

llvm-svn: 242671

9 years agoSilence a -Wtype-limits warning; NFC.
Aaron Ballman [Mon, 20 Jul 2015 13:36:07 +0000 (13:36 +0000)]
Silence a -Wtype-limits warning; NFC.

llvm-svn: 242670

9 years agoSimplify iterating over program headers and detect corrupt ones.
Rafael Espindola [Mon, 20 Jul 2015 13:35:33 +0000 (13:35 +0000)]
Simplify iterating over program headers and detect corrupt ones.

We now use a simple pointer and have range loops.

llvm-svn: 242669

9 years agoRemove erroneous space in "lib64" string constant.
Yaron Keren [Mon, 20 Jul 2015 12:40:25 +0000 (12:40 +0000)]
Remove erroneous space in "lib64" string constant.

llvm-svn: 242667

9 years ago[mips] Added support for the ERETNC instruction.
Vasileios Kalintiris [Mon, 20 Jul 2015 12:28:56 +0000 (12:28 +0000)]
[mips] Added support for the ERETNC instruction.

Summary: This required adding the instruction predicate HasMips32r5.

Patch by Scott Egerton.

Reviewers: dsanders, vkalintiris

Subscribers: llvm-commits

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

llvm-svn: 242666

9 years ago[X86, inlineasm] Improve analysis of x,Y0,Yi,Ym,Yt,L,e,Z,s asm constraints (patch...
Alexey Bataev [Mon, 20 Jul 2015 12:08:00 +0000 (12:08 +0000)]
[X86, inlineasm] Improve analysis of x,Y0,Yi,Ym,Yt,L,e,Z,s asm constraints (patch by Alexey Frolov)

Improve Sema checking of 9 existing inline asm constraints (‘x’, ‘Y*’, ‘L’, ‘e’, ‘Z’, ‘s’).
Differential Revision: http://reviews.llvm.org/D10536

llvm-svn: 242665

9 years agoAllow case-insensitive values for -mtune for AArch64 target in line with GCC.
Gabor Ballabas [Mon, 20 Jul 2015 11:28:20 +0000 (11:28 +0000)]
Allow case-insensitive values for -mtune for AArch64 target in line with GCC.

GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mtune option for the AArch64 target.

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

llvm-svn: 242663

9 years agoFix typo found by Joerg Sonnenberger.
Yaron Keren [Mon, 20 Jul 2015 10:20:57 +0000 (10:20 +0000)]
Fix typo found by Joerg Sonnenberger.

llvm-svn: 242662

9 years agoAttempt to fix greendragon buildbot failures; apparently wc sometimes inserts a leadi...
Richard Smith [Mon, 20 Jul 2015 08:40:51 +0000 (08:40 +0000)]
Attempt to fix greendragon buildbot failures; apparently wc sometimes inserts a leading space into its output. Just check for a matching number anywhere in the output.

llvm-svn: 242661

9 years agoSupport mingw toolchain include and lib directories on Arch Linux.
Yaron Keren [Mon, 20 Jul 2015 06:38:39 +0000 (06:38 +0000)]
Support mingw toolchain include and lib directories on Arch Linux.
Thanks to Thomas Pochtrager for testing this!

llvm-svn: 242660

9 years agoExtend misc-unused-parameters to delete parameters of local functions.
Daniel Jasper [Mon, 20 Jul 2015 03:42:38 +0000 (03:42 +0000)]
Extend misc-unused-parameters to delete parameters of local functions.

Also see: llvm.org/PR24180.

llvm-svn: 242659