oota-llvm.git
9 years agoFix a bugs in the Mach-O disassembler when disassembling from a
Kevin Enderby [Sat, 10 Oct 2015 00:05:01 +0000 (00:05 +0000)]
Fix a bugs in the Mach-O disassembler when disassembling from a
malformed Mach-O file that caused a crash.  This was because of an
assert where the code was incorrectly attempting to parse relocation
entries off of the sections and the filetype was not an MH_OBJECT.

rdar://22983603

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249921 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WinEH] Remove more dead code
David Majnemer [Sat, 10 Oct 2015 00:04:29 +0000 (00:04 +0000)]
[WinEH] Remove more dead code

wineh-parent is dead, so is ValueOrMBB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249920 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WinEH] Delete the old landingpad implementation of Windows EH
Reid Kleckner [Fri, 9 Oct 2015 23:34:53 +0000 (23:34 +0000)]
[WinEH] Delete the old landingpad implementation of Windows EH

The new implementation works at least as well as the old implementation
did.

Also delete the associated preparation tests. They don't exercise
interesting corner cases of the new implementation. All the codegen
tests of the EH tables have already been ported.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249918 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SEH] Update SEH codegen tests to use the new IR
Reid Kleckner [Fri, 9 Oct 2015 23:05:54 +0000 (23:05 +0000)]
[SEH] Update SEH codegen tests to use the new IR

Also Fix a buglet where SEH tables had ranges that spanned funclets.

The remaining tests using the old landingpad IR are preparation tests,
and will be deleted along with the old preparation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249917 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Remove implicit ilist iterator conversions, NFC
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 22:56:24 +0000 (22:56 +0000)]
CodeGen: Remove implicit ilist iterator conversions, NFC

Finish removing implicit ilist iterator conversions from LLVMCodeGen.
I'm sure there are lots more of these in lib/CodeGen/*/.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249915 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CMake] Parallel make breaks on native tablegen
Chris Bieneman [Fri, 9 Oct 2015 22:26:04 +0000 (22:26 +0000)]
[CMake] Parallel make breaks on native tablegen

Patch by Alex Wang

This patch resolves a parallelization issue that occurs when native tablegen targets are built at the same time. They both try to build libSupport and clobber each other causing the builds to fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249911 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WinEH] Insert the catchpad return before CSR restoration
David Majnemer [Fri, 9 Oct 2015 22:18:45 +0000 (22:18 +0000)]
[WinEH] Insert the catchpad return before CSR restoration

x64 catchpads use rax to inform the unwinder where control should go
next.  However, we must initialize rax before the epilogue sequence so
as to not perturb the unwinder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249910 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix use of uninitialized bool, found by ubsan in portion of
Richard Smith [Fri, 9 Oct 2015 22:09:56 +0000 (22:09 +0000)]
Fix use of uninitialized bool, found by ubsan in portion of
test/tools/llvm-objdump/malformed-machos.test added in r249845.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249909 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix assert when emitting llvm.pow.f86.
James Y Knight [Fri, 9 Oct 2015 21:36:19 +0000 (21:36 +0000)]
Fix assert when emitting llvm.pow.f86.

This occurred due to introducing the invalid i64 type after type
legalization had already finished, in an attempt to workaround bitcast
f64 -> v2i32 not doing constant folding.

The *right* thing is to actually fix bitcast, but that has other
complications. So, for now, just get rid of the broken workaround, and
check in a test-case showing that it doesn't crash, with TODOs for
emitting proper code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249908 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove unused function in sample profile writer API - NFC.
Diego Novillo [Fri, 9 Oct 2015 21:33:13 +0000 (21:33 +0000)]
Remove unused function in sample profile writer API - NFC.

These functions are not needed and are getting in the way of changes
for implementing a table of contents for the binary format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249907 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SEH] Fix _except_handler4 table base states
Reid Kleckner [Fri, 9 Oct 2015 21:27:28 +0000 (21:27 +0000)]
[SEH] Fix _except_handler4 table base states

We got them right for the old IR, but not with funclets.  Port the old
test to the new IR and fix the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249906 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Avoid more ilist iterator implicit conversions, NFC
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 21:08:19 +0000 (21:08 +0000)]
CodeGen: Avoid more ilist iterator implicit conversions, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249903 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Use range-based for in PostRAScheduler, NFC
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 21:05:00 +0000 (21:05 +0000)]
CodeGen: Use range-based for in PostRAScheduler, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249901 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SEH] Remember to emit the last invoke range for SEH
Reid Kleckner [Fri, 9 Oct 2015 20:39:39 +0000 (20:39 +0000)]
[SEH] Remember to emit the last invoke range for SEH

This wasn't very observable in execution tests, because usually there is
an invoke in the catchpad that unwinds the the catchendpad but never
actually throws.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249898 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoGeneralize convergent check to handle invokes as well as calls.
Owen Anderson [Fri, 9 Oct 2015 20:17:46 +0000 (20:17 +0000)]
Generalize convergent check to handle invokes as well as calls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249892 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix assert in X86 backend.
James Y Knight [Fri, 9 Oct 2015 20:10:14 +0000 (20:10 +0000)]
Fix assert in X86 backend.

When running combine on an extract_vector_elt, it wants to look through
a bitcast to check if the argument to the bitcast was itself an
extract_vector_elt with particular operands.

However, it called getOperand() on the argument to the bitcast *before*
checking that the opcode was EXTRACT_VECTOR_ELT, assert-failing if there
were zero operands for the actual opcode.

