platform/upstream/llvm.git
9 years ago[ARM] ARMLoadStoreOpt::UpdateBaseRegUses should stop on def
John Brawn [Tue, 23 Jun 2015 16:02:11 +0000 (16:02 +0000)]
[ARM] ARMLoadStoreOpt::UpdateBaseRegUses should stop on def

When UpdateBaseRegUses sees an instruction that defines the base
register it must stop, as the base register value it is updating is no
longer live. Ideally we would already have seen the register be killed
(which is already checked for), but the kill flags may be inaccurate
and we have to account for this.

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

llvm-svn: 240424

9 years agoobjdump: Don't print a (always 0) size for MachO symbols.
Rafael Espindola [Tue, 23 Jun 2015 15:45:38 +0000 (15:45 +0000)]
objdump: Don't print a (always 0) size for MachO symbols.

Only common symbol on MachO and COFF have a size.

For COFF we already had a custom format.

For MachO, there is no native objdump and we were printing it as ELF. Now
we only print the sizes for symbols that actually have them.

llvm-svn: 240422

9 years agoSystemZ: Avoid left shifting negative values (it's UB)
Justin Bogner [Tue, 23 Jun 2015 15:38:24 +0000 (15:38 +0000)]
SystemZ: Avoid left shifting negative values (it's UB)

Found by ubsan.

llvm-svn: 240420

9 years ago[Option] Plug a leak when move-assigning an InputArgList.
Benjamin Kramer [Tue, 23 Jun 2015 15:28:10 +0000 (15:28 +0000)]
[Option] Plug a leak when move-assigning an InputArgList.

The class has a non-trivial dtor so we have to clean up before we move
in new members. Remove misleading comment as a default move assignment
operator will never be synthesized for this class.

llvm-svn: 240417

9 years agoMake helper functions static. NFC.
Benjamin Kramer [Tue, 23 Jun 2015 14:51:40 +0000 (14:51 +0000)]
Make helper functions static. NFC.

llvm-svn: 240416

9 years ago[BranchFolding] Document why replacing HashMachineInstr with hash_code doesn't work
Benjamin Kramer [Tue, 23 Jun 2015 14:47:36 +0000 (14:47 +0000)]
[BranchFolding] Document why replacing HashMachineInstr with hash_code doesn't work

llvm-svn: 240415

9 years ago[MachineBasicBlock] Add getFirstNonDebugInstr to complement getLastNonDebugInstr
Benjamin Kramer [Tue, 23 Jun 2015 14:47:29 +0000 (14:47 +0000)]
[MachineBasicBlock] Add getFirstNonDebugInstr to complement getLastNonDebugInstr

Use it in CodeGen where applicable. No functionality change intended.

llvm-svn: 240414

9 years ago[MachineBasicBlock] Use the const_cast(this) trick to reduce duplication
Benjamin Kramer [Tue, 23 Jun 2015 14:47:18 +0000 (14:47 +0000)]
[MachineBasicBlock] Use the const_cast(this) trick to reduce duplication

NFC.

llvm-svn: 240413

9 years agoWhen building libc++, we use '"' as a delimiter instead of '<' when including libc...
Marshall Clow [Tue, 23 Jun 2015 14:45:02 +0000 (14:45 +0000)]
When building libc++, we use '"' as a delimiter instead of '<' when including libc++ header files. This is so that the dylib gets built with our headers; rather than the system-installed ones. We do this in most places already, just fixing a couple of inconsistent uses.

llvm-svn: 240412

9 years agoBe sure to set the DataLayout before checking the cache.
Rafael Espindola [Tue, 23 Jun 2015 14:42:34 +0000 (14:42 +0000)]
Be sure to set the DataLayout before checking the cache.

This makes sure the same mangling is used.

Should fix the OS X bots.

llvm-svn: 240411

9 years ago[mips] [IAS] Add partial support for the ULHU pseudo-instruction.
Toma Tabacu [Tue, 23 Jun 2015 14:39:42 +0000 (14:39 +0000)]
[mips] [IAS] Add partial support for the ULHU pseudo-instruction.

Summary:
This only adds support for ULHU of an immediate address with/without a source register.
It does not include support for ULHU of the address of a symbol.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 240410

9 years ago[OPENMP] Initial support for 'depend' clause (4.0).
Alexey Bataev [Tue, 23 Jun 2015 14:25:19 +0000 (14:25 +0000)]
[OPENMP] Initial support for 'depend' clause (4.0).

Parsing and sema analysis (without support for array sections in arguments) for 'depend' clause (used in 'task' directive, OpenMP 4.0).

llvm-svn: 240409

9 years agoRemove unused arguments and move ManglerPrefixTy to the implementation.
Rafael Espindola [Tue, 23 Jun 2015 14:11:09 +0000 (14:11 +0000)]
Remove unused arguments and move ManglerPrefixTy to the implementation.

llvm-svn: 240408

9 years ago[mips] [IAS] Add support for generating DADDu to createAddu(). NFC.
Toma Tabacu [Tue, 23 Jun 2015 14:00:54 +0000 (14:00 +0000)]
[mips] [IAS] Add support for generating DADDu to createAddu(). NFC.

Summary: This isn't used right now, but it will be in some upcoming changes.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 240407

9 years agoUpdate for LLVM api change.
Rafael Espindola [Tue, 23 Jun 2015 13:59:36 +0000 (13:59 +0000)]
Update for LLVM api change.

llvm-svn: 240406

9 years agoSimplify the Mangler interface now that DataLayout is mandatory.
Rafael Espindola [Tue, 23 Jun 2015 13:59:29 +0000 (13:59 +0000)]
Simplify the Mangler interface now that DataLayout is mandatory.

We only need to pass in a DataLayout when mangling a raw string, not when
constructing the mangler.

llvm-svn: 240405

9 years ago[mips64] Emit correct addend for some PC-relative relocations
Petar Jovanovic [Tue, 23 Jun 2015 13:54:42 +0000 (13:54 +0000)]
[mips64] Emit correct addend for some PC-relative relocations

So far, LLVM has not emitted correct addend for N64 and N32 ABI. This patch
fixes that. It also removes fixup from MCJIT for R_MIPS_PC16 relocation.

Patch by Vladimir Radosavljevic.

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

llvm-svn: 240404

9 years ago[Hexagon] Use MF reference from parent class in HexagonPacketizerList
Krzysztof Parzyszek [Tue, 23 Jun 2015 13:50:23 +0000 (13:50 +0000)]
[Hexagon] Use MF reference from parent class in HexagonPacketizerList

llvm-svn: 240403

9 years agoMoving r215806, r215807, and r215808 into AttrDocs.td. These changes were originally...
Aaron Ballman [Tue, 23 Jun 2015 13:41:03 +0000 (13:41 +0000)]
Moving r215806, r215807, and r215808 into AttrDocs.td. These changes were originally applied to the RST file that is automatically generated by the server, and so the changes were never properly reflected online once the server overwrote AttributeReference.rst.

llvm-svn: 240402

9 years agoFixing a build bot break from r240400.
Aaron Ballman [Tue, 23 Jun 2015 13:29:33 +0000 (13:29 +0000)]
Fixing a build bot break from r240400.

llvm-svn: 240401

9 years agoClarify pointer ownership semantics by hoisting the std::unique_ptr creation to the...
Aaron Ballman [Tue, 23 Jun 2015 13:15:32 +0000 (13:15 +0000)]
Clarify pointer ownership semantics by hoisting the std::unique_ptr creation to the caller instead of hiding it in emitReport. NFC.

llvm-svn: 240400

9 years ago[clang-tidy] Fix false positives in misc-macro-parentheses checker
Daniel Marjamaki [Tue, 23 Jun 2015 12:45:14 +0000 (12:45 +0000)]
[clang-tidy] Fix false positives in misc-macro-parentheses checker

llvm-svn: 240399

9 years ago[mips] [IAS] Move some function definitions to MipsTargetStreamer.cpp. NFC.
Toma Tabacu [Tue, 23 Jun 2015 12:34:19 +0000 (12:34 +0000)]
[mips] [IAS] Move some function definitions to MipsTargetStreamer.cpp. NFC.

Summary: For the sake of consistency and to make some upcoming changes a little less noisy.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 240398

9 years agoAdd handling of async notify packets
Ewan Crawford [Tue, 23 Jun 2015 12:32:06 +0000 (12:32 +0000)]
Add handling of async notify packets

This patch adds a listener to the AynscThread in ProcessGDBRemote, specifically for dealing with any async notification packets.

From the broadcast our listener receives we can process the notify packet from the event data. A handler function then sets the thread stop info from this packet, and updates lldb by setting the process private state to stopped. Allowing the async thread to go back to sleep and getting the main thread to handle the implications of a state change.

When sending a vCont in nonstop mode we also get a different reply from all-stop mode, an OK response as opposed to a stop reply. So a condition is added to handle this and set the process state without the stop-reply data.

Reviewers: clayborg

Subscribers: lldb-commits, labath, ted, aidan.dodds, deepak2427

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

llvm-svn: 240397

9 years agoDon't repeat names in comments.
Rafael Espindola [Tue, 23 Jun 2015 12:29:52 +0000 (12:29 +0000)]
Don't repeat names in comments.

llvm-svn: 240396

9 years agoUse MCSymbols for FastISel.
Rafael Espindola [Tue, 23 Jun 2015 12:21:54 +0000 (12:21 +0000)]
Use MCSymbols for FastISel.

The summary is that it moves the mangling earlier and replaces a few
calls to .addExternalSymbol with addSym.

I originally wanted to replace all the uses of addExternalSymbol with
addSym, but noticed it was a lot of work and doesn't need to be done
all at once.

llvm-svn: 240395

9 years agoRevert r240302 ("Bring r240130 back.").
Daniel Jasper [Tue, 23 Jun 2015 11:31:32 +0000 (11:31 +0000)]
Revert r240302 ("Bring r240130 back.").

This causes errors like:

  ld: error: blah.o: requires dynamic R_X86_64_PC32 reloc against '' which
  may overflow at runtime; recompile with -fPIC
  blah.cc:function f(): error: undefined reference to ''
  blah.o:g(): error: undefined reference to ''

I have not yet come up with an appropriate reproduction.

llvm-svn: 240394

9 years agoRevert r240271 (Fixed/added namespace ending comments using clang-tidy. NFC)
Alexander Kornienko [Tue, 23 Jun 2015 10:48:35 +0000 (10:48 +0000)]
Revert r240271 (Fixed/added namespace ending comments using clang-tidy. NFC)

llvm-svn: 240393

9 years ago[mips] llvm-readobj can parse .MIPS.abiflags. No need to check the bytes.
Daniel Sanders [Tue, 23 Jun 2015 10:11:36 +0000 (10:11 +0000)]
[mips] llvm-readobj can parse .MIPS.abiflags. No need to check the bytes.

Summary:

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: llvm-commits

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

llvm-svn: 240392

9 years agoFix a warning. [-Wsign-compare]
NAKAMURA Takumi [Tue, 23 Jun 2015 10:01:20 +0000 (10:01 +0000)]
Fix a warning. [-Wsign-compare]

FIXME: Should "Level" be unsigned?
llvm-svn: 240391

9 years agoRevert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)
Alexander Kornienko [Tue, 23 Jun 2015 09:49:53 +0000 (09:49 +0000)]
Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)

