platform/upstream/llvm.git
9 years agoRemove unused function
David Blaikie [Sat, 1 Nov 2014 01:15:26 +0000 (01:15 +0000)]
Remove unused function

llvm-svn: 221037

9 years agoAnd... fix the build some more.
David Blaikie [Sat, 1 Nov 2014 01:15:24 +0000 (01:15 +0000)]
And... fix the build some more.

llvm-svn: 221036

9 years agoRemove the LoopBounds from the TempScop class.
Johannes Doerfert [Sat, 1 Nov 2014 01:14:56 +0000 (01:14 +0000)]
Remove the LoopBounds from the TempScop class.

  We will use ScalarEvolution in the ScopInfo.cpp to get the loop trip
  count, not cache it in the TempScop object.

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

llvm-svn: 221035

9 years agoJust iterate the DwarfCompileUnits rather than trying to filter them out of the list...
David Blaikie [Sat, 1 Nov 2014 01:11:19 +0000 (01:11 +0000)]
Just iterate the DwarfCompileUnits rather than trying to filter them out of the list of all units.

llvm-svn: 221034

9 years agoAdd '*' to auto variable that is a pointer, as per the coding conventions.
David Blaikie [Sat, 1 Nov 2014 01:03:39 +0000 (01:03 +0000)]
Add '*' to auto variable that is a pointer, as per the coding conventions.

llvm-svn: 221033

9 years agoAdd show and merge tools for sample PGO profiles.
Diego Novillo [Sat, 1 Nov 2014 00:56:55 +0000 (00:56 +0000)]
Add show and merge tools for sample PGO profiles.

Summary:
This patch extends the 'show' and 'merge' commands in llvm-profdata to handle
sample PGO formats. Using the 'merge' command it is now possible to convert
one sample PGO format to another.

The only format that is currently not working is 'gcc'. I still need to
implement support for it in lib/ProfileData.

The changes in the sample profile support classes are needed for the
merge operation.

Reviewers: bogner

Subscribers: llvm-commits

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

llvm-svn: 221032

9 years agoAdd DwarfCompileUnit::getSkeleton that returns DwarfCompileUnit* to avoid having...
David Blaikie [Sat, 1 Nov 2014 00:50:34 +0000 (00:50 +0000)]
Add DwarfCompileUnit::getSkeleton that returns DwarfCompileUnit* to avoid having to cast from DwarfUnit* on every call.

llvm-svn: 221031

9 years agoFix a bug where -Wuninitialized would skip arguments to a function call.
Richard Trieu [Sat, 1 Nov 2014 00:46:54 +0000 (00:46 +0000)]
Fix a bug where -Wuninitialized would skip arguments to a function call.

llvm-svn: 221030

9 years agoPartial fix for building w/ libcxxrt on OSX. Patch from C Bergstrom.
Eric Fiselier [Sat, 1 Nov 2014 00:41:42 +0000 (00:41 +0000)]
Partial fix for building w/ libcxxrt on OSX. Patch from C Bergstrom.

llvm-svn: 221029

9 years agoTemporarily revert r220777 to sort out build bot breakage.
Adrian Prantl [Sat, 1 Nov 2014 00:26:59 +0000 (00:26 +0000)]
Temporarily revert r220777 to sort out build bot breakage.
"[x86] Simplify vector selection if condition value type matches vselect value type and true value is all ones or false value is all zeros."

llvm-svn: 221028

9 years agoIR: MDNode => Value: Instruction::getAllMetadata()
Duncan P. N. Exon Smith [Sat, 1 Nov 2014 00:26:42 +0000 (00:26 +0000)]
IR: MDNode => Value: Instruction::getAllMetadata()

Change `Instruction::getAllMetadata()` to modify a vector of `Value`
instead of `MDNode` and update call sites.  This is part of PR21433.

llvm-svn: 221027

9 years agoRemove the MaxLoopDepth attribute from the TempScop class
Johannes Doerfert [Sat, 1 Nov 2014 00:12:13 +0000 (00:12 +0000)]
Remove the MaxLoopDepth attribute from the TempScop class

  Now MaxLoopDepth only lives in Scops not in TempScops anymore.
  This is the first part of a series of changes to make TempScops
  obsolete.

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

llvm-svn: 221026

9 years agolibcxxrt defines bad_array_new_length::what() so move that into a conditional compila...
Eric Fiselier [Sat, 1 Nov 2014 00:11:25 +0000 (00:11 +0000)]
libcxxrt defines bad_array_new_length::what() so move that into a conditional compilation block

llvm-svn: 221025

9 years agoIR: MDNode => Value: Instruction::getMetadata()
Duncan P. N. Exon Smith [Sat, 1 Nov 2014 00:10:31 +0000 (00:10 +0000)]
IR: MDNode => Value: Instruction::getMetadata()

Change `Instruction::getMetadata()` to return `Value` as part of
PR21433.

Update most callers to use `Instruction::getMDNode()`, which wraps the
result in a `cast_or_null<MDNode>`.

llvm-svn: 221024

9 years agoIR: MDNode => Value: Add Instruction::getMDNode()
Duncan P. N. Exon Smith [Fri, 31 Oct 2014 23:58:04 +0000 (23:58 +0000)]
IR: MDNode => Value: Add Instruction::getMDNode()

Add `Instruction::getMDNode()` that casts to `MDNode` before changing
`Instruction::getMetadata()` to return `Value`.  This avoids adding
`cast_or_null<MDNode>` boiler-plate throughout the code.

Part of PR21433.

llvm-svn: 221023

