platform/upstream/llvm.git
10 years agoTiny improvement in a test (missing quote)
Sylvestre Ledru [Fri, 11 Jul 2014 11:53:18 +0000 (11:53 +0000)]
Tiny improvement in a test (missing quote)

llvm-svn: 212806

10 years agoGCC compatibility: Create a Group to ignore unsupported optimization.
Sylvestre Ledru [Fri, 11 Jul 2014 11:43:57 +0000 (11:43 +0000)]
GCC compatibility: Create a Group to ignore unsupported optimization.

Returns a warning when using an unknown optimization flag.
This patch includes -finline-limit as one of those ignored flags.
More options will be moved in this group

Patch by Arthur Marble <arthur@info9.net> in the context of
Debian Google Summer of code 2014.

Reviewers: rnk, Sylvestre
llvm-svn: 212805

10 years ago[OPENMP] Parsing and sema analysis for 'omp task' directive.
Alexey Bataev [Fri, 11 Jul 2014 11:25:16 +0000 (11:25 +0000)]
[OPENMP] Parsing and sema analysis for 'omp task' directive.

llvm-svn: 212804

10 years agoAdded test for commit r212802 that was missing
Marcello Maggioni [Fri, 11 Jul 2014 10:36:00 +0000 (10:36 +0000)]
Added test for commit r212802 that was missing

llvm-svn: 212803

10 years agoFixup PHIs in LowerSwitch when a Leaf node is not emitted.
Marcello Maggioni [Fri, 11 Jul 2014 10:34:36 +0000 (10:34 +0000)]
Fixup PHIs in LowerSwitch when a Leaf node is not emitted.

This commit fixes bug http://llvm.org/bugs/show_bug.cgi?id=20103.

Thanks to Qwertyuiop for the report and the proposed fix.

llvm-svn: 212802

10 years ago[msan] A comment for the chained-origin-depot hash function.
Evgeniy Stepanov [Fri, 11 Jul 2014 09:09:37 +0000 (09:09 +0000)]
[msan] A comment for the chained-origin-depot hash function.

llvm-svn: 212801

10 years agoRemove unnecessary isl annotations
Tobias Grosser [Fri, 11 Jul 2014 09:02:41 +0000 (09:02 +0000)]
Remove unnecessary isl annotations

They where just left over from copy-pasting.

Reported-by: Johannes Doerfert <jdoerfert@codeaurora.org>
llvm-svn: 212800

10 years ago[msan] Use real memset/memcpy/memmove in interceptors.
Evgeniy Stepanov [Fri, 11 Jul 2014 08:57:57 +0000 (08:57 +0000)]
[msan] Use real memset/memcpy/memmove in interceptors.

Our versions are not exactly as fast as libc's, and
MSan uses them heavily (even compared to other sanitizers).

This will break if libc version of mem* are instrumented,
but they never are, and if they are, we should be able
to fix it on libc side.

llvm-svn: 212799

10 years ago[msan] Make one test case less brittle.
Evgeniy Stepanov [Fri, 11 Jul 2014 08:47:51 +0000 (08:47 +0000)]
[msan] Make one test case less brittle.

llvm-svn: 212798

10 years ago[clang-tidy] Add a checker for implicit bool conversion of a bool*.
Benjamin Kramer [Fri, 11 Jul 2014 08:08:47 +0000 (08:08 +0000)]
[clang-tidy] Add a checker for implicit bool conversion of a bool*.

The goal is to find code like the example below, which is likely a typo
where someone meant to write "if (*b)".
bool *b = SomeFunction();
 if (b) {
   // b never dereferenced
 }

This checker naturally has a relatively high false positive rate so it
applies some heuristics to avoid cases where the pointer is checked for
nullptr before being written.

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

llvm-svn: 212797

10 years agoDeadCodeElim: Compute correct liveout for non-affine accesses
Tobias Grosser [Fri, 11 Jul 2014 07:12:10 +0000 (07:12 +0000)]
DeadCodeElim: Compute correct liveout for non-affine accesses

Thanks to Johannes Doerfert for narrowing down the bug.

Reported-by: Chris Jenneisch <chrisj@codeaurora.org>
llvm-svn: 212796

10 years ago[X86] AVX512: Improve readability of isCDisp8
Adam Nemet [Fri, 11 Jul 2014 05:23:25 +0000 (05:23 +0000)]
[X86] AVX512: Improve readability of isCDisp8

No functional change.  As I was trying to understand this function, I found
that variables were reused with confusing names and the broadcast case was a
bit too implicit.  Hopefully, this is an improvement.

llvm-svn: 212795

10 years ago[X86] AVX512: Simplify logic in isCDisp8
Adam Nemet [Fri, 11 Jul 2014 05:23:12 +0000 (05:23 +0000)]
[X86] AVX512: Simplify logic in isCDisp8

It was computing the VL/n case as:
  MemObjSize = VectorByteSize / ElemByteSize / Divider * ElemByteSize

ElemByteSize not only falls out but VectorByteSize/Divider now actually
matches the definition of VL/n.

Also some formatting fixes.

llvm-svn: 212794

10 years agoRevert "Reapply "DebugInfo: Ensure that all debug location scope chains from instruct...
David Blaikie [Fri, 11 Jul 2014 02:42:57 +0000 (02:42 +0000)]
Revert "Reapply "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself.""

This reverts commit r212776.

Nope, still seems to be failing on the sanitizer bots... but hey, not
the msan self-host anymore, it's failing in asan now. I'll start looking
there next.

llvm-svn: 212793

10 years agoEnable the ability to enable debug info generation when evaluating expressions.
Greg Clayton [Fri, 11 Jul 2014 01:03:57 +0000 (01:03 +0000)]
Enable the ability to enable debug info generation when evaluating expressions.

llvm-svn: 212792

10 years agoRemove code that was merged incorrectly.
Greg Clayton [Fri, 11 Jul 2014 00:51:53 +0000 (00:51 +0000)]
Remove code that was merged incorrectly.

