platform/upstream/llvm.git
9 years ago[mach-o] Support linker synthesized mach_header symbols.
Nick Kledzik [Wed, 12 Nov 2014 22:21:56 +0000 (22:21 +0000)]
[mach-o] Support linker synthesized mach_header symbols.

On darwin in final linked images, the __TEXT segment covers that start of the
file.  That means in memory a process can see the mach_header (and load commands)
for every loaded image in a process.  There are APIs that take and return the
mach_header addresses as a way to specify a particular loaded image.

For completeness, any code can get the address of the mach_header of the image
it is in by using &__dso_handle.  In addition there are mach-o type specific
symbols like __mh_execute_header.

The linker needs to supply a definition for any of these symbols if used.  But
the address the symbol it resolves to is not in any section.  Instead it is the
address of the start of the __TEXT segment.

I needed to make a small change to SimpleFileNode to not override
resetNextIndex() because the Driver creates a SimpleFileNode to hold the
internal/implicit files that the context/writer can create. For some reason
SimpleFileNode overrode resetNextIndex() to do nothing instead of reseting
the index (which mach-o needs if the internal file is an archive).

llvm-svn: 221822

9 years agoFix fallout from r219557
Anton Korobeynikov [Wed, 12 Nov 2014 22:19:06 +0000 (22:19 +0000)]
Fix fallout from r219557

Summary:
Consider the following nifty 1 liner: (0 ? csqrtl(2.0f) : sqrtl(2.0f)). One can easily obtain such code from e.g. tgmath. Right now it produces an assertion because we fail to do the promotion real => _Complex real.

The case was properly handled previously (old handleOtherComplexFloatConversion routine), but was forgotten in the current version. This seems to be about fallout from r219557

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221821

9 years ago[CodeGenPrepare][AArch64] Fix a TLI legality check on iPTR to use a lowered instead.
Ahmed Bougacha [Wed, 12 Nov 2014 22:16:55 +0000 (22:16 +0000)]
[CodeGenPrepare][AArch64] Fix a TLI legality check on iPTR to use a lowered instead.

Fixes PR21548.  Related to PR20474.

llvm-svn: 221820

9 years agoExpose the number of Newton-Raphson iterations applied to the hardware's reciprocal...
Sanjay Patel [Wed, 12 Nov 2014 21:39:01 +0000 (21:39 +0000)]
Expose the number of Newton-Raphson iterations applied to the hardware's reciprocal estimate as a parameter (x86).

This is a follow-on to r221706 and r221731 and discussed in more detail in PR21385.

This patch also loosens the testcase checking for btver2. We know that the "1.0" will be loaded, but
we can't tell exactly when, so replace the CHECK-NEXT specifiers with plain CHECKs. The CHECK-NEXT
sequence relied on a quirk of post-RA-scheduling that may change independently of anything in these tests.

llvm-svn: 221819

9 years agoFix brace init of unions with unnamed struct members
Reid Kleckner [Wed, 12 Nov 2014 21:30:23 +0000 (21:30 +0000)]
Fix brace init of unions with unnamed struct members

The check for unnamed members was intended to skip unnamed bitfields,
but it ended up skipping unnamed structs. This lead to an assertion in
IRGen.

llvm-svn: 221818

9 years agoAdd fortified (__*_chk) library functions to TLI (NFC)
Ahmed Bougacha [Wed, 12 Nov 2014 21:23:34 +0000 (21:23 +0000)]
Add fortified (__*_chk) library functions to TLI (NFC)

One of them (__memcpy_chk) was already there, the others were checked
by comparing function names.
Note that the fortified libfuncs are now part of TLI, but are always
available, because they aren't generated, only optimized into the
non-checking versions.

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

llvm-svn: 221817

9 years agoUpdate Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,
Richard Smith [Wed, 12 Nov 2014 21:16:38 +0000 (21:16 +0000)]
Update Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,
which we don't yet implement).

llvm-svn: 221816

9 years agoAdd decorator for failing null dereference test on FreeBSD
Ed Maste [Wed, 12 Nov 2014 20:53:04 +0000 (20:53 +0000)]
Add decorator for failing null dereference test on FreeBSD

llvm.org/pr21550

llvm-svn: 221815

9 years agoAdd a test for PR21528 to make sure ASan C++ symbolization doesn't regress
Timur Iskhodzhanov [Wed, 12 Nov 2014 20:37:57 +0000 (20:37 +0000)]
Add a test for PR21528 to make sure ASan C++ symbolization doesn't regress

llvm-svn: 221814

9 years agoTemporary fix for PR21528 - use mangled C++ function names in COFF debug info to...
Timur Iskhodzhanov [Wed, 12 Nov 2014 20:21:20 +0000 (20:21 +0000)]
Temporary fix for PR21528 - use mangled C++ function names in COFF debug info to un-break ASan on Windows

llvm-svn: 221813

9 years ago[COFF] Make it clearer that the symbols subsection holds function display name rather...
Timur Iskhodzhanov [Wed, 12 Nov 2014 20:10:09 +0000 (20:10 +0000)]
[COFF] Make it clearer that the symbols subsection holds function display name rather than just name

llvm-svn: 221812

9 years ago[AVX512] Add integer shift by immediate intrinsics.
Cameron McInally [Wed, 12 Nov 2014 19:58:54 +0000 (19:58 +0000)]
[AVX512] Add integer shift by immediate intrinsics.