9 years agoComplete the superclass type when completing an
Sean Callanan [Fri, 31 Oct 2014 23:55:36 +0000 (23:55 +0000)]
Complete the superclass type when completing an
Objective-C class type.

llvm-svn: 221022

9 years agoRevert "R600: Add missing file to CMakeLists.txt"
Reid Kleckner [Fri, 31 Oct 2014 23:39:10 +0000 (23:39 +0000)]
Revert "R600: Add missing file to CMakeLists.txt"

This reverts commit r220998.

It should've been reverted with the other change.

llvm-svn: 221021

9 years agoRevert "R600: Make sure to inline all internal functions"
Reid Kleckner [Fri, 31 Oct 2014 23:35:26 +0000 (23:35 +0000)]
Revert "R600: Make sure to inline all internal functions"

This reverts commit r220996.

It introduced layering violations causing link errors in many
configurations.

llvm-svn: 221020

9 years agoSilence a warning from MSVC "14" by making an enum unsigned
Reid Kleckner [Fri, 31 Oct 2014 23:33:56 +0000 (23:33 +0000)]
Silence a warning from MSVC "14" by making an enum unsigned

It says there is a narrowing conversion when we assign it to an unsigned
3 bit bitfield.

Also, use unsigned instead of size_t for the Size field of the struct in
question. Otherwise they won't run together in MSVC or clang-cl.

llvm-svn: 221019

9 years agoTOT broken by R220956 - Differential Revision: http://reviews/llvm.org/D6066
Shawn Best [Fri, 31 Oct 2014 23:20:13 +0000 (23:20 +0000)]
TOT broken by R220956 - Differential Revision: reviews/llvm.org/D6066

llvm-svn: 221018

9 years agoWork around bugs in MSVC "14" CTP 3's conversion logic
Reid Kleckner [Fri, 31 Oct 2014 23:19:46 +0000 (23:19 +0000)]
Work around bugs in MSVC "14" CTP 3's conversion logic

It appears to ignore or find ambiguous MachineInstrBuilder's conversion
operators that allow conversion to MachineInstr* and
MachineBasicBlock::bundle_iterator.

As a workaround, add an explicit way to get the MachineInstr.

llvm-svn: 221017

9 years ago[Refactor][NFC] Remove unused argument.
Johannes Doerfert [Fri, 31 Oct 2014 23:16:02 +0000 (23:16 +0000)]
[Refactor][NFC] Remove unused argument.

llvm-svn: 221016

9 years ago[Refactor][NFC] Map basic blocks to SCoP statements.
Johannes Doerfert [Fri, 31 Oct 2014 23:13:39 +0000 (23:13 +0000)]
[Refactor][NFC] Map basic blocks to SCoP statements.

  This will simplify the construction of domains and the modeling of
  PHI's.

llvm-svn: 221015

9 years agoRefactor duplicated code in liking GlobalValues.
Rafael Espindola [Fri, 31 Oct 2014 23:10:07 +0000 (23:10 +0000)]
Refactor duplicated code in liking GlobalValues.

There is quiet a bit of logic that is common to any GlobalValue but was
duplicated for Functions, GlobalVariables and GlobalAliases.

While at it, merge visibility even when comdats are used, fixing pr21415.

llvm-svn: 221014

9 years agoDefine LLVM_NOEXCEPT with MSVC 14 CTP 3 or newer
Reid Kleckner [Fri, 31 Oct 2014 23:02:40 +0000 (23:02 +0000)]
Define LLVM_NOEXCEPT with MSVC 14 CTP 3 or newer

We have to use _MSC_FULL_VER here as CTP 2 and earlier didn't define
noexcept to my knowledge.

Fixes build error in lib/Support/Error.cpp when inheriting from
std::error_category, which has a noexcept virtual method.

llvm-svn: 221013

9 years agoSuppress MSVC's equivalent of -Wshadow warnings
Reid Kleckner [Fri, 31 Oct 2014 22:55:57 +0000 (22:55 +0000)]
Suppress MSVC's equivalent of -Wshadow warnings

IMO we need to clean up some of these, but the member variable one
(C4458) has false positives on static methods.  It is currently firing
on Twine, which has a static method like:
  struct Twine {
    uintptr_t LHS, RHS;
    static void staticMethod() {
      // warning C4458: declaration of 'LHS' hides class member
      uintptr_t LHS;
      ...
    }
  };

We should fix up clang's -Wshadow and clean it up, and then we can
re-enable some of these MSVC warnings.

llvm-svn: 221012

9 years agoAlways transmit SIGPROF back to the inferior.
Stephane Sezer [Fri, 31 Oct 2014 22:37:24 +0000 (22:37 +0000)]
Always transmit SIGPROF back to the inferior.

Summary:
SIGPROF is used for profiling processes (with google-perftools for
instance), which results in the inferior receiving a SIGPROF from the
kernel every few milliseconds. Instead of stopping the debugging session
and notifying the user of this, we should just pass the signal and keep
running.

This follows the behavior we have in UnixSignals.cpp.

Test Plan: Run LLDB on linux with a binary using google-perftools, see that execution gets interrupted all the time because we receive SIGPROF. Apply the patch, everything works fine.

Subscribers: lldb-commits

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

llvm-svn: 221011

9 years agoSink some of DwarfDebug::collectDeadVariables down into DwarfCompileUnit.
David Blaikie [Fri, 31 Oct 2014 22:30:30 +0000 (22:30 +0000)]
Sink some of DwarfDebug::collectDeadVariables down into DwarfCompileUnit.

llvm-svn: 221010

9 years agoCorrectly update dom-tree after loop vectorizer.
Michael Zolotukhin [Fri, 31 Oct 2014 22:28:03 +0000 (22:28 +0000)]
Correctly update dom-tree after loop vectorizer.

