platform/upstream/llvm.git
10 years agoPPCAsmParser: Stop leaking names.
Benjamin Kramer [Sat, 3 Aug 2013 22:43:29 +0000 (22:43 +0000)]
PPCAsmParser: Stop leaking names.

Store them in a place that gets cleaned up properly.

llvm-svn: 187700

10 years agoUnbreak llvm-rtdyld build.
Benjamin Kramer [Sat, 3 Aug 2013 22:18:45 +0000 (22:18 +0000)]
Unbreak llvm-rtdyld build.

llvm-svn: 187699

10 years agoMachObjectFile: Don't leak on error.
Benjamin Kramer [Sat, 3 Aug 2013 22:16:37 +0000 (22:16 +0000)]
MachObjectFile: Don't leak on error.

llvm-svn: 187698

10 years agollvm-rtdyld: Don't leak memory managers.
Benjamin Kramer [Sat, 3 Aug 2013 22:16:31 +0000 (22:16 +0000)]
llvm-rtdyld: Don't leak memory managers.

Dyld never outlives MemMgr, just put both on the stack.

llvm-svn: 187697

10 years agoARMAsmParser: Plug a leak.
Benjamin Kramer [Sat, 3 Aug 2013 22:16:24 +0000 (22:16 +0000)]
ARMAsmParser: Plug a leak.

Using an object to do the cleanup may look like overkill, but it's safer and nicer than putting deletes everywhere.

llvm-svn: 187696

10 years agoStop leaking register infos in the disassemblers.
Benjamin Kramer [Sat, 3 Aug 2013 22:16:16 +0000 (22:16 +0000)]
Stop leaking register infos in the disassemblers.

llvm-svn: 187695

10 years agoAdd support for passing -1 to __builtin_shufflevector to signify an undefined element...
Craig Topper [Sat, 3 Aug 2013 17:40:38 +0000 (17:40 +0000)]
Add support for passing -1 to __builtin_shufflevector to signify an undefined element value to match IR capabilities.

llvm-svn: 187694

10 years agoFix PPC64 64-bit GPR inline asm constraint matching
Hal Finkel [Sat, 3 Aug 2013 12:25:10 +0000 (12:25 +0000)]
Fix PPC64 64-bit GPR inline asm constraint matching

Internally, the PowerPC backend names the 32-bit GPRs R[0-9]+, and names the
64-bit parent GPRs X[0-9]+. When matching inline assembly constraints with
explicit register names, on PPC64 when an i64 MVT has been requested, we need
to follow gcc's convention of using r[0-9]+ to refer to the 64-bit (parent)
registers.

At some point, we'll probably want to arrange things so that the generic code
in TargetLowering uses the AsmName fields declared in *RegisterInfo.td in order
to match these inline asm register constraints. If we do that, this change can
be reverted.

llvm-svn: 187693

10 years agoMinor address space code simplification.
Matt Arsenault [Sat, 3 Aug 2013 01:03:12 +0000 (01:03 +0000)]
Minor address space code simplification.

Remove assertion that the verifier should catch.

llvm-svn: 187692

10 years agoRemove unused using's.
Rui Ueyama [Fri, 2 Aug 2013 23:22:46 +0000 (23:22 +0000)]
Remove unused using's.

llvm-svn: 187690

10 years agoOptions.td: remove _DASH_DASH
Hans Wennborg [Fri, 2 Aug 2013 23:21:32 +0000 (23:21 +0000)]
Options.td: remove _DASH_DASH

Since LLVM r187675, this is handled by the option parsing code itself.

llvm-svn: 187689

10 years ago[PECOFF] Move more code from Atoms.h to ReaderCOFF.cpp.
Rui Ueyama [Fri, 2 Aug 2013 22:58:22 +0000 (22:58 +0000)]
[PECOFF] Move more code from Atoms.h to ReaderCOFF.cpp.

llvm-svn: 187688

10 years agoRegenerate with changes for -rdynamic.
Bob Wilson [Fri, 2 Aug 2013 22:51:11 +0000 (22:51 +0000)]
Regenerate with changes for -rdynamic.

llvm-svn: 187687

10 years agoLink with -rdynamic instead of -Wl,-export-dynamic.
Bob Wilson [Fri, 2 Aug 2013 22:51:06 +0000 (22:51 +0000)]
Link with -rdynamic instead of -Wl,-export-dynamic.

Recent versions of the OS X linker support this but follow the existing
OS X linker convention of using an underscore in the option name, i.e.,
-export_dynamic. Rather than changing our configure scripts to check for
that alternate spelling, it is simpler to just use the compiler's -rdynamic
option and let it deal with translating that to the appropriate linker
option. One potential disadvantage of this approach is that the compiler
will typically ignore -rdynamic on platforms where it is not supported, so
the HAVE_LINK_EXPORT_DYNAMIC in config.h will not necessarily show whether
that option has any effect or not. I don't see any in-tree uses of that
macro, so I'm assuming it is OK.

llvm-svn: 187686

10 years agoAdd a AttributeSetImpl::dump function.
Peter Collingbourne [Fri, 2 Aug 2013 22:34:30 +0000 (22:34 +0000)]
Add a AttributeSetImpl::dump function.

This is for the benefit of those of us with inferior debuggers which
do not permit member function calls on value types.

llvm-svn: 187685