llvm-svn: 221811

9 years agoUse PRIx64 when printing addr_t's. Don't need to force full-width 0 padding
Jason Molenda [Wed, 12 Nov 2014 19:51:43 +0000 (19:51 +0000)]
Use PRIx64 when printing addr_t's.  Don't need to force full-width 0 padding
with addresses that aren't designed to be column-aligned across multiple lines.

llvm-svn: 221810

9 years agoUpdate comments to reflect how the new methods ended up being written.
Jason Molenda [Wed, 12 Nov 2014 19:49:58 +0000 (19:49 +0000)]
Update comments to reflect how the new methods ended up being written.

llvm-svn: 221809

9 years agoChanging a StringRef::begin() call into StringRef::data(); NFC.
Aaron Ballman [Wed, 12 Nov 2014 19:43:13 +0000 (19:43 +0000)]
Changing a StringRef::begin() call into StringRef::data(); NFC.

llvm-svn: 221808

9 years ago[ProcessWindows] Improve support for launching processes.
Zachary Turner [Wed, 12 Nov 2014 19:31:56 +0000 (19:31 +0000)]
[ProcessWindows] Improve support for launching processes.

This sends notifications for module load / unload to the process
plugin, and also manages the state more accurately during the
loading sequence.

Similar work by Virgile Bello was referenced during the
implementation of this patch.

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

llvm-svn: 221807

9 years ago[ProcessWindows] Simplify the DebugDelegate interface.
Zachary Turner [Wed, 12 Nov 2014 19:31:39 +0000 (19:31 +0000)]
[ProcessWindows] Simplify the DebugDelegate interface.

Due to a previous multi-threaded design involving message
passing, we used message classes to pass event information
to the delegate.  Since the multi-threaded design has gone
away, we simplify this by passing event arguments as direct
function parameters, which is more clear and easier to
understand.

llvm-svn: 221806

9 years agoAvoid crash in InitializeNonZerothFrame if no module found
Ed Maste [Wed, 12 Nov 2014 18:49:54 +0000 (18:49 +0000)]
Avoid crash in InitializeNonZerothFrame if no module found

After r221575 TestCallStopAndContinue and TestCallThatRestarts started
crashing on FreeBSD with a null temporary_module_sp in
RegisterContextLLDB::InitializeNonZerothFrame().

llvm-svn: 221805

9 years agoUse the return of readBytes to find out if we are at the end of the stream.
Rafael Espindola [Wed, 12 Nov 2014 18:37:00 +0000 (18:37 +0000)]
Use the return of readBytes to find out if we are at the end of the stream.

This allows the removal of isObjectEnd and opens the way for reading 64 bits
at a time.

llvm-svn: 221804

9 years agoPass the filter function_ref by value now that r221753 fixes the bug
Kaelyn Takata [Wed, 12 Nov 2014 18:34:08 +0000 (18:34 +0000)]
Pass the filter function_ref by value now that r221753 fixes the bug
that was preventing pass-by-value from working correctly.

llvm-svn: 221803

9 years agoCGSCC should not treat intrinsic calls like function calls (PR21403)
Sanjay Patel [Wed, 12 Nov 2014 18:25:47 +0000 (18:25 +0000)]
CGSCC should not treat intrinsic calls like function calls (PR21403)

Make the handling of calls to intrinsics in CGSCC consistent:
they are not treated like regular function calls because they
are never lowered to function calls.

Without this patch, we can get dangling pointer asserts from
the subsequent loop that processes callsites because it already
ignores intrinsics.

See http://llvm.org/bugs/show_bug.cgi?id=21403 for more details / discussion.

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

llvm-svn: 221802

9 years agoFix broken doxygen annotations, NFC
Jingyue Wu [Wed, 12 Nov 2014 18:25:06 +0000 (18:25 +0000)]
Fix broken doxygen annotations, NFC

llvm-svn: 221801

9 years ago[asan] [mips] added support of asan for mips64/mips64el, patch by Kumar Sukhani
Kostya Serebryany [Wed, 12 Nov 2014 18:23:16 +0000 (18:23 +0000)]
[asan] [mips] added support of asan for mips64/mips64el, patch by Kumar Sukhani

llvm-svn: 221800

9 years agoDisable indvar widening if arithmetics on the wider type are more expensive
Jingyue Wu [Wed, 12 Nov 2014 18:09:15 +0000 (18:09 +0000)]
Disable indvar widening if arithmetics on the wider type are more expensive

Summary:
Reapply r221772. The old patch breaks the bot because the @indvar_32_bit test
was run whether NVPTX was enabled or not.

IndVarSimplify should not widen an indvar if arithmetics on the wider
indvar are more expensive than those on the narrower indvar. For
instance, although NVPTX64 treats i64 as a legal type, an ADD on i64 is
twice as expensive as that on i32, because the hardware needs to
simulate a 64-bit integer using two 32-bit integers.

Split from D6188, and based on D6195 which adds NVPTXTargetTransformInfo.

Fixes PR21148.

Test Plan:
Added @indvar_32_bit that verifies we do not widen an indvar if the arithmetics
on the wider type are more expensive. This test is run only when NVPTX is
enabled.

Reviewers: jholewinski, eliben, meheff, atrick

Reviewed By: atrick

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 221799

