platform/upstream/llvm.git
9 years agoAdd support for -stack-list-variables.
Hafiz Abid Qadeer [Wed, 29 Apr 2015 08:18:41 +0000 (08:18 +0000)]
Add support for -stack-list-variables.

This command is able to list both local variables and stack arguments for a specific thread/frame.
Args are denoted with 'arg="1"'.
Patch from Chuck Ries.

llvm-svn: 236090

9 years ago[TableGen] Use range-based for loops. NFC.
Craig Topper [Wed, 29 Apr 2015 07:13:14 +0000 (07:13 +0000)]
[TableGen] Use range-based for loops. NFC.

llvm-svn: 236089

9 years ago[TableGen] Fold a couple dyn_casts into the ifs that check their results. NFC
Craig Topper [Wed, 29 Apr 2015 07:13:12 +0000 (07:13 +0000)]
[TableGen] Fold a couple dyn_casts into the ifs that check their results. NFC

llvm-svn: 236088

9 years ago[TableGen] Replace some dyn_casts followed by an assert with just a regular cast...
Craig Topper [Wed, 29 Apr 2015 07:13:05 +0000 (07:13 +0000)]
[TableGen] Replace some dyn_casts followed by an assert with just a regular cast which asserts internally. NFC

llvm-svn: 236087

9 years agofixed comments, blanks, nullptr; NFC
Elena Demikhovsky [Wed, 29 Apr 2015 06:49:50 +0000 (06:49 +0000)]
fixed comments, blanks, nullptr; NFC

llvm-svn: 236086

9 years ago[OPENMP] Fix crash on reductions codegen for short circuit reduction operations.
Alexey Bataev [Wed, 29 Apr 2015 05:21:03 +0000 (05:21 +0000)]
[OPENMP] Fix crash on reductions codegen for short circuit reduction operations.

llvm-svn: 236084

9 years ago[TableGen] Use range-based for loops. NFC
Craig Topper [Wed, 29 Apr 2015 04:43:36 +0000 (04:43 +0000)]
[TableGen] Use range-based for loops. NFC

llvm-svn: 236083

9 years agoRevert r236052, it caused linker errors when building 32-bit applications.
Nico Weber [Wed, 29 Apr 2015 03:08:32 +0000 (03:08 +0000)]
Revert r236052, it caused linker errors when building 32-bit applications.

llvm-svn: 236082

9 years agoDrop Dragonegg from the release export script
Hans Wennborg [Wed, 29 Apr 2015 02:36:43 +0000 (02:36 +0000)]
Drop Dragonegg from the release export script

Follow-up to r236077.

llvm-svn: 236081

9 years agoUse an "early return" idiom for the error case. NFC
Filipe Cabecinhas [Wed, 29 Apr 2015 02:36:08 +0000 (02:36 +0000)]
Use an "early return" idiom for the error case. NFC

llvm-svn: 236080

9 years agoCheck that we have a valid PointerType element type before calling get()
Filipe Cabecinhas [Wed, 29 Apr 2015 02:27:28 +0000 (02:27 +0000)]
Check that we have a valid PointerType element type before calling get()

Same as r236073 but for PointerType.

Bug found with AFL fuzz.

llvm-svn: 236079

9 years agoUse the ArrayType member function for array element types.
Filipe Cabecinhas [Wed, 29 Apr 2015 02:27:21 +0000 (02:27 +0000)]
Use the ArrayType member function for array element types.

ArrayType and StructType accept the same types, so no test.

llvm-svn: 236078

9 years agoDrop Dragonegg support from the release script
Hans Wennborg [Wed, 29 Apr 2015 02:14:26 +0000 (02:14 +0000)]
Drop Dragonegg support from the release script

It doesn't have a maintainer and none of the release testers test it,
so I don't think it should be part of the release.

http://reviews.llvm.org/D9331

llvm-svn: 236077

9 years agoTurn an assert into report_fatal_error since it's reachable based on user input
Filipe Cabecinhas [Wed, 29 Apr 2015 01:58:31 +0000 (01:58 +0000)]
Turn an assert into report_fatal_error since it's reachable based on user input

Bug found with AFL fuzz.

llvm-svn: 236076

9 years agoAdd -Wpessimizing-move and -Wredundant-move warnings.
Richard Trieu [Wed, 29 Apr 2015 01:52:17 +0000 (01:52 +0000)]
Add -Wpessimizing-move and -Wredundant-move warnings.

-Wpessimizing-move warns when a call to std::move would prevent copy elision
if the argument was not wrapped in a call.  This happens when moving a local
variable in a return statement when the variable is the same type as the
return type or using a move to create a new object from a temporary object.

-Wredundant-move warns when an implicit move would already be made, so the
std::move call is not needed, such as when moving a local variable in a return
that is different from the return type.

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

llvm-svn: 236075

9 years ago[Orc] It's not valid to pass a null resolver to addModuleSet. Use a no-op
Lang Hames [Wed, 29 Apr 2015 01:33:35 +0000 (01:33 +0000)]
[Orc] It's not valid to pass a null resolver to addModuleSet. Use a no-op
resolver with a diagnostic instread.

llvm-svn: 236074

