platform/upstream/llvm.git
9 years agoAdd link to Go bindings documentation.
Peter Collingbourne [Tue, 13 Jan 2015 18:49:42 +0000 (18:49 +0000)]
Add link to Go bindings documentation.

llvm-svn: 225815

9 years agoReplace vector<unique_ptr<File> with unique_ptr<File>.
Rui Ueyama [Tue, 13 Jan 2015 18:47:25 +0000 (18:47 +0000)]
Replace vector<unique_ptr<File> with unique_ptr<File>.

Because each InputElement has exactly one File, we no longer have
to use a vector to store pointers to Files.

llvm-svn: 225814

9 years agoWhen attribute 'optnone' appears on the same declaration with a
Paul Robinson [Tue, 13 Jan 2015 18:34:56 +0000 (18:34 +0000)]
When attribute 'optnone' appears on the same declaration with a
conflicting attribute, warn about the conflict and pick a "winning"
attribute to preserve, instead of emitting an error.  This matches the
behavior when the conflicting attributes are on different declarations.

Along the way I discovered that conflicts involving __forceinline were
reported as 'always_inline' (alternate spelling, same attribute) so
fixed that up to report the attribute as spelled in the source.

llvm-svn: 225813

9 years agoFix maxLoopDepth computation in ScopInfo
David Peixotto [Tue, 13 Jan 2015 18:31:55 +0000 (18:31 +0000)]
Fix maxLoopDepth computation in ScopInfo

The max loop depth was incorrectly computed for scops that contain a
block from a loop but do not contain the entire loop. We need to
check that the full loop is contained in the region when computing
the max loop depth.

These scops occur when a region containing an inner loop is expanded
to include some blocks from the outer loop, but it cannot be fully
expanded to contain the outer loop because the region containing the
outer loop is invalid.

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

llvm-svn: 225812

9 years agoRevert "r225808 - [PowerPC] Add StackMap/PatchPoint support"
Hal Finkel [Tue, 13 Jan 2015 18:25:05 +0000 (18:25 +0000)]
Revert "r225808 - [PowerPC] Add StackMap/PatchPoint support"

Reverting this while I investiage buildbot failures (segfaulting in
GetCostForDef at ScheduleDAGRRList.cpp:314).

llvm-svn: 225811

9 years agoUpdate multiline.ll testcase to handle (ppc64le) .localentry directive
Will Schmidt [Tue, 13 Jan 2015 18:17:08 +0000 (18:17 +0000)]
Update multiline.ll testcase to handle (ppc64le) .localentry directive

The ppc64le platform will emit a .localentry directive. This is triggering
a false-positive against a CHECK-NOT: .loc in multiline.ll.
Add a space "{{ }}" to the check-not line to allow for arguments, and
prevent .localentry from matching.

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

llvm-svn: 225810

9 years ago[PowerPC] Add missing override keyword
Hal Finkel [Tue, 13 Jan 2015 18:02:22 +0000 (18:02 +0000)]
[PowerPC] Add missing override keyword

llvm-svn: 225809

9 years ago[PowerPC] Add StackMap/PatchPoint support
Hal Finkel [Tue, 13 Jan 2015 17:48:12 +0000 (17:48 +0000)]
[PowerPC] Add StackMap/PatchPoint support

This commit does two things:

 1. Refactors PPCFastISel to use more of the common infrastructure for call
    lowering (this lets us take advantage of this common code for lowering some
    common intrinsics, stackmap/patchpoint among them).

 2. Adds support for stackmap/patchpoint lowering. For the most part, this is
    very similar to the support in the AArch64 target, with the obvious differences
    (different registers, NOP instructions, etc.). The test cases are adapted
    from the AArch64 test cases.