9 years agoremove function names from comments; NFC
Sanjay Patel [Wed, 12 Nov 2014 18:07:42 +0000 (18:07 +0000)]
remove function names from comments; NFC

llvm-svn: 221798

9 years agoFix the iOS build after recent inherited OTHER_LDFLAGS.
Greg Clayton [Wed, 12 Nov 2014 18:05:32 +0000 (18:05 +0000)]
Fix the iOS build after recent inherited OTHER_LDFLAGS.

llvm-svn: 221797

9 years agoCheck for IRGen output when varag is used
Fariborz Jahanian [Wed, 12 Nov 2014 17:54:11 +0000 (17:54 +0000)]
Check for IRGen output when varag is used
in -funknown-anytype  mode (in lldb use).

llvm-svn: 221796

9 years agoReturn the number of read bytes in MemoryObject::readBytes.
Rafael Espindola [Wed, 12 Nov 2014 17:11:16 +0000 (17:11 +0000)]
Return the number of read bytes in MemoryObject::readBytes.

Returning more information will allow BitstreamReader to be simplified a bit
and changed to read 64 bits at a time.

llvm-svn: 221794

9 years agoRevert part of the PIC tests (TLS part)
Justin Hibbits [Wed, 12 Nov 2014 16:50:15 +0000 (16:50 +0000)]
Revert part of the PIC tests (TLS part)

This change actually wasn't warranted for -O0, and the new changes prove it and
break the build.

llvm-svn: 221793

9 years agoFix thet tests.
Justin Hibbits [Wed, 12 Nov 2014 16:40:00 +0000 (16:40 +0000)]
Fix thet tests.

I seem to have missed the update I made for changing 'flag_pic' to "PIC Level".
Mea culpa.

llvm-svn: 221792

9 years agoAdd support for small-model PIC for PowerPC.
Justin Hibbits [Wed, 12 Nov 2014 15:16:30 +0000 (15:16 +0000)]
Add support for small-model PIC for PowerPC.

Summary:
Large-model was added first.  With the addition of support for multiple PIC
models in LLVM, now add small-model PIC for 32-bit PowerPC, SysV4 ABI.  This
generates more optimal code, for shared libraries with less than about 16380
data objects.

Test Plan: Test cases added or updated

Reviewers: joerg, hfinkel

Reviewed By: hfinkel

Subscribers: jholewinski, mcrosier, emaste, llvm-commits

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

llvm-svn: 221791

9 years agoFIx a bug with PC-register handling in a RA register.
Justin Hibbits [Wed, 12 Nov 2014 15:14:12 +0000 (15:14 +0000)]
FIx a bug with PC-register handling in a RA register.

The addition of RegisterNumber introduced a bug where if the PC is stored in a
return address register, such as on ARM and PowerPC, this register number is
retrieved and used, but never checked in the row if it's saved.  Correct this by
setting the variable that's used to the new register number.

Patch by Jason Molenda.

llvm-svn: 221790

9 years agoImprove PowerPC unwind support
Justin Hibbits [Wed, 12 Nov 2014 15:14:08 +0000 (15:14 +0000)]
Improve PowerPC unwind support

Summary:
Taking advantage of the new 'CFAIsRegisterDereferenced' CFA register type, add
full stack unwind support to the PowerPC/PowerPC64 ABI.  Also, add a new
register set for powerpc32-on-64, so the register sizes are correct.  This also
requires modifying the ProcessMonitor to add support for non-uintptr_t-sized
register values.

Reviewers: jasonmolenda, emaste

Subscribers: emaste, lldb-commits

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

llvm-svn: 221789

9 years agoAdd an alternative CFA type.
Justin Hibbits [Wed, 12 Nov 2014 15:14:03 +0000 (15:14 +0000)]
Add an alternative CFA type.

Summary:
PowerPC handles the stack chain with the current stack pointer being a pointer
to the backchain (CFA).  LLDB currently has no way of handling this, so this
adds a "CFA is dereferenced from a register" type.

Discussed with Jason Molenda, who also provided the initial patch for this.

Reviewers: jasonmolenda

Reviewed By: jasonmolenda

Subscribers: emaste, lldb-commits

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

llvm-svn: 221788

9 years agoAdd powerpc support for the test suite.
Justin Hibbits [Wed, 12 Nov 2014 15:13:58 +0000 (15:13 +0000)]
Add powerpc support for the test suite.

Reviewed by Ed Maste at MeetBSD.

llvm-svn: 221787

9 years agoUpdate for llvm api change.
Rafael Espindola [Wed, 12 Nov 2014 14:48:44 +0000 (14:48 +0000)]
Update for llvm api change.

llvm-svn: 221786

9 years agoReduce code duplication a bit. NFC.
Rafael Espindola [Wed, 12 Nov 2014 14:48:38 +0000 (14:48 +0000)]
Reduce code duplication a bit. NFC.

llvm-svn: 221785

9 years agoSimplify code a bit by passing StreamFile to the BitstreamCursor constructor.
Rafael Espindola [Wed, 12 Nov 2014 14:42:25 +0000 (14:42 +0000)]
Simplify code a bit by passing StreamFile to the BitstreamCursor constructor.

llvm-svn: 221784

9 years agoFix the test.
Rafael Espindola [Wed, 12 Nov 2014 14:23:04 +0000 (14:23 +0000)]
Fix the test.

