Commit Graph

195758 Commits

Author SHA1 Message Date
Aaron Ballman f00fd1f087 Removing dead code to silence warning C4060: switch statement contains no 'case' or 'default' labels; NFC.
llvm-svn: 231785
2015-03-10 13:56:28 +00:00
Karthik Bhat 8d0099bdab Fix a crash in Dependency Analysis.
This crash in Dependency analysis is because we assume here that in case of UsefulGEP
both source and destination have the same number of operands which may not be true.
This incorrect assumption results in crash while populating Pairs. Fix the same.

This crash was observed during lnt regression for code such as-
  struct s{
    int A[10][10];
    int C[10][10][10]; 
  } S;
  void dep_constraint_crash_test(int k,int N)  {
     for( int i=0;i<N;i++)
       for( int j=0;j<N;j++)
         S.A[0][0] = S.C[0][0][k];
  }
Review: http://reviews.llvm.org/D8162

llvm-svn: 231784
2015-03-10 13:31:03 +00:00
Daniel Sanders 2db94ba0bc The operand flag word used in ISD::INLINEASM is an i32 not a pointer. NFC.
Summary:
This is part of the work to support memory constraints that behave
differently to 'm'. The subsequent patches will expand on the existing
encoding (which is a 32-bit int) and as a result in some flag words will no
longer fit into an i16. This problem only affected the MSP430 target which
appears to have 16-bit pointers.

Reviewers: hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, llvm-commits

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

llvm-svn: 231783
2015-03-10 10:42:59 +00:00
Dmitry Vyukov 2d78c6371d asan: fix leak test for power platform
Power is 64-bit but does not support leak detection,
so this test fails. Use the more robust leak-detection
predicate instead.

llvm-svn: 231782
2015-03-10 10:36:06 +00:00
Andrey Churbanov d39f11c026 fix for broken commit 231774
llvm-svn: 231781
2015-03-10 10:14:57 +00:00
Ed Schouten 911040f19e Also use LC_C_LOCALE on CloudABI.
Before I discovered that NetBSD provides a permanent handle to the C
locale called LC_C_LOCALE, I also added support for this to CloudABI
under the name LC_POSIX_LOCALE. I've renamed it to LC_C_LOCALE to
improve compatibility.

llvm-svn: 231780
2015-03-10 09:35:22 +00:00
Andrey Churbanov 16a1432176 issuing of incorrect warning fixed
llvm-svn: 231779
2015-03-10 09:34:38 +00:00
Andrey Churbanov 2b8ecbeeb6 cleanup: removed unused function __kmp_change_thread_affinity_mask
llvm-svn: 231778
2015-03-10 09:31:21 +00:00
Ed Schouten 510b6ab07c Enable _LIBCPP_LOCALE__L_EXTENSIONS on CloudABI.
CloudABI provides the _l() functions that are part of POSIX.1-2008, but
also the extensions that are available on systems like OS X and *BSD
(scanf_l, printf_l, etc).

llvm-svn: 231777
2015-03-10 09:26:38 +00:00
Andrey Churbanov 94e569e0e6 proc_bind_disabled enum value removed, its usage replased with proc_bind_false
llvm-svn: 231776
2015-03-10 09:19:47 +00:00
Andrey Churbanov 1f037e495a cleanup: usages of mask size wrapped into macros
llvm-svn: 231775
2015-03-10 09:15:26 +00:00
Andrey Churbanov 7b2ab719fe Adding some 8-bit atomic operations for future use
llvm-svn: 231774
2015-03-10 09:03:42 +00:00
Andrey Churbanov 128755741f changed unsigned types to signed - caused by comments of Hal Finkel on one of earlier patches
llvm-svn: 231773
2015-03-10 09:00:36 +00:00
Chandler Carruth 96f02da75a The LLD tests require 'llvm-nm' to run as well, ensure that this is
built before running the test suite.

llvm-svn: 231770
2015-03-10 08:08:58 +00:00
Chandler Carruth 8300c76b15 Don't write output to 'a.out', write it to a temporary file. This fixes
the test when run frem a read-only checkout of the source tree.

llvm-svn: 231769
2015-03-10 08:06:49 +00:00
Ed Schouten cda27e8197 Don't include <sys/sysctl.h> on CloudABI.
As CloudABI does not provide sysctl(), this header is not present. Make
thread.cpp build correctly (and pass all tests) by not including the header.

