platform/upstream/llvm.git
9 years ago[CMake] We shouldn't be storing values in the cache unless they actually need CMake...
Chris Bieneman [Tue, 14 Jul 2015 01:17:43 +0000 (01:17 +0000)]
[CMake] We shouldn't be storing values in the cache unless they actually need CMake cache behavior.

add_llvm_external_project puts LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR into the cache even if it is just the in-tree default path. This causes all sorts of oddness, and makes it so that I can't change the behavior of this variable.

This patch never puts LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR into the cache. It will only end up in the cache if it is specified on the command line, which is the correct behavior.

There is also a temporary change to remove non-default values from the cache if they are already present. This should have the impact of cleaning out unncecissary values from the caches on the buildbots and people's local build directories. This part of the change is marked with a TODO and can be removed in a few days.

llvm-svn: 242102

9 years agoRefactor Unix signals.
Chaoren Lin [Tue, 14 Jul 2015 01:09:28 +0000 (01:09 +0000)]
Refactor Unix signals.

Summary:
- Consolidate Unix signals selection in UnixSignals.
- Make Unix signals available from platform.
- Add jSignalsInfo packet to retrieve Unix signals from remote platform.
- Get a copy of the platform signal for each remote process.
- Update SB API for signals.
- Update signal utility in test suite.

Reviewers: ovyalov, clayborg

Subscribers: chaoren, jingham, labath, emaste, tberghammer, lldb-commits

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

llvm-svn: 242101

9 years agoAdd a herper function. NFC.
Rafael Espindola [Tue, 14 Jul 2015 01:06:16 +0000 (01:06 +0000)]
Add a herper function. NFC.

llvm-svn: 242100

9 years agoRemove a completely redundant initialization of llvm::TimePassesIsEnabled,
Adrian Prantl [Tue, 14 Jul 2015 01:04:40 +0000 (01:04 +0000)]
Remove a completely redundant initialization of llvm::TimePassesIsEnabled,
which is actually the variable backing up the llvm -time-passes command
line argument.
llvm::TimePassesIsEnabled is actually being initialized in CodeGenAction.

llvm-svn: 242099

9 years agoFix warnings.
Michael J. Spencer [Tue, 14 Jul 2015 01:02:37 +0000 (01:02 +0000)]
Fix warnings.

llvm-svn: 242098

9 years agoBasic code generation for MSan use-after-dtor.
Evgeniy Stepanov [Tue, 14 Jul 2015 00:34:50 +0000 (00:34 +0000)]
Basic code generation for MSan use-after-dtor.

Under the -fsanitize-memory-use-after-dtor (disabled by default) insert
an MSan runtime library call at the end of every destructor.

Patch by Naomi Musgrave.

llvm-svn: 242097

9 years ago[LinkerScript] Don't create unnecessarily large segments
Rafael Auler [Tue, 14 Jul 2015 00:34:43 +0000 (00:34 +0000)]
[LinkerScript] Don't create unnecessarily large segments

When using a linker script expression to change the address of a section, even
if the new address is more than a page of distance from the old address, lld
may put everything in the same segment, forcing it to be unnecessarily large.
This patch changes the logic in Segment::assignVirtualAddress() and
Segment::assignFileOffsets() to allow the segment to be sliced into two or more
if it detects a linker script expression that changes a section address.

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

llvm-svn: 242096

9 years agoMIR Serialization: Serialize the variable sized stack objects.
Alex Lorenz [Tue, 14 Jul 2015 00:26:26 +0000 (00:26 +0000)]
MIR Serialization: Serialize the variable sized stack objects.

llvm-svn: 242095

9 years agoExtend -ftime-report to give more information about time spent reading module files.
Richard Smith [Tue, 14 Jul 2015 00:26:00 +0000 (00:26 +0000)]
Extend -ftime-report to give more information about time spent reading module files.

llvm-svn: 242094

9 years agoPut explicit template instantiations in the correct namespace.
Michael J. Spencer [Tue, 14 Jul 2015 00:22:00 +0000 (00:22 +0000)]
Put explicit template instantiations in the correct namespace.

llvm-svn: 242093

9 years agoRemove commented out code.
Michael J. Spencer [Tue, 14 Jul 2015 00:11:38 +0000 (00:11 +0000)]
Remove commented out code.

llvm-svn: 242092

9 years agoUpdate enforceKnownAlignment after the isWeakForLinker semantic change
Reid Kleckner [Tue, 14 Jul 2015 00:11:08 +0000 (00:11 +0000)]
Update enforceKnownAlignment after the isWeakForLinker semantic change

Previously we would refrain from attempting to increase the linkage of
available_externally globals because they were considered weak for the
linker. Now they are treated more like a declaration instead of a weak
definition.

This was causing SSE alignment faults in Chromuim, when some code
assumed it could increase the alignment of a dllimported global that it
didn't control.  http://crbug.com/509256

llvm-svn: 242091

9 years ago[OpenMP] Add REQUIRES pragma to threadprivate regression tests.
Samuel Antao [Tue, 14 Jul 2015 00:09:50 +0000 (00:09 +0000)]
[OpenMP] Add REQUIRES pragma to threadprivate regression tests.

llvm-svn: 242090

9 years ago[LinkerScript] Fix bug in Segment::assignVirtualAddress()
Rafael Auler [Mon, 13 Jul 2015 23:52:58 +0000 (23:52 +0000)]
[LinkerScript] Fix bug in Segment::assignVirtualAddress()

