platform/upstream/llvm.git
11 years agoFix funky copy-pasted grammatical error.
Sean Silva [Mon, 10 Dec 2012 18:37:26 +0000 (18:37 +0000)]
Fix funky copy-pasted grammatical error.

PR14343

llvm-svn: 169742

11 years agoRevert "Make '-mtune=x86_64' assume fast unaligned memory accesses."
Chandler Carruth [Mon, 10 Dec 2012 18:23:52 +0000 (18:23 +0000)]
Revert "Make '-mtune=x86_64' assume fast unaligned memory accesses."

Accidental commit... git svn betrayed me. Sorry for the noise.

llvm-svn: 169741

11 years agoMake '-mtune=x86_64' assume fast unaligned memory accesses.
Chandler Carruth [Mon, 10 Dec 2012 18:22:42 +0000 (18:22 +0000)]
Make '-mtune=x86_64' assume fast unaligned memory accesses.

Summary:
Not all chips targeted by x86_64 have this feature, but a dramatically
increasing number do. Specifying a chip-specific tuning parameter will
continue to turn the feature on or off as appropriate for that
particular chip, but the generic flag should try to achieve the best
performance on the most widely available hardware. Today, the number of
chips with fast UA access dwarfs those without in the x86-64 space.

Note that this also brings LLVM's code generation for this '-march' flag
more in line with that of modern GCCs.

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

llvm-svn: 169740

11 years agoFix a typo in my previous commit -- bloomfield is 0x1A not 0x2A.
Chandler Carruth [Mon, 10 Dec 2012 18:22:40 +0000 (18:22 +0000)]
Fix a typo in my previous commit -- bloomfield is 0x1A not 0x2A.

Thanks to the PaX folks for noticing in review! We need some tests here,
any sugestions welcome...

llvm-svn: 169739

11 years agoClang-format: error recovery for access specifiers
Alexander Kornienko [Mon, 10 Dec 2012 16:34:48 +0000 (16:34 +0000)]
Clang-format: error recovery for access specifiers

Reviewers: klimek

Reviewed By: klimek

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

llvm-svn: 169738

11 years agoClarifying comments for the MatchFinder and matchesNames matcher.
Manuel Klimek [Mon, 10 Dec 2012 16:13:06 +0000 (16:13 +0000)]
Clarifying comments for the MatchFinder and matchesNames matcher.

llvm-svn: 169737

11 years ago[ASan] Typo fix in memcpy() and memmove() interceptors: ASAN_WRITE_RANGE and ASAN_REA...
Alexander Potapenko [Mon, 10 Dec 2012 16:02:13 +0000 (16:02 +0000)]
[ASan] Typo fix in memcpy() and memmove() interceptors: ASAN_WRITE_RANGE and ASAN_READ_RANGE were swapped.
This has been spotted by Anna Zaks (ganna@apple.com)

llvm-svn: 169736

11 years ago[asan] move FakeStack into a separate file
Kostya Serebryany [Mon, 10 Dec 2012 14:19:15 +0000 (14:19 +0000)]
[asan] move FakeStack into a separate file

llvm-svn: 169734

11 years ago[asan] introduce asan_allocator2.cc, which will have the replacement for asan allocat...
Kostya Serebryany [Mon, 10 Dec 2012 13:52:55 +0000 (13:52 +0000)]
[asan] introduce asan_allocator2.cc, which will have the replacement for asan allocator (now, just a bit of boilerplate)

llvm-svn: 169733

11 years agoAdd a libsanitizer API __sanitizer_sandbox_on_notify(void* reserved), which should...
Alexander Potapenko [Mon, 10 Dec 2012 13:10:40 +0000 (13:10 +0000)]
Add a libsanitizer API __sanitizer_sandbox_on_notify(void* reserved), which should be used by
the client programs to notify the tools that sandboxing is about to be turned on.

llvm-svn: 169732

11 years agoAddress a FIXME and update the fast unaligned memory feature for newer
Chandler Carruth [Mon, 10 Dec 2012 09:18:44 +0000 (09:18 +0000)]
Address a FIXME and update the fast unaligned memory feature for newer
Intel chips.

The model number rules were determined by inspecting Intel's
documentation for their newer chip model numbers. My understanding is
that all of the newer Intel chips have fast unaligned memory access, but
if anyone is concerned about a particular chip, just shout.

No tests updated; it's not clear we have dedicated tests for the chips'
various features, but if anyone would like tests (or can point me at
some existing ones), I'm happy to oblige.

llvm-svn: 169730

11 years agotsan: exclude flaky test
Dmitry Vyukov [Mon, 10 Dec 2012 09:16:17 +0000 (09:16 +0000)]
tsan: exclude flaky test

llvm-svn: 169729

11 years agoAdd a new visitor for walking the uses of a pointer value.
Chandler Carruth [Mon, 10 Dec 2012 08:28:39 +0000 (08:28 +0000)]
Add a new visitor for walking the uses of a pointer value.

This visitor provides infrastructure for recursively traversing the
use-graph of a pointer-producing instruction like an alloca or a malloc.
It maintains a worklist of uses to visit, so it can handle very deep
recursions. It automatically looks through instructions which simply
translate one pointer to another (bitcasts and GEPs). It tracks the
offset relative to the original pointer as long as that offset remains
constant and exposes it during the visit as an APInt offset. Finally, it
performs conservative escape analysis.

However, currently it has some limitations that should be addressed
going forward:
1) It doesn't handle vectors of pointers.
2) It doesn't provide a cheaper visitor when the constant offset
   tracking isn't needed.
3) It doesn't support non-instruction pointer values.

