platform/upstream/llvm.git
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

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

llvm-svn: 225714

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

llvm-svn: 225713

9 years agoBitcode: Simplify emission of METADATA_BLOCK
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:30:34 +0000 (22:30 +0000)]
Bitcode: Simplify emission of METADATA_BLOCK

Refactor logic so that we know up-front whether to open a block and
whether we need an MDString abbreviation.

This is almost NFC, but will start emitting `MDString` abbreviations
when the first record is not an `MDString`.

llvm-svn: 225712

9 years agoAsmParser: Use subclass API instead of MDNode wrappers, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:27:39 +0000 (22:27 +0000)]
AsmParser: Use subclass API instead of MDNode wrappers, NFC

Use subclass API instead of the wrappers in `MDNode` in the assembly
parser.  This will make the code easier to follow once we have multiple
subclasses.

llvm-svn: 225711

9 years agoAsmParser: Factor duplicated code into ParseMDNode(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:26:48 +0000 (22:26 +0000)]
AsmParser: Factor duplicated code into ParseMDNode(), NFC

llvm-svn: 225710

9 years agoAsmParser: Reorder ParseMetadata() logic, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:24:50 +0000 (22:24 +0000)]
AsmParser: Reorder ParseMetadata() logic, NFC

llvm-svn: 225709

9 years agoAsmParser: Simplify ParseMDTuple(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:23:04 +0000 (22:23 +0000)]
AsmParser: Simplify ParseMDTuple(), NFC

llvm-svn: 225708

9 years agoDebug Info: Implement DwarfUnit::addRegisterOffset using DwarfExpression.
Adrian Prantl [Mon, 12 Jan 2015 22:19:26 +0000 (22:19 +0000)]
Debug Info: Implement DwarfUnit::addRegisterOffset using DwarfExpression.
No functional change.

llvm-svn: 225707

9 years agoDebug info: Factor out the creation of DWARF expressions from AsmPrinter
Adrian Prantl [Mon, 12 Jan 2015 22:19:22 +0000 (22:19 +0000)]
Debug info: Factor out the creation of DWARF expressions from AsmPrinter
into a new class DwarfExpression that can be shared between AsmPrinter
and DwarfUnit.

This is the first step towards unifying the two entirely redundant
implementations of dwarf expression emission in DwarfUnit and AsmPrinter.

Almost no functional change — Testcases were updated because asm comments
that used to be on two lines now appear on the same line, which is
actually preferable.

llvm-svn: 225706

9 years ago[patch][pr19848] Produce explicit comdats in clang.
Rafael Espindola [Mon, 12 Jan 2015 22:13:53 +0000 (22:13 +0000)]
[patch][pr19848] Produce explicit comdats in clang.

The llvm IR until recently had no support for comdats. This was a problem when
targeting C++ on ELF/COFF as just using weak linkage would cause quite a bit of
dead bits to remain on the executable (unless -ffunction-sections,
-fdata-sections and --gc-sections were used).

To fix the problem, llvm's codegen will just assume that any weak or linkonce
that is not in an explicit comdat should be output in one with the same name as
the global.

This unfortunately breaks cases like pr19848 where a weak symbol is not
xpected to be part of any comdat.

Now that we have explicit comdats in the IR, we can finally get both cases
right.

This first patch just makes clang give explicit comdats to GlobalValues where
t is allowed to.

A followup patch to llvm will then stop implicitly producing comdats.

llvm-svn: 225705

9 years agoRemove CMake standalone build configuration
Greg Fitzgerald [Mon, 12 Jan 2015 21:41:10 +0000 (21:41 +0000)]
Remove CMake standalone build configuration

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

llvm-svn: 225704

9 years agoWrap to 80 columns. No behavior change.
Nico Weber [Mon, 12 Jan 2015 21:24:10 +0000 (21:24 +0000)]
Wrap to 80 columns. No behavior change.

llvm-svn: 225703

9 years agoAsmParser: ParseMDNode() => ParseMDTuple(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 21:23:11 +0000 (21:23 +0000)]
AsmParser: ParseMDNode() => ParseMDTuple(), NFC

This isn't parsing arbitrary subclasses of `MDNode`, just `MDTuple`.

llvm-svn: 225702

9 years agoDon't use a doc comment in a function body.
Nico Weber [Mon, 12 Jan 2015 21:22:27 +0000 (21:22 +0000)]
Don't use a doc comment in a function body.

llvm-svn: 225701

9 years ago80-cols; NFC
Sanjay Patel [Mon, 12 Jan 2015 21:21:28 +0000 (21:21 +0000)]
80-cols; NFC