llvm-svn: 212791

10 years agoDon't assume StringRef.data() is null-terminated
Ben Langmuir [Fri, 11 Jul 2014 00:43:47 +0000 (00:43 +0000)]
Don't assume StringRef.data() is null-terminated

llvm-svn: 212790

10 years agoTestAfterDivZeroChecker.cpp: Avoid member initializer. It is unsupported in msc17.
NAKAMURA Takumi [Fri, 11 Jul 2014 00:32:35 +0000 (00:32 +0000)]
TestAfterDivZeroChecker.cpp: Avoid member initializer. It is unsupported in msc17.

llvm-svn: 212789

10 years ago[modules] Don't try to merge template specializations by performing name lookup
Richard Smith [Fri, 11 Jul 2014 00:20:06 +0000 (00:20 +0000)]
[modules] Don't try to merge template specializations by performing name lookup
into their container; we won't find them there. These things are already being
merged when they're added to their primary template's folding set, so this
merging is redundant (and causes us to reject-valid because we think we've
found an odr violation).

llvm-svn: 212788

10 years agoclang/test/CodeGenCXX/PR20038.cpp: Appease targeting msvc due to incompatibility...
NAKAMURA Takumi [Fri, 11 Jul 2014 00:18:29 +0000 (00:18 +0000)]
clang/test/CodeGenCXX/PR20038.cpp: Appease targeting msvc due to incompatibility of dw.

llvm-svn: 212787

10 years agoReturn a FixItHint instead of taking a diagnostic builder
Reid Kleckner [Fri, 11 Jul 2014 00:16:51 +0000 (00:16 +0000)]
Return a FixItHint instead of taking a diagnostic builder

Addressing review comments from r212784.

llvm-svn: 212786

10 years agoGet the python scripting interface working on Windows.
Zachary Turner [Thu, 10 Jul 2014 23:47:42 +0000 (23:47 +0000)]
Get the python scripting interface working on Windows.

This patch fixes a number of issues with embedded Python on
Windows.  In particular:

1) The script that builds the python modules was normalizing the
   case of python filenames during copies.  The module name is
   the filename, and is case-sensitive, so this was breaking code.

2) Changes the build to not attempt to link against python27.lib
   (e.g. the release library) when linking against msvcrt debug
   library.  Doing a debug build of LLDB with embedded python
   support now requires you to provide your own self-compiled
   debug version of python.

3) Don't import termios when initializing the interpreter.  This
   is part of a larger effort to remove the dependency on termios
   since it is not available on Windows.  This particular instance
   was unnecessary and unused.

Reviewed by: Todd Fiala

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

llvm-svn: 212785

10 years agoMSVC compat: Allow lookup of friend types in enclosing namespaces
Reid Kleckner [Thu, 10 Jul 2014 23:44:52 +0000 (23:44 +0000)]
MSVC compat: Allow lookup of friend types in enclosing namespaces

The relevant portion of C++ standard says [namespace.memdef]p3:

  If the name in a friend declaration is neither qualified nor a
  template-id and the declaration is a function or an
  elaborated-type-specifier, the lookup to determine whether the entity
  has been previously declared shall not consider any scopes outside the
  innermost enclosing namespace.

MSVC does not implement that rule for types.  If there is a type in an
enclosing namespace, they consider an unqualified tag declaration with
the same name to be a redeclaration of the type from another namespace.

Implementing compatibility is a simple matter of disabling our
implementation of this rule for types, which was added in r177473.

Reviewers: rsmith

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

llvm-svn: 212784

10 years agoCleanup the iOS simulator code.
Greg Clayton [Thu, 10 Jul 2014 23:33:37 +0000 (23:33 +0000)]
Cleanup the iOS simulator code.

Fixes include:
- Don't say that "<arch>-apple-ios" is compatible with "<arch>-apple-macosx"
- Fixed DynamicLoaderMacOSXDYLD so specify an architecture that was converted solely from a cputype and subtype, just specify the file + UUID.
- Fixed PlatformiOSSimulator::GetSupportedArchitectureAtIndex() so it returns the correct archs
- Fixed SymbolFileDWARFDebugMap to load .o files correctly by just specifying the architecture without the vendor and OS now that "<arch>-apple-ios" is not compatible with "<arch>-apple-macosx" so we can load .o files correctly for DWARF with debug map
- Fixed the coded in TargetList::CreateTarget() so it does the right thing with an underspecified triple where just the arch is specified.

llvm-svn: 212783

10 years agoPartially fix PR20058: reduce compile time for loop unrolling with very high count...
Mark Heffernan [Thu, 10 Jul 2014 23:30:06 +0000 (23:30 +0000)]
Partially fix PR20058: reduce compile time for loop unrolling with very high count by reducing calls to SE->forgetLoop

llvm-svn: 212782

10 years agoEnable -gcolumn-info by default.
Diego Novillo [Thu, 10 Jul 2014 23:29:28 +0000 (23:29 +0000)]
Enable -gcolumn-info by default.

This patch flips the default value for -gcolumn-info to be on by
default. I discussed the rationale and provided compile/size data
in:

http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/074290.html

This also updates the documentation and some tests that relied on
the lack of column information. Some tests had column information
in the expected output, but it was wrong (the tsan tests). Others
were using the driver to execute.

llvm-svn: 212781

10 years ago[RuntimeDyld] Replace a crufty old ARM RuntimeDyld test with a new one that uses
Lang Hames [Thu, 10 Jul 2014 23:29:11 +0000 (23:29 +0000)]
[RuntimeDyld] Replace a crufty old ARM RuntimeDyld test with a new one that uses
RuntimeDyldChecker.

This allows us to remove one of the six remaining object files in the LLVM
source tree.

llvm-svn: 212780

