oota-llvm.git
6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

7 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

7 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

7 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

7 years agoAVX512: vpextrb/w/d/q and vpinsrb/w/d/q implementation.
Igor Breger [Thu, 8 Oct 2015 12:55:01 +0000 (12:55 +0000)]
AVX512: vpextrb/w/d/q and vpinsrb/w/d/q implementation.
This instructions doesn't have intrincis.
Added tests for lowering and encoding.

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

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

7 years agoCompute demanded bits for icmp instructions
James Molloy [Thu, 8 Oct 2015 12:40:06 +0000 (12:40 +0000)]
Compute demanded bits for icmp instructions

Instead of bailing out when we see an icmp, we can instead at least
say that if the upper bits of both operands are known zero, they are
not demanded. This doesn't help with signed comparisons, but it's at
least better than bailing out.

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

7 years agoTreat Mul just like Add and Subtract
James Molloy [Thu, 8 Oct 2015 12:39:59 +0000 (12:39 +0000)]
Treat Mul just like Add and Subtract

Like adds and subtracts, muls ripple only to the left so we can use
the same logic.

While we're here, add a print method to DemandedBits so it can be used
with -analyze, which we'll use in the testcase.

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

7 years agoMake demanded bits lazy
James Molloy [Thu, 8 Oct 2015 12:39:50 +0000 (12:39 +0000)]
Make demanded bits lazy

The algorithm itself is still eager, but it doesn't get run until a
query function is called. This greatly reduces the compile-time impact
of requiring DemandedBits when at runtime it is not often used.

NFCI.

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

7 years ago[X86] Fix wrong treatment of multi-lane blends in BUILD_VECTORtoBlendMask()
Michael Kuperstein [Thu, 8 Oct 2015 08:13:02 +0000 (08:13 +0000)]
[X86] Fix wrong treatment of multi-lane blends in BUILD_VECTORtoBlendMask()

This fixes two separate bugs:
1) The mask for the high lane was not set correctly. That fixes PR24532.
2) The transformation should bail out if it believes it involves more than
2 lanes, as it does not currently do anything sensible in this case.

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

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

7 years agoDo not assert on first non-prologue instruction being a CFI directive.
Michael Kuperstein [Thu, 8 Oct 2015 07:48:49 +0000 (07:48 +0000)]
Do not assert on first non-prologue instruction being a CFI directive.

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

7 years ago[SystemZ] SystemZElimCompare pass improved.
Jonas Paulsson [Thu, 8 Oct 2015 07:40:23 +0000 (07:40 +0000)]
[SystemZ] SystemZElimCompare pass improved.

Compare elimination extended to recognize load-and-test instructions used
for comparison and eliminate them the same way as with compare instructions.

Test case fp-cmp-05.ll updated to expect optimized results now also for z13.

The order of instruction shortening and compare elimination passes have been
changed so that opcodes do not have to be handled in both passes.

Reviewed by Ulrich Weigand.

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

7 years ago[SystemZ] Bugfix: check CC reg liveness in SystemZShortenInst.
Jonas Paulsson [Thu, 8 Oct 2015 07:40:19 +0000 (07:40 +0000)]
[SystemZ] Bugfix: check CC reg liveness in SystemZShortenInst.

The following instruction shortening transformations would introduce a
definition of the CC reg, so therefore liveness of CC reg must be checked:

WFADB -> ADBR
WFSDB -> SDBR

Also add the CC reg implicit def operand to the MI in case of change of opcode.

Reviewed by Ulrich Weigand.

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

7 years ago [SystemZ] Use load-and-test for fp compare with 0 if vector support is present.
Jonas Paulsson [Thu, 8 Oct 2015 07:40:16 +0000 (07:40 +0000)]
 [SystemZ] Use load-and-test for fp compare with 0 if vector support is present.

Since the LTxBRCompare instructions can't be used with vector registers, a
normal load-and-test instruction (with a modelled def operand) is used instead.

Reviewed by Ulrich Weigand.

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

7 years ago[SystemZ] More minor fixing in SystemZElimCompare.cpp
Jonas Paulsson [Thu, 8 Oct 2015 07:40:11 +0000 (07:40 +0000)]
[SystemZ] More minor fixing in SystemZElimCompare.cpp

Don't use subreg indices since they are not used after regalloc.

Reviewed by Ulrich Weigand.

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

7 years ago[SystemZ] Minor fixes in SystemZElimCompare.cpp
Jonas Paulsson [Thu, 8 Oct 2015 07:39:55 +0000 (07:39 +0000)]
[SystemZ] Minor fixes in SystemZElimCompare.cpp