llvm-svn: 221009

9 years agoFix an accidental self-assignment using std::move in r220723.
Kaelyn Takata [Fri, 31 Oct 2014 22:25:09 +0000 (22:25 +0000)]
Fix an accidental self-assignment using std::move in r220723.

llvm-svn: 221008

9 years ago[mach-o] explicitly cast little_n uses to ints to silence MSVC
Tim Northover [Fri, 31 Oct 2014 22:12:20 +0000 (22:12 +0000)]
[mach-o] explicitly cast little_n uses to ints to silence MSVC

Hopefully this'll fix the build failure in the bot.

llvm-svn: 221007

9 years agoImplement IRGen for the x86 vectorcall convention
Reid Kleckner [Fri, 31 Oct 2014 22:00:51 +0000 (22:00 +0000)]
Implement IRGen for the x86 vectorcall convention

The most complex aspect of the convention is the handling of homogeneous
vector and floating point aggregates.  Reuse the homogeneous aggregate
classification code that we use on PPC64 and ARM for this.

This convention also has a C mangling, and we apparently implement that
in both Clang and LLVM.

Reviewed By: majnemer

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

llvm-svn: 221006

9 years agoSink most of DwarfDebug::constructAbstractSubprogramScopeDIE into DwarfCompileUnit
David Blaikie [Fri, 31 Oct 2014 21:57:02 +0000 (21:57 +0000)]
Sink most of DwarfDebug::constructAbstractSubprogramScopeDIE into DwarfCompileUnit

llvm-svn: 221005

9 years agoR600: Add IPO to the list of required libraries
Tom Stellard [Fri, 31 Oct 2014 21:52:08 +0000 (21:52 +0000)]
R600: Add IPO to the list of required libraries

llvm-svn: 221004

9 years ago[Object] Modify OwningBinary's interface to separate inspection from ownership.
Lang Hames [Fri, 31 Oct 2014 21:37:49 +0000 (21:37 +0000)]
[Object] Modify OwningBinary's interface to separate inspection from ownership.

The getBinary and getBuffer method now return ordinary pointers of appropriate
const-ness. Ownership is transferred by calling takeBinary(), which returns a
pair of the Binary and a MemoryBuffer.

llvm-svn: 221003

9 years agoSBAddress currently *may* have an Address object or it may not.
Jason Molenda [Fri, 31 Oct 2014 21:30:59 +0000 (21:30 +0000)]
SBAddress currently *may* have an Address object or it may not.
If it has an Address object, it is assumed to be Valid.
Change SBAddress to always have an Address object and check
whether it is valid or not in those case.

This is fixing a subtle problem where we ended up with
a SBAddress with an Address of LLDB_INVALID_ADDRESS could
run through a copy constructor and turn into an SBAddress
with no Address object being backed (because it wasn't
distinguishing between invalid-Address versus no-Address.)

The cost of an Address object is not high and this will be
an easy mistake for someone else to make; I'm fixing
SBAddress so it doesn't come up again.
<rdar://problem/18069407>

llvm-svn: 221002

9 years agoObjective-C SDK modernization tool. Use its own option
Fariborz Jahanian [Fri, 31 Oct 2014 21:19:45 +0000 (21:19 +0000)]
Objective-C SDK modernization tool. Use its own option
,-objcmt-migrate-property-dot-syntax, when migarting to use
property-dot syntax in place of messaging expression.
rdar://18839124

llvm-svn: 221001

9 years agoHave -Wuninitialized catch uninitalized use in overloaded operator arguments.
Richard Trieu [Fri, 31 Oct 2014 21:10:22 +0000 (21:10 +0000)]
Have -Wuninitialized catch uninitalized use in overloaded operator arguments.

llvm-svn: 221000

9 years ago[analyzer] Helpful hints for Windows users of scan-build.
Anton Yartsev [Fri, 31 Oct 2014 20:57:57 +0000 (20:57 +0000)]
[analyzer] Helpful hints for Windows users of scan-build.

llvm-svn: 220999

9 years agoR600: Add missing file to CMakeLists.txt
Tom Stellard [Fri, 31 Oct 2014 20:56:36 +0000 (20:56 +0000)]
R600: Add missing file to CMakeLists.txt

llvm-svn: 220998

9 years agoR600: Don't promote allocas when one of the users is a ptrtoint instruction
Tom Stellard [Fri, 31 Oct 2014 20:52:04 +0000 (20:52 +0000)]
R600: Don't promote allocas when one of the users is a ptrtoint instruction

We need to figure out how to track ptrtoint values all the
way until result is converted back to a pointer in order
to correctly rewrite the pointer type.

llvm-svn: 220997

9 years agoR600: Make sure to inline all internal functions
Tom Stellard [Fri, 31 Oct 2014 20:52:02 +0000 (20:52 +0000)]
R600: Make sure to inline all internal functions

Function calls aren't supported yet.

llvm-svn: 220996

9 years agoIR: Instruction::setMetadata() should use cast_or_null
Duncan P. N. Exon Smith [Fri, 31 Oct 2014 20:28:04 +0000 (20:28 +0000)]
IR: Instruction::setMetadata() should use cast_or_null

Not sure why this assertion didn't fire locally [1], but in r220994
`Instruction::setMetadata()` should be using `cast_or_null`.

[1]: http://lab.llvm.org:8011/builders/llvm-hexagon-elf/builds/12327

llvm-svn: 220995