Apparently, the style needs to be agreed upon first.

llvm-svn: 240390

9 years agoSilence VC warning C4715: '`anonymous namespace'::getNativeVectorSizeForA VXABI' :
Yaron Keren [Tue, 23 Jun 2015 09:45:42 +0000 (09:45 +0000)]
Silence VC warning C4715: '`anonymous namespace'::getNativeVectorSizeForA VXABI' :
not all control paths return a value.

llvm-svn: 240389

9 years agoWrite output file to temp directory. The tests shouldn't assume that
Daniel Jasper [Tue, 23 Jun 2015 09:26:37 +0000 (09:26 +0000)]
Write output file to temp directory. The tests shouldn't assume that
they can write to the current working directory.

llvm-svn: 240388

9 years agoTweak clang/test/Modules/modules-with-same-name.m to run with GnuWin32's find.exe...
NAKAMURA Takumi [Tue, 23 Jun 2015 08:37:21 +0000 (08:37 +0000)]
Tweak clang/test/Modules/modules-with-same-name.m to run with GnuWin32's find.exe on newer version of Windows.

It seems "*.pcm" would be expanded with current directory by NTOS 6.x's msvcrt. GnuWin32 utils are affected.
To avoid the issue, put an expression that msvcrt's glob won't match, like "*.pc[m]".

