platform/upstream/llvm.git
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

8 years agoMove coverage related code into a separate library.
Easwaran Raman [Fri, 29 Apr 2016 18:53:05 +0000 (18:53 +0000)]
Move coverage related code into a separate library.

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

llvm-svn: 268089

8 years ago[libFuzzer] enable detect_leaks=1, add proper docs
Kostya Serebryany [Fri, 29 Apr 2016 18:49:55 +0000 (18:49 +0000)]
[libFuzzer] enable detect_leaks=1, add proper docs

llvm-svn: 268088

8 years ago[MemorySSA] Fix bugs in walker; refactor unittests a bit.
George Burgess IV [Fri, 29 Apr 2016 18:42:55 +0000 (18:42 +0000)]
[MemorySSA] Fix bugs in walker; refactor unittests a bit.

This patch fixes two somewhat related bugs in MemorySSA's caching
walker. These bugs were found because D19695 brought up the problem
that we'd have defs cached to themselves, which is incorrect.

The bugs this fixes are:

- We would sometimes skip the nearest clobber of a MemoryAccess, because
  we would query our cache for a given potential clobber before
  checking if the potential clobber is the clobber we're looking for.
  The cache entry for the potential clobber would point to the nearest
  clobber *of the potential clobber*, so if that was a cache hit, we'd
  ignore the potential clobber entirely.

- There are times (sometimes in DFS, sometimes in the getClobbering...
  functions) where we would insert cache entries that say a def
  clobbers itself.

There's a bit of common code between the fixes for the bugs, so they
aren't split out into multiple commits.

This patch also adds a few unit tests, and refactors existing tests a
bit to reduce the duplication of setup code.

llvm-svn: 268087

8 years ago[ValueTracking] matchSelectPattern needs to be more careful around FP
David Majnemer [Fri, 29 Apr 2016 18:40:34 +0000 (18:40 +0000)]
[ValueTracking] matchSelectPattern needs to be more careful around FP

matchSelectPattern attempts to see through casts which mask min/max
patterns from being more obvious.  Under certain circumstances, it would
misidentify a sequence of instructions as a min/max because it assumed
that folding casts would preserve the result.  This is not the case for
floating point <-> integer casts.

This fixes PR27575.

llvm-svn: 268086

8 years ago[MS] Make #pragma pack use PragmaStack<> class.
Denis Zobnin [Fri, 29 Apr 2016 18:17:40 +0000 (18:17 +0000)]
[MS] Make #pragma pack use PragmaStack<> class.

Make implementation of #pragma pack consistent with other "stack" pragmas.
Use PragmaStack<> class instead of old representation of internal stack.
Don't change compiler's behavior.

TODO:
  1. Introduce diagnostics on popping named slots from pragma stacks.

Reviewer: rnk

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

llvm-svn: 268085

8 years agoFix crash in PDB when loading corrupt file.
Zachary Turner [Fri, 29 Apr 2016 18:09:19 +0000 (18:09 +0000)]
Fix crash in PDB when loading corrupt file.

There are probably hundreds of crashers we can find by fuzzing
more.  For now we do the simplest possible validation of the
block size.  Later, more complicated validations can verify that
other fields of the super block such as directory size, number
of blocks, agree with the size of the file etc.

llvm-svn: 268084

8 years ago[fix] Fixed a bug where const this would cause parser errors about $__lldb_expr.
Sean Callanan [Fri, 29 Apr 2016 18:09:03 +0000 (18:09 +0000)]
[fix] Fixed a bug where const this would cause parser errors about $__lldb_expr.

In templated const functions, trying to run an expression would produce the
error

error: out-of-line definition of '$__lldb_expr' does not match any declaration
in 'foo' member declaration does not match because it is const qualified
error: 1 error parsing expression

which is no good.  It turned out we don't actually need to worry about "const,"
we just need to be consistent about the declaration of the expression and the
FunctionDecl we inject into the class for "this."

Also added a test case.

<rdar://problem/24985958>

llvm-svn: 268083

8 years agoFix crash in BuildCXXDefaultInitExpr.
Reid Kleckner [Fri, 29 Apr 2016 18:06:53 +0000 (18:06 +0000)]
Fix crash in BuildCXXDefaultInitExpr.

Fix crash in BuildCXXDefaultInitExpr when member of template class has
same name as the class itself.

Based on patch by Raphael "Teemperor" Isemann!

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

llvm-svn: 268082

8 years ago[Concepts] Pass requires-clause to ActOnTemplateParameterList; NFC
Hubert Tong [Fri, 29 Apr 2016 18:05:37 +0000 (18:05 +0000)]
[Concepts] Pass requires-clause to ActOnTemplateParameterList; NFC

Summary:
Prepare to store requires-clause expression for access via
TemplateParameterList.

Reviewers: aaron.ballman, faisalv, rsmith

Subscribers: cfe-commits, nwilson

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

llvm-svn: 268081

8 years agoFix typo in test.
Rui Ueyama [Fri, 29 Apr 2016 17:58:48 +0000 (17:58 +0000)]
Fix typo in test.

llvm-svn: 268080

8 years agoAdd boost-use-to-string
Piotr Padlewski [Fri, 29 Apr 2016 17:58:29 +0000 (17:58 +0000)]
Add boost-use-to-string

http://reviews.llvm.org/D18136

llvm-svn: 268079

8 years ago[Clang][Darwin] Define __ARM_DWARF_EH__ for WatchABI
Chris Bieneman [Fri, 29 Apr 2016 17:53:00 +0000 (17:53 +0000)]
[Clang][Darwin] Define __ARM_DWARF_EH__ for WatchABI