llvm-svn: 225700

9 years agoAsmParser: Remove unused version of ParseMDNodeID()
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 21:14:38 +0000 (21:14 +0000)]
AsmParser: Remove unused version of ParseMDNodeID()

Merge the two versions of `ParseMDNodeID()` now that no one needs
special forward references.

llvm-svn: 225699

9 years agoAsmParser: Use normal references for metadata attachments, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 21:13:09 +0000 (21:13 +0000)]
AsmParser: Use normal references for metadata attachments, NFC

Remove special parsing logic for metadata attachments.  Now that
`DebugLoc` is stored normally (since the metadata/value split), we don't
need this special forward referencing logic.

llvm-svn: 225698

9 years agoIR: Prepare for a new UniquableMDNode subclass, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:56:33 +0000 (20:56 +0000)]
IR: Prepare for a new UniquableMDNode subclass, NFC

Add generic dispatch for the parts of `UniquableMDNode` that cast to
`MDTuple`.  This makes adding other subclasses (like PR21433's
`MDLocation`) easier.

llvm-svn: 225697

9 years agoIR: Stop erasing MDNodes from uniquing sets during teardown
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:50:25 +0000 (20:50 +0000)]
IR: Stop erasing MDNodes from uniquing sets during teardown

Stop erasing `MDNode`s from the uniquing sets in `LLVMContextImpl`
during teardown (in particular, during
`UniquableMDNode::~UniquableMDNode()`).  Although it's currently
feasible, there isn't any clear benefit and it may not be feasible for
other subclasses (which don't explicitly store the lookup hash).

llvm-svn: 225696

9 years agoFirst crack at PowerPC 3.6 release notes
Bill Schmidt [Mon, 12 Jan 2015 20:46:43 +0000 (20:46 +0000)]
First crack at PowerPC 3.6 release notes

llvm-svn: 225695

9 years agoAdd support for character option types.
Zachary Turner [Mon, 12 Jan 2015 20:44:02 +0000 (20:44 +0000)]
Add support for character option types.

This will allow, in a subsequent patch, the addition of a global
setting that allows the user to specify a single character that
LLDB will recognize as an escape character when processing arg
strings to accomodate differences in Windows/non-Windows path
handling.

Differential Revision: http://reviews.llvm.org/D6887
Reviewed by: Jim Ingham

llvm-svn: 225694

9 years ago[LIT] Remove string decoding in gtest discovery code. lit.util.capture now does decoding.
Eric Fiselier [Mon, 12 Jan 2015 20:43:34 +0000 (20:43 +0000)]
[LIT] Remove string decoding in gtest discovery code. lit.util.capture now does decoding.

llvm-svn: 225693

9 years ago[dfsan] Export dfsan_get_label_info function with C linkage.
Peter Collingbourne [Mon, 12 Jan 2015 20:40:30 +0000 (20:40 +0000)]
[dfsan] Export dfsan_get_label_info function with C linkage.

llvm-svn: 225692

9 years ago[X86] Also create+widen FMIN/FMAX nodes for v2f32.
Ahmed Bougacha [Mon, 12 Jan 2015 20:31:30 +0000 (20:31 +0000)]
[X86] Also create+widen FMIN/FMAX nodes for v2f32.

This happens in the HINT benchmark, where the SLP-vectorizer created
v2f32 fcmp/select code.  The "correct" solution would have been to
teach the vectorizer cost model that v2f32 isn't legal (because really,
it isn't), but if we can vectorize we might as well do so.

We legalize these v2f32 FMIN/FMAX nodes by widening to v4f32 later on.
v3f32 were already widened to v4f32 by the generic unroll-and-build-vector
legalization.

rdar://15763436
Differential Revision: http://reviews.llvm.org/D6557

llvm-svn: 225691

9 years agoIR: Move creation logic to MDNodeFwdDecl, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:21:37 +0000 (20:21 +0000)]
IR: Move creation logic to MDNodeFwdDecl, NFC

Same as with `MDTuple`, factor out a `friend MDNode` by moving creation
logic to the concrete subclass.

llvm-svn: 225690

9 years agoIR: Make MDNodeFwdDecl destructor public
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:19:54 +0000 (20:19 +0000)]
IR: Make MDNodeFwdDecl destructor public

Now that the leak detector is gone, anyone can call this.

llvm-svn: 225689