When calculating the start address and size of a segment, lld mistakenly
attributed the start address of the last segment slice to the whole segment
when it should consider the start address of the first slice. In this case, in a
multi-slice segment, Segment::assignVirtualAddress() will return a wrong
segment start address to TargetLayout::assignVirtualAddress(). The effect of
this miscalculation is to allocate some program headers in unnecessarily far
away addresses. This commit fixes this.

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

llvm-svn: 242089

9 years agoInitial ELF port.
Michael J. Spencer [Mon, 13 Jul 2015 23:48:06 +0000 (23:48 +0000)]
Initial ELF port.

This is a direct port of the new PE/COFF linker to ELF.

It can take a single object file and generate a valid executable that executes at the first byte in the text section.

llvm-svn: 242088

9 years ago[Intrin.h] Use __ATOMIC_SEQ_CST instead of '5'
David Majnemer [Mon, 13 Jul 2015 23:39:37 +0000 (23:39 +0000)]
[Intrin.h] Use __ATOMIC_SEQ_CST instead of '5'

No functionality change is intended.

llvm-svn: 242087

9 years ago[Intrin.h] Make the variable names more consistent
David Majnemer [Mon, 13 Jul 2015 23:38:56 +0000 (23:38 +0000)]
[Intrin.h] Make the variable names more consistent

No functionality change intended.

llvm-svn: 242086

9 years ago[cuda] Driver changes to compile and stitch together host and device-side CUDA code.
Artem Belevich [Mon, 13 Jul 2015 23:27:56 +0000 (23:27 +0000)]
[cuda] Driver changes to compile and stitch together host and device-side CUDA code.

  NOTE: reverts r242077 to reinstate r242058, r242065, 242067
        and includes fix for OS X test failures.

  - Changed driver pipeline to compile host and device side of CUDA
    files and incorporate results of device-side compilation into host
    object file.

  - Added a test for cuda pipeline creation in clang driver.

  New clang options:
  --cuda-host-only   - Do host-side compilation only.
  --cuda-device-only - Do device-side compilation only.

  --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side
    compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more
    than once in which case one device-compilation will be done per
    unique specified GPU architecture.

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

llvm-svn: 242085

9 years agoMIR Serialization: Serialize the sub register indices.
Alex Lorenz [Mon, 13 Jul 2015 23:24:34 +0000 (23:24 +0000)]
MIR Serialization: Serialize the sub register indices.

This commit serializes the sub register indices from the register machine
operands.

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

9 years agoAdd missing file.
Rafael Espindola [Mon, 13 Jul 2015 23:14:26 +0000 (23:14 +0000)]
Add missing file.

Sorry about that.

llvm-svn: 242083

9 years agoFix reading archive members with / in the name.
Rafael Espindola [Mon, 13 Jul 2015 23:07:05 +0000 (23:07 +0000)]
Fix reading archive members with / in the name.

This is important for thin archives.

llvm-svn: 242082

9 years ago[PPC64LE] More improvements to VSX swap optimization
Bill Schmidt [Mon, 13 Jul 2015 22:58:19 +0000 (22:58 +0000)]
[PPC64LE] More improvements to VSX swap optimization

This patch allows VSX swap optimization to succeed more frequently.
Specifically, it is concerned with common code sequences that occur
when copying a scalar floating-point value to a vector register.  This
patch currently handles cases where the floating-point value is
already in a register, but does not yet handle loads (such as via an
LXSDX scalar floating-point VSX load).  That will be dealt with later.

A typical case is when a scalar value comes in as a floating-point
parameter.  The value is copied into a virtual VSFRC register, and
then a sequence of SUBREG_TO_REG and/or COPY operations will convert
it to a full vector register of the class required by the context.  If
this vector register is then used as part of a lane-permuted
computation, the original scalar value will be in the wrong lane.  We
can fix this by adding a swap operation following any widening
SUBREG_TO_REG operation.  Additional COPY operations may be needed
around the swap operation in order to keep register assignment happy,
but these are pro forma operations that will be removed by coalescing.

If a scalar value is otherwise directly referenced in a computation
(such as by one of the many XS* vector-scalar operations), we
currently disable swap optimization.  These operations are
lane-sensitive by definition.  A MentionsPartialVR flag is added for
use in each swap table entry that mentions a scalar floating-point
register without having special handling defined.

A common idiom for PPC64LE is to convert a double-precision scalar to
a vector by performing a splat operation.  This ensures that the value
can be referenced as V[0], as it would be for big endian, whereas just
converting the scalar to a vector with a SUBREG_TO_REG operation
leaves this value only in V[1].  A doubleword splat operation is one
form of an XXPERMDI instruction, which takes one doubleword from a
first operand and another doubleword from a second operand, with a
two-bit selector operand indicating which doublewords are chosen.  In
the general case, an XXPERMDI can be permitted in a lane-swapped
region provided that it is properly transformed to select the
corresponding swapped values.  This transformation is to reverse the
order of the two input operands, and to reverse and complement the
bits of the selector operand (derivation left as an exercise to the
reader ;).

A new test case that exercises the scalar-to-vector and generalized
XXPERMDI transformations is added as CodeGen/PowerPC/swaps-le-5.ll.
The patch also requires a change to CodeGen/PowerPC/swaps-le-3.ll to
use CHECK-DAG instead of CHECK for two independent instructions that
now appear in reverse order.

There are two small unrelated changes that are added with this patch.
First, the XXSLDWI instruction was incorrectly omitted from the list
of lane-sensitive instructions; this is now fixed.  Second, I observed
that the same webs were being rejected over and over again for
different reasons.  Since it's sufficient to reject a web only once, I
added a check for this to speed up the compilation time slightly.

llvm-svn: 242081