One difference of note is that the patchpoint call sequence takes 24 bytes, so
you can't use less than that (on AArch64 you can go down to 16). Also, as noted
in the docs, we take the patchpoint address to be the actual code address
(assuming the call is local in the TOC-sharing sense), which should yield
higher performance than generating the full cross-DSO indirect-call sequence
and is likely just as useful for JITed code (if not, we'll change it).

StackMaps and Patchpoints are still marked as experimental, and so this support
is doubly experimental. So go ahead and experiment!

llvm-svn: 225808

9 years ago[StackMaps] Use CurrentFnSymForSize
Hal Finkel [Tue, 13 Jan 2015 17:48:07 +0000 (17:48 +0000)]
[StackMaps] Use CurrentFnSymForSize

When computing the call-site offset, use AP.CurrentFnSymForSize instead of
AP.CurrentFnSym. There should be no change for other targets, but this is
necessary for generating valid expressions for PPC64/ELF.

llvm-svn: 225807

9 years ago[StackMaps] Mark in CallLoweringInfo when lowering a patchpoint
Hal Finkel [Tue, 13 Jan 2015 17:48:04 +0000 (17:48 +0000)]
[StackMaps] Mark in CallLoweringInfo when lowering a patchpoint

While, generally speaking, the process of lowering arguments for a patchpoint
is the same as lowering a regular indirect call, on some targets it may not be
exactly the same. Targets may not, for example, want to add additional register
dependencies that apply only to making cross-DSO calls through linker stubs,
may not want to load additional registers out of function descriptors, and may
not want to add additional side-effect-causing instructions that cannot be
removed later with the call itself being generated.

The PowerPC target will use this in a future commit (for all of the reasons
stated above).

llvm-svn: 225806

9 years ago[StackMaps] Allow the target to pre-process the live-out mask
Hal Finkel [Tue, 13 Jan 2015 17:47:59 +0000 (17:47 +0000)]
[StackMaps] Allow the target to pre-process the live-out mask

Some targets, PowerPC for example, have pseudo-registers (such as that used to
represent the rounding mode), that don't have DWARF register numbers or a
register class. These are used only for internal dependency tracking, and
should not appear in the recorded live-outs. This adds a callback allowing the
target to pre-process the live-out mask in order to remove these kinds of
registers so that the StackMaps code does not complain about them and/or
attempt to include them in the output.

This will be used by the PowerPC target in a future commit.

llvm-svn: 225805

9 years ago[PowerPC] Split the blr definition into BLR and BLR8
Hal Finkel [Tue, 13 Jan 2015 17:47:54 +0000 (17:47 +0000)]
[PowerPC] Split the blr definition into BLR and BLR8

We really need a separate 64-bit version of this instruction so that it can be
marked as clobbering LR8 (instead of just LR). No change in functionality
(although the verifier might be slightly happier), however, it is required for
stackmap/patchpoint support. Thus, this will be covered by stackmap test cases
once those are added.

llvm-svn: 225804

9 years agoInherit attributes when infering a framework module
Ben Langmuir [Tue, 13 Jan 2015 17:47:44 +0000 (17:47 +0000)]
Inherit attributes when infering a framework module

If a module map contains
framework module * [extern_c] {}

We will now infer [extern_c] on the inferred framework modules (we
already inferred [system] as a special case).

llvm-svn: 225803

9 years agoHandle [extern_c] attribute in module printer
Ben Langmuir [Tue, 13 Jan 2015 17:47:38 +0000 (17:47 +0000)]
Handle [extern_c] attribute in module printer

I'm not sure why we have OS.indent(Indent+2) for the system attribute,
but presumably we want the same behaviour for all attributes...

llvm-svn: 225802

9 years agoRemove unused method canInferFrameworkModule
Ben Langmuir [Tue, 13 Jan 2015 17:47:29 +0000 (17:47 +0000)]
Remove unused method canInferFrameworkModule

llvm-svn: 225801

9 years ago[PowerPC] Add DWARF numbers for CA (XER), etc.
Hal Finkel [Tue, 13 Jan 2015 17:45:11 +0000 (17:45 +0000)]
[PowerPC] Add DWARF numbers for CA (XER), etc.

For registers that have DWARF numbers (like CA, which is really part of XER),
add them. Also, RM is not an SPR, and the declaration hack (where it is
declared as an SPR with an arbitrary number) is not needed, so just declare it
as a register.

NFC; although CA's register number will be needed when stackmap/patchpoint
support is added.

llvm-svn: 225800

9 years agoMake regex::assign not clobber the regex in case of failure. Fixes PR#22213
Marshall Clow [Tue, 13 Jan 2015 16:49:52 +0000 (16:49 +0000)]
Make regex::assign not clobber the regex in case of failure. Fixes PR#22213

llvm-svn: 225799

9 years ago[mips][microMIPS] Fix issue with 16b instructions in jr instruction delay slot
Jozef Kolek [Tue, 13 Jan 2015 15:59:17 +0000 (15:59 +0000)]
[mips][microMIPS] Fix issue with 16b instructions in jr instruction delay slot

16 bit instructions are not allowed in jr delay slot. Same stands for
PseudoIndirectBranch and PseudoReturn.

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

llvm-svn: 225798

9 years agoAdded a Mips lld milestone to the release notes for the 3.6 release.
Daniel Sanders [Tue, 13 Jan 2015 15:17:00 +0000 (15:17 +0000)]
Added a Mips lld milestone to the release notes for the 3.6 release.

llvm-svn: 225797

9 years agofixed the missed bracket introduced by checkin rev 225792
Andrey Churbanov [Tue, 13 Jan 2015 15:16:49 +0000 (15:16 +0000)]
fixed the missed bracket introduced by checkin rev 225792

llvm-svn: 225796

9 years agoAdded TLI hook for isFPExtFree. Some of the FMA combine heuristics are now guarded...
Olivier Sallenave [Tue, 13 Jan 2015 15:06:36 +0000 (15:06 +0000)]
Added TLI hook for isFPExtFree. Some of the FMA combine heuristics are now guarded with that hook.

llvm-svn: 225795

9 years agoThis patch enables the use of KMP_AFFINITY=balanced on non-MIC Architectures. The...
Andrey Churbanov [Tue, 13 Jan 2015 14:54:00 +0000 (14:54 +0000)]
This patch enables the use of KMP_AFFINITY=balanced on non-MIC Architectures.  The restriction for using balanced affinity on non-MIC architectures is it only works for one-package machines.

llvm-svn: 225794

9 years agosmall fixes to the hierarchical barrier
Andrey Churbanov [Tue, 13 Jan 2015 14:47:02 +0000 (14:47 +0000)]
small fixes to the hierarchical barrier

llvm-svn: 225793

9 years agoaarch64 port sent by C. Bergstrom
Andrey Churbanov [Tue, 13 Jan 2015 14:43:35 +0000 (14:43 +0000)]
aarch64 port sent by C. Bergstrom

llvm-svn: 225792

9 years agoRevert "SLPVectorizer: Cache results from memory alias checking."
Erik Eckstein [Tue, 13 Jan 2015 14:36:46 +0000 (14:36 +0000)]
Revert "SLPVectorizer: Cache results from memory alias checking."

The alias cache has a problem of incorrect collisions in case a new instruction is allocated at the same address as a previously deleted instruction.

llvm-svn: 225790

9 years agoReturn the architecture by probing predefined compiler macros
Andrey Churbanov [Tue, 13 Jan 2015 14:35:23 +0000 (14:35 +0000)]
Return the architecture by probing predefined compiler macros

llvm-svn: 225789

9 years agoSilence warnings about unknown pragmas for compilers that are not Clang. NFC.
Aaron Ballman [Tue, 13 Jan 2015 14:30:07 +0000 (14:30 +0000)]
Silence warnings about unknown pragmas for compilers that are not Clang. NFC.

llvm-svn: 225788

9 years ago[OCaml] Allow out-of-tree builds of LLVM bindings.
Peter Zotov [Tue, 13 Jan 2015 12:17:56 +0000 (12:17 +0000)]
[OCaml] Allow out-of-tree builds of LLVM bindings.

In order to use this feature, configure LLVM as usual,
but then build and install it as:

   make all install SYSTEM_LLVM_CONFIG=llvm-config

where llvm-config is the llvm-config binary installed on your
system (possibly llvm-config-VERSION on e.g. Debian).

llvm-svn: 225787

9 years agoSLPVectorizer: Cache results from memory alias checking.
Erik Eckstein [Tue, 13 Jan 2015 11:37:51 +0000 (11:37 +0000)]
SLPVectorizer: Cache results from memory alias checking.

This speeds up the dependency calculations for blocks with many load/store/call instructions.
Beside the improved runtime, there is no functional change.

llvm-svn: 225786

9 years ago[PM] In the PassManager template, remove a pointless indirection through
Chandler Carruth [Tue, 13 Jan 2015 11:36:43 +0000 (11:36 +0000)]
[PM] In the PassManager template, remove a pointless indirection through
a nested class template for the PassModel, and use the T-suffix for the
two typedefs to match the code in the AnalysisManager.

This is the last of the fairly fundamental code cleanups here. Will be
focusing on the printing of analyses next to finish that aspect off.

llvm-svn: 225785

9 years ago[PM] Remove the 'AnalysisManagerT' type parameter from numerous layers
Chandler Carruth [Tue, 13 Jan 2015 11:31:43 +0000 (11:31 +0000)]
[PM] Remove the 'AnalysisManagerT' type parameter from numerous layers
of templates in the new pass manager.

The analysis manager is now itself just a template predicated on the IR
unit. This makes lots of the templates really trivial and more clear:
they are all parameterized on a single type, the IR unit's type.
Everything else is a function of that. To me, this is a really nice
cleanup of the APIs and removes a layer of 'magic' and 'indirection'
that really wasn't there and just got in the way of understanding what
is going on here.

llvm-svn: 225784

9 years ago[PM] Refactor the new pass manager to use a single template to implement
Chandler Carruth [Tue, 13 Jan 2015 11:13:56 +0000 (11:13 +0000)]
[PM] Refactor the new pass manager to use a single template to implement
the generic functionality of the pass managers themselves.

In the new infrastructure, the pass "manager" isn't actually interesting
at all. It just pipelines a single chunk of IR through N passes. We
don't need to know anything about the IR or the passes to do this really
and we can replace the 3 implementations of the exact same functionality
with a single generic PassManager template, complementing the single
generic AnalysisManager template.

I've left typedefs in place to give convenient names to the various
obvious instantiations of the template.

With this, I think I've nuked almost all of the redundant logic in the
managers, and I think the overall design is actually simpler for having
single templates that clearly indicate there is no special logic here.
The logging is made somewhat more annoying by this change, but I don't
think the difference is worth having heavy-weight traits to help log
things.

llvm-svn: 225783

9 years ago[mips] Fix va_arg() for pointer types on big-endian N32.
Daniel Sanders [Tue, 13 Jan 2015 10:47:00 +0000 (10:47 +0000)]
[mips] Fix va_arg() for pointer types on big-endian N32.

Summary:
The Mips ABI's treat pointers in the same way as integers. They are
sign-extended to 32-bit for O32, and 64-bit for N32/N64. This doesn't matter
for O32 and N64 where pointers are already the correct width but it does matter
for big-endian N32, where pointers are 32-bit and need promoting.

The caller side is already passing pointers correctly. This patch corrects the
callee.

Reviewers: vmedic, atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

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

llvm-svn: 225782

9 years agoRevert "Sema: An extern declaration can't be a redeclaration of a parameter"
David Majnemer [Tue, 13 Jan 2015 10:14:57 +0000 (10:14 +0000)]
Revert "Sema: An extern declaration can't be a redeclaration of a parameter"

This reverts commit r225780, we can't compile line 181 in
sanitizer_platform_limits_posix.cc with this commit.

llvm-svn: 225781

9 years agoSema: An extern declaration can't be a redeclaration of a parameter
David Majnemer [Tue, 13 Jan 2015 09:55:56 +0000 (09:55 +0000)]
Sema: An extern declaration can't be a redeclaration of a parameter

In the following:
void f(int x) { extern int x; }

The second declaration of 'x' shouldn't be considered a redeclaration of
the parameter.

llvm-svn: 225780

9 years agoUpdate release notes wrt OCaml bindings.
Peter Zotov [Tue, 13 Jan 2015 09:48:02 +0000 (09:48 +0000)]
Update release notes wrt OCaml bindings.

llvm-svn: 225779

9 years ago[OCaml] Use $CAMLORIGIN, an rpath-$ORIGIN-like mechanism in OCaml.
Peter Zotov [Tue, 13 Jan 2015 09:47:59 +0000 (09:47 +0000)]
[OCaml] Use $CAMLORIGIN, an rpath-$ORIGIN-like mechanism in OCaml.

As a result, installations of LLVM in non-standard locations
will not require passing custom -ccopt -L flags when building
the binary, nor absolute paths would be embedded in the cma/cmxa
files. Additionally, the executables will not require changes
to LD_LIBRARY_PATH, although CAML_LD_LIBRARY_PATH still
has to be set for ocamlc without -custom.

See http://caml.inria.fr/mantis/view.php?id=6642.
Note that the patch is approved, but not merged yet.
It will be released in 4.03 and likely 4.02.

llvm-svn: 225778

9 years agoUpdate clang-format.el to use xml output and patch in the returned chunks.
Manuel Klimek [Tue, 13 Jan 2015 08:35:34 +0000 (08:35 +0000)]
Update clang-format.el to use xml output and patch in the returned chunks.

This leads to better undo behavior and avoids window content jumping
around.

Patch by Johann Klähn.

llvm-svn: 225777

9 years agoParse: Switch to using EOF tokens for late parsed attributes
David Majnemer [Tue, 13 Jan 2015 08:35:24 +0000 (08:35 +0000)]
Parse: Switch to using EOF tokens for late parsed attributes

The EOF token injection technique is preferable to using
isBeforeInTranslationUnit to determine whether or not additional cleanup
is needed.  I don't have an example off-hand that requires it but it is
nicer nonetheless.

llvm-svn: 225776

9 years agoIR/MetadataTest.cpp: Appease msc17 to avoid initializer list.
NAKAMURA Takumi [Tue, 13 Jan 2015 08:13:46 +0000 (08:13 +0000)]
IR/MetadataTest.cpp: Appease msc17 to avoid initializer list.

llvm-svn: 225775

9 years agoParse: Don't crash when default argument in typedef consists of sole '='
David Majnemer [Tue, 13 Jan 2015 07:42:33 +0000 (07:42 +0000)]
Parse: Don't crash when default argument in typedef consists of sole '='

We'd crash trying to make the SourceRange for the tokens we'd like to
highlight.  Don't assume there is more than one token makes up the
default argument.

llvm-svn: 225774

9 years agoEnhance the eh_frame unwind instruction augmenter so that
Jason Molenda [Tue, 13 Jan 2015 07:39:03 +0000 (07:39 +0000)]
Enhance the eh_frame unwind instruction augmenter so that
it will do the right thing on x86 routines with a mid-function
epilogue sequence (where the unwind rules need to be reinstalled
after the epilogue has completed).
<rdar://problem/19417410>

llvm-svn: 225773

9 years agoPeephole opt needs optimizeSelect() to keep track of newly created MIs
Mehdi Amini [Tue, 13 Jan 2015 07:07:13 +0000 (07:07 +0000)]
Peephole opt needs optimizeSelect() to keep track of newly created MIs

Peephole optimizer is scanning a basic block forward. At some point it
needs to answer the question "given a pointer to an MI in the current
BB, is it located before or after the current instruction".
To perform this, it keeps a set of the MIs already seen during the scan,
if a MI is not in the set, it is assumed to be after.
It means that newly created MIs have to be inserted in the set as well.

This commit passes the set as an argument to the target-dependent
optimizeSelect() so that it can properly update the set with the
(potentially) newly created MIs.

llvm-svn: 225772

9 years agoAdd an additional check to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite
Jason Molenda [Tue, 13 Jan 2015 06:07:07 +0000 (06:07 +0000)]
Add an additional check to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite
which will verify if the eh_frame instructions include details about
the prologue or not.  Both clang and gcc include prologue instructions
but there's no requirement for them to do so -- and I'm sure we'll
have to interoperate with a compiler that doesn't generate prologue
info at some point.

I don't have any compilers that omit the prologue instructions so the
testing was of the "makre sure augmented unwind info is still created".
With an eh_frame without prologue, this code should reject the
augmentation scheme altogether and we should fall back to using assembly
instruction profiling.

llvm-svn: 225771

9 years agoChange the x86 assembly instruction unwind parser to
Jason Molenda [Tue, 13 Jan 2015 06:04:04 +0000 (06:04 +0000)]
Change the x86 assembly instruction unwind parser to
step through the complete function looking for any epilogue
instructions.  If we find an epilogue sequence, re-instate
the correct unwind instructions if there is more code past
that epilogue -- this will correctly handle an x86 function
with multiple epilogues in it.

NB there is still a bug with the "eh_frame augmented"
UnwindPlans and mid-function epilogues.  Looking at that next.

<rdar://problem/18863406>

llvm-svn: 225770

9 years agoRemove dead code.
Rui Ueyama [Tue, 13 Jan 2015 05:59:17 +0000 (05:59 +0000)]
Remove dead code.

Now every InputElement has exactly one File in it, so "expand"
method is now no-op.

llvm-svn: 225769

9 years agoParse: Don't crash if missing an initializer expression
David Majnemer [Tue, 13 Jan 2015 05:28:24 +0000 (05:28 +0000)]
Parse: Don't crash if missing an initializer expression

llvm-svn: 225768

9 years agoRemove InputGraph::registerObserver.
Rui Ueyama [Tue, 13 Jan 2015 05:24:53 +0000 (05:24 +0000)]
Remove InputGraph::registerObserver.

PECOFF was the only user of the API, and the reason why we created
the API is because, although the driver creates a list of input files,
it has no knowledge on what files are being created. It was because
everything was hidden behind the InputGraph abstraction.

Now the driver knows what that's doing. We no longer need this
indirection to get the file list being processed.

llvm-svn: 225767

9 years agoRemove InputGraph::dump().
Rui Ueyama [Tue, 13 Jan 2015 05:11:05 +0000 (05:11 +0000)]
Remove InputGraph::dump().

This is dead code.

llvm-svn: 225766

9 years agoParse: use the EOF token method to lex inline method bodies
David Majnemer [Tue, 13 Jan 2015 05:06:20 +0000 (05:06 +0000)]
Parse: use the EOF token method to lex inline method bodies

Mark the end of the method body with an EOF token, collect it once we
expect to be done with method body parsing.  No functionality change
intended.

llvm-svn: 225765

9 years agoConvert other drivers to use WrapperNode.
Rui Ueyama [Tue, 13 Jan 2015 04:33:07 +0000 (04:33 +0000)]
Convert other drivers to use WrapperNode.

llvm-svn: 225764

9 years agoParse: Further simplify ParseLexedMethodDeclaration
David Majnemer [Tue, 13 Jan 2015 04:20:57 +0000 (04:20 +0000)]
Parse: Further simplify ParseLexedMethodDeclaration

No functionality change intended, just moving code around to make it
simpler.

llvm-svn: 225763

9 years agofix {typo, build failure} in r225760
Ramkumar Ramachandra [Tue, 13 Jan 2015 04:17:47 +0000 (04:17 +0000)]
fix {typo, build failure} in r225760

llvm-svn: 225762

9 years agoMark vtable used on explicit destructor definitions.
Nico Weber [Tue, 13 Jan 2015 03:52:11 +0000 (03:52 +0000)]
Mark vtable used on explicit destructor definitions.

There are two things in a C++ program that need to read the vtable pointer:
Constructors and destructors.  (A few other operations -- virtual calls,
dynamic cast, rtti -- read the vtable pointer off a this pointer, but for
this they don't need the vtable symbol.)  Implicit constructors and destructors
and explicit constructors already marked the vtable as used, but explicit
destructors didn't.

Note that the only thing sema's "mark a class's vtable used" does is to mark all
final overriders of the class as referenced, it does _not_ cause emission of
the vtable itself.  This is done on demand by codegen, independent of sema,
since sema might emit functions that are not referenced.  (The exception are
vtables that are forced via key functions -- these are forced onto codegen
by sema.)

This bug went unnoticed for years because it doesn't have observable effects
(yet -- I want to change this in PR20337, which is why I noticed this).

r213109 made it so that _calls_ to constructors don't mark the vtable used.
Currently, _calls_ to destructors still mark the vtable used.  If that
wasn't the case, this program would tickle the problem:

  test.h:
    template <typename T>
    struct B {
      int* p;
      virtual ~B() { delete p; }
      virtual void f() {}
    };

    struct __attribute__((visibility("default"))) C {
      C();
      B<int> m;
    };

  test2.cc:
    #include "test.h"
    int main() {
      C* c = new C;
      delete c;
    }

  test3.cc:
    #include "test.h"
    C::C() {}

  # This bin/clang++ binary doesn't MarkVTableUsed() for virtual dtor calls:
  $ bin/clang++ -shared test3.cc -std=c++11 -O2  -fvisibility=hidden \
        -fvisibility-inlines-hidden  -o libtest3.dylib
  $ bin/clang++ test2.cc -std=c++11 -O2  -fvisibility=hidden \
        -fvisibility-inlines-hidden  libtest3.dylib
  Undefined symbols for architecture x86_64:
    "B<int>::f()", referenced from:
        vtable for B<int> in test2-af8f4f.o
  ld: symbol(s) not found for architecture x86_64

What's happening here is that there's a copy of B's vtable hidden in
libtest3.dylib, because C's constructor caused an implicit instantiation of that
(and implicit constructors generate vtables).
test2.cc calls C's destructDr, which destroys the B<int> member,
which wants to overwrite the vtable back to B (think of B as the base of a class
hierarchy, and of hierarchical destruction -- maybe we shouldn't do the vtable
writing in destructors of final classes), but there's nothing in test2.cc that
marks B's vtable used.  So codegen writes out the vtable, but since it wasn't
marked used, sema didn't mark all the virtual functions (in particular f())
as used.

Note that this change makes us reject programs we didn't reject before (see
the included Sema test case), but both gcc and cl also reject this code, and
clang used to reject it before r213109.

llvm-svn: 225761

9 years agoStandardize {pred,succ,use,user}_empty()
Ramkumar Ramachandra [Tue, 13 Jan 2015 03:46:47 +0000 (03:46 +0000)]
Standardize {pred,succ,use,user}_empty()

The functions {pred,succ,use,user}_{begin,end} exist, but many users
have to check *_begin() with *_end() by hand to determine if the
BasicBlock or User is empty. Fix this with a standard *_empty(),
demonstrating a few usecases.

llvm-svn: 225760

9 years ago[OPENMP] Consider global named register variables as threadprivate by default.
Alexey Bataev [Tue, 13 Jan 2015 03:35:30 +0000 (03:35 +0000)]
[OPENMP] Consider global named register variables as threadprivate by default.
Register are thread-local by default, so we have to consider them as threadprivate.

llvm-svn: 225759

9 years agoARM: prepare prefix parsing for improved AAELF support
Saleem Abdulrasool [Tue, 13 Jan 2015 03:22:49 +0000 (03:22 +0000)]
ARM: prepare prefix parsing for improved AAELF support

AAELF specifies a number of ELF specific relocation types which have custom
prefixes for the symbol reference.  Switch the parser to be more table driven
with an idea of file formats for which they apply.  NFC.

llvm-svn: 225758

9 years ago[PM] Fold all three analysis managers into a single AnalysisManager
Chandler Carruth [Tue, 13 Jan 2015 02:51:47 +0000 (02:51 +0000)]
[PM] Fold all three analysis managers into a single AnalysisManager
template.

This consolidates three copies of nearly the same core logic. It adds
"complexity" to the ModuleAnalysisManager in that it makes it possible
to share a ModuleAnalysisManager across multiple modules... But it does
so by deleting *all of the code*, so I'm OK with that. This will
naturally make fixing bugs in this code much simpler, etc.

The only down side here is that we have to use 'typename' and 'this->'
in various places, and the implementation is lifted into the header.
I'll take that for the code size reduction.

The convenient names are still typedef-ed and used throughout so that
users can largely ignore this aspect of the implementation.

The follow-up change to this will do the exact same refactoring for the
PassManagers. =D

It turns out that the interesting different code is almost entirely in
the adaptors. At the end, that should be essentially all that is left.

llvm-svn: 225757

9 years agoExtend the self move warning to record types.
Richard Trieu [Tue, 13 Jan 2015 02:32:02 +0000 (02:32 +0000)]
Extend the self move warning to record types.

Move the logic for checking self moves into SemaChecking and add that function
to Sema since it is now used in multiple places.

llvm-svn: 225756

9 years agoIf we don't find a matching ) for a ( in an exception specification, keep the tokens...
Richard Smith [Tue, 13 Jan 2015 02:24:58 +0000 (02:24 +0000)]
If we don't find a matching ) for a ( in an exception specification, keep the tokens around so we can diagnose an error rather than silently discarding them.

llvm-svn: 225755

9 years agoDisable a warning for self move since the test is checking for this behavior.
Richard Trieu [Tue, 13 Jan 2015 02:10:33 +0000 (02:10 +0000)]
Disable a warning for self move since the test is checking for this behavior.

llvm-svn: 225754

9 years agofix typo; NFC
Sanjay Patel [Tue, 13 Jan 2015 01:51:52 +0000 (01:51 +0000)]
fix typo; NFC

llvm-svn: 225753

9 years agoRename llvm.recoverframeallocation to llvm.framerecover
Reid Kleckner [Tue, 13 Jan 2015 01:51:34 +0000 (01:51 +0000)]
Rename llvm.recoverframeallocation to llvm.framerecover

This name is less descriptive, but it sort of puts things in the
'llvm.frame...' namespace, relating it to frameallocate and
frameaddress. It also avoids using "allocate" and "allocation" together.

llvm-svn: 225752

9 years agoPR22208: On FreeBSD systems, __STDC_MB_MIGHT_NEQ_WC__ is expected to be defined
Richard Smith [Tue, 13 Jan 2015 01:47:45 +0000 (01:47 +0000)]
PR22208: On FreeBSD systems, __STDC_MB_MIGHT_NEQ_WC__ is expected to be defined
even though every basic source character literal has the same numerical value
as a narrow or wide character literal.

It appears that the FreeBSD folks are trying to use this macro to mean
something other than what the relevant standards say it means, but their usage
is conforming, so put up with it.

llvm-svn: 225751

9 years ago[PM] Fix another place where I was using an overly generic T&& for the
Chandler Carruth [Tue, 13 Jan 2015 01:44:56 +0000 (01:44 +0000)]
[PM] Fix another place where I was using an overly generic T&& for the
IR unit to directly use IRUnitT& for now.

llvm-svn: 225750

9 years agoIR: Use unique_ptr, NFC
Duncan P. N. Exon Smith [Tue, 13 Jan 2015 00:57:27 +0000 (00:57 +0000)]
IR: Use unique_ptr, NFC

Use `std::unique_ptr<>`, as suggested by David Blaikie.

llvm-svn: 225749

9 years agoDon't run functionalities/tty under sudo / as root.
Jason Molenda [Tue, 13 Jan 2015 00:54:59 +0000 (00:54 +0000)]
Don't run functionalities/tty under sudo / as root.
The terminal window will be opened under the ownership
of the real userid and it won't be able to open the
socket talking back to lldb -- the testsuite will hang
here.

The same thing probably should be done for lldb when run
on a remote system over ssh.  I added a line for that
but commented it out for now because I haven't
tested it.

llvm-svn: 225748

9 years agoPhabricator calls it "subscriber" not "cc"
Paul Robinson [Tue, 13 Jan 2015 00:50:31 +0000 (00:50 +0000)]
Phabricator calls it "subscriber" not "cc"

llvm-svn: 225747

9 years agoAdd the llvm.frameallocate and llvm.recoverframeallocation intrinsics
Reid Kleckner [Tue, 13 Jan 2015 00:48:10 +0000 (00:48 +0000)]
Add the llvm.frameallocate and llvm.recoverframeallocation intrinsics

These intrinsics allow multiple functions to share a single stack
allocation from one function's call frame. The function with the
allocation may only perform one allocation, and it must be in the entry
block.

Functions accessing the allocation call llvm.recoverframeallocation with
the function whose frame they are accessing and a frame pointer from an
active call frame of that function.

These intrinsics are very difficult to inline correctly, so the
intention is that they be introduced rarely, or at least very late
during EH preparation.

Reviewers: echristo, andrew.w.kaylor

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

llvm-svn: 225746

9 years agoIR: Remove an invalid assertion when replacing resolved operands
Duncan P. N. Exon Smith [Tue, 13 Jan 2015 00:46:34 +0000 (00:46 +0000)]
IR: Remove an invalid assertion when replacing resolved operands

This adds back the testcase from r225738, and adds to it.  Looks like we
need both sides for now (the assertion was incorrect both ways, and
although it seemed reasonable (when written correctly) it wasn't
particularly important).

llvm-svn: 225745

9 years agoCombine fcmp + select to fminnum / fmaxnum if no nans and legal
Matt Arsenault [Tue, 13 Jan 2015 00:43:00 +0000 (00:43 +0000)]
Combine fcmp + select to fminnum / fmaxnum if no nans and legal

Also require unsafe FP math for no since there isn't a way to
test for signed zeros.

llvm-svn: 225744

9 years ago[PM] Re-clang-format much of this code as the code has changed some and
Chandler Carruth [Tue, 13 Jan 2015 00:36:47 +0000 (00:36 +0000)]
[PM] Re-clang-format much of this code as the code has changed some and
so has clang-format. Notably, this fixes a bunch of formatting in the
CGSCC pass manager side of things that has been improved in clang-format
recently.

llvm-svn: 225743

9 years agoRevert "IR: Fix an inverted assertion when replacing resolved operands"
Duncan P. N. Exon Smith [Tue, 13 Jan 2015 00:34:21 +0000 (00:34 +0000)]
Revert "IR: Fix an inverted assertion when replacing resolved operands"

This reverts commit r225738.  Maybe the assertion is just plain wrong,
but this version fails on WAY more bots.  I'll make sure both ways work
in a follow-up but I want to get bots green in the meantime.

llvm-svn: 225742

9 years agoSimplify a test. No behavior change.
Nico Weber [Tue, 13 Jan 2015 00:24:46 +0000 (00:24 +0000)]
Simplify a test. No behavior change.

Templates don't have key functions (cf computeKeyFunction() in
RecordLayoutBuilder.cpp), so don't have something that looks like one.