The current functionality is exactly what is required to implement the
SROA pointer-use visitors in terms of this one, rather than in terms of
their own ad-hoc base visitor, which was always very poorly specified.
SROA has been converted to use this, and the code there deleted which
this utility now provides.

Technically speaking, using this new visitor allows SROA to handle a few
more cases than it previously did. It is now more aggressive in ignoring
chains of instructions which look like they would defeat SROA, but in
fact do not because they never result in a read or write of memory.
While this is "neat", it shouldn't be interesting for real programs as
any such chains should have been removed by others passes long before we
get to SROA. As a consequence, I've not added any tests for these
features -- it shouldn't be part of SROA's contract to perform such
heroics.

The goal is to extend the functionality of this visitor going forward,
and re-use it from passes like ASan that can benefit from doing
a detailed walk of the uses of a pointer.

Thanks to Ben Kramer for the code review rounds and lots of help
reviewing and debugging this patch.

llvm-svn: 169728

11 years agoTeach DAG combine to handle vector add/sub with vectors of all 0s.
Craig Topper [Mon, 10 Dec 2012 08:12:29 +0000 (08:12 +0000)]
Teach DAG combine to handle vector add/sub with vectors of all 0s.

llvm-svn: 169727

11 years ago[CMake] TARGET_TRIPLE may be internal alias of LLVM_DEFAULT_TARGET_TRIPLE.
NAKAMURA Takumi [Mon, 10 Dec 2012 07:14:29 +0000 (07:14 +0000)]
[CMake] TARGET_TRIPLE may be internal alias of LLVM_DEFAULT_TARGET_TRIPLE.

llvm-svn: 169726

11 years agoAdding tests since when I was asked whether this works I wasn't
Manuel Klimek [Mon, 10 Dec 2012 07:08:53 +0000 (07:08 +0000)]
Adding tests since when I was asked whether this works I wasn't
100% sure.

llvm-svn: 169725

11 years ago[CMake] Update dependencies to intrinsics_gen corresponding to r169711.
NAKAMURA Takumi [Mon, 10 Dec 2012 05:27:15 +0000 (05:27 +0000)]
[CMake] Update dependencies to intrinsics_gen corresponding to r169711.

llvm-svn: 169724

11 years ago[Driver] Add test.
Michael J. Spencer [Mon, 10 Dec 2012 02:53:10 +0000 (02:53 +0000)]
[Driver] Add test.

llvm-svn: 169721

11 years agoRevert to old behavior until linker can pass export-dynamic option.
Bill Wendling [Mon, 10 Dec 2012 02:51:16 +0000 (02:51 +0000)]
Revert to old behavior until linker can pass export-dynamic option.

llvm-svn: 169720

11 years agoFix PR14548: SROA was crashing on a mixture of i1 and i8 loads and stores.
Chandler Carruth [Mon, 10 Dec 2012 00:54:45 +0000 (00:54 +0000)]
Fix PR14548: SROA was crashing on a mixture of i1 and i8 loads and stores.

When SROA was evaluating a mixture of i1 and i8 loads and stores, in
just a particular case, it would tickle a latent bug where we compared
bits to bytes rather than bits to bits. As a consequence of the latent
bug, we would allow integers through which were not byte-size multiples,
a situation the later rewriting code was never intended to handle.

In release builds this could trigger all manner of oddities, but the
reported issue in PR14548 was forming invalid bitcast instructions.

The only downside of this fix is that it makes it more clear that SROA
in its current form is not capable of handling mixed i1 and i8 loads and
stores. Sometimes with the previous code this would work by luck, but
usually it would crash, so I'm not terribly worried. I'll watch the LNT
numbers just to be sure.

llvm-svn: 169719

11 years ago[Driver] Properly handle -entry for X86 Linux.
Michael J. Spencer [Sun, 9 Dec 2012 23:56:37 +0000 (23:56 +0000)]
[Driver] Properly handle -entry for X86 Linux.

llvm-svn: 169718

11 years ago[Driver] Add -### support for printing out the core command line.
Michael J. Spencer [Sun, 9 Dec 2012 23:56:26 +0000 (23:56 +0000)]
[Driver] Add -### support for printing out the core command line.

llvm-svn: 169717

11 years agoRemove left over debugging output.
Michael J. Spencer [Sun, 9 Dec 2012 23:56:03 +0000 (23:56 +0000)]
Remove left over debugging output.

llvm-svn: 169716

11 years ago[Driver] Make the X86Linux target use X86 (not x64) and properly initalize WriterOptions.
Michael J. Spencer [Sun, 9 Dec 2012 23:55:52 +0000 (23:55 +0000)]
[Driver] Make the X86Linux target use X86 (not x64) and properly initalize WriterOptions.

llvm-svn: 169715

11 years agoDocumentation: convert ReleaseNotes.html to reST.
Dmitri Gribenko [Sun, 9 Dec 2012 23:14:26 +0000 (23:14 +0000)]
Documentation: convert ReleaseNotes.html to reST.

Patch by Anthony Mykhailenko with small fixes by me.

llvm-svn: 169714

11 years agoUnbreak the clang build after r169712.
Benjamin Kramer [Sun, 9 Dec 2012 21:58:24 +0000 (21:58 +0000)]
Unbreak the clang build after r169712.

llvm-svn: 169713

11 years agoReorganize FastMathFlags to be a wrapper around unsigned, and streamline some interfaces.
Michael Ilseman [Sun, 9 Dec 2012 21:12:04 +0000 (21:12 +0000)]
Reorganize FastMathFlags to be a wrapper around unsigned, and streamline some interfaces.

llvm-svn: 169712

11 years agoLoopVectorize: support vectorizing intrinsic calls
Paul Redmond [Sun, 9 Dec 2012 20:42:17 +0000 (20:42 +0000)]
LoopVectorize: support vectorizing intrinsic calls