10 years agoObjectiveC migrator. Differentiate 'instancetype'
Fariborz Jahanian [Fri, 2 Aug 2013 22:34:18 +0000 (22:34 +0000)]
ObjectiveC migrator. Differentiate 'instancetype'
from 'id' result type when deciding on migration
to instancetype.

llvm-svn: 187684

10 years ago[PECOFF] Remove special treatment of "--" option.
Rui Ueyama [Fri, 2 Aug 2013 22:34:12 +0000 (22:34 +0000)]
[PECOFF] Remove special treatment of "--" option.

Thanks to Hans' patch (r187675), OptTable now handles "--", so we don't
need this code in LLD.

llvm-svn: 187683

10 years agoMake one of the AttributeSet ctors maintain the invariant that the
Peter Collingbourne [Fri, 2 Aug 2013 22:29:40 +0000 (22:29 +0000)]
Make one of the AttributeSet ctors maintain the invariant that the
attribute list is ordered by index.

Differential Revision: http://llvm-reviews.chandlerc.com/D1265

llvm-svn: 187682

10 years ago[PECOFF] Remove COFFDefinedFileAtom::originalOffset().
Rui Ueyama [Fri, 2 Aug 2013 22:27:15 +0000 (22:27 +0000)]
[PECOFF] Remove COFFDefinedFileAtom::originalOffset().

The aim of this patch is to reduce the dependency from COFFDefinedAtom
to COFF structs defined in llvm/Object/COFF.h. Currently many attributes
of the atom are computed in the atom. That provide a simple interface but
does not work well in some cases.

There are some cases that the same type atom is created from different
parts of a COFF file. One example is the BSS atom, which can be created
from the defined symbol in the .bss section or from the undefined symbol.
Computing attributes from different sources in the atom complicates the
code. We should compute it outside the atom.

In the next patch, I'll move more code from Atoms.h to ReaderCOFF.cpp.

llvm-svn: 187681

10 years agoOnly use the Darwin linker's -export_dynamic option with supported versions.
Bob Wilson [Fri, 2 Aug 2013 22:25:34 +0000 (22:25 +0000)]
Only use the Darwin linker's -export_dynamic option with supported versions.

Related to <rdar://problem/14578094>.

llvm-svn: 187680

10 years agoRe-commit r187637: "clang-cl: add more options"
Hans Wennborg [Fri, 2 Aug 2013 22:24:50 +0000 (22:24 +0000)]
Re-commit r187637: "clang-cl: add more options"

> This adds a bunch of options to clang-cl. Notably, this includes
> all the options that get passed when doing a default build of a
> command-line project with msbuild.exe in Debug and Release modes,
> and I believe all flags from Reid's original patch.

The original commit was reverted in r187640 after it broke the Mac build.

This should now be fixed, by Clang r187668, LLVM r187675, and putting
a -- before %s in the test.

llvm-svn: 187679

10 years agoImplement Allman style.
Manuel Klimek [Fri, 2 Aug 2013 21:31:59 +0000 (21:31 +0000)]
Implement Allman style.

Patch by Frank Miller.

llvm-svn: 187678

10 years ago[PECOFF] Handle .drectve section.
Rui Ueyama [Fri, 2 Aug 2013 21:26:14 +0000 (21:26 +0000)]
[PECOFF] Handle .drectve section.

Summary:
The .drectve section contains linker command line options, and the linker is
expected to interpret them as if they were given via the command line. In this
patch, the command line parser in the driver is called from the object file
reader to parse the string.

I think this patch is important, because this is the first step towards mutable
TargetInfo. We had a discussion about that on llvm-commits mailing list before.
I haven't removed "const" from the function signature yet. Instead, I just use
cast to remove "const". This is a temporary aid for an experiment. If we don't
see any issue with this mutable TargetInfo appraoch, I'll change the function
signature, and rename the class LinkerContext from TargetInfo.

Reviewers: kledzik

CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1246

llvm-svn: 187677

10 years agoFix crash when encountering alias templates in isDerivedFrom matches.
Manuel Klimek [Fri, 2 Aug 2013 21:24:09 +0000 (21:24 +0000)]
Fix crash when encountering alias templates in isDerivedFrom matches.

- pull out function to drill to the CXXRecordDecl from the type,
  to allow recursive resolution
- make the analysis more robust by rather skipping values we don't
  understand

llvm-svn: 187676

10 years agoOption parsing: recognize the special -- token
Hans Wennborg [Fri, 2 Aug 2013 21:20:27 +0000 (21:20 +0000)]
Option parsing: recognize the special -- token

Everything that comes after -- should be treated as a filename. This
enables passing in filenames that would otherwise be conflated with
command-line options.

This is especially important for clang-cl which supports options
starting with /, which are easily conflatable with Unix-style
path names.

Differential Revision: http://llvm-reviews.chandlerc.com/D1274

llvm-svn: 187675

10 years agoFix invalid function pointers in bugpoint ExtractLoops
Hal Finkel [Fri, 2 Aug 2013 21:13:42 +0000 (21:13 +0000)]
Fix invalid function pointers in bugpoint ExtractLoops