9 years ago[Msan] Fix use of mmap(MAP_ANONYMOUS) in the unit tests on FreeBSD
Viktor Kutuzov [Mon, 12 Jan 2015 20:18:38 +0000 (20:18 +0000)]
[Msan] Fix use of mmap(MAP_ANONYMOUS) in the unit tests on FreeBSD
Differential Revision: http://reviews.llvm.org/D6929

llvm-svn: 225688

9 years ago[X86] Make SSE min/max testcases more explicit. NFC.
Ahmed Bougacha [Mon, 12 Jan 2015 20:15:47 +0000 (20:15 +0000)]
[X86] Make SSE min/max testcases more explicit. NFC.

llvm-svn: 225687

9 years ago[Msan] Fix tests reading /proc files on FreeBSD
Viktor Kutuzov [Mon, 12 Jan 2015 20:15:33 +0000 (20:15 +0000)]
[Msan] Fix tests reading /proc files on FreeBSD
Differential Revision: http://reviews.llvm.org/D6926

llvm-svn: 225686

9 years agoIR: Move creation logic down to MDTuple, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:13:56 +0000 (20:13 +0000)]
IR: Move creation logic down to MDTuple, NFC

Move creation logic for `MDTuple`s down where it belongs.  Once there
are a few more subclasses, these functions really won't make much sense
here (the `friend` relationship was already awkward).  For now, leave
the `MDNode` versions around, but have it forward down.

llvm-svn: 225685

9 years agoreverting due to build bot failure
Nathan Sidwell [Mon, 12 Jan 2015 20:13:20 +0000 (20:13 +0000)]
reverting due to build bot failure

llvm-svn: 225684

9 years agoIR: Push storeDistinctInContext() down to UniquableMDNode, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:11:32 +0000 (20:11 +0000)]
IR: Push storeDistinctInContext() down to UniquableMDNode, NFC

llvm-svn: 225683

9 years agoIR: Split GenericMDNode into MDTuple and UniquableMDNode
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:09:34 +0000 (20:09 +0000)]
IR: Split GenericMDNode into MDTuple and UniquableMDNode

Split `GenericMDNode` into two classes (with more descriptive names).

  - `UniquableMDNode` will be a common subclass for `MDNode`s that are
    sometimes uniqued like constants, and sometimes 'distinct'.

    This class gets the (short-lived) RAUW support and related API.

  - `MDTuple` is the basic tuple that has always been returned by
    `MDNode::get()`.  This is as opposed to more specific nodes to be
    added soon, which have additional fields, custom assembly syntax,
    and extra semantics.

    This class gets the hash-related logic, since other sublcasses of
    `UniquableMDNode` may need to hash based on other fields.

To keep this diff from getting too big, I've added casts to `MDTuple`
that won't really scale as new subclasses of `UniquableMDNode` are
added, but I'll clean those up incrementally.

(No functionality change intended.)

llvm-svn: 225682

9 years ago[LIT] Decode string result in lit.util.capture
Eric Fiselier [Mon, 12 Jan 2015 20:09:34 +0000 (20:09 +0000)]
[LIT] Decode string result in lit.util.capture

Summary: I think this is probably a bug, but I'm putting this up for review just to be sure. I think that `lit.util.capture` should decode the resulting string in the same way `lit.util.executeCommand` does.

Reviewers: ddunbar, EricWF

Reviewed By: EricWF

Subscribers: llvm-commits

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

llvm-svn: 225681

9 years agoIR: Invert logic to simplify control flow, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:45:44 +0000 (19:45 +0000)]
IR: Invert logic to simplify control flow, NFC

llvm-svn: 225670

9 years agoIR: Separate out decrementUnresolvedOperandCount(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:43:15 +0000 (19:43 +0000)]
IR: Separate out decrementUnresolvedOperandCount(), NFC

llvm-svn: 225667

9 years agoFix typo Block.h vs Blocks.h
Ben Langmuir [Mon, 12 Jan 2015 19:42:27 +0000 (19:42 +0000)]
Fix typo Block.h vs Blocks.h

Thanks for Jeremy for noticing!

llvm-svn: 225666

9 years agoIR: Prevent handleChangedOperand() recursion
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:36:35 +0000 (19:36 +0000)]
IR: Prevent handleChangedOperand() recursion

Instead of returning early on `handleChangedOperand()` recursion
(finally identified (and test added) in r225657), prevent it upfront by
releasing operands before RAUW.

Aside from massively different program flow, there should be no
functionality change ;).

llvm-svn: 225665