llvm-svn: 231768
2015-03-10 08:01:10 +00:00
Ed Schouten c19393c758 Print log/error messages on stderr, not stdout
There are a couple of places where libc++ prints log/error messages to
stdout on its own. This may of course interfere with the output
generated with applications. Log/error messages should be directed to
stderr instead.

Differential Revision:	http://reviews.llvm.org/D8135
Reviewed by:	marshall

llvm-svn: 231767
2015-03-10 07:57:43 +00:00
Chandler Carruth 1bdbf48fff Fix the local variable naming I used in r231765 to follow the LLD coding
conventions. Sorry for missing this before I committed the patch!

llvm-svn: 231766
2015-03-10 07:54:34 +00:00
Chandler Carruth b952e2287b Fix a bug where the code would use subscript a std::vector with the size
of the vector. For a vector 'v', '&v[v.size()]' isn't a valid way to
compute a pointer one-past-the-end of the vector. Instead, write the
loop in terms of iterators and save the beginning iterator. Once we have
that we can compute the beginning pointer from the beginning iterator,
and compute the distance which we should increment the beginning pointer
by subtracting the iterators.

What might be simpler would be to convert the function accepting a raw
pointer for begin and end to accept iterators or a range or some other
construct, but I wanted to keep this to a minimal bug-fix change.

This fixes a crash on any debug STL implementation which checks for
indexing out of bounds.

llvm-svn: 231765
2015-03-10 07:53:02 +00:00
Ed Schouten 17f5dbef9b Add support for arc4random() to random_device.
Nuxi CloudABI (https://github.com/NuxiNL/cloudlibc) does not allow
processes to access the global filesystem namespace. This breaks
random_device, as it attempts to use /dev/{u,}random. This change adds
support for arc4random(), which is present on CloudABI.

In my opinion it would also make sense to use arc4random() on other
operating systems, such as *BSD and Mac OS X, but I'd rather leave that
to the maintainers of the respective platforms. Switching to
arc4random() does change the ABI.

This change also attempts to make some cleanups to the code. It adds a
single #define for every random interface, instead of testing against
operating systems explicitly.

As discussed, also validate the token argument to be equal to
"/dev/urandom" on all systems that only provide pseudo-random numbers.
This should cause little to no breakage, as "/dev/urandom" is also the
default argument value.

Reviewed by: jfb
Differential Revision: http://reviews.llvm.org/D8134

llvm-svn: 231764
2015-03-10 07:46:06 +00:00
Yaron Keren 09fb7c6e7a Teach raw_ostream to accept SmallString.
Saves adding .str() call to any raw_ostream << SmallString usage
and a small step towards making .str() consistent in the ADTs by
removing one of the SmallString::str() use cases, discussion at

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141013/240026.html

I'll update the Phabricator patch http://reviews.llvm.org/D6372
for review of the Twine SmallString support, it's more complex
than this one.

llvm-svn: 231763
2015-03-10 07:33:23 +00:00
Alexey Bataev 62b63b197d [OPENMP] Initial codegen for 'omp task' directive.
The task region is emmitted in several steps:

Emit a call to kmp_task_t *__kmpc_omp_task_alloc(ident_t *, kmp_int32 gtid, kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds, kmp_routine_entry_t *task_entry).
Here task_entry is a pointer to the function:
kmp_int32 .omp_task_entry.(kmp_int32 gtid, kmp_task_t *tt) {
    TaskFunction(gtid, tt->part_id, tt->shareds);
      return 0;
}
Copy a list of shared variables to field shareds of the resulting structure kmp_task_t returned by the previous call (if any).
Copy a pointer to destructions function to field destructions of the resulting structure kmp_task_t.
Emit a call to kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32 gtid, kmp_task_t *new_task), where new_task is a resulting structure from previous items.
Differential Revision: http://reviews.llvm.org/D7560

llvm-svn: 231762
2015-03-10 07:28:44 +00:00
Owen Anderson 58364dc4da Fix a crash in InstCombine where we could try to truncate a switch comparison to zero width.
llvm-svn: 231761
2015-03-10 06:51:39 +00:00
Owen Anderson e90f992b21 Fix a stack overflow in the assembler when checking that GEPs must be over sized types.
We failed to use a marking set to properly handle recursive types, which caused use
to recurse infinitely and eventually overflow the stack.