The ExtractLoops function tries to reduce the failing test case by extracting
one or more loops from the misoptimized piece of the program. In doing this,
ExtractLoops must keep the MiscompiledFunctions vector up-to-date by ensuring
that the pointers refer to functions in the current failing program.
Unfortunately, this is not trivial because:

 - ExtractLoops is iterative, and there are several early exits (and the
   MiscompiledFunctions vector must be consistent with the current program at
every non-fatal exit point).
 - Several of the utility functions used by ExtractLoops (such as
   TestOptimizer, some of which are called through the TestFn callback
parameter, and Linker::LinkModules) delete their inputs upon success.

This change adds several updates of the MiscompiledFunctions vector at
different points. The first is after the initial call to TestMergedProgram
which checks that the loop-extracted program still works. The second is after
the call to TestFn (TestOptimizer, for example). This function will delete its
inputs (which is why the existing ExtractLoops logic cloned the inputs first).

llvm-svn: 187674

10 years ago[PECOFF] Return an error_code instead of calling report_fatal_error().
Rui Ueyama [Fri, 2 Aug 2013 21:10:17 +0000 (21:10 +0000)]
[PECOFF] Return an error_code instead of calling report_fatal_error().

For an invalid input we should not call report_fatal_error(), because
when LLD is used as a library, we don't want to kill the whole app
because of a malformed input.

llvm-svn: 187673

10 years agoObjectiveC migrator: Add another family of factory
Fariborz Jahanian [Fri, 2 Aug 2013 20:54:18 +0000 (20:54 +0000)]
ObjectiveC migrator: Add another family of factory
methods which can be migrated to instancetype.

llvm-svn: 187672

10 years agoAdd a missing 'return' statement.
Joey Gouly [Fri, 2 Aug 2013 20:50:01 +0000 (20:50 +0000)]
Add a missing 'return' statement.

llvm-svn: 187671

10 years agoUse report_fatal_error() instead of llvm_unreachable() to show broken input file...
Rui Ueyama [Fri, 2 Aug 2013 20:45:25 +0000 (20:45 +0000)]
Use report_fatal_error() instead of llvm_unreachable() to show broken input file error.

llvm-svn: 187670

10 years agoFix missing * making the C++ mode thing not work
Matt Arsenault [Fri, 2 Aug 2013 20:43:37 +0000 (20:43 +0000)]
Fix missing * making the C++ mode thing not work

llvm-svn: 187669

10 years agoCC1: Only parse command-line options that have the CC1Option flag.
Hans Wennborg [Fri, 2 Aug 2013 20:16:22 +0000 (20:16 +0000)]
CC1: Only parse command-line options that have the CC1Option flag.

We already reject flags that don't have the CC1Option flag,
but we would previously do so after parsing the command-line
arguments.

Since the option parser now has a parameter for excluding options,
we should just use that instead.

Differential Revision: http://llvm-reviews.chandlerc.com/D1270

llvm-svn: 187668

10 years ago[mips] Expand vector truncating stores and extending loads.
Akira Hatanaka [Fri, 2 Aug 2013 19:23:33 +0000 (19:23 +0000)]
[mips] Expand vector truncating stores and extending loads.

llvm-svn: 187667

10 years ago[ARMv8] Add an assembler warning for the deprecated 'setend' instruction.
Joey Gouly [Fri, 2 Aug 2013 19:18:12 +0000 (19:18 +0000)]
[ARMv8] Add an assembler warning for the deprecated 'setend' instruction.

llvm-svn: 187666

10 years ago[PECOFF] Remove an assertion that's too heavy.
Rui Ueyama [Fri, 2 Aug 2013 19:10:29 +0000 (19:10 +0000)]
[PECOFF] Remove an assertion that's too heavy.

llvm-svn: 187665

10 years ago[PECOFF] Relocations now take into account the address which is stored at the relocat...
Rui Ueyama [Fri, 2 Aug 2013 18:40:50 +0000 (18:40 +0000)]
[PECOFF] Relocations now take into account the address which is stored at the relocation site

Patch by Ron Ofir.

llvm-svn: 187664

10 years agoSLPVectorizer: Fix PR16777. PHInodes may use multiple extracted values that come...
Nadav Rotem [Fri, 2 Aug 2013 18:40:24 +0000 (18:40 +0000)]
SLPVectorizer: Fix PR16777. PHInodes may use multiple extracted values that come from different blocks.
Thanks Alexey Samsonov.

llvm-svn: 187663

10 years agoTeach EmitGEPOffset about address spaces
Matt Arsenault [Fri, 2 Aug 2013 18:33:34 +0000 (18:33 +0000)]
Teach EmitGEPOffset about address spaces

llvm-svn: 187662

10 years agoObjectiveC migrator: Fixes public buildbot failures,
Fariborz Jahanian [Fri, 2 Aug 2013 18:00:53 +0000 (18:00 +0000)]
ObjectiveC migrator: Fixes public buildbot failures,
in my previous patch which was reverted in r187657

llvm-svn: 187661

10 years agoMark additional icc test failures as expected fail.
Matt Kopec [Fri, 2 Aug 2013 17:53:28 +0000 (17:53 +0000)]
Mark additional icc test failures as expected fail.

llvm-svn: 187660

10 years agodebug mode for unordered_map. Also picked up a missing check and test in unordered_m...
Howard Hinnant [Fri, 2 Aug 2013 17:50:49 +0000 (17:50 +0000)]
debug mode for unordered_map.  Also picked up a missing check and test in unordered_multimap.  This wraps up debug mode for the unordered containers.

