platform/upstream/llvm.git
8 years agoAdd AST Matchers for CXXConstructorDecl::isDelegatingConstructor and CXXMethodDecl...
Alexander Kornienko [Wed, 13 Apr 2016 11:13:08 +0000 (11:13 +0000)]
Add AST Matchers for CXXConstructorDecl::isDelegatingConstructor and CXXMethodDecl::isUserProvided.

Summary: Added two AST matchers: isDelegatingConstructor for CXXConstructorDecl::IsDelegatingConstructor; and isUserProvided corresponding to CXXMethodDecl::isUserProvided.

Reviewers: aaron.ballman, alexfh

Subscribers: klimek, cfe-commits

Patch by Michael Miller!

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

llvm-svn: 266189

8 years ago[Clang][AVX512][Builtin] Adding supporting to intrinsics of cvt{b|d|q}2mask{128|256...
Michael Zuckerman [Wed, 13 Apr 2016 10:49:37 +0000 (10:49 +0000)]
[Clang][AVX512][Builtin] Adding supporting to intrinsics of cvt{b|d|q}2mask{128|256|512} and cvtmask2{b|d|q}{128|256|512} instruction set.

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

llvm-svn: 266188

8 years ago[modules] Add OpenCLImageTypes.def to module map to fix the modules build.
Alexey Bader [Wed, 13 Apr 2016 09:54:47 +0000 (09:54 +0000)]
[modules] Add OpenCLImageTypes.def to module map to fix the modules build.

llvm-svn: 266187

8 years agoEnable support for __float128 in Clang
Nemanja Ivanovic [Wed, 13 Apr 2016 09:49:45 +0000 (09:49 +0000)]
Enable support for __float128 in Clang

This patch corresponds to review:
http://reviews.llvm.org/D15120

It adds support for the __float128 keyword, literals and a target feature to
enable it. This support is disabled by default on all targets and any target
that has support for this type is free to add it.

Based on feedback that I've received from target maintainers, this appears to
be the right thing for most targets. I have not heard from the maintainers of
X86 which I believe supports this type. I will subsequently investigate the
impact of enabling this on X86.

llvm-svn: 266186

8 years agoAdded missing autogeneration note
Simon Pilgrim [Wed, 13 Apr 2016 09:28:44 +0000 (09:28 +0000)]
Added missing autogeneration note

llvm-svn: 266185

8 years agoTry to use readability-identifier-naming check on Clang.
Alexander Kornienko [Wed, 13 Apr 2016 08:59:49 +0000 (08:59 +0000)]
Try to use readability-identifier-naming check on Clang.

llvm-svn: 266184

8 years agoDon't use misc-unused-parameters check on LLVM.
Alexander Kornienko [Wed, 13 Apr 2016 08:58:52 +0000 (08:58 +0000)]
Don't use misc-unused-parameters check on LLVM.

llvm-svn: 266183

8 years ago[clang-tidy] Disable misc-unused-parameters for clang.
Alexander Kornienko [Wed, 13 Apr 2016 08:47:42 +0000 (08:47 +0000)]
[clang-tidy] Disable misc-unused-parameters for clang.

llvm-svn: 266182

8 years ago[clang-tidy] add_new_check.py should fail if check name starts with the module name
Alexander Kornienko [Wed, 13 Apr 2016 08:46:32 +0000 (08:46 +0000)]
[clang-tidy] add_new_check.py should fail if check name starts with the module name

+ updated formatting

llvm-svn: 266181

8 years ago[OpenCL] Move OpenCLImageTypes.def from clangAST to clangBasic library.
Alexey Bader [Wed, 13 Apr 2016 08:33:41 +0000 (08:33 +0000)]
[OpenCL] Move OpenCLImageTypes.def from clangAST to clangBasic library.

Putting OpenCLImageTypes.def to clangAST library violates layering requirement: "It's not OK for a Basic/ header to include an AST/ header".
This fixes the modules build.

Differential revision: http://reviews.llvm.org/D18954
Reviewers: Richard Smith, Vassil Vassilev.

llvm-svn: 266180

8 years ago[mips][microMIPS] Add CodeGen support for DIV, MOD, DIVU, MODU, DDIV, DMOD, DDIVU...
Zlatko Buljan [Wed, 13 Apr 2016 08:02:26 +0000 (08:02 +0000)]
[mips][microMIPS] Add CodeGen support for DIV, MOD, DIVU, MODU, DDIV, DMOD, DDIVU and DMODU instructions
Differential Revision: http://reviews.llvm.org/D17137

This patch was reverted after the revertion of dependant patch http://reviews.llvm.org/D17068.
There was the problem with test-suite failure.
The problem is hopefully solved with dependant patch so this patch is commited again.

llvm-svn: 266179

8 years agoconstexpr -> const to appease MSVC bots.
Richard Smith [Wed, 13 Apr 2016 07:47:38 +0000 (07:47 +0000)]
constexpr -> const to appease MSVC bots.

llvm-svn: 266178

8 years agoASTWriterDecl.cpp: Prune a couple of \param(s), corresponding to r266160. [-Wdocument...
NAKAMURA Takumi [Wed, 13 Apr 2016 07:45:10 +0000 (07:45 +0000)]
ASTWriterDecl.cpp: Prune a couple of \param(s), corresponding to r266160. [-Wdocumentation]

llvm-svn: 266177

8 years ago[modules] Add some missing blockinfo records. No functionality change except to llvm...
Richard Smith [Wed, 13 Apr 2016 07:41:35 +0000 (07:41 +0000)]
[modules] Add some missing blockinfo records. No functionality change except to llvm-bcanalyzer output.

llvm-svn: 266176

8 years ago[InstCombine] We folded an fcmp to an i1 instead of a vector of i1
David Majnemer [Wed, 13 Apr 2016 06:55:52 +0000 (06:55 +0000)]
[InstCombine] We folded an fcmp to an i1 instead of a vector of i1

Remove an ad-hoc transform in InstCombine and replace it with more
general machinery (ValueTracking, InstructionSimplify and VectorUtils).

This fixes PR27332.

llvm-svn: 266175

8 years agoSimplify LTOInternalize into UpdateLLVMCompilerUsed
Mehdi Amini [Wed, 13 Apr 2016 06:32:46 +0000 (06:32 +0000)]
Simplify LTOInternalize into UpdateLLVMCompilerUsed

It is now only doing the update to the llvm.compiler_used global.
The client has to call separately the internalization stage.
Hopefully the code is simpler to understand this way.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266174

8 years agoMinor cleanup in Internalize, hide helper class using anonymous namespace (NFC)
Mehdi Amini [Wed, 13 Apr 2016 06:32:29 +0000 (06:32 +0000)]
Minor cleanup in Internalize, hide helper class using anonymous namespace (NFC)

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266173

8 years agoLTOInternalize: Use a StringSet instead of a sorted vector and a binary search query...
Mehdi Amini [Wed, 13 Apr 2016 06:32:04 +0000 (06:32 +0000)]
LTOInternalize: Use a StringSet instead of a sorted vector and a binary search query for each function

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266172

8 years ago[mips][microMIPS] Fix for "Cannot copy registers" assertion
Hrvoje Varga [Wed, 13 Apr 2016 06:17:21 +0000 (06:17 +0000)]
[mips][microMIPS] Fix for "Cannot copy registers" assertion
Differential Revision: http://reviews.llvm.org/D17068

This changes contains fix for failing test-suite. So, this patch should hopefully work now.

llvm-svn: 266171

8 years agoMove "ExternalSymbols" out of LTOInternalize (NFC)
Mehdi Amini [Wed, 13 Apr 2016 05:36:06 +0000 (05:36 +0000)]
Move "ExternalSymbols" out of LTOInternalize (NFC)

This is not really related to internalization per se.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266170

8 years agoReally return whether Internalize did change the Module or not.
Mehdi Amini [Wed, 13 Apr 2016 05:25:16 +0000 (05:25 +0000)]
Really return whether Internalize did change the Module or not.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266169

8 years agoModernize Internalizer with for-range loop (NFC)
Mehdi Amini [Wed, 13 Apr 2016 05:25:12 +0000 (05:25 +0000)]
Modernize Internalizer with for-range loop (NFC)

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266168

8 years agoRefactor the InternalizePass into a helper class, and expose it through a public...
Mehdi Amini [Wed, 13 Apr 2016 05:25:08 +0000 (05:25 +0000)]
Refactor the InternalizePass into a helper class, and expose it through a public free function (NFC)

There is really no reason to require to instanciate a pass manager to
internalize.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266167

8 years ago[PPC64][VSX] Add a couple of new data types for vec_vsx_ld and vec_vsx_st intrinsics...
Chuang-Yu Cheng [Wed, 13 Apr 2016 05:16:31 +0000 (05:16 +0000)]
[PPC64][VSX] Add a couple of new data types for vec_vsx_ld and vec_vsx_st intrinsics and fix incorrect testcases with minor refactoring

New added data types:
  vector double vec_vsx_ld (int, const double *);
  vector float vec_vsx_ld (int, const float *);
  vector bool short vec_vsx_ld (int, const vector bool short *);
  vector bool int vec_vsx_ld (int, const vector bool int *);
  vector signed int vec_vsx_ld (int, const signed int *);
  vector unsigned int vec_vsx_ld (int, const unsigned int *);

  void vec_vsx_st (vector double, int, double *);
  void vec_vsx_st (vector float, int, float *);
  void vec_vsx_st (vector bool short, int, vector bool short *);
  void vec_vsx_st (vector bool short, int, signed short *);
  void vec_vsx_st (vector bool short, int, unsigned short *);
  void vec_vsx_st (vector bool int, int, vector bool int *);
  void vec_vsx_st (vector bool int, int, signed int *);
  void vec_vsx_st (vector bool int, int, unsigned int *);

Also fix testcases which use non-vector argument version of vec_vsx_ld or
vec_vsx_st, but pass incorrect parameter.

llvm-svn: 266166

8 years agoUpdate Symtab::InitAddressIndexes so that computed symbol sizes
Jason Molenda [Wed, 13 Apr 2016 04:32:49 +0000 (04:32 +0000)]
Update Symtab::InitAddressIndexes so that computed symbol sizes
will not exceed the bounds of their Section.  This is addressing a
problem where a file had a large space between two sections that
were not used by this module - the last symbol in the text section
had an enormous size because the distance between that and the first
symbol in the data section were used to compute the size.

http://reviews.llvm.org/D19004
<rdar://problem/25227945>

llvm-svn: 266165

8 years agoAttempt to fix TestCPPBreakpointLocations on Linux/Android.
Oleksiy Vyalov [Wed, 13 Apr 2016 04:21:05 +0000 (04:21 +0000)]
Attempt to fix TestCPPBreakpointLocations on Linux/Android.

llvm-svn: 266164

8 years agoRefactor Internalization pass to use as a callback instead of a StringSet (NFC)
Mehdi Amini [Wed, 13 Apr 2016 04:20:32 +0000 (04:20 +0000)]
Refactor Internalization pass to use as a callback instead of a StringSet (NFC)

This will save a bunch of copies / initialization of intermediate
datastructure, and (hopefully) simplify the code.

This also abstract the symbol preservation mechanism outside of the
Internalization pass into the client code, which is not forced
to keep a map of strings for instance (ThinLTO will prefere hashes).

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266163

8 years agoRecommit r265547, and r265610,r265639,r265657 on top of it, plus
Wei Mi [Wed, 13 Apr 2016 03:08:27 +0000 (03:08 +0000)]
Recommit r265547, and r265610,r265639,r265657 on top of it, plus
two fixes with one about error verify-regalloc reported, and
another about live range update of phi after rematerialization.

r265547:
Replace analyzeSiblingValues with new algorithm to fix its compile
time issue. The patch is to solve PR17409 and its duplicates.

analyzeSiblingValues is a N x N complexity algorithm where N is
the number of siblings generated by reg splitting. Although it
causes siginificant compile time issue when N is large, it is also
important for performance since it removes redundent spills and
enables rematerialization.

To solve the compile time issue, the patch removes analyzeSiblingValues
and replaces it with lower cost alternatives containing two parts. The
first part creates a new spill hoisting method in postOptimization of
register allocation. It does spill hoisting at once after all the spills
are generated instead of inside every instance of selectOrSplit. The
second part queries the define expr of the original register for
rematerializaiton and keep it always available during register allocation
even if it is already dead. It deletes those dead instructions only in
postOptimization. With the two parts in the patch, it can remove
analyzeSiblingValues without sacrificing performance.

Patches on top of r265547:
r265610 "Fix the compare-clang diff error introduced by r265547."
r265639 "Fix the sanitizer bootstrap error in r265547."
r265657 "InlineSpiller.cpp: Escap \@ in r265547. [-Wdocumentation]"

Differential Revision: http://reviews.llvm.org/D15302
Differential Revision: http://reviews.llvm.org/D18934
Differential Revision: http://reviews.llvm.org/D18935
Differential Revision: http://reviews.llvm.org/D18936

llvm-svn: 266162

8 years agoELF: Do not create relative relocations for undefined symbols.
Peter Collingbourne [Wed, 13 Apr 2016 02:24:48 +0000 (02:24 +0000)]
ELF: Do not create relative relocations for undefined symbols.

We need to ensure that the address of an undefined weak symbol evaluates to
zero. We were getting this right for non-PIC executables (where the symbol
can be evaluated directly) and for DSOs (where we emit a symbolic relocation
for these symbols, as they are preemptible). But we weren't getting it right
for PIEs. Probably the simplest way to ensure that these symbols evaluate
to zero is by not creating a relocation in .got for them.

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

llvm-svn: 266161

8 years ago[modules] Refactor handling of cases where we write an offset to a prior record into...
Richard Smith [Wed, 13 Apr 2016 02:12:03 +0000 (02:12 +0000)]
[modules] Refactor handling of cases where we write an offset to a prior record into the bitstream and simplify a little, in preparation for doing this in more cases.

llvm-svn: 266160

8 years agoFix FunctionImport export list computation: need to take a reference to a map entry...
Mehdi Amini [Wed, 13 Apr 2016 01:52:32 +0000 (01:52 +0000)]
Fix FunctionImport export list computation: need to take a reference to a map entry to actually modify it

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266159

8 years agoChange how we apply relocations.
Rafael Espindola [Wed, 13 Apr 2016 01:40:19 +0000 (01:40 +0000)]
Change how we apply relocations.

With this patch we use the first scan over the relocations to remember
the information we found about them: will them be relaxed, will a plt be
used, etc.

With that the actual relocation application becomes much simpler. That
is particularly true for the interfaces in Target.h.

This unfortunately means that we now do two passes over relocations for
non SHF_ALLOC sections. I think this can be solved by factoring out the
code that scans a single relocation. It can then be used both as a scan
that record info and for a dedicated direct relocation of non SHF_ALLOC
sections.

I also think it is possible to reduce the number of enum values by
representing a target with just an OutputSection and an offset (which
can be from the start or end).

This should unblock adding features like relocation optimizations.

llvm-svn: 266158

8 years ago[analyzer] Nullability: Treat nil _Nonnull ivar as invariant violation.
Devin Coughlin [Wed, 13 Apr 2016 00:41:54 +0000 (00:41 +0000)]
[analyzer] Nullability: Treat nil _Nonnull ivar as invariant violation.

Treat a _Nonnull ivar that is nil as an invariant violation in a similar
fashion to how a nil _Nonnull parameter is treated as a precondition violation.

This avoids warning on defensive returns of nil on defensive internal
checks, such as the following common idiom:

@class InternalImplementation
@interface PublicClass {
  InternalImplementation * _Nonnull _internal;
}
-(id _Nonnull)foo;
@end

@implementation PublicClass
-(id _Nonnull)foo {
  if (!_internal)
    return nil; // no-warning

  return [_internal foo];
}
@end

rdar://problem/24485171

llvm-svn: 266157

8 years agoAMDGPU: Add test for m0 initialization in basic loop
Matt Arsenault [Wed, 13 Apr 2016 00:39:52 +0000 (00:39 +0000)]
AMDGPU: Add test for m0 initialization in basic loop

Initialization of m0 is emitted for each LDS operation, so
every block with LDS usage ends up with one. MachineLICM
used to fail to hoist this out of the loop, so every loop
iteration with LDS usage in it would re-initialize it.

This seems to be fixed now, so add a test to make sure that
it stays this way.

llvm-svn: 266156

8 years agoAMDGPU: Remove leftover ShaderType attributes in tests
Matt Arsenault [Wed, 13 Apr 2016 00:39:48 +0000 (00:39 +0000)]
AMDGPU: Remove leftover ShaderType attributes in tests

llvm-svn: 266155

8 years agoclang/test/Driver/cl-options.c: Fix an expression to recognize dos r'\\'.
NAKAMURA Takumi [Wed, 13 Apr 2016 00:22:25 +0000 (00:22 +0000)]
clang/test/Driver/cl-options.c: Fix an expression to recognize dos r'\\'.

llvm-svn: 266154

8 years agoLTOInternalize: Fix member type, should be a reference and not a copy
Mehdi Amini [Tue, 12 Apr 2016 23:58:30 +0000 (23:58 +0000)]
LTOInternalize: Fix member type, should be a reference and not a copy

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266153

8 years agoAMDGPU/SI: Fix spilling of 96-bit registers
Tom Stellard [Tue, 12 Apr 2016 23:57:30 +0000 (23:57 +0000)]
AMDGPU/SI: Fix spilling of 96-bit registers

Summary:
It seems like this was broken in r252327.  I thought we had test cases
for this, but it's really hard to tirgger spills of this exact register
size since they aren't used very much.

Reviewers: arsenm, nhaehnle

Subscribers: nhaehnle, arsenm, llvm-commits

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

llvm-svn: 266152

8 years agoFix mismatch on returned type between header and implementation for createNameAnonFun...
Mehdi Amini [Tue, 12 Apr 2016 23:25:11 +0000 (23:25 +0000)]
Fix mismatch on returned type between header and implementation for createNameAnonFunctionPass()

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266151

8 years agoCodeGen: Clear the MFI's save and restore point after PrologEpilogInserter
Justin Bogner [Tue, 12 Apr 2016 23:21:53 +0000 (23:21 +0000)]
CodeGen: Clear the MFI's save and restore point after PrologEpilogInserter

This state is no longer useful and not guaranteed to be valid in later
codegen passes. For example, see the added test, which would print a
savepoint of %bb.-1 without this change, and crashes with a
use-after-free error under ASan if you apply the recycling allocator
patch from llvm.org/PR26808.

llvm-svn: 266150

8 years agoAdd space between words in verify-scev-maps option help message
Jeroen Ketema [Tue, 12 Apr 2016 23:21:46 +0000 (23:21 +0000)]
Add space between words in verify-scev-maps option help message

llvm-svn: 266149

8 years ago[x86, InstCombine] fix masked load pass-through operand to be a zero vector
Sanjay Patel [Tue, 12 Apr 2016 23:16:23 +0000 (23:16 +0000)]
[x86, InstCombine] fix masked load pass-through operand to be a zero vector

This bug was introduced with:
http://reviews.llvm.org/rL262269

AVX masked loads are specified to set vector lanes to zero when the high bit of the mask
element for that lane is zero:
"If the mask is 0, the corresponding data element is set to zero in the load form of these
instructions, and unmodified in the store form." --Intel manual

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

llvm-svn: 266148

8 years ago[ObjC] Pop all cleanups created in EmitObjCForCollectionStmt before
Akira Hatanaka [Tue, 12 Apr 2016 23:10:58 +0000 (23:10 +0000)]
[ObjC] Pop all cleanups created in EmitObjCForCollectionStmt before
exiting the for-in loop.

This commit fixes a bug where EmitObjCForCollectionStmt didn't pop
cleanups for captures.

For example, in the following for-in loop, a block which captures self
is passed to foo1:

for (id x in [self foo1:^{ use(self); }]) {
  use(x);
  break;
}

Previously, the code in EmitObjCForCollectionStmt wouldn't pop the
cleanup for the captured self before exiting the loop, which caused
code-gen to generate an IR in which objc_release was called twice on
the captured self.

This commit fixes the bug by entering a RunCleanupsScope before the
loop condition is evaluated and forcing its cleanup before exiting the
loop.

rdar://problem/16865751

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

llvm-svn: 266147

8 years agoObjC class properties: add diagnostics for unimplemented class properties.
Manman Ren [Tue, 12 Apr 2016 23:01:55 +0000 (23:01 +0000)]
ObjC class properties: add diagnostics for unimplemented class properties.

rdar://24711047

llvm-svn: 266146

8 years agoFix breakpoint_set_restart test for Windows
Adrian McCarthy [Tue, 12 Apr 2016 22:45:03 +0000 (22:45 +0000)]
Fix breakpoint_set_restart test for Windows

When run with the multiprocess test runner, the getchar() trick doesn't work, so ninja check-lldb would fail on this test, but running the test directly worked fine.

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

llvm-svn: 266145

8 years ago[AArch64] Fuse AES{D,E}/AESMC for Exynos M1. (NFC)
Evandro Menezes [Tue, 12 Apr 2016 22:42:36 +0000 (22:42 +0000)]
[AArch64] Fuse AES{D,E}/AESMC for Exynos M1. (NFC)

llvm-svn: 266144

8 years agoAdd test for the interaction of copy relocations and non alloc sections.
Rafael Espindola [Tue, 12 Apr 2016 22:36:05 +0000 (22:36 +0000)]
Add test for the interaction of copy relocations and non alloc sections.

llvm-svn: 266143

8 years agoPre-fill LibcallRoutineNames with nullptr.
James Y Knight [Tue, 12 Apr 2016 22:32:47 +0000 (22:32 +0000)]
Pre-fill LibcallRoutineNames with nullptr.

And rearrange InitLibcallNames slightly.

llvm-svn: 266142

8 years agoAdd a few more cases to this test.
Rafael Espindola [Tue, 12 Apr 2016 22:08:23 +0000 (22:08 +0000)]
Add a few more cases to this test.

It now documents how we currently handle relocations for
alloc/non-alloc.

llvm-svn: 266141

8 years ago[COFF] Simplify the code leveraging implicit conversion.
Davide Italiano [Tue, 12 Apr 2016 22:05:38 +0000 (22:05 +0000)]
[COFF] Simplify the code leveraging implicit conversion.

Suggested by: David Blaikie!

llvm-svn: 266140

8 years agoFixed being able to set breakpoints on destructors when we don't fully specify the...
Greg Clayton [Tue, 12 Apr 2016 22:02:37 +0000 (22:02 +0000)]
Fixed being able to set breakpoints on destructors when we don't fully specify the demangled name. So all of the following now work:

(lldb) b ~Foo
(lldb) b Foo::~Foo
(lldb) b Bar::Foo::~Foo

Improved out C++ breakpoint locations tests as well to cover this issue.

<rdar://problem/25577252>

llvm-svn: 266139

8 years agoUse the FormatEntity work for great good - parse summary strings before accepting...
Enrico Granata [Tue, 12 Apr 2016 21:57:11 +0000 (21:57 +0000)]
Use the FormatEntity work for great good - parse summary strings before accepting them, and fail to add any strings that fail parsing

llvm-svn: 266138

8 years agoUpdate psabi link for x86-64. Add link to linux gabi supplement.
James Y Knight [Tue, 12 Apr 2016 21:54:57 +0000 (21:54 +0000)]
Update psabi link for x86-64. Add link to linux gabi supplement.

llvm-svn: 266137

8 years ago[MC/ELFObjectWriter] Fix indentation of class body.
David Blaikie [Tue, 12 Apr 2016 21:45:53 +0000 (21:45 +0000)]
[MC/ELFObjectWriter] Fix indentation of class body.

llvm-svn: 266136

8 years agoFixed a few typos and formatting problems. NFCI.
David L Kreitzer [Tue, 12 Apr 2016 21:45:09 +0000 (21:45 +0000)]
Fixed a few typos and formatting problems. NFCI.

llvm-svn: 266135

8 years ago[DebugInfo] Add error message to test.
Davide Italiano [Tue, 12 Apr 2016 21:44:16 +0000 (21:44 +0000)]
[DebugInfo] Add error message to test.

Suggested by Rafael as post-commit review (r266102).

llvm-svn: 266134

8 years ago[AMDGPU] Add debugger related target options
Konstantin Zhuravlyov [Tue, 12 Apr 2016 21:42:15 +0000 (21:42 +0000)]
[AMDGPU] Add debugger related target options

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

llvm-svn: 266133

8 years agoAdd a pass to name anonymous/nameless function
Mehdi Amini [Tue, 12 Apr 2016 21:35:28 +0000 (21:35 +0000)]
Add a pass to name anonymous/nameless function

Summary:
For correct handling of alias to nameless
function, we need to be able to refer them through a GUID in the summary.
Here we name them using a hash of the non-private global names in the module.

Reviewers: tejohnson

Subscribers: joker.eph, llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266132

8 years agoMove summary creation out of llvm-as into opt
Mehdi Amini [Tue, 12 Apr 2016 21:35:18 +0000 (21:35 +0000)]
Move summary creation out of llvm-as into opt

Summary:
Let keep llvm-as "dumb": it converts textual IR to bitcode. This
commit removes the dependency from llvm-as to libLLVMAnalysis.
We'll add back summary in llvm-as if we get to a textual
representation for it at some point. In the meantime, opt seems
like a better place for that.

Reviewers: tejohnson

Subscribers: joker.eph, llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266131

8 years agoX86: Avoid accessing SDValues after they've been RAUW'd
Justin Bogner [Tue, 12 Apr 2016 21:34:24 +0000 (21:34 +0000)]
X86: Avoid accessing SDValues after they've been RAUW'd

This fixes two use-after-frees in selectLEA64_32Addr. If matchAddress
matches an ADD with an AND as an operand, and that AND hits one of the
"heroic transforms" that folds masks and shifts, we end up with N
pointing to an SDNode that was deleted. Make sure we're done accessing
it before that.

Found by ASan with the recycling allocator changes in llvm.org/PR26808.

llvm-svn: 266130

8 years agoCleanup the arguments for 'memory find' such that the help system reflects the real...
Enrico Granata [Tue, 12 Apr 2016 21:26:48 +0000 (21:26 +0000)]
Cleanup the arguments for 'memory find' such that the help system reflects the real way to invoke it

llvm-svn: 266129

8 years agoNFC: MergeFunctions return early
JF Bastien [Tue, 12 Apr 2016 21:23:05 +0000 (21:23 +0000)]
NFC: MergeFunctions return early

Same effect, easier to read.

llvm-svn: 266128

8 years agoAdd a fixme for an old patch I had lying around that I'm not going to finish any...
David Blaikie [Tue, 12 Apr 2016 21:22:48 +0000 (21:22 +0000)]
Add a fixme for an old patch I had lying around that I'm not going to finish any time so n

llvm-svn: 266127

8 years agoAMDGPU: add llvm.amdgcn.buffer.load/store intrinsics
Nicolai Haehnle [Tue, 12 Apr 2016 21:18:10 +0000 (21:18 +0000)]
AMDGPU: add llvm.amdgcn.buffer.load/store intrinsics

Summary:
They correspond to BUFFER_LOAD/STORE_DWORD[_X2,X3,X4] and mostly behave like
llvm.amdgcn.buffer.load/store.format. They will be used by Mesa for SSBO and
atomic counters at least when robust buffer access behavior is desired.
(These instructions perform no format conversion and do buffer range checking
per component.)

As a side effect of sharing patterns with llvm.amdgcn.buffer.store.format,
it has become trivial to add support for the f32 and v2f32 variants of that
intrinsic, so the patch does so.

Also DAG-ify (and fix) some tests that I noticed intermittent failures in
while developing this patch.

Some tests were (temporarily) adjusted for the required mayLoad/hasSideEffects
changes to the BUFFER_STORE_DWORD* instructions. See also
http://reviews.llvm.org/D18291.

Reviewers: arsenm, tstellarAMD, mareko

Subscribers: arsenm, llvm-commits

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

llvm-svn: 266126

8 years ago[ThinLTO] Only compute imports for current module in FunctionImport pass
Teresa Johnson [Tue, 12 Apr 2016 21:13:11 +0000 (21:13 +0000)]
[ThinLTO] Only compute imports for current module in FunctionImport pass

Summary:
The function import pass was computing all the imports for all the
modules in the index, and only using the imports for the current module.
Change this to instead compute only for the given module. This means
that the exports list can't be populated, but they weren't being used
anyway.

Longer term, the linker can collect all the imports and export lists
and serialize them out for consumption by the distributed backend
processes which use this pass.

Reviewers: joker.eph

Subscribers: llvm-commits, joker.eph

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

llvm-svn: 266125

8 years agoNFC: MergeFunctions update more comments
JF Bastien [Tue, 12 Apr 2016 21:13:01 +0000 (21:13 +0000)]
NFC: MergeFunctions update more comments

They are wordy. Some words were wrong.

llvm-svn: 266124

8 years agoAlways use --eh-frame-hdr on FreeBSD, even for -static
Ed Maste [Tue, 12 Apr 2016 21:11:46 +0000 (21:11 +0000)]
Always use --eh-frame-hdr on FreeBSD, even for -static

FreeBSD uses LLVM's libunwind on FreeBSD/arm64 today (and is expected to
use it more widely in the future), and it requires the EH frame segment
in static binaries.

This is the same as r203742 for NetBSD.

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

llvm-svn: 266123

8 years agoAdd a couple of missing vsx load and store intrinsics.
Eric Christopher [Tue, 12 Apr 2016 21:08:54 +0000 (21:08 +0000)]
Add a couple of missing vsx load and store intrinsics.

Patch by Jing Yu!

llvm-svn: 266122

8 years agoELF: Give automatically generated __start_* and __stop_* symbols hidden visibility.
Peter Collingbourne [Tue, 12 Apr 2016 20:41:42 +0000 (20:41 +0000)]
ELF: Give automatically generated __start_* and __stop_* symbols hidden visibility.

These symbols describe a property of a linkage unit, so it seems reasonable
to limit their visibility to the linkage unit. Furthermore the use cases I
am aware of do not require more than hidden visibility.

This is a departure from the behavior of the bfd and gold linkers. However,
it is unclear that the decision to give these symbols default visibility
in those linkers was made deliberately. The __start_*/__stop_* feature
was added to the bfd linker in 1994 [1], while the visibility feature was
added about five years later [2], so it may have been that the visibility
of these symbols was not considered. The feature was implemented in gold
[3] in the same way; the behavior may have simply been copied from bfd.

The only related discussion I could find on the binutils mailing list [4]
was a user issue which would most likely not have occurred if the symbols
had hidden visibility.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=5efddb2e7c3229b569a862205f61d42860af678b
[2] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=0fc731e447cd01e7fc35197b487ff0e4fd25afca
[3] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=bfd58944a64b0997a310b95fbe0423338961e71c
[4] https://sourceware.org/ml/binutils/2014-05/msg00011.html

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

llvm-svn: 266121

8 years agoAdd declarations of OpenMP 4.5 target/offload routines to headers
Jonathan Peyton [Tue, 12 Apr 2016 20:37:18 +0000 (20:37 +0000)]
Add declarations of OpenMP 4.5 target/offload routines to headers

All these routines are implemented in the offload library.

llvm-svn: 266120

8 years ago[ELF][MIPS] Add test case to check using GP0 value in relocation calculation. NFC.
Simon Atanasyan [Tue, 12 Apr 2016 20:37:00 +0000 (20:37 +0000)]
[ELF][MIPS] Add test case to check using GP0 value in relocation calculation. NFC.

llvm-svn: 266119

8 years agoRevert to using libdispatch to reap threads on MacOSX. Code was accidentally checked...
Greg Clayton [Tue, 12 Apr 2016 20:26:41 +0000 (20:26 +0000)]
Revert to using libdispatch to reap threads on MacOSX. Code was accidentally checked in that is now reverted.

<rdar://problem/25643874>

llvm-svn: 266118

8 years agoPass -backend-option to LLVM when there is no target machine.
Yaxun Liu [Tue, 12 Apr 2016 20:22:32 +0000 (20:22 +0000)]
Pass -backend-option to LLVM when there is no target machine.

Clang should pass -backend-option to LLVM even though there is no target machine, since LLVM passes are used when emitting LLVM IR.

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

llvm-svn: 266117

8 years ago[modules] Extend r266113 to cope with submodules.
Richard Smith [Tue, 12 Apr 2016 20:20:33 +0000 (20:20 +0000)]
[modules] Extend r266113 to cope with submodules.

llvm-svn: 266116

8 years agoAdd __atomic_* lowering to AtomicExpandPass.
James Y Knight [Tue, 12 Apr 2016 20:18:48 +0000 (20:18 +0000)]
Add __atomic_* lowering to AtomicExpandPass.

(Recommit of r266002, with r266011, r266016, and not accidentally
including an extra unused/uninitialized element in LibcallRoutineNames)

AtomicExpandPass can now lower atomic load, atomic store, atomicrmw, and
cmpxchg instructions to __atomic_* library calls, when the target
doesn't support atomics of a given size.

This is the first step towards moving all atomic lowering from clang
into llvm. When all is done, the behavior of __sync_* builtins,
__atomic_* builtins, and C11 atomics will be unified.

Previously LLVM would pass everything through to the ISelLowering
code. There, unsupported atomic instructions would turn into __sync_*
library calls. Because of that behavior, Clang currently avoids emitting
llvm IR atomic instructions when this would happen, and emits __atomic_*
library functions itself, in the frontend.

This change makes LLVM able to emit __atomic_* libcalls, and thus will
eventually allow clang to depend on LLVM to do the right thing.

It is advantageous to do the new lowering to atomic libcalls in
AtomicExpandPass, before ISel time, because it's important that all
atomic operations for a given size either lower to __atomic_*
libcalls (which may use locks), or native instructions which won't. No
mixing and matching.

At the moment, this code is enabled only for SPARC, as a
demonstration. The next commit will expand support to all of the other
targets.

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

llvm-svn: 266115

8 years ago[WebAssembly] Fix debug info in reg-stackify.ll test
Derek Schuff [Tue, 12 Apr 2016 20:12:05 +0000 (20:12 +0000)]
[WebAssembly] Fix debug info in reg-stackify.ll test

It lacked a CU and thus became invalid with r266102

llvm-svn: 266114

8 years ago[modules] When an incompatible module file is explicitly provided for a module,
Richard Smith [Tue, 12 Apr 2016 19:58:30 +0000 (19:58 +0000)]
[modules] When an incompatible module file is explicitly provided for a module,
and we fall back to textual inclusion, don't require the module as a whole to
be marked available; it's OK if some other file in the same module is missing,
just as it would be if the header were explicitly marked textual.

llvm-svn: 266113

8 years agoDelete mergefunctions.clang.svn.patch
JF Bastien [Tue, 12 Apr 2016 19:44:40 +0000 (19:44 +0000)]
Delete mergefunctions.clang.svn.patch

The patch doesn't apply, and was removed from zorg by rL266094.

llvm-svn: 266112

8 years agoPR19957: [OpenCL] Incorrectly accepts implicit address space conversion with ternary...
Yaxun Liu [Tue, 12 Apr 2016 19:43:36 +0000 (19:43 +0000)]
PR19957: [OpenCL] Incorrectly accepts implicit address space conversion with ternary operator.

Generates addrspacecast instead of bitcast for ternary operator when necessary, and diagnose ternary operator with incompatible second and third operands.

https://llvm.org/bugs/show_bug.cgi?id=19957

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

llvm-svn: 266111

8 years ago[analyzer] Nullability: Suppress return diagnostics in inlined functions.
Devin Coughlin [Tue, 12 Apr 2016 19:29:52 +0000 (19:29 +0000)]
[analyzer] Nullability: Suppress return diagnostics in inlined functions.

The nullability checker can sometimes miss detecting nullability precondition
violations in inlined functions because the binding for the parameter
that violated the precondition becomes dead before the return:

int * _Nonnull callee(int * _Nonnull p2) {
  if (!p2)
    // p2 becomes dead here, so binding removed.
    return 0; // warning here because value stored in p2 is symbolic.
  else
   return p2;
}

int *caller(int * _Nonnull p1) {
  return callee(p1);
}

The fix, which is quite blunt, is to not warn about null returns in inlined
methods/functions. This won’t lose much coverage for ObjC because the analyzer
always analyzes each ObjC method at the top level in addition to inlined. It
*will* lose coverage for C — but there aren’t that many codebases with C
nullability annotations.

rdar://problem/25615050

llvm-svn: 266109

8 years agoclang-cl: Remove -isystem, add -imsvc.
Nico Weber [Tue, 12 Apr 2016 19:04:37 +0000 (19:04 +0000)]
clang-cl: Remove -isystem, add -imsvc.

r260990 exposed -isystem in clang-cl. -isystem adds a directory to the front of
the system include search path. The idea was to use this to point to a hermetic
msvc install, but as it turns out this doesn't work: -isystem then adds the
hermetic headers in front of clang's builtin headers, and clang's headers that
are supposed to wrap msvc headers (say, stdarg.h) aren't picked up at all
anymore.

So revert that, and instead expose -imsvc which works as if the passed
directory was part of %INCLUDE%: The header is treated as a system header, but
it is searched after clang's lib/Header headers.

Fixes half of PRPR26751.

llvm-svn: 266108

8 years ago[OpenCL] Handle AddressSpaceConversion when target address space does not change.
Yaxun Liu [Tue, 12 Apr 2016 19:03:49 +0000 (19:03 +0000)]
[OpenCL] Handle AddressSpaceConversion when target address space does not change.

In codegen different address spaces may be mapped to the same address
space for a target, e.g. in x86/x86-64 all address spaces are mapped
to 0. Therefore AddressSpaceConversion should be translated by
CreatePointerBitCastOrAddrSpaceCast instead of CreateAddrSpaceCast.

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

llvm-svn: 266107

8 years ago[safestack] Fix stack canary test on Mac.
Evgeniy Stepanov [Tue, 12 Apr 2016 18:48:41 +0000 (18:48 +0000)]
[safestack] Fix stack canary test on Mac.

Disable FORTIFY_SOURCE and explicitly disable stack protector in the
no-stack-protector run.

llvm-svn: 266106

8 years agoAMDGPU/SI: Insert wait states required after v_readfirstlane on SI
Tom Stellard [Tue, 12 Apr 2016 18:40:43 +0000 (18:40 +0000)]
AMDGPU/SI: Insert wait states required after v_readfirstlane on SI

Summary:
We will be able to handle this case much better once the hazard recognizer
is finished, but this conservative implementation  fixes a hang with the piglit
test:

spec/arb_arrays_of_arrays/execution/sampler/fs-nested-struct-arrays-nonconst-nested-arra

Reviewers: arsenm, nhaehnle

Subscribers: arsenm, llvm-commits

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

llvm-svn: 266105

8 years agoAMDGPU: Eliminate half of i64 or if one operand is zero_extend from i32
Matt Arsenault [Tue, 12 Apr 2016 18:24:38 +0000 (18:24 +0000)]
AMDGPU: Eliminate half of i64 or if one operand is zero_extend from i32

This helps clean up some of the mess when expanding unaligned 64-bit
loads when changed to be promote to v2i32, and fixes situations
where or x, 0 was emitted after splitting 64-bit ors during moveToVALU.

I think this could be a generic combine but I'm not sure.

llvm-svn: 266104

8 years agoInitialize the Python script interpreter lazily (i.e. not at debugger startup)
Enrico Granata [Tue, 12 Apr 2016 18:23:18 +0000 (18:23 +0000)]
Initialize the Python script interpreter lazily (i.e. not at debugger startup)

This time it should also pass the gtests

llvm-svn: 266103

8 years ago[IR/Verifier] Each DISubprogram with isDefinition: true must belong to a CU.
Davide Italiano [Tue, 12 Apr 2016 18:22:33 +0000 (18:22 +0000)]
[IR/Verifier] Each DISubprogram with isDefinition: true must belong to a CU.

Add a check to catch violations. ~60 tests were broken and prevented
this change to be committed. Adrian and I (thanks Adrian!) went
through them in the last week or so updating. The check can be
done more efficiently but I'd still like to get this in ASAP to
avoid more broken tests to be checked in (if any).

PR:  27101
llvm-svn: 266102

8 years agoAPInt: Add overload of isMask
Matt Arsenault [Tue, 12 Apr 2016 18:17:23 +0000 (18:17 +0000)]
APInt: Add overload of isMask

This mimics the version in MathExtras.h which isn't testing for a
specific mask size.

llvm-svn: 266101

8 years ago[CodeGen] Remove constant-folding dead code. NFC.
Ahmed Bougacha [Tue, 12 Apr 2016 18:15:39 +0000 (18:15 +0000)]
[CodeGen] Remove constant-folding dead code. NFC.

This code was specific to vector operations with scalar operands:
all the opcodes in FoldValue (via FoldConstantArithmetic) can't
match those criteria.

Replace it with an assert if that ever changes: at that point,
we might need to add back a splat BUILD_VECTOR.

llvm-svn: 266100

8 years agoCheck alloca's special state
JF Bastien [Tue, 12 Apr 2016 18:06:55 +0000 (18:06 +0000)]
Check alloca's special state

Following up to a similar fix in MergeFunctions: r266022. This patch keeps both in sync, it would be nice to not have to do this. It doesn't look like there's an easy way to test this code directly at the moment: AFAICT all currect uses of isSameOperationAs are looking at instructions deep inside a function. IndVarSimplify/pr24952.ll and InstMerge/st_sink_* look at alloca inadvertently but are brittle tests.

llvm-svn: 266099

8 years agoIntroduce an GCRelocateInst class [NFC]
Philip Reames [Tue, 12 Apr 2016 18:05:10 +0000 (18:05 +0000)]
Introduce an GCRelocateInst class [NFC]

Previously, we were using isGCRelocate predicates.  Using a subclass of IntrinsicInst is far more idiomatic.  The refactoring also enables a couple of minor simplifications and code sharing.

llvm-svn: 266098

8 years agofix indentation; NFC
Sanjay Patel [Tue, 12 Apr 2016 18:01:48 +0000 (18:01 +0000)]
fix indentation; NFC

llvm-svn: 266097

8 years ago[FIX] Check the invalid context agains the context to rule out SCoPs
Johannes Doerfert [Tue, 12 Apr 2016 17:54:29 +0000 (17:54 +0000)]
[FIX] Check the invalid context agains the context to rule out SCoPs

llvm-svn: 266096

8 years agoStricter checks in the stack-protector codegen test.
Evgeniy Stepanov [Tue, 12 Apr 2016 17:51:59 +0000 (17:51 +0000)]
Stricter checks in the stack-protector codegen test.

llvm-svn: 266095

8 years agoBreakpoint conditions were making result variables, which they should not do.
Jim Ingham [Tue, 12 Apr 2016 17:17:35 +0000 (17:17 +0000)]
Breakpoint conditions were making result variables, which they should not do.

The result variables aren't useful, and if you have a breakpoint on a
common function you can generate a lot of these.  So I changed the
code that checks the condition to set ResultVariableIsInternal in the
EvaluateExpressionOptions that we pass to the execution.
Unfortunately, the check for this variable was done in the wrong place
(the static UserExpression::Evaluate) which is not how breakpoint
conditions execute expressions (UserExpression::Execute).  So I moved
the check to UserExpression::Execute (which Evaluate also calls) and made the
overridden method DoExecute.

llvm-svn: 266093

8 years ago'int' is reported as an exception on OS X not as a signal. I don't think
Jim Ingham [Tue, 12 Apr 2016 17:04:12 +0000 (17:04 +0000)]
'int' is reported as an exception on OS X not as a signal.  I don't think
this test ever succeeded on OS X.

llvm-svn: 266092

8 years agoRevert 266090, needs more testing first.
Nico Weber [Tue, 12 Apr 2016 16:52:30 +0000 (16:52 +0000)]
Revert 266090, needs more testing first.

llvm-svn: 266091

8 years agoclang-cl: Expose -nostdlibinc.
Nico Weber [Tue, 12 Apr 2016 16:38:07 +0000 (16:38 +0000)]
clang-cl: Expose -nostdlibinc.

llvm-svn: 266090

8 years ago[FileManager] Don't crash if reading from stdin and stat(".") fails
David Majnemer [Tue, 12 Apr 2016 16:33:53 +0000 (16:33 +0000)]
[FileManager] Don't crash if reading from stdin and stat(".") fails

addAncestorsAsVirtualDirs("<stdin>") quickly returns without doing work
because "<stdin>" has no parent_path.  This violates the expectation
that a subsequent call to getDirectoryFromFile("<stdin>") would succeed.
Instead, it fails because it uses the "." if the file has no path
component.

Fix this by keeping the behavior between addAncestorsAsVirtualDirs and
getDirectoryFromFile symmetric.

llvm-svn: 266089

8 years agoAMDGPU/SI: Fix a mis-compilation of multi-level breaks
Nicolai Haehnle [Tue, 12 Apr 2016 16:10:38 +0000 (16:10 +0000)]
AMDGPU/SI: Fix a mis-compilation of multi-level breaks

Summary:
Under certain circumstances, multi-level breaks (or what is understood by
the control flow passes as such) could be miscompiled in a way that causes
infinite loops, by emitting incorrect control flow intrinsics.

This fixes a hang in
dEQP-GLES3.functional.shaders.loops.while_dynamic_iterations.conditional_continue_vertex

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits

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

llvm-svn: 266088