Reviewed by Ulrich Weigand.

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

7 years agoUse range-based for loops. NFC.
Craig Topper [Thu, 8 Oct 2015 06:06:42 +0000 (06:06 +0000)]
Use range-based for loops. NFC.

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

7 years ago[SCEV] Check `Pred` first in isKnownPredicateViaSplitting
Sanjoy Das [Thu, 8 Oct 2015 03:46:00 +0000 (03:46 +0000)]
[SCEV] Check `Pred` first in isKnownPredicateViaSplitting

Comparing `Pred` with `ICmpInst::ICMP_ULT` is cheaper that memory access
-- do that check before loading / storing `ProvingSplitPredicate`.

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

7 years ago[SCEV] Use `auto *` instead of `auto`; NFCI
Sanjoy Das [Thu, 8 Oct 2015 03:45:58 +0000 (03:45 +0000)]
[SCEV] Use `auto *` instead of `auto`; NFCI

(As prescribed by the coding style document)

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

7 years agoRevert "Handle inline stacks in gcov-encoded sample profiles."
Diego Novillo [Thu, 8 Oct 2015 01:17:26 +0000 (01:17 +0000)]
Revert "Handle inline stacks in gcov-encoded sample profiles."

This reverts commit r249644.

The buildbots are failing the new test I added. Investigating.

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

7 years ago[libFuzzer] fix 32-bit build
Kostya Serebryany [Thu, 8 Oct 2015 00:59:25 +0000 (00:59 +0000)]
[libFuzzer] fix 32-bit build

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

7 years agoHandle inline stacks in gcov-encoded sample profiles.
Diego Novillo [Thu, 8 Oct 2015 00:39:11 +0000 (00:39 +0000)]
Handle inline stacks in gcov-encoded sample profiles.

This patch adds support for reading sample profiles with inline stacks.
Inline stacks in a profile are generated when the sampled binary has
samples in inlined functions.

For instance, if main() calls foo() and foo() calls bar(), and bar() is
inlined into foo() and foo() inlined into main(), the profile may look
something like:

main total:364084 head:0
  [ ... ]
  2.3: _Z3fool total:243786
    1: 60149
    1.2: 38568
    1.4: 46511
    1.7: _Z3bari total:98558
      1.1: 52672
      1.2: 45886

At line 2, discriminator 3, main() calls foo(). In turn, foo() calls
bar() at line 1, discriminator 7.

In the textual format, this stacking of inline calls is represented
with indentation.

With this change, LLVM can now read sample profile files generated by
the create_gcov tool from https://github.com/google/autofdo.

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

7 years agoCodeGen: print and verify after TargetPassConfig::insertPass by default
Justin Bogner [Thu, 8 Oct 2015 00:36:22 +0000 (00:36 +0000)]
CodeGen: print and verify after TargetPassConfig::insertPass by default

In r224059, we started verifying after addPass, but missed doing so on
insertPass. There isn't a good reason for the discrepancy, and
skipping the verifier in these cases causes bugs.

This also exposes a verifier error that was introduced in r249087, but
the verifier doesn't run until after the register coalescer, when the
issue happens to have been resolved. I've skipped the verifier after
SIFixSGPRLiveRangesID to avoid the failures for now and will follow up
with Matt for a proper fix.

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

7 years ago[WinEH] Add missing test case for llvm.eh.exceptioncode
Reid Kleckner [Wed, 7 Oct 2015 23:55:06 +0000 (23:55 +0000)]
[WinEH] Add missing test case for llvm.eh.exceptioncode

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

7 years ago[WinEH] Fix 32-bit funclet epilogues in the presence of dynamic allocas
Reid Kleckner [Wed, 7 Oct 2015 23:55:01 +0000 (23:55 +0000)]
[WinEH] Fix 32-bit funclet epilogues in the presence of dynamic allocas

In particular, passing non-trivially copyable objects by value on win32
uses a dynamic alloca (inalloca). We would clobber ESP in the epilogue
and end up returning to outer space.

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

7 years agoStop linking all target libraries in llvm-nm and llvm-objdump.
Pete Cooper [Wed, 7 Oct 2015 22:39:17 +0000 (22:39 +0000)]
Stop linking all target libraries in llvm-nm and llvm-objdump.

llvm-nm only needs the target to parse module level assembly in bitcode.  It doesn't need a disassembler or codegen.

llvm-objdump needs to be able to disassemble a file, but doesn't need asm parsers or codegen.

This reduces the sizes of these tools by a few MB each, depending on how many backends are linked in.

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