llvm-svn: 187659

10 years agoFixes ARM LNT bot from SLP change in O3
Renato Golin [Fri, 2 Aug 2013 17:10:04 +0000 (17:10 +0000)]
Fixes ARM LNT bot from SLP change in O3

This patch fixes the multiple breakages on ARM test-suite after the SLP
vectorizer was introduced by default on O3. The problem was an illegal
vector type on ARMTTI::getCmpSelInstrCost() <3 x i1> which is not simple.

The guard protects this code from breaking (cause of the problems) but
doesn't fix the issue that is generating the odd vector in the first
place, which also needs to be investigated.

llvm-svn: 187658

10 years agorevert patch I added in r187655. It still breaks public
Fariborz Jahanian [Fri, 2 Aug 2013 16:25:41 +0000 (16:25 +0000)]
revert patch I added in r187655. It still breaks public
buildbot.

llvm-svn: 187657

10 years agoBugfix for making the DWARF debug strings and labels to code emitted as secrel32...
Carlo Kok [Fri, 2 Aug 2013 16:14:15 +0000 (16:14 +0000)]
Bugfix for making the DWARF debug strings and labels to code emitted as secrel32 instead of long opcodes (only for coff). This makes them debuggable with GDB (with fix for 64bits msvc)

llvm-svn: 187656

10 years agoObjectiveC migration. Check-in patch reverted in r187634.
Fariborz Jahanian [Fri, 2 Aug 2013 16:00:08 +0000 (16:00 +0000)]
ObjectiveC migration. Check-in patch reverted in r187634.
Also removed check for "NS" prefix for class name.

llvm-svn: 187655

10 years agoConvert last use of st_dev in clang.
Rafael Espindola [Fri, 2 Aug 2013 15:31:35 +0000 (15:31 +0000)]
Convert last use of st_dev in clang.

llvm-svn: 187654

10 years ago[msan] Allocator statistics interface and malloc hooks.
Evgeniy Stepanov [Fri, 2 Aug 2013 14:26:58 +0000 (14:26 +0000)]
[msan] Allocator statistics interface and malloc hooks.

llvm-svn: 187653

10 years agoRemove rather oddly merged logic from AArch64 commit.
Tim Northover [Fri, 2 Aug 2013 11:38:46 +0000 (11:38 +0000)]
Remove rather oddly merged logic from AArch64 commit.

We seem to have ended up with both an inlined check of permitted NEON base
types and a call to a function.

Since the outer if was (I believe) strictly weaker than the one in the
function, there's no actual user-visible behaviour change, so no tests.

llvm-svn: 187652

10 years agoFix handling of CHECK-DAG combined with CHECK-NOT
Tim Northover [Fri, 2 Aug 2013 11:32:50 +0000 (11:32 +0000)]
Fix handling of CHECK-DAG combined with CHECK-NOT

Patch by Daniel Sanders.

llvm-svn: 187651

10 years agoclang-format: Fix string breaking after "<<".
Daniel Jasper [Fri, 2 Aug 2013 11:01:15 +0000 (11:01 +0000)]
clang-format: Fix string breaking after "<<".

Before, clang-format would not break overly long string literals
following a "<<" with FormatStyle::AlwaysBreakBeforeMultilineStrings
being set.

llvm-svn: 187650

10 years agoPacify GCC, which worries about falling off the end of the switch.
Duncan Sands [Fri, 2 Aug 2013 09:37:20 +0000 (09:37 +0000)]
Pacify GCC, which worries about falling off the end of the switch.

llvm-svn: 187649

10 years ago[msan] Fix unused function warning in the tests.
Evgeniy Stepanov [Fri, 2 Aug 2013 09:09:02 +0000 (09:09 +0000)]
[msan] Fix unused function warning in the tests.

llvm-svn: 187648

10 years agoAssume UniqueID is zero for invalid PPRegion to fix uninitialized reads reported...
Alexey Samsonov [Fri, 2 Aug 2013 09:06:39 +0000 (09:06 +0000)]
Assume UniqueID is zero for invalid PPRegion to fix uninitialized reads reported by MSan

llvm-svn: 187647

10 years agoFix dereferencing end iterator in SimplifyCFG. Patch by Ye Mei.
Alexey Samsonov [Fri, 2 Aug 2013 08:06:43 +0000 (08:06 +0000)]
Fix dereferencing end iterator in SimplifyCFG. Patch by Ye Mei.

llvm-svn: 187646

10 years ago[PECOFF] A symbol with symbol with section number 0 and non-zero value represents...
Rui Ueyama [Fri, 2 Aug 2013 05:25:31 +0000 (05:25 +0000)]
[PECOFF] A symbol with symbol with section number 0 and non-zero value represents a BSS atom.

llvm-svn: 187645

10 years agoFix indentation. No functional change.
Craig Topper [Fri, 2 Aug 2013 05:10:31 +0000 (05:10 +0000)]
Fix indentation. No functional change.

llvm-svn: 187644

10 years ago[PECOFF] Simplify COFFBSSAtom.
Rui Ueyama [Fri, 2 Aug 2013 05:04:06 +0000 (05:04 +0000)]
[PECOFF] Simplify COFFBSSAtom.

A instance of the class always represents a BSS atom, so we don't need
to look at the symbol or the section to retrieve its attributes.