- added function to VectorTargetTransformInfo to query cost of intrinsics
- vectorize trivially vectorizable intrinsic calls such as sin, cos, log, etc.

Reviewed by: Nadav

llvm-svn: 169711

11 years agoHave the bitcode reader/writer just use FPMathOperator's fast math enum directly
Michael Ilseman [Sun, 9 Dec 2012 20:23:16 +0000 (20:23 +0000)]
Have the bitcode reader/writer just use FPMathOperator's fast math enum directly

llvm-svn: 169710

11 years agotest commit.
Paul Redmond [Sun, 9 Dec 2012 19:46:31 +0000 (19:46 +0000)]
test commit.

llvm-svn: 169709

11 years agoVirtual method overrides can no longer have mismatched calling conventions. This...
Aaron Ballman [Sun, 9 Dec 2012 17:45:41 +0000 (17:45 +0000)]
Virtual method overrides can no longer have mismatched calling conventions.  This fixes PR14339.

llvm-svn: 169705

11 years agoSo many people have touched this, it doesn't make sense to ascribe authorship anymore.
Chris Lattner [Sun, 9 Dec 2012 16:55:39 +0000 (16:55 +0000)]
So many people have touched this, it doesn't make sense to ascribe authorship anymore.

llvm-svn: 169704

11 years agoUse m_OneUse pattern instead of hasOneUse() method.
Jakub Staszak [Sun, 9 Dec 2012 16:06:44 +0000 (16:06 +0000)]
Use m_OneUse pattern instead of hasOneUse() method.
No functionality change.

llvm-svn: 169703

11 years agodocs: Convert GarbageCollection.html to reST
Sean Silva [Sun, 9 Dec 2012 15:52:47 +0000 (15:52 +0000)]
docs: Convert GarbageCollection.html to reST

Patch by Alexander Zinenko!

llvm-svn: 169702

11 years agoRemove trailing spaces.
Jakub Staszak [Sun, 9 Dec 2012 15:37:46 +0000 (15:37 +0000)]
Remove trailing spaces.

llvm-svn: 169701

11 years agoDocumentation: HowToReleaseLLVM.rst: remove trailing whitespace.
Dmitri Gribenko [Sun, 9 Dec 2012 15:33:26 +0000 (15:33 +0000)]
Documentation: HowToReleaseLLVM.rst: remove trailing whitespace.

llvm-svn: 169700

11 years agoDocumentation: don't create TOCs manually.
Dmitri Gribenko [Sun, 9 Dec 2012 15:29:56 +0000 (15:29 +0000)]
Documentation: don't create TOCs manually.

Thanks to Sean Silva for pointing out!

llvm-svn: 169699

11 years agoSwitch SROA to pop Uses off the back of its visitors' queues.
Chandler Carruth [Sun, 9 Dec 2012 11:56:01 +0000 (11:56 +0000)]
Switch SROA to pop Uses off the back of its visitors' queues.

This will more closely match the behavior of the new PtrUseVisitor that
I am adding. Hopefully this will not change the actual behavior in any
way, but by making the processing order more similar help in debugging.

llvm-svn: 169697

11 years agoAdd a triple to this test. It depends on little-endian bitfield layout.
Chandler Carruth [Sun, 9 Dec 2012 10:39:18 +0000 (10:39 +0000)]
Add a triple to this test. It depends on little-endian bitfield layout.

llvm-svn: 169696

11 years agoDrop the address space limit for tests in the makefile build.
Benjamin Kramer [Sun, 9 Dec 2012 10:34:22 +0000 (10:34 +0000)]
Drop the address space limit for tests in the makefile build.

The limit seems to break newer pythons (see PR13598) so just drop it for now.
Eventually lit should learn to set limits for its children instead of a global
limit in the makefile.

If some PPC bots fail after this change: That's a good thing, they actually run
clang tests now.

llvm-svn: 169695

11 years agoCleanup and fix an assert that was mis-firing.
Chandler Carruth [Sun, 9 Dec 2012 10:33:27 +0000 (10:33 +0000)]
Cleanup and fix an assert that was mis-firing.

Note that there is no test suite update. This was found by a couple of
tests failing when the test suite was run on a powerpc64 host (thanks
Roman!). The tests don't specify a triple, which might seem surprising
for a codegen test. But in fact, these tests don't even inspect their
output. Not at all. I could add a bunch of triples to these tests so
that we'd get the test coverage for normal builds, but really someone
needs to go through and add actual *tests* to these tests. =[ The ones
in question are:

  test/CodeGen/bitfield-init.c
  test/CodeGen/union.c

llvm-svn: 169694

11 years agoAdd a test case that I've been using to clarify the bitfield layout for
Chandler Carruth [Sun, 9 Dec 2012 10:08:22 +0000 (10:08 +0000)]
Add a test case that I've been using to clarify the bitfield layout for
both LE and BE targets.

AFAICT, Clang get's this correct for PPC64. I've compared it to GCC 4.8
output for PPC64 (thanks Roman!) and to my limited ability to read power
assembly, it looks functionally equivalent. It would be really good to
fill in the assertions on this test case for x86-32, PPC32, ARM, etc.,
but I've reached the limit of my time and energy... Hopefully other
folks can chip in as it would be good to have this in place to test any
subsequent changes.

To those who care about PPC64 performance, a side note: there is some
*obnoxiously* bad code generated for these test cases. It would be worth
someone's time to sit down and teach the PPC backend to pattern match
these IR constructs better. It appears that things like '(shr %foo,
<imm>)' turn into 'rldicl R, R, 64-<imm>, <imm>' or some such. They
don't even get combined with other 'rldicl' instructions *immediately
adjacent*. I'll add a couple of these patterns to the README, but
I think it would be better to look at all the patterns produced by this
and other bitfield access code, and systematically build up a collection
of patterns that efficiently reduce them to the minimal code.