9 years agoIR: MDNode => Value: Instruction::setMetadata()
Duncan P. N. Exon Smith [Fri, 31 Oct 2014 20:13:11 +0000 (20:13 +0000)]
IR: MDNode => Value: Instruction::setMetadata()

Change `Instruction::setMetadata()` API to accept `Value` instead of
`MDNode`.  Part of PR21433.

llvm-svn: 220994

9 years agoMS ABI: Properly call global delete when invoking virtual destructors
David Majnemer [Fri, 31 Oct 2014 20:09:12 +0000 (20:09 +0000)]
MS ABI: Properly call global delete when invoking virtual destructors

Summary:
The Itanium ABI approach of using offset-to-top isn't possible with the
MS ABI, it doesn't have that kind of information lying around.

Instead, we do the following:
- Call the virtual deleting destructor with the "don't delete the object
  flag" set.  The virtual deleting destructor will return a pointer to
  'this' adjusted to the most derived class.
- Call the global delete using the adjusted 'this' pointer.

Reviewers: rnk

Subscribers: cfe-commits

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

llvm-svn: 220993

9 years agoC++-11 [qoi]. Do not warn on missing 'verride' on use of
Fariborz Jahanian [Fri, 31 Oct 2014 19:56:27 +0000 (19:56 +0000)]
C++-11 [qoi]. Do not warn on missing 'verride' on use of
macros in user code when macros themselves are defined
in a system header. rdar://18295240

llvm-svn: 220992

9 years ago[asan] increase the initial buffer size in caller-callee dumper
Kostya Serebryany [Fri, 31 Oct 2014 19:49:46 +0000 (19:49 +0000)]
[asan] increase the initial buffer size in caller-callee dumper

llvm-svn: 220991

9 years ago[PowerPC] Initial VSX intrinsic support, with min/max for vector double
Bill Schmidt [Fri, 31 Oct 2014 19:19:24 +0000 (19:19 +0000)]
[PowerPC] Initial VSX intrinsic support, with min/max for vector double

Now that we have initial support for VSX, we can begin adding
intrinsics for programmer access to VSX instructions.  This patch
performs the necessary enablement in the front end, and tests it by
implementing intrinsics for minimum and maximum using the vector
double data type.

The main change in the front end is to no longer disallow "vector" and
"double" in the same declaration (lib/Sema/DeclSpec.cpp), but "vector"
and "long double" must still be disallowed.  The new intrinsics are
accessed via vec_max and vec_min with changes in
lib/Headers/altivec.h.  Note that for v4f32, we already access
corresponding VMX builtins, but with VSX enabled we should use the
forms that allow all 64 vector registers.

The new built-ins are defined in include/clang/Basic/BuiltinsPPC.def.

I've added a new test in test/CodeGen/builtins-ppc-vsx.c that is
similar to, but much smaller than, builtins-ppc-altivec.c.  This
allows us to test VSX IR generation without duplicating CHECK lines
for the existing bazillion Altivec tests.

Since vector double is now legal when VSX is available, I've modified
the error message, and changed where we test for it and for vector
long double, since the target machine isn't visible in the old place.
This serendipitously removed a not-pertinent warning about 'long'
being deprecated when used with 'vector', when "vector long double" is
encountered and we just want to issue an error.  The existing tests
test/Parser/altivec.c and test/Parser/cxx-altivec.cpp have been
updated accordingly, and I've added test/Parser/vsx.c to verify that
"vector double" is now legitimate with VSX enabled.

There is a companion patch for LLVM.

llvm-svn: 220989

9 years ago[PowerPC] Initial VSX intrinsic support, with min/max for vector double
Bill Schmidt [Fri, 31 Oct 2014 19:19:07 +0000 (19:19 +0000)]
[PowerPC] Initial VSX intrinsic support, with min/max for vector double

Now that we have initial support for VSX, we can begin adding
intrinsics for programmer access to VSX instructions.  This patch adds
basic support for VSX intrinsics in general, and tests it by
implementing intrinsics for minimum and maximum for the vector double
data type.

The LLVM portion of this is quite straightforward.  There is a
companion patch for Clang.

llvm-svn: 220988

9 years ago[AArch64] Check Dest Register Liveness in CondOpt pass.
Chad Rosier [Fri, 31 Oct 2014 19:02:38 +0000 (19:02 +0000)]
[AArch64] Check Dest Register Liveness in CondOpt pass.

Our internal test reveals such case should not be transformed:

  cmp x17, #3
  b.lt .LBB10_15
  ...
  subs x12, x12, #1
  b.gt .LBB10_1

where x12 is a liveout, becomes:

  cmp x17, #2
  b.le .LBB10_15
  ...
  subs x12, x12, #2
  b.ge .LBB10_1

Unable to provide test case as it's difficult to reproduce on community branch.

http://reviews.llvm.org/D6048
Patch by Zhaoshi Zheng <zhaoshiz@codeaurora.org>!

llvm-svn: 220987

9 years agoignore -mconstructor-aliases when adding field paddings for asan
Kostya Serebryany [Fri, 31 Oct 2014 19:01:02 +0000 (19:01 +0000)]
ignore -mconstructor-aliases when adding field paddings for asan

Summary:
When we are adding field paddings for asan even an empty dtor has to remain in the code,
so we ignore -mconstructor-aliases if the paddings are going to be added.

Test Plan: added a test

Reviewers: rsmith, rnk, rafael

Reviewed By: rafael

Subscribers: cfe-commits

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

llvm-svn: 220986

9 years ago[asan] do not treat inline asm calls as indirect calls
Kostya Serebryany [Fri, 31 Oct 2014 18:38:23 +0000 (18:38 +0000)]
[asan] do not treat inline asm calls as indirect calls