Also, instead of a vcall to force generation of the vtable, just construct
the object.  This is how the repro on PR5557 (what the test is for) worked too.

llvm-svn: 225741

9 years agoGrammar and spelling.
Eric Christopher [Tue, 13 Jan 2015 00:21:14 +0000 (00:21 +0000)]
Grammar and spelling.

llvm-svn: 225740

9 years agoRemove fragile regex from test
Greg Fitzgerald [Tue, 13 Jan 2015 00:12:04 +0000 (00:12 +0000)]
Remove fragile regex from test

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

llvm-svn: 225739

9 years agoIR: Fix an inverted assertion when replacing resolved operands
Duncan P. N. Exon Smith [Tue, 13 Jan 2015 00:10:38 +0000 (00:10 +0000)]
IR: Fix an inverted assertion when replacing resolved operands

Add a unit test, since this bug was only exposed by clang tests.  Thanks
to Rafael for tracking this down!

llvm-svn: 225738

9 years agoRelease merge script: don't actually commit the merge
Hans Wennborg [Tue, 13 Jan 2015 00:07:31 +0000 (00:07 +0000)]
Release merge script: don't actually commit the merge

Instead, just present the command for committing it. This way,
the user can test the merge locally, resolve conflicts, etc.
before committing, which seems much safer to me.