llvm-svn: 169693

11 years agoRemove extra blank line.
Craig Topper [Sun, 9 Dec 2012 08:20:52 +0000 (08:20 +0000)]
Remove extra blank line.

llvm-svn: 169692

11 years agoFix the bitfield record layout in codegen for big endian targets.
Chandler Carruth [Sun, 9 Dec 2012 07:26:04 +0000 (07:26 +0000)]
Fix the bitfield record layout in codegen for big endian targets.

This was an egregious bug due to the several iterations of refactorings
that took place. Size no longer meant what it original did by the time
I finished, but this line of code never got updated. Unfortunately we
had essentially zero tests for this in the regression test suite. =[

I've added a PPC64 run over the bitfield test case I've been primarily
using. I'm still looking at adding more tests and making sure this is
the *correct* bitfield access code on PPC64 linux, but it looks pretty
close to me, and it is *worlds* better than before this patch as it no
longer asserts! =] More commits to follow with at least additional tests
and maybe more fixes.

Sorry for the long breakage due to this....

llvm-svn: 169691

11 years agoFix overload resolution for the initialization of a multi-dimensional
Richard Smith [Sun, 9 Dec 2012 06:48:56 +0000 (06:48 +0000)]
Fix overload resolution for the initialization of a multi-dimensional
array from a braced-init-list. There seems to be a core wording wart
here (it suggests we should be testing whether the elements of the init
list are implicitly convertible to the array element type, not whether
there is an implicit conversion sequence) but our prior behavior appears
to be a bug, not a deliberate effort to implement the standard as written.

llvm-svn: 169690

11 years agoPR14550: If a system header contains a bogus constexpr function definition,
Richard Smith [Sun, 9 Dec 2012 05:55:43 +0000 (05:55 +0000)]
PR14550: If a system header contains a bogus constexpr function definition,
don't mark the function as invalid, since we suppress the error.

llvm-svn: 169689

11 years agoPR14549. Don't assert if we see an incomplete decltype specifier at the end of the...
Richard Smith [Sun, 9 Dec 2012 04:17:57 +0000 (04:17 +0000)]
PR14549. Don't assert if we see an incomplete decltype specifier at the end of the file.

llvm-svn: 169688

11 years ago- Re-enable population count loop idiom recognization
Shuxin Yang [Sun, 9 Dec 2012 03:12:46 +0000 (03:12 +0000)]
- Re-enable population count loop idiom recognization
- fix a bug which cause sigfault.
- add two testing cases which was causing crash

llvm-svn: 169687

11 years agoModify testit to use the local headers and lib. Thanks go to Jeffrey Yasskin.
Howard Hinnant [Sun, 9 Dec 2012 00:12:14 +0000 (00:12 +0000)]
Modify testit to use the local headers and lib.  Thanks go to Jeffrey Yasskin.

llvm-svn: 169686

11 years agoTeach DAG combine to handle vector logical operations with vectors of all 1s or all...
Craig Topper [Sat, 8 Dec 2012 22:49:19 +0000 (22:49 +0000)]
Teach DAG combine to handle vector logical operations with vectors of all 1s or all 0s. These cases can show up when vectors are split for legalizing. Fix some tests that were dependent on these cases not being combined.

llvm-svn: 169684

11 years agoRevert the patches adding a popcount loop idiom recognition pass.
Chandler Carruth [Sat, 8 Dec 2012 22:18:29 +0000 (22:18 +0000)]
Revert the patches adding a popcount loop idiom recognition pass.

There are still bugs in this pass, as well as other issues that are
being worked on, but the bugs are crashers that occur pretty easily in
the wild. Test cases have been sent to the original commit's review
thread.

This reverts the commits:
  r169671: Fix a logic error.
  r169604: Move the popcnt tests to an X86 subdirectory.
  r168931: Initial commit adding the pass.

llvm-svn: 169683

11 years agoEscape % in the TextDiagnosticBuffer so they aren't interpreted twice when fed into...
Benjamin Kramer [Sat, 8 Dec 2012 12:42:30 +0000 (12:42 +0000)]
Escape % in the TextDiagnosticBuffer so they aren't interpreted twice when fed into the diagnostic formatting machinery again.

Fixes PR14543.

llvm-svn: 169677

11 years agoSimplify code. Sort includes. No functionality change.
Benjamin Kramer [Sat, 8 Dec 2012 10:45:24 +0000 (10:45 +0000)]
Simplify code. Sort includes. No functionality change.

llvm-svn: 169676

11 years agolong double should be 64 bits on FreeBSD/MIPS64. It possibly should be on
David Chisnall [Sat, 8 Dec 2012 09:06:08 +0000 (09:06 +0000)]
long double should be 64 bits on FreeBSD/MIPS64.  It possibly should be on
Linux too, as I think we inherited it from there.  The ABI spec says 128-bit,
although I think SGI's compiler on IRIX may be the only thing ever to support
this.

llvm-svn: 169674

11 years agoFinish implementing 'selected constructor' rules for triviality in C++11. In
Richard Smith [Sat, 8 Dec 2012 08:32:28 +0000 (08:32 +0000)]
Finish implementing 'selected constructor' rules for triviality in C++11. In
the cases where we can't determine whether special members would be trivial
while building the class, we eagerly declare those special members. The impact
of this is bounded, since it does not trigger implicit declarations of special
members in classes which merely *use* those classes.