It was broken since r221708.

llvm-svn: 221783

9 years agoFixing more -Wcast-qual warnings; NFC.
Aaron Ballman [Wed, 12 Nov 2014 14:01:17 +0000 (14:01 +0000)]
Fixing more -Wcast-qual warnings; NFC.

llvm-svn: 221782

9 years agoFixing a -Wcast-qual warning; NFC.
Aaron Ballman [Wed, 12 Nov 2014 13:55:27 +0000 (13:55 +0000)]
Fixing a -Wcast-qual warning; NFC.

llvm-svn: 221781

9 years ago[mips][micromips] Add predicate 'InMicroMips' at CodeGen patterns for microMIPS instr...
Zoran Jovanovic [Wed, 12 Nov 2014 13:30:10 +0000 (13:30 +0000)]
[mips][micromips] Add predicate 'InMicroMips' at CodeGen patterns for microMIPS instructions
Differential Revision: http://reviews.llvm.org/D6198

llvm-svn: 221780

9 years ago[x86] Start improving the matching of unpck instructions based on test
Chandler Carruth [Wed, 12 Nov 2014 10:05:18 +0000 (10:05 +0000)]
[x86] Start improving the matching of unpck instructions based on test
cases from Halide folks. This initial step was extracted from
a prototype change by Clay Wood to try and address regressions found
with Halide and the new vector shuffle lowering.

llvm-svn: 221779

9 years ago[ASan] Skip dump_instruction_bytes test on non-x86 targets
Jay Foad [Wed, 12 Nov 2014 09:45:40 +0000 (09:45 +0000)]
[ASan] Skip dump_instruction_bytes test on non-x86 targets

Summary: This test case is blatantly x86-specific, so skip it on other targets.

Reviewers: kcc, eugenis, earthdok, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 221778

9 years ago[ASan] Skip ptrace test on non-x86 targets
Jay Foad [Wed, 12 Nov 2014 09:42:01 +0000 (09:42 +0000)]
[ASan] Skip ptrace test on non-x86 targets

Summary:
Address sanitization of ptrace(2) is only implemented for x86, so skip
the test on other targets.

Reviewers: kcc, eugenis, earthdok, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 221777

9 years ago[x86] Clean up a bunch of vector shuffle tests with my script. Notably,
Chandler Carruth [Wed, 12 Nov 2014 09:17:15 +0000 (09:17 +0000)]
[x86] Clean up a bunch of vector shuffle tests with my script. Notably,
removes windows line endings and other noise. This is in prelude to
making substantive changes to these tests.

llvm-svn: 221776

9 years agoMCDisassembler::getInstruction():: Prune also "\param Region", since it was removed...
NAKAMURA Takumi [Wed, 12 Nov 2014 07:42:26 +0000 (07:42 +0000)]
MCDisassembler::getInstruction():: Prune also "\param Region", since it was removed in r221751. [-Wdocumentation]

llvm-svn: 221775

9 years agoAVX-512: Intrinsics for ERI
Elena Demikhovsky [Wed, 12 Nov 2014 07:31:03 +0000 (07:31 +0000)]
AVX-512: Intrinsics for ERI
3 instructions: vrcp28, vrsqrt28, vexp2, only vector forms.
Intrinsics include SAE (Suppres All Exceptions) parameter.

http://reviews.llvm.org/D6214

llvm-svn: 221774

9 years agoReverts r221772 which fails tests
Jingyue Wu [Wed, 12 Nov 2014 07:19:25 +0000 (07:19 +0000)]
Reverts r221772 which fails tests

llvm-svn: 221773

9 years agoDisable indvar widening if arithmetics on the wider type are more expensive
Jingyue Wu [Wed, 12 Nov 2014 06:58:45 +0000 (06:58 +0000)]
Disable indvar widening if arithmetics on the wider type are more expensive

Summary:
IndVarSimplify should not widen an indvar if arithmetics on the wider
indvar are more expensive than those on the narrower indvar. For
instance, although NVPTX64 treats i64 as a legal type, an ADD on i64 is
twice as expensive as that on i32, because the hardware needs to
simulate a 64-bit integer using two 32-bit integers.

Split from D6188, and based on D6195 which adds NVPTXTargetTransformInfo.

Fixes PR21148.

Test Plan:
Added @indvar_32_bit that verifies we do not widen an indvar if the arithmetics
on the wider type are more expensive.

Reviewers: jholewinski, eliben, meheff, atrick

Reviewed By: atrick

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 221772

9 years agoMark TypeDecls used in explicit destructor calls as referenced.
Nico Weber [Wed, 12 Nov 2014 04:33:52 +0000 (04:33 +0000)]
Mark TypeDecls used in explicit destructor calls as referenced.

Fixes PR21221. Patch by Axel Naumann, test by me.

llvm-svn: 221771

9 years agoDelete dead code. NFC.
Rafael Espindola [Wed, 12 Nov 2014 04:31:19 +0000 (04:31 +0000)]
Delete dead code. NFC.

llvm-svn: 221770

9 years agodelete => delete[] for arrays.
Richard Trieu [Wed, 12 Nov 2014 04:19:57 +0000 (04:19 +0000)]
delete => delete[] for arrays.

llvm-svn: 221769