Fix, and add trivial test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249891 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Simplify code. NFC."
Chad Rosier [Fri, 9 Oct 2015 19:48:48 +0000 (19:48 +0000)]
Revert "Simplify code.  NFC."

This reverts commit r248610.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249887 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Continue removing ilist iterator implicit conversions
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 19:40:45 +0000 (19:40 +0000)]
CodeGen: Continue removing ilist iterator implicit conversions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249884 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Remove implicit iterator conversions from MBB.cpp
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 19:36:12 +0000 (19:36 +0000)]
CodeGen: Remove implicit iterator conversions from MBB.cpp

Remove implicit ilist iterator conversions from MachineBasicBlock.cpp.

I've also added an overload of `splice()` that takes a pointer, since
it's a natural API.  This is similar to the overloads I added for
`remove()` and `erase()` in r249867.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249883 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Avoid ilist iterator implicit conversions in a few more places, NFC
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 19:23:20 +0000 (19:23 +0000)]
CodeGen: Avoid ilist iterator implicit conversions in a few more places, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249880 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Remove more ilist iterator implicit conversions, NFC
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 19:13:58 +0000 (19:13 +0000)]
CodeGen: Remove more ilist iterator implicit conversions, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249879 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Use range-based for in IntrinsicLowering::AddPrototypes, NFC
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 19:07:41 +0000 (19:07 +0000)]
CodeGen: Use range-based for in IntrinsicLowering::AddPrototypes, NFC

This happens to avoid a host of implicit ilist iterator conversions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249877 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Use range-based for in GlobalMerge, NFC
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 18:57:47 +0000 (18:57 +0000)]
CodeGen: Use range-based for in GlobalMerge, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249876 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Remove a few more ilist iterator implicit conversions, NFC
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 18:44:40 +0000 (18:44 +0000)]
CodeGen: Remove a few more ilist iterator implicit conversions, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249875 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoTeach LoopUnswitch not to perform non-trivial unswitching on loops containing converg...
Owen Anderson [Fri, 9 Oct 2015 18:40:20 +0000 (18:40 +0000)]
Teach LoopUnswitch not to perform non-trivial unswitching on loops containing convergent operations.

Doing so could cause the post-unswitching convergent ops to be
control-dependent on the unswitch condition where they were not before.
This check could be refined to allow unswitching where the convergent
operation was already control-dependent on the unswitch condition.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249874 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd iterator ranges for blocks in a Loop.
Owen Anderson [Fri, 9 Oct 2015 18:40:15 +0000 (18:40 +0000)]
Add iterator ranges for blocks in a Loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249873 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Remove implicit iterator conversions from SlotIndexes.h, NFC
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 18:35:09 +0000 (18:35 +0000)]
CodeGen: Remove implicit iterator conversions from SlotIndexes.h, NFC

Be explicit about changes between pointers and iterators, as with other
recent commits.  This transitively removes implicit ilist iterator
conversions from about 20 source files in CodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249869 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Remove implicit conversions from Analysis and BranchFolding
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 18:23:49 +0000 (18:23 +0000)]
CodeGen: Remove implicit conversions from Analysis and BranchFolding

Remove a few more implicit ilist iterator conversions, this time from
Analysis.cpp and BranchFolding.cpp.

I added a few overloads for `remove()` and `erase()`, which quite
naturally take pointers as well as iterators as parameters.  This will
reduce the churn at least in the short term, but I don't really have a
problem with these existing for longer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249867 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefine the definition of convergent to only disallow the addition of new control...
Owen Anderson [Fri, 9 Oct 2015 18:06:13 +0000 (18:06 +0000)]
Refine the definition of convergent to only disallow the addition of new control dependencies.

This covers the common case of operations that cannot be sunk.
Operations that cannot be hoisted should already be handled properly via
the safe-to-speculate rules and mechanisms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249865 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agofix typos; NFC
Sanjay Patel [Fri, 9 Oct 2015 18:01:03 +0000 (18:01 +0000)]
fix typos; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249863 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CMake] If LLVM_DYLIB_EXPORT_ALL is On don't generate an export list at all, just...
Chris Bieneman [Fri, 9 Oct 2015 17:55:21 +0000 (17:55 +0000)]
[CMake] If LLVM_DYLIB_EXPORT_ALL is On don't generate an export list at all, just export the world.

This should resolve Bug 24157 - CMake built shared library does not export all public symbols

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249862 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd inline stack streaming to binary sample profiles.
Diego Novillo [Fri, 9 Oct 2015 17:54:24 +0000 (17:54 +0000)]
Add inline stack streaming to binary sample profiles.

With this patch we can now read and write inline stacks in sample
profiles to the binary encoded profiles.

In a subsequent patch, I will add a string table to the binary encoding.
Right now function names are emitted as strings every time we find them.
This is too bloated and will produce large files in applications with
lots of inlining.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249861 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WebAssembly] Rename floating-point operators to match their spec names.
Dan Gohman [Fri, 9 Oct 2015 17:50:00 +0000 (17:50 +0000)]
[WebAssembly] Rename floating-point operators to match their spec names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249859 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd verification for align, dereferenceable, dereferenceable_or_null load metadata
Artur Pilipenko [Fri, 9 Oct 2015 17:41:29 +0000 (17:41 +0000)]
Add verification for align, dereferenceable, dereferenceable_or_null load metadata