9 years ago[PowerPC]To provide better compatibility with gcc I added the __bool keyword to the...
Bill Seurer [Mon, 12 Jan 2015 19:35:51 +0000 (19:35 +0000)]
[PowerPC]To provide better compatibility with gcc I added the __bool keyword to the Alitivec support in clang. __bool is functionally identical to using bool when declaring vector types. For example:

vector bool char v_bc;
vector __bool char v___bc;

clang already supported vector/__vector and pixel/__pixel but was missing __bool.

http://llvm.org/bugs/show_bug.cgi?id=19220

For reference: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/PowerPC-AltiVec_002fVSX-Built-in-Functions.html

http://reviews.llvm.org/D6882

llvm-svn: 225664

9 years agoR600/SI: Use RegisterOperands to specify which operands can accept immediates
Tom Stellard [Mon, 12 Jan 2015 19:33:18 +0000 (19:33 +0000)]
R600/SI: Use RegisterOperands to specify which operands can accept immediates

There are some operands which can take either immediates or registers
and we were previously using different register class to distinguish
between operands that could take immediates and those that could not.

This patch switches to using RegisterOperands which should simplify the
backend by reducing the number of register classes and also make it
easier to implement the assembler.

llvm-svn: 225662

9 years agoTarget: Allow target specific operand types
Tom Stellard [Mon, 12 Jan 2015 19:33:09 +0000 (19:33 +0000)]
Target: Allow target specific operand types

This adds two new fields to the RegisterOperand TableGen class:

string OperandNamespace = "MCOI";
string OperandType = "OPERAND_REGISTER";

These fields can be used to specify a target specific operand type,
which will be stored in the OperandType member of the MCOperandInfo
object.

This can be useful for targets that need to store some extra information
about operands that cannot be expressed using the target independent
types.  For example, in the R600 backend, there are operands which
can take either registers or immediates and it is convenient to be able
to specify this in the TableGen definitions.

llvm-svn: 225661

9 years agoGVN: propagate equalities for floating point compares
Sanjay Patel [Mon, 12 Jan 2015 19:29:48 +0000 (19:29 +0000)]
GVN: propagate equalities for floating point compares

Allow optimizations based on FP comparison values in the same way
as integers.

This resolves PR17713:
http://llvm.org/bugs/show_bug.cgi?id=17713

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

llvm-svn: 225660

9 years agoFix bogus 'method is unavailable' errors with modules
Ben Langmuir [Mon, 12 Jan 2015 19:27:00 +0000 (19:27 +0000)]
Fix bogus 'method is unavailable' errors with modules

This just tweaks the fix from r224892 (which handled PCHs) to work with
modules, where we will serialize each method individually and hence the
hasMoreThanOneDecl bit needs to be updated as we add the methods.

llvm-svn: 225659

9 years agoIR: Add test for handleChangedOperand() recursion
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:22:04 +0000 (19:22 +0000)]
IR: Add test for handleChangedOperand() recursion

Turns out this can happen.  Remove the `FIXME` and add a testcase that
crashes without the extra logic.

llvm-svn: 225657

9 years agoIR: Separate out recalculateHash(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:16:34 +0000 (19:16 +0000)]
IR: Separate out recalculateHash(), NFC

llvm-svn: 225655

9 years agoIR: Separate out helper: resolveAfterOperandChange(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:14:15 +0000 (19:14 +0000)]
IR: Separate out helper: resolveAfterOperandChange(), NFC

llvm-svn: 225654

9 years agoIR: Use SubclassData32 directly, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:12:37 +0000 (19:12 +0000)]
IR: Use SubclassData32 directly, NFC

Simplify some logic by accessing `SubclassData32` directly instead of
relying on API.

llvm-svn: 225653

9 years agoRegisterCoalescer: Turn some impossible conditions into asserts
Matthias Braun [Mon, 12 Jan 2015 19:10:17 +0000 (19:10 +0000)]
RegisterCoalescer: Turn some impossible conditions into asserts

This is a fixed version of reverted r225500. It fixes the too early
if() continue; of the last patch and adds a comment to the unorthodox
loop.

llvm-svn: 225652

9 years agoMore [-Werror,-Winconsistent-missing-override] fixes.
Eric Christopher [Mon, 12 Jan 2015 19:09:48 +0000 (19:09 +0000)]
More [-Werror,-Winconsistent-missing-override] fixes.

llvm-svn: 225651

9 years agoIR: Don't allow operands to become unresolved
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 18:59:40 +0000 (18:59 +0000)]
IR: Don't allow operands to become unresolved

Operands shouldn't change from being resolved to unresolved during graph
construction.  Simplify the logic based on that assumption.

llvm-svn: 225649