9 years ago[PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics
Bill Schmidt [Wed, 12 Nov 2014 04:19:56 +0000 (04:19 +0000)]
[PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics

This patch enables the vec_vsx_ld and vec_vsx_st intrinsics for
PowerPC, which provide programmer access to the lxvd2x, lxvw4x,
stxvd2x, and stxvw4x instructions.

New code in altivec.h defines these in terms of new builtins, which
are themselves defined in BuiltinsPPC.def.  The builtins are converted
to LLVM intrinsics in CGBuiltin.cpp.  Additional code is added to
builtins-ppc-vsx.c to verify the correct generation of the intrinsics.

Note that I moved the other VSX builtins so all VSX builtins will be
alphabetical in their own section in BuiltinsPPC.def.

There is a companion patch for LLVM.

llvm-svn: 221768

9 years ago[PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics
Bill Schmidt [Wed, 12 Nov 2014 04:19:40 +0000 (04:19 +0000)]
[PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics

This patch enables the vec_vsx_ld and vec_vsx_st intrinsics for
PowerPC, which provide programmer access to the lxvd2x, lxvw4x,
stxvd2x, and stxvw4x instructions.

New LLVM intrinsics are provided to represent these four instructions
in IntrinsicsPowerPC.td.  These are patterned after the similar
intrinsics for lvx and stvx (Altivec).  In PPCInstrVSX.td, these
intrinsics are tied to the code gen patterns, with additional patterns
to allow plain vanilla loads and stores to still generate these
instructions.

At -O1 and higher the intrinsics are immediately converted to loads
and stores in InstCombineCalls.cpp.  This will open up more
optimization opportunities while still allowing the correct
instructions to be generated.  (Similar code exists for aligned
Altivec loads and stores.)

The new intrinsics are added to the code that checks for consecutive
loads and stores in PPCISelLowering.cpp, as well as to
PPCTargetLowering::getTgtMemIntrinsic().

There's a new test to verify the correct instructions are generated.
The loads and stores tend to be reordered, so the test just counts
their number.  It runs at -O2, as it's not very effective to test this
at -O0, when many unnecessary loads and stores are generated.

I ended up having to modify vsx-fma-m.ll.  It turns out this test case
is slightly unreliable, but I don't know a good way to prevent
problems with it.  The xvmaddmdp instructions read and write the same
register, which is one of the multiplicands.  Commutativity allows
either to be chosen.  If the FMAs are reordered differently than
expected by the test, the register assignment can be different as a
result.  Hopefully this doesn't change often.

There is a companion patch for Clang.

llvm-svn: 221767

9 years agoMerge StreamableMemoryObject into MemoryObject.
Rafael Espindola [Wed, 12 Nov 2014 03:55:46 +0000 (03:55 +0000)]
Merge StreamableMemoryObject into MemoryObject.

Every MemoryObject is a StreamableMemoryObject since the removal of
StringRefMemoryObject, so just merge the two.

I will clean up the MemoryObject interface in the upcoming commits.

llvm-svn: 221766

9 years agoMark TypeDecls used in member initializers as referenced.
Nico Weber [Wed, 12 Nov 2014 03:52:25 +0000 (03:52 +0000)]
Mark TypeDecls used in member initializers as referenced.

Without this, -Wunused-local-typedef would incorrectly warn on the two typedefs
in this program:

void foo() {
  struct A {};
  struct B : public A {
    typedef A INHERITED;
    B() : INHERITED() {}

    typedef B SELF;
    B(int) : SELF() {}
  };
}

llvm-svn: 221765

9 years agoclang-format a few lines, fixes one 80col violation. nfc.
Nico Weber [Wed, 12 Nov 2014 03:44:43 +0000 (03:44 +0000)]
clang-format a few lines, fixes one 80col violation. nfc.

llvm-svn: 221764

9 years agoFix non-variadic function_ref cases to match r221753
David Blaikie [Wed, 12 Nov 2014 03:28:57 +0000 (03:28 +0000)]
Fix non-variadic function_ref cases to match r221753

llvm-svn: 221763

9 years agoDon't duplicate name in comments. NFC.
Rafael Espindola [Wed, 12 Nov 2014 03:25:45 +0000 (03:25 +0000)]
Don't duplicate name in comments. NFC.

llvm-svn: 221762

9 years agoRevert "Use a function_ref now that it works (r221753)."
Rafael Espindola [Wed, 12 Nov 2014 03:17:33 +0000 (03:17 +0000)]
Revert "Use a function_ref now that it works (r221753)."

This reverts commit r221756.

David Blaikie pointed out it was unsafe.

llvm-svn: 221761

9 years agoEnable armv7 core file writing for Mach-O binaries.
Jason Molenda [Wed, 12 Nov 2014 02:39:14 +0000 (02:39 +0000)]
Enable armv7 core file writing for Mach-O binaries.
The problems with the dyld all image infos struct
seems to be specific to arm64.

llvm-svn: 221760

9 years agoRemove unused method. NFC.
Rafael Espindola [Wed, 12 Nov 2014 02:35:31 +0000 (02:35 +0000)]
Remove unused method. NFC.

llvm-svn: 221759

9 years agoMake readBytes pure virtual. Every real implementation has it.
Rafael Espindola [Wed, 12 Nov 2014 02:30:38 +0000 (02:30 +0000)]
Make readBytes pure virtual. Every real implementation has it.

llvm-svn: 221758

9 years agoRemove unused method. NFC.
Rafael Espindola [Wed, 12 Nov 2014 02:27:40 +0000 (02:27 +0000)]
Remove unused method. NFC.

llvm-svn: 221757

9 years agoUse a function_ref now that it works (r221753).
Rafael Espindola [Wed, 12 Nov 2014 02:23:37 +0000 (02:23 +0000)]
Use a function_ref now that it works (r221753).

llvm-svn: 221756

9 years agoRemove the now unused StringRefMemoryObject.h.
Rafael Espindola [Wed, 12 Nov 2014 02:13:27 +0000 (02:13 +0000)]
Remove the now unused StringRefMemoryObject.h.

llvm-svn: 221755

9 years agoTry a different workaround for GCC 4.7.2 lambda capture bug. The previous
Richard Smith [Wed, 12 Nov 2014 02:09:03 +0000 (02:09 +0000)]
Try a different workaround for GCC 4.7.2 lambda capture bug. The previous
workaround took us from wrong-code to ICE.

llvm-svn: 221754

9 years agoEnsure function_refs are copyable even from non-const references
David Blaikie [Wed, 12 Nov 2014 02:06:08 +0000 (02:06 +0000)]
Ensure function_refs are copyable even from non-const references

A subtle bug was found where attempting to copy a non-const function_ref
lvalue would actually invoke the generic forwarding constructor (as it
was a closer match - being T& rather than the const T& of the implicit
copy constructor). In the particular case this lead to a dangling
function_ref member (since it had referenced the function_ref passed by
value to its ctor, rather than the outer function_ref that was still
alive)

SFINAE the converting constructor to not be considered if the copy
constructor is available and demonstrate that this causes the copy to
refer to the original functor, not to the function_ref it was copied
from. (without the code change, the test would fail as Y would be
referencing X and Y() would see the result of the mutation to X, ie: 2)

llvm-svn: 221753

9 years agoUpdate for llvm API change.
Rafael Espindola [Wed, 12 Nov 2014 02:04:31 +0000 (02:04 +0000)]
Update for llvm API change.

llvm-svn: 221752

9 years agoPass an ArrayRef to MCDisassembler::getInstruction.
Rafael Espindola [Wed, 12 Nov 2014 02:04:27 +0000 (02:04 +0000)]
Pass an ArrayRef to MCDisassembler::getInstruction.

With this patch MCDisassembler::getInstruction takes an ArrayRef<uint8_t>
instead of a MemoryObject.

Even on X86 there is a maximum size an instruction can have. Given
that, it seems way simpler and more efficient to just pass an ArrayRef
to the disassembler instead of a MemoryObject and have it do a virtual
call every time it wants some extra bytes.

llvm-svn: 221751

9 years agoInstantiate exception specifications when instantiating function types (other
Richard Smith [Wed, 12 Nov 2014 02:00:47 +0000 (02:00 +0000)]
Instantiate exception specifications when instantiating function types (other
than the type of a function declaration). We previously didn't instantiate
these at all! This also covers the pathological case where the only mention of
a parameter pack is within the exception specification; this gives us a second
way (other than alias templates) to reach the horrible state where a type
contains an unexpanded pack, but its canonical type does not.

This is a re-commit of r219977:

r219977 was reverted in r220038 because it hit a wrong-code bug in GCC 4.7.2.
(That's gcc.gnu.org/PR56135, and affects any implicit lambda-capture of
'this' within a template.)

r219977 was a re-commit of r217995, r218011, and r218053:

r217995 was reverted in r218058 because it hit a rejects-valid bug in MSVC.
(Incorrect overload resolution in the presence of using-declarations.)
It was re-committed in r219977 with a workaround for the MSVC rejects-valid.

r218011 was a workaround for an MSVC parser bug. (Incorrect desugaring of
unbraced range-based for loop).

llvm-svn: 221750

9 years agoRevert "Update for LLVM API change in r221024"
Duncan P. N. Exon Smith [Wed, 12 Nov 2014 01:59:53 +0000 (01:59 +0000)]
Revert "Update for LLVM API change in r221024"

This reverts commit r221073 to match upstream revert in r221711.

llvm-svn: 221749

9 years agoPR21536: Fix a corner case where we'd get confused by a pack expanding into the
Richard Smith [Wed, 12 Nov 2014 01:43:45 +0000 (01:43 +0000)]
PR21536: Fix a corner case where we'd get confused by a pack expanding into the
penultimate parameter of a template parameter list, where the last parameter is
itself a pack, and build a bogus empty final pack argument.

llvm-svn: 221748

9 years agoObject, support both mach-o archive t.o.c file names
Nick Kledzik [Wed, 12 Nov 2014 01:37:45 +0000 (01:37 +0000)]
Object, support both mach-o archive t.o.c file names

For historical reasons archives on mach-o have two possible names for the
file containing the table of contents for the archive: "__.SYMDEF SORTED"
and "__.SYMDEF".  But the libObject archive reader only supported the former.

This patch fixes llvm::object::Archive to support both names.

llvm-svn: 221747

9 years agoRemove a bit of dead code.
Rafael Espindola [Wed, 12 Nov 2014 01:27:22 +0000 (01:27 +0000)]
Remove a bit of dead code.

Every "real" object file implements this an ptx doesn't use it.

llvm-svn: 221746

9 years agoFix this code to follow the coding style regarding anonymous namespaces and
Richard Smith [Wed, 12 Nov 2014 01:24:00 +0000 (01:24 +0000)]
Fix this code to follow the coding style regarding anonymous namespaces and
static functions. Make a bunch of file-local functions static. Remove one
unused static function revealed by this.

llvm-svn: 221745

9 years agoMake Sema::CollectMultipleMethodsInGlobalPool() public.
Douglas Gregor [Wed, 12 Nov 2014 01:12:47 +0000 (01:12 +0000)]
Make Sema::CollectMultipleMethodsInGlobalPool() public.

It's useful for out-of-tree clients to be able to query the global
Objective-C method pool, and only Sema can do that right now.

llvm-svn: 221744

9 years agoSketch out the armv7 and arm64 core file writing support in
Jason Molenda [Wed, 12 Nov 2014 01:11:36 +0000 (01:11 +0000)]
Sketch out the armv7 and arm64 core file writing support in
ObjectFileMachO.  It's close but we seem to be missing some
of the memory region segments - not exactly sure how that's
happening.  The register context writing into the LC_THREAD
load commands is working correctly though.

Slightly reordered the arm64 definitions in ArchSpec.cpp so
when we look for an arm64 core file definiton we're getting
a cpu subtype of CPU_ANY which we can't put in the mach
header of a core file.  Make the first definition we find by
linear search have the currently correct '1' cpu subtype.

llvm-svn: 221743

9 years agoExtend intrinsic name mangling to support arrays, named structs, and function types.
Philip Reames [Wed, 12 Nov 2014 00:21:51 +0000 (00:21 +0000)]
Extend intrinsic name mangling to support arrays, named structs, and function types.

Currently, we have a type parameter mechanism for intrinsics. Rather than having to specify a separate intrinsic for each combination of argument and return types, we can specify a single intrinsic with one or more type parameters. These type parameters are passed explicitly to Intrinsic::getDeclaration or can be specified implicitly in the naming of the intrinsic function in an LL file.

Today, the types are limited to integer, floating point, and pointer types. With a goal of supporting symbolic targets for patchpoints and statepoints, this change adds support for function types.  The change also includes support for first class aggregate types (named structures and arrays) since these appear in function types we've encountered.

Reviewed by: atrick, ributzka
Differential Revision: http://reviews.llvm.org/D4608

llvm-svn: 221742

9 years agoclang/test/CodeGenCXX/debug-info-cxx1y.cpp: Add %itanium_abi_triple for incompatible...
NAKAMURA Takumi [Tue, 11 Nov 2014 23:51:53 +0000 (23:51 +0000)]
clang/test/CodeGenCXX/debug-info-cxx1y.cpp: Add %itanium_abi_triple for incompatible MS targets.

llvm-svn: 221741

9 years agoMake TreePattern::error use Twine
Matt Arsenault [Tue, 11 Nov 2014 23:48:11 +0000 (23:48 +0000)]
Make TreePattern::error use Twine

The underlying error function already uses a Twine,
and most of the uses build up strings.

llvm-svn: 221740

9 years ago[clang/asan] Do not emit memcpy for trivial operator= when -fsanitize-address-field...
Kostya Serebryany [Tue, 11 Nov 2014 23:38:13 +0000 (23:38 +0000)]
[clang/asan] Do not emit memcpy for trivial operator= when -fsanitize-address-field-padding >= 1

Summary: If we've added poisoned paddings to a type do not emit memcpy for operator=.

Test Plan: regression tests.

Reviewers: majnemer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221739

9 years ago[Reassociate] Canonicalize negative constants out of expressions.
Chad Rosier [Tue, 11 Nov 2014 23:36:42 +0000 (23:36 +0000)]
[Reassociate] Canonicalize negative constants out of expressions.

Add support for FDiv, which was regressed by the previous commit.

llvm-svn: 221738

9 years agoCanonicalize an assume(load != null) into !nonnull metadata
Philip Reames [Tue, 11 Nov 2014 23:33:19 +0000 (23:33 +0000)]
Canonicalize an assume(load != null) into !nonnull metadata

We currently have two ways of informing the optimizer that the result of a load is never null: metadata and assume. This change converts the second in to the former. This avoids a need to implement optimizations using both forms.

We should probably extend this basic idea to metadata of other forms; in particular, range metadata. We view is that assumes should be considered a "last resort" for when there isn't a more canonical way to represent something.

Reviewed by: Hal
Differential Revision: http://reviews.llvm.org/D5951

llvm-svn: 221737

9 years agoHave LookupMemberExprInRecord only call CorrectTypoDelayed, dropping the
Kaelyn Takata [Tue, 11 Nov 2014 23:26:58 +0000 (23:26 +0000)]
Have LookupMemberExprInRecord only call CorrectTypoDelayed, dropping the
code for calling CorrectTypo.

Includes a needed fix for non-C++ code to not choke on TypoExprs (which
also resolves a TODO from r220698).

llvm-svn: 221736

9 years agoCreate two helpers for running the typo-correction tree transform.
Kaelyn Takata [Tue, 11 Nov 2014 23:26:56 +0000 (23:26 +0000)]
Create two helpers for running the typo-correction tree transform.

One takes an Expr* and the other is a simple wrapper that takes an
ExprResult instead, and handles checking whether the ExprResult is
invalid.

Additionally, allow an optional callback that is run on the full result
of the tree transform, for filtering potential corrections based on the
characteristics of the resulting expression once all of the typos have
been replaced.

llvm-svn: 221735

9 years agoReplace MemberTypoDiags and MemberExprTypoRecovery with lambdas.
Kaelyn Takata [Tue, 11 Nov 2014 23:26:54 +0000 (23:26 +0000)]
Replace MemberTypoDiags and MemberExprTypoRecovery with lambdas.

llvm-svn: 221734

9 years agolibLTO: Allow linker to choose context of modules and codegen
Duncan P. N. Exon Smith [Tue, 11 Nov 2014 23:19:23 +0000 (23:19 +0000)]
libLTO: Allow linker to choose context of modules and codegen

Add API for specifying which `LLVMContext` each `lto_module_t` and
`lto_code_gen_t` is in.

In particular, this enables the following flow:

    for (auto &File : Files) {
      lto_module_t M = lto_module_create_in_local_context(File...);
      querySymbols(M);
      lto_module_dispose(M);
    }

    lto_code_gen_t CG = lto_codegen_create_in_local_context();
    for (auto &File : FilesToLink) {
      lto_module_t M = lto_module_create_in_codegen_context(File..., CG);
      lto_codegen_add_module(CG, M);
      lto_module_dispose(M);
    }
    lto_codegen_compile(CG);
    lto_codegen_write_merged_modules(CG, ...);
    lto_codegen_dispose(CG);

This flow has a few benefits.

  - Only one module (two if you count the combined module in the code
    generator) is in memory at a time.

  - Metadata (and constants) from files that are parsed to query symbols
    but not linked into the code generator don't pollute the global
    context.

  - The first for loop can be parallelized, since each module is in its
    own context.

  - When the code generator is disposed, the memory from LTO gets freed.

rdar://problem/18767512

llvm-svn: 221733

9 years agoRemove unnecessary semicolon.
Kaelyn Takata [Tue, 11 Nov 2014 23:17:30 +0000 (23:17 +0000)]
Remove unnecessary semicolon.

llvm-svn: 221732

9 years agoInitialize new subtarget feature variable for generating reciprocal estimate instruct...
Sanjay Patel [Tue, 11 Nov 2014 23:13:15 +0000 (23:13 +0000)]
Initialize new subtarget feature variable for generating reciprocal estimate instructions.

This was missed in r221706.

llvm-svn: 221731

9 years agolibLTO: Assert if LTOCodeGenerator and LTOModule are from different contexts
Duncan P. N. Exon Smith [Tue, 11 Nov 2014 23:13:10 +0000 (23:13 +0000)]
libLTO: Assert if LTOCodeGenerator and LTOModule are from different contexts

llvm-svn: 221730

9 years ago[FastISel][AArch64] Add support for fabs intrinsic.
Juergen Ributzka [Tue, 11 Nov 2014 23:10:44 +0000 (23:10 +0000)]
[FastISel][AArch64] Add support for fabs intrinsic.

Lower the llvm.fabs intrinsic to the 'fabs' MI instruction.

This fixes rdar://problem/18946552.

llvm-svn: 221729

9 years agolibLTO: Allow LTOModule to own a context
Duncan P. N. Exon Smith [Tue, 11 Nov 2014 23:08:05 +0000 (23:08 +0000)]
libLTO: Allow LTOModule to own a context

llvm-svn: 221728

9 years agoclang-format: Improve handling of comments in binary expressions.
Daniel Jasper [Tue, 11 Nov 2014 23:04:51 +0000 (23:04 +0000)]
clang-format: Improve handling of comments in binary expressions.

Before:
  b = a &&
      // Comment
      b.c &&
      d;

After:
  b = a &&
      // Comment
      b.c && d;

This fixes llvm.org/PR21535.

llvm-svn: 221727

9 years agolibLTO: Allow LTOCodeGenerator to own a context
Duncan P. N. Exon Smith [Tue, 11 Nov 2014 23:03:29 +0000 (23:03 +0000)]
libLTO: Allow LTOCodeGenerator to own a context

llvm-svn: 221726

9 years ago[asan] adding ShadowOffset64 for mips64, patch by Kumar Sukhani
Kostya Serebryany [Tue, 11 Nov 2014 23:02:57 +0000 (23:02 +0000)]
[asan] adding ShadowOffset64 for mips64, patch by Kumar Sukhani

llvm-svn: 221725

9 years agoMake LookupResult be copyable to avoid decomposing an existing one and
Kaelyn Takata [Tue, 11 Nov 2014 23:00:42 +0000 (23:00 +0000)]
Make LookupResult be copyable to avoid decomposing an existing one and
initializing a new one every time a copy is needed.

llvm-svn: 221724

9 years agoExplicitly exclude keywords from the member validator.
Kaelyn Takata [Tue, 11 Nov 2014 23:00:40 +0000 (23:00 +0000)]
Explicitly exclude keywords from the member validator.

Also simply and remove dead code from MemberExprTypoRecovery.

llvm-svn: 221723

9 years agoFix some formatting prior to refactoring the code.
Kaelyn Takata [Tue, 11 Nov 2014 23:00:38 +0000 (23:00 +0000)]
Fix some formatting prior to refactoring the code.

llvm-svn: 221722