llvm-svn: 220985

9 years agoclang-format: [Java] Improve line breaks around annotations.
Daniel Jasper [Fri, 31 Oct 2014 18:23:49 +0000 (18:23 +0000)]
clang-format: [Java] Improve line breaks around annotations.

Before:
  @SomeAnnotation("With some really looooooooooooooong text") private static final
      long something = 0L;

  void SomeFunction(@Nullable
                    String something) {}

After:
  @SomeAnnotation("With some really looooooooooooooong text")
  private static final long something = 0L;

  void SomeFunction(@Nullable String something) {}

llvm-svn: 220984

9 years agocommit on behalf of Oleksiy Vyalov Fix junk content handling within GDBRemoteCOmmunic...
Shawn Best [Fri, 31 Oct 2014 18:18:23 +0000 (18:18 +0000)]
commit on behalf of Oleksiy Vyalov Fix junk content handling within GDBRemoteCOmmunication::CheckForPacket  1. Avoid removing of an extra symbol from m_bytes.  2. iterate over m_bytes until useful content is found.  Differential Revision: reviews.llvm.org/D6042

llvm-svn: 220983

9 years agoIn ValueObjectDynamicValue, trust what comes from
Sean Callanan [Fri, 31 Oct 2014 18:07:44 +0000 (18:07 +0000)]
In ValueObjectDynamicValue, trust what comes from
the runtime rather than trying to fix it up,
because now those types have ivars regardless of
whether they come from "frame variable" or from
expressions.

Patch by Enrico Granata.

llvm-svn: 220982

9 years agoUpdated the Objective-C runtime type vendor to
Sean Callanan [Fri, 31 Oct 2014 18:06:26 +0000 (18:06 +0000)]
Updated the Objective-C runtime type vendor to
load ivars into classes that are reported to the
Objective-C runtime.

llvm-svn: 220981

9 years ago- Fixed a bug where ::Describe for class descriptors
Sean Callanan [Fri, 31 Oct 2014 18:05:26 +0000 (18:05 +0000)]
- Fixed a bug where ::Describe for class descriptors
  would fail if the class had no ivars.

- Updated use of the RealizeType API by the class
  descriptors to use "for_expression" rather than
  the misnamed "allow_unknownanytype."

llvm-svn: 220980

9 years ago- Use "for_expression" rather than "allow_unknownanytype"
Sean Callanan [Fri, 31 Oct 2014 18:02:30 +0000 (18:02 +0000)]
- Use "for_expression" rather than "allow_unknownanytype"
  to indicate that we're doing stuff for the expression
  parser.

- When for_expression is true, look through @s and find
  the actual class rather than just returning id.

- Rename BuildObjCObjectType to BuildObjCObjectPointerType
  since it's actually returning an object *pointer* type.

llvm-svn: 220979

9 years ago[CodeGenPrepare] Move extractelement close to store if they can be combined.
Quentin Colombet [Fri, 31 Oct 2014 17:52:53 +0000 (17:52 +0000)]
[CodeGenPrepare] Move extractelement close to store if they can be combined.

This patch adds an optimization in CodeGenPrepare to move an extractelement
right before a store when the target can combine them.
The optimization may promote any scalar operations to vector operations in the
way to make that possible.

** Context **

Some targets use different register files for both vector and scalar operations.
This means that transitioning from one domain to another may incur copy from one
register file to another. These copies are not coalescable and may be expensive.
For example, according to the scheduling model, on cortex-A8 a vector to GPR
move is 20 cycles.

** Motivating Example **

Let us consider an example:
define void @foo(<2 x i32>* %addr1, i32* %dest) {
 %in1 = load <2 x i32>* %addr1, align 8
 %extract = extractelement <2 x i32> %in1, i32 1
 %out = or i32 %extract, 1
 store i32 %out, i32* %dest, align 4
 ret void
}

As it is, this IR generates the following assembly on armv7:
  vldr  d16, [r0]            @vector load
  vmov.32 r0, d16[1]  @ cross-register-file copy: 20 cycles
  orr r0, r0, #1           @ scalar bitwise or
  str r0, [r1]               @ scalar store
  bx  lr

Whereas we could generate much faster code:
  vldr  d16, [r0]               @ vector load
  vorr.i32  d16, #0x1     @ vector bitwise or
  vst1.32 {d16[1]}, [r1:32] @ vector extract + store
  bx  lr

Half of the computation made in the vector is useless, but this allows to get
rid of the expensive cross-register-file copy.

** Proposed Solution **

To avoid this cross-register-copy penalty, we promote the scalar operations to
vector operations. The penalty will be removed if we manage to promote the whole
chain of computation in the vector domain.
Currently, we do that only when the chain of computation ends by a store and the
target is able to combine an extract with a store.

Stores are the most likely candidates, because other instructions produce values
that would need to be promoted and so, extracted as some point[1]. Moreover,
this is customary that targets feature stores that perform a vector extract (see
AArch64 and X86 for instance).

The proposed implementation relies on the TargetTransformInfo to decide whether
or not it is beneficial to promote a chain of computation in the vector domain.
Unfortunately, this interface is rather inaccurate for this level of details and
although this optimization may be beneficial for X86 and AArch64, the inaccuracy
will lead to the optimization being too aggressive.
Basically in TargetTransformInfo, everything that is legal has a cost of 1,
whereas, even if a vector type is legal, usually a vector operation is slightly
more expensive than its scalar counterpart. That will lead to too many
promotions that may not be counter balanced by the saving of the
cross-register-file copy. For instance, on AArch64 this penalty is just 4
cycles.