Reviewed By: reames

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249856 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoClear SectionSymbols in MCContext::Reset
Keno Fischer [Fri, 9 Oct 2015 17:24:54 +0000 (17:24 +0000)]
Clear SectionSymbols in MCContext::Reset

This was just forgotten when SectionSymbols was introduced and could cause
corruption if the MCContext was reused after Reset.

Reviewers: rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249854 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAArch64: Make getNextNode() cleanup in r249764 more clear
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 16:54:54 +0000 (16:54 +0000)]
AArch64: Make getNextNode() cleanup in r249764 more clear

After r249764, if you didn't see the full context, it looked like
`std::next(I)` would get the same result as
`++MachineBasicBlock::iterator(I)`.  However, `I` is a `MachineInstr*`
(not a `MachineBasicBlock::iterator`).

Use the `getIterator()` helper I added later (r249782) to make this code
more clear.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249852 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Start removing implicit conversions to/from list iterators, NFC
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 16:54:49 +0000 (16:54 +0000)]
CodeGen: Start removing implicit conversions to/from list iterators, NFC

Start removing implicit conversions to/from list iterators in CodeGen,
ala r249782 for IR.  A lot more to go after this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249851 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Support: Partially revert r249782 to unbreak clang build"
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 16:51:23 +0000 (16:51 +0000)]
Revert "Support: Partially revert r249782 to unbreak clang build"

This reverts commit r249783, fully reinstating r249782.  I've fixed the
bug in clang: it was a non-const iterator that dereferenced to const
(but had an implicit conversion to non-const).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249850 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMake HeaderLineno a local variable.
Dehao Chen [Fri, 9 Oct 2015 16:50:16 +0000 (16:50 +0000)]
Make HeaderLineno a local variable.

http://reviews.llvm.org/D13576

As we are using hierarchical profile, there is no need to keep HeaderLineno a member variable. This is because each level of the inline stack will have its own header lineno. One should use the head lineno of its own inline stack level instead of the actual symbol.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249848 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix pdb.test when python is not on PATH
Reid Kleckner [Fri, 9 Oct 2015 16:49:56 +0000 (16:49 +0000)]
Fix pdb.test when python is not on PATH

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249847 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFixed two bugs in llvm-objdump’s printing of Objective-C meta data
Kevin Enderby [Fri, 9 Oct 2015 16:48:44 +0000 (16:48 +0000)]
Fixed two bugs in llvm-objdump’s printing of Objective-C meta data
from malformed Mach-O files that caused crashes.  The first because the
offset in a dyld bind table entry was out of range.  The second because their
was no image info section and the routine printing it did not have the
need check to see the section did not exist.

rdar://22983603

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249845 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoValueTracking: use getAlignment in isAligned
Artur Pilipenko [Fri, 9 Oct 2015 15:58:26 +0000 (15:58 +0000)]
ValueTracking: use getAlignment in isAligned

Reviewed By: reames

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249841 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[dsymutil] Prevent warning
Frederic Riss [Fri, 9 Oct 2015 15:04:05 +0000 (15:04 +0000)]
[dsymutil] Prevent warning

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249836 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoImprove ISel across lane float min/max reduction
Jun Bum Lim [Fri, 9 Oct 2015 14:11:25 +0000 (14:11 +0000)]
Improve ISel across lane float min/max reduction

In vectorized float min/max reduction code, the final "reduce" step
is sub-optimal. In AArch64, this change wll combine :

  svn0 = vector_shuffle t0, undef<2,3,u,u>
  fmin = fminnum t0,svn0
  svn1 = vector_shuffle fmin, undef<1,u,u,u>
  cc = setcc fmin, svn1, ole
  n0 = extract_vector_elt cc, #0
  n1 = extract_vector_elt fmin, #0
  n2 = extract_vector_elt fmin, #1
  result = select n0, n1,n2
into :
  result = llvm.aarch64.neon.fminnmv t0

This change extends r247575.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249834 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SystemZ] Remove unused code in SystemZElimCompare.cpp
Jonas Paulsson [Fri, 9 Oct 2015 11:27:44 +0000 (11:27 +0000)]
[SystemZ] Remove unused code in SystemZElimCompare.cpp

The Reference IndirectDef and IndirectUse members were unused and therefore
removed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249824 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoVector element extraction without stack operations on Power 8
Nemanja Ivanovic [Fri, 9 Oct 2015 11:12:18 +0000 (11:12 +0000)]
Vector element extraction without stack operations on Power 8

This patch corresponds to review:
http://reviews.llvm.org/D12032

This patch builds onto the patch that provided scalar to vector conversions
without stack operations (D11471).
Included in this patch:

    - Vector element extraction for all vector types with constant element number
    - Vector element extraction for v16i8 and v8i16 with variable element number
    - Removal of some unnecessary COPY_TO_REGCLASS operations that ended up
      unnecessarily moving things around between registers

Not included in this patch (will be in upcoming patch):

    - Vector element extraction for v4i32, v4f32, v2i64 and v2f64 with
      variable element number
    - Vector element insertion for variable/constant element number

Testing is provided for all extractions. The extractions that are not
implemented yet are just placeholders.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249822 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[MemCpyOpt] Fix wrong merging adjacent nontemporal stores into memset calls.
Andrea Di Biagio [Fri, 9 Oct 2015 10:53:41 +0000 (10:53 +0000)]
[MemCpyOpt] Fix wrong merging adjacent nontemporal stores into memset calls.