9 years agoMake sure that isValidElementType(Type) before calling {Array,Struct}Type::get(Type)
Filipe Cabecinhas [Wed, 29 Apr 2015 01:27:01 +0000 (01:27 +0000)]
Make sure that isValidElementType(Type) before calling {Array,Struct}Type::get(Type)

Bug found with AFL fuzz.

llvm-svn: 236073

9 years agoPR20625: Instantiate static constexpr member function of a local struct in a function...
Richard Smith [Wed, 29 Apr 2015 00:07:09 +0000 (00:07 +0000)]
PR20625: Instantiate static constexpr member function of a local struct in a function template earlier.

This is necessary in order to allow the use of a constexpr member function, or
a member function with deduced return type, of a local class within a
surrounding instantiated function template specialization.

Patch by Michael Park!

llvm-svn: 236063

9 years agoRegisterCoalescer: hide terminal rule option by default
Matthias Braun [Tue, 28 Apr 2015 23:55:11 +0000 (23:55 +0000)]
RegisterCoalescer: hide terminal rule option by default

llvm-svn: 236062

9 years agotest-release.sh: Drop some unused command-line options.
Hans Wennborg [Tue, 28 Apr 2015 23:37:41 +0000 (23:37 +0000)]
test-release.sh: Drop some unused command-line options.

These haven't done anything since before r142165.

llvm-svn: 236061

9 years agoStop emitting the soft-float and soft-float-abi target features
Eric Christopher [Tue, 28 Apr 2015 23:18:33 +0000 (23:18 +0000)]
Stop emitting the soft-float and soft-float-abi target features
for ARM while the backend will only ignore them. No functional
change intended.

llvm-svn: 236060

9 years agoDebug Info: Represent local anonymous unions as anonymous unions
Adrian Prantl [Tue, 28 Apr 2015 23:01:24 +0000 (23:01 +0000)]
Debug Info: Represent local anonymous unions as anonymous unions
in the debug info. This patch deletes a hack that emits the members
of local anonymous unions as local variables.

Besides being morally wrong, the existing representation using local
variables breaks internal assumptions about the local variables' storage
size.

Compiling

```
   void fn1() {
     union {
       int i;
       char c;
     };
     i = c;
   }

```

with -g -O3 -verify will cause the verifier to fail after SROA splits
the 32-bit storage for the "local variable" c into two pieces because the
second piece is clearly outside the 8-bit range that is expected for a
variable of type char. Given the choice I'd rather fix the debug
representation than weaken the verifier.

Debuggers generally already know how to deal with anonymous unions when
they are members of C++ record types, but they may have problems finding
the local anonymous struct members in the expression evaluator.

rdar://problem/20730771

llvm-svn: 236059

9 years agoMap directly from signature symbol to group index. NFC.
Rafael Espindola [Tue, 28 Apr 2015 22:59:58 +0000 (22:59 +0000)]
Map directly from signature symbol to group index. NFC.

llvm-svn: 236058

9 years agoFix Sema tests using __try by adding triple
Reid Kleckner [Tue, 28 Apr 2015 22:58:25 +0000 (22:58 +0000)]
Fix Sema tests using __try by adding triple

llvm-svn: 236057

9 years agoTests for r236055.
Eric Christopher [Tue, 28 Apr 2015 22:56:57 +0000 (22:56 +0000)]
Tests for r236055.

Patch by Teresa Johnson.

llvm-svn: 236056

9 years agoThis change is the first of 3 patches to add support for specifying
Eric Christopher [Tue, 28 Apr 2015 22:54:51 +0000 (22:54 +0000)]
This change is the first of 3 patches to add support for specifying
the profile output from the command line via -fprofile-instr-generate=<path>,
where the specified output path/file will be overridden by the
LLVM_PROFILE_FILE environment variable.

Several changes are made to the runtime to support this:

Add a new interface __llvm_profile_override_default_filename that will
set the profile output filename, but allows LLVM_PROFILE_FILE to override.
This is the interface used by the new option.

Refactor the pid-expansion done for LLVM_PROFILE_FILE into a separate
routine that can be shared by the various filename setting routines
(so that the filename from the option can also use the "%p" syntax).

Move the truncation into setFilename, and only truncate if there is a
new filename specified (to maintain support for appending to the same
profile file in the case of multiple shared objects built with profiling).

Move the handling for a NULL filename passed to __llvm_profile_set_filename and
__llvm_profile_override_default_filename into the new setFilenamePossiblyWithPid
routine. This now correctly resets the output file to default.profraw
instead of NULL.
The handling for a null LLVM_PROFILE_FILE (which should not reset) is done
by caller setFilenameFromEnvironment.

Patch by Teresa Johnson.

llvm-svn: 236055

9 years agoReuse a lookup in an assert.
Eric Christopher [Tue, 28 Apr 2015 22:38:35 +0000 (22:38 +0000)]
Reuse a lookup in an assert.

llvm-svn: 236054

9 years agoRemove redundant temporary std::vector.
Rafael Espindola [Tue, 28 Apr 2015 22:26:19 +0000 (22:26 +0000)]
Remove redundant temporary std::vector.

New sections are added to the end of the list, so the RelSections array was
redundant.

llvm-svn: 236053