llvm-svn: 187643

10 years agoRevert r187597, "Bugfix for making the DWARF debug strings and labels to code emitted...
NAKAMURA Takumi [Fri, 2 Aug 2013 03:46:05 +0000 (03:46 +0000)]
Revert r187597, "Bugfix for making the DWARF debug strings and labels to code emitted as secrel32 instead of long opcodes (only for coff). This makes them debuggable with GDB."

It broke x86_64-win32 builder in llvm/test/DebugInfo.

llvm-svn: 187642

10 years agoUse @rpath for libraries rather than @executable_path on OSX.
Eric Christopher [Fri, 2 Aug 2013 01:51:52 +0000 (01:51 +0000)]
Use @rpath for libraries rather than @executable_path on OSX.

Patch by Benjamin Scarlet!

llvm-svn: 187641

10 years agoRevert r187537 "clang-cl: add more options"
Hans Wennborg [Fri, 2 Aug 2013 01:29:28 +0000 (01:29 +0000)]
Revert r187537 "clang-cl: add more options"

It broke the "phase1 - sanity" buildbot. Reverting until
we can figure out what's going on.

And Eric says it broke all current Mac builds actually.

llvm-svn: 187640

10 years agoWhen merging redeclaration chains across modules, if a declaration is visible
Richard Smith [Fri, 2 Aug 2013 01:09:12 +0000 (01:09 +0000)]
When merging redeclaration chains across modules, if a declaration is visible
in one module but is only declared as a friend in another module, keep it
visible in the result of the merge.

This is incomplete on two axes:

1) Our handling of local extern declarations is basically broken (we put them
in the wrong decl context, and don't find them in redeclaration lookup, unless
they've previously been declared), and this results in them making friends
visible after a merge.

2) Eventually we'll need to mark that this has happened, and more carefully
check whether a declaration should be visible if it was only visible in some
of the modules in which it was declared. Fortunately it's rare for the
identifier namespace of a declaration to change along its redeclaration chain.

llvm-svn: 187639

10 years agoTemporarily revert "Debug Info Finder|Verifier: handle DbgLoc attached to
Eric Christopher [Fri, 2 Aug 2013 00:49:44 +0000 (00:49 +0000)]
Temporarily revert "Debug Info Finder|Verifier: handle DbgLoc attached to
instructions." in an attempt to bring back some bots.

This reverts commit r187609.

llvm-svn: 187638

10 years agoclang-cl: add more options
Hans Wennborg [Fri, 2 Aug 2013 00:30:15 +0000 (00:30 +0000)]
clang-cl: add more options

This adds a bunch of options to clang-cl. Notably, this includes
all the options that get passed when doing a default build of a
command-line project with msbuild.exe in Debug and Release modes,
and I believe all flags from Reid's original patch.

Differential Revision: http://llvm-reviews.chandlerc.com/D1264

llvm-svn: 187637

10 years agoOk, 3 major changes for debug mode in one commit:
Howard Hinnant [Fri, 2 Aug 2013 00:26:35 +0000 (00:26 +0000)]
Ok, 3 major changes for debug mode in one commit:

1.  I had been detecting and trapping iterator == and \!= among iterators
    in different containers as an error.  But the trapping itself is actually
    an error.

    Consider:

    #include <iostream>
    #include <vector>
    #include <algorithm>

    template <class C>
    void
    display(const C& c)
    {
        std::cout << "{";
        bool first = true;
        for (const auto& x : c)
        {
            if (\!first)
                std::cout << ", ";
            first = false;
            std::cout << x;
        }
        std::cout << "}\n";
    }

    int
    main()
    {
        typedef std::vector<int> V;
        V v1 = {1, 3, 5};
        V v2 = {2, 4, 6};
        display(v1);
        display(v2);
        V::iterator i = std::find(v1.begin(), v1.end(), 1);
        V::iterator j = std::find(v2.begin(), v2.end(), 2);
        if (*i == *j)
            i = j;    // perfectly legal
        // ...
        if (i \!= j)   // the only way to check
            v2.push_back(*i);
        display(v1);
        display(v2);
    }

    It is legal to assign an iterator from one container to another of the
    same type.  This is required to work.  One might want to test whether or
    not such an assignment had been made.  The way one performs such a check
    is using the iterator's ==, \!= operator.  This is a logical and necessary
    function and does not constitute an error.

2.  I had a header circular dependence bug when _LIBCPP_DEBUG2 is defined.
    This caused a problem in several of the libc++ tests.
    Fixed.

3.  There is a serious problem when _LIBCPP_DEBUG2=1 at the moment in that
    std::basic_string is inoperable.  std::basic_string uses __wrap_iterator
    to implement its iterators.  __wrap_iterator has been rigged up in debug
    mode to support vector.  But string hasn't been rigged up yet.  This means
    that one gets false positives when using std::string in debug mode.  I've
    upped std::string's priority in www/debug_mode.html.

llvm-svn: 187636

10 years agoTeach InstructionSimplify about pointer address spaces
Matt Arsenault [Fri, 2 Aug 2013 00:10:44 +0000 (00:10 +0000)]
Teach InstructionSimplify about pointer address spaces

llvm-svn: 187635