llvm-svn: 225737

9 years agoRelease tag script: add -revision option
Hans Wennborg [Tue, 13 Jan 2015 00:07:29 +0000 (00:07 +0000)]
Release tag script: add -revision option

It seems useful to be able to create the branch at a revision that looks good
on the buildbots.

llvm-svn: 225736

9 years agoRelease tag script: add -dry-run flag
Hans Wennborg [Tue, 13 Jan 2015 00:07:22 +0000 (00:07 +0000)]
Release tag script: add -dry-run flag

llvm-svn: 225735

9 years agoDebug Info: Move support for constants into DwarfExpression.
Adrian Prantl [Tue, 13 Jan 2015 00:04:06 +0000 (00:04 +0000)]
Debug Info: Move support for constants into DwarfExpression.
Move the declaration of DebugLocDwarfExpression into DwarfExpression.h
because it needs to be accessed from AsmPrinterDwarf.cpp and DwarfDebug.cpp

NFC.

llvm-svn: 225734

9 years agoFix XCode build on OSX - add OptionValueChar.cpp
Oleksiy Vyalov [Mon, 12 Jan 2015 23:50:51 +0000 (23:50 +0000)]
Fix XCode build on OSX - add OptionValueChar.cpp

http://reviews.llvm.org/D6941

llvm-svn: 225733