10 years agoFix expected column numbers in two tests.
Diego Novillo [Thu, 10 Jul 2014 23:29:10 +0000 (23:29 +0000)]
Fix expected column numbers in two tests.

This is a minor fix to two tsan tests that were expecting the wrong
column information. Now that clang emits column information by default
in its debugging output, the tests had started failing.

llvm-svn: 212779

10 years ago[RuntimeDyld] Improve error diagnostic in RuntimeDyldChecker.
Lang Hames [Thu, 10 Jul 2014 23:26:20 +0000 (23:26 +0000)]
[RuntimeDyld] Improve error diagnostic in RuntimeDyldChecker.

The compiler often emits assembler-local labels (beginning with 'L') for use in
relocation expressions, however these aren't included in the object files.
Teach RuntimeDyldChecker to warn the user if they try to use one of these in an
expression, since it will never work.

llvm-svn: 212777

10 years agoReapply "DebugInfo: Ensure that all debug location scope chains from instructions...
David Blaikie [Thu, 10 Jul 2014 22:59:39 +0000 (22:59 +0000)]
Reapply "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself."

Committed in r212205 and reverted in r212226 due to msan self-hosting
failure, I believe I've got that fixed by r212761 to Clang.

Original commit message:

"Originally committed in r211723, reverted in r211724 due to failure
cases found and fixed (ArgumentPromotion: r211872, Inlining: r212065),
committed again in r212085 and reverted again in r212089 after fixing
some other cases, such as debug info subprogram lists not keeping track
of the function they represent (r212128) and then short-circuiting
things like LiveDebugVariables that build LexicalScopes for functions
that might not have full debug info.

And again, I believe the invariant actually holds for some reasonable
amount of code (but I'll keep an eye on the buildbots and see what
happens... ).

Original commit message:

PR20038: DebugInfo: Inlined call sites where the caller has debug info
but the call itself has no debug location.

This situation does bad things when inlined, so I've fixed Clang not to
produce inlinable call sites without locations when the caller has debug
info (in the one case where I could find that this occurred). This
updates the PR20038 test case to be what clang now produces, and readds
the assertion that had to be removed due to this bug.

I've also beefed up the debug info verifier to help diagnose these
issues in the future, and I hope to add checks to the inliner to just
assert-fail if it encounters this situation. If, in the future, we
decide we have to cope with this situation, the right thing to do is
probably to just remove all the DebugLocs from the inlined
instructions."

llvm-svn: 212776

10 years agoThis test case doesn't actually need the inliner to reproduce the input.
David Blaikie [Thu, 10 Jul 2014 22:57:40 +0000 (22:57 +0000)]
This test case doesn't actually need the inliner to reproduce the input.

llvm-svn: 212775

10 years agoAdd AST dumping for VarDecl init kind.
Richard Smith [Thu, 10 Jul 2014 22:54:03 +0000 (22:54 +0000)]
Add AST dumping for VarDecl init kind.

llvm-svn: 212774

10 years agoR600: Implement float to long/ulong
Jan Vesely [Thu, 10 Jul 2014 22:40:21 +0000 (22:40 +0000)]
R600: Implement float to long/ulong

Use alg. from LegalizeDAG.cpp
Move Expand setting to SIISellowering

v2: Extend existing tests instead of creating new ones
v3: use separate LowerFPTOSINT function
v4: use TargetLowering::expandFP_TO_SINT
    add comment about using FP_TO_SINT for uints

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 212773

10 years agoSelectionDAG: Factor FP_TO_SINT lower code out of DAGLegalizer
Jan Vesely [Thu, 10 Jul 2014 22:40:18 +0000 (22:40 +0000)]
SelectionDAG: Factor FP_TO_SINT lower code out of DAGLegalizer

Move the code to a helper function to allow calls from TypeLegalizer.

No functionality change intended

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <tom@stellard.net>
Reviewed-by: Owen Anderson <resistor@mac.com>
llvm-svn: 212772

10 years agoUse the integrated assembler by default on OpenBSD.
Brad Smith [Thu, 10 Jul 2014 22:37:28 +0000 (22:37 +0000)]
Use the integrated assembler by default on OpenBSD.

llvm-svn: 212771

10 years ago[UBSan] Introduce type-based blacklisting.
Alexey Samsonov [Thu, 10 Jul 2014 22:34:19 +0000 (22:34 +0000)]
[UBSan] Introduce type-based blacklisting.

Teach UBSan vptr checker to ignore technically invalud down-casts on
blacklisted types.

Based on http://reviews.llvm.org/D4407 by Byoungyoung Lee!

llvm-svn: 212770

10 years ago[mips] Emit two CFI offset directives per double precision SDC1/LDC1
Zoran Jovanovic [Thu, 10 Jul 2014 22:23:30 +0000 (22:23 +0000)]
[mips] Emit two CFI offset directives per double precision SDC1/LDC1
instead of just one for FR=1 registers
Differential Revision: http://reviews.llvm.org/D4310

llvm-svn: 212769

10 years agoMake cmake cxxflags match those in lib/buildit.
Dan Albert [Thu, 10 Jul 2014 22:23:03 +0000 (22:23 +0000)]
Make cmake cxxflags match those in lib/buildit.

llvm-svn: 212768

10 years agoBe more specific about return types of some methods.
Alexey Samsonov [Thu, 10 Jul 2014 22:18:36 +0000 (22:18 +0000)]
Be more specific about return types of some methods.

This would allow to call addCompilerUsedGlobal on some
Clang-generated globals.

llvm-svn: 212767

10 years ago[PECOFF] s/context/ctx/ for consistency.
Rui Ueyama [Thu, 10 Jul 2014 21:55:28 +0000 (21:55 +0000)]
[PECOFF] s/context/ctx/ for consistency.

llvm-svn: 212766

10 years ago[PECOFF] Set resource table entry in header.
Rui Ueyama [Thu, 10 Jul 2014 21:43:19 +0000 (21:43 +0000)]
[PECOFF] Set resource table entry in header.