9 years ago[SEH] Add 32-bit lowering code for __try
Reid Kleckner [Tue, 28 Apr 2015 22:19:32 +0000 (22:19 +0000)]
[SEH] Add 32-bit lowering code for __try

This is just the clang-side of 32-bit SEH. LLVM still needs work, and it
will determinstically fail to compile until it's feature complete.

On x86, all outlined handlers have no parameters, but they do implicitly
take the EBP value passed in and use it to address locals of the parent
frame. We model this with llvm.frameaddress(1).

This works (mostly), but __finally block inlining can break it. For now,
we apply the 'noinline' attribute. If we really want to inline __finally
blocks on 32-bit x86, we should teach the inliner how to untangle
frameescape and framerecover.

Promote the error diagnostic from codegen to sema. It now rejects SEH on
non-Windows platforms. LLVM doesn't implement SEH on non-x86 Windows
platforms, but there's nothing preventing it.

llvm-svn: 236052

9 years agoFix the typo in r236044. NFC.
Steven Wu [Tue, 28 Apr 2015 22:07:05 +0000 (22:07 +0000)]
Fix the typo in r236044. NFC.

llvm-svn: 236051

9 years agoARM: fix peephole optimisation of TST
Tim Northover [Tue, 28 Apr 2015 22:03:55 +0000 (22:03 +0000)]
ARM: fix peephole optimisation of TST

We were trying to look through COPY instructions, but only to the next
instruction in a BB and incorrectly anyway. The cases where that would actually
be a good idea are rare enough (and not even tested!) that it's not worth
trying to get right.

rdar://20721342

llvm-svn: 236050

9 years agoAvoid one more walk over all sections. NFC.
Rafael Espindola [Tue, 28 Apr 2015 22:03:22 +0000 (22:03 +0000)]
Avoid one more walk over all sections. NFC.

Set the group section index as they are created.

llvm-svn: 236049

9 years agoStyle updates
Andrew Kaylor [Tue, 28 Apr 2015 22:01:51 +0000 (22:01 +0000)]
Style updates

llvm-svn: 236048

9 years agoUse a range loop. NFC.
Rafael Espindola [Tue, 28 Apr 2015 21:58:05 +0000 (21:58 +0000)]
Use a range loop. NFC.

llvm-svn: 236047

9 years ago[WinEH] Split blocks at calls to llvm.eh.begincatch
Andrew Kaylor [Tue, 28 Apr 2015 21:54:14 +0000 (21:54 +0000)]
[WinEH] Split blocks at calls to llvm.eh.begincatch

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

llvm-svn: 236046

9 years agoAvoid an extra walk over the sections just to assign sections to groups.
Rafael Espindola [Tue, 28 Apr 2015 21:52:33 +0000 (21:52 +0000)]
Avoid an extra walk over the sections just to assign sections to groups.

Assign the sections in the same pass we compute the index.

llvm-svn: 236045

9 years agoFix -fno-gnu-inline-asm doesn't catch file scope asm
Steven Wu [Tue, 28 Apr 2015 21:49:09 +0000 (21:49 +0000)]
Fix -fno-gnu-inline-asm doesn't catch file scope asm

Summary:
FileScopeAsm should be treated the same as funcion level inline asm.
-fno-gnu-inline-asm should trigger an error if file scope asm is used.
I missed this case from r226340. This should not affect ms-extension
because it is not allowed in the file scope.

Reviewers: bob.wilson, rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 236044

9 years agoFix assertion failure if a lambda array-capture is followed by a this capture.
Richard Smith [Tue, 28 Apr 2015 21:41:14 +0000 (21:41 +0000)]
Fix assertion failure if a lambda array-capture is followed by a this capture.

llvm-svn: 236043

9 years agoSparc: Add alternate aliases for conditional branch instructions.
James Y Knight [Tue, 28 Apr 2015 21:27:31 +0000 (21:27 +0000)]
Sparc: Add alternate aliases for conditional branch instructions.

llvm-svn: 236042

9 years ago[SEH] Add an LLVM intrinsic for _exception_info
Reid Kleckner [Tue, 28 Apr 2015 21:20:42 +0000 (21:20 +0000)]
[SEH] Add an LLVM intrinsic for _exception_info

Eventually, we will lower this out during IR preparation.

llvm-svn: 236036

9 years agoAttempt to fix the MSVC build by making ExprIterator
Sean Callanan [Tue, 28 Apr 2015 21:18:01 +0000 (21:18 +0000)]
Attempt to fix the MSVC build by making ExprIterator
inherit correctly.

llvm-svn: 236035

9 years agoWork around a suspected MSVC miscompile to try to bring the MSVC2013 buildbot back.
Richard Smith [Tue, 28 Apr 2015 21:09:27 +0000 (21:09 +0000)]
Work around a suspected MSVC miscompile to try to bring the MSVC2013 buildbot back.

llvm-svn: 236034

9 years agoRemove the GroupMapTy DenseMap. NFC.
Rafael Espindola [Tue, 28 Apr 2015 21:07:28 +0000 (21:07 +0000)]
Remove the GroupMapTy DenseMap. NFC.

Instead use the Group symbol of MCSectionELF.

llvm-svn: 236033