9 years agoIR: Split out writeMDTuple(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 23:45:31 +0000 (23:45 +0000)]
IR: Split out writeMDTuple(), NFC

Prepare for more subclasses of `UniquableMDNode` than `MDTuple`.

llvm-svn: 225732

9 years agoMake DwarfExpression store the AsmPrinter instead of the TargetMachine.
Adrian Prantl [Mon, 12 Jan 2015 23:36:56 +0000 (23:36 +0000)]
Make DwarfExpression store the AsmPrinter instead of the TargetMachine.
NFC.

llvm-svn: 225731

9 years agoremove extra semicolon
Adrian Prantl [Mon, 12 Jan 2015 23:36:50 +0000 (23:36 +0000)]
remove extra semicolon

llvm-svn: 225730

9 years agomusttail: Only set the inreg flag for fastcall and vectorcall
Reid Kleckner [Mon, 12 Jan 2015 23:28:23 +0000 (23:28 +0000)]
musttail: Only set the inreg flag for fastcall and vectorcall

Otherwise we'll attempt to forward ECX, EDX, and EAX for cdecl and
stdcall thunks, leaving us with no scratch registers for indirect call
targets.

Fixes PR22052.

llvm-svn: 225729

9 years agoR600/SI: Remove redundant setting expand on f64 vectors
Matt Arsenault [Mon, 12 Jan 2015 23:13:00 +0000 (23:13 +0000)]
R600/SI: Remove redundant setting expand on f64 vectors