9 years ago[OpenMP] Add TLS-based implementation for threadprivate directive.
Samuel Antao [Mon, 13 Jul 2015 22:54:53 +0000 (22:54 +0000)]
[OpenMP] Add TLS-based implementation for threadprivate directive.

llvm-svn: 242080

9 years agoFix Windows build break related to MainLoop.
Adrian McCarthy [Mon, 13 Jul 2015 22:35:44 +0000 (22:35 +0000)]
Fix Windows build break related to MainLoop.

llvm-svn: 242079

9 years agoCOFF: Fix x86 delay-load helper function name.
Rui Ueyama [Mon, 13 Jul 2015 22:31:45 +0000 (22:31 +0000)]
COFF: Fix x86 delay-load helper function name.

If /delayload option is given, we have to resolve __delayLoadHelper2
since the function is the dynamic loader to delay-load DLLs.
The function name is mangled in x86 as ___delayLoadHelper2@8.

llvm-svn: 242078

9 years agoThis reverts commit r242058, r242065, r242067.
Rafael Espindola [Mon, 13 Jul 2015 22:26:30 +0000 (22:26 +0000)]
This reverts commit r242058,  r242065,  r242067.

The tests were failing on OS X.

Revert "[cuda] Driver changes to compile and stitch together host and device-side CUDA code."
Revert "Fixed regex to properly match '64' in the test case."
Revert "clang/test/Driver/cuda-options.cu REQUIRES clang-driver, at least."

llvm-svn: 242077

9 years agoDon't crash if we are unable to get the member type.
Greg Clayton [Mon, 13 Jul 2015 22:08:16 +0000 (22:08 +0000)]
Don't crash if we are unable to get the member type.

<rdar://problem/21624447>

llvm-svn: 242076

9 years agoCOFF: Inline Defined::getRVA because it's very hot.
Rui Ueyama [Mon, 13 Jul 2015 22:01:27 +0000 (22:01 +0000)]
COFF: Inline Defined::getRVA because it's very hot.

llvm-svn: 242075

9 years agoUse std::make_tuple to reduce code duplication.
Rafael Espindola [Mon, 13 Jul 2015 22:01:02 +0000 (22:01 +0000)]
Use std::make_tuple to reduce code duplication.

Thanks to David Blaikie for the suggestion.

llvm-svn: 242074

9 years agoRemove unnecessary lines from the test in r242068.
Pete Cooper [Mon, 13 Jul 2015 21:50:35 +0000 (21:50 +0000)]
Remove unnecessary lines from the test in r242068.

This test case was breaking the hexagon elf bot.  The failing lines
were actually unnecessary as checking that the store still reads the
correct value demonstrates that everything is working fine now.

llvm-svn: 242073

9 years agoReduce memory usage of ComputeEditDistance() by (almost) 50%
Nico Weber [Mon, 13 Jul 2015 21:33:21 +0000 (21:33 +0000)]
Reduce memory usage of ComputeEditDistance() by (almost) 50%

ComputeEditDistance() currently keeps two rows of the edit distance matrix in
memory.  That's unnecessary, one row plus one additional element are sufficient.
With this change, strings up to 64 chars can be processed without going to the
heap, compared to 32 chars previously.  (But the main motivation is that the
code gets a bit simpler.)

No intended behavior change.

llvm-svn: 242069

9 years agoLoop idiom recognizer was replacing too many uses of popcount.
Pete Cooper [Mon, 13 Jul 2015 21:25:33 +0000 (21:25 +0000)]
Loop idiom recognizer was replacing too many uses of popcount.

When spotting that a loop can use ctpop, we were incorrectly replacing all uses of a value with a value derived from ctpop.

The bug here was exposed because we were replacing a use prior to the ctpop with the ctpop value and so we have a use before def, i.e., we changed

 %tobool.5 = icmp ne i32 %num, 0
 store i1 %tobool.5, i1* %ptr
 br i1 %tobool.5, label %for.body.lr.ph, label %for.end

to

 store i1 %1, i1* %ptr
 %0 = call i32 @llvm.ctpop.i32(i32 %num)
 %1 = icmp ne i32 %0, 0
 br i1 %1, label %for.body.lr.ph, label %for.end

Even if we inserted the ctpop so that it dominates the store here, that would still be incorrect.  The store doesn’t want the result of ctpop.

The fix is very simple, and involves replacing only the branch condition with the ctpop instead of all uses.

Reviewed by Hal Finkel.

llvm-svn: 242068

9 years agoclang/test/Driver/cuda-options.cu REQUIRES clang-driver, at least.
NAKAMURA Takumi [Mon, 13 Jul 2015 21:18:53 +0000 (21:18 +0000)]
clang/test/Driver/cuda-options.cu REQUIRES clang-driver, at least.

llvm-svn: 242067

9 years agoCOFF: Split createSymbolAndSymbolTable to small functions. NFC.
Rui Ueyama [Mon, 13 Jul 2015 20:56:31 +0000 (20:56 +0000)]
COFF: Split createSymbolAndSymbolTable to small functions. NFC.

llvm-svn: 242066

9 years agoFixed regex to properly match '64' in the test case.
Artem Belevich [Mon, 13 Jul 2015 20:49:50 +0000 (20:49 +0000)]
Fixed regex to properly match '64' in the test case.

llvm-svn: 242065

9 years agoMove class into an anonymous namespace. NFC.
Benjamin Kramer [Mon, 13 Jul 2015 20:42:13 +0000 (20:42 +0000)]
Move class into an anonymous namespace. NFC.

llvm-svn: 242064