9 years agoRefactor to make MacroState ownership and lifetime clearer.
Richard Smith [Tue, 28 Apr 2015 21:05:07 +0000 (21:05 +0000)]
Refactor to make MacroState ownership and lifetime clearer.

llvm-svn: 236032

9 years agotransform fadd chains to increase parallelism
Sanjay Patel [Tue, 28 Apr 2015 21:03:22 +0000 (21:03 +0000)]
transform fadd chains to increase parallelism

This is a compromise: with this simple patch, we should always handle a chain of exactly 3
operations optimally, but we're not generating the optimal balanced binary tree for a longer
sequence.

In general, this transform will reduce the dependency chain for a sequence of instructions
using N operands from a worst case N-1 dependent operations to N/2 dependent operations.
The optimal balanced binary tree would reduce the chain to log2(N).

The trade-off for not dealing with longer sequences is: (1) we have less complexity in the
compiler, (2) we avoid unknown compile-time blowup calculating a balanced tree, and (3) we
don't need to worry about the increased register pressure required to parallelize longer
sequences. It also seems unlikely that we would ever encounter really long strings of
dependent ops like that in the wild, but I'm not sure how to verify that speculation.
FWIW, I see no perf difference for test-suite running on btver2 (x86-64) with -ffast-math
and this patch.

We can extend this patch to cover other associative operations such as fmul, fmax, fmin,
integer add, integer mul.

This is a partial fix for:
https://llvm.org/bugs/show_bug.cgi?id=17305

and if extended:
https://llvm.org/bugs/show_bug.cgi?id=21768
https://llvm.org/bugs/show_bug.cgi?id=23116

The issue also came up in:
http://reviews.llvm.org/D8941

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

llvm-svn: 236031

9 years ago[bpf] fix build
Alexei Starovoitov [Tue, 28 Apr 2015 20:38:56 +0000 (20:38 +0000)]
[bpf] fix build

Patch by Brenden Blanco.

llvm-svn: 236030

9 years ago[cuda] Preserve TLS storage class of host variable even if it's a
Artem Belevich [Tue, 28 Apr 2015 20:31:49 +0000 (20:31 +0000)]
[cuda] Preserve TLS storage class of host variable even if it's a
device-side compilation.

llvm-svn: 236029

9 years agoUse range loops. NFC.
Rafael Espindola [Tue, 28 Apr 2015 20:23:35 +0000 (20:23 +0000)]
Use range loops. NFC.

llvm-svn: 236028

9 years agoRelax an assert when there's a type mismatch in forward references
Filipe Cabecinhas [Tue, 28 Apr 2015 20:18:47 +0000 (20:18 +0000)]
Relax an assert when there's a type mismatch in forward references

Summary:
We don't seem to need to assert here, since this function's callers expect
to get a nullptr on error. This way we don't assert on user input.

Bug found with AFL fuzz.

Reviewers: rafael

Subscribers: llvm-commits

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

llvm-svn: 236027

9 years agoAvoid adding to SectionIndexMap sections that we never lookup. NFC.
Rafael Espindola [Tue, 28 Apr 2015 20:09:13 +0000 (20:09 +0000)]
Avoid adding to SectionIndexMap sections that we never lookup. NFC.

llvm-svn: 236026

9 years agoRemoved 'complete' from 2408; updated status
Marshall Clow [Tue, 28 Apr 2015 19:35:36 +0000 (19:35 +0000)]
Removed 'complete' from 2408; updated status

llvm-svn: 236025

9 years ago[TestMiVar] Enable one of the tests for GCC.
Siva Chandra [Tue, 28 Apr 2015 19:21:57 +0000 (19:21 +0000)]
[TestMiVar] Enable one of the tests for GCC.

Summary:
The "internal" name of vars is different between clang and GCC. All this
change does is to use a regex instead of the hardcoded internal name.

Test Plan: dotest.py -C <clang|gcc> -p TestMiVar

Reviewers: ki.stfu

Reviewed By: ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 236024

9 years agoMake getModRefInfo(Instruction *) not crash on certain types of instructions
Daniel Berlin [Tue, 28 Apr 2015 19:19:14 +0000 (19:19 +0000)]
Make getModRefInfo(Instruction *) not crash on certain types of instructions

llvm-svn: 236023

9 years agoUse a range loop. NFC.
Rafael Espindola [Tue, 28 Apr 2015 19:07:16 +0000 (19:07 +0000)]
Use a range loop. NFC.

llvm-svn: 236015

9 years ago[asan] Use dl_iterate_phdr on Android.
Evgeniy Stepanov [Tue, 28 Apr 2015 18:50:32 +0000 (18:50 +0000)]
[asan] Use dl_iterate_phdr on Android.

It's available on Android/ARM starting with API 21 (L).

llvm-svn: 236014

9 years ago[x86] remove RCPPS and RSQRTPS intrinsic instruction definitions
Sanjay Patel [Tue, 28 Apr 2015 18:48:45 +0000 (18:48 +0000)]
[x86] remove RCPPS and RSQRTPS intrinsic instruction definitions

We don't need codegen-only intrinsic instructions for the vector forms of these instructions.

This makes the reciprocal estimate instruction lowering identical to how we handle normal
square roots: (V)SQRTPS / (V)SQRTPD.