In order to determine whether we need to apply this rule, we also need to
eagerly declare move operations and destructors in cases where they might be
deleted. If a move operation were supposed to be deleted, it would instead
be suppressed, and we could need overload resolution to determine if we fall
back to a trivial copy operation. If a destructor were implicitly deleted,
it would cause the move constructor of any derived classes to be suppressed.

As discussed on cxx-abi-dev, C++11's selected constructor rules are also
retroactively applied as a defect resolution in C++03 mode, in order to
identify that class B has a non-trivial copy constructor (since it calls
A's constructor template, not A's copy constructor):

struct A { template<typename T> A(T &); };
struct B { mutable A a; };

llvm-svn: 169673

11 years agoFix Windows build breakage.
Logan Chien [Sat, 8 Dec 2012 05:19:49 +0000 (05:19 +0000)]
Fix Windows build breakage.

Windows does not have <stdint.h>, should include
"llvm/Support/DataTypes.h" instead.

llvm-svn: 169672

11 years agoFix an inadvertent typo error.
Shuxin Yang [Sat, 8 Dec 2012 05:00:59 +0000 (05:00 +0000)]
Fix an inadvertent typo error.

llvm-svn: 169671

11 years agoRemove some remnants of the assumption that there is at most one of each
Richard Smith [Sat, 8 Dec 2012 04:10:18 +0000 (04:10 +0000)]
Remove some remnants of the assumption that there is at most one of each
flavour of special member.

llvm-svn: 169670

11 years agoThread-safety analysis: check member access on guarded non-primitive types.
DeLesley Hutchins [Sat, 8 Dec 2012 03:46:30 +0000 (03:46 +0000)]
Thread-safety analysis: check member access on guarded non-primitive types.

llvm-svn: 169669

11 years agoFix a use-after-free bug found by ASan. You can't assign a temporary
Chandler Carruth [Sat, 8 Dec 2012 03:10:14 +0000 (03:10 +0000)]
Fix a use-after-free bug found by ASan. You can't assign a temporary
std::string to a StringRef. Moreover, the method being called accepts
a Twine to simplify these patterns.

Fixes this ASan failure:
==6312== ERROR: AddressSanitizer: heap-use-after-free on address 0x7fd558b1af58 at pc 0xcb7529 bp 0x7fffff572080 sp 0x7fffff572078
READ of size 1 at 0x7fd558b1af58 thread T0
    #0 0xcb7528 .../llvm/include/llvm/ADT/StringRef.h:192 llvm::StringRef::operator[]()
    #1 0x1d53c0a .../llvm/include/llvm/ADT/StringExtras.h:128 llvm::HashString()
    #2 0x1d53878 .../llvm/lib/Support/StringMap.cpp:64 llvm::StringMapImpl::LookupBucketFor()
    #3 0x1b6872f .../llvm/include/llvm/ADT/StringMap.h:352 llvm::StringMap<>::GetOrCreateValue<>()
    #4 0x1b61836 .../llvm/lib/MC/MCContext.cpp:109 llvm::MCContext::GetOrCreateSymbol()
    #5 0xe9fd47 .../llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp:154 (anonymous namespace)::ARMELFStreamer::EmitMappingSymbol()
    #6 0xea01dd .../llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp:133 (anonymous namespace)::ARMELFStreamer::EmitDataMappingSymbol()
    #7 0xe9f78b .../llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp:91 (anonymous namespace)::ARMELFStreamer::EmitBytes()
    #8 0x1b15d82 .../llvm/lib/MC/MCStreamer.cpp:89 llvm::MCStreamer::EmitIntValue()
    #9 0xcc0f9b .../llvm/lib/Target/ARM/ARMAsmPrinter.cpp:713 llvm::ARMAsmPrinter::emitAttributes()
    #10 0xcc0d44 .../llvm/lib/Target/ARM/ARMAsmPrinter.cpp:632 llvm::ARMAsmPrinter::EmitStartOfAsmFile()
    #11 0x14692ad .../llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:162 llvm::AsmPrinter::doInitialization()
    #12 0x1bc4677 .../llvm/lib/VMCore/PassManager.cpp:1561 llvm::FPPassManager::doInitialization()
    #13 0x1bc4990 .../llvm/lib/VMCore/PassManager.cpp:1595 llvm::MPPassManager::runOnModule()
    #14 0x1bc55e5 .../llvm/lib/VMCore/PassManager.cpp:1705 llvm::PassManagerImpl::run()
    #15 0x1bc5878 .../llvm/lib/VMCore/PassManager.cpp:1740 llvm::PassManager::run()
    #16 0xc3954d .../llvm/tools/llc/llc.cpp:378 compileModule()
    #17 0xc38001 .../llvm/tools/llc/llc.cpp:194 main
    #18 0x7fd557d6a11c __libc_start_main