Summary: The Darwin armv7k ABI uses Dwarf EH, so we need to set the OS define correctly. Without this the gcc_personality fails to build.

Reviewers: t.p.northover

Subscribers: aemerson, cfe-commits, rengolin

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

llvm-svn: 268078

8 years agoBe sure to always increment the Versym pointer.
Rafael Espindola [Fri, 29 Apr 2016 17:46:07 +0000 (17:46 +0000)]
Be sure to always increment the Versym pointer.

It was getting out of sync if we had undefined symbols at the start of
the symbol table.

llvm-svn: 268077

8 years agosmall reformat to test access
Piotr Padlewski [Fri, 29 Apr 2016 17:45:20 +0000 (17:45 +0000)]
small reformat to test access

llvm-svn: 268076

8 years agoImprove test coverage of -Wdouble-promotion
Robert Lougher [Fri, 29 Apr 2016 17:44:29 +0000 (17:44 +0000)]
Improve test coverage of -Wdouble-promotion

This patch adds coverage for additional cases where implicit conversion can
occur (assignment and return).  It also adds tests for some cases where a
warning should occur but none is produced.  These are marked as FIXME.

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

llvm-svn: 268075

8 years agoUse SelectionDAG::getTargetConstant* helper functions. NFC.
Simon Pilgrim [Fri, 29 Apr 2016 17:42:45 +0000 (17:42 +0000)]
Use SelectionDAG::getTargetConstant* helper functions. NFC.

Instead of SelectionDAG::getConstant directly to make it more obvious that we're creating target constants.

llvm-svn: 268074

8 years ago[AMDGPU][llvm-mc] Add some missing testcases to trap.s
Artem Tamazov [Fri, 29 Apr 2016 17:41:44 +0000 (17:41 +0000)]
[AMDGPU][llvm-mc] Add some missing testcases to trap.s

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

llvm-svn: 268073

8 years agoPut PDB parsing code into a pdb namespace.
Zachary Turner [Fri, 29 Apr 2016 17:28:47 +0000 (17:28 +0000)]
Put PDB parsing code into a pdb namespace.

llvm-svn: 268072

8 years agoRefactor the PDB Stream reading interface.
Zachary Turner [Fri, 29 Apr 2016 17:22:58 +0000 (17:22 +0000)]
Refactor the PDB Stream reading interface.

The motivation for this change is that PDB has the notion of
streams and substreams.  Substreams often consist of variable
length structures that are convenient to be able to treat as
guaranteed, contiguous byte arrays, whereas the streams they
are contained in are not necessarily so, as a single stream
could be spread across many discontiguous blocks.

So, when processing data from a substream, we want to be able
to assume that we have a contiguous byte array so that we can
cast pointers to variable length arrays and such.

This leads to the question of how to be able to read the same
data structure from either a stream or a substream using the
same interface, which is where this patch comes in.

We separate out the stream's read state from the underlying
representation, and introduce a `StreamReader` class.  Then
we change the name of `PDBStream` to `MappedBlockStream`, and
introduce a second kind of stream called a `ByteStream` which is
simply a sequence of contiguous bytes.  Finally, we update all
of the std::vectors in `PDBDbiStream` to use `ByteStream` instead
as a proof of concept.

llvm-svn: 268071

8 years agoFix the alignment of the version info.
Rafael Espindola [Fri, 29 Apr 2016 17:19:45 +0000 (17:19 +0000)]
Fix the alignment of the version info.

llvm-svn: 268070

8 years agoDo not read callee name when matching IR to profile as it is not used.
Dehao Chen [Fri, 29 Apr 2016 17:19:10 +0000 (17:19 +0000)]
Do not read callee name when matching IR to profile as it is not used.

Summary: Callee name is not used to identify a callsite now, so do not read it during annotation.

Reviewers: davidxl, dnovillo

Subscribers: dnovillo, danielcdh, llvm-commits

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

llvm-svn: 268069

8 years ago[BasicAA] Treat llvm.assume as not accessing memory in getModRefBehavior(Function)
Geoff Berry [Fri, 29 Apr 2016 17:18:28 +0000 (17:18 +0000)]
[BasicAA] Treat llvm.assume as not accessing memory in getModRefBehavior(Function)

Reviewers: dberlin, chandlerc, hfinkel, reames, sanjoy

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 268068

8 years ago[MBP] Split placement and alignment into two functions. NFC.
Haicheng Wu [Fri, 29 Apr 2016 17:06:44 +0000 (17:06 +0000)]
[MBP] Split placement and alignment into two functions. NFC.

Cut and Paste.

llvm-svn: 268067

8 years agoFixed/Recommitted r267733 "[AMDGPU][llvm-mc] Add support of TTMP quads. Rework M0...
Artem Tamazov [Fri, 29 Apr 2016 17:04:50 +0000 (17:04 +0000)]
Fixed/Recommitted r267733 "[AMDGPU][llvm-mc] Add support of TTMP quads. Rework M0 exclusion for SMRD."

Previously reverted by r267752.

r267733 review:
Differential Revision: http://reviews.llvm.org/D19342

llvm-svn: 268066

8 years agoAdd a Subjects line to NoDebugAttr [NFC].
Paul Robinson [Fri, 29 Apr 2016 17:03:34 +0000 (17:03 +0000)]
Add a Subjects line to NoDebugAttr [NFC].

The 'nodebug' attribute had hand-coded constraints; replace those with
a Subjects line in Attr.td.
Also add a missing test to verify the attribute is okay on an
Objective-C method.

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

llvm-svn: 268065