Pass MemCpyOpt doesn't check if a store instruction is nontemporal.
As a consequence, adjacent nontemporal stores are always merged into a
memset call.

Example:

;;;
define void @foo(<4 x float>* nocapture %p) {
entry:
  store <4 x float> zeroinitializer, <4 x float>* %p, align 16, !nontemporal !0
  %p1 = getelementptr inbounds <4 x float>, <4 x float>* %dst, i64 1
  store <4 x float> zeroinitializer, <4 x float>* %p1, align 16, !nontemporal !0
  ret void
}

!0 = !{i32 1}
;;;

In this example, the two nontemporal stores are combined to a memset of zero
which does not preserve the nontemporal hint. Later on the backend (tested on a
x86-64 corei7) expands that memset call into a sequence of two normal 16-byte
aligned vector stores.

opt -memcpyopt example.ll -S -o - | llc -mcpu=corei7 -o -

Before:
  xorps  %xmm0, %xmm0
  movaps  %xmm0, 16(%rdi)
  movaps  %xmm0, (%rdi)

With this patch, we no longer merge nontemporal stores into calls to memset.
In this example, llc correctly expands the two stores into two movntps:
  xorps  %xmm0, %xmm0
  movntps %xmm0, 16(%rdi)
  movntps  %xmm0, (%rdi)

In theory, we could extend the usage of !nontemporal metadata to memcpy/memset
calls. However a change like that would only have the effect of forcing the
backend to expand !nontemporal memsets back to sequences of store instructions.
A memset library call would not have exactly the same semantic of a builtin
!nontemporal memset call. So, SelectionDAG will have to conservatively expand
it back to a sequence of !nontemporal stores (effectively undoing the merging).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249820 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[EarlyCSE] Address post commit review for r249523.
Arnaud A. de Grandmaison [Fri, 9 Oct 2015 09:23:01 +0000 (09:23 +0000)]
[EarlyCSE] Address post commit review for r249523.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249814 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SystemZ] Remove superfluous braces in SystemZShortenInst.cpp
Jonas Paulsson [Fri, 9 Oct 2015 07:19:20 +0000 (07:19 +0000)]
[SystemZ] Remove superfluous braces in SystemZShortenInst.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249812 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SystemZ] Minor bugfixes.
Jonas Paulsson [Fri, 9 Oct 2015 07:19:16 +0000 (07:19 +0000)]
[SystemZ] Minor bugfixes.

LLCH, LLHH and CLIH had the wrong register classes for the def-operand.
Tie operands if changing opcode to an instruction with tied ops.
Comment typo fix.

These fixes were needed in order to make regression test case
SystemZ/asm-18.ll pass with -verify-machineinstrs (not used by
default).

Reviewed by Ulrich Weigand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249811 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SystemZ] Bugfix in SystemZAsmParser.cpp.
Jonas Paulsson [Fri, 9 Oct 2015 07:19:12 +0000 (07:19 +0000)]
[SystemZ] Bugfix in SystemZAsmParser.cpp.

Let parseRegister() allow RegFP Group if expecting RegV Group, since the
%f register prefix yields the FP group even while used with vector instructions.

Reviewed by Ulrich Weigand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249810 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[libFuzzer] don't print large artifacts to stderr
Kostya Serebryany [Fri, 9 Oct 2015 04:03:14 +0000 (04:03 +0000)]
[libFuzzer] don't print large artifacts to stderr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249808 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[libFuzzer] add -artifact_prefix flag
Kostya Serebryany [Fri, 9 Oct 2015 03:57:59 +0000 (03:57 +0000)]
[libFuzzer] add -artifact_prefix flag

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249807 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoARM: tweak WoA frame lowering
Saleem Abdulrasool [Fri, 9 Oct 2015 03:19:03 +0000 (03:19 +0000)]
ARM: tweak WoA frame lowering

Accept r11 when targeting Windows on ARM rather than just low registers.
Because we are in a thumb-2 only mode, this may be slightly more expensive in
code size, but results in better code for the environment since it spills the
frame register, which is generally desired for fast stack walking as per the
ABI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249804 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SCEV] Call `StrengthenNoWrapFlags` after `GroupByComplexity`; NFCI
Sanjoy Das [Fri, 9 Oct 2015 02:44:45 +0000 (02:44 +0000)]
[SCEV] Call `StrengthenNoWrapFlags` after `GroupByComplexity`; NFCI

The current implementation of `StrengthenNoWrapFlags` is agnostic to the
order of `Ops`, so this commit should not change anything semantic.  An
upcoming change will make `StrengthenNoWrapFlags` sensitive to the order
of `Ops`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249802 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRe-enable the coff-dwarf test on Windows
Reid Kleckner [Fri, 9 Oct 2015 01:18:27 +0000 (01:18 +0000)]
Re-enable the coff-dwarf test on Windows

Apparently system-windows was only a clang lit suite feature.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249797 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Revert "Revert r248959, "[WinEH] Emit int3 after noreturn calls on Win64"""
Reid Kleckner [Fri, 9 Oct 2015 01:13:17 +0000 (01:13 +0000)]
Revert "Revert "Revert r248959, "[WinEH] Emit int3 after noreturn calls on Win64"""

This reverts commit r249794.