For now, the optimization is just enabled for ARM prior than v8, since those
processors have a larger penalty on cross-register-file copies, and the scope is
limited to basic blocks. Because of these two factors, we limit the effects of
the inaccuracy. Indeed, I did not want to build up a fancy cost model with block
frequency and everything on top of that.

[1] We can imagine targets that can combine an extractelement with  other
instructions than just stores. If we want to go into that direction, the current
interfaces must be augmented and, moreover, I think this becomes a global isel
problem.

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

<rdar://problem/14170854>

llvm-svn: 220978

9 years agoclang-format: [js] Updates to Google's JavaScript style.
Daniel Jasper [Fri, 31 Oct 2014 17:50:40 +0000 (17:50 +0000)]
clang-format: [js] Updates to Google's JavaScript style.

The style guide is changing..

llvm-svn: 220977

9 years ago[analyzer] Rename NewDeleteLeaks checker in the test script.
Anna Zaks [Fri, 31 Oct 2014 17:40:14 +0000 (17:40 +0000)]
[analyzer] Rename NewDeleteLeaks checker in the test script.

Fixup to r220289.

llvm-svn: 220976

9 years ago[asan] run-time part of the caller-callee coverage instrumentation
Kostya Serebryany [Fri, 31 Oct 2014 17:19:11 +0000 (17:19 +0000)]
[asan] run-time part of the caller-callee coverage instrumentation

llvm-svn: 220975

9 years agoFix the build
David Blaikie [Fri, 31 Oct 2014 17:18:09 +0000 (17:18 +0000)]
Fix the build

llvm-svn: 220974

9 years ago[asan] fix caller-calee instrumentation to emit new cache for every call site
Kostya Serebryany [Fri, 31 Oct 2014 17:11:27 +0000 (17:11 +0000)]
[asan] fix caller-calee instrumentation to emit new cache for every call site

llvm-svn: 220973

9 years agoFix ARM HVA classification of classes with non-virtual bases
Reid Kleckner [Fri, 31 Oct 2014 17:10:41 +0000 (17:10 +0000)]
Fix ARM HVA classification of classes with non-virtual bases

Reuse the PPC64 HVA detection algorithm for ARM and AArch64. This is a
nice code deduplication, since they are roughly identical. A few virtual
method extension points are needed to understand how big an HVA can be
and what element types it can have for a given architecture.

Also make the record expansion code work in the presence of non-virtual
bases.

Reviewed By: uweigand, asl

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

llvm-svn: 220972

9 years agoRemove the wrongly named and now empty Ocaml directory
Justin Bogner [Fri, 31 Oct 2014 17:10:02 +0000 (17:10 +0000)]
Remove the wrongly named and now empty Ocaml directory

llvm-svn: 220971

9 years agoFix unused-function warning differently from r220853
David Blaikie [Fri, 31 Oct 2014 17:08:11 +0000 (17:08 +0000)]
Fix unused-function warning differently from r220853

Rather than executing this code only needed for an assertion even in a
non-asserts build, just roll the function into the assert. The assertion
text literally describes the two cases so it doesn't seem like this
benefits much from having a separate function (& have to hassle about
ifndef NDEBUG it out, etc)

llvm-svn: 220970

9 years agoUpdate the non-pthreads fallback for RWMutex on Unix
David Blaikie [Fri, 31 Oct 2014 17:02:30 +0000 (17:02 +0000)]
Update the non-pthreads fallback for RWMutex on Unix

Tested this by #if 0'ing out the pthreads implementation, which
indicated that this fallback was not currently compiling successfully
and applying this patch resolves that.

Patch by Andy Chien.

llvm-svn: 220969

9 years agoUnify and update link-messages.ll and redefinition.ll. NFC.
Rafael Espindola [Fri, 31 Oct 2014 16:52:30 +0000 (16:52 +0000)]
Unify and update link-messages.ll and redefinition.ll. NFC.

llvm-svn: 220968

9 years agoCorrect assert text from r220923
David Blaikie [Fri, 31 Oct 2014 16:45:36 +0000 (16:45 +0000)]
Correct assert text from r220923

Noticed in post-commit review by Adrian Prantl.

llvm-svn: 220967

9 years ago[libclang] Disable spell-checking and warnings during code-completion since they...
Argyrios Kyrtzidis [Fri, 31 Oct 2014 16:44:32 +0000 (16:44 +0000)]
[libclang] Disable spell-checking and warnings during code-completion since they are not needed.

llvm-svn: 220966

9 years ago[Makefile] If ENABLE_CLANG_ARCMT=0 it seems we don't build libclang, so the unittests...
Argyrios Kyrtzidis [Fri, 31 Oct 2014 16:44:30 +0000 (16:44 +0000)]
[Makefile] If ENABLE_CLANG_ARCMT=0 it seems we don't build libclang, so the unittests for libclang should be disabled too.

This is a modified patch provided by Vassil Vassilev.

llvm-svn: 220965

9 years agoMark a few variables const. NFC.
Rafael Espindola [Fri, 31 Oct 2014 16:08:17 +0000 (16:08 +0000)]
Mark a few variables const. NFC.

llvm-svn: 220964

9 years agoFix some bugs from D5988
Justin Hibbits [Fri, 31 Oct 2014 15:57:52 +0000 (15:57 +0000)]
Fix some bugs from D5988

Summary:
Ed Maste found some problems with the commit in D5988.  Address most of these.
While here, also add floating point return handling.  This doesn't handle
128-bit long double yet.  Since I don't have any system that uses it, I don't
currently have plans to implement it.

Reviewers: emaste

Reviewed By: emaste