9 years ago[WinEH] Emit the LSDA even if no lpads remain but outlining occurred
Reid Kleckner [Mon, 13 Jul 2015 20:41:46 +0000 (20:41 +0000)]
[WinEH] Emit the LSDA even if no lpads remain but outlining occurred

The outlined funclets call intrinsics which reference labels from the
LSDA. This situation can easily arise in small functions with a single
cleanup at -O0, where Clang marks a definition as nounwind, and then
WinEHPrepare "discovers" that the landingpad is dead by accident and
deletes it.

We now need to ask the LLVM IR Function for it's personality directly,
rather than going through MachineModuleInfo.

Fixes PR23892.

llvm-svn: 242063

9 years ago[Hexagon] Move BitTracker into the llvm namespace and remove redundant qualifications
Benjamin Kramer [Mon, 13 Jul 2015 20:38:16 +0000 (20:38 +0000)]
[Hexagon] Move BitTracker into the llvm namespace and remove redundant qualifications

No functional change intended.

llvm-svn: 242062

9 years agoAdd support deterministic output in llvm-ar and make it the default.
Rafael Espindola [Mon, 13 Jul 2015 20:38:09 +0000 (20:38 +0000)]
Add support deterministic output in llvm-ar and make it the default.

llvm-svn: 242061

9 years agoRevert "[CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registrati...
Chris Bieneman [Mon, 13 Jul 2015 20:30:58 +0000 (20:30 +0000)]
Revert "[CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registration that was already partially working."

Reverting r242059 because it broke some bots. I'm attempting to reproduce the failures now.

llvm-svn: 242060

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

Summary:
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_*_*.

Original Summary:
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: 242059

9 years ago[cuda] Driver changes to compile and stitch together host and device-side CUDA code.
Artem Belevich [Mon, 13 Jul 2015 20:21:06 +0000 (20:21 +0000)]
[cuda] Driver changes to compile and stitch together host and device-side CUDA code.

  - Changed driver pipeline to compile host and device side of CUDA
    files and incorporate results of device-side compilation into host
    object file.

  - Added a test for cuda pipeline creation in clang driver.

  New clang options:
  --cuda-host-only   - Do host-side compilation only.
  --cuda-device-only - Do device-side compilation only.

  --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side
    compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more
    than once in which case one device-compilation will be done per
    unique specified GPU architecture.

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

llvm-svn: 242058

9 years ago[lldb-mi] Add const qualifier to vMITextLine in InterpretCommandThisDriver.
Dawn Perchik [Mon, 13 Jul 2015 20:16:13 +0000 (20:16 +0000)]
[lldb-mi] Add const qualifier to vMITextLine in InterpretCommandThisDriver.

llvm-svn: 242057

9 years agoImplement the first part of N4258: 'Cleaning up noexcept in the Library'. This patch...
Marshall Clow [Mon, 13 Jul 2015 20:04:56 +0000 (20:04 +0000)]
Implement the first part of N4258: 'Cleaning up noexcept in the Library'. This patch deals with swapping containers, and implements a more strict noexcept specification (a conforming extension) than the standard mandates.

llvm-svn: 242056

9 years ago[Modules] Allow missing header before a missing requirement
Ben Langmuir [Mon, 13 Jul 2015 19:48:52 +0000 (19:48 +0000)]
[Modules] Allow missing header before a missing requirement

And make the module unavailable without breaking any parent modules.

If there's a missing requirement after we've already seen a missing
header, still update the IsMissingRequiement bit correctly.  Also,
diagnose missing requirements before missing headers, since the
existence of the header is moot if there are missing requirements.

llvm-svn: 242055

9 years ago[CMake] Add missing DebugInfo libraries to llvm-shlib
Keno Fischer [Mon, 13 Jul 2015 19:41:51 +0000 (19:41 +0000)]
[CMake] Add missing DebugInfo libraries to llvm-shlib

Reviewers: beanz

Subscribers: llvm-commits

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

llvm-svn: 242054

9 years agoAMDGPU: Minor cleanups to always inline pass
Matt Arsenault [Mon, 13 Jul 2015 19:08:36 +0000 (19:08 +0000)]
AMDGPU: Minor cleanups to always inline pass

llvm-svn: 242053

9 years agoFix some bugs in OMPT support
Jonathan Peyton [Mon, 13 Jul 2015 18:55:45 +0000 (18:55 +0000)]
Fix some bugs in OMPT support

1.) in kmp_csupport.c, move computation of parameters only needed for OMPT tracing
inside a conditional to reduce overhead if not receiving ompt_event_master_begin
callbacks.
2.) in kmp_gsupport.c, remove spurious reset of OMPT reenter_runtime_frame (which
is set in its caller, GOMP_parallel_start correct placement of #if OMP_TRACE so
that state is maintained even if tracing support not included.
3.) in z_Linux_util.c, add architecture independent support for OMPT by setting
and resetting OMPT's exit_frame_ptr before and after invoking a microtask.
4.) On the Intel MIC, the loader refuses to retain static symbols in the
libomp.so shared library, even though tools need them. The loader could not be
bullied into doing so. To accommodate this, I changed the visibility of OMPT
placeholder functions to public. This required additions in exports.so.txt,
adding extern "C" scoping in ompt-general.c so that the public placeholder
symbols won't be mangled.

Patch by John Mellor-Crummey

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

llvm-svn: 242052

9 years agoclang-cl: For files setting output names, mention which flags they belong to.
Nico Weber [Mon, 13 Jul 2015 18:54:56 +0000 (18:54 +0000)]
clang-cl: For files setting output names, mention which flags they belong to.