0x7fd558b1af58 is located 24 bytes inside of 29-byte region [0x7fd558b1af40,0x7fd558b1af5d)
freed by thread T0 here:
    #0 0xc337da .../llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:56 operator delete()
    #1 0x1ee9cef .../libstdc++-v3/include/bits/basic_string.h:535 std::string::~string()
    #2 0xea01dd .../llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp:133 (anonymous namespace)::ARMELFStreamer::EmitDataMappingSymbol()
    #3 0xe9f78b .../llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp:91 (anonymous namespace)::ARMELFStreamer::EmitBytes()
    #4 0x1b15d82 .../llvm/lib/MC/MCStreamer.cpp:89 llvm::MCStreamer::EmitIntValue()
    #5 0xcc0f9b .../llvm/lib/Target/ARM/ARMAsmPrinter.cpp:713 llvm::ARMAsmPrinter::emitAttributes()
    #6 0xcc0d44 .../llvm/lib/Target/ARM/ARMAsmPrinter.cpp:632 llvm::ARMAsmPrinter::EmitStartOfAsmFile()
    #7 0x14692ad .../llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:162 llvm::AsmPrinter::doInitialization()
    #8 0x1bc4677 .../llvm/lib/VMCore/PassManager.cpp:1561 llvm::FPPassManager::doInitialization()
    #9 0x1bc4990 .../llvm/lib/VMCore/PassManager.cpp:1595 llvm::MPPassManager::runOnModule()
    #10 0x1bc55e5 .../llvm/lib/VMCore/PassManager.cpp:1705 llvm::PassManagerImpl::run()
    #11 0x1bc5878 .../llvm/lib/VMCore/PassManager.cpp:1740 llvm::PassManager::run()
    #12 0xc3954d .../llvm/tools/llc/llc.cpp:378 compileModule()
    #13 0xc38001 .../llvm/tools/llc/llc.cpp:194 main
    #14 0x7fd557d6a11c __libc_start_main

llvm-svn: 169668

11 years agoProperly compute triviality for explicitly-defaulted or deleted special members.
Richard Smith [Sat, 8 Dec 2012 02:53:02 +0000 (02:53 +0000)]
Properly compute triviality for explicitly-defaulted or deleted special members.
Remove pre-standard restriction on explicitly-defaulted copy constructors with
'incorrect' parameter types, and instead just make those special members
non-trivial as the standard requires.

This required making CXXRecordDecl correctly handle classes which have both a
trivial and a non-trivial special member of the same kind.

This also fixes PR13217 by reimplementing DiagnoseNontrivial in terms of the
new triviality computation technology.

llvm-svn: 169667

11 years ago[libclang] Resolve a cursor that points to a macro name inside a #ifdef/#ifndef
Argyrios Kyrtzidis [Sat, 8 Dec 2012 02:21:17 +0000 (02:21 +0000)]
[libclang] Resolve a cursor that points to a macro name inside a #ifdef/#ifndef
directive as a macro expansion.

This is more of a "macro reference" than a macro expansion but it's close enough
for libclang's purposes. If it causes issues we can revisit and introduce a new
kind of cursor.

llvm-svn: 169666

11 years ago[Preprocessor] Enhance Ifdef/Ifndef/Defined preprocessor callbacks to also pass
Argyrios Kyrtzidis [Sat, 8 Dec 2012 02:21:11 +0000 (02:21 +0000)]
[Preprocessor] Enhance Ifdef/Ifndef/Defined preprocessor callbacks to also pass
a MacroInfo object if the identifier was a macro name.

llvm-svn: 169665

11 years agoAdd a FIXME.
Richard Smith [Sat, 8 Dec 2012 02:13:02 +0000 (02:13 +0000)]
Add a FIXME.

llvm-svn: 169664

11 years agoEven when we aren’t going to init all the lldb.frame, etc, globals, init lldb.debugge...
Jim Ingham [Sat, 8 Dec 2012 02:02:04 +0000 (02:02 +0000)]
Even when we aren’t going to init all the lldb.frame, etc, globals, init lldb.debugger, since each script interpreter is tied to just one debugger.

llvm-svn: 169663

11 years agoImplement C++03 [dcl.init]p5's checking for value-initialization of references
Richard Smith [Sat, 8 Dec 2012 02:01:17 +0000 (02:01 +0000)]
Implement C++03 [dcl.init]p5's checking for value-initialization of references
properly, rather than faking it up by pretending that a reference member makes
the default constructor non-trivial. That leads to rejects-valids when putting
such types inside unions.

llvm-svn: 169662

11 years agoGet LLDB-Info.plist up to date with r169081.
Filipe Cabecinhas [Sat, 8 Dec 2012 01:20:07 +0000 (01:20 +0000)]
Get LLDB-Info.plist up to date with r169081.

llvm-svn: 169661

11 years agoASan: fix interface-symbols test on Mac by explicitly listing all weak functions
Alexey Samsonov [Sat, 8 Dec 2012 01:12:12 +0000 (01:12 +0000)]
ASan: fix interface-symbols test on Mac by explicitly listing all weak functions

llvm-svn: 169660

11 years agoAdd the core architecture for the lld driver.
Michael J. Spencer [Sat, 8 Dec 2012 00:47:36 +0000 (00:47 +0000)]
Add the core architecture for the lld driver.

This includes selecting which driver to emulate, option parsing, invocation
building, and running the link. This currently only supports a very basic
subset of ld for x86_64-linux.

lld -flavor ld obj.o -o obj

or symlink lld as (ld , link, ld64, core) to get the desired behavior without
-flavor.

llvm-svn: 169659

11 years agoMake sure to check for DW_AT_linkage_name to get the mangled name in the DWARF along...
Greg Clayton [Sat, 8 Dec 2012 00:24:40 +0000 (00:24 +0000)]
Make sure to check for DW_AT_linkage_name to get the mangled name in the DWARF along with the older DW_AT_MIPS_linkage_name attribute.

llvm-svn: 169657

11 years agoAdd the `lto_codegen_set_export_dynamic' function.
Bill Wendling [Sat, 8 Dec 2012 00:18:16 +0000 (00:18 +0000)]
Add the `lto_codegen_set_export_dynamic' function.

This function sets the `_exportDynamic' ivar. When that's set, we export all
symbols (e.g. we don't run the internalize pass). This is equivalent to the
`--export-dynamic' linker flag in GNU land:

--export-dynamic
  When creating a dynamically linked executable, add all symbols to the dynamic
  symbol table. The dynamic symbol table is the set of symbols which are visible
  from dynamic objects at run time. If you do not use this option, the dynamic
  symbol table will normally contain only those symbols which are referenced by
  some dynamic object mentioned in the link. If you use dlopen to load a dynamic
  object which needs to refer back to the symbols defined by the program, rather
  than some other dynamic object, then you will probably need to use this option
  when linking the program itself.

The Darwin linker will support this via the `-export_dynamic' flag. We should
modify clang to support this via the `-rdynamic' flag.

llvm-svn: 169656

11 years agoAdded GetCanonicalType() to SBType:
Greg Clayton [Sat, 8 Dec 2012 00:17:07 +0000 (00:17 +0000)]
Added GetCanonicalType() to SBType:

lldb::SBType
SBType::GetCanonicalType();

llvm-svn: 169655

11 years agoCurrently when AST record layouts are dumped with -fdump-record-layouts, the
Eli Bendersky [Sat, 8 Dec 2012 00:07:24 +0000 (00:07 +0000)]
Currently when AST record layouts are dumped with -fdump-record-layouts, the
following:

sizeof=132, dsize=132, align=4
nvsize=132, nvalign=4

Is not indented, so when classes are nested there is no way to know to
which class it belongs.

Fix this problem by indenting the size summary properly for each class.

llvm-svn: 169654

11 years agoAdd C API for specifying CPU to the disassembler.
Jim Grosbach [Fri, 7 Dec 2012 23:53:27 +0000 (23:53 +0000)]
Add C API for specifying CPU to the disassembler.

It was a nasty oversight that we didn't include this when we added this
API in the first place. Blech.

rdar://12839439

llvm-svn: 169653

11 years agos/AttrListPtr/AttributeSet/g to better label what this class is going to be in the...
Bill Wendling [Fri, 7 Dec 2012 23:17:26 +0000 (23:17 +0000)]
s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future.

llvm-svn: 169652

11 years agos/AttrListPtr/AttributeSet/g to better label what this class is going to be in the...
Bill Wendling [Fri, 7 Dec 2012 23:16:57 +0000 (23:16 +0000)]
s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future.

llvm-svn: 169651

11 years agoFix analysis based warnings so that all warnings are emitted when compiling
DeLesley Hutchins [Fri, 7 Dec 2012 22:53:48 +0000 (22:53 +0000)]
Fix analysis based warnings so that all warnings are emitted when compiling
with -Werror.  Previously, compiling with -Werror would emit only the first
warning in a compilation unit, because clang assumes that once an error occurs,
further analysis is unlikely to return valid results.  However, warnings that
have been upgraded to errors should not be treated as "errors" in this sense.

llvm-svn: 169649

11 years agoAppease -Wnon-virtual-dtor
Matt Beaumont-Gay [Fri, 7 Dec 2012 22:49:27 +0000 (22:49 +0000)]
Appease -Wnon-virtual-dtor

llvm-svn: 169648

11 years ago[libclang] Declarations inside anonymous namespaces have internal linkage so
Argyrios Kyrtzidis [Fri, 7 Dec 2012 22:41:46 +0000 (22:41 +0000)]
[libclang] Declarations inside anonymous namespaces have internal linkage so
their USR should contain a location.

This uniques them from other declarations with the same name but in different translation units.
rdar://10546541

llvm-svn: 169647

11 years agoASan: use new option -fsanitize-blacklist in output tests
Alexey Samsonov [Fri, 7 Dec 2012 22:21:21 +0000 (22:21 +0000)]
ASan: use new option -fsanitize-blacklist in output tests

llvm-svn: 169646

11 years agoFix a few more clang (3.2) warnings on Linux:
Daniel Malea [Fri, 7 Dec 2012 22:21:08 +0000 (22:21 +0000)]
Fix a few more clang (3.2) warnings on Linux:
- remove unused members
- add NO_PEDANTIC to selected Makefiles
- fix return values (removed NULL as needed)
- disable warning about four-char-constants
- remove unneeded const from operator*() declaration
- add missing lambda function return types
- fix printf() with no format string
- change sizeof to use a type name instead of variable name
- fix Linux ProcessMonitor.cpp to be 32/64 bit friendly
- disable warnings emitted by swig-generated C++ code

Patch by Matt Kopec!

llvm-svn: 169645

11 years agoMake the contents of encoded sections SmallVector<char, N> instead of
Eli Bendersky [Fri, 7 Dec 2012 22:06:56 +0000 (22:06 +0000)]
Make the contents of encoded sections SmallVector<char, N> instead of
SmallString. This makes it possible to use the length-erased SmallVectorImpl
in the interface without imposing buffer size. Thus, the size of MCInstFragment
is back down since a preallocated 8-byte contents buffer is enough.

It would be generally a good idea to rid all the fragments of SmallString as
contents, because a vector just makes more sense.

llvm-svn: 169644

11 years agoASan: change the strategy we use for installing malloc/free/symbolization hooks on...
Alexey Samsonov [Fri, 7 Dec 2012 22:01:28 +0000 (22:01 +0000)]
ASan: change the strategy we use for installing malloc/free/symbolization hooks on Linux: don't provide a default no-op implementations for hooks in runtime, and optionally call hooks if they are provided by the user. Don't force weak interface functions into runtime.

llvm-svn: 169641

11 years ago[analyzer] Rename the option help to reflect better what it does.
Anna Zaks [Fri, 7 Dec 2012 21:51:50 +0000 (21:51 +0000)]
[analyzer] Rename the option help to reflect better what it does.

llvm-svn: 169640

11 years ago[analyzer] Optimization heuristic: do not reanalyze every ObjC method as
Anna Zaks [Fri, 7 Dec 2012 21:51:47 +0000 (21:51 +0000)]
[analyzer] Optimization heuristic: do not reanalyze every ObjC method as
top level.