The resource table entry should have the RVA of the
embedded resource file.

llvm-svn: 212765

10 years agoPR20256: don't accidentally instantiate non-dependent default-initialization as
Richard Smith [Thu, 10 Jul 2014 20:53:43 +0000 (20:53 +0000)]
PR20256: don't accidentally instantiate non-dependent default-initialization as
value-initialization.

llvm-svn: 212764

10 years ago[PECOFF] Invoke cvtres.exe in the driver.
Rui Ueyama [Thu, 10 Jul 2014 20:53:37 +0000 (20:53 +0000)]
[PECOFF] Invoke cvtres.exe in the driver.

Previously we invoked cvtres.exe for each compiled Windows
resource file. The generated files were then concatenated
and embedded to the executable.

That was not the correct way to merge compiled Windows
resource files. If you just concatenate generated files,
only the first file would be recognized and the rest would
be ignored as trailing garbage.

The right way to merge them is to call cvtres.exe with
multiple input files. In this patch we do that in the
Windows driver.

llvm-svn: 212763

10 years agoFlipped intermittent test failures from skip to XFAIL.
Todd Fiala [Thu, 10 Jul 2014 20:52:08 +0000 (20:52 +0000)]
Flipped intermittent test failures from skip to XFAIL.

The following intermittently-failing tests have been flipped from
skip to XFAIL on some combo of Linux and MacOSX:

TestCallStopAndContinue.py (Linux, MacOSX)
TestCallWithTimeout.py (Linux)
TestConvenienceVariables.py (Linux)
TestStopHookMultipleThreads.py (Linux)

The following new tests have been marked XFAIL but are just
intermittently failing:

TestMultipleDebug.py (definitely intermittent on MacOSX, not sure I've seen
it pass yet on Linux)

llvm-svn: 212762

10 years agoFix the dtor location issues in PR20038 harder.
David Blaikie [Thu, 10 Jul 2014 20:42:59 +0000 (20:42 +0000)]
Fix the dtor location issues in PR20038 harder.

Originally committed in r211722, this fixed one case of dtor calls being
emitted without locations (this causes problems for debug info if the
call is then inlined), this caught only some of the cases.

Instead of trying to re-enable the location before the cleanup, simply
re-enable the location immediately after the unconditional branches in
question using a scoped device to ensure the no-location state doesn't
leak out arbitrarily.

llvm-svn: 212761

10 years agoMove the post-build step that creates lldb.py.
Zachary Turner [Thu, 10 Jul 2014 20:37:47 +0000 (20:37 +0000)]
Move the post-build step that creates lldb.py.

Being in lldb\source, ${CMAKE_CURRENT_BINARY_DIR} would resolve to
the build\tools\lldb\source directory.  For correct operation, and
parity with the shell script, it needs to resolve to the
build\tools\lldb\scripts directory.

llvm-svn: 212760

10 years agoAdd better logging to the new Python-based SWIG generation scripts.
Zachary Turner [Thu, 10 Jul 2014 20:25:18 +0000 (20:25 +0000)]
Add better logging to the new Python-based SWIG generation scripts.

llvm-svn: 212759

10 years ago[Mips] Make rel-dynamic-10.test test case independent from external input files.
Simon Atanasyan [Thu, 10 Jul 2014 19:47:23 +0000 (19:47 +0000)]
[Mips] Make rel-dynamic-10.test test case independent from external input files.

llvm-svn: 212758

10 years agoFix (and reenable) ppc64-align-struct.c test for non-assert builds.
Ulrich Weigand [Thu, 10 Jul 2014 19:19:03 +0000 (19:19 +0000)]
Fix (and reenable) ppc64-align-struct.c test for non-assert builds.

llvm-svn: 212757

10 years agoExtend the test coverage in combine-vec-shuffle-2.ll adding some negative tests.
Andrea Di Biagio [Thu, 10 Jul 2014 18:59:41 +0000 (18:59 +0000)]
Extend the test coverage in combine-vec-shuffle-2.ll adding some negative tests.

Add test cases where we don't expect to trigger the combine optimizations
introduced at revision 212748.

No functional change intended.

llvm-svn: 212756

10 years ago[doc] Fix incorrect reference to clang-format -> clang-tidy
Tobias Grosser [Thu, 10 Jul 2014 18:59:25 +0000 (18:59 +0000)]
[doc] Fix incorrect reference to clang-format -> clang-tidy

llvm-svn: 212755

10 years agoRemove use of uniform initialization ({}) introduced in r212725 since this isn't...
David Blaikie [Thu, 10 Jul 2014 18:46:15 +0000 (18:46 +0000)]
Remove use of uniform initialization ({}) introduced in r212725 since this isn't supported in MSVC.

llvm-svn: 212754

10 years agoAvoid definining more GCC specific predefined macros in clang-cl
Ehsan Akhgari [Thu, 10 Jul 2014 18:44:24 +0000 (18:44 +0000)]
Avoid definining more GCC specific predefined macros in clang-cl

Reviewers: hansw, rnk

Subscribers: cfe-commits

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

llvm-svn: 212753

10 years agoQuick (attempted) fix for non-asserts builds for a test introduced in r212743.
David Blaikie [Thu, 10 Jul 2014 18:40:54 +0000 (18:40 +0000)]
Quick (attempted) fix for non-asserts builds for a test introduced in r212743.

llvm-svn: 212752

10 years ago[Driver/Unittests] Follow up for r212666, add unit test for the newly exposed getARMC...
Argyrios Kyrtzidis [Thu, 10 Jul 2014 18:38:38 +0000 (18:38 +0000)]
[Driver/Unittests] Follow up for r212666, add unit test for the newly exposed getARMCPUForMArch() function.

llvm-svn: 212751