Subscribers: emaste, lldb-commits

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

llvm-svn: 220963

9 years ago[CMake] llvm/examples: Update libdeps for unoptimized builds.
NAKAMURA Takumi [Fri, 31 Oct 2014 15:27:16 +0000 (15:27 +0000)]
[CMake] llvm/examples: Update libdeps for unoptimized builds.

llvm-svn: 220962

9 years ago[AArch64] CondOpt pass is missing FCMP instructions when searching backward for
Chad Rosier [Fri, 31 Oct 2014 15:17:36 +0000 (15:17 +0000)]
[AArch64] CondOpt pass is missing FCMP instructions when searching backward for
a CMP which defines the flags used by B.CC.

http://reviews.llvm.org/D6047
Patch by Zhaoshi Zheng <zhaoshiz@codeaurora.org>!

llvm-svn: 220961

9 years ago[SCEV] Improve Scalar Evolution's use of no {un,}signed wrap flags
Bradley Smith [Fri, 31 Oct 2014 11:40:32 +0000 (11:40 +0000)]
[SCEV] Improve Scalar Evolution's use of no {un,}signed wrap flags

In a case where we have a no {un,}signed wrap flag on the increment, if
RHS - Start is constant then we can avoid inserting a max operation bewteen
the two, since we can statically determine which is greater.

This allows us to unroll loops such as:

 void testcase3(int v) {
   for (int i=v; i<=v+1; ++i)
     f(i);
 }

llvm-svn: 220960

9 years ago[PowerPC] Load BlockAddress values from the TOC in 64-bit SVR4 code
Ulrich Weigand [Fri, 31 Oct 2014 10:33:14 +0000 (10:33 +0000)]
[PowerPC] Load BlockAddress values from the TOC in 64-bit SVR4 code

Since block address values can be larger than 2GB in 64-bit code, they
cannot be loaded simply using an @l / @ha pair, but instead must be
loaded from the TOC, just like GlobalAddress, ConstantPool, and
JumpTable values are.

The commit also fixes a bug in PPCLinuxAsmPrinter::doFinalization where
temporary labels could not be used as TOC values, since code would
attempt (and fail) to use GetOrCreateSymbol to create a symbol of the
same name as the temporary label.

llvm-svn: 220959

9 years ago[OCaml] Ensure consistent naming.
Peter Zotov [Fri, 31 Oct 2014 09:19:03 +0000 (09:19 +0000)]
[OCaml] Ensure consistent naming.

Specifically:
  * Directories match module names.
  * Test names match module names.
  * The language is called "OCaml", not "Ocaml".

llvm-svn: 220958

9 years ago[OCaml] Rework Llvm_executionengine using ctypes.
Peter Zotov [Fri, 31 Oct 2014 09:05:36 +0000 (09:05 +0000)]
[OCaml] Rework Llvm_executionengine using ctypes.

Since JIT->MCJIT migration, most of the ExecutionEngine interface
became deprecated and/or broken. This especially affected the OCaml
bindings, as runFunction is no longer available, and unlike in C,
it is not possible to coerce a pointer to a function and call it
in OCaml.

In practice, LLVM 3.5 shipped completely unusable
Llvm_executionengine.

The GenericValue interface and runFunction were essentially
a poor man's FFI. As such, this interface was removed and instead
a dependency on ctypes >=0.3 added, which handled platform-specific
aspects of accessing data and calling functions.