10 years agoRevert "ObjectiveC migrator. Migrate to instancetype return type for mehods with...
Rafael Espindola [Fri, 2 Aug 2013 00:01:14 +0000 (00:01 +0000)]
Revert "ObjectiveC migrator. Migrate to instancetype return type for mehods with certain prefix selector matching their class names' suffix."

This reverts commit r187626.

It is breaking the bots.

llvm-svn: 187634

10 years agoRevert "If -fslp-vectorize or -fno-slp-vectorize are given, honor this selection...
Rafael Espindola [Thu, 1 Aug 2013 23:56:42 +0000 (23:56 +0000)]
Revert "If -fslp-vectorize or -fno-slp-vectorize are given, honor this selection. If no flag is given, enable it for -O3."

This reverts commit r187630.

Looks like it is breaking the bots.

llvm-svn: 187633

10 years ago[mips] Make load/store accumulator pseudo instructions codeGenOnly. Also,
Akira Hatanaka [Thu, 1 Aug 2013 23:14:16 +0000 (23:14 +0000)]
[mips] Make load/store accumulator pseudo instructions codeGenOnly. Also,
remove lines that are setting DecoderNamespace for pseudo atomic instructions.

No intended functionality change.

llvm-svn: 187632

10 years agoclang-format: Operator precendence in ObjC method exprs.
Daniel Jasper [Thu, 1 Aug 2013 23:13:03 +0000 (23:13 +0000)]
clang-format: Operator precendence in ObjC method exprs.

Patch (mostly) by Adam Strzelecki. Thanks!

Before:
  [self aaaaaa:bbbbbbbbbbbbb
      aaaaaaaaaa:bbbbbbbbbbbbbbbbb
           aaaaa:bbbbbbbbbbb +
      bbbbbbbbbbbb aaaa:bbb];

After:
  [self aaaaaa:bbbbbbbbbbbbb
      aaaaaaaaaa:bbbbbbbbbbbbbbbbb
           aaaaa:bbbbbbbbbbb + bbbbbbbbbbbb
            aaaa:bbb];

This fixes llvm.org/PR16150.

llvm-svn: 187631

10 years agoIf -fslp-vectorize or -fno-slp-vectorize are given, honor this selection. If no flag...
Nadav Rotem [Thu, 1 Aug 2013 22:56:53 +0000 (22:56 +0000)]
If -fslp-vectorize or -fno-slp-vectorize are given, honor this selection. If no flag is given, enable it for -O3.

llvm-svn: 187630

10 years agoTeach getOrEnforceKnownAlignment about address spaces
Matt Arsenault [Thu, 1 Aug 2013 22:42:18 +0000 (22:42 +0000)]
Teach getOrEnforceKnownAlignment about address spaces

llvm-svn: 187629

10 years agoMove the optlevel check to the frontend.
Nadav Rotem [Thu, 1 Aug 2013 22:41:58 +0000 (22:41 +0000)]
Move the optlevel check to the frontend.

llvm-svn: 187628

10 years agoObjectiveC migrator. Migrate to instancetype return type
Fariborz Jahanian [Thu, 1 Aug 2013 22:29:32 +0000 (22:29 +0000)]
ObjectiveC migrator. Migrate to instancetype return type
for mehods with certain prefix selector matching their class names'
suffix.

llvm-svn: 187626

10 years ago[analyzer] Don't process autorelease counts in synthesized function bodies.
Jordan Rose [Thu, 1 Aug 2013 22:16:36 +0000 (22:16 +0000)]
[analyzer] Don't process autorelease counts in synthesized function bodies.

We process autorelease counts when we exit functions, but if there's an
issue in a synthesized body the report will get dropped. Just skip the
processing for now and let it get handled when the caller gets around to
processing autoreleases.

(This is still suboptimal: objects autoreleased in the caller context
should never be warned about when exiting a callee context, synthesized
or not.)

Second half of <rdar://problem/14611722>

llvm-svn: 187625

10 years ago[analyzer] Silently drop all reports within synthesized bodies.
Jordan Rose [Thu, 1 Aug 2013 22:16:30 +0000 (22:16 +0000)]
[analyzer] Silently drop all reports within synthesized bodies.

Much of our diagnostic machinery is set up to assume that the report
end path location is valid. Moreover, the user may be quite confused
when something goes wrong in our BodyFarm-synthesized function bodies,
which may be simplified or modified from the real implementations.
Rather than try to make this all work somehow, just drop the report so
that we don't try to go on with an invalid source location.

Note that we still handle reports whose /paths/ go through invalid
locations, just not those that are reported in one.

We do have to be careful not to lose warnings because of this.
The impetus for this change was an autorelease being processed within
the synthesized body, and there may be other possible issues that are
worth reporting in some way. We'll take these as they come, however.

<rdar://problem/14611722>

llvm-svn: 187624

10 years agofix for LLVM debug info on llvm-mips-linux where the label name uses % instead of...
Carlo Kok [Thu, 1 Aug 2013 22:15:34 +0000 (22:15 +0000)]
fix for LLVM debug info on llvm-mips-linux where the label name uses % instead of L as a prefix.

llvm-svn: 187623

10 years agoclang-format: Don't break empty 2nd operand of ternary expr.
Daniel Jasper [Thu, 1 Aug 2013 22:05:00 +0000 (22:05 +0000)]
clang-format: Don't break empty 2nd operand of ternary expr.