llvm-svn: 231760
2015-03-10 06:34:57 +00:00
Owen Anderson 3e7e67b5ed Fix an issue in the verifier where we could try to read information out of a malformed statepoint intrinsic.
In this situation we would always have already flagged an error on the statepoint intrinsic,
but then we carry on to parse other, related GC intrinsics, and could end up crashing during that
verification when they try to access data from the malformed statepoint.

llvm-svn: 231759
2015-03-10 05:58:21 +00:00
Alexey Bataev da19af4f42 [OPENMP] Fixed tests for non-debug builds. NFC.
llvm-svn: 231758
2015-03-10 05:28:46 +00:00
Alexey Bataev 36bf011e83 [OPENMP] Improved code for generating debug info + generation of all OpenMP regions in termination scope
Patch adds proper generation of debug info for all OpenMP regions. Also, all OpenMP regions are generated in a termination scope, because standard does not allow to throw exceptions out of structured blocks, associated with the OpenMP regions
Differential Revision: http://reviews.llvm.org/D7935

llvm-svn: 231757
2015-03-10 05:15:26 +00:00
Rui Ueyama 81ad639ed3 Use template aliases.
We dropped Visual Studio 2012 support, so we can use template aliases.

llvm-svn: 231756
2015-03-10 05:14:24 +00:00
Owen Anderson 51b75b8c34 Fix an infinite loop in InstCombine when an instruction with no users and side effects can be constant folded.
ReplaceInstUsesWith needs to return nullptr when the input has no users,
because in that case it does not mutate the program.  Otherwise, we can
get stuck in an infinite loop of repeatedly attempting to constant fold
and instruction with no users.

llvm-svn: 231755
2015-03-10 05:13:47 +00:00
Rafael Espindola eb26ddf559 Revert "[OPENMP] Improved code for generating debug info + generation of all OpenMP regions in termination scope Patch adds proper generation of debug info for all OpenMP regions. Also, all OpenMP regions are generated in a termination scope, because standard does not allow to throw exceptions out of structured blocks, associated with the OpenMP regions Differential Revision: http://reviews.llvm.org/D7935"
This reverts commit r231752.

It was failing to link with cmake:

lib64/libclangCodeGen.a(CGOpenMPRuntime.cpp.o):/home/espindola/llvm/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:function clang::CodeGen::InlinedOpenMPRegionRAII::~InlinedOpenMPRegionRAII(): error: undefined reference to 'clang::CodeGen::EHScopeStack::popTerminate()'
clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)

llvm-svn: 231754
2015-03-10 04:40:21 +00:00
Rafael Espindola c63a98a662 Move variable into assert to fix -Asserts builds.
llvm-svn: 231753
2015-03-10 04:28:09 +00:00
Alexey Bataev 7ab2cc178f [OPENMP] Improved code for generating debug info + generation of all OpenMP regions in termination scope
Patch adds proper generation of debug info for all OpenMP regions. Also, all OpenMP regions are generated in a termination scope, because standard does not allow to throw exceptions out of structured blocks, associated with the OpenMP regions
Differential Revision: http://reviews.llvm.org/D7935

llvm-svn: 231752
2015-03-10 04:22:11 +00:00
Rafael Espindola 760bf9520a Remove incredibly confusing isBaseAddressKnownZero.
When referring to a symbol in a dwarf section on ELF we should use

.long foo

instead of

.long foo - .debug_something

because ELF is unaware of the content of the sections and therefore needs
relocations. This has nothing to do with optimizing a -0.

llvm-svn: 231751
2015-03-10 04:11:52 +00:00
Rafael Espindola fcc2821882 Use a better name for compile unit labels.
They mark the start of a compile unit, so name them .Lcu_*. Using
Section->getLabelBeginName() makes it looks like they mark the start of the
section.

While at it, switch to createTempSymbol to avoid collisions with labels
created in inline assembly. Not sure if a "don't crash" test is worth it.

With this getLabelBeginName is dead, delete it.

llvm-svn: 231750
2015-03-10 03:58:36 +00:00
Sanjay Patel d45a3f1a03 removed function names from comments; NFC
llvm-svn: 231749
2015-03-10 03:48:14 +00:00
Frederic Riss 44a219f0a0 DwarfAccelTable: remove unneeded bucket terminators.
Last commit fixed the handling of hash collisions, but it introdcuced
unneeded bucket terminators in some places. The generated table was
correct, it can just be a tiny bit smaller. As the previous table was
correct, the test doesn't need updating. If we really wanted to test
this, I could add the section size to the dwarf dump and test for a
precise value there. IMO the correctness test is sufficient.