llvm-svn: 240387

9 years agoAVX-512: Added all forms of VPABS instruction
Elena Demikhovsky [Tue, 23 Jun 2015 08:19:46 +0000 (08:19 +0000)]
AVX-512: Added all forms of VPABS instruction
Added all intrinsics, tests for encoding, tests for intrinsics.

llvm-svn: 240386

9 years agoMCExpr: Avoid UB by evaluating this shift as unsigned
Justin Bogner [Tue, 23 Jun 2015 07:32:55 +0000 (07:32 +0000)]
MCExpr: Avoid UB by evaluating this shift as unsigned

We hit undefined behaviour in some MCExpr tests when the LHS of a left
shift is -1. Twos-complement semantics are completely reasonable here,
so we should just do the shift in unsigned.

llvm-svn: 240385

9 years ago[MS ABI] Rework member pointer conversion
David Majnemer [Tue, 23 Jun 2015 07:31:11 +0000 (07:31 +0000)]
[MS ABI] Rework member pointer conversion

Member pointers in the MS ABI are made complicated due to the following:
- Virtual methods in the most derived class (MDC) might live in a
  vftable in a virtual base.
- There are four different representations of member pointer: single
  inheritance, multiple inheritance, virtual inheritance and the "most
  general" representation.
- Bases might have a *more* general representation than classes which
  derived from them, a most surprising result.

We believed that we could treat all member pointers as-if they were a
degenerate case of the multiple inheritance model.  This fell apart once
we realized that implementing standard member pointers using this ABI
requires referencing members with a non-zero vbindex.

On a bright note, all but the virtual inheritance model operate rather
similarly.  The virtual inheritance member pointer representation
awkwardly requires a virtual base adjustment in order to refer to
entities in the MDC.

However, the first virtual base might be quite far from the start of the
virtual base.  This means that we must add a negative non-virtual
displacement.

However, things get even more complicated.  The most general
representation interprets vbindex zero differently from the virtual
inheritance model: it doesn't reference the vbtable at all.

It turns out that this complexity can increase for quite some time:
consider a derived to base conversion from the most general model to the
multiple inheritance model...

To manage this complexity we introduce a concept of "normalized" member
pointer which allows us to treat all three models as the most general
model.  Then we try to figure out how to map this generalized member
pointer onto the destination member pointer model.  I've done my best to
furnish the code with comments explaining why each adjustment is
performed.

This fixes PR23878.

llvm-svn: 240384

9 years ago[MS ABI] Refactor member pointer generation
David Majnemer [Tue, 23 Jun 2015 07:31:07 +0000 (07:31 +0000)]
[MS ABI] Refactor member pointer generation

The MS ABI has very complicated member pointers.  Don't attempt to
synthesize the final member pointer ab ovo usque ad mala in one go.

Instead, start with a member pointer which points to the declaration in
question as-if it's decl context was the target class.  Then, utilize
our conversion logical to convert it to the target type.

This allows us to simplify how we think about member pointers because we
don't need to consider non-zero nv adjustments before we even generate
the member pointer.  Furthermore, it gives our adjustment logic more
exposure by utilizing it in a common path.

llvm-svn: 240383

9 years ago[CodeGen] Rename EmitMemberPointer to EmitMemberFunctionPointer
David Majnemer [Tue, 23 Jun 2015 07:31:01 +0000 (07:31 +0000)]
[CodeGen] Rename EmitMemberPointer to EmitMemberFunctionPointer

llvm-svn: 240382

9 years ago[mips] Fix some UB by shifting before sign-extending
Justin Bogner [Tue, 23 Jun 2015 07:28:57 +0000 (07:28 +0000)]
[mips] Fix some UB by shifting before sign-extending

Avoid shifting a negative value by sign-extending after the shift.

Fixes a couple of tests that were failing under ubsan.

llvm-svn: 240381