No existing regression tests fail with this patch.

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

llvm-svn: 236013

9 years agoImplemented ASTImporter support for Stmts and fixed
Sean Callanan [Tue, 28 Apr 2015 18:41:46 +0000 (18:41 +0000)]
Implemented ASTImporter support for Stmts and fixed
some bugs in the ASTImporter that this exposed:

- When importing functions, the body (if any) was
  previously ignored.  This patch ensures that the
  body is imported also.

- When a function-local Decl is imported, the first
  thing the ASTImporter does is import its context
  (via ImportDeclParts()).  This can trigger
  importing the Decl again as part of the body of
  the function (but only once, since the function's
  Decl has been added to ImportedDecls).  This patch
  fixes that problem by extending ImportDeclParts()
  to return the imported Decl if it was imported as
  part of importing its context, and the patch adds
  ASTImporter::GetAlreadyImportedOrNull() to support
  this query.  All callers of ImportDeclParts return
  the imported version of the Decl if ImportDeclParts()
  returns it.

- When creating functions, InnerLocStart of the source
  function was re-used without importing.  This is a
  straight up bug, and this patch makes ASTImporter
  import the InnerLocStart and use the imported version.

- When importing FileIDs, the ASTImporter previously
  always tried to re-load the file for the corresponding
  CacheEntry from disk.  This doesn't work if the
  CacheEntry corresponds to a named memory buffer.  This
  patch changes the code so that if the UniqueID for the
  cache entry is invalid (i.e., it is not a disk file)
  the whole entry is treated as if it were invalid, which
  forces an in-memory copy of the buffer.

Also added test cases, using the new support committed in
236011.

llvm-svn: 236012

9 years agoImplemented support for testing the ASTImporter's
Sean Callanan [Tue, 28 Apr 2015 18:24:12 +0000 (18:24 +0000)]
Implemented support for testing the ASTImporter's
ability to generate code that CodeGen likes.  Test
cases can use this functionality by calling

// RUN: %clang_cc1 -emit-obj -o /dev/null -ast-merge %t.1.ast -ast-merge %t.2.ast %s

llvm-svn: 236011

9 years agoFix typo in comment.
Nico Weber [Tue, 28 Apr 2015 18:19:18 +0000 (18:19 +0000)]
Fix typo in comment.

llvm-svn: 236010

9 years agoAdd a fixme to resetTargetOptions to explain why it needs to go
Eric Christopher [Tue, 28 Apr 2015 18:09:05 +0000 (18:09 +0000)]
Add a fixme to resetTargetOptions to explain why it needs to go
away.

llvm-svn: 236009

9 years agotsan: fix a bug memory access handling
Dmitry Vyukov [Tue, 28 Apr 2015 18:08:42 +0000 (18:08 +0000)]
tsan: fix a bug memory access handling

We incorrectly replaced shadow slots
when the new value is not stronger than the old one.
The bug can lead to false negatives.
The bug was detected by Go race test suite:
https://github.com/golang/go/issues/10589

llvm-svn: 236008

9 years agoFix a [-Werror,-Winconsistent-missing-override] problem in the
Eric Christopher [Tue, 28 Apr 2015 18:06:27 +0000 (18:06 +0000)]
Fix a [-Werror,-Winconsistent-missing-override] problem in the
NVPTX overrides.

llvm-svn: 236007

9 years agoFix PR22047: ObjC: Method unavailability attribute doesn't work with overloaded methods
Jonathan Roelofs [Tue, 28 Apr 2015 18:04:44 +0000 (18:04 +0000)]
Fix PR22047: ObjC: Method unavailability attribute doesn't work with overloaded methods

http://reviews.llvm.org/D9261

llvm-svn: 236006

9 years agoCombine instantiation context of field initializer with context of class.
Serge Pavlov [Tue, 28 Apr 2015 17:58:47 +0000 (17:58 +0000)]
Combine instantiation context of field initializer with context of class.

Inclass initializer is instantiated in its own LocalInstantiationScope. It
causes problems when instantiating local classes - when instantiation scope
is searched for DeclContext of the field, the search fails. As a solution,
the instantiation scope of field initializer is combined with its outer
scope.

This patch fixes PR23194.

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

llvm-svn: 236005

9 years agoR600: Fix up for AsmPrinter's OutStreamer being a unique_ptr
Tom Stellard [Tue, 28 Apr 2015 17:37:03 +0000 (17:37 +0000)]
R600: Fix up for AsmPrinter's OutStreamer being a unique_ptr

Fixes a crash with basically any OpenGL application using the radeonsi
driver.

Patch by: Michel Dänzer

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90176
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
llvm-svn: 236004

9 years agoR600/SI: Add a lower case alias for subtarget feature: +DumpCode
Tom Stellard [Tue, 28 Apr 2015 17:37:00 +0000 (17:37 +0000)]
R600/SI: Add a lower case alias for subtarget feature: +DumpCode

llc converts all feature strings to lower case, while the LLVM C API
does not, so we need a lower case alias in order to test this with llc.

llvm-svn: 236003