llvm-svn: 231748
2015-03-10 03:47:55 +00:00
Sanjay Patel c6012545fa use range-based for loops; NFC
llvm-svn: 231747
2015-03-10 03:26:39 +00:00
Craig Topper 7bbd37b277 Improve and simplify EnforceSmallerThan for vector types.
Explicitly compare the size of the scalar types and the whole vector size rather than just comparing enum encodings.

llvm-svn: 231746
2015-03-10 03:25:07 +00:00
Craig Topper 0d1fb90e3c Remove extra indentation of entire function body. NFC.
llvm-svn: 231745
2015-03-10 03:25:04 +00:00
Rafael Espindola 3c31114824 Move label creation close to emission. NFC.
llvm-svn: 231744
2015-03-10 03:11:11 +00:00
George Burgess IV ab03af277b Added ConstantExpr support to CFLAA.
CFLAA didn't know how to properly handle ConstantExprs; it would silently
ignore them. This was a problem if the ConstantExpr is, say, a GEP of a global,
because CFLAA wouldn't realize that there's a global there. :)

llvm-svn: 231743
2015-03-10 02:58:15 +00:00
Richard Smith 202850a025 [modules] Don't bother looking up a declaration to merge into if we're not
actually loading a formerly-canonical declaration.

llvm-svn: 231742
2015-03-10 02:57:50 +00:00
George Burgess IV b54a8d62a4 Added special handling for inttoptr in CFLAA.
We now treat pointers given to ptrtoint and pointers retrieved from
inttoptr as similar to arguments or globals (can alias anything, etc.)

This solves some of the problems we were having with giving incorrect
results.

llvm-svn: 231741
2015-03-10 02:40:06 +00:00
Mehdi Amini a28d91d81b DataLayout is mandatory, update the API to reflect it with references.
Summary:
Now that the DataLayout is a mandatory part of the module, let's start
cleaning the codebase. This patch is a first attempt at doing that.

This patch is not exactly NFC as for instance some places were passing
a nullptr instead of the DataLayout, possibly just because there was a
default value on the DataLayout argument to many functions in the API.
Even though it is not purely NFC, there is no change in the
validation.

I turned as many pointer to DataLayout to references, this helped
figuring out all the places where a nullptr could come up.

I had initially a local version of this patch broken into over 30
independant, commits but some later commit were cleaning the API and
touching part of the code modified in the previous commits, so it
seemed cleaner without the intermediate state.

Test Plan:

Reviewers: echristo

Subscribers: llvm-commits

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 231740
2015-03-10 02:37:25 +00:00
Mehdi Amini b3d5209927 Update for LLVM API change: getOrEnforceKnownAlignment() requires a DataLayout
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 231739
2015-03-10 02:36:43 +00:00
Richard Smith 80969754b7 PR21687: when adding a redeclaration of a function with an implicit exception
specification, update all prior declarations if the new one has an explicit
exception specification and the prior ones don't.

Patch by Vassil Vassilev! Some minor tweaking and test case by me.

llvm-svn: 231738
2015-03-10 02:00:53 +00:00
Oleksiy Vyalov 4eab4bc23c Restore commented setTearDownCleanup in TestHelloWorld.test_with_dwarf_and_attach_to_process_with_id_api.
llvm-svn: 231737
2015-03-10 01:58:47 +00:00
Kostya Serebryany 48a4023f40 [sanitizer] fix instrumentation with -mllvm -sanitizer-coverage-block-threshold=0 to actually do something useful.
llvm-svn: 231736
2015-03-10 01:58:27 +00:00
Richard Smith f81340096d [modules] Don't clobber a destructor's operator delete when adding another one;
move the operator delete updating into a separate update record so we can cope
with updating another module's destructor's operator delete.

llvm-svn: 231735
2015-03-10 01:41:22 +00:00
Oleksiy Vyalov 63acdfdeb2 Add Utility/ModuleCache class and integrate it with PlatformGDBRemoteServer - in order to allow modules caching from remote targets.
http://reviews.llvm.org/D8037

llvm-svn: 231734
2015-03-10 01:15:28 +00:00