7 years ago[Orc] Enable user supplied partitioning functors in the CompileOnDemand layer.
Lang Hames [Wed, 7 Oct 2015 21:53:41 +0000 (21:53 +0000)]
[Orc] Enable user supplied partitioning functors in the CompileOnDemand layer.

Previously the CompileOnDemand layer always created single-function partitions.
In theory this new API allows for more interesting partitions, though this has
not been well tested yet.

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

7 years ago[WinEH] Refer to filter funclets using their symbol-table symbol
David Majnemer [Wed, 7 Oct 2015 21:34:00 +0000 (21:34 +0000)]
[WinEH] Refer to filter funclets using their symbol-table symbol

The relocation for the filter funclet will be against a symbol table
entry for a function instead of the section, making it easier to
understand what is going on.

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

7 years ago[RS4GC] Use AssertingVH for RematerializedValueMapTy, NFCI
Sanjoy Das [Wed, 7 Oct 2015 21:32:35 +0000 (21:32 +0000)]
[RS4GC] Use AssertingVH for RematerializedValueMapTy, NFCI

Reviewers: reames, swaroop.sridhar

Subscribers: llvm-commits

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

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

7 years ago[WinEH] Undo the effect of r249578 for 32-bit
Reid Kleckner [Wed, 7 Oct 2015 21:13:15 +0000 (21:13 +0000)]
[WinEH] Undo the effect of r249578 for 32-bit

The __CxxFrameHandler3 tables for 32-bit are supposed to hold stack
offsets relative to EBP, not ESP. I blindly updated the win-catchpad.ll
test case, and immediately noticed that 32-bit catching stopped working.

While I'm at it, move the frame index to frame offset WinEH table logic
out of PEI.  PEI shouldn't have to know about WinEHFuncInfo. I realized
we can calculate frame index offsets just fine from the table printer.

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

7 years ago[WinEH] Remove unreachable blocks before preparation
David Majnemer [Wed, 7 Oct 2015 21:08:25 +0000 (21:08 +0000)]
[WinEH] Remove unreachable blocks before preparation

We remove unreachable blocks because it is pointless to consider them
for coloring.  However, we still had stale pointers to these blocks in
some data structures after we removed them from the function.

Instead, remove the unreachable blocks before attempting to do anything
with the function.

This fixes PR25099.

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

7 years agoSupport: Stop using iplist in Recycler
Duncan P. N. Exon Smith [Wed, 7 Oct 2015 20:49:09 +0000 (20:49 +0000)]
Support: Stop using iplist in Recycler

Recycler just needs a singly-linked list, and it takes less (and
simpler) code to hand-roll one of those than to build up the equivalent
`iplist_traits`.  In theory, this should speed things up a bit too, but
this is really just a drive-by cleanup so I haven't measured.

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

7 years agogit-clang-format r249548.
Rafael Espindola [Wed, 7 Oct 2015 20:32:24 +0000 (20:32 +0000)]
git-clang-format r249548.

Sorry for missing this the first time.

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

7 years ago[mips][FastISel] Factor out common code from switch statement. NFC
Vasileios Kalintiris [Wed, 7 Oct 2015 20:06:30 +0000 (20:06 +0000)]
[mips][FastISel] Factor out common code from switch statement. NFC

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

7 years agoIR: Create SymbolTableList wrapper around iplist, NFC
Duncan P. N. Exon Smith [Wed, 7 Oct 2015 20:05:10 +0000 (20:05 +0000)]
IR: Create SymbolTableList wrapper around iplist, NFC

Create `SymbolTableList`, a wrapper around `iplist` for lists that
automatically manage a symbol table.  This commit reduces a ton of code
duplication between the six traits classes that were used previously.

As a drive by, reduce the number of template parameters from 2 to 1 by
using a SymbolTableListParentType metafunction (I originally had this as
a separate commit, but it touched most of the same lines so I squashed
them).

I'm in the process of trying to remove the UB in `createSentinel()` (see
the FIXMEs I added for `ilist_embedded_sentinel_traits` and
`ilist_half_embedded_sentinel_traits`).  My eventual goal is to separate
the list logic into a base class layer that knows nothing about (and
isn't templated on) the downcasted nodes -- removing the need to invoke
UB -- but for now I'm just trying to get a handle on all the current use
cases (and cleaning things up as I see them).

Besides these six SymbolTable lists, there are two others that use the
addNode/removeNode/transferNodes() hooks: the `MachineInstruction` and
`MachineBasicBlock` lists.  Ideally there'll be a way to factor these
hooks out of the low-level API entirely, but I'm not quite there yet.

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