9 years agoSilencing a -Wuninitialized warning in a different way. This replaces r235981, but...
Aaron Ballman [Tue, 28 Apr 2015 17:34:38 +0000 (17:34 +0000)]
Silencing a -Wuninitialized warning in a different way. This replaces r235981, but is still NFC.

llvm-svn: 236002

9 years agoDisable clang-tools-extra/test/pp-trace/pp-trace-modules.cpp on win32 for now. Invest...
NAKAMURA Takumi [Tue, 28 Apr 2015 17:31:36 +0000 (17:31 +0000)]
Disable clang-tools-extra/test/pp-trace/pp-trace-modules.cpp on win32 for now. Investigating.

llvm-svn: 236001

9 years ago[NVPTX] Handle addrspacecast constant expressions in aggregate initializers
Justin Holewinski [Tue, 28 Apr 2015 17:18:30 +0000 (17:18 +0000)]
[NVPTX] Handle addrspacecast constant expressions in aggregate initializers

We need to track if an AddrSpaceCast expression was seen when
generating an MCExpr for a ConstantExpr.  This change introduces a
custom lowerConstant method to the NVPTX asm printer that will create
NVPTXGenericMCSymbolRefExpr nodes at the appropriate places to encode
the information that a given symbol needs to be casted to a generic
address.

llvm-svn: 236000

9 years agoFix some preprocessor directives that were generating warnings in the test suite.
Marshall Clow [Tue, 28 Apr 2015 16:52:30 +0000 (16:52 +0000)]
Fix some preprocessor directives that were generating warnings in the test suite.

llvm-svn: 235999

9 years ago[opaque pointer type] Encode the allocated type of an alloca rather than its pointer...
David Blaikie [Tue, 28 Apr 2015 16:51:01 +0000 (16:51 +0000)]
[opaque pointer type] Encode the allocated type of an alloca rather than its pointer result type.

llvm-svn: 235998

9 years agomove IR-level optimization flags into their own struct
Sanjay Patel [Tue, 28 Apr 2015 16:39:12 +0000 (16:39 +0000)]
move IR-level optimization flags into their own struct

This is a preliminary step to using the IR-level floating-point fast-math-flags in the SDAG (D8900).

In this patch, we introduce the optimization flags as their own struct. As noted in the TODO comment,
we should eventually share this data between the IR passes and the backend.

We also switch the existing nsw / nuw / exact bit functionality of the BinaryWithFlagsSDNode class to
use the new struct.

The tradeoff is that instead of using the free but limited space of SDNode's SubclassData, we add a
data member to the subclass. This means we don't have to repeat all of the get/set methods per flag,
but we're potentially adding size to all nodes of this subclassi type.

In practice on 64-bit systems (measured on Linux and MacOS X), there is no size difference between an
SDNode and BinaryWithFlagsSDNode after this change: they're both 80 bytes. This means that we had at
least one free byte to play with due to struct alignment.

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

llvm-svn: 235997

9 years agoUse a std::vector to record the offsets of the sections. NFC.
Rafael Espindola [Tue, 28 Apr 2015 15:26:21 +0000 (15:26 +0000)]
Use a std::vector to record the offsets of the sections. NFC.

llvm-svn: 235995

9 years agoAvoid an extra loop for computing the section size. NFC.
Rafael Espindola [Tue, 28 Apr 2015 15:04:09 +0000 (15:04 +0000)]
Avoid an extra loop for computing the section size. NFC.

llvm-svn: 235994

9 years agoFixed crash of variable shift inst on AVX2
Elena Demikhovsky [Tue, 28 Apr 2015 14:46:35 +0000 (14:46 +0000)]
Fixed crash of variable shift inst on AVX2

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

llvm-svn: 235993

9 years agoUpdate C++17 status; mark issues 2170, 2377, and 2408 as complete. We already do...
Marshall Clow [Tue, 28 Apr 2015 14:26:29 +0000 (14:26 +0000)]
Update C++17 status; mark issues 2170, 2377, and 2408 as complete. We already do these; no code changes necessary.

llvm-svn: 235992

9 years agoReplace sprintf with snprintf to avoid a crash.
Hafiz Abid Qadeer [Tue, 28 Apr 2015 14:16:00 +0000 (14:16 +0000)]
Replace sprintf with snprintf to avoid a crash.
During testing -data-list-register-values, I saw a crash here due to buffer overflow.
This commit should fix the crash. There is still problem with printing 1-byte register
in some cases that I will fix separately.

No regression on MI test cases.

llvm-svn: 235991

9 years ago[mips] [IAS] Do not generate redundant ORi in createLShiftOri.
Toma Tabacu [Tue, 28 Apr 2015 14:06:35 +0000 (14:06 +0000)]
[mips] [IAS] Do not generate redundant ORi in createLShiftOri.

Summary: If the immediate is 0, the ORi is pointless.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 235990

9 years agoReapply r235977 "[DebugInfo] Add debug locations to constant SD nodes"
Sergey Dmitrouk [Tue, 28 Apr 2015 14:05:47 +0000 (14:05 +0000)]
Reapply r235977 "[DebugInfo] Add debug locations to constant SD nodes"

[DebugInfo] Add debug locations to constant SD nodes

This adds debug location to constant nodes of Selection DAG and updates
all places that create constants to pass debug locations
(see PR13269).

