platform/upstream/llvm.git
8 years agoAdd thread numbers into ASan thread names.
Kuba Brecka [Sun, 1 May 2016 11:23:04 +0000 (11:23 +0000)]
Add thread numbers into ASan thread names.

llvm-svn: 268192

8 years agoFix NetBSD build with CMake 3.5.2
Kamil Rytarowski [Sun, 1 May 2016 10:23:24 +0000 (10:23 +0000)]
Fix NetBSD build with CMake 3.5.2

Summary:
Building HEAD of LLDB fails in linking against DebugInfoPDB. It also prints the following warning:

```
CMake Warning (dev) in source/Plugins/SymbolFile/PDB/CMakeLists.txt:
  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "lldbPluginSymbolFilePDB" has an INTERFACE_LINK_LIBRARIES property.
  This should be preferred as the source of the link interface for this
  library but because CMP0022 is not set CMake is ignoring the property and
  using the link implementation as the link interface instead.

  INTERFACE_LINK_LIBRARIES:

    LLVMDebugInfoPDB

  Link implementation:

    (empty)
```

CMP0022 was introduced in CMake-2.8.11, bump minimal required version from 2.8 to 3.0 to gain more useful features like libexecinfo(3) detection on NetBSD.

Reviewers: emaste, zturner, labath

Subscribers: zturner, lldb-commits, joerg

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

llvm-svn: 268191

8 years agoChange AVX512 braodcastsd/ss patterns interaction with spilling . New implementation...
Igor Breger [Sun, 1 May 2016 08:40:00 +0000 (08:40 +0000)]
Change AVX512 braodcastsd/ss patterns interaction with spilling . New implementation take a scalar register and generate a vector without COPY_TO_REGCLASS (turn it into a VR128 register ) .The issue is that during register allocation we may spill a scalar value using 128-bit loads and stores, wasting cache bandwidth.

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

llvm-svn: 268190

8 years ago[AVX512] Prefer AVX512 VPACK instructions over AVX/AVX2 instructions when VLX and...
Craig Topper [Sun, 1 May 2016 06:52:19 +0000 (06:52 +0000)]
[AVX512] Prefer AVX512 VPACK instructions over AVX/AVX2 instructions when VLX and BWI are supported.

llvm-svn: 268189

8 years ago[AVX512] Add HasVLX to the 128/256-bit versions of VPACKSSDW/USDW/SSWB/USWB and VPMAD...
Craig Topper [Sun, 1 May 2016 06:24:57 +0000 (06:24 +0000)]
[AVX512] Add HasVLX to the 128/256-bit versions of VPACKSSDW/USDW/SSWB/USWB and VPMADDUBSW/VPMADDWD.

llvm-svn: 268188

8 years agoShould fix all remaining MSVC problems.
Peter Collingbourne [Sun, 1 May 2016 06:00:09 +0000 (06:00 +0000)]
Should fix all remaining MSVC problems.

llvm-svn: 268187

8 years ago[AVX512] Make sure 128/256-bit DQI versions of VAND/VANDN/VOR/VXOR are also marked...
Craig Topper [Sun, 1 May 2016 05:57:06 +0000 (05:57 +0000)]
[AVX512] Make sure 128/256-bit DQI versions of VAND/VANDN/VOR/VXOR are also marked as requiring VLX.

llvm-svn: 268186

8 years agoFurther MSVC appeasement.
Peter Collingbourne [Sun, 1 May 2016 05:39:02 +0000 (05:39 +0000)]
Further MSVC appeasement.

llvm-svn: 268185

8 years ago[X86] Add an AddedComplexity to another pattern to put it near similar in the output...
Craig Topper [Sun, 1 May 2016 05:22:15 +0000 (05:22 +0000)]
[X86] Add an AddedComplexity to another pattern to put it near similar in the output file.

llvm-svn: 268184

8 years ago[X86] Remove a seemlingly unused pattern. The same pattern appears elsewhere with...
Craig Topper [Sun, 1 May 2016 05:22:13 +0000 (05:22 +0000)]
[X86] Remove a seemlingly unused pattern. The same pattern appears elsewhere with an AddedComplexity that made this unreachable.

llvm-svn: 268183

8 years agoTry to fix MSVC build.
Peter Collingbourne [Sun, 1 May 2016 05:12:13 +0000 (05:12 +0000)]
Try to fix MSVC build.

llvm-svn: 268182

8 years ago[X86] Add AddedComplexity to keep some similar patterns near each other in the output...
Craig Topper [Sun, 1 May 2016 04:59:49 +0000 (04:59 +0000)]
[X86] Add AddedComplexity to keep some similar patterns near each other in the output file.

llvm-svn: 268181

8 years ago[X86] Remove some redundant selection patterns.
Craig Topper [Sun, 1 May 2016 04:59:46 +0000 (04:59 +0000)]
[X86] Remove some redundant selection patterns.

llvm-svn: 268180