None of these are legal types already, so they default to
Expand.

llvm-svn: 225728

9 years agoIR: Unbreak the MSVC build after r225689
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 23:09:14 +0000 (23:09 +0000)]
IR: Unbreak the MSVC build after r225689

llvm-svn: 225727

9 years agoRun clang-format on the parts of AsmPrinterDwarf where it improves the
Adrian Prantl [Mon, 12 Jan 2015 23:03:23 +0000 (23:03 +0000)]
Run clang-format on the parts of AsmPrinterDwarf where it improves the
readability.

llvm-svn: 225726

9 years agoUpdate test cases for new -fsanitize-recover= semantics.
Alexey Samsonov [Mon, 12 Jan 2015 23:02:42 +0000 (23:02 +0000)]
Update test cases for new -fsanitize-recover= semantics.

llvm-svn: 225725

9 years agoDebug Info: Add a virtual destructor to DwarfExpression.
Adrian Prantl [Mon, 12 Jan 2015 22:59:28 +0000 (22:59 +0000)]
Debug Info: Add a virtual destructor to DwarfExpression.
Thanks Chandler for noticing!

llvm-svn: 225724

9 years ago[PM] Sink the reference vs. value decision for IR units out of the
Chandler Carruth [Mon, 12 Jan 2015 22:53:31 +0000 (22:53 +0000)]
[PM] Sink the reference vs. value decision for IR units out of the
templated interface.