Apparently my checkouts are full of unexpected surprises today.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249796 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix coff-dwarf test for non-Windows platforms that cannot demangle MS C++ names
Reid Kleckner [Fri, 9 Oct 2015 01:11:40 +0000 (01:11 +0000)]
Fix coff-dwarf test for non-Windows platforms that cannot demangle MS C++ names

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249795 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Revert r248959, "[WinEH] Emit int3 after noreturn calls on Win64""
Reid Kleckner [Fri, 9 Oct 2015 01:11:37 +0000 (01:11 +0000)]
Revert "Revert r248959, "[WinEH] Emit int3 after noreturn calls on Win64""

This reverts commit r249032.

TODO write commit msg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249794 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WinEH] Fix cleanup state numbering
Joseph Tremoulet [Fri, 9 Oct 2015 00:46:08 +0000 (00:46 +0000)]
[WinEH] Fix cleanup state numbering

Summary:
 - Recurse from cleanupendpads to their cleanuppads, to make sure the
   cleanuppad is visited if it has a cleanupendpad but no cleanupret.
 - Check for and avoid double-processing cleanuppads, to allow for them to
   have multiple cleanuprets (plus cleanupendpads).
 - Update Cxx state numbering to visit toplevel cleanupendpads and to
   recurse from cleanupendpads to their preds, to ensure we number any
   funclets in inlined cleanups.  SEH state numbering already did this.

Reviewers: rnk

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249792 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SEH] Fix llvm.eh.exceptioncode fast register allocation assertion
Reid Kleckner [Fri, 9 Oct 2015 00:15:13 +0000 (00:15 +0000)]
[SEH] Fix llvm.eh.exceptioncode fast register allocation assertion

I called the wrong MachineBasicBlock::addLiveIn() overload.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249786 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAddress review comments, remove error case and return 0 instead as required by tests
Reid Kleckner [Fri, 9 Oct 2015 00:15:08 +0000 (00:15 +0000)]
Address review comments, remove error case and return 0 instead as required by tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249785 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[llvm-symbolizer] Make --relative-address work with DWARF contexts
Reid Kleckner [Fri, 9 Oct 2015 00:15:01 +0000 (00:15 +0000)]
[llvm-symbolizer] Make --relative-address work with DWARF contexts

Summary:
Previously the relative address flag only affected PDB debug info.  Now
both DIContext implementations always expect to be passed virtual
addresses. llvm-symbolizer is now responsible for adding ImageBase to
module offsets when --relative-offset is passed.

Reviewers: zturner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249784 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSupport: Partially revert r249782 to unbreak clang build
Duncan P. N. Exon Smith [Fri, 9 Oct 2015 00:03:57 +0000 (00:03 +0000)]
Support: Partially revert r249782 to unbreak clang build

Apparently the iterators in `clang::CFGBlock` have an auto-conversion to
`CFGBlock *`, but the dereference operator gives `const CFGBlock &`.
Until I have a moment to fix that, revert the GenericDomTree chagnes
from r249782.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249783 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoIR: Remove implicit iterator conversions from lib/IR, NFC
Duncan P. N. Exon Smith [Thu, 8 Oct 2015 23:49:46 +0000 (23:49 +0000)]
IR: Remove implicit iterator conversions from lib/IR, NFC

Stop converting implicitly between iterators and pointers/references in
lib/IR.  For convenience, I've added a `getIterator()` accessor to
`ilist_node` so that callers don't need to know how to spell the
iterator class (i.e., they can use `X.getIterator()` instead of
`Function::iterator(X)`).

I'll eventually disallow these implicit conversions entirely, but
there's a lot of code, so it doesn't make sense to do it all in one
patch.  One library or so at a time.