9 years agotest: Move target dependent test in their own folder for c API test
Justin Bogner [Tue, 23 Jun 2015 06:46:54 +0000 (06:46 +0000)]
test: Move target dependent test in their own folder for c API test

Dissasembly tests depends on target. The problem is that it disable
all tests if all targets are not compiled. This moves things around in
order to get target specific code in a target specific folder.

Patch by Amaury Sechet. Thanks!

llvm-svn: 240380

9 years ago[Sanitizers] Pass the correct arch to the symbolizer for x86_64h
Frederic Riss [Tue, 23 Jun 2015 05:35:19 +0000 (05:35 +0000)]
[Sanitizers] Pass the correct arch to the symbolizer for x86_64h

I have no idea how to directly test that as it depends on a particular
(micro-)architecure of the host processor.
Combined with llvm's r240339 this should fix issues people might have
be seeing intermitently on Darwin haswell machines (the symbolizer
would use the wrong slice of the binary, thus potentially resolving
to the wrong symbol).

llvm-svn: 240379

9 years agoFix PR13851: Preserve metadata for the unswitched branch
Weiming Zhao [Tue, 23 Jun 2015 05:31:09 +0000 (05:31 +0000)]
Fix PR13851: Preserve metadata for the unswitched branch

This patch copies the metadata of the unswitched branch to the newly
crreated branch in loop unswitch pass.

llvm-svn: 240378

9 years ago[OPENMP] Do not emit references to original variables in 'private' clause.
Alexey Bataev [Tue, 23 Jun 2015 04:51:00 +0000 (04:51 +0000)]
[OPENMP] Do not emit references to original variables in 'private' clause.

Currently if the variable is captured in captured region, capture record for this region stores reference to this variable for future use. But we don't need to provide the reference to the original variable if it was explicitly marked as private in the 'private' clause of the OpenMP construct, this variable is replaced by private copy.
Differential Revision: http://reviews.llvm.org/D9550

llvm-svn: 240377

9 years agoEliminate "enumeration value not handled in switch" warnings
Douglas Katzman [Tue, 23 Jun 2015 04:20:44 +0000 (04:20 +0000)]
Eliminate "enumeration value not handled in switch" warnings

(Caused by r240370)

llvm-svn: 240376

9 years agoRemove broken banner.
Rafael Espindola [Tue, 23 Jun 2015 03:45:23 +0000 (03:45 +0000)]
Remove broken banner.

Thanks to Filipe Cabecinhas for noticing.

llvm-svn: 240375

9 years agoAdd a test for the previous commit.
Rafael Espindola [Tue, 23 Jun 2015 03:42:44 +0000 (03:42 +0000)]
Add a test for the previous commit.

This shows how two symbols at the same address are handled.

llvm-svn: 240374

9 years ago[LLDB][MIPS] MIPS32 branch emulation and single-stepping
Jaydeep Patil [Tue, 23 Jun 2015 03:37:08 +0000 (03:37 +0000)]
[LLDB][MIPS] MIPS32 branch emulation and single-stepping

    SUMMARY:
    This patch implements
      1. Emulation of MIPS32 branch instructions
      2. Enable single-stepping for MIPS32 instructions
      3. Correction in emulation of MIPS64 branch instructions with delay slot
      4. Adjust breakpoint address when breakpoint is hit in a forbidden slot of compact branch instruction

    Reviewers: clayborg
    Subscribers: mohit.bhakkad, sagar, bhushan, lldb-commits, emaste, nitesh.jain
    Differential Revision: http://reviews.llvm.org/D10596

llvm-svn: 240373

9 years agoHandle multiple symbols having the same address.
Rafael Espindola [Tue, 23 Jun 2015 03:36:08 +0000 (03:36 +0000)]
Handle multiple symbols having the same address.
I will add an explicit test in a second, but this fixes the bots.

llvm-svn: 240372

9 years agoRevert "Reduced packet counts to the remote GDB server where possible."
Chaoren Lin [Tue, 23 Jun 2015 03:17:01 +0000 (03:17 +0000)]
Revert "Reduced packet counts to the remote GDB server where possible."

This reverts commit 0cc0745ea9c68d7fdcadc9904cee3f13c96dae60.

Due to breakage on Linux build bot:

http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/3436

llvm-svn: 240371

9 years agoChange some if/else chains to 'switch' statements. NFC
Douglas Katzman [Tue, 23 Jun 2015 03:02:39 +0000 (03:02 +0000)]
Change some if/else chains to 'switch' statements. NFC

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

llvm-svn: 240370

9 years ago[InstCombine] Optimize subtract of selects into a select of a sub
David Majnemer [Tue, 23 Jun 2015 02:49:24 +0000 (02:49 +0000)]
[InstCombine] Optimize subtract of selects into a select of a sub

This came up when examining some code generated by clang's IRGen for
certain member pointers.

llvm-svn: 240369

9 years agoFix tests when X86 is not enabled.
Rafael Espindola [Tue, 23 Jun 2015 02:45:44 +0000 (02:45 +0000)]
Fix tests when X86 is not enabled.

llvm-svn: 240368

9 years agoCompute correct symbol sizes for MachO and COFF.
Rafael Espindola [Tue, 23 Jun 2015 02:20:37 +0000 (02:20 +0000)]
Compute correct symbol sizes for MachO and COFF.

Before this would dump from the symbol start to the end of the section.

llvm-svn: 240367

9 years agoExtract an utility for computing symbol sizes on MachO and COFF.
Rafael Espindola [Tue, 23 Jun 2015 02:08:48 +0000 (02:08 +0000)]
Extract an utility for computing symbol sizes on MachO and COFF.

I will add a second user in the next commit.

llvm-svn: 240366

9 years agoAMDGPU: Use getAsInteger instead of atoi
Matt Arsenault [Tue, 23 Jun 2015 02:05:55 +0000 (02:05 +0000)]
AMDGPU: Use getAsInteger instead of atoi

llvm-svn: 240365

9 years ago[FaultMaps] Move FaultMapParser to Object/
Sanjoy Das [Tue, 23 Jun 2015 01:05:26 +0000 (01:05 +0000)]
[FaultMaps] Move FaultMapParser to Object/

Summary:
That way llvm-objdump can rely on it without adding an extra dependency
on CodeGen.

This change duplicates the FaultKind enum and the code that serializes
it to a string.  I could not figure out a way to get around this without
adding a new dependency to Object

Reviewers: rafael, ab

Subscribers: llvm-commits

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

llvm-svn: 240364

9 years agoFix a typo in a comment in FaultMaps.h. NFC.
Sanjoy Das [Tue, 23 Jun 2015 01:05:21 +0000 (01:05 +0000)]
Fix a typo in a comment in FaultMaps.h. NFC.

llvm-svn: 240363

9 years agollvm/tools/llvm-objdump/CMakeLists.txt: Update libdeps to fix r240304.
NAKAMURA Takumi [Tue, 23 Jun 2015 00:59:12 +0000 (00:59 +0000)]
llvm/tools/llvm-objdump/CMakeLists.txt: Update libdeps to fix r240304.

llvm-svn: 240362

9 years ago[x86] generalize reassociation optimization in machine combiner to 2 instructions
Sanjay Patel [Tue, 23 Jun 2015 00:39:40 +0000 (00:39 +0000)]
[x86] generalize reassociation optimization in machine combiner to 2 instructions

Currently ( D10321, http://reviews.llvm.org/rL239486 ), we can use the machine combiner pass
to reassociate the following sequence to reduce the critical path:

A = ? op ?
B = A op X
C = B op Y
-->
A = ? op ?
B = X op Y
C = A op B

'op' is currently limited to x86 AVX scalar FP adds (with fast-math on), but in theory, it could
be any associative math/logic op (see TODO in code comment).

This patch generalizes the pattern match to ignore the instruction that defines 'A'. So instead of
a sequence of 3 adds, we now only need to find 2 dependent adds and decide if it's worth
reassociating them.

This generalization has a compile-time cost because we can now match more instruction sequences
and we rely more heavily on the machine combiner to discard sequences where reassociation doesn't
improve the critical path.

For example, in the new test case:

A = M div N
B = A add X
C = B add Y

We'll match 2 reassociation patterns, but this transform doesn't reduce the critical path:

A = M div N
B = A add Y
C = B add X

We need the combiner to reject that pattern but select this:

A = M div N
B = X add Y
C = B add A

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

llvm-svn: 240361

9 years agoRe-apply "InstrProf: When reading, copy the data instead of taking a reference. NFC"
Justin Bogner [Mon, 22 Jun 2015 23:58:05 +0000 (23:58 +0000)]
Re-apply "InstrProf: When reading, copy the data instead of taking a reference. NFC"

This version fixes a missing include that MSVC noticed and
clarifies the ownership of the counter buffer that's passed to
InstrProfRecord.

This restores r240206, which was reverted in r240208.

Patch by Betul Buyukkurt.

llvm-svn: 240360

9 years agoInstrProf: Add a test for multiple copies of the same with different hashes
Justin Bogner [Mon, 22 Jun 2015 23:56:53 +0000 (23:56 +0000)]
InstrProf: Add a test for multiple copies of the same with different hashes

This functionality wasn't being tested.

Patch by Betul Buyukkurt.

llvm-svn: 240359

9 years agoCreate Value.def helper. NFC.
Pete Cooper [Mon, 22 Jun 2015 23:48:35 +0000 (23:48 +0000)]
Create Value.def helper.  NFC.

This is similar to Metadata.def and Instructions.def but for Value's.

It will be used in upcoming commits to devirtualize the Value class.

Reviewed by Duncan Exon Smith.

llvm-svn: 240358

9 years agoFix PR23914.
Evgeniy Stepanov [Mon, 22 Jun 2015 23:36:03 +0000 (23:36 +0000)]
Fix PR23914.

r226830 moved the declaration of Buf to a nested scope, resulting
in a dangling reference (in StringRef Name), and a use-after-free.

llvm-svn: 240357

9 years ago[CMake] Respect the value of -mmacosx-version-min flag.
Alexey Samsonov [Mon, 22 Jun 2015 23:30:28 +0000 (23:30 +0000)]
[CMake] Respect the value of -mmacosx-version-min flag.

Make sure that sanitizer runtimes target OS X version provided in
-mmacosx-version-min= flag. Enforce that it should be at least 10.7.

llvm-svn: 240356

9 years agoCode cleanup: Remove std::move() around xvalue (NFC)
Logan Chien [Mon, 22 Jun 2015 23:16:02 +0000 (23:16 +0000)]
Code cleanup: Remove std::move() around xvalue (NFC)

Remove std::move() around xvalue so that copy elision is eligible.
In case that copy elision is not appliable, the c++ standard also
guarantees the move semantics on xvalue.  Thus, it is not necessary
to wrap Args with std::move.

This also silence a warning since r240345.

llvm-svn: 240355

9 years agoReduced packet counts to the remote GDB server where possible.
Greg Clayton [Mon, 22 Jun 2015 23:12:45 +0000 (23:12 +0000)]
Reduced packet counts to the remote GDB server where possible.

We have been working on reducing the packet count that is sent between LLDB and the debugserver on MacOSX and iOS. Our approach to this was to reduce the packets required when debugging multiple threads. We currently make one qThreadStopInfoXXXX call (where XXXX is the thread ID in hex) per thread except the thread that stopped with a stop reply packet. In order to implement multiple thread infos in a single reply, we need to use structured data, which means JSON. The new jThreadsInfo packet will attempt to retrieve all thread infos in a single packet. The data is very similar to the stop reply packets, but packaged in JSON and uses JSON arrays where applicable. The JSON output looks like:

[
  { "tid":1580681,
    "metype":6,
    "medata":[2,0],
    "reason":"exception",
    "qaddr":140735118423168,
    "registers": {
      "0":"8000000000000000",
      "1":"0000000000000000",
      "2":"20fabf5fff7f0000",
      "3":"e8f8bf5fff7f0000",
      "4":"0100000000000000",
      "5":"d8f8bf5fff7f0000",
      "6":"b0f8bf5fff7f0000",
      "7":"20f4bf5fff7f0000",
      "8":"8000000000000000",
      "9":"61a8db78a61500db",
      "10":"3200000000000000",
      "11":"4602000000000000",
      "12":"0000000000000000",
      "13":"0000000000000000",
      "14":"0000000000000000",
      "15":"0000000000000000",
      "16":"960b000001000000",
      "17":"0202000000000000",
      "18":"2b00000000000000",
      "19":"0000000000000000",
      "20":"0000000000000000"},
    "memory":[
      {"address":140734799804592,"bytes":"c8f8bf5fff7f0000c9a59e8cff7f0000"},
      {"address":140734799804616,"bytes":"00000000000000000100000000000000"}
    ]
  }
]

It contains an array of dicitionaries with all of the key value pairs that are normally in the stop reply packet. Including the expedited registers. Notice that is also contains expedited memory in the "memory" key. Any values in this memory will get included in a new L1 cache in lldb_private::Process where if a memory read request is made and that memory request fits into one of the L1 memory cache blocks, it will use that memory data. If a memory request fails in the L1 cache, it will fall back to the L2 cache which is the same block sized caching we were using before these changes. This allows a process to expedite memory that you are likely to use and it reduces packet count. On MacOSX with debugserver, we expedite the frame pointer backchain for a thread (up to 256 entries) by reading 2 pointers worth of bytes at the frame pointer (for the previous FP and PC), and follow the backchain. Most backtraces on MacOSX and iOS now don't require us to read any memory!

We will try these packets out and if successful, we should port these to lldb-server in the near future.

<rdar://problem/21494354>

llvm-svn: 240354

9 years agoRevert r240270 ("Fixed/added namespace ending comments using clang-tidy").
Alexander Kornienko [Mon, 22 Jun 2015 23:07:51 +0000 (23:07 +0000)]
Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").

llvm-svn: 240353

9 years ago[LoopDist] Improve variable names and comments in LoopVersioning class, NFC
Adam Nemet [Mon, 22 Jun 2015 22:59:40 +0000 (22:59 +0000)]
[LoopDist] Improve variable names and comments in LoopVersioning class, NFC

As with the previous patch, the goal is to turn the class into a general
loop-versioning class.  This patch removes any references to loop
distribution.

llvm-svn: 240352

9 years agoFix a crasher on the MacOSX test suite for Objective C.
Greg Clayton [Mon, 22 Jun 2015 22:35:07 +0000 (22:35 +0000)]
Fix a crasher on the MacOSX test suite for Objective C.

llvm-svn: 240351

9 years ago[modules] When building a module, if there are multiple matches for a header
Richard Smith [Mon, 22 Jun 2015 22:20:47 +0000 (22:20 +0000)]
[modules] When building a module, if there are multiple matches for a header
file in the loaded module maps and one of them is from the current module,
that's the right match.

llvm-svn: 240350

9 years agoUpdate for LLVM API change to return by InputArgList directly (rather than by pointer...
David Blaikie [Mon, 22 Jun 2015 22:07:27 +0000 (22:07 +0000)]
Update for LLVM API change to return by InputArgList directly (rather than by pointer) from ParseArgs

llvm-svn: 240349

9 years agoUpdate for LLVM API change to return by InputArgList directly (rather than by pointer...
David Blaikie [Mon, 22 Jun 2015 22:06:58 +0000 (22:06 +0000)]
Update for LLVM API change to return by InputArgList directly (rather than by pointer) from ParseArgs

llvm-svn: 240348

9 years agoUpdate for LLVM API change to return by InputArgList directly (rather than by pointer...
David Blaikie [Mon, 22 Jun 2015 22:06:52 +0000 (22:06 +0000)]
Update for LLVM API change to return by InputArgList directly (rather than by pointer) from ParseArgs

llvm-svn: 240347

9 years agoFix missed formatting in prior commit (mostly 80 cols violation and some whitespace...
David Blaikie [Mon, 22 Jun 2015 22:06:48 +0000 (22:06 +0000)]
Fix missed formatting in prior commit (mostly 80 cols violation and some whitespace around *)

llvm-svn: 240346

9 years agoModify ParseArgs to return the InputArgList by value - there's no need for dynamic...
David Blaikie [Mon, 22 Jun 2015 22:06:37 +0000 (22:06 +0000)]
Modify ParseArgs to return the InputArgList by value - there's no need for dynamic allocation/ownership here

The one caller that does anything other than keep this variable on the
stack is the single use of DerivedArgList in Clang, which is a bit more
interesting but can probably be cleaned up/simplified a bit further
(have DerivedArgList take ownership of the InputArgList rather than
needing to reference its Args indirectly) which I'll try to after this.

llvm-svn: 240345

9 years ago[CMake] Treating LLVM_INCLUDE_TOOLS, which is a bool, as a string to change behaviors...
Chris Bieneman [Mon, 22 Jun 2015 21:58:02 +0000 (21:58 +0000)]
[CMake] Treating LLVM_INCLUDE_TOOLS, which is a bool, as a string to change behaviors of the build is a dirty hack. We shouldn't do it.

Summary: I don't think anyone is relying on this behavior for bootstrapping (because I don't think it works), but if you do need it, speak now or forever hold your peace.

Reviewers: chapuni, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 240344

9 years agoRevert r240291: causes problems in self-hosted builds.
Pawel Bylica [Mon, 22 Jun 2015 21:54:07 +0000 (21:54 +0000)]
Revert r240291: causes problems in self-hosted builds.

llvm-svn: 240343

9 years ago[X86][FMA4] FMA4 ops can perform unaligned folded loads.
Simon Pilgrim [Mon, 22 Jun 2015 21:49:41 +0000 (21:49 +0000)]
[X86][FMA4] FMA4 ops can perform unaligned folded loads.

llvm-svn: 240342

9 years agoLinker: Do not expect comdat to exist in source module.
Peter Collingbourne [Mon, 22 Jun 2015 21:46:51 +0000 (21:46 +0000)]
Linker: Do not expect comdat to exist in source module.

llvm-svn: 240341

9 years agoFix line endings (NFC)
Joseph Tremoulet [Mon, 22 Jun 2015 21:37:34 +0000 (21:37 +0000)]
Fix line endings (NFC)

I inadvertently checked these in with Windows-style line
endings in r240288.

llvm-svn: 240340

9 years ago[Object] Search for architecures by name in MachOUniversalBinary::getObjectForArch()
Frederic Riss [Mon, 22 Jun 2015 21:33:24 +0000 (21:33 +0000)]
[Object] Search for architecures by name in MachOUniversalBinary::getObjectForArch()

The reason we need to search by name rather than by Triple::ArchType
is to handle subarchitecture correclty. There is no different ArchType
for the x86_64h architecture (it identifies itself as x86_64), or for
the various ARM subarches. The only way to get to the subarch slice
in an universal binary is to search by name.

This issue led to hard to debug and transient symbolication failures
in Asan tests (it mostly works, because the files are very similar).

This also affects the Profiling infrastucture as it is the other user
of that API.

Reviewers: samsonov, bogner

Subscribers: llvm-commits

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

llvm-svn: 240339

9 years ago[CodeGen] Teach X86_64ABIInfo about AVX512.
Ahmed Bougacha [Mon, 22 Jun 2015 21:31:43 +0000 (21:31 +0000)]
[CodeGen] Teach X86_64ABIInfo about AVX512.

As specified in the SysV AVX512 ABI drafts. It follows the same scheme
as AVX2:

    Arguments of type __m512 are split into eight eightbyte chunks.
    The least significant one belongs to class SSE and all the others
    to class SSEUP.

This also means we change the OpenMP SIMD default alignment on AVX512.

Based on r240337.
Differential Revision: http://reviews.llvm.org/D9894

llvm-svn: 240338

9 years ago[CodeGen] Use enum for AVX level in X86*TargetCodeGenInfo. NFCI.
Ahmed Bougacha [Mon, 22 Jun 2015 21:30:39 +0000 (21:30 +0000)]
[CodeGen] Use enum for AVX level in X86*TargetCodeGenInfo. NFCI.

Follow-up to r237989: expressing the AVX level as an enum makes it
simple to extend it with AVX512.

llvm-svn: 240337

9 years agoSet missing x86 arch in a CodeGen regression test.
Pawel Bylica [Mon, 22 Jun 2015 21:18:10 +0000 (21:18 +0000)]
Set missing x86 arch in a CodeGen regression test.

Fixes the regression test added in r240291.

llvm-svn: 240336

9 years ago[modules] Add a flag to disable the feature that permits conflicting redefinitions...
Richard Smith [Mon, 22 Jun 2015 21:15:01 +0000 (21:15 +0000)]
[modules] Add a flag to disable the feature that permits conflicting redefinitions of internal-linkage symbols that are not visible.

Such conflicts are an accident waiting to happen, and this feature conflicts
with the desire to include existing headers into multiple modules and merge the
results. (In an ideal world, it should not be possible to export internal
linkage symbols from a module, but sadly the glibc and libstdc++ headers
provide 'static inline' functions in a few cases.)

llvm-svn: 240335

9 years agotest-release.sh: Minor fixes.
Hans Wennborg [Mon, 22 Jun 2015 21:13:30 +0000 (21:13 +0000)]
test-release.sh: Minor fixes.

llvm-svn: 240334

9 years ago[X86][AVX2] Added missing stack folding tests for vpshufhw/vpshuflw
Simon Pilgrim [Mon, 22 Jun 2015 21:10:42 +0000 (21:10 +0000)]
[X86][AVX2] Added missing stack folding tests for vpshufhw/vpshuflw

llvm-svn: 240332

9 years agoR600/SI: Use ELF64 format instead of ELF32
Tom Stellard [Mon, 22 Jun 2015 21:03:54 +0000 (21:03 +0000)]
R600/SI: Use ELF64 format instead of ELF32

Reviewers: arsenm, rafael

Subscribers: llvm-commits

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

llvm-svn: 240331

9 years agoR600: Use EM_AMDGPU for the ELF Machine type
Tom Stellard [Mon, 22 Jun 2015 21:03:52 +0000 (21:03 +0000)]
R600: Use EM_AMDGPU for the ELF Machine type

Reviewers: arsenm, rafael

Subscribers: llvm-commits

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

llvm-svn: 240330

9 years agoSupport/ELF: Add EM_AMDGPU
Tom Stellard [Mon, 22 Jun 2015 21:03:47 +0000 (21:03 +0000)]
Support/ELF: Add EM_AMDGPU

Summary: This will be used by the R600 backend.

Reviewers: chandlerc, rafael

Subscribers: llvm-commits

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

llvm-svn: 240329

9 years agoAdd comment about the importance of being adjacent. NFC
Douglas Katzman [Mon, 22 Jun 2015 20:55:31 +0000 (20:55 +0000)]
Add comment about the importance of being adjacent. NFC

llvm-svn: 240328

9 years agoAdding some more flakey tests to the XFAIL list
Vince Harron [Mon, 22 Jun 2015 20:54:14 +0000 (20:54 +0000)]
Adding some more flakey tests to the XFAIL list

llvm-svn: 240327

9 years ago[X86] Teach load folding to accept scalar _Int users of MOVSS/MOVSD.
Ahmed Bougacha [Mon, 22 Jun 2015 20:51:51 +0000 (20:51 +0000)]
[X86] Teach load folding to accept scalar _Int users of MOVSS/MOVSD.

The _Int instructions are special, in that they operate on the full
VR128 instead of FR32.  The load folding then looks at MOVSS, at the
user, and bails out when it sees a size mismatch.

What we really know is that the rm_Int instructions don't load the
higher lanes, so folding is fine.

This happens for the straightforward intrinsic code, e.g.:

    _mm_add_ss(a, _mm_load_ss(p));

Fixes PR23349.

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

llvm-svn: 240326

9 years agoEnhance lldb-mi arguments test (MI)
Dawn Perchik [Mon, 22 Jun 2015 20:41:57 +0000 (20:41 +0000)]
Enhance lldb-mi arguments test (MI)

SUMMARY:
Add additional arguments to lldb-mi args tests to make sure arguments with quotes are handled correctly.

Reviewers: ki.stfu
Subscribers: lldb-commits
Test Plan:
    ./dotest.py --executable lldb -f MiInterpreterExecTestCase.test_lldbmi_settings_set_target_run_args_before
    ./dotest.py --executable lldb -f MiInterpreterExecTestCase.test_lldbmi_settings_set_target_run_args_after
Differential Revision: http://reviews.llvm.org/D10523

llvm-svn: 240325

9 years agoMIR Serialization: Introduce a lexer for machine instructions.
Alex Lorenz [Mon, 22 Jun 2015 20:37:46 +0000 (20:37 +0000)]
MIR Serialization: Introduce a lexer for machine instructions.

This commit adds a function that tokenizes the string containing
the machine instruction. This commit also adds a struct called
'MIToken' which is used to represent the lexer's tokens.

Reviewers: Sean Silva

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

llvm-svn: 240323

9 years agoUse C99 to compile ISL
Michael Kruse [Mon, 22 Jun 2015 20:31:16 +0000 (20:31 +0000)]
Use C99 to compile ISL

ISL with small integer optimization requires C99 to compile. gcc < 5.0
still uses C89 as default, so we need to enable the options to compile
in C99 mode.

This patch is preparing the actual activation of small integer
optimization.

Differential version: http://reviews.llvm.org/D10610

Reviewers: grosser
llvm-svn: 240322

9 years agoSafeStack: Create the unsafe stack pointer on demand.
Peter Collingbourne [Mon, 22 Jun 2015 20:26:54 +0000 (20:26 +0000)]
SafeStack: Create the unsafe stack pointer on demand.

This avoids creating an unnecessary undefined reference on targets such as
NVPTX that require such references to be declared in asm output.

llvm-svn: 240321

9 years agoMove MCSymbol Value in to the union of Offset and CommonSize.
Pete Cooper [Mon, 22 Jun 2015 19:57:33 +0000 (19:57 +0000)]
Move MCSymbol Value in to the union of Offset and CommonSize.

This is a reapplication of r239440 which was reverted in r239441.
There are no changes to this patch from then, but this had instead exposed
a bug in .thumb_set which was fixed in r240318.  Having fixed that bug, it
is now safe to re-apply this code.

Original commit message below:

It wasn't possible to have a variable Symbol with offset or 'isCommon' so
this just enables better packing of the MCSymbol class.

Reviewed by Rafael Espindola.

llvm-svn: 240320

9 years agoCOFF: Separate DefinedCOMDAT from DefinedRegular symbol type. NFC.
Rui Ueyama [Mon, 22 Jun 2015 19:56:01 +0000 (19:56 +0000)]
COFF: Separate DefinedCOMDAT from DefinedRegular symbol type. NFC.

Before this change, you got to cast a symbol to DefinedRegular and then
call isCOMDAT() to determine if a given symbol is a COMDAT symbol.
Now you can just use isa<DefinedCOMDAT>().

As to the class definition of DefinedCOMDAT, I could remove duplicate
code from DefinedRegular and DefinedCOMDAT by introducing another base
class for them, but I chose to not do that to keep the class hierarchy
shallow. This amount of code duplication doesn't worth to define a new
class.

llvm-svn: 240319