So far, every single IR unit I can come up with has address-identity.
That is, when two units of IR are both active in LLVM, their addresses
will be distinct of the IR is distinct. This is clearly true for
Modules, Functions, BasicBlocks, and Instructions. It turns out that the
only practical way to make the CGSCC stuff work the way we want is to
make it true for SCCs as well. I expect this pattern to continue.

When first designing the pass manager code, I kept this dimension of
freedom in the type parameters, essentially allowing for a wrapper-type
whose address did not form identity. But that really no longer makes
sense and is making the code more complex or subtle for no gain. If we
ever have an actual use case for this, we can figure out what makes
sense then and there. It will be better because then we will have the
actual example in hand.

While the simplifications afforded in this patch are fairly small
(mostly sinking the '&' out of many type parameters onto a few
interfaces), it would have become much more pronounced with subsequent
changes. I have a sequence of changes that will completely remove the
code duplication that currently exists between all of the pass managers
and analysis managers. =] Should make things much cleaner and avoid bug
fixing N times for the N pass managers.

llvm-svn: 225723

9 years agoIR: Remove incorrect comment, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:53:18 +0000 (22:53 +0000)]
IR: Remove incorrect comment, NFC

llvm-svn: 225722

9 years agoIR: Fix unit test memory leak reported by ASan
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:46:15 +0000 (22:46 +0000)]
IR: Fix unit test memory leak reported by ASan

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/603/steps/check-llvm%20asan/logs/stdio