Why?  To root out cases of `getNextNode()` and `getPrevNode()` being
used in iterator logic.  The design of `ilist` makes that invalid when
the current node could be at the back of the list, but it happens to
"work" right now because of a bug where those functions never return
`nullptr` if you're using a half-node sentinel.  Before I can fix the
function, I have to remove uses of it that rely on it misbehaving.
(Maybe the function should just be deleted anyway?  But I don't want
deleting it -- potentially a huge project -- to block fixing
ilist/iplist.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249782 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[RS4GC] Refactoring to make a later change easier, NFCI
Sanjoy Das [Thu, 8 Oct 2015 23:18:38 +0000 (23:18 +0000)]
[RS4GC] Refactoring to make a later change easier, NFCI

Summary:
These non-semantic changes will help make a later change adding
support for deopt operand bundles more streamlined.

Reviewers: reames, swaroop.sridhar

Subscribers: sanjoy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249779 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[IRBuilder] Change the `gc.statepoint` creation interface
Sanjoy Das [Thu, 8 Oct 2015 23:18:33 +0000 (23:18 +0000)]
[IRBuilder] Change the `gc.statepoint` creation interface

This is to enable me to address review for D13491 -- `Flags` is a
bitfield of `StatepointFlags`, not an individual item out of the enum,
so it should be represented as an `uint32_t`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249778 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[PlaceSafeopints] Extract out `callsGCLeafFunction`, NFC
Sanjoy Das [Thu, 8 Oct 2015 23:18:30 +0000 (23:18 +0000)]
[PlaceSafeopints] Extract out `callsGCLeafFunction`, NFC

Summary:
This will be used in a later change to RewriteStatepointsForGC.

Reviewers: reames, swaroop.sridhar

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249777 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[RS4GC] Don't copy ADT's unneccessarily, NFCI
Sanjoy Das [Thu, 8 Oct 2015 23:18:22 +0000 (23:18 +0000)]
[RS4GC] Don't copy ADT's unneccessarily, NFCI

Summary: Use `const auto &` instead of `auto` in `makeStatepointExplicit`.

Reviewers: reames, swaroop.sridhar

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249776 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix a bug in llvm-objdump’s printing of Objective-C meta data
Kevin Enderby [Thu, 8 Oct 2015 22:50:55 +0000 (22:50 +0000)]
Fix a bug in llvm-objdump’s printing of Objective-C meta data
from malformed Mach-O files that caused a crash because of a
section header had a size that extended past the end of the file.

rdar://22983603

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249768 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSupport: Stop relying on iterator auto-conversion, NFC
Duncan P. N. Exon Smith [Thu, 8 Oct 2015 22:47:55 +0000 (22:47 +0000)]
Support: Stop relying on iterator auto-conversion, NFC

Stop relying on ilist implicit conversions from `value_type&` to
`iterator` in YAMLParser.cpp.

I eventually want to outlaw this entirely.  It encourages
`getNextNode()` and `getPrevNode()` in iterator logic, which is
extremely fragile (and relies on them never returning `nullptr`).

FTR, there's nothing nefarious going on in this case, it was just easy
to clean up since the callers really wanted iterators to begin with.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249767 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoEnable gtest SEH when building with clang-cl
Reid Kleckner [Thu, 8 Oct 2015 22:44:39 +0000 (22:44 +0000)]
Enable gtest SEH when building with clang-cl

Clang supports SEH well enough that this should work out of the box.  If
it doesn't, we'll hear about it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249766 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAArch64: Stop using MachineInstr::getNextNode()
Duncan P. N. Exon Smith [Thu, 8 Oct 2015 22:43:26 +0000 (22:43 +0000)]
AArch64: Stop using MachineInstr::getNextNode()

Stop using `getNextNode()` to get an insertion point (at least, in this
one place).  Instead, use iterator logic directly.

The `getNextNode()` interface isn't actually supposed to work for
creating iterators; it's supposed to return `nullptr` (not a real
iterator) if this is the last node.  It's currently broken and will
"happen" to work, but if we ever fix the function, we'll get some
strange failures in places like this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249764 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMC: Stop using Fragment::getNextNode()
Duncan P. N. Exon Smith [Thu, 8 Oct 2015 22:36:08 +0000 (22:36 +0000)]
MC: Stop using Fragment::getNextNode()

Stop using `getNextNode()` to get an iterator to a fragment (at least,
in this one place).  Instead, use iterator logic directly.

The `getNextNode()` interface isn't actually supposed to work for
creating iterators; it's supposed to return `nullptr` (not a real
iterator) if this is the last node.  It's currently broken and will
"happen" to work, but if we ever fix the function, we'll get some
strange failures in places like this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249763 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[dsymutil] Try to find lipo first besides dsymutil before looking up the PATH.
Frederic Riss [Thu, 8 Oct 2015 22:35:53 +0000 (22:35 +0000)]
[dsymutil] Try to find lipo first besides dsymutil before looking up the PATH.

Even if we don't have it in PATH, lipo should usually exist in the same directory
as dsymutil. Keep the fallback looking up the PATH, it's very useful when
testing a non-installed executable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249762 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPowerPC: Don't use getNextNode() for insertion point
Duncan P. N. Exon Smith [Thu, 8 Oct 2015 22:20:37 +0000 (22:20 +0000)]
PowerPC: Don't use getNextNode() for insertion point

Stop using `getNextNode()` to create an insertion point for machine
instructions (at least, in this one place).  Instead, use an iterator.
As a drive-by, clean up dump statements to use iterator logic.

The `getNextNode()` interface isn't actually supposed to work for
insertion points; it's supposed to return `nullptr` if this is the last
node.  It's currently broken and will "happen" to work, but if we ever
fix the function, we'll get some strange failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249758 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoNew MSan mapping layout (llvm part).
Evgeniy Stepanov [Thu, 8 Oct 2015 21:35:26 +0000 (21:35 +0000)]
New MSan mapping layout (llvm part).

This is an implementation of
https://github.com/google/sanitizers/issues/579

It has a number of advantages over the current mapping:
* Works for non-PIE executables.
* Does not require ASLR; as a consequence, debugging MSan programs in
  gdb no longer requires "set disable-randomization off".
* Supports linux kernels >=4.1.2.
* The code is marginally faster and smaller.

This is an ABI break. We never really promised ABI stability, but
this patch includes a courtesy escape hatch: a compile-time macro
that reverts back to the old mapping layout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249753 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd Triple::isAndroid().
Evgeniy Stepanov [Thu, 8 Oct 2015 21:21:24 +0000 (21:21 +0000)]
Add Triple::isAndroid().

This is a simple refactoring that replaces Triple.getEnvironment()
checks for Android with Triple.isAndroid().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249750 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix another UBSan test error from r248897 and follow on fix r249689
Teresa Johnson [Thu, 8 Oct 2015 20:52:23 +0000 (20:52 +0000)]
Fix another UBSan test error from r248897 and follow on fix r249689

While here fix a few more issues with potential overflow and add
new tests for these cases. Ensured that test now passes with UBSan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249745 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove a '#' so that we can check either form for the various targets.
Eric Christopher [Thu, 8 Oct 2015 20:18:15 +0000 (20:18 +0000)]
Remove a '#' so that we can check either form for the various targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249734 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMove the MMX subtarget feature out of the SSE set of features and into
Eric Christopher [Thu, 8 Oct 2015 20:10:06 +0000 (20:10 +0000)]
Move the MMX subtarget feature out of the SSE set of features and into
its own variable.