8 years ago[AVX512] Replace vector_extract with extractelt in some patterns. They mean the same...
Craig Topper [Sun, 1 May 2016 04:59:44 +0000 (04:59 +0000)]
[AVX512] Replace vector_extract with extractelt in some patterns. They mean the same thing but vector_extract is deprecated. NFC

llvm-svn: 268179

8 years agoELF: New symbol table design.
Peter Collingbourne [Sun, 1 May 2016 04:55:03 +0000 (04:55 +0000)]
ELF: New symbol table design.

This patch implements a new design for the symbol table that stores
SymbolBodies within a memory region of the Symbol object. Symbols are mutated
by constructing SymbolBodies in place over existing SymbolBodies, rather
than by mutating pointers. As mentioned in the initial proposal [1], this
memory layout helps reduce the cache miss rate by improving memory locality.

Performance numbers:

           old(s) new(s)
Without debug info:
chrome      7.178  6.432 (-11.5%)
LLVMgold.so 0.505  0.502 (-0.5%)
clang       0.954  0.827 (-15.4%)
llvm-as     0.052  0.045 (-15.5%)
With debug info:
scylla      5.695  5.613 (-1.5%)
clang      14.396 14.143 (-1.8%)

Performance counter results show that the fewer required indirections is
indeed the cause of the improved performance. For example, when linking
chrome, stalled cycles decreases from 14,556,444,002 to 12,959,238,310, and
instructions per cycle increases from 0.78 to 0.83. We are also executing
many fewer instructions (15,516,401,933 down to 15,002,434,310), probably
because we spend less time allocating SymbolBodies.

The new mechanism by which symbols are added to the symbol table is by calling
add* functions on the SymbolTable.

In this patch, I handle local symbols by storing them inside "unparented"
SymbolBodies. This is suboptimal, but if we do want to try to avoid allocating
these SymbolBodies, we can probably do that separately.

I also removed a few members from the SymbolBody class that were only being
used to pass information from the input file to the symbol table.

This patch implements the new design for the ELF linker only. I intend to
prepare a similar patch for the COFF linker.

[1] http://lists.llvm.org/pipermail/llvm-dev/2016-April/098832.html

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

llvm-svn: 268178

8 years ago[SCEV] When printing via -analysis, dump loop disposition
Sanjoy Das [Sun, 1 May 2016 04:51:05 +0000 (04:51 +0000)]
[SCEV] When printing via -analysis, dump loop disposition

There are currently some bugs in tree around SCEV caching an incorrect
loop disposition.  Printing out loop dispositions will let us write
whitebox tests as those are fixed.

The dispositions are printed as a list in "inside out" order,
i.e. innermost loop first.

llvm-svn: 268177

8 years agoProperly name LLVMSetIsInBounds's argument. NFC
Amaury Sechet [Sun, 1 May 2016 02:23:14 +0000 (02:23 +0000)]
Properly name LLVMSetIsInBounds's argument. NFC

llvm-svn: 268176

8 years agoCapitalize align argument in the C API as per convention. NFC
Amaury Sechet [Sun, 1 May 2016 01:42:34 +0000 (01:42 +0000)]
Capitalize align argument in the C API as per convention. NFC

llvm-svn: 268175

8 years ago[AVX512] Add hasSideEffects/mayLoad/mayStore flags to some instructions.
Craig Topper [Sun, 1 May 2016 01:03:56 +0000 (01:03 +0000)]
[AVX512] Add hasSideEffects/mayLoad/mayStore flags to some instructions.

llvm-svn: 268174

8 years ago[ORC] Save AArch64 NEON state in the JIT reentry block.
Lang Hames [Sun, 1 May 2016 00:14:45 +0000 (00:14 +0000)]
[ORC] Save AArch64 NEON state in the JIT reentry block.

The earlier version of the resolver code did not save NEON state, so it would
have broken any callees that used floating point.

llvm-svn: 268173

8 years agoELF: --reproduce: quote pathnames for -L and other options.
Rui Ueyama [Sat, 30 Apr 2016 22:46:47 +0000 (22:46 +0000)]
ELF: --reproduce: quote pathnames for -L and other options.

Previously, arguments for options that take pathnames were not rewritten.

llvm-svn: 268172

8 years agoELF: --reproduce: Copy files referenced by linker scripts.
Rui Ueyama [Sat, 30 Apr 2016 22:23:29 +0000 (22:23 +0000)]
ELF: --reproduce: Copy files referenced by linker scripts.

Previuosly, only files appeared on the command line were copied.

llvm-svn: 268171

8 years agoAttempt to fix Windows buildbots.
Rui Ueyama [Sat, 30 Apr 2016 22:20:27 +0000 (22:20 +0000)]
Attempt to fix Windows buildbots.

llvm-svn: 268170

8 years agoELF: Make --reproduce to produce a response file.
Rui Ueyama [Sat, 30 Apr 2016 21:40:04 +0000 (21:40 +0000)]
ELF: Make --reproduce to produce a response file.

The aim of this patch is to make it easy to re-run the command without
updating paths in the command line. Here is a use case.