Before:
  some_quite_long_variable_name_ptr
      ?
      : argv[9] ? ptr : argv[8] ? : argv[7] ? ptr : argv[6];
After:
  some_quite_long_variable_name_ptr
      ?: argv[9] ? ptr : argv[8] ?: argv[7] ? ptr : argv[6];

Patch by Adam Strzelecki, thank you!!

This fixed llvm.org/PR16758.

llvm-svn: 187622

10 years agoRe-enable fast stepping for arm targets. The issue being worked
Jason Molenda [Thu, 1 Aug 2013 21:50:20 +0000 (21:50 +0000)]
Re-enable fast stepping for arm targets.  The issue being worked
around was fixed in llvm commit r186846.
<rdar://problem/14489274>

llvm-svn: 187620

10 years agoUse llvm::sys::fs::UniqueID for windows and unix.
Rafael Espindola [Thu, 1 Aug 2013 21:42:11 +0000 (21:42 +0000)]
Use llvm::sys::fs::UniqueID for windows and unix.

This unifies the unix and windows versions of FileManager::UniqueDirContainer
and FileManager::UniqueFileContainer by using UniqueID.

We cannot just replace "struct stat" with llvm::sys::fs::file_status, since we
want to be able to construct fake ones, and file_status has different members
on unix and windows.

What the patch does is:

* Record only the information that clang is actually using.
* Use llvm::sys::fs::status instead of stat and fstat.
* Use llvm::sys::fs::UniqueID
* Delete the old windows versions of UniqueDirContainer and
UniqueFileContainer since the "unix" one now works on windows too.

llvm-svn: 187619

10 years agoUse function attributes to indicate that we don't want to realign the stack.
Bill Wendling [Thu, 1 Aug 2013 21:42:05 +0000 (21:42 +0000)]
Use function attributes to indicate that we don't want to realign the stack.

Function attributes are the future! So just query whether we want to realign the
stack directly from the function instead of through a random target options
structure.

llvm-svn: 187618

10 years agoUse function attributes to indicate if we don't want to realign the stack.
Bill Wendling [Thu, 1 Aug 2013 21:41:02 +0000 (21:41 +0000)]
Use function attributes to indicate if we don't want to realign the stack.

llvm-svn: 187617

10 years agoExpose that the unique file ID has a device and a file component.
Rafael Espindola [Thu, 1 Aug 2013 21:36:02 +0000 (21:36 +0000)]
Expose that the unique file ID has a device and a file component.

The use of sd_dev and st_ino has reached libclang, so expose the two components
in UniqueID so that we can use it in clang.

llvm-svn: 187616

10 years agoFixed the Intel-syntax X86 disassembler to respect the (existing) option for hexadeci...
Daniel Malea [Thu, 1 Aug 2013 21:18:16 +0000 (21:18 +0000)]
Fixed the Intel-syntax X86 disassembler to respect the (existing) option for hexadecimal immediates, to match AT&T syntax. This also brings a new option for C-vs-MASM-style hex.

Patch by Richard Mitton
Reviewed: http://llvm-reviews.chandlerc.com/D1243

llvm-svn: 187614

10 years agoFix some issues with Mips16 floating when certain intrinsics are present.
Reed Kotler [Thu, 1 Aug 2013 21:17:53 +0000 (21:17 +0000)]
Fix some issues with Mips16 floating when certain intrinsics are present.
This is actually an LLVM bug in the way it generates signatures for these
when soft float is enabled. For example, floor ends up having the signature
of int64(int64). The signature part is not the same as where the actual
parameter types are recorded, and those ARE of course int64(int64) when
soft float is enabled. (Yes, Mips16 hard float uses soft float but with
different runtime rounes but then has to interoperate with Mips32 using
normal floating point). This logic will eventually be moved to the
Mips16HardFloat pass so it's not worth sorting out these issues in LLVM
since nobody but Mips16 cares about these signatures, as far as I know,
and even I won't eventually either.

llvm-svn: 187613

10 years agoDebugInfo: Don't prefer declarations over definitions in -flimit-debug-info in C
David Blaikie [Thu, 1 Aug 2013 20:57:40 +0000 (20:57 +0000)]
DebugInfo: Don't prefer declarations over definitions in -flimit-debug-info in C

Without an ODR, the -flimit-debug-info debug info size optimization of
emitting declarations for fully defined types when only a declaration is
needed by the TU, is incorrect. Emit the full definition whenever it's
available in non-C++.

llvm-svn: 187611

10 years agoARM/Hexagon testcases can't compile x86 only testcase. Reverting change to testcase...
Carlo Kok [Thu, 1 Aug 2013 20:53:57 +0000 (20:53 +0000)]
ARM/Hexagon testcases can't compile x86 only testcase. Reverting change to testcase & fixing check for all.

llvm-svn: 187610

10 years agoDebug Info Finder|Verifier: handle DbgLoc attached to instructions.
Manman Ren [Thu, 1 Aug 2013 20:52:39 +0000 (20:52 +0000)]
Debug Info Finder|Verifier: handle DbgLoc attached to instructions.

Also remove checking of llvm.dbg.sp since it is not used in generating dwarf.