It always takes me a while to figure out how to say "preprocess to file
foo.txt" with clang-cl. With this, it might be easier.
http://reviews.llvm.org/D10890

llvm-svn: 242051

9 years ago[MC] Correctly escape .safeseh's symbol
David Majnemer [Mon, 13 Jul 2015 18:51:15 +0000 (18:51 +0000)]
[MC] Correctly escape .safeseh's symbol

This fixes PR24107.

llvm-svn: 242050

9 years agoEnable partial and runtime loop unrolling for NVPTX.
Mark Heffernan [Mon, 13 Jul 2015 18:33:21 +0000 (18:33 +0000)]
Enable partial and runtime loop unrolling for NVPTX.

Enable partial and runtime loop unrolling for NVPTX backend via
TTI::UnrollingPreferences with a small threshold. This partially unrolls
small loops which are often unrolled by the PTX to SASS compiler
and unrolling earlier can be beneficial.

llvm-svn: 242049

9 years agoUpdate documentation for unroll pragmas on loops with runtime trip counts.
Mark Heffernan [Mon, 13 Jul 2015 18:31:37 +0000 (18:31 +0000)]
Update documentation for unroll pragmas on loops with runtime trip counts.

This change updates the documentation for the loop unrolling pragma behavior
change in r242047. Specifically, with that change "#pragma unroll" will not
unroll loops with a runtime trip count.

llvm-svn: 242048

9 years agoEnable runtime unrolling with unroll pragma metadata
Mark Heffernan [Mon, 13 Jul 2015 18:26:27 +0000 (18:26 +0000)]
Enable runtime unrolling with unroll pragma metadata

Enable runtime unrolling for loops with unroll count metadata ("#pragma unroll N")
and a runtime trip count. Also, do not unroll loops with unroll full metadata if the
loop has a runtime loop count. Previously, such loops would be unrolled with a
very large threshold (pragma-unroll-threshold) if runtime unrolled happened to be
enabled resulting in a very large (and likely unwise) unroll factor.

llvm-svn: 242047

9 years agoService the doxygen comments in DwarfUnit and DwarfDebug.
Adrian Prantl [Mon, 13 Jul 2015 18:25:29 +0000 (18:25 +0000)]
Service the doxygen comments in DwarfUnit and DwarfDebug.

llvm-svn: 242046

9 years agoMIR Serialization: Serialize the fixed stack objects.
Alex Lorenz [Mon, 13 Jul 2015 18:07:26 +0000 (18:07 +0000)]
MIR Serialization: Serialize the fixed stack objects.

This commit serializes the fixed stack objects, including fixed spill slots.
The fixed stack objects are serialized using a YAML sequence of YAML inline
mappings. Each mapping has the object's ID, type, size, offset, and alignment.
The objects that aren't spill slots also serialize the isImmutable and isAliased
flags.

The fixed stack objects are a part of the machine function's YAML mapping.

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

9 years ago[WinEH] Strip the \01 character from the __CxxFrameHandler3 thunk name
Reid Kleckner [Mon, 13 Jul 2015 17:55:14 +0000 (17:55 +0000)]
[WinEH] Strip the \01 character from the __CxxFrameHandler3 thunk name

Add another C++ 32-bit EH table test.

llvm-svn: 242044

9 years agofixed typo in debug assertion reported by John Mellor-Crummey
Andrey Churbanov [Mon, 13 Jul 2015 17:52:41 +0000 (17:52 +0000)]
fixed typo in debug assertion reported by John Mellor-Crummey

llvm-svn: 242043

9 years agoRemove macro guards for extern template instantiations.
Benjamin Kramer [Mon, 13 Jul 2015 17:21:31 +0000 (17:21 +0000)]
Remove macro guards for extern template instantiations.

This is a C++11 feature that both GCC and MSVC have supported as ane extension
long before C++11 was approved.

llvm-svn: 242042

9 years agoAvoid using Loop::getSubLoopsVector.
Benjamin Kramer [Mon, 13 Jul 2015 17:21:14 +0000 (17:21 +0000)]
Avoid using Loop::getSubLoopsVector.

Passes should never modify it, just use the const version. While there
reduce copying in LoopInterchange. No functional change intended.

llvm-svn: 242041

9 years agoFix handling of the 'n' asm constraint with invalid operands.
James Y Knight [Mon, 13 Jul 2015 16:36:22 +0000 (16:36 +0000)]
Fix handling of the 'n' asm constraint with invalid operands.

It had accidently accepted a symbol+offset value (and emitted
incorrect code for it, keeping only the offset part) instead of
properly reporting the constraint as invalid.

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

llvm-svn: 242040

9 years agoclang-format: Print token type name instead of number in -debug output
Birunthan Mohanathas [Mon, 13 Jul 2015 16:19:34 +0000 (16:19 +0000)]
clang-format: Print token type name instead of number in -debug output

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

llvm-svn: 242039

9 years agoAMDGPU/SI: Select mad patterns to v_mac_f32
Tom Stellard [Mon, 13 Jul 2015 15:47:57 +0000 (15:47 +0000)]
AMDGPU/SI: Select mad patterns to v_mac_f32

The two-address instruction pass will convert these back to v_mad_f32
if necessary.

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

llvm-svn: 242038

9 years agoARM: Fix cttz expansion on vector types.
Logan Chien [Mon, 13 Jul 2015 15:37:30 +0000 (15:37 +0000)]
ARM: Fix cttz expansion on vector types.

The 64/128-bit vector types are legal if NEON instructions are
available.  However, there was no matching patterns for @llvm.cttz.*()
intrinsics and result in fatal error.