This heuristic is already turned on for non-ObjC methods
(inlining-mode=noredundancy). If a method has been previously analyzed,
while being inlined inside of another method, do not reanalyze it as top
level.

This commit applies it to ObjCMethods as well. The main caveat here is
that to catch the retain release errors, we are still going to reanalyze
all the ObjC methods but without inlining turned on.

Gives 21% performance increase on one heavy ObjC benchmark, which
suffered large performance regressions due to ObjC inlining.

llvm-svn: 169639

11 years agoWhen we use the BLEND instruction that uses the MSB as a mask, we can remove
Nadav Rotem [Fri, 7 Dec 2012 21:43:11 +0000 (21:43 +0000)]
When we use the BLEND instruction that uses the MSB as a mask, we can remove
the VSRI instruction before it since it does not affect the MSB.

Thanks Craig Topper for suggesting this.

llvm-svn: 169638

11 years agoRemove trailing whitespace
Michael Ilseman [Fri, 7 Dec 2012 21:41:53 +0000 (21:41 +0000)]
Remove trailing whitespace

llvm-svn: 169637

11 years agoUnbreak the C++98 build.
David Blaikie [Fri, 7 Dec 2012 21:39:54 +0000 (21:39 +0000)]
Unbreak the C++98 build.

llvm-svn: 169636

11 years agoIn hexagon convertToHardwareLoop, don't deref end() iterator
Matthew Curtis [Fri, 7 Dec 2012 21:03:15 +0000 (21:03 +0000)]
In hexagon convertToHardwareLoop, don't deref end() iterator

In particular, check if MachineBasicBlock::iterator is end() before
using it to call getDebugLoc();

See also this thread on llvm-commits:
   http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121112/155914.html

llvm-svn: 169634

11 years agoMore Linux warnings fixes (remove default labels as needed):
Daniel Malea [Fri, 7 Dec 2012 20:51:09 +0000 (20:51 +0000)]
More Linux warnings fixes (remove default labels as needed):
- as per http://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations

Patch by Matt Kopec!

llvm-svn: 169633

11 years agoAST matcher tutorial (Part I)
Daniel Jasper [Fri, 7 Dec 2012 20:34:49 +0000 (20:34 +0000)]
AST matcher tutorial (Part I)

This an AST matcher tutorial based on Sam Panzer's document
(https://docs.google.com/a/google.com/document/d/1oTkVLhCdRJUEH1_LDaQdXqe8-aOqT5GLDL9e4MhoFF8/edit).

Checking in now although some parts might be a bit rough so others can
help improving it.

llvm-svn: 169632

11 years ago[analyzer] Fix r168019 to work with unpruned paths as well.
Jordan Rose [Fri, 7 Dec 2012 19:56:29 +0000 (19:56 +0000)]
[analyzer] Fix r168019 to work with unpruned paths as well.

This is the case where the analyzer tries to print out source locations
for code within a synthesized function body, which of course does not have
a valid source location. The previous fix attempted to do this during
diagnostic path pruning, but some diagnostics have pruning disabled, and
so any diagnostic with a path that goes through a synthesized body will
either hit an assertion or emit invalid output.

<rdar://problem/12657843> (again)

llvm-svn: 169631

11 years agoReduce conversions between Store <-> ImmutableMapRef in RegionStore.
Ted Kremenek [Fri, 7 Dec 2012 19:54:25 +0000 (19:54 +0000)]
Reduce conversions between Store <-> ImmutableMapRef in RegionStore.

This reduces canonicalization of ImmutableMaps.  This reduces analysis time
of one heavy Objective-C file by another 1%.

llvm-svn: 169630

11 years agoMark ImmutableMap::remove/add() const.
Ted Kremenek [Fri, 7 Dec 2012 19:44:12 +0000 (19:44 +0000)]
Mark ImmutableMap::remove/add() const.

llvm-svn: 169629

11 years agotsan: even more fd interceptors + fixes
Dmitry Vyukov [Fri, 7 Dec 2012 19:23:59 +0000 (19:23 +0000)]
tsan: even more fd interceptors + fixes

llvm-svn: 169628

11 years agoFixed some grammar and punctuation error.
John Criswell [Fri, 7 Dec 2012 19:21:10 +0000 (19:21 +0000)]
Fixed some grammar and punctuation error.
No content changes.

llvm-svn: 169627

11 years agoRefactor MCInstFragment and MCDataFragment to adhere to a common interface,
Eli Bendersky [Fri, 7 Dec 2012 19:13:57 +0000 (19:13 +0000)]
Refactor MCInstFragment and MCDataFragment to adhere to a common interface,
which removes code duplication and prepares the ground for future additions.

Full discussion:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121203/158233.html

llvm-svn: 169626

11 years agoNow that we set ThreadPlanCallFunction to private in the constructor, it is confusing...
Jim Ingham [Fri, 7 Dec 2012 19:04:31 +0000 (19:04 +0000)]
Now that we set ThreadPlanCallFunction to private in the constructor, it is confusing that we set it
again in client code after creating the plans.  So remove those unnecessary calls.

llvm-svn: 169625

11 years agoX86: Prefer using VPSHUFD over VPERMIL because it has better throughput.
Nadav Rotem [Fri, 7 Dec 2012 19:01:13 +0000 (19:01 +0000)]
X86: Prefer using VPSHUFD over VPERMIL because it has better throughput.

llvm-svn: 169624

11 years ago<rdar://problem/10903854>
Greg Clayton [Fri, 7 Dec 2012 18:37:09 +0000 (18:37 +0000)]
<rdar://problem/10903854>

log enable now resolves the "--file" option in case it contains ~.

llvm-svn: 169623