This is needed so that we can explicitly turn off MMX without turning
off SSE and also so that we can diagnose feature set incompatibilities
that involve MMX without SSE.

Rationale:

// sse3
__m128d test_mm_addsub_pd(__m128d A, __m128d B) {
  return _mm_addsub_pd(A, B);
}

// mmx
void shift(__m64 a, __m64 b, int c) {
  _mm_slli_pi16(a, c);
  _mm_slli_pi32(a, c);
  _mm_slli_si64(a, c);
  _mm_srli_pi16(a, c);
  _mm_srli_pi32(a, c);
  _mm_srli_si64(a, c);
  _mm_srai_pi16(a, c);
  _mm_srai_pi32(a, c);
}

clang -msse3 -mno-mmx file.c -c

For this code we should be able to explicitly turn off MMX
without affecting the compilation of the SSE3 function and then
diagnose and error on compiling the MMX function.

This matches the existing gcc behavior and follows the spirit of
the SSE/MMX separation in llvm where we can (and do) turn off
MMX code generation except in the presence of intrinsics.

Updated a couple of tests, but primarily tested with a couple of tests
for turning on only mmx and only sse.

This is paired with a patch to clang to take advantage of this behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249731 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRe-apply r249644: Handle inline stacks in gcov-encoded sample profiles.
Diego Novillo [Thu, 8 Oct 2015 19:40:37 +0000 (19:40 +0000)]
Re-apply r249644: Handle inline stacks in gcov-encoded sample profiles.

This fixes memory allocation problems by making the merge operation keep
the profile readers around until the merged profile has been emitted.
This is needed to prevent the inlined function names to disappear from
the function profiles. Since all the names are kept as references, once
the reader disappears, the names are also deallocated.

Additionally, XFAIL on big-endian architectures. The test case uses a
gcov file generated on a little-endian system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249724 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[bpf] Do not expand UNDEF SDNode during insn selection lowering
Alexei Starovoitov [Thu, 8 Oct 2015 18:52:40 +0000 (18:52 +0000)]
[bpf] Do not expand UNDEF SDNode during insn selection lowering

  o Before this patch, BPF backend will expand UNDEF node
    to i64 constant 0.
  o For second pass of dag combiner, legalizer will run through
    each to-be-processed dag node.
  o If any new SDNode is generated and has an undef operand,
    dag combiner will put undef node, newly-generated constant-0 node,
    and any node which uses these nodes in the working list.
  o During this process, it is possible undef operand is
    generated again, and this will form an infinite loop
    for dag combiner pass2.
  o This patch allows UNDEF to be a legal type.

Signed-off-by: Yonghong Song <yhs@plumgrid.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249718 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SCEV] Bring some methods up to coding style; NFC
Sanjoy Das [Thu, 8 Oct 2015 18:46:59 +0000 (18:46 +0000)]
[SCEV] Bring some methods up to coding style; NFC

 - Start methods with lower case
 - Reflow a comment
 - Delete header comment repeated in .cpp file

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249716 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WinEH] Relax assertion in the presence of stack realignment
Reid Kleckner [Thu, 8 Oct 2015 18:41:52 +0000 (18:41 +0000)]
[WinEH] Relax assertion in the presence of stack realignment

The code is correct as is, but we should test it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249715 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[PowerPC] Add R_PPC64_GLOB_DAT and R_PPC64_RELATIVE to PowerPC64.def
Hal Finkel [Thu, 8 Oct 2015 18:30:27 +0000 (18:30 +0000)]
[PowerPC] Add R_PPC64_GLOB_DAT and R_PPC64_RELATIVE to PowerPC64.def

These are not used by LLVM proper, but will be used by upcoming commits to lld
(and will receive test coverage there).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249714 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SCEV] Remove comment repeated in cpp file; NFC
Sanjoy Das [Thu, 8 Oct 2015 18:28:42 +0000 (18:28 +0000)]
[SCEV] Remove comment repeated in cpp file; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249713 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SCEV] Pick backedge values for phi nodes correctly
Sanjoy Das [Thu, 8 Oct 2015 18:28:36 +0000 (18:28 +0000)]
[SCEV] Pick backedge values for phi nodes correctly

Summary:
`getConstantEvolutionLoopExitValue` and `ComputeExitCountExhaustively`
assumed all phi nodes in the loop header have the same order of incoming
values.  This is not correct, and this commit changes
`getConstantEvolutionLoopExitValue` and `ComputeExitCountExhaustively`
to lookup the backedge value of a phi node using the loop's latch block.

Unfortunately, there is still some code duplication
`getConstantEvolutionLoopExitValue` and `ComputeExitCountExhaustively`.
At some point in the future we should extract out a helper class /
method that can evolve constant evolution phi nodes across iterations.

Fixes 25060.  Thanks to Mattias Eriksson for the spot-on analysis!

Depends on D13457.

Reviewers: atrick, hfinkel

Subscribers: materi, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249712 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoHandle Archive::getNumberOfSymbols being called in an archive with no symbols.
Rafael Espindola [Thu, 8 Oct 2015 18:06:20 +0000 (18:06 +0000)]
Handle Archive::getNumberOfSymbols being called in an archive with no symbols.

No change in llvm, but will be tested from lld.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249709 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SystemZ] Fix another assertion failure in tryBuildVectorShuffle
Ulrich Weigand [Thu, 8 Oct 2015 17:46:59 +0000 (17:46 +0000)]
[SystemZ] Fix another assertion failure in tryBuildVectorShuffle