This commit fixes the problem by lowering cttz to:
a. ctpop((x & -x) - 1)
b. width - ctlz(x & -x) - 1

llvm-svn: 242037

9 years ago[ARM] Handle commutativity when converting to tADDhirr in Thumb2
Scott Douglass [Mon, 13 Jul 2015 15:31:48 +0000 (15:31 +0000)]
[ARM] Handle commutativity when converting to tADDhirr in Thumb2

Also, run thumb_rewrite.s tests in Thumb2 now that they pass.

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

llvm-svn: 242036

9 years ago[ARM] Add Thumb2 ADD with SP narrowing from 3 operand to 2
Scott Douglass [Mon, 13 Jul 2015 15:31:40 +0000 (15:31 +0000)]
[ARM] Add Thumb2 ADD with SP narrowing from 3 operand to 2

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

llvm-svn: 242035

9 years ago[ARM] Small refactor of tryConvertingToTwoOperandForm (nfc)
Scott Douglass [Mon, 13 Jul 2015 15:31:33 +0000 (15:31 +0000)]
[ARM] Small refactor of tryConvertingToTwoOperandForm (nfc)

Also, add more Thumb2 ADD tests requested during review of
http://reviews.llvm.org/D11053.

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

llvm-svn: 242034

9 years agoCleanup after r241809 - remove uncessary call to std::sort
Silviu Baranga [Mon, 13 Jul 2015 14:48:24 +0000 (14:48 +0000)]
Cleanup after r241809 - remove uncessary call to std::sort

Summary:
The iteration order within a member of DepCands is deterministic
and therefore we don't have to sort the accesses within a member.
We also don't have to copy the indices of the pointers into a
vector, since we can iterate over the members of the class.

Subscribers: llvm-commits

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

llvm-svn: 242033

9 years agoRemove unused variable.
Rafael Espindola [Mon, 13 Jul 2015 14:43:33 +0000 (14:43 +0000)]
Remove unused variable.

Sorry I missed it in the previous commit.

llvm-svn: 242032

9 years agoAliases don't have available_externally linkage.
Rafael Espindola [Mon, 13 Jul 2015 14:39:02 +0000 (14:39 +0000)]
Aliases don't have available_externally linkage.

Allowing that is probably a good idea, but currently we don't, so
this is dead code.

llvm-svn: 242031

9 years agoDon't change the visibility when converting a definition to a declaration.
Rafael Espindola [Mon, 13 Jul 2015 14:18:22 +0000 (14:18 +0000)]
Don't change the visibility when converting a definition to a declaration.

llvm-svn: 242030

9 years agoSupport alternate attribute spelling __enable_if__
Ulrich Weigand [Mon, 13 Jul 2015 14:13:01 +0000 (14:13 +0000)]
Support alternate attribute spelling __enable_if__

Attribute names usually support an alternate spelling that uses double
underscores before and after the attribute name, like e.g. attribute
((__aligned__)) for attribute ((aligned)). This is necessary to allow
use of attributes in system headers without polluting the name space.

However, for attribute ((enable_if)) that alternate spelling does not
work correctly. This is because of code in Parser::ParseGNUAttributeArgs
(ParseDecl.cpp) that specifically checks for the "enable_if" spelling
without allowing the alternate spelling.

Similar code in ParseDecl.cpp uses the normalizeAttrName helper to allow
both spellings. This patch adds use of that helper for the "enable_if"
check as well, which fixes attribute ((__enable_if__)).

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

llvm-svn: 242029

9 years agoRemoving several -Wunused-but-set-variable warnings; NFC intended.
Aaron Ballman [Mon, 13 Jul 2015 14:04:30 +0000 (14:04 +0000)]
Removing several -Wunused-but-set-variable warnings; NFC intended.

llvm-svn: 242028

9 years agoPrint the visibility of available_externally functions.
Rafael Espindola [Mon, 13 Jul 2015 13:55:18 +0000 (13:55 +0000)]
Print the visibility of available_externally functions.

We were already printing it for declarations, but not available_externally.

llvm-svn: 242027

9 years agoRevert r241981 "Revert "Revert r236894 "[BasicAA] Fix zext & sext handling"""
Manuel Klimek [Mon, 13 Jul 2015 13:50:55 +0000 (13:50 +0000)]
Revert r241981 "Revert "Revert r236894 "[BasicAA] Fix zext & sext handling"""

The repros from PR23626 still fail.

llvm-svn: 242025

9 years agoAVX-512: Added all AVX-512 forms of Vector Convert for Float/Double/Int/Long types.
Elena Demikhovsky [Mon, 13 Jul 2015 13:26:20 +0000 (13:26 +0000)]
AVX-512: Added all AVX-512 forms of Vector Convert for Float/Double/Int/Long types.
In this patch I have only encoding. Intrinsics and DAG lowering will be in the next patch.
I temporary removed the old intrinsics test (just to split this patch).
Half types are not covered here.

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

llvm-svn: 242023

9 years agoAvoid dependency on uuid.h in MacOSXDYLD
Pavel Labath [Mon, 13 Jul 2015 12:27:28 +0000 (12:27 +0000)]
Avoid dependency on uuid.h in MacOSXDYLD

Summary:
r241964 has added a dependency on uuid.h, which (on linux at least) necessitates instalation of a
new package. Since the only thing we need from that file is uuid_t (and this is already defined
in UuidCompatibility.h), we can avoid this dependency by making this include __APPLE__ specific.
If in future, we need more from this library, we can revisit this decision.

Reviewers: jasonmolenda

Subscribers: lldb-commits

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

llvm-svn: 242022