Can't guarantee that all locations are correct, but in a lot of cases choice
is obvious, so most of them should be. At least all tests pass.

Tests for these changes do not cover everything, instead just check it for
SDNodes, ARM and AArch64 where it's easy to get incorrect locations on
constants.

This is not complete fix as FastISel contains workaround for wrong debug
locations, which drops locations from instructions on processing constants,
but there isn't currently a way to use debug locations from constants there
as llvm::Constant doesn't cache it (yet). Although this is a bit different
issue, not directly related to these changes.

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

llvm-svn: 235989

9 years agoUse CIE version 4 for dwarf4.
Rafael Espindola [Tue, 28 Apr 2015 13:55:31 +0000 (13:55 +0000)]
Use CIE version 4 for dwarf4.

According to http://www.dwarfstd.org/doc/DWARF4.pdf appendix F the CIE
version for dwarf 4 is 4.

llvm-svn: 235988

9 years agoRevert "[DebugInfo] Add debug locations to constant SD nodes"
Daniel Jasper [Tue, 28 Apr 2015 13:38:35 +0000 (13:38 +0000)]
Revert "[DebugInfo] Add debug locations to constant SD nodes"

This breaks a test:
http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/23870

llvm-svn: 235987

9 years agoAVX-512: added intrinsics for KNL and SKX
Elena Demikhovsky [Tue, 28 Apr 2015 13:28:01 +0000 (13:28 +0000)]
AVX-512: added intrinsics for KNL and SKX
by Asaf Badouh (asaf.badouh@intel.com)

llvm-svn: 235986

9 years ago[OPENMP] Fix crash on loop control vars explicitly marked as private.
Alexey Bataev [Tue, 28 Apr 2015 13:20:05 +0000 (13:20 +0000)]
[OPENMP] Fix crash on loop control vars explicitly marked as private.

It is allowed to mark loop control vars as private in 'private' or 'lastprivate' clause, so no need to assert here.

llvm-svn: 235985

9 years ago[mips] [IAS] Rename the createShiftOr function to createLShiftOri. NFC.
Toma Tabacu [Tue, 28 Apr 2015 13:16:06 +0000 (13:16 +0000)]
[mips] [IAS] Rename the createShiftOr function to createLShiftOri. NFC.

Summary: The new name is more accurate with regard to the functionality.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 235984

9 years agoAdd language option in -gdb-show command (MI)
Ilia K [Tue, 28 Apr 2015 12:51:16 +0000 (12:51 +0000)]
Add language option in -gdb-show command (MI)

Summary:
Add language option in -gdb-show command + test:
```
$ bin/lldb-mi ~/p/hello
[...]
b main
[...]
r
[...]
(gdb)
-gdb-show language
^done,value="c++"
(gdb)
quit
```

Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/

Reviewers: abidh, granata.enrico, jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, jingham, granata.enrico, clayborg, abidh

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

llvm-svn: 235983

9 years agoDon't print a type of variable in Address::Dump if it's unknown (i.e. nullptr)
Ilia K [Tue, 28 Apr 2015 12:45:57 +0000 (12:45 +0000)]
Don't print a type of variable in Address::Dump if it's unknown (i.e. nullptr)

Summary: This patch fixes dereferencing of nullptr in case when GetType() returns that.

Reviewers: jingham, granata.enrico, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, granata.enrico, clayborg, jingham

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

llvm-svn: 235982

9 years agoSilencing a spurious -Wuninitialized warning with this local; NFC.
Aaron Ballman [Tue, 28 Apr 2015 12:36:54 +0000 (12:36 +0000)]
Silencing a spurious -Wuninitialized warning with this local; NFC.

llvm-svn: 235981

9 years agotest commit
Ewan Crawford [Tue, 28 Apr 2015 12:34:19 +0000 (12:34 +0000)]
test commit

llvm-svn: 235980

9 years agoSkip TestProcessAttach.py on Linux
Pavel Labath [Tue, 28 Apr 2015 12:28:08 +0000 (12:28 +0000)]
Skip TestProcessAttach.py on Linux

The test was already XFAILed. Changing this to skip, because the test timeouts and gets flagged
as an error anyway.

llvm-svn: 235979

9 years ago[mips] [IAS] Store the expandLoadImm destination register in a variable. NFC.
Toma Tabacu [Tue, 28 Apr 2015 12:04:53 +0000 (12:04 +0000)]
[mips] [IAS] Store the expandLoadImm destination register in a variable. NFC.

Summary: This removes multiple calls to getReg() and saves us column space in the source file.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 235978

9 years ago[DebugInfo] Add debug locations to constant SD nodes
Sergey Dmitrouk [Tue, 28 Apr 2015 11:56:37 +0000 (11:56 +0000)]
[DebugInfo] Add debug locations to constant SD nodes

This adds debug location to constant nodes of Selection DAG and updates
all places that create constants to pass debug locations
(see PR13269).

Can't guarantee that all locations are correct, but in a lot of cases choice
is obvious, so most of them should be. At least all tests pass.

Tests for these changes do not cover everything, instead just check it for
SDNodes, ARM and AArch64 where it's easy to get incorrect locations on
constants.