The new interface does not expose JIT (which is a shim around MCJIT),
as well as the interpreter (which can't handle a lot of valid IR).

Llvm_executionengine.add_global_mapping is currently unusable
due to PR20656.

llvm-svn: 220957

9 years agoRemove StorageClass typedefs from VarDecl and FunctionDecl since StorageClass is...
Craig Topper [Fri, 31 Oct 2014 06:57:13 +0000 (06:57 +0000)]
Remove StorageClass typedefs from VarDecl and FunctionDecl since StorageClass is in the clang namespace.

llvm-svn: 220956

9 years agoRemove CastKind typedef from CastExpr since CastKind is in the clang namespace.
Craig Topper [Fri, 31 Oct 2014 06:57:10 +0000 (06:57 +0000)]
Remove CastKind typedef from CastExpr since CastKind is in the clang namespace.

llvm-svn: 220955

9 years agoRemove a couple typedefs for things in the clang namespace with the same name. Remove...
Craig Topper [Fri, 31 Oct 2014 06:57:07 +0000 (06:57 +0000)]
Remove a couple typedefs for things in the clang namespace with the same name. Remove a typedef that matches an identical one in the clang namespace.

llvm-svn: 220954

9 years agoMove an input file to Inputs instead of using RUN: true.
Rafael Espindola [Fri, 31 Oct 2014 05:54:15 +0000 (05:54 +0000)]
Move an input file to Inputs instead of using RUN: true.

llvm-svn: 220953

9 years agoObject, COFF: Cleanup symbol type code, improve binutils compatibility
David Majnemer [Fri, 31 Oct 2014 05:07:00 +0000 (05:07 +0000)]
Object, COFF: Cleanup symbol type code, improve binutils compatibility

Do a better job classifying symbols.  This increases the consistency
between the COFF handling code and the ELF side of things.

llvm-svn: 220952

9 years agomerge tests for constant linking.
Rafael Espindola [Fri, 31 Oct 2014 05:04:16 +0000 (05:04 +0000)]
merge tests for constant linking.

llvm-svn: 220951

9 years agoMove definition closer to use. NFC.
Rafael Espindola [Fri, 31 Oct 2014 04:46:38 +0000 (04:46 +0000)]
Move definition closer to use. NFC.

llvm-svn: 220949

9 years agoUpdate default disassembly format string so we get
Jason Molenda [Fri, 31 Oct 2014 03:40:06 +0000 (03:40 +0000)]
Update default disassembly format string so we get
better output when we don't have any symbol name.
It looked like this:

0x1097fd029 <ud2
0x1097fd02b <addb   %al, (%rax)

now, like this:

0x10cdd3064: ud2
0x10cdd3066: addb   %al, (%rax)

<rdar://problem/18833391>

llvm-svn: 220948

9 years agoUpdate xcode project file to build new ppc files.
Jason Molenda [Fri, 31 Oct 2014 03:39:11 +0000 (03:39 +0000)]
Update xcode project file to build new ppc files.

llvm-svn: 220947

9 years ago[AArch64]Add 2 intrinsics vmov_n_p64/vmovq_n_p64, the alias for vdup_n_p64/vdup_n_p64.
Hao Liu [Fri, 31 Oct 2014 02:41:37 +0000 (02:41 +0000)]
[AArch64]Add 2 intrinsics vmov_n_p64/vmovq_n_p64, the alias for vdup_n_p64/vdup_n_p64.
As this change is too small, commit it directly.

llvm-svn: 220946

9 years agoPR20557: Fix the bug that bogus cpu parameter crashes llc on AArch64 backend.
Hao Liu [Fri, 31 Oct 2014 02:35:34 +0000 (02:35 +0000)]
PR20557: Fix the bug that bogus cpu parameter crashes llc on AArch64 backend.
Initial patch by Oleg Ranevskyy.

llvm-svn: 220945

9 years agoFirst cut of PowerPC(64) support in LLDB.
Justin Hibbits [Fri, 31 Oct 2014 02:34:28 +0000 (02:34 +0000)]
First cut of PowerPC(64) support in LLDB.

Summary:
This adds preliminary support for PowerPC/PowerPC64, for FreeBSD.  There are
some issues still:

 * Breakpoints don't work well on powerpc64.
 * Shared libraries don't yet get loaded for a 32-bit process on powerpc64 host.
 * Backtraces don't work.  This is due to PowerPC ABI using a backchain pointer
   in memory, instead of a dedicated frame pointer register for the backchain.
 * Breakpoints on functions without debug info may not work correctly for 32-bit
   powerpc.

Reviewers: emaste, tfiala, jingham, clayborg

Reviewed By: clayborg

Subscribers: emaste, lldb-commits

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

llvm-svn: 220944

9 years ago[modules] When a .pcm file is explicitly built separately from the translation
Richard Smith [Fri, 31 Oct 2014 02:28:58 +0000 (02:28 +0000)]
[modules] When a .pcm file is explicitly built separately from the translation
unit, allow the -O settings of the two compilations to differ.

llvm-svn: 220943

9 years agoMake QualType::dump() produce a useful dump of the structure of the type,
Richard Smith [Fri, 31 Oct 2014 01:17:45 +0000 (01:17 +0000)]
Make QualType::dump() produce a useful dump of the structure of the type,
rather than simply pretty-printing it.

llvm-svn: 220942

9 years agoThreading.h: Give named parameters to llvm::call_once(flag,UserFn). [-Wdocumentation]
NAKAMURA Takumi [Fri, 31 Oct 2014 00:54:20 +0000 (00:54 +0000)]
Threading.h: Give named parameters to llvm::call_once(flag,UserFn). [-Wdocumentation]

llvm-svn: 220941

9 years agoASTDumper.cpp: Appease g++, for now.
NAKAMURA Takumi [Fri, 31 Oct 2014 00:30:37 +0000 (00:30 +0000)]
ASTDumper.cpp: Appease g++, for now.

llvm-svn: 220940

9 years agoRename 'DarwinStaticLib' to 'DarwinLibName'
Kuba Brecka [Fri, 31 Oct 2014 00:08:57 +0000 (00:08 +0000)]
Rename 'DarwinStaticLib' to 'DarwinLibName'

The former name doesn't make sense, we are using this parameter for both .a and .dylib libraries.

No functional change.

http://reviews.llvm.org/D6040

llvm-svn: 220939

9 years agoGet the correct process architecture in ProcessKDP::DidAttach().
Greg Clayton [Fri, 31 Oct 2014 00:06:52 +0000 (00:06 +0000)]
Get the correct process architecture in ProcessKDP::DidAttach().

<rdar://problem/18806212>

llvm-svn: 220938

9 years ago[SelectionDAG] When scalarizing trunc, don't assert for legal operands.
Ahmed Bougacha [Thu, 30 Oct 2014 23:46:50 +0000 (23:46 +0000)]
[SelectionDAG] When scalarizing trunc, don't assert for legal operands.

r212242 introduced a legalizer hook, originally to let AArch64 widen
v1i{32,16,8} rather than scalarize, because the legalizer expected, when
scalarizing the result of a conversion operation, to already have
scalarized the operands.  On AArch64, v1i64 is legal, so that commit
ensured operations such as v1i32 = trunc v1i64 wouldn't assert.

It did that by choosing to widen v1 types whenever possible.  However,
v1i1 types, for which there's no legal widened type, would still trigger
the assert.

This commit fixes that, by only scalarizing a trunc's result when the
operand has already been scalarized, and introducing an extract_elt
otherwise.
This is similar to r205625.

Fixes PR20777.

llvm-svn: 220937

9 years agoSpeculative fix for Windows build after r220932
Hans Wennborg [Thu, 30 Oct 2014 23:10:01 +0000 (23:10 +0000)]
Speculative fix for Windows build after r220932

llvm-svn: 220936