9 years agoUpdate comment
Ulrich Weigand [Mon, 13 Jul 2015 11:52:14 +0000 (11:52 +0000)]
Update comment

As noticed by David Majnemer, update an out-of-date comment in
CGClass.cpp after the r241916 commit.

llvm-svn: 242021

9 years ago[llvm-stress] Remove unneeded llvm:: prefix. NFC.
Pawel Bylica [Mon, 13 Jul 2015 11:25:56 +0000 (11:25 +0000)]
[llvm-stress] Remove unneeded llvm:: prefix. NFC.

llvm-svn: 242020

9 years agoRemove hack about the size of long doubles from DataExtractor
Tamas Berghammer [Mon, 13 Jul 2015 10:50:55 +0000 (10:50 +0000)]
Remove hack about the size of long doubles from DataExtractor

The size of a long double was hardcoded in DataExtractor for x86 and
x86_64 architectures. This CL removes the hard coded values and use the
actual size based on the floating point semantics specified.

Differential revision: http://reviews.llvm.org/D8417

llvm-svn: 242019

9 years agoIntroduce a MainLoop class and switch llgs to use it
Pavel Labath [Mon, 13 Jul 2015 10:44:55 +0000 (10:44 +0000)]
Introduce a MainLoop class and switch llgs to use it

Summary:
This is the first part of our effort to make llgs single threaded. Currently, llgs consists of
about three threads and the synchronisation between them is a major source of latency when
debugging linux and android applications.

In order to be able to go single threaded, we must have the ability to listen for events from
multiple sources (primarily, client commands coming over the network and debug events from the
inferior) and perform necessary actions. For this reason I introduce the concept of a MainLoop.
A main loop has the ability to register callback's which will be invoked upon receipt of certain
events. MainLoopPosix has the ability to listen for file descriptors and signals.

For the moment, I have merely made the GDBRemoteCommunicationServerLLGS class use MainLoop
instead of waiting on the network socket directly, but the other threads still remain. In the
followup patches I indend to migrate NativeProcessLinux to this class and remove the remaining
threads.

Reviewers: ovyalov, clayborg, amccarth, zturner, emaste

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 242018

9 years agoSkip oatdata and oatexec symbols in system@framework@boot.oat
Tamas Berghammer [Mon, 13 Jul 2015 09:54:41 +0000 (09:54 +0000)]
Skip oatdata and oatexec symbols in system@framework@boot.oat

On Android the oatdata and the oatexec symbols in
system@framework@boot.oat covers the full .text section what causes
issues with displaying unusable symbol name to the user and very slow
unwinding speed because the instruction emulation based unwind plans
try to emulate all instructions in these symbols. Don't add these
symbols to the symbol list as they have no use for the debugger and
they are causing a lot of trouble.

Differential revision: http://reviews.llvm.org/D11065

llvm-svn: 242017

9 years ago[LLDB][MIPS] Add mips cores in cores_match () in ArchSpec
Sagar Thakur [Mon, 13 Jul 2015 09:52:06 +0000 (09:52 +0000)]
[LLDB][MIPS] Add mips cores in cores_match () in ArchSpec

    This patch:
        - Allows mips32 cores to match with any mips32/mips64 cores.
        - Allows mips32r2 cores to match with core only up-to mips32r2/mips64r2.
        - Allows mips32r3 cores to match with core only up-to mips32r3/mips64r3.
        - Allows mips32r5 cores to match with core only up-to mips32r3/mips64r5.
        - Allows mips32r6 core to match with only mips32r6/mips64r6 or mips32/mips64.

Reviewers: emaste, jaydeep, clayborg
Subscribers: mohit.bhakkad, nitesh.jain, bhushan, lldb-commits
Differential Revision: http://reviews.llvm.org/D10921

llvm-svn: 242016

9 years ago[mips] Explained the 'w' modifier in the Inline Assembler documentation.
Daniel Sanders [Mon, 13 Jul 2015 09:24:21 +0000 (09:24 +0000)]
[mips] Explained the 'w' modifier in the Inline Assembler documentation.

It exists for compatibility with GCC which requires it to print MSA registers
for the 'f' constraint. Although LLVM doesn't need it, the 'w' modifier should
still be used for portability between the two compilers.

llvm-svn: 242015

9 years ago[Mips] Support MIPS big-endian 32/64-bits targets
Simon Atanasyan [Mon, 13 Jul 2015 09:11:35 +0000 (09:11 +0000)]
[Mips] Support MIPS big-endian 32/64-bits targets

llvm-svn: 242014

9 years agoprofile: Autoconf build system support for r241824
Justin Bogner [Mon, 13 Jul 2015 06:39:53 +0000 (06:39 +0000)]
profile: Autoconf build system support for r241824

r241824 didn't update the autoconf build system to handle the new file
in the profile library.

llvm-svn: 242013

9 years agoSet the linkage before setting the visibility.
Rafael Espindola [Mon, 13 Jul 2015 06:07:58 +0000 (06:07 +0000)]
Set the linkage before setting the visibility.

Otherwise the visibility setting code would not know that a given
function was available_externally.

Fixes PR24097.

llvm-svn: 242012

9 years ago[LSR] don't attempt to promote ephemeral values to indvars
Jingyue Wu [Mon, 13 Jul 2015 03:28:53 +0000 (03:28 +0000)]
[LSR] don't attempt to promote ephemeral values to indvars

Summary:
This at least saves compile time. I also encountered a case where
ephemeral values affect whether other variables are promoted, causing
performance issues. It may be a bug in LSR, but I didn't manage to
reduce it yet. Anyhow, I believe it's in general not worth considering
ephemeral values in LSR.