This is not complete fix as FastISel contains workaround for wrong debug
locations, which drops locations from instructions on processing constants,
but there isn't currently a way to use debug locations from constants there
as llvm::Constant doesn't cache it (yet). Although this is a bit different
issue, not directly related to these changes.

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

llvm-svn: 235977

9 years ago[ARM/AArch64] Enforce alignment for bitfielded structs
Bradley Smith [Tue, 28 Apr 2015 11:24:54 +0000 (11:24 +0000)]
[ARM/AArch64] Enforce alignment for bitfielded structs

When creating a global variable with a type of a struct with bitfields, we must
forcibly set the alignment of the global from the RecordDecl. We must do this so
that the proper bitfield alignment makes its way down to LLVM, since clang will
mangle the bitfields into one large type.

llvm-svn: 235976

9 years ago[Msan] Fix the getline.cc test to pass on FreeBSD
Viktor Kutuzov [Tue, 28 Apr 2015 10:23:52 +0000 (10:23 +0000)]
[Msan] Fix the getline.cc test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D9251

llvm-svn: 235975

9 years agoLLDB-MI: -var-list-children with no children doesn't need a children value in the...
Bruce Mitchener [Tue, 28 Apr 2015 10:03:55 +0000 (10:03 +0000)]
LLDB-MI: -var-list-children with no children doesn't need a children value in the response.

Summary:
When using GDB with MI, if there aren't children for a variable,
it doesn't include a "children" value in the response. LLDB does
and sets it to "[]" while variables with children have an unquoted
list: children=[...].

This removes the children value entirely when there are no children
making this match GDB in behavior.

Test Plan: Ran tests on Mac OS X and they passed.

Reviewers: abidh, domipheus

Subscribers: lldb-commits

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

llvm-svn: 235974

9 years agoAVX-512: Added "pandn" intrinsics set
Elena Demikhovsky [Tue, 28 Apr 2015 08:12:42 +0000 (08:12 +0000)]
AVX-512: Added "pandn" intrinsics set
by Asaf Badouh (asaf.badouh@intel.com)

llvm-svn: 235971

9 years agoMasked gather and scatter: Added code for SelectionDAG.
Elena Demikhovsky [Tue, 28 Apr 2015 07:57:37 +0000 (07:57 +0000)]
Masked gather and scatter: Added code for SelectionDAG.
All other patches, including tests will follow.

http://reviews.llvm.org/D7665

llvm-svn: 235970

9 years ago[NativeProcessLinux] Add back synchronisation of thread create events
Pavel Labath [Tue, 28 Apr 2015 07:51:52 +0000 (07:51 +0000)]
[NativeProcessLinux] Add back synchronisation of thread create events

Summary:
Without the synchronisation between the two thread creation events the following case could
happen:
- threads A and B are running. A hits a breakpoint. We note that we want to stop B.
- before we could stop it, B creates a new thread C, we get the stop notification for B, but we
  don't record C's existence yet.
- we resume B
- before we get the C notification, B stops again (e.g. hits a breakpoint, gets our SIGSTOP,
  etc.)
- we see all known threads have stopped, and we notify LLDB
- C notification comes, we note it's existence and resume it
=> we have an inconsistent state (LLDB thinks we've stopped, but C is running)

I resolve this by doing a blocking wait for for the C notification when we get the creation
notification on the parent (B) thread. This way the two events are synchronised, but we don't
need to introduce the intermediate "launching" state which would complicate handling of thread
states as all code would need to be aware of the third possible state.

Test Plan:
This is an obscure corner case, which I had not observed in practise, so I have no
test for it. I have tested that this commit does not regress in existing tests though.

Reviewers: chaoren, vharron

Subscribers: lldb-commits

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

llvm-svn: 235969

9 years agoInstrProf: Match a bit less strictly - some targets may add signext
Justin Bogner [Tue, 28 Apr 2015 06:55:23 +0000 (06:55 +0000)]
InstrProf: Match a bit less strictly - some targets may add signext

Notably, this bot didn't like it:

  http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/5117

llvm-svn: 235968

9 years agoInstrProf: Mark code regions after throw expressions as unreachable
Justin Bogner [Tue, 28 Apr 2015 06:31:55 +0000 (06:31 +0000)]
InstrProf: Mark code regions after throw expressions as unreachable

We weren't setting regions as being unreachable after C++ throw
expressions, leading to incorrect count propagations.

llvm-svn: 235967

9 years ago[opaque pointer type] Encode the pointee type in the bitcode for 'cmpxchg'
David Blaikie [Tue, 28 Apr 2015 04:30:29 +0000 (04:30 +0000)]
[opaque pointer type] Encode the pointee type in the bitcode for 'cmpxchg'

As a space optimization, this instruction would just encode the pointer
type of the first operand and use the knowledge that the second and
third operands would be of the pointee type of the first. When typed
pointers go away, this assumption will no longer be available - so
encode the type of the second operand explicitly and rely on that for
the third.

Test case added to demonstrate the backwards compatibility concern,
which only comes up when the definition of the second operand comes
after the use (hence the weird basic block sequence) - at which point
the type needs to be explicitly encoded in the bitcode and the record
length changes to accommodate this.

llvm-svn: 235966