platform/upstream/llvm.git
9 years agoWhen reporting constraints that should be constant, the type doesn't
Joerg Sonnenberger [Thu, 22 Jan 2015 21:01:00 +0000 (21:01 +0000)]
When reporting constraints that should be constant, the type doesn't
really help. Improve diagnostics.

llvm-svn: 226863

9 years agoDon't use -z,defs on FreeBSD.
Rafael Espindola [Thu, 22 Jan 2015 20:57:30 +0000 (20:57 +0000)]
Don't use -z,defs on FreeBSD.

Looks like environ is defined only in the main binary.

llvm-svn: 226862

9 years ago[emacs] Use c-mode-common-hook, derive from "gnu"
Ramkumar Ramachandra [Thu, 22 Jan 2015 20:56:25 +0000 (20:56 +0000)]
[emacs] Use c-mode-common-hook, derive from "gnu"

Make it clear that the "llvm.org" style is deriving from "gnu" style,
and use the c-mode-common-hook instead of c-mode-hook and c++-mode-hook.

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

llvm-svn: 226861

9 years agoReplace more runCmd('continue') with process control API.
Enrico Granata [Thu, 22 Jan 2015 20:53:04 +0000 (20:53 +0000)]
Replace more runCmd('continue') with process control API.

llvm-svn: 226860

9 years agoChange wildcard . to literal . in regex for copying python.
Zachary Turner [Thu, 22 Jan 2015 20:30:29 +0000 (20:30 +0000)]
Change wildcard . to literal . in regex for copying python.

On Windows we copy python27(_d).dll to the bin directory.  We do
this by looking at the PYTHON_LIBRARY specified by the user, which
is something like C:\foo\python27_d.lib, and replacing ".lib" with
".dll".  But ".lib" as a regex will also match "flib", etc.  So
make this a literal . instead of a wildcard .

llvm-svn: 226858

9 years agoIntrinsics: introduce llvm_any_ty aka ValueType Any
Ramkumar Ramachandra [Thu, 22 Jan 2015 20:14:38 +0000 (20:14 +0000)]
Intrinsics: introduce llvm_any_ty aka ValueType Any

Specifically, gc.result benefits from this greatly. Instead of:

gc.result.int.*
gc.result.float.*
gc.result.ptr.*
...

We now have a gc.result.* that can specialize to literally any type.

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

llvm-svn: 226857

9 years agoMake OSX test run firewall friendly.
Oleksiy Vyalov [Thu, 22 Jan 2015 20:03:21 +0000 (20:03 +0000)]
Make OSX test run firewall friendly.

http://reviews.llvm.org/D7115

llvm-svn: 226856