10 years agoRevert "Revert r212640, "Add trunc (select c, a, b) -> select c (trunc a), (trunc...
Matt Arsenault [Thu, 10 Jul 2014 18:21:04 +0000 (18:21 +0000)]
Revert "Revert r212640, "Add trunc (select c, a, b) -> select c (trunc a), (trunc b) combine.""

Don't try to convert the select condition type.

llvm-svn: 212750

10 years ago[TSan] Fix a bug in libcxx-tsan build conditions spotted by Ryuta Suzuki
Alexey Samsonov [Thu, 10 Jul 2014 18:17:51 +0000 (18:17 +0000)]
[TSan] Fix a bug in libcxx-tsan build conditions spotted by Ryuta Suzuki

llvm-svn: 212749

10 years ago[DAG] Further improve the logic in DAGCombiner that folds a pair of shuffles into...
Andrea Di Biagio [Thu, 10 Jul 2014 18:04:55 +0000 (18:04 +0000)]
[DAG] Further improve the logic in DAGCombiner that folds a pair of shuffles into a single shuffle if the resulting mask is legal.

This patch teaches the DAGCombiner how to fold shuffles according to the
following new rules:
  1. shuffle(shuffle(x, y), undef) -> x
  2. shuffle(shuffle(x, y), undef) -> y
  3. shuffle(shuffle(x, y), undef) -> shuffle(x, undef)
  4. shuffle(shuffle(x, y), undef) -> shuffle(y, undef)

The backend avoids to combine shuffles according to rules 3. and 4. if
the resulting shuffle does not have a legal mask. This is to avoid introducing
illegal shuffles that are potentially expanded into a sub-optimal sequence of
target specific dag nodes during vector legalization.

Added test case combine-vec-shuffle-2.ll to verify that we correctly triggers
the new rules when combining shuffles.

llvm-svn: 212748

10 years ago[X86] Mark pseudo instruction TEST8ri_NOEREX as hasSIdeEffects=0.
Akira Hatanaka [Thu, 10 Jul 2014 18:00:53 +0000 (18:00 +0000)]
[X86] Mark pseudo instruction TEST8ri_NOEREX as hasSIdeEffects=0.

Also, add a case clause in X86InstrInfo::shouldScheduleAdjacent to enable
macro-fusion.

<rdar://problem/15680770>

llvm-svn: 212747

10 years agoAdd the CSR company and the Kalimba DSP processor to Triple.
Eric Christopher [Thu, 10 Jul 2014 17:26:54 +0000 (17:26 +0000)]
Add the CSR company and the Kalimba DSP processor to Triple.

Patch by Matthew Gardiner with fixes by me.

llvm-svn: 212745

10 years agoMake it possible for the Subtarget to change between function
Eric Christopher [Thu, 10 Jul 2014 17:26:51 +0000 (17:26 +0000)]
Make it possible for the Subtarget to change between function
passes in the mips back end. This, unfortunately, required a
bit of churn in the various predicates to use a pointer rather
than a reference.

llvm-svn: 212744

10 years ago[PowerPC] ABI support for aligned by-value aggregates
Ulrich Weigand [Thu, 10 Jul 2014 17:20:07 +0000 (17:20 +0000)]
[PowerPC] ABI support for aligned by-value aggregates

This patch adds support for respecting the ABI and type alignment
of aggregates passed by value.  Currently, all aggregates are aligned
at 8 bytes in the parameter save area.  This is incorrect for two
reasons:

- Aggregates that need alignment of 16 bytes or more should be aligned
  at 16 bytes in the parameter save area.  This is implemented by
  using an appropriate "byval align" attribute in the IR.

- Aggregates that need alignment beyond 16 bytes need to be dynamically
  realigned by the caller.  This is implemented by setting the Realign
  flag of the ABIArgInfo::getIndirect call.

In addition, when expanding a va_arg call accessing a type that is
aligned at 16 bytes in the argument save area (either one of the
aggregate types as above, or a vector type which is already aligned
at 16 bytes), code needs to align the va_list pointer accordingly.

Reviewed by Hal Finkel.

llvm-svn: 212743

10 years agoInstCombine: Fix a crash in Descale for multiply-by-zero
Duncan P. N. Exon Smith [Thu, 10 Jul 2014 17:13:27 +0000 (17:13 +0000)]
InstCombine: Fix a crash in Descale for multiply-by-zero

Fix a crash in `InstCombiner::Descale()` when a multiply-by-zero gets
created as an argument to a GEP partway through an iteration, causing
-instcombine to optimize the GEP before the multiply.

rdar://problem/17615671

llvm-svn: 212742

10 years agoProvide -verify support to match "any" line for diagnostics in included files.
Andy Gibbs [Thu, 10 Jul 2014 16:43:29 +0000 (16:43 +0000)]
Provide -verify support to match "any" line for diagnostics in included files.

Allow diagnostic checks that originate in included files to be matched without necessarily determining the line number that the diagnostic occurs on.  The new syntax replaces the line number with '*'.  This extension is limited to diagnostics in included files and may be used where the include file is not part of the test-suite itself.

Expected uses are for diagnostics originating in system headers, or for users who use -verify in testing 3rd-party library code where the location of diagnostics in header files may change from revision to revision and their precise location is not important to the success of the test-case.

llvm-svn: 212735

10 years ago[PowerPC] ABI support for non-Altivec vector types
Ulrich Weigand [Thu, 10 Jul 2014 16:39:01 +0000 (16:39 +0000)]
[PowerPC] ABI support for non-Altivec vector types

This patch adds support for passing arguments of non-Altivec vector type
(i.e. defined via attribute ((vector_size (...)))) on powerpc64-linux.

While such types are not mentioned in the formal ABI document, this
patch implements a calling convention compatible with GCC:

- Vectors of size < 16 bytes are passed in a GPR
- Vectors of size > 16 bytes are passed via reference

Note that vector types with a number of elements that is not a power
of 2 are not supported by GCC, so there is no pre-existing ABI to
follow.  We choose to pass those (of size < 16) as if widened to the
next power of two, so they might end up in a vector register or
in a GPR.  (Sizes > 16 are always passed via reference as well.)

Reviewed by Hal Finkel.

llvm-svn: 212734

10 years agoFix clang tests to be compliant with LLVM IR aliases
David Majnemer [Thu, 10 Jul 2014 16:26:19 +0000 (16:26 +0000)]
Fix clang tests to be compliant with LLVM IR aliases

Comdat IR references were mistakenly printed for aliases when they
passed through the IR/AsmWriter code.

This makes clang's tests not check for the existance of these wrongly
printed comdat references.

llvm-svn: 212733

10 years agoIR: Aliases don't belong to an explicit comdat
David Majnemer [Thu, 10 Jul 2014 16:26:10 +0000 (16:26 +0000)]
IR: Aliases don't belong to an explicit comdat

Aliases inherit their comdat from their aliasee, they don't have an
explicit comdat.

This fixes PR20279.

llvm-svn: 212732

10 years ago[analyzer] Check for code testing a variable for 0 after using it as a denominator.
Jordan Rose [Thu, 10 Jul 2014 16:10:52 +0000 (16:10 +0000)]
[analyzer] Check for code testing a variable for 0 after using it as a denominator.

This new checker, alpha.core.TestAfterDivZero, catches issues like this:

  int sum = ...
  int avg = sum / count; // potential division by zero...
  if (count == 0) { ... } // ...caught here

Because the analyzer does not necessarily explore /all/ paths through a program,
this check is restricted to only work on zero checks that immediately follow a
division operation (/ % /= %=). This could later be expanded to handle checks
dominated by a division operation but not necessarily in the same CFG block.

Patch by Anders Rönnholm! (with very minor modifications by me)

llvm-svn: 212731

10 years agoFeeding isSafeToSpeculativelyExecute its DataLayout pointer (in Sink)
Hal Finkel [Thu, 10 Jul 2014 16:07:11 +0000 (16:07 +0000)]
Feeding isSafeToSpeculativelyExecute its DataLayout pointer (in Sink)

This is the one remaining place I see where passing
isSafeToSpeculativelyExecute a DataLayout pointer might matter (at least for
loads) -- I think I got the others in r212720. Most of the other remaining
callers of isSafeToSpeculativelyExecute only use it for call sites (or
otherwise exclude loads).

llvm-svn: 212730

10 years agoMips: Silence a -Wcovered-switch-default
David Majnemer [Thu, 10 Jul 2014 16:04:04 +0000 (16:04 +0000)]
Mips: Silence a -Wcovered-switch-default

Remove a default label which covered no enumerators, replace it with a
llvm_unreachable.

No functionality changed.

llvm-svn: 212729

10 years ago[Codestyle][x32] Cosmetic codestyle fix.
Zinovy Nis [Thu, 10 Jul 2014 15:42:35 +0000 (15:42 +0000)]
[Codestyle][x32] Cosmetic codestyle fix.

llvm-svn: 212728

10 years agoSupport the built-in type-trait support in gcc 4.7 and later. Thanks to Albert Wong...
Marshall Clow [Thu, 10 Jul 2014 15:38:20 +0000 (15:38 +0000)]
Support the built-in type-trait support in gcc 4.7 and later. Thanks to Albert Wong for the patch.

llvm-svn: 212727

10 years ago[mips] Added FPXX modeless calling convention.
Zoran Jovanovic [Thu, 10 Jul 2014 15:36:12 +0000 (15:36 +0000)]
[mips] Added FPXX modeless calling convention.
Differential Revision: http://reviews.llvm.org/D4293

llvm-svn: 212726

10 years ago[x32] Adding X32 target support to driver, including TargetInfo,DescriptionString...
Zinovy Nis [Thu, 10 Jul 2014 15:27:19 +0000 (15:27 +0000)]
[x32] Adding X32 target support to driver, including TargetInfo,DescriptionString, flags, paths lookup, etc. Cover changes with new tests. The author of the patch is Pavel Chupin (@pavel.v.chupin).
The changes enable "hello world" on x32 target (x86_64-*-linux-gnux32). s/isX32/IsX32/ also fixed.

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

llvm-svn: 212725

10 years agoAdd support for BIONIC C library (Android). Patch from Dan Albert
Marshall Clow [Thu, 10 Jul 2014 15:20:28 +0000 (15:20 +0000)]
Add support for BIONIC C library (Android). Patch from Dan Albert

llvm-svn: 212724

10 years agoFix warning in test - missing exception specifier for overload of operator new
Marshall Clow [Thu, 10 Jul 2014 15:19:50 +0000 (15:19 +0000)]
Fix warning in test - missing exception specifier for overload of operator new

llvm-svn: 212723

10 years ago[AArch64] Add logical alias instructions to MC AsmParser
Arnaud A. de Grandmaison [Thu, 10 Jul 2014 15:12:26 +0000 (15:12 +0000)]
[AArch64] Add logical alias instructions to MC AsmParser

This patch teaches the AsmParser to accept some logical+immediate
instructions and convert them as shown:

  bic  Rd, Rn, #imm  ->  and Rd, Rn, #~imm
  bics Rd, Rn, #imm  ->  ands Rd, Rn, #~imm
  orn  Rd, Rn, #imm  ->  orr Rd, Rn, #~imm
  eon  Rd, Rn, #imm  ->  eor Rd, Rn, #~imm

Those instructions are an alternate syntax available to assembly coders,
and are needed in order to support code already compiling with some other
assemblers. For example, the bic construct is used by the linux kernel.

llvm-svn: 212722

10 years agoReapply typo fix.
Bruce Mitchener [Thu, 10 Jul 2014 14:45:57 +0000 (14:45 +0000)]
Reapply typo fix.

This was lost in the re-merging of command validation changes.

llvm-svn: 212721

10 years agoFeeding isSafeToSpeculativelyExecute its DataLayout pointer
Hal Finkel [Thu, 10 Jul 2014 14:41:31 +0000 (14:41 +0000)]
Feeding isSafeToSpeculativelyExecute its DataLayout pointer

isSafeToSpeculativelyExecute can optionally take a DataLayout pointer. In the
past, this was mainly used to make better decisions regarding divisions known
not to trap, and so was not all that important for users concerned with "cheap"
instructions. However, now it also helps look through bitcasts for
dereferencable loads, and will also be important if/when we add a
dereferencable pointer attribute.

This is some initial work to feed a DataLayout pointer through to callers of
isSafeToSpeculativelyExecute, generally where one was already available.

llvm-svn: 212720

10 years ago[mips][mips64r6] Add support for mips-img-linux-gnu GCC toolchains
Daniel Sanders [Thu, 10 Jul 2014 14:40:57 +0000 (14:40 +0000)]
[mips][mips64r6] Add support for mips-img-linux-gnu GCC toolchains

Summary:
* Support the multilib layout used by the mips-img-linux-gnu
* Recognize mips{,64}{,el}-img-linux-gnu as being aliases of mips-img-linux-gnu
* Use the correct dynamic linker for mips-img-linux-gnu
* Make mips32r6/mips64r6 the default CPU for mips-img-linux-gnu

Subscribers: mpf

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

llvm-svn: 212719

10 years agoAArch64: correctly fast-isel i8 & i16 multiplies
Tim Northover [Thu, 10 Jul 2014 14:18:46 +0000 (14:18 +0000)]
AArch64: correctly fast-isel i8 & i16 multiplies

We were asking for a register for type i8 or i16 which caused an assert.

rdar://problem/17620015

llvm-svn: 212718

10 years ago[mips] Add support for -modd-spreg/-mno-odd-spreg
Daniel Sanders [Thu, 10 Jul 2014 13:38:23 +0000 (13:38 +0000)]
[mips] Add support for -modd-spreg/-mno-odd-spreg

Summary:
When -mno-odd-spreg is in effect, 32-bit floating point values are not
permitted in odd FPU registers. The option also prohibits 32-bit and 64-bit
floating point comparison results from being written to odd registers.

This option has three purposes:
* It allows support for certain MIPS implementations such as loongson-3a that
  do not allow the use of odd registers for single precision arithmetic.
* When using -mfpxx, -mno-odd-spreg is the default and this allows us to
  statically check that code is compliant with the O32 FPXX ABI since mtc1/mfc1
  instructions to/from odd registers are guaranteed not to appear for any
  reason. Once this has been established, the user can then re-enable
  -modd-spreg to regain the use of all 32 single-precision registers.
* When using -mfp64 and -mno-odd-spreg together, an O32 extension named
  O32 FP64A is used as the ABI. This is intended to provide almost all
  functionality of an FR=1 processor but can also be executed on a FR=0 core
  with the assistance of a hardware compatibility mode which emulates FR=0
  behaviour on an FR=1 processor.

* Added '.module oddspreg' and '.module nooddspreg' each of which update
  the .MIPS.abiflags section appropriately
* Moved setFpABI() call inside emitDirectiveModuleFP() so that the caller
  doesn't have to remember to do it.
* MipsABIFlags now calculates the flags1 and flags2 member on demand rather
  than trying to maintain them in the same format they will be emitted in.

There is one portion of the -mfp64 and -mno-odd-spreg combination that is not
implemented yet. Moves to/from odd-numbered double-precision registers must not
use mtc1. I will fix this in a follow-up.

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

llvm-svn: 212717

10 years ago[x32] Add AsmBackend for X32 which uses ELF32 with x86_64 (the author is Pavel Chupin).
Zinovy Nis [Thu, 10 Jul 2014 13:03:26 +0000 (13:03 +0000)]
[x32] Add AsmBackend for X32 which uses ELF32 with x86_64 (the author is Pavel Chupin).

This is minimal change for backend required to have "hello world" compiled and working on x32 target (x86_64-linux-gnux32). More patches for x32 will follow.

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

llvm-svn: 212716

10 years ago[msan] Fix performance issue in fast_memset.
Evgeniy Stepanov [Thu, 10 Jul 2014 12:45:56 +0000 (12:45 +0000)]
[msan] Fix performance issue in fast_memset.

Fast path was never triggered when called from __msan_poison.

llvm-svn: 212715

10 years ago[x86,SDAG] Introduce any- and sign-extend-vector-inreg nodes analogous
Chandler Carruth [Thu, 10 Jul 2014 12:32:32 +0000 (12:32 +0000)]
[x86,SDAG] Introduce any- and sign-extend-vector-inreg nodes analogous
to the zero-extend-vector-inreg node introduced previously for the same
purpose: manage the type legalization of widened extend operations,
especially to support the experimental widening mode for x86.

I'm adding both because sign-extend is expanded in terms of any-extend
with shifts to propagate the sign bit. This removes the last
fundamental scalarization from vec_cast2.ll (a test case that hit many
really bad edge cases for widening legalization), although the trunc
tests in that file still appear scalarized because the the shuffle
legalization is scalarizing. Funny thing, I've been working on that.

Some initial experiments with this and SSE2 scenarios is showing
moderately good behavior already for sign extension. Still some work to
do on the shuffle combining on X86 before we're generating optimal
sequences, but avoiding scalarization is a huge step forward.

llvm-svn: 212714

10 years ago[mach-o]: support -Z option to skip standard library paths
Tim Northover [Thu, 10 Jul 2014 11:46:13 +0000 (11:46 +0000)]
[mach-o]: support -Z option to skip standard library paths

llvm-svn: 212713

10 years ago[mach-o]: support user-specified (-L) library search paths
Tim Northover [Thu, 10 Jul 2014 11:46:08 +0000 (11:46 +0000)]
[mach-o]: support user-specified (-L) library search paths

llvm-svn: 212712

10 years ago[SystemZ] Use SystemZCallingConv.td to define callee-saved registers
Richard Sandiford [Thu, 10 Jul 2014 11:44:37 +0000 (11:44 +0000)]
[SystemZ] Use SystemZCallingConv.td to define callee-saved registers

Just a clean-up.  No behavioral change intended.

llvm-svn: 212711

10 years agoSpecialCaseList.h: Fix -Wdocumentation with \code.
NAKAMURA Takumi [Thu, 10 Jul 2014 11:39:59 +0000 (11:39 +0000)]
SpecialCaseList.h: Fix -Wdocumentation with \code.

llvm-svn: 212710

10 years agollvm/test/CodeGen/X86/shift-parts.ll: FileCheck-ize. (from r212640)
NAKAMURA Takumi [Thu, 10 Jul 2014 11:37:39 +0000 (11:37 +0000)]
llvm/test/CodeGen/X86/shift-parts.ll: FileCheck-ize. (from r212640)

llvm-svn: 212709

10 years agoRevert r212640, "Add trunc (select c, a, b) -> select c (trunc a), (trunc b) combine."
NAKAMURA Takumi [Thu, 10 Jul 2014 11:37:28 +0000 (11:37 +0000)]
Revert r212640, "Add trunc (select c, a, b) -> select c (trunc a), (trunc b) combine."

This caused miscompilation on, at least, x86-64. SExt(i1 cond) confused other optimizations.

llvm-svn: 212708

10 years ago[SystemZ] Tweak instruction format classifications
Richard Sandiford [Thu, 10 Jul 2014 11:29:23 +0000 (11:29 +0000)]
[SystemZ] Tweak instruction format classifications

There's no real need to have Shift as a separate format type from Binary.
The comments for other format types were too specific and in some cases
no longer accurate.

Just a clean-up, no behavioral change intended.

llvm-svn: 212707

10 years ago[mach-o]: support -syslibroot and -l options
Tim Northover [Thu, 10 Jul 2014 11:21:06 +0000 (11:21 +0000)]
[mach-o]: support -syslibroot and -l options

These behave slightly idiosyncratically in the best of cases, and have
additional hacks layered on top of that for compatibility with badly behaved
build systems (via ld64).

For -lXYZ:
  + If XYZ is actually XY.o then search all library paths for XY.o
  + Otherwise search all library paths, first for libXYZ.dylib, then libXYZ.a
  + By default the library paths are /usr/lib and /usr/local/lib in that order.

For -syslibroot:
  + -syslibroot options apply to absolute paths in the search order.
  + All -syslibroot prefixes that exist are added to the search path *instead*
    of the original.
  + If no -syslibroot prefixed path exists, the original is kept.
  + Hacks^WExceptions:
      + If only 1 -syslibroot is given and doesn't contain /usr/lib or
        /usr/local/lib, that path is dropped entirely. (rdar://problem/6438270).
      + If the last -syslibroot is "/", all of them are ignored entirely.
        (rdar://problem/5829579).

At least, that's my best interpretation of what ld64 does in buildSearchPaths.

llvm-svn: 212706

10 years ago[x86] Add another combine that is particularly useful for the new vector
Chandler Carruth [Thu, 10 Jul 2014 11:09:29 +0000 (11:09 +0000)]
[x86] Add another combine that is particularly useful for the new vector
shuffle lowering: match shuffle patterns equivalent to an unpcklwd or
unpckhwd instruction.

This allows us to use generic lowering code for v8i16 shuffles and match
the unpack pattern late.

llvm-svn: 212705

10 years ago[msan] Switch chained origins hash to murmur2.
Evgeniy Stepanov [Thu, 10 Jul 2014 11:02:33 +0000 (11:02 +0000)]
[msan] Switch chained origins hash to murmur2.

llvm-svn: 212704

10 years ago[SystemZ] Add MC support for LEDBRA, LEXBRA and LDXBRA
Richard Sandiford [Thu, 10 Jul 2014 11:00:55 +0000 (11:00 +0000)]
[SystemZ] Add MC support for LEDBRA, LEXBRA and LDXBRA

These instructions aren't used for codegen since the original L*DB instructions
are suitable for fround.

llvm-svn: 212703

10 years ago[SystemZ] Avoid using i8 constants for immediate fields
Richard Sandiford [Thu, 10 Jul 2014 10:52:51 +0000 (10:52 +0000)]
[SystemZ] Avoid using i8 constants for immediate fields

Immediate fields that have no natural MVT type tended to use i8 if the
field was small enough.  This was a bit confusing since i8 isn't a legal
type for the target.  Fields for short immediates in a 32-bit or 64-bit
operation use i32 or i64 instead, so it would be better to do the same
for all fields.

No behavioral change intended.

llvm-svn: 212702

10 years ago[SystemZ] Fix FPR dwarf numbering
Richard Sandiford [Thu, 10 Jul 2014 10:45:11 +0000 (10:45 +0000)]
[SystemZ] Fix FPR dwarf numbering

The dwarf FPR numbers are supposed to have the order F0, F2, F4, F6,
F1, F3, F5, F7, F8, etc., which matches the pairing of registers for
long doubles.  E.g. a long double stored in F0 is paired with F2.

llvm-svn: 212701

10 years ago[mips] Add support for -modd-spreg/-mno-odd-spreg
Daniel Sanders [Thu, 10 Jul 2014 10:39:51 +0000 (10:39 +0000)]
[mips] Add support for -modd-spreg/-mno-odd-spreg

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

llvm-svn: 212700

10 years ago[ASan/Win] Don't hardcode ASan runtime version in ASan dll thunk
Timur Iskhodzhanov [Thu, 10 Jul 2014 10:33:48 +0000 (10:33 +0000)]
[ASan/Win] Don't hardcode ASan runtime version in ASan dll thunk

Reviewed at http://reviews.llvm.org/D4459

llvm-svn: 212699