Current state of Finder:
DebugInfoFinder tries to list all debug info MDNodes used in a module. To
list debug info MDNodes used by an instruction, DebugInfoFinder provides
processDeclare, processValue and processLocation to handle DbgDeclareInst,
DbgValueInst and DbgLoc attached to instructions. processModule will go
through all DICompileUnits in llvm.dbg.cu and list debug info MDNodes
used by the CUs.

TODO:
1> Finder has a list of CUs, SPs, Types, Scopes and global variables. We
need to add a list of variables that are used by DbgDeclareInst and
DbgValueInst.
2> MDString fields should be null or isa<MDString> and MDNode fields should be
null or isa<MDNode>. We currently use empty string or int 0 to represent null.
3> Go though Verify functions and make sure that they check field types.
4> Clean up existing testing cases to remove llvm.dbg.sp and make sure each
testing case has a llvm.dbg.cu.

llvm-svn: 187609

10 years agoDebugInfo: Emit template arguments for limited types used for context.
David Blaikie [Thu, 1 Aug 2013 20:31:40 +0000 (20:31 +0000)]
DebugInfo: Emit template arguments for limited types used for context.

We emit definitions with no members when a nested type is
referenced/required (GCC does the same, to be fair) but failed to attach
the template arguments in such a case.

llvm-svn: 187608

10 years agoDebugInfo: Emit definitions for types with no members.
David Blaikie [Thu, 1 Aug 2013 20:30:22 +0000 (20:30 +0000)]
DebugInfo: Emit definitions for types with no members.

The absence of members was a poor/incorrect proxy for "is definition".

llvm-svn: 187607

10 years agochange the inlinefnlocalvar testcase so it uses a triple that's not coff (doesn't...
Carlo Kok [Thu, 1 Aug 2013 20:17:37 +0000 (20:17 +0000)]
change the inlinefnlocalvar testcase so it uses a triple that's not coff (doesn't seem to matter for the testcase itself, what it tests isn't triple specific), as coff has a slightly different way of emitting what it checks for.

llvm-svn: 187604

10 years agoDisable test on Mac OS X due to llvm.org/pr16769
Daniel Malea [Thu, 1 Aug 2013 20:03:36 +0000 (20:03 +0000)]
Disable test on Mac OS X due to llvm.org/pr16769

llvm-svn: 187603

10 years agoOptions.td: O0 and O4 are not Joined options
Hans Wennborg [Thu, 1 Aug 2013 19:46:33 +0000 (19:46 +0000)]
Options.td: O0 and O4 are not Joined options

(I'm not sure how to test this because the Driver will still accept
 e.g. "-O4foo", but it goes in the catch-all -O option instead of -O4.)

llvm-svn: 187602

10 years agoTemporarily xfail a test that breaks on OS X when building with LTO.
Bob Wilson [Thu, 1 Aug 2013 19:29:26 +0000 (19:29 +0000)]
Temporarily xfail a test that breaks on OS X when building with LTO.

This is another case where internalize hides a symbol that is needed by
a loadable module.  I am currently investigating a proper fix but this patch
will get our buildbot to pass in the meantime. <rdar://problem/14578094>

llvm-svn: 187601

10 years agoUpdates TestLongjump to ensure that compiler optimizations don't affect the
Ashok Thirumurthi [Thu, 1 Aug 2013 18:52:01 +0000 (18:52 +0000)]
Updates TestLongjump to ensure that compiler optimizations don't affect the
mapping of source to assembly so that the same test script can be used
with more compilers.

Patch by Andy Kaylor!

Also marks the LLDB test of template parameters as xfail on icc.

llvm-svn: 187600

10 years agoFix Linux Host::GetCurrentThreadID() to return real tid (not pthread_t).
Michael Sartain [Thu, 1 Aug 2013 18:51:08 +0000 (18:51 +0000)]
Fix Linux Host::GetCurrentThreadID() to return real tid (not pthread_t).
This fixes threadname logging (--thread-name)
Add "-t" to TestLogging.py script to enable threadsafe and disable threadname logging

llvm-svn: 187599

10 years agoUpdate incorrect file headers.
Sean Silva [Thu, 1 Aug 2013 18:42:28 +0000 (18:42 +0000)]
Update incorrect file headers.

One of these was spotted in review by Rafael.

llvm-svn: 187598

10 years agoBugfix for making the DWARF debug strings and labels to code emitted as secrel32...
Carlo Kok [Thu, 1 Aug 2013 18:38:14 +0000 (18:38 +0000)]
Bugfix for making the DWARF debug strings and labels to code emitted as secrel32 instead of long opcodes (only for coff). This makes them debuggable with GDB.

fixes Bug 16249 - LLVM generates broken debug info on Windows

llvm-svn: 187597

10 years agoEnable the SLP-vectorizer by default
Nadav Rotem [Thu, 1 Aug 2013 18:28:23 +0000 (18:28 +0000)]
Enable the SLP-vectorizer by default

llvm-svn: 187596

10 years agoOnly enable SLP-vectorization on O3 builds.
Nadav Rotem [Thu, 1 Aug 2013 18:28:15 +0000 (18:28 +0000)]
Only enable SLP-vectorization on O3 builds.

llvm-svn: 187595

10 years agoReduce a variable's scope (no functionality change)
David Blaikie [Thu, 1 Aug 2013 18:23:24 +0000 (18:23 +0000)]
Reduce a variable's scope (no functionality change)

llvm-svn: 187594