Assume that Alice is having an issue with lld and is reporting the issue
to developer Bob. Alice's current directly is /home/alice/work and her
command line is "ld.lld -o foo foo.o ../bar.o". She adds "--reproduce repro"
to the command line and re-run. Then the following text will be produced as
response.txt (notice that the paths are rewritten so that they are
relative to /home/alice/work/repro.)

  -o home/alice/work/foo home/alice/work/foo.o home/alice/bar.o

The command also produces the following files by copying inputs.

  /home/alice/repro/home/alice/work/foo.o
  /home/alice/repro/home/alice/bar.o

Alice zips the directory and send it to Bob. Bob get an archive from Alice
and extract it to his home directory as /home/bob/repro. Now his directory
have the following files.

  /home/bob/repro/response.txt
  /home/bob/repro/home/alice/work/foo.o
  /home/bob/repro/home/alice/bar.o

Bob then re-run the command with these files by the following commands.

  cd /home/bob/repro
  ld.lld @response.txt

This command will run the linker with the same command line options and
the same input files as Alice's, so it is very likely that Bob will see
the same issue as Alice saw.

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

llvm-svn: 268169

8 years ago[lit] Add %:[STpst] to represent paths without colons on Windows.
Rui Ueyama [Sat, 30 Apr 2016 21:32:12 +0000 (21:32 +0000)]
[lit] Add %:[STpst] to represent paths without colons on Windows.

Summary:
We need these variables to concatenate two absolute paths to construct
a valid path. Currently, %t\%t is, for example, expanded to C:\foo\C:\foo,
which is not a valid path because ":" is not a valid path character
on Windows. With this patch, %t will be expanded to C\foo.

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

llvm-svn: 268168

8 years agopython: add bindings for children of diagnostics
Saleem Abdulrasool [Sat, 30 Apr 2016 21:14:01 +0000 (21:14 +0000)]
python: add bindings for children of diagnostics

This exposes the Clang API bindings clang_getChildDiagnostics (which returns a
CXDiagnosticSet) and clang_getNumDiagnosticsInSet / clang_getDiagnosticInSet (to
traverse the CXDiagnosticSet), and adds a helper children property in the Python
Diagnostic wrapper.

Also, this adds the missing OVERLOAD_CANDIDATE (700) cursor type.

Patch by Hanson Wang!

llvm-svn: 268167

8 years ago[InstCombine][AVX2] Added VPERMD/VPERMPS shuffle combining placeholder tests.
Simon Pilgrim [Sat, 30 Apr 2016 20:41:52 +0000 (20:41 +0000)]
[InstCombine][AVX2] Added VPERMD/VPERMPS shuffle combining placeholder tests.

For future support for VPERMD/VPERMPS to generic shuffles combines

llvm-svn: 268166

8 years agoCodeGen: convert to range based loops
Saleem Abdulrasool [Sat, 30 Apr 2016 18:15:34 +0000 (18:15 +0000)]
CodeGen: convert to range based loops

Convert to using some range based loops, avoid unnecessary variables for
unchecked casts.  NFC.

llvm-svn: 268165

8 years ago[X86] Reduce memory usage of MemOp2RegOp and RegOp2MemOp folding maps.
Craig Topper [Sat, 30 Apr 2016 17:59:49 +0000 (17:59 +0000)]
[X86] Reduce memory usage of MemOp2RegOp and RegOp2MemOp folding maps.

llvm-svn: 268164

8 years agoAdd missing override.
Rafael Espindola [Sat, 30 Apr 2016 15:18:21 +0000 (15:18 +0000)]
Add missing override.

llvm-svn: 268163

8 years ago[ASan] Add shadow offset for SystemZ.
Marcin Koscielnicki [Sat, 30 Apr 2016 10:02:12 +0000 (10:02 +0000)]
[ASan] Add shadow offset for SystemZ.

This is the compiler-rt counterpart to D19650.

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

llvm-svn: 268162

8 years ago[ASan] Add shadow offset for SystemZ.
Marcin Koscielnicki [Sat, 30 Apr 2016 09:57:34 +0000 (09:57 +0000)]
[ASan] Add shadow offset for SystemZ.