Thanks Alexey for pointing me to this!

llvm-svn: 225721

9 years agoUntwine this expression. Thanks to David for noticing!
Adrian Prantl [Mon, 12 Jan 2015 22:39:14 +0000 (22:39 +0000)]
Untwine this expression. Thanks to David for noticing!

llvm-svn: 225720

9 years agoReimplement -fsanitize-recover family of flags.
Alexey Samsonov [Mon, 12 Jan 2015 22:39:12 +0000 (22:39 +0000)]
Reimplement -fsanitize-recover family of flags.

Introduce the following -fsanitize-recover flags:
  - -fsanitize-recover=<list>: Enable recovery for selected checks or
      group of checks. It is forbidden to explicitly list unrecoverable
      sanitizers here (that is, "address", "unreachable", "return").
  - -fno-sanitize-recover=<list>: Disable recovery for selected checks or
     group of checks.
  - -f(no-)?sanitize-recover is now a synonym for
    -f(no-)?sanitize-recover=undefined,integer and will soon be deprecated.

These flags are parsed left to right, and mask of "recoverable"
sanitizer is updated accordingly, much like what we do for -fsanitize= flags.
-fsanitize= and -fsanitize-recover= flag families are independent.

CodeGen change: If there is a single UBSan handler function, responsible
for implementing multiple checks, which have different recoverable setting,
then we emit two handler calls instead of one:
the first one for the set of "unrecoverable" checks, another one - for
set of "recoverable" checks. If all checks implemented by a handler have the
same recoverability setting, then the generated code will be the same.

llvm-svn: 225719

9 years ago[X86][SSE] Minor regression fix for r225551
Simon Pilgrim [Mon, 12 Jan 2015 22:38:08 +0000 (22:38 +0000)]
[X86][SSE] Minor regression fix for r225551

r225551 vector byte shuffle optimization caused an assertion as fully zeroable vectors can be produced under certain circumstances. This fix drops the assert and returns a zero vector where the assert would have failed.

llvm-svn: 225718

9 years agoDebug Info: Implement DwarfUnit::addRegisterOpPiece() using DwarfExpression.
Adrian Prantl [Mon, 12 Jan 2015 22:37:16 +0000 (22:37 +0000)]
Debug Info: Implement DwarfUnit::addRegisterOpPiece() using DwarfExpression.
NFC.

llvm-svn: 225717

9 years agoBitcode: Range-based for, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:35:34 +0000 (22:35 +0000)]
Bitcode: Range-based for, NFC

llvm-svn: 225716

9 years agoBitcode: Add abbreviation for METADATA_NAME
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:34:10 +0000 (22:34 +0000)]
Bitcode: Add abbreviation for METADATA_NAME

llvm-svn: 225715