Reviewers: atrick, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 242011

9 years agoIntrin.h: Don't invade the program's namespace
David Majnemer [Mon, 13 Jul 2015 02:53:23 +0000 (02:53 +0000)]
Intrin.h: Don't invade the program's namespace

The program is permitted to have stuff like '#define x' in it so avoid
using identifiers not reserved for the implementation.

llvm-svn: 242010

9 years agoIntrin.h: Clean up our atomic intrinsics
David Majnemer [Mon, 13 Jul 2015 02:53:19 +0000 (02:53 +0000)]
Intrin.h: Clean up our atomic intrinsics

Three things:
- The atomic intrinsics mandate memory barriers, let's start emitting
  some.
- We don't need to manually create RMW operations, we can just do
  __atomic_fetch_foo instead of performing __atomic_foo_fetch and
  undoing foo.
- Don't use inline assembly, we don't need it for these intrinsics.

This fixes PR24101.

llvm-svn: 242009

9 years ago[InstSimplify] Teach InstSimplify how to simplify extractelement
David Majnemer [Mon, 13 Jul 2015 01:15:53 +0000 (01:15 +0000)]
[InstSimplify] Teach InstSimplify how to simplify extractelement

llvm-svn: 242008

9 years ago[InstSimplify] Teach InstSimplify how to simplify extractvalue
David Majnemer [Mon, 13 Jul 2015 01:15:46 +0000 (01:15 +0000)]
[InstSimplify] Teach InstSimplify how to simplify extractvalue

llvm-svn: 242007

9 years agoMake COFF linker work when it's built by clang again.
Nico Weber [Mon, 13 Jul 2015 00:55:26 +0000 (00:55 +0000)]
Make COFF linker work when it's built by clang again.

clang-cl doesn't compile std::atomic_flag correctly (PR24101).  Since the COFF
linker doesn't use threads yet, just revert r241420 and r241481 for now to
work around this clang-cl bug.

llvm-svn: 242006

9 years agoFix clang/unittests/ASTMatchers/Dynamic/Makefile. clangDynamicASTMatchers should...
NAKAMURA Takumi [Mon, 13 Jul 2015 00:52:19 +0000 (00:52 +0000)]
Fix clang/unittests/ASTMatchers/Dynamic/Makefile. clangDynamicASTMatchers should be linked in advance of clangAST and clangASTMatchers.

llvm-svn: 242005

9 years agoFix lld tests with LLVM_ENABLE_THREADS disabled.
Nico Weber [Mon, 13 Jul 2015 00:51:43 +0000 (00:51 +0000)]
Fix lld tests with LLVM_ENABLE_THREADS disabled.

With LLVM_ENABLE_THREADS disabled, all the llvm code assumes that it runs on
a single thread and doesn't use any mutexes.  lld still spawned lots of threads
in that case and called into llvm, assuming that llvm is thread-safe.

As fix, let lld use only a single thread if LLVM_ENABLE_THREADS is disabled.
I left in all the mutexes in lld. That means lld is a bit slower than
necessary in single-thread mode, but that's probably worth the simpler code.

llvm-svn: 242004

9 years agosanitizer_common: Only use _ReadWriteBarrier when targeting MSVC cl.exe.
Peter Collingbourne [Mon, 13 Jul 2015 00:26:04 +0000 (00:26 +0000)]
sanitizer_common: Only use _ReadWriteBarrier when targeting MSVC cl.exe.

Fixes check-ubsan when self hosting on Windows.

llvm-svn: 242003

9 years agosanitizer_common: Fix implementation of bit count operations on 64-bit Windows.
Peter Collingbourne [Mon, 13 Jul 2015 00:26:03 +0000 (00:26 +0000)]
sanitizer_common: Fix implementation of bit count operations on 64-bit Windows.

llvm-svn: 242002

9 years agoMinor simplification, no functionality change.
Richard Smith [Sun, 12 Jul 2015 23:51:20 +0000 (23:51 +0000)]
Minor simplification, no functionality change.

llvm-svn: 242001

9 years ago[modules] Improve performance when there is a local declaration of an entity
Richard Smith [Sun, 12 Jul 2015 23:43:21 +0000 (23:43 +0000)]
[modules] Improve performance when there is a local declaration of an entity
before the first imported declaration.

We don't need to track all formerly-canonical declarations of an entity; it's sufficient to track those ones for which no other formerly-canonical declaration was imported into the same module. We call those ones "key declarations", and use them as our starting points for collecting redeclarations and performing namespace lookups.

llvm-svn: 241999

9 years ago[Sema] If lvalue to rvalue reference cast is valid don't emit diagnostic.
Davide Italiano [Sun, 12 Jul 2015 22:10:56 +0000 (22:10 +0000)]
[Sema] If lvalue to rvalue reference cast is valid don't emit diagnostic.

In the test, y1 is not reference compatible to y2 and we currently assume
the cast is ill-formed so we emit a diagnostic. Instead, in order to honour
the standard, if y1 it's not reference-compatible to y2 then it can't be
converted using a static_cast, and a reinterpret_cast should be tried instead.
Richard Smith provided the correct interpretation of the standard and
explanation about the subtle difference between "can't be cast" and "the cast
is ill-formed". The former applies in this case.

PR: 23802
llvm-svn: 241998

9 years agoFix PR24099 reported by Tomas Brukner.
Yaron Keren [Sun, 12 Jul 2015 20:40:41 +0000 (20:40 +0000)]
Fix PR24099 reported by Tomas Brukner.

llvm-svn: 241997