SystemZ on Linux currently has 53-bit address space.  In theory, the hardware
could support a full 64-bit address space, but that's not supported due to
kernel limitations (it'd require 5-level page tables), and there are no plans
for that.  The default process layout stays within first 4TB of address space
(to avoid creating 4-level page tables), so any offset >= (1 << 42) is fine.
Let's use 1 << 52 here, ie. exactly half the address space.

I've originally used 7 << 50 (uses top 1/8th of the address space), but ASan
runtime assumes there's some space after the shadow area.  While this is
fixable, it's simpler to avoid the issue entirely.

Also, I've originally wanted to have the shadow aligned to 1/8th the address
space, so that we can use OR like X86 to assemble the offset.  I no longer
think it's a good idea, since using ADD enables us to load the constant just
once and use it with register + register indexed addressing.

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

llvm-svn: 268161

8 years agoFinally fix invalid-pointer-pairs.cc. This time the demangle on the Windows buildbot.
Filipe Cabecinhas [Sat, 30 Apr 2016 08:34:40 +0000 (08:34 +0000)]
Finally fix invalid-pointer-pairs.cc. This time the demangle on the Windows buildbot.

llvm-svn: 268160

8 years ago[InstCombine][AVX] Split off VPERMILVAR tests and added additional tests for UNDEF...
Simon Pilgrim [Sat, 30 Apr 2016 07:32:19 +0000 (07:32 +0000)]
[InstCombine][AVX] Split off VPERMILVAR tests and added additional tests for UNDEF mask elements

llvm-svn: 268159

8 years ago[InstCombine][AVX] VPERMILVAR to shuffle combine to use general aggregate elements...
Simon Pilgrim [Sat, 30 Apr 2016 07:23:30 +0000 (07:23 +0000)]
[InstCombine][AVX] VPERMILVAR to shuffle combine to use general aggregate elements. NFCI.

Make use of Constant::getAggregateElement instead of checking constant types - first step towards adding support for UNDEF mask elements.

llvm-svn: 268158

8 years ago[tsan] Return 0 from malloc_size for non-malloc'd pointers
Kuba Brecka [Sat, 30 Apr 2016 07:14:41 +0000 (07:14 +0000)]
[tsan] Return 0 from malloc_size for non-malloc'd pointers

In http://reviews.llvm.org/D19100, I introduced a bug: On OS X, existing programs rely on malloc_size() to detect whether a pointer comes from heap memory (malloc_size returns non-zero) or not. We have to distinguish between a zero-sized allocation (where we need to return 1 from malloc_size, due to other binary compatibility reasons, see http://reviews.llvm.org/D19100), and pointers that are not returned from malloc at all.

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

llvm-svn: 268157

8 years agoStab in the dark to fix the PS4 bot
Chris Bieneman [Sat, 30 Apr 2016 05:27:17 +0000 (05:27 +0000)]
Stab in the dark to fix the PS4 bot

r268127 is causing the PS4 bots to fail. Not sure what is causing it, but hopefully this will fix it.

llvm-svn: 268156

8 years agoDifferential Revision: http://reviews.llvm.org/D19753
Sriraman Tallam [Sat, 30 Apr 2016 04:18:52 +0000 (04:18 +0000)]
Differential Revision: reviews.llvm.org/D19753

Delete Target Option PositionIndependentExecutable as PIE is now part of module flags.

llvm-svn: 268155

8 years agoAMDGPU/SI: Remove wait state handling for SMRD in SIInsertWaits
Tom Stellard [Sat, 30 Apr 2016 04:04:48 +0000 (04:04 +0000)]
AMDGPU/SI: Remove wait state handling for SMRD in SIInsertWaits

This was supposed to be part of r268143.

llvm-svn: 268154

8 years agoReplace one more occurrence of non-standard std:launch::any. Patch from STL@microsoft.com
Eric Fiselier [Sat, 30 Apr 2016 02:30:18 +0000 (02:30 +0000)]
Replace one more occurrence of non-standard std:launch::any. Patch from STL@microsoft.com

llvm-svn: 268153

8 years ago[PowerPC/QPX] Fix the load/splat peephole with overlapping reads
Hal Finkel [Sat, 30 Apr 2016 01:59:28 +0000 (01:59 +0000)]
[PowerPC/QPX] Fix the load/splat peephole with overlapping reads

If, in between the splat and the load (which does an implicit splat), there is
a read of the splat register, then that register must have another earlier
definition. In that case, we can't replace the load's destination register with
the splat's destination register.

Unfortunately, I don't have a small or non-fragile test case.

llvm-svn: 268152

8 years agoReverting 268055 as it caused PR27579.
Amjad Aboud [Sat, 30 Apr 2016 01:44:38 +0000 (01:44 +0000)]
Reverting 268055 as it caused PR27579.

llvm-svn: 268151

8 years agoReverting 268054 & 268063 as they caused PR27579.
Amjad Aboud [Sat, 30 Apr 2016 01:44:07 +0000 (01:44 +0000)]
Reverting 268054 & 268063 as they caused PR27579.

llvm-svn: 268150

8 years agoDon't create dynamic relocations to ro segments.
Rafael Espindola [Sat, 30 Apr 2016 01:15:17 +0000 (01:15 +0000)]
Don't create dynamic relocations to ro segments.

These would just crash at runtime.

If we ever decide to support rw text segments this should make it easier
to implement as there is now a single point where we notice the problem.

I have tested this with a freebsd buildworld. It found a non pic
assembly file being linked into a .so,. With that fixed, buildworld
finished.

llvm-svn: 268149

8 years ago[LowerGuardIntrinsics] Keep track of !make.implicit metadata
Sanjoy Das [Sat, 30 Apr 2016 00:55:59 +0000 (00:55 +0000)]
[LowerGuardIntrinsics] Keep track of !make.implicit metadata

If a guard call being lowered by LowerGuardIntrinsics has the
`!make.implicit` metadata attached, then reattach the metadata to the
branch in the resulting expanded form of the intrinsic.  This allows us
to implement null checks as guards and still get the benefit of implicit
null checks.

llvm-svn: 268148

8 years ago Reroll loops with multiple IV and negative step part 3
Lawrence Hu [Sat, 30 Apr 2016 00:51:22 +0000 (00:51 +0000)]
Reroll loops with multiple IV and negative step part 3
            support multiple induction variables

    This patch enable loop reroll for the following case:
        for(int i=0;  i<N; i += 2) {
           S += *a++;
           S += *a++;
        };

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

llvm-svn: 268147

8 years ago[Orc] Fix the AArch64 resolver size.
Lang Hames [Sat, 30 Apr 2016 00:50:26 +0000 (00:50 +0000)]
[Orc] Fix the AArch64 resolver size.

llvm-svn: 268146

8 years agoDon't depend on lld creating relocations in ro segments.
Rafael Espindola [Sat, 30 Apr 2016 00:49:10 +0000 (00:49 +0000)]
Don't depend on lld creating relocations in ro segments.

We currently don't do a good job of diagnosing inputs that would require
dynamic relocations to be applied to read only segments.

I am about to improve lld in that area, but unfortunately we developed
tests that depend on the current behavior.

To make clear what is actually changing, this first patch just updates
tests to not depend on the current behavior. In most cases this just
means using a rw section instead of a ro one, but that unfortunately
changes many addresses.

llvm-svn: 268145

8 years agoFix a typo (NFC)
Vedant Kumar [Sat, 30 Apr 2016 00:32:54 +0000 (00:32 +0000)]
Fix a typo (NFC)

llvm-svn: 268144

8 years agoAMDGPU/SI: Enable the post-ra scheduler
Tom Stellard [Sat, 30 Apr 2016 00:23:06 +0000 (00:23 +0000)]
AMDGPU/SI: Enable the post-ra scheduler

Summary:
This includes a hazard recognizer implementation to replace some of
the hazard handling we had during frame index elimination.

Reviewers: arsenm

Subscribers: qcolombet, arsenm, llvm-commits

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

llvm-svn: 268143

8 years ago[LowerGuardIntrinsics] Preserve calling conv when lowering
Sanjoy Das [Sat, 30 Apr 2016 00:17:47 +0000 (00:17 +0000)]
[LowerGuardIntrinsics] Preserve calling conv when lowering

llvm-svn: 268142

8 years agoadd minimal test to show dropped metadata
Sanjay Patel [Sat, 30 Apr 2016 00:12:54 +0000 (00:12 +0000)]
add minimal test to show dropped metadata

llvm-svn: 268141

8 years ago[Release Notes] Mention Clang-tidy cert-err34-c check.
Eugene Zelenko [Sat, 30 Apr 2016 00:11:10 +0000 (00:11 +0000)]
[Release Notes] Mention Clang-tidy cert-err34-c check.

Fix order and style of Boost related notes.

llvm-svn: 268140

8 years agoremove the metadata added with r267827
Sanjay Patel [Sat, 30 Apr 2016 00:02:36 +0000 (00:02 +0000)]
remove the metadata added with r267827

We can demonstrate the 'select' bug and fix with a simpler test case.
The merged weight values are already tested in another test.

llvm-svn: 268139

8 years agoFix test's memory leaks.
Filipe Cabecinhas [Fri, 29 Apr 2016 23:42:34 +0000 (23:42 +0000)]
Fix test's memory leaks.

llvm-svn: 268138

8 years agoDelete store to Target option PositionIndependentExecutable as PIE is now set in...
Sriraman Tallam [Fri, 29 Apr 2016 23:38:53 +0000 (23:38 +0000)]
Delete store to Target option PositionIndependentExecutable as PIE is now set in module flags.

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

llvm-svn: 268137

8 years agoDocument how to recreate a binary.
Rafael Espindola [Fri, 29 Apr 2016 23:35:49 +0000 (23:35 +0000)]
Document how to recreate a binary.

llvm-svn: 268136

8 years agoFix TestEnumTypes.py for 32 bit platforms.
Chaoren Lin [Fri, 29 Apr 2016 23:34:44 +0000 (23:34 +0000)]
Fix TestEnumTypes.py for 32 bit platforms.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 268135

8 years agoDocument how to recreate a binary.
Rafael Espindola [Fri, 29 Apr 2016 23:28:36 +0000 (23:28 +0000)]
Document how to recreate a binary.

llvm-svn: 268134

8 years agoUse simpler types. NFC.
Rafael Espindola [Fri, 29 Apr 2016 23:20:30 +0000 (23:20 +0000)]
Use simpler types. NFC.

llvm-svn: 268133

8 years ago[CUDA] Copy host builtin types to NVPTXTargetInfo.
Justin Lebar [Fri, 29 Apr 2016 23:05:19 +0000 (23:05 +0000)]
[CUDA] Copy host builtin types to NVPTXTargetInfo.

Summary:
Host and device types must match, otherwise when we pass values back and
forth between the host and device, we will get the wrong result.

This patch makes NVPTXTargetInfo inherit most of its type information
from the host's target info.

Reviewers: rsmith

Subscribers: cfe-commits, jhen, tra

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

llvm-svn: 268131

8 years agoReapply r268107 after fixing a bug breaks debug build.
Xinliang David Li [Fri, 29 Apr 2016 22:59:36 +0000 (22:59 +0000)]
Reapply r268107 after fixing a bug breaks debug build.

Makes the new method to set data needed by debug dump.

llvm-svn: 268130

8 years ago[NFC] Initialize a variable to make buildbot green.
Denis Zobnin [Fri, 29 Apr 2016 22:50:16 +0000 (22:50 +0000)]
[NFC] Initialize a variable to make buildbot green.

In r268085 "[MS] Make #pragma pack use PragmaStack<> class." there was an
uninitialized variable 'Alignment', which caused the following failure:
  http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/1758
Zero-initialize the variable to fix this failure.

llvm-svn: 268129

8 years agoFix test case for incompatible sysroot warning
Chris Bieneman [Fri, 29 Apr 2016 22:44:33 +0000 (22:44 +0000)]
Fix test case for incompatible sysroot warning

r268127 broke some bots because it needs to specify a darwin target.

llvm-svn: 268128

8 years agoAdd a new warning to notify users of mismatched SDK and deployment target
Chris Bieneman [Fri, 29 Apr 2016 22:28:34 +0000 (22:28 +0000)]
Add a new warning to notify users of mismatched SDK and deployment target

Summary:
This patch adds a new driver warning -Wincompatible-sdk which notifies the user when they are mismatching the version min options and the sysroot.

The patch works by checking the sysroot (if present) for an SDK name, then matching that against the target platform. In the case of a mismatch it logs a warning.

Reviewers: bob.wilson, rsmith

Subscribers: rsmith, edward-san, cfe-commits

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

llvm-svn: 268127

8 years agoMark guards on true as "trivially dead"
Sanjoy Das [Fri, 29 Apr 2016 22:23:16 +0000 (22:23 +0000)]
Mark guards on true as "trivially dead"

This moves some logic added to EarlyCSE in rL268120 into
`llvm::isInstructionTriviallyDead`.  Adds a test case for DCE to
demonstrate that passes other than EarlyCSE can now pick up on the new
information.

llvm-svn: 268126

8 years ago[CMake] [Xcode] Improving Xcode toolchain generation to support distribution targets
Chris Bieneman [Fri, 29 Apr 2016 22:19:35 +0000 (22:19 +0000)]
[CMake] [Xcode] Improving Xcode toolchain generation to support distribution targets

This adds a new target `install-distribution-toolchain` which will install an Xcode toolchain featuring just the LLVM components specified in LLVM_DISTRIBUTION_COMPONENTS.

llvm-svn: 268125

8 years ago[CMake] Create a separate install target for libcxx headers
Chris Bieneman [Fri, 29 Apr 2016 22:17:15 +0000 (22:17 +0000)]
[CMake] Create a separate install target for libcxx headers

This change doesn't impact the behavior of the install-libcxx target which installs whichever libcxx components you build, it just adds a separate target to just install the headers.

llvm-svn: 268124

8 years agoclean up documentation comments; NFC
Sanjay Patel [Fri, 29 Apr 2016 22:03:27 +0000 (22:03 +0000)]
clean up documentation comments; NFC

llvm-svn: 268122

8 years ago[MBP] Use Function::optForSize() instead of checking OptimizeForSize directly.
Haicheng Wu [Fri, 29 Apr 2016 22:01:10 +0000 (22:01 +0000)]
[MBP] Use Function::optForSize() instead of checking OptimizeForSize directly.

Fix a FIXME.  Disable loop alignment if compiled with -Oz now.

llvm-svn: 268121

8 years ago[EarlyCSE] Simplify guard intrinsics
Sanjoy Das [Fri, 29 Apr 2016 21:52:58 +0000 (21:52 +0000)]
[EarlyCSE] Simplify guard intrinsics

Summary:
This change teaches EarlyCSE some basic properties of guard intrinsics:

 - Guard intrinsics read all memory, but don't write to any memory
 - After a guard has executed, the condition it was guarding on can be
   assumed to be true
 - Guard intrinsics on a constant `true` are no-ops

Reviewers: reames, hfinkel

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 268120

8 years agoAMDGPU: Fix crash with unreachable terminators.
Matt Arsenault [Fri, 29 Apr 2016 21:52:13 +0000 (21:52 +0000)]
AMDGPU: Fix crash with unreachable terminators.

If a block has no successors because it ends in unreachable,
this was accessing an invalid iterator.

Also stop counting instructions that don't emit any
real instructions.

llvm-svn: 268119

8 years ago[ELF] Ignore -d option (and aliases).
Davide Italiano [Fri, 29 Apr 2016 21:44:02 +0000 (21:44 +0000)]
[ELF] Ignore -d option (and aliases).

The linker already allocates common symbols by default.
Discussed with Rafael.

llvm-svn: 268117

8 years agoRevert r268107 -- debug build failure
Xinliang David Li [Fri, 29 Apr 2016 21:43:28 +0000 (21:43 +0000)]
Revert r268107 -- debug build failure

llvm-svn: 268116

8 years ago[InstCombine][SSE] PSHUFB to shuffle combine to use general aggregate elements. NFCI.
Simon Pilgrim [Fri, 29 Apr 2016 21:34:54 +0000 (21:34 +0000)]
[InstCombine][SSE] PSHUFB to shuffle combine to use general aggregate elements. NFCI.

Make use of Constant::getAggregateElement instead of checking constant types - first step towards adding support for UNDEF mask elements.

llvm-svn: 268115

8 years agoTry to fix clang-cmake-aarch64-42vma by removing a memory leak (have a global var...
Filipe Cabecinhas [Fri, 29 Apr 2016 21:33:12 +0000 (21:33 +0000)]
Try to fix clang-cmake-aarch64-42vma by removing a memory leak (have a global var capture it).

llvm-svn: 268114

8 years ago[Sema] Specify the underlying type for an enum. NFC.
George Burgess IV [Fri, 29 Apr 2016 21:32:53 +0000 (21:32 +0000)]
[Sema] Specify the underlying type for an enum. NFC.

llvm-svn: 268113

8 years ago[Orc] Add ORC lazy-compilation support for AArch64.
Lang Hames [Fri, 29 Apr 2016 21:32:00 +0000 (21:32 +0000)]
[Orc] Add ORC lazy-compilation support for AArch64.

The ORC compile callbacks and indirect stubs APIs will now work for AArc64,
allowing functions to be lazily compiled and/or updated.

llvm-svn: 268112

8 years ago[Orc] Make sure we don't drop the internal error in OrcRemoteTargetClient when
Lang Hames [Fri, 29 Apr 2016 21:29:48 +0000 (21:29 +0000)]
[Orc] Make sure we don't drop the internal error in OrcRemoteTargetClient when
the constructor fails, as this would lead to an 'unchecked error' crash.

llvm-svn: 268111

8 years agoWatch out for compilers that generate bad bitfield info. If the bit size of a bitfiel...
Greg Clayton [Fri, 29 Apr 2016 21:26:46 +0000 (21:26 +0000)]
Watch out for compilers that generate bad bitfield info. If the bit size of a bitfield member doesn't lie within the bit bounds of the type itself, just leave it out so we don't get clang asserting and killing our IDE when it gets unhappy with the information.

https://llvm.org/bugs/show_bug.cgi?id=27515
<rdar://problem/21082998>

llvm-svn: 268110

8 years ago[Docs] Refer to the CMakePrimer from CMake doc
Chris Bieneman [Fri, 29 Apr 2016 21:23:24 +0000 (21:23 +0000)]
[Docs] Refer to the CMakePrimer from CMake doc

The "Building LLVM with CMake" document should have a reference to the CMakePrimer.

llvm-svn: 268109

8 years ago[ValueTracking] Make the code in lookThroughCast
David Majnemer [Fri, 29 Apr 2016 21:22:04 +0000 (21:22 +0000)]
[ValueTracking] Make the code in lookThroughCast

No functionality change is intended.

llvm-svn: 268108

8 years ago[inliner]: Refactor inline deferring logic into its own method /NFC
Xinliang David Li [Fri, 29 Apr 2016 21:21:44 +0000 (21:21 +0000)]
[inliner]: Refactor inline deferring logic into its own method /NFC

The implemented heuristic has a large body of code which better sits
in its own function for better readability. It also allows adding more
heuristics easier in the future.

llvm-svn: 268107

8 years agoDifferential Revision: http://reviews.llvm.org/D19733
Sriraman Tallam [Fri, 29 Apr 2016 21:19:16 +0000 (21:19 +0000)]
Differential Revision: reviews.llvm.org/D19733

llvm-svn: 268106

8 years agoAMDGPU: Add kernarg.segment.ptr intrinsic
Matt Arsenault [Fri, 29 Apr 2016 21:16:52 +0000 (21:16 +0000)]
AMDGPU: Add kernarg.segment.ptr intrinsic

llvm-svn: 268105

8 years ago[InstCombine] Determine the result of a select based on a dominating condition.
Chad Rosier [Fri, 29 Apr 2016 21:12:31 +0000 (21:12 +0000)]
[InstCombine] Determine the result of a select based on a dominating condition.

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

llvm-svn: 268104

8 years agoAdd the ability to determine whether a format string argument is of a double type...
Aaron Ballman [Fri, 29 Apr 2016 21:05:55 +0000 (21:05 +0000)]
Add the ability to determine whether a format string argument is of a double type or not. This change is tested by clang-tidy in r268100.

llvm-svn: 268103

8 years agoFix comment
Matt Arsenault [Fri, 29 Apr 2016 21:02:04 +0000 (21:02 +0000)]
Fix comment

llvm-svn: 268102

8 years agoFix TestGetVariables.py so it works correctly. We had duplicate static values showing...
Greg Clayton [Fri, 29 Apr 2016 21:00:38 +0000 (21:00 +0000)]
Fix TestGetVariables.py so it works correctly. We had duplicate static values showing up as we would find static variables in the Block and also in the compile unit. We now make sure a variable hasn't been added to the list before we add it.

llvm-svn: 268101

8 years agoAdd a clang-tidy check that flags string-to-number conversion functions that have...
Aaron Ballman [Fri, 29 Apr 2016 20:56:48 +0000 (20:56 +0000)]
Add a clang-tidy check that flags string-to-number conversion functions that have insufficient error checking, suggesting a better alternative.

This check corresponds to: https://www.securecoding.cert.org/confluence/display/c/ERR34-C.+Detect+errors+when+converting+a+string+to+a+number

llvm-svn: 268100

8 years ago[InstCombine] clean up; NFC
Sanjay Patel [Fri, 29 Apr 2016 20:54:56 +0000 (20:54 +0000)]
[InstCombine] clean up; NFC

llvm-svn: 268099

8 years agoMake sure LLDB can deal with forward declarations to enums without crashing or asserting.
Greg Clayton [Fri, 29 Apr 2016 20:48:39 +0000 (20:48 +0000)]
Make sure LLDB can deal with forward declarations to enums without crashing or asserting.

<rdar://problem/23776428>

llvm-svn: 268098

8 years ago[asan] Assert in __sanitizer_ptr_{sub,cmp} if one of the pointers was freed.
Filipe Cabecinhas [Fri, 29 Apr 2016 20:37:34 +0000 (20:37 +0000)]
[asan] Assert in __sanitizer_ptr_{sub,cmp} if one of the pointers was freed.

Summary:
This (partially) implements the check mentioned at
http://kristerw.blogspot.co.uk/2016/04/dangling-pointers-and-undefined-behavior.html
(via John Regehr)

Quoting:
"That the behavior is undefined follows from C11 6.2.4 "Storage
durations of objects"
  The lifetime of an object is the portion of program execution during
  which storage is guaranteed to be reserved for it. An object exists, has
  a constant address, and retains its last-stored value throughout its
  lifetime. If an object is referred to outside of its lifetime, the
  behavior is undefined. The value of a pointer becomes indeterminate when
  the object it points to (or just past) reaches the end of its lifetime.
and 7.22.3 "Memory management functions" that says that free ends the
lifetime of objects
  The lifetime of an allocated object extends from the allocation until
  the deallocation.
"

We can probably implement this for stack variables too, but I think this
is a good start to see if there's interest in this check.
We can also hide this behind a flag, too.

Reviewers: samsonov, kcc, rsmith, regehr

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 268097

8 years ago[Docs] Add CMake Primer document
Chris Bieneman [Fri, 29 Apr 2016 20:34:54 +0000 (20:34 +0000)]
[Docs] Add CMake Primer document

This document is intended to provide a basic overview of the CMake scripting language for LLVM developers. It was unorthodoxly reviewed for accuracy and content on the CMake developer list:

http://public.kitware.com/pipermail/cmake-developers/2016-April/028300.html

llvm-svn: 268096

8 years agoAMDGPU/SI: Move post regalloc run of SIShrinkInstructions
Matt Arsenault [Fri, 29 Apr 2016 20:23:42 +0000 (20:23 +0000)]
AMDGPU/SI: Move post regalloc run of SIShrinkInstructions

Move to addPreEmitPass. This is so it runs after post-RA
scheduling so we can merge s_nops emitted by the scheduler
and hazard recognizer.

llvm-svn: 268095

8 years agoDAGCombiner: Reduce truncated shl width
Matt Arsenault [Fri, 29 Apr 2016 19:53:16 +0000 (19:53 +0000)]
DAGCombiner: Reduce truncated shl width

llvm-svn: 268094

8 years agoFix some Include What You Use warnings; other minor fixes.
Eugene Zelenko [Fri, 29 Apr 2016 19:47:09 +0000 (19:47 +0000)]
Fix some Include What You Use warnings; other minor fixes.

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

llvm-svn: 268093

8 years ago[libFuzzer] fix docs
Kostya Serebryany [Fri, 29 Apr 2016 19:28:24 +0000 (19:28 +0000)]
[libFuzzer] fix docs

llvm-svn: 268092

8 years agoMethod Pool in modules: we make sure that if a module contains an entry for
Manman Ren [Fri, 29 Apr 2016 19:04:05 +0000 (19:04 +0000)]
Method Pool in modules: we make sure that if a module contains an entry for
a selector, the entry should be complete, containing everything introduced by
that module and all modules it imports.

Before writing out the method pool of a module, we sync up the out of date
selectors by pulling in methods for the selectors, from all modules it imports.

In ReadMethodPool, after pulling in the method pool entry for module A, this
lets us skip the modules that module A imports.

rdar://problem/25900131

llvm-svn: 268091

8 years agoUse the new path for coverage related headers and update CMakeLists.txt
Easwaran Raman [Fri, 29 Apr 2016 18:53:16 +0000 (18:53 +0000)]
Use the new path for coverage related headers and update CMakeLists.txt

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

llvm-svn: 268090