9 years ago[libcxxabi] Teach CMake better ways to find the libc++ source directory (and misc...
Eric Fiselier [Thu, 22 Jan 2015 20:00:06 +0000 (20:00 +0000)]
[libcxxabi] Teach CMake better ways to find the libc++ source directory (and misc cleanup).

Summary:
The main section of this patch teaches CMake  a new option `LIBCXXABI_LIBCXX_PATH` that specifies the path to the libcxx source root. This information is passed to lit so that it can better find libc++'s python module. `LIBCXXABI_LIBCXX_PATH` is also used to help find the libc++ headers.

The rest of this patch is misc cleanup, mostly to make pep8 and pylint happy.
I've also copied libc++'s .gitignore into libc++abi.

Reviewers: jroelofs, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 226855

9 years agoAdd a benchmark test case that shows how much slower repeat 'continue' commands are...
Enrico Granata [Thu, 22 Jan 2015 19:33:53 +0000 (19:33 +0000)]
Add a benchmark test case that shows how much slower repeat 'continue' commands are than going through the SB API directly

llvm-svn: 226852

9 years agoError::Clear() should reset the type to invalid instead of generic.
Zachary Turner [Thu, 22 Jan 2015 19:30:05 +0000 (19:30 +0000)]
Error::Clear() should reset the type to invalid instead of generic.

This matches the behavior of the default constructor, so is
technically more correct.

Patch by Chaoren Lin
Differential Revision: http://reviews.llvm.org/D7113

llvm-svn: 226851

9 years agoRevert "Don't remove a landing pad if the invoke requires a table entry."
Reid Kleckner [Thu, 22 Jan 2015 19:29:46 +0000 (19:29 +0000)]
Revert "Don't remove a landing pad if the invoke requires a table entry."

This reverts commit r176827.

Björn Steinbrink pointed out that this didn't actually fix the bug
(PR15555) it was attempting to fix.

With this reverted, we can now remove landingpad cleanups that
immediately resume unwinding, converting the invoke to a call.

llvm-svn: 226850

9 years agoDon't stomp the triple when loading a PECOFF target.
Zachary Turner [Thu, 22 Jan 2015 18:59:05 +0000 (18:59 +0000)]
Don't stomp the triple when loading a PECOFF target.

When you create a target, it tries to look for the platform's list
of supported architectures for a match.  The match it finds can
contain specific triples, like i386-pc-windows-msvc.  Later, we
overwrite this value with the most generic triple that can apply
to any platform with COFF support, causing some of the fields of
the triple to get overwritten.

This patch changes the behavior to only merge in values from the COFF
triple if the fields of the matching triple were unknown/unspecified
to begin with.

This fixes load address resolution on Windows, since it enables the
DynamicLoaderWindows to be used instead of DynamicLoaderStatic.

Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D7120

llvm-svn: 226849

9 years agoAdd the option, -indirect-symbols, used with -macho to print the Mach-O indirect...
Kevin Enderby [Thu, 22 Jan 2015 18:55:27 +0000 (18:55 +0000)]
Add the option, -indirect-symbols, used with -macho to print the Mach-O indirect symbol table to llvm-objdump.

llvm-svn: 226848

9 years agoFix PR#22284. Add a new overload to deque::insert to handle forward iterators. Update...
Marshall Clow [Thu, 22 Jan 2015 18:33:29 +0000 (18:33 +0000)]
Fix PR#22284. Add a new overload to deque::insert to handle forward iterators. Update tests to exercise this case.

llvm-svn: 226847

9 years agoFix the -*-version-min option to not try and use the current OS version for iOS and...
Greg Clayton [Thu, 22 Jan 2015 18:25:49 +0000 (18:25 +0000)]
Fix the -*-version-min option to not try and use the current OS version for iOS and the simulator since llvm/clang will assert and kill LLDB.

llvm-svn: 226846

9 years agomerge consecutive stores of extracted vector elements (PR21711)
Sanjay Patel [Thu, 22 Jan 2015 18:21:26 +0000 (18:21 +0000)]
merge consecutive stores of extracted vector elements (PR21711)

This is a 2nd try at the same optimization as http://reviews.llvm.org/D6698.
That patch was checked in at r224611, but reverted at r225031 because it
caused a failure outside of the regression tests.

The cause of the crash was not recognizing consecutive stores that have mixed
source values (loads and vector element extracts), so this patch adds a check
to bail out if any store value is not coming from a vector element extract.

This patch also refactors the shared logic of the constant source and vector
extracted elements source cases into a helper function.

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

llvm-svn: 226845

9 years ago[libcxx] Allow use of ShTest in libc++ tests along with other changes.
Eric Fiselier [Thu, 22 Jan 2015 18:05:58 +0000 (18:05 +0000)]
[libcxx] Allow use of ShTest in libc++ tests along with other changes.

Summary:
This patch allows the use of LIT's ShTest format in the libc++ test suite. ShTests have the suffix '.sh.cpp'. It also introduces a series of other changes. These changes are:

- More functionality including parsing test metadata has been moved into LIT.
- LibcxxTestFormat now supports multi-part suffixes.
- the `CXXCompiler` functionality has been used to shrink the size of LibcxxTestFormat.
- The recursive loading of the site config has been turned into `libcxx.test.config.loadSiteConfig` so it can be used with libc++abi.
- Temporary files are now created in the build directory of libc++. This follows how it is down in ShTest.
- `not.py` was added as a utility executable that mirrors the functionality of LLVM's `not` executable.
- The first ShTest test was added under test/libcxx/double_include.sh.cpp

Reviewers: jroelofs, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 226844

9 years agoFix the condition in this assertion, and also make it into an unreachable.
Adrian Prantl [Thu, 22 Jan 2015 17:52:08 +0000 (17:52 +0000)]
Fix the condition in this assertion, and also make it into an unreachable.

llvm-svn: 226843

9 years agoRevert "PR21408: Workaround the appearance of duplicate variables due to problems...
David Blaikie [Thu, 22 Jan 2015 17:49:59 +0000 (17:49 +0000)]
Revert "PR21408: Workaround the appearance of duplicate variables due to problems when inlining two calls to the same function from the same call site."

The underlying bug has been fixed in r226736 so there's no need to
workaround this anymore.

This reverts commit r220923.

llvm-svn: 226842

9 years agoAArch64: decode all MRS/MSR forms early to avoid saving FeatureBits.
Tim Northover [Thu, 22 Jan 2015 17:23:04 +0000 (17:23 +0000)]
AArch64: decode all MRS/MSR forms early to avoid saving FeatureBits.

Currently, we're adding a uint64_t describing the current subtarget so
that matching can check whether the specified register is valid.
However, we want to move to a bitset for those bits (x86 has more than
64 of them).

This can't live in a union so it's probably better to do the checks
early (especially as there are only 3 of them).

llvm-svn: 226841

9 years agoRun clang-format on parts of DebugInfo.h
Adrian Prantl [Thu, 22 Jan 2015 16:55:27 +0000 (16:55 +0000)]
Run clang-format on parts of DebugInfo.h

llvm-svn: 226838

9 years agoDocument DIExpression.
Adrian Prantl [Thu, 22 Jan 2015 16:55:24 +0000 (16:55 +0000)]
Document DIExpression.

llvm-svn: 226837

9 years agoRewrite DIExpression::printInternal() to use the iterator interface.
Adrian Prantl [Thu, 22 Jan 2015 16:55:22 +0000 (16:55 +0000)]
Rewrite DIExpression::printInternal() to use the iterator interface.
NFC.

llvm-svn: 226836

9 years agoRename DIExpressionIterator to DIExpression::iterator.
Adrian Prantl [Thu, 22 Jan 2015 16:55:20 +0000 (16:55 +0000)]
Rename DIExpressionIterator to DIExpression::iterator.
Addresses review feedback from Duncan.

llvm-svn: 226835

9 years agoFix a comment.
Adrian Prantl [Thu, 22 Jan 2015 16:55:16 +0000 (16:55 +0000)]
Fix a comment.

llvm-svn: 226834

9 years ago[sanitizer] Move sched_getparam test under Linux/.
Evgeniy Stepanov [Thu, 22 Jan 2015 15:34:50 +0000 (15:34 +0000)]
[sanitizer] Move sched_getparam test under Linux/.

llvm-svn: 226832

9 years ago[ASan/Win] Fix PR20944 -- run ASan gtests as part of check-asan on Windows
Timur Iskhodzhanov [Thu, 22 Jan 2015 14:54:22 +0000 (14:54 +0000)]
[ASan/Win] Fix PR20944 -- run ASan gtests as part of check-asan on Windows

llvm-svn: 226831

9 years ago[pr21886] Change MCJIT/ELF to support MSVC C++ mangled symbol.
Rafael Espindola [Thu, 22 Jan 2015 14:20:45 +0000 (14:20 +0000)]
[pr21886] Change MCJIT/ELF to support MSVC C++ mangled symbol.

The ELF format is used on Windows by the MCJIT engine. Thus, on Windows, the
ELFObjectWriter can encounter symbols mangled using the MS Visual Studio C++
name mangling. Symbols mangled using the MSVC C++ name mangling can legally
have "@@@" as a substring. The EFLObjectWriter should not interpret the "@@@"
substring as specifying GNU-style symbol versioning. The ELFObjectWriter
therefore check for the MSVC C++ name mangling prefix which is either "?", "@?",
"imp_?" or "imp_?@".

llvm-svn: 226830

9 years agotsan: use hacky call only on x86_64
Dmitry Vyukov [Thu, 22 Jan 2015 14:13:56 +0000 (14:13 +0000)]
tsan: use hacky call only on x86_64

required for mips64 and aarch64 ports

llvm-svn: 226829

9 years agoPass -Wl,-z,defs when building shared libraries, but not with the sanitizers.
Rafael Espindola [Thu, 22 Jan 2015 14:06:51 +0000 (14:06 +0000)]
Pass -Wl,-z,defs when building shared libraries, but not with the sanitizers.

llvm-svn: 226828

9 years ago[sanitizer] Intercept sched_getparam.
Evgeniy Stepanov [Thu, 22 Jan 2015 14:03:07 +0000 (14:03 +0000)]
[sanitizer] Intercept sched_getparam.

llvm-svn: 226827

9 years agoSilencing a -Wsign-compare warning (all uses of this constant are within unsigned...
Aaron Ballman [Thu, 22 Jan 2015 13:57:41 +0000 (13:57 +0000)]
Silencing a -Wsign-compare warning (all uses of this constant are within unsigned expressions anyway); NFC.

llvm-svn: 226826

9 years ago[sanitizer] Fix windows build.
Evgeniy Stepanov [Thu, 22 Jan 2015 13:47:12 +0000 (13:47 +0000)]
[sanitizer] Fix windows build.

llvm-svn: 226825

9 years agoEnable backtrace_test for ARM.
Logan Chien [Thu, 22 Jan 2015 13:40:16 +0000 (13:40 +0000)]
Enable backtrace_test for ARM.

llvm-svn: 226824

9 years agoAdd -funwind-tables to CMAKE_C_FLAGS.
Logan Chien [Thu, 22 Jan 2015 13:39:08 +0000 (13:39 +0000)]
Add -funwind-tables to CMAKE_C_FLAGS.

Without -funwind-tables, the compiler won't generate the unwinding
table for these C functions.  However, the functions in libunwind,
such as `_Unwind_Backtrace()`, WILL unwind stack to get the backtrace.

llvm-svn: 226823

9 years agoForce unwind frame with user-defined personality.
Logan Chien [Thu, 22 Jan 2015 13:38:11 +0000 (13:38 +0000)]
Force unwind frame with user-defined personality.

If libcxxabi is compiled as a shared library, and the
executable references the user-defined personality routines
(e.g.  __gxx_personality_v0), then the pointer comparison in
Unwind-EHABI.cpp won't work.  This is due to the fact that
the PREL31 will point to the PLT stubs for the personality
routines (in the executable), while the __gxx_personality_v0
symbol reference is yet another (different) PLT stub (in the
libunwind.)

This will cause _Unwind_Backtrace() stops to unwind the frame
whenever it reaches __gxx_personality_v0().  This CL fix the
problem by calling the user-defined personality routines
with an undocumented API for force unwinding.

llvm-svn: 226822

9 years ago[msan] Better use-after-free reports.
Evgeniy Stepanov [Thu, 22 Jan 2015 13:33:16 +0000 (13:33 +0000)]
[msan] Better use-after-free reports.

By attaching an extra integer tag to heap origins, we are able
to distinguish between uninits
 - created by heap allocation,
 - created by heap deallocation (i.e. use-after-free),
 - created by __msan_allocated_memory call,
 - etc.

See https://code.google.com/p/memory-sanitizer/issues/detail?id=35.

llvm-svn: 226821

9 years agoFix _Unwind_Backtrace for libc++abi built with libgcc.
Logan Chien [Thu, 22 Jan 2015 13:28:39 +0000 (13:28 +0000)]
Fix _Unwind_Backtrace for libc++abi built with libgcc.

Implement an undocumented _US_FORCE_UNWIND flag for force
unwinding.

llvm-svn: 226820

9 years agoAllow libc++abi to be built without unwinder.
Logan Chien [Thu, 22 Jan 2015 13:27:36 +0000 (13:27 +0000)]
Allow libc++abi to be built without unwinder.

This CL adds a new compilation flags LIBCXXABI_USE_LLVM_UNWINDER
to specify whether the LLVM unwinder is enabled.  Besides, all
unwinder-specific code are guarded with this definition.

Now, libc++abi will be able to use the unwinding routine from libgcc
when LIBCXXABI_USE_LLVM_UNWINDER is disabled.

llvm-svn: 226819

9 years agoRemove _Unwind_{Get,Set}{GR,IP} from ARM EHABI build.
Logan Chien [Thu, 22 Jan 2015 13:25:55 +0000 (13:25 +0000)]
Remove _Unwind_{Get,Set}{GR,IP} from ARM EHABI build.

This commit partially reverts r219629.

This functions are not a part of ARM EHABI specification, and AFAIK,
the de facto implementation does not export these functions.

Without this change, any programs compiled with this unwind.h
will be incompatible with other implementations due to linkage
error.

llvm-svn: 226818

9 years agoReplace size call with empty call where appripriate in clang/tools/extra
Alexander Kornienko [Thu, 22 Jan 2015 13:14:29 +0000 (13:14 +0000)]
Replace size call with empty call where appripriate in clang/tools/extra

This patch is the result of applying fixes of the ContainerSizeEmpty Clang-Tidy
checker which was committed recently.

http://reviews.llvm.org/D7085

Patch by Gábor Horváth!

llvm-svn: 226817

9 years ago[DAGCombine] Produce better code for constant splats
Michael Kuperstein [Thu, 22 Jan 2015 13:07:28 +0000 (13:07 +0000)]
[DAGCombine] Produce better code for constant splats

This solves PR22276.
Splats of constants would sometimes produce redundant shuffles, sometimes ridiculously so (see the PR for details). Fold these shuffles into BUILD_VECTORs early on instead.

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

Fixed recommit of r226811.

llvm-svn: 226816

9 years agoMark |TLI| variables used to suppress -Wunused-variable warnings.
Alexander Potapenko [Thu, 22 Jan 2015 13:03:33 +0000 (13:03 +0000)]
Mark |TLI| variables used to suppress -Wunused-variable warnings.
(These vars are only used in assertions)

llvm-svn: 226815

9 years agoRevert r226811, MSVC accepts code sane compilers don't.
Michael Kuperstein [Thu, 22 Jan 2015 12:48:07 +0000 (12:48 +0000)]
Revert r226811, MSVC accepts code sane compilers don't.

llvm-svn: 226814

9 years agoSema: Add FIXME note
Francisco Lopes da Silva [Thu, 22 Jan 2015 12:41:44 +0000 (12:41 +0000)]
Sema: Add FIXME note

llvm-svn: 226813

9 years ago[clang-tidy] Use actual LangOptions.
Alexander Kornienko [Thu, 22 Jan 2015 12:40:47 +0000 (12:40 +0000)]
[clang-tidy] Use actual LangOptions.

llvm-svn: 226812

9 years ago[DAGCombine] Produce better code for constant splats
Michael Kuperstein [Thu, 22 Jan 2015 12:37:23 +0000 (12:37 +0000)]
[DAGCombine] Produce better code for constant splats

This solves PR22276.
Splats of constants would sometimes produce redundant shuffles, sometimes ridiculously so (see the PR for details). Fold these shuffles into BUILD_VECTORs early on instead.

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

llvm-svn: 226811

9 years ago[clang-tidy] Minor cleanups in readability-container-size-empty checker
Alexander Kornienko [Thu, 22 Jan 2015 12:27:09 +0000 (12:27 +0000)]
[clang-tidy] Minor cleanups in readability-container-size-empty checker

  * Removed an unused header
  * Simplified the custom ast_matchers

http://reviews.llvm.org/D7088

Patch by Gábor Horváth!

llvm-svn: 226810

9 years ago[ASan/Win] Move the shadow to 0x30000000
Timur Iskhodzhanov [Thu, 22 Jan 2015 12:24:21 +0000 (12:24 +0000)]
[ASan/Win] Move the shadow to 0x30000000

llvm-svn: 226809

9 years agoFixed a bug in type legalizer for masked load/store intrinsics.
Elena Demikhovsky [Thu, 22 Jan 2015 12:07:59 +0000 (12:07 +0000)]
Fixed a bug in type legalizer for masked load/store intrinsics.
The problem occurs when after vectorization we have type
<2 x i32>. This type is promoted to <2 x i64> and then requires
additional efforts for expanding loads and truncating stores.
I added EXPAND / TRUNCATE attributes to the masked load/store
SDNodes. The code now contains additional shuffles.
I've prepared changes in the cost estimation for masked memory
operations, it will be submitted separately.

llvm-svn: 226808

9 years ago[ASan] Print out the shadow memory range on shadow mapping failures
Timur Iskhodzhanov [Thu, 22 Jan 2015 12:05:27 +0000 (12:05 +0000)]
[ASan] Print out the shadow memory range on shadow mapping failures

llvm-svn: 226807

9 years agoFixed a comment
Elena Demikhovsky [Thu, 22 Jan 2015 10:01:36 +0000 (10:01 +0000)]
Fixed a comment

llvm-svn: 226806

9 years agoFixed a bug in narrowing store operation.
Elena Demikhovsky [Thu, 22 Jan 2015 09:39:08 +0000 (09:39 +0000)]
Fixed a bug in narrowing store operation.
Type MVT::i1 became legal in KNL, but store operation can't be narrowed to this type,
since the size of VT (1 bit) is not equal to its actual store size(8 bits).

Added a test provided by David (dag@cray.com)

llvm-svn: 226805

9 years ago[NFC] Introduce a 'struct Range' for IRCE
Sanjoy Das [Thu, 22 Jan 2015 09:32:02 +0000 (09:32 +0000)]
[NFC] Introduce a 'struct Range' for IRCE

Use the struct instead of a std::pair<Value *, Value *>.  This makes a
Range an obviously immutable object, and we can now assert that a
range is well-typed (Begin->getType() == End->getType()) on its
construction.

llvm-svn: 226804

9 years ago[msan] Relax CHECK conditions in 2 tests.
Evgeniy Stepanov [Thu, 22 Jan 2015 09:27:00 +0000 (09:27 +0000)]
[msan] Relax CHECK conditions in 2 tests.

Sometimes malloc/realloc/etc are symbolized as
__interceptor_malloc/realloc/etc.

llvm-svn: 226803

9 years agoRevert r226798. Guess I missed the patterns.
Craig Topper [Thu, 22 Jan 2015 09:01:20 +0000 (09:01 +0000)]
Revert r226798. Guess I missed the patterns.

llvm-svn: 226802

9 years ago[Msan] Fix the readv and preadv unit tests to pass on FreeBSD
Viktor Kutuzov [Thu, 22 Jan 2015 09:00:46 +0000 (09:00 +0000)]
[Msan] Fix the readv and preadv unit tests to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D7091

llvm-svn: 226801

9 years ago[Msan] Fix the strerror_r unit test to build on FreeBSD
Viktor Kutuzov [Thu, 22 Jan 2015 08:57:59 +0000 (08:57 +0000)]
[Msan] Fix the strerror_r unit test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D7089

llvm-svn: 226800

9 years ago[Msan] Fix the DynRet unit test to build on FreeBSD
Viktor Kutuzov [Thu, 22 Jan 2015 08:54:03 +0000 (08:54 +0000)]
[Msan] Fix the DynRet unit test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D7086

llvm-svn: 226799

9 years agoUse u8imm instead of i32i8imm on a couple instructions that have no patterns and...
Craig Topper [Thu, 22 Jan 2015 08:53:11 +0000 (08:53 +0000)]
Use u8imm instead of i32i8imm on a couple instructions that have no patterns and thus no reason to use a larger operand size.

llvm-svn: 226798

9 years ago[X86] Remove some unused multiclasses from AVX512 instruction file.
Craig Topper [Thu, 22 Jan 2015 08:53:08 +0000 (08:53 +0000)]
[X86] Remove some unused multiclasses from AVX512 instruction file.

llvm-svn: 226797

9 years ago[Sanitizers] Fix inet_aton() and inet_pton() interceptors to work on FreeBSD
Viktor Kutuzov [Thu, 22 Jan 2015 08:51:07 +0000 (08:51 +0000)]
[Sanitizers] Fix inet_aton() and inet_pton() interceptors to work on FreeBSD
Differential Revision: http://reviews.llvm.org/D7084

llvm-svn: 226796

9 years agoSupport ‘omp for’ with static chunked schedule kind.
Alexander Musman [Thu, 22 Jan 2015 08:49:35 +0000 (08:49 +0000)]
Support ‘omp for’ with static chunked schedule kind.

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

llvm-svn: 226795

9 years ago[Sanitizers] Intercept preadv() on FreeBSD
Viktor Kutuzov [Thu, 22 Jan 2015 08:47:54 +0000 (08:47 +0000)]
[Sanitizers] Intercept preadv() on FreeBSD
Committed unreviewed with permission.

llvm-svn: 226794

9 years agoFix crashes in IRCE caused by mismatched types
Sanjoy Das [Thu, 22 Jan 2015 08:29:18 +0000 (08:29 +0000)]
Fix crashes in IRCE caused by mismatched types

There are places where the inductive range check elimination pass
depends on two llvm::Values or llvm::SCEVs to be of the same
llvm::Type when they do not need to be. This patch relaxes those
restrictions (by bailing out of the optimization if the types
mismatch), and adds test cases to trigger those paths.

These issues were found by bootstrapping clang with IRCE running in
the -O3 pass ordering.

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

llvm-svn: 226793

9 years agoSLPVectorizer: add a second limit for the number of alias checks.
Erik Eckstein [Thu, 22 Jan 2015 08:20:51 +0000 (08:20 +0000)]
SLPVectorizer: add a second limit for the number of alias checks.

Even with the current limit on the number of alias checks, the containing loop has quadratic complexity.
This begins to hurt for blocks containing > 1K load/store instructions.
This commit introduces a limit for the loop count. It reduces the runtime for such very large blocks.

llvm-svn: 226792

9 years agoFixed a bug in masked load/store in reversed loop.
Elena Demikhovsky [Thu, 22 Jan 2015 08:20:06 +0000 (08:20 +0000)]
Fixed a bug in masked load/store in reversed loop.
Added a test.

The bug was submitted to bugzilla:
http://llvm.org/bugs/show_bug.cgi?id=22225

llvm-svn: 226791

9 years ago[MSan][Clang][MIPS] Enabled memory and dataflow options for MIPS64 platform
Mohit K. Bhakkad [Thu, 22 Jan 2015 07:21:22 +0000 (07:21 +0000)]
[MSan][Clang][MIPS] Enabled memory and dataflow options for MIPS64 platform

Reviewers: kcc, samsonov, petarj, eugenis
llvm-svn: 226790

9 years agoUpdate ExpressionSourceCode::GetText() to match the
Jason Molenda [Thu, 22 Jan 2015 06:31:58 +0000 (06:31 +0000)]
Update ExpressionSourceCode::GetText() to match the
name of the iOS simulator platform which was changed
in r181631.
<rdar://problem/19200084>

llvm-svn: 226789

9 years ago[OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
Alexey Bataev [Thu, 22 Jan 2015 06:17:56 +0000 (06:17 +0000)]
[OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".)
Differential Revision: http://reviews.llvm.org/D6431

llvm-svn: 226788

9 years agoRevert commit revision 226786
Alexey Bataev [Thu, 22 Jan 2015 06:09:48 +0000 (06:09 +0000)]
Revert commit revision 226786
Need to add initialization of AtomicInfo::EvaluationKind field

llvm-svn: 226787

9 years ago[OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
Alexey Bataev [Thu, 22 Jan 2015 05:44:37 +0000 (05:44 +0000)]
[OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".)
Differential Revision: http://reviews.llvm.org/D6431

llvm-svn: 226786

9 years agoRevert commit r226784.
Alexey Bataev [Thu, 22 Jan 2015 05:35:53 +0000 (05:35 +0000)]
Revert commit r226784.
Accidentally modified file SemaType.cpp must be restored to its original state.

llvm-svn: 226785

9 years ago[OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
Alexey Bataev [Thu, 22 Jan 2015 05:29:28 +0000 (05:29 +0000)]
[OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".
Differential Revision: http://reviews.llvm.org/D6431

llvm-svn: 226784

9 years ago[PM] Rename InstCombine.h to InstCombineInternal.h in preparation for
Chandler Carruth [Thu, 22 Jan 2015 05:25:13 +0000 (05:25 +0000)]
[PM] Rename InstCombine.h to InstCombineInternal.h in preparation for
creating a non-internal header file for the InstCombine pass.

I thought about calling this InstCombiner.h or in some way more clearly
associating it with the InstCombiner clas that it is primarily defining,
but there are several other utility interfaces defined within this for
InstCombine. If, in the course of refactoring, those end up moving
elsewhere or going away, it might make more sense to make this the
combiner's header alone.

Naturally, this is a bikeshed to a certain degree, so feel free to lobby
for a different shade of paint if this name just doesn't suit you.

llvm-svn: 226783

9 years agoAdd ARM backend to the autotools build
Greg Fitzgerald [Thu, 22 Jan 2015 05:12:46 +0000 (05:12 +0000)]
Add ARM backend to the autotools build

From: Greg Fitzgerald <garious@gmail.com>
llvm-svn: 226782

9 years ago[canonicalize] Teach InstCombine to canonicalize loads which are only
Chandler Carruth [Thu, 22 Jan 2015 05:08:12 +0000 (05:08 +0000)]
[canonicalize] Teach InstCombine to canonicalize loads which are only
ever stored to always use a legal integer type if one is available.

Regardless of whether this particular type is good or bad, it ensures we
don't get weird differences in generated code (and resulting
performance) from "equivalent" patterns that happen to end up using
a slightly different type.

After some discussion on llvmdev it seems everyone generally likes this
canonicalization. However, there may be some parts of LLVM that handle
it poorly and need to be fixed. I have at least verified that this
doesn't impede GVN and instcombine's store-to-load forwarding powers in
any obvious cases. Subtle cases are exactly what we need te flush out if
they remain.

Also note that this IR pattern should already be hitting LLVM from Clang
at least because it is exactly the IR which would be produced if you
used memcpy to copy a pointer or floating point between memory instead
of a variable.

llvm-svn: 226781

9 years agoMakes a simple member function static.
Francisco Lopes da Silva [Thu, 22 Jan 2015 04:30:23 +0000 (04:30 +0000)]
Makes a simple member function static.

This function has been just included with the initial support for C++
parameter completion and it's trivial enough to be a static member.

llvm-svn: 226780

9 years agoARM: fail less catastrophically on invalid Windows input
Saleem Abdulrasool [Thu, 22 Jan 2015 04:03:32 +0000 (04:03 +0000)]
ARM: fail less catastrophically on invalid Windows input

Windows supports a restricted set of relocations (compared to ARM ELF).  In some
cases, we may end up generating an unsupported relocation.  This can occur with
bad input to the assembler in particular (the frontend should never generate
code that cannot be compiled).  Generate an error rather than just aborting.

The change in the API is driven by the desire to provide a slightly more helpful
message for debugging purposes.

llvm-svn: 226779

9 years ago[modules] If we add an implicit special member to a class through an update
Richard Smith [Thu, 22 Jan 2015 03:50:31 +0000 (03:50 +0000)]
[modules] If we add an implicit special member to a class through an update
record, and that class declaration is not the canonical definition of the
class, be sure to add the class to the list of classes that are consulted when
we look up a special member in the canonical definition.

llvm-svn: 226778

9 years ago[canonicalize] Move a helper function further up the file so it can be
Chandler Carruth [Thu, 22 Jan 2015 03:34:54 +0000 (03:34 +0000)]
[canonicalize] Move a helper function further up the file so it can be
used earlier. NFC.

llvm-svn: 226777

9 years agoFix test file names so they're picked up by lit.
Richard Smith [Thu, 22 Jan 2015 03:24:07 +0000 (03:24 +0000)]
Fix test file names so they're picked up by lit.

llvm-svn: 226776

9 years agoDIBuilder: Make header iterator constructor explicit, NFC
Duncan P. N. Exon Smith [Thu, 22 Jan 2015 03:20:09 +0000 (03:20 +0000)]
DIBuilder: Make header iterator constructor explicit, NFC

llvm-svn: 226775

9 years agoDIBuilder: Extract header_begin() and header_end(), NFC
Duncan P. N. Exon Smith [Thu, 22 Jan 2015 03:17:43 +0000 (03:17 +0000)]
DIBuilder: Extract header_begin() and header_end(), NFC

Use begin/end functions so that users don't need to know how these weird
things work.

llvm-svn: 226774

9 years agoDIBuilder: Stop abusing DIExpressionIterator::operator*(), NFC
Duncan P. N. Exon Smith [Thu, 22 Jan 2015 03:13:35 +0000 (03:13 +0000)]
DIBuilder: Stop abusing DIExpressionIterator::operator*(), NFC

This code was confusing, since it created a `DIExpressionIterator` from
an invalid start point (although it wasn't wrong: it never actually
iterated).  Now that the underlying iterator has `getNumber()`, just use
it directly.

llvm-svn: 226773

9 years agoDIBuilder: Extract DIHeaderFieldIterator::getNumber(), NFC
Duncan P. N. Exon Smith [Thu, 22 Jan 2015 03:11:13 +0000 (03:11 +0000)]
DIBuilder: Extract DIHeaderFieldIterator::getNumber(), NFC

Reduce code duplication between `DIBuilder` and `DIExpressionIterator`
by implementing a `getNumber()` directly in the iterator.

llvm-svn: 226772

9 years agoAdd an API to ValueObject that iterates over the entire parent chain via a callback...
Enrico Granata [Thu, 22 Jan 2015 03:07:34 +0000 (03:07 +0000)]
Add an API to ValueObject that iterates over the entire parent chain via a callback, and rewrite GetRoot() in terms of this general iteration API. NFC

llvm-svn: 226771

9 years agoDIBuilder: Create a getHeaderIterator() helper, NFC
Duncan P. N. Exon Smith [Thu, 22 Jan 2015 03:00:01 +0000 (03:00 +0000)]
DIBuilder: Create a getHeaderIterator() helper, NFC

Extract this so it can be reused.

llvm-svn: 226770

9 years agoMaking deleted copy constructors and operators to be private for better diagnostics...
Chris Bieneman [Thu, 22 Jan 2015 02:51:33 +0000 (02:51 +0000)]
Making deleted copy constructors and operators to be private for better diagnostics when deleted is not available.

llvm-svn: 226769

9 years agoSEH: Finish writing the catch-all test case
Reid Kleckner [Thu, 22 Jan 2015 02:31:09 +0000 (02:31 +0000)]
SEH: Finish writing the catch-all test case

llvm-svn: 226768

9 years agoWin64 SEH: Emit the constant 1 for catch-all into xdata
Reid Kleckner [Thu, 22 Jan 2015 02:27:44 +0000 (02:27 +0000)]
Win64 SEH: Emit the constant 1 for catch-all into xdata

llvm-svn: 226767

9 years agoSEH: Emit the constant filter 1 as a catch-all
Reid Kleckner [Thu, 22 Jan 2015 02:25:56 +0000 (02:25 +0000)]
SEH: Emit the constant filter 1 as a catch-all

Minor optimization of code like __try { ... } __except(1) { ... }.

llvm-svn: 226766

9 years ago[modules] If we load two declarations with typedef names for linkage purposes
Richard Smith [Thu, 22 Jan 2015 02:21:23 +0000 (02:21 +0000)]
[modules] If we load two declarations with typedef names for linkage purposes
on top of a local declaration of the same entity, we still need to remember
that we loaded the first one or we may fail to merge the second one properly.

llvm-svn: 226765

9 years agoInstrProf: Avoid creating profile names for symbols in system headers
Justin Bogner [Thu, 22 Jan 2015 02:17:23 +0000 (02:17 +0000)]
InstrProf: Avoid creating profile names for symbols in system headers

We don't emit any coverage mapping for uncovered functions that come
from system headers, but we were creating a GlobalVariable with each
of their names. This is wasteful since the linker will need to dead
strip the unused symbols, and it can lead to issues when merging
coverage with others TUs that do have coverage for those functions.

llvm-svn: 226764

9 years agoAssigning and copying command line option objects shouldn't be allowed.
Chris Bieneman [Thu, 22 Jan 2015 01:49:59 +0000 (01:49 +0000)]
Assigning and copying command line option objects shouldn't be allowed.

Summary:
The default copy and assignment operators for these objects probably don't actually do what the clients intend, so they should be deleted.

Places using the assignment operator to set the value of an option should cast to the option's data type first to call into the override for operator=. Places using the copy constructor just need to be changed to not copy (i.e. passing by const reference instead of value).

Reviewers: dexonsmith, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 226762

9 years ago[modules] It's possible to merge into the pattern of a class template before we
Richard Smith [Thu, 22 Jan 2015 01:41:56 +0000 (01:41 +0000)]
[modules] It's possible to merge into the pattern of a class template before we
load the definition data from the declaration itself. In that case, merge
properly; don't assume the prior definition is the same as our own.

llvm-svn: 226761

9 years agoInitial support for Win64 SEH IR emission
Reid Kleckner [Thu, 22 Jan 2015 01:36:17 +0000 (01:36 +0000)]
Initial support for Win64 SEH IR emission

The lowering looks a lot like normal EH lowering, with the exception
that the exceptions are caught by executing filter expression code
instead of matching typeinfo globals. The filter expressions are
outlined into functions which are used in landingpad clauses where
typeinfo would normally go.

Major aspects that still need work:
- Non-call exceptions in __try bodies won't work yet. The plan is to
  outline the __try block in the frontend to keep things simple.
- Filter expressions cannot use local variables until capturing is
  implemented.
- __finally blocks will not run after exceptions. Fixing this requires
  work in the LLVM SEH preparation pass.

The IR lowering looks like this:

// C code:
bool safe_div(int n, int d, int *r) {
  __try {
    *r = normal_div(n, d);
  } __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) {
    return false;
  }
  return true;
}

; LLVM IR:
define i32 @filter(i8* %e, i8* %fp) {
  %ehptrs = bitcast i8* %e to i32**
  %ehrec = load i32** %ehptrs
  %code = load i32* %ehrec
  %matches = icmp eq i32 %code, i32 u0xC0000094
  %matches.i32 = zext i1 %matches to i32
  ret i32 %matches.i32
}

define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) {
  %rr = invoke i32 @normal_div(i32 %n, i32 %d)
      to label %normal unwind to label %lpad

normal:
  store i32 %rr, i32* %r
  ret i1 1

lpad:
  %ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler
      catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*)
  %ehptr = extractvalue {i8*, i32} %ehvals, i32 0
  %sel = extractvalue {i8*, i32} %ehvals, i32 1
  %filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*))
  %matches = icmp eq i32 %sel, %filter_sel
  br i1 %matches, label %eh.except, label %eh.resume

eh.except:
  ret i1 false

eh.resume:
  resume
}

Reviewers: rjmccall, rsmith, majnemer

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

llvm-svn: 226760

9 years agoRevert "Try to fix -Asserts build bots."
Rafael Espindola [Thu, 22 Jan 2015 01:33:41 +0000 (01:33 +0000)]
Revert "Try to fix -Asserts build bots."

This reverts commit r226758.

Looks like rnk's 226757 fixed the real issue.
Sorry for the noise.

llvm-svn: 226759

9 years agoTry to fix -Asserts build bots.
Rafael Espindola [Thu, 22 Jan 2015 01:26:39 +0000 (01:26 +0000)]
Try to fix -Asserts build bots.

llvm-svn: 226758

9 years agoGive the block inlining test a triple to determinise output
Reid Kleckner [Thu, 22 Jan 2015 01:19:19 +0000 (01:19 +0000)]
Give the block inlining test a triple to determinise output

It fails on Windows due to another temporary being emitted first, so the
LLVM internal renaming scheme gives out the name
__block_descriptor_tmp1.

llvm-svn: 226757