This fixes yet another scenario where tryBuildVectorShuffle would
attempt to create a BUILD_VECTOR node with an invalid combination
of types.  This can happen if the incoming BUILD_VECTOR has elements
of a type different from the vector element type, which is allowed
in certain cases as long as they are all the same type.

When one of these elements is used in the residual vector, and
UNDEF elements are added to fill up the residual vector, those
UNDEFs then have to use the type of the original element, not
the vector element type, or else the resulting BUILD_VECTOR
will have an invalid type combination.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249706 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMake the Kaleidoscope Orc examples -Wdeprecated clean by avoiding copying some AST...
David Blaikie [Thu, 8 Oct 2015 17:22:12 +0000 (17:22 +0000)]
Make the Kaleidoscope Orc examples -Wdeprecated clean by avoiding copying some AST nodes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249703 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[InstCombine] transform masking off of an FP sign bit into a fabs() intrinsic call...
Sanjay Patel [Thu, 8 Oct 2015 17:09:31 +0000 (17:09 +0000)]
[InstCombine] transform masking off of an FP sign bit into a fabs() intrinsic call (PR24886)

This is a partial fix for PR24886:
https://llvm.org/bugs/show_bug.cgi?id=24886

Without this IR transform, the backend (x86 at least) was producing inefficient code.

This patch is making 2 assumptions:

    1. The canonical form of a fabs() operation is, in fact, the LLVM fabs() intrinsic.
    2. The high bit of an FP value is always the sign bit; as noted in the bug report, this isn't specified by the LangRef.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249702 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ValueTracking] teach computeKnownBits that a fabs() clears sign bits
Sanjay Patel [Thu, 8 Oct 2015 16:56:55 +0000 (16:56 +0000)]
[ValueTracking] teach computeKnownBits that a fabs() clears sign bits

This was requested in D13076: if we're going to canonicalize to fabs(), ValueTracking
should know that fabs() clears sign bits.

In this patch (as in D13076), we're not handling vectors yet even though computeKnownBits'
fabs() case itself should be vector-ready via the splat in this patch.
Fixing this will require follow-on patches to correct other logic that uses 'getScalarType'.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249701 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix a bug in llvm-objdump’s printing of Objective-C meta data
Kevin Enderby [Thu, 8 Oct 2015 16:56:35 +0000 (16:56 +0000)]
Fix a bug in llvm-objdump’s printing of Objective-C meta data
from malformed Mach-O files that caused a crash because of loops
in the class meta data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249700 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoWindows: Fixed sys::findProgramByName to work with files containing dot in their...
George Rimar [Thu, 8 Oct 2015 16:03:19 +0000 (16:03 +0000)]
Windows: Fixed sys::findProgramByName to work with files containing dot in their name.

Problem was in SearchPathW function that does not attach an extension if file already has one.
That does not work for executables like ld.lld2 for example which require to have .exe extension but SearchPath thinks that its "lld2".
Solution was to add the extension manually.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249696 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSupport for llvm-bcanalyzer dumping of record array strings.
Teresa Johnson [Thu, 8 Oct 2015 15:56:24 +0000 (15:56 +0000)]
Support for llvm-bcanalyzer dumping of record array strings.

Summary:
Adds support for automatically detecting and printing strings
represented by Array abbrev operands, analogous to the string dumping
performed for Blob abbrev operands.

Enhanced the ThinLTO combined index test to check for the appropriate
module and function strings.

Reviewers: dexonsmith, joker.eph, davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249695 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86] Disable X86CallFrameOptimization on Darwin in presence of EH
Frederic Riss [Thu, 8 Oct 2015 15:45:08 +0000 (15:45 +0000)]
[X86] Disable X86CallFrameOptimization on Darwin in presence of EH

We emit 1 compact unwind encoding per function, and this can’t represent
the varying stack pointer that will be generated by X86CallFrameOptimization.
Disable the optimization on Darwin.

(It might be possible to split the function into multiple ranges
and emit 1 compact unwind info per range. The compact unwind emission
code isn’t ready for that and this kind of info certainly isn’t
tested/used anywhere. It might be worth exploring this path if we want
to get the space savings at some point though)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249694 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix combined function index abbrev (NFC)
Teresa Johnson [Thu, 8 Oct 2015 13:52:56 +0000 (13:52 +0000)]
Fix combined function index abbrev (NFC)

Removed an unused abbrev op in the VST_CODE_COMBINED_FNENTRY abbrev.

I noticed while writing/testing an array string dumper for
llvm-bcanalyze that the combined function's VST entry abbrevs contained
an old field that I am not using. Everything was working fine since the
bitcode writer and reader were in sync on how the record fields were
actually being set up and interpreted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249691 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd a helper for getting a section's content as an array.
Rafael Espindola [Thu, 8 Oct 2015 13:38:42 +0000 (13:38 +0000)]
Add a helper for getting a section's content as an array.

It will be used in lld shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249690 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix UBSan test error from r248897 about left shift of unsigned value.
Teresa Johnson [Thu, 8 Oct 2015 13:14:59 +0000 (13:14 +0000)]
Fix UBSan test error from r248897 about left shift of unsigned value.

Fixed by masking off the upper bits that we are shifting off before
doing the left shift.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249689 91177308-0d34-0410-b5e6-96231b3b80d8