Commit Graph

16616 Commits

Author SHA1 Message Date
Adrian Prantl
ccd539282b DwarfDebug: Prevent DebugLocEntry merging from coalescing two different
constants into only the first one.

rdar://14874886.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205357 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-01 21:04:18 +00:00
Matt Arsenault
eb8eac6be2 Make isSetCCEquivalent respect the TargetBooleanContents
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205336 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-01 18:13:26 +00:00
Matt Arsenault
1ff5f1a061 Add helpers for checking if a value is a target boolean constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205335 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-01 18:13:22 +00:00
David Blaikie
6b10f3a87d DebugInfo: Factor out common functionality for rendering debug_loc and debug_loc.dwo location list entries
In preparation for refactoring this function into two, one for
debug_loc, one for debug_loc.dwo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205324 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-01 16:17:41 +00:00
David Blaikie
6817d33dda Cleanup remaining use of removed variable to fix the build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205323 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-01 16:13:29 +00:00
David Blaikie
fabe5ce566 Simplify debug_loc.dwo handling slightly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205322 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-01 16:09:49 +00:00
David Blaikie
a07c1ab4e6 DebugInfo: Avoid creating unnecessary/empty line tables and remove the special case of '0' in DwarfCompileUnit::initStmtList by just always using a label difference
This moves one case of raw text checking down into the MCStreamer
interfaces in the form of a virtual function, even if we ultimately end
up consolidating on the one-or-many line tables issue one day, this is
nicer in the interim. This just generally streamlines a bunch of use
cases into a common code path.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205287 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-01 08:07:52 +00:00
Adrian Prantl
1a2786b900 LTO type uniquing: store the Decl field of a DIImportedEntity as a DIRef.
No other functionality changes, DIBuilder testcase is included in a paired
CFE commit.

This relaxes the assertion in isScopeRef to also accept subclasses of
DIScope.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205279 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-01 03:41:04 +00:00
Juergen Ributzka
d8c9577764 [Stackmaps] Update the stackmap format to use 64-bit relocations for the function address and properly align all entries.
This commit updates the stackmap format to version 1 to indicate the
reorganizaion of several fields. This was done in order to align stackmap
entries to their natural alignment and to minimize padding.

Fixes <rdar://problem/16005902>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205254 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31 22:14:04 +00:00
Matt Arsenault
8d8c507bbf Change shouldSplitVectorElementType to better match the description.
Pass the entire vector type, and not just the element.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205247 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31 20:54:58 +00:00
Hal Finkel
1523211990 Add an optional ability to expand larger BUILD_VECTORs with shuffles
This adds the ability to expand large (meaning with more than two unique
defined values) BUILD_VECTOR nodes in terms of SCALAR_TO_VECTOR and (legal)
vector shuffles. There is now no limit of the size we are capable of expanding
this way, although we don't currently do this for vectors with many unique
values because of the default implementation of TLI's
shouldExpandBuildVectorWithShuffles function.

There is currently no functional change to any existing targets because the new
capabilities are not used unless some target overrides the TLI
shouldExpandBuildVectorWithShuffles function. As a result, I've not included a
test case for the new functionality in this commit, but regression tests will
(at least) be added soon when I commit support for the PPC QPX vector
instruction set.

The benefit of committing this now is that it makes the
shouldExpandBuildVectorWithShuffles callback, which had to be added for other
reasons regardless, fully functional. I suspect that other targets will
also benefit from tuning the heuristic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205243 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31 19:42:55 +00:00
Hal Finkel
adbf9764ae Add a TLI hook to control when BUILD_VECTOR might be expanded using shuffles
There are two general methods for expanding a BUILD_VECTOR node:
  1. Use SCALAR_TO_VECTOR on the defined scalar values and then shuffle
     them together.
  2. Build the vector on the stack and then load it.

Currently, we use a fixed heuristic: If there are only one or two unique
defined values, then we attempt an expansion in terms of SCALAR_TO_VECTOR and
vector shuffles (provided that the required shuffle mask is legal). Otherwise,
always expand via the stack. Even when SCALAR_TO_VECTOR is not legal, this
can still be a good idea depending on what tricks the target can play when
lowering the resulting shuffle. If the target can't do anything special,
however, and if SCALAR_TO_VECTOR is expanded via the stack, this heuristic
leads to sub-optimal code (two stack loads instead of one).

Because only the target knows whether the SCALAR_TO_VECTORs and shuffles for a
build vector of a particular type are likely to be optimial, this adds a new
TLI function: shouldExpandBuildVectorWithShuffles which takes the vector type
and the count of unique defined values. If this function returns true, then
method (1) will be used, subject to the constraint that all of the necessary
shuffles are legal (as determined by isShuffleMaskLegal). If this function
returns false, then method (2) is always used.

This commit does not enhance the current code to support expanding a
build_vector with more than two unique values using shuffles, but I'll commit
an implementation of the more-general case shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205230 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31 17:48:10 +00:00
Paul Robinson
5fa58a5b23 Disable each MachineFunctionPass for 'optnone' functions, unless that
pass normally runs at optimization level None, or is part of the
register allocation pipeline.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205228 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31 17:43:35 +00:00
Hal Finkel
65fafbb109 Look at shuffles of build_vectors in DAGCombiner::visitEXTRACT_VECTOR_ELT
When the loop vectorizer vectorizes code that uses the loop induction variable,
we often end up with IR like this:

  %b1 = insertelement <2 x i32> undef, i32 %v, i32 0
  %b2 = shufflevector <2 x i32> %b1, <2 x i32> undef, <2 x i32> zeroinitializer
  %i = add <2 x i32> %b2, <i32 2, i32 3>

If the add in this example is not legal (as is the case on PPC with VSX), it
will be scalarized, and we'll end up with a number of extract_vector_elt nodes
with the vector shuffle as the input operand, and that vector shuffle is fed by
one or more build_vector nodes. By the time that vector operations are
expanded, visitEXTRACT_VECTOR_ELT will not create new extract_vector_elt by
looking through the vector shuffle (to make sure that no illegal operations are
created), and so the extract_vector_elt -> vector shuffle -> build_vector is
never simplified to an operand of the build vector.

By looking at build_vectors through a shuffle we fix this particular situation,
preventing a vector from being built, only to be deconstructed again (for the
scalarized add) -- an expensive proposition when this all needs to be done via
the stack. We probably want a more comprehensive fix here where we look back
recursively through any shuffles to any build_vectors or scalar_to_vectors,
etc. but that can come later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205179 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31 11:43:19 +00:00
Hal Finkel
111bcf9b59 Make use of previously generated stores in SelectionDAGLegalize::ExpandExtractFromVectorThroughStack
When expanding EXTRACT_VECTOR_ELT and EXTRACT_SUBVECTOR using
SelectionDAGLegalize::ExpandExtractFromVectorThroughStack, we store the entire
vector and then load the piece we want. This is fine in isolation, but
generating a new store (and corresponding stack slot) for each extraction ends
up producing code of poor quality. When we scalarize a vector operation (using
SelectionDAG::UnrollVectorOp for example) we generate one EXTRACT_VECTOR_ELT
for each element in the vector. This used to generate one stored copy of the
vector for each element in the vector. Now we search the uses of the vector for
a suitable store before generating a new one, which results in much more
efficient scalarization code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205153 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-30 15:10:18 +00:00
Benjamin Kramer
70c25ab51b Avoid storing Twines.
While there nested ifs into a helper function. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205108 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-29 16:54:29 +00:00
Tim Northover
483b0e996c CodeGen: add sensible defaults for the ISD::FROUND operation
Some exotic types didn't know how to handle FROUND, which ARM64 uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205088 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-29 09:03:18 +00:00
Tim Northover
1db780ba22 CodeGenPrep: wrangle IR to exploit AArch64 tbz/tbnz inst.
Given IR like:
    %bit = and %val, #imm-with-1-bit-set
    %tst = icmp %bit, 0
    br i1 %tst, label %true, label %false

some targets can emit just a single instruction (tbz/tbnz in the
AArch64 case). However, with ISel acting at the basic-block level, all
three instructions need to be together for this to be possible.

This adds another transformation to CodeGenPrep to expose these
opportunities, if targets opt in via the hook.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205086 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-29 08:22:29 +00:00
Manman Ren
d9524d66cd Provide a target override for the cost of using a callee-saved register
for the first time.

Thanks Andy for the discussion.
rdar://16162005


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204979 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 23:10:04 +00:00
Saleem Abdulrasool
2ea701e67a Canonicalise Windows target triple spellings
Construct a uniform Windows target triple nomenclature which is congruent to the
Linux counterpart.  The old triples are normalised to the new canonical form.
This cleans up the long-standing issue of odd naming for various Windows
environments.

There are four different environments on Windows:

MSVC: The MS ABI, MSVCRT environment as defined by Microsoft
GNU: The MinGW32/MinGW32-W64 environment which uses MSVCRT and auxiliary libraries
Itanium: The MSVCRT environment + libc++ built with Itanium ABI
Cygnus: The Cygwin environment which uses custom libraries for everything

The following spellings are now written as:

i686-pc-win32 => i686-pc-windows-msvc
i686-pc-mingw32 => i686-pc-windows-gnu
i686-pc-cygwin => i686-pc-windows-cygnus

This should be sufficiently flexible to allow us to target other windows
environments in the future as necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204977 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 22:50:05 +00:00
Manman Ren
b5e6ddca56 Register Allocator: refactoring and add comments.
No functionality change. Thanks Andy for reviewing.

rdar://16162005


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204962 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 21:21:57 +00:00
David Blaikie
8040d49d85 DebugInfo: TargetOptions/MCAsmInfo support for compressed debug info sections
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204957 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 20:45:41 +00:00
Rafael Espindola
f165cf7ce8 Prevent alias from pointing to weak aliases.
This adds back r204781.

Original message:

Aliases are just another name for a position in a file. As such, the
regular symbol resolutions are not applied. For example, given

define void @my_func() {
  ret void
}
@my_alias = alias weak void ()* @my_func
@my_alias2 = alias void ()* @my_alias

We produce without this patch:

        .weak   my_alias
my_alias = my_func
        .globl  my_alias2
my_alias2 = my_alias

That is, in the resulting ELF file my_alias, my_func and my_alias are
just 3 names pointing to offset 0 of .text. That is *not* the
semantics of IR linking. For example, linking in a

@my_alias = alias void ()* @other_func

would require the strong my_alias to override the weak one and
my_alias2 would end up pointing to other_func.

There is no way to represent that with aliases being just another
name, so the best solution seems to be to just disallow it, converting
a miscompile into an error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204934 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 15:26:56 +00:00
Ekaterina Romanova
899a605fc1 This is a fix for PR# 19051. I noticed code gen differences due to code motion when running tests with and without the debug info at O2. The problem is in branch folding. A loop wanted to skip the debug info, but actually it didn't do so.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204865 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 22:15:28 +00:00
Manman Ren
3d7d0bc71a Add comments. Addressing review comments from Evan on r204690.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204864 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 22:14:09 +00:00
Jim Grosbach
489752ddb4 Fix for incorrect address sinking in the presence of potential overflows.
In some cases it is possible for CGP to attempt to reuse a base address from
another basic block. In those cases we have to be sure that all the address
math was either done at the same bit width, or that none of it overflowed
before it was extended.

Patch by Louis Gerbarg <lgg@apple.com>

rdar://16307442

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204833 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 17:27:01 +00:00
Renato Golin
c4b058f9e7 Add @llvm.clear_cache builtin
Implementing the LLVM part of the call to __builtin___clear_cache
which translates into an intrinsic @llvm.clear_cache and is lowered
by each target, either to a call to __clear_cache or nothing at all
incase the caches are unified.

Updating LangRef and adding some tests for the implemented architectures.
Other archs will have to implement the method in case this builtin
has to be compiled for it, since the default behaviour is to bail
unimplemented.

A Clang patch is required for the builtin to be lowered into the
llvm intrinsic. This will be done next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204802 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 12:52:28 +00:00
Timur Iskhodzhanov
2b84dba718 Follow-up to r204790: don't try to emit line tables if there are no functions with DI in the TU
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204795 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 11:24:36 +00:00
Timur Iskhodzhanov
d4c442f12a Fix PR19239 - Add support for generating debug info for functions without lexical scopes and/or debug info at all
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204790 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 09:50:36 +00:00
Rafael Espindola
72db10a995 Revert "Prevent alias from pointing to weak aliases."
This reverts commit r204781.

I will follow up to with msan folks to see what is what they
were trying to do with aliases to weak aliases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204784 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 06:14:40 +00:00
Rafael Espindola
33845aa8c4 Prevent alias from pointing to weak aliases.
Aliases are just another name for a position in a file. As such, the
regular symbol resolutions are not applied. For example, given

define void @my_func() {
  ret void
}
@my_alias = alias weak void ()* @my_func
@my_alias2 = alias void ()* @my_alias

We produce without this patch:

        .weak   my_alias
my_alias = my_func
        .globl  my_alias2
my_alias2 = my_alias

That is, in the resulting ELF file my_alias, my_func and my_alias are
just 3 names pointing to offset 0 of .text. That is *not* the
semantics of IR linking. For example, linking in a

@my_alias = alias void ()* @other_func

would require the strong my_alias to override the weak one and
my_alias2 would end up pointing to other_func.

There is no way to represent that with aliases being just another
name, so the best solution seems to be to just disallow it, converting
a miscompile into an error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204781 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 04:48:47 +00:00
Duncan P. N. Exon Smith
27e1ca8189 blockfreq: Implement Pass::releaseMemory()
Implement Pass::releaseMemory() in BlockFrequencyInfo and
MachineBlockFrequencyInfo.  Just delete the private implementation when
not in use.  Switch to a std::unique_ptr to make the logic more clear.

<rdar://problem/14292693>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204741 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 18:01:38 +00:00
Duncan P. N. Exon Smith
8451e1baa9 blockfreq: Use const in MachineBlockFrequencyInfo
<rdar://problem/14292693>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204740 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 18:01:32 +00:00
Juergen Ributzka
6ac0491001 [DAG] Keep the opaque constant flag when performing unary constant folding operations.
Usually opaque constants shouldn't be folded, unless they are simple unary
operations that don't create new constants. Although this shouldn't drop the
opaque constant flag. This commit fixes this.

Related to <rdar://problem/14774662>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204737 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 18:01:20 +00:00
Matt Arsenault
71a8d2baba Fix creating illegal setcc cond codes.
If GT/UGT or LT/ULT were set to expand, a comparison
with a constant would replace it with the illegal
cond code.

There are several more places later in this function that
will have the same basic problem.

Theoretically R600 should hit this problem for a test,
but for some reason it doesn't.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204727 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 16:09:21 +00:00
David Majnemer
4fd5cd06c8 WinCOFF: Add support for -fdata-sections
This is a pretty straight forward translation for COFF, we just need to
stick the data in a COMDAT section marked as
IMAGE_COMDAT_SELECT_NODUPLICATES.

N.B. We must be careful to avoid sticking entities with private linkage
in COMDAT groups.  COFF is pretty hostile to the renaming of entities so
we must be careful to disallow GlobalVariables with unstable names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204703 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 06:14:26 +00:00
David Blaikie
9d5961d0d8 DebugInfo: Add GNU_addr_base and GNU_ranges_base only when there are addresses or ranges
Based on code review feedback from Eric in r204672.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204702 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 05:34:24 +00:00
David Blaikie
b13d54f588 DebugInfo: Support debug_loc under fission
Implement debug_loc.dwo, as well as llvm-dwarfdump support for dumping
this section.

Outlined in the DWARF5 spec and http://gcc.gnu.org/wiki/DebugFission the
debug_loc.dwo section has more variation than the standard debug_loc,
allowing 3 different forms of entry (plus the end of list entry). GCC
seems to, and Clang certainly, only use one form, so I've just
implemented dumping support for that for now.

It wasn't immediately obvious that there was a good refactoring to share
the implementation of dumping support between debug_loc and
debug_loc.dwo, so they're separate for now - ideas welcome or I may come
back to it at some point.

As per a comment in the code, we could choose different forms that may
reduce the number of debug_addr entries we emit, but that will require
further study.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204697 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 01:44:02 +00:00
David Blaikie
6cfebbd64d DebugInfo: Remove unnecessary zero-size check
This seems excessive - switching section isn't expensive (or if it is
we're already being wasteful, since we emitted the debug_loc section
symbol earlier anyway) and otherwise there's no work that happens in
this function when the list is empty.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204696 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 01:43:56 +00:00
Manman Ren
692d1830f3 Register Allocator: check other options before using a CSR for the first time.
When register allocator's stage is RS_Spill, we choose spill over using the CSR
for the first time, if the spill cost is lower than CSRCost. 
When register allocator's stage is < RS_Split, we choose pre-splitting over
using the CSR for the first time, if the cost of splitting is lower than
CSRCost.

CSRCost is set with command-line option "regalloc-csr-first-time-cost". The
default value is 0 to generate the same codes as before this commit.

With a value of 15 (1 << 14 is the entry frequency), I measured performance
gain of 3% on 253.perlbmk and 1.7% on 197.parser, with instrumented PGO,
on an arm device.

rdar://16162005


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204690 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 00:16:25 +00:00
Manman Ren
66124f9e89 Register Allocator: refactoring (no functionality change).
Factor out two functions calculateRegionSplitCost and doRegionSplit
from tryRegionSplit. These two functions will be used in coming patches.

rdar://16162005


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204684 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 23:23:42 +00:00
David Blaikie
0f53443d82 DebugInfo: Simplify debug loc list handling by keeping separate lists
Rather than using a flat list with "empty" entries (ala the actual
on-disk format), keep separate lists for each variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204680 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 22:38:38 +00:00
David Blaikie
7385c3207c DwarfDebug: Simplify debug_loc merging
No functional change intended.

Merging up-front rather than delaying this task until later. This just
seems simpler and more efficient (avoiding growing the debug loc list
only to have to skip over those post-merged entries, etc).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204679 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 22:27:06 +00:00
Adrian Prantl
1b14452fe4 Get rid of an unnecessary use of the * and & operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204673 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 21:33:01 +00:00
David Blaikie
882d89ead8 DebugInfo: Add DW_AT_GNU_ranges_base to skeleton CUs
This is used to avoid relocations in the dwo file by allowing
DW_AT_ranges specified in debug_info.dwo to be relative to this base
address. (r204667 implements the base-relative DW_AT_ranges side of
this)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204672 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 21:31:35 +00:00
David Blaikie
f4ec1889db DebugInfo: Implement relative addressing for DW_AT_ranges under fission
This removes the debug_ranges relocations from debug_info.dwo (but
doesn't implement the DW_AT_GNU_ranges_base which is also necessary for
correct functioning)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204668 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 21:07:27 +00:00
David Blaikie
05e62b507a DebugInfo: Don't emit relocations to abbreviations in debug_info.dwo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204667 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 20:53:02 +00:00
David Blaikie
f2c696ac66 DwarfDebug: Remove an unused parameter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204665 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 20:31:01 +00:00
David Blaikie
fcd547ce03 Remove unused parameter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204663 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 20:28:10 +00:00
Tom Stellard
b15ac1b99b SelectionDAG: Allow promotion of SELECT nodes from float to int types
And vice-versa, as long as the types are the same width.

There are a few R600 tests that will cover this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204616 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 16:07:28 +00:00
David Majnemer
77df5169a8 WinCOFF: Add support for -ffunction-sections
This is a pretty straight forward translation for COFF, we just need to
stick the function in a COMDAT section marked as
IMAGE_COMDAT_SELECT_NODUPLICATES.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204565 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-23 17:47:39 +00:00
Nuno Lopes
2ca626570f remove a bunch of unused private methods
found with a smarter version of -Wunused-member-function that I'm playwing with.
Appologies in advance if I removed someone's WIP code.

 include/llvm/CodeGen/MachineSSAUpdater.h            |    1 
 include/llvm/IR/DebugInfo.h                         |    3 
 lib/CodeGen/MachineSSAUpdater.cpp                   |   10 --
 lib/CodeGen/PostRASchedulerList.cpp                 |    1 
 lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp    |   10 --
 lib/IR/DebugInfo.cpp                                |   12 --
 lib/MC/MCAsmStreamer.cpp                            |    2 
 lib/Support/YAMLParser.cpp                          |   39 ---------
 lib/TableGen/TGParser.cpp                           |   16 ---
 lib/TableGen/TGParser.h                             |    1 
 lib/Target/AArch64/AArch64TargetTransformInfo.cpp   |    9 --
 lib/Target/ARM/ARMCodeEmitter.cpp                   |   12 --
 lib/Target/ARM/ARMFastISel.cpp                      |   84 --------------------
 lib/Target/Mips/MipsCodeEmitter.cpp                 |   11 --
 lib/Target/Mips/MipsConstantIslandPass.cpp          |   12 --
 lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp              |   21 -----
 lib/Target/NVPTX/NVPTXISelDAGToDAG.h                |    2 
 lib/Target/PowerPC/PPCFastISel.cpp                  |    1 
 lib/Transforms/Instrumentation/AddressSanitizer.cpp |    2 
 lib/Transforms/Instrumentation/BoundsChecking.cpp   |    2 
 lib/Transforms/Instrumentation/MemorySanitizer.cpp  |    1 
 lib/Transforms/Scalar/LoopIdiomRecognize.cpp        |    8 -
 lib/Transforms/Scalar/SCCP.cpp                      |    1 
 utils/TableGen/CodeEmitterGen.cpp                   |    2 
 24 files changed, 2 insertions(+), 261 deletions(-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204560 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-23 17:09:26 +00:00
Andrea Di Biagio
d47cb57ab8 [DAG] Fix an assertion failure caused by an invalid cast in method 'BuildVectorSDNode::isConstantSplat'
This patch renames method 'isConstantSplat' as 'getConstantSplatValue'
(mainly for consistency reasons), and rewrites its logic to ensure
that we always perform a legal 'cast<ConstantSDNode>'.

Added test shift-combine-crash.ll to verify that DAGCombiner no longer crashes with an assertion failure in the attempt to simplify a vector shift by a vector of all undef counts.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204536 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-22 01:47:22 +00:00
Adrian Prantl
e25ab8e305 Delete stale comment. Thanks, Eric!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204530 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 22:58:25 +00:00
Adrian Prantl
0fb178b831 Dwarf Debug: Remove some cargo-cult type uniquing. Scopes do not have
an ID, so this is a noop.
Thanks Manman for catching this!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204528 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 22:16:32 +00:00
Arnaud A. de Grandmaison
96c049d56d Remove some dead assignements found by scan-build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204526 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 21:54:46 +00:00
Manman Ren
8dbd561a88 Register allocator: add condition to hoist a spill to outer loop.
We make sure a spill is not hoisted to a hotter outer loop by adding
a condition. Hoist a spill to outer loop if there are multiple dependents
(it can be beneficial if more than one dependents are hoisted) or
if DepSV (the hoisting source) is hotter than SV (the hoisting destination).

rdar://16268194


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204522 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 21:46:24 +00:00
David Blaikie
4d221b3e89 DebugInfo: Omit DW_AT_addr_base from skeletal type units.
Type units have no addresses, so there's no need for DW_AT_addr_base.
This removes another relocation from every skeletal type unit and brings
LLVM's skeletal type units in line with GCC's (containing only
GNU_dwo_name (strp), comp_dir (strp), and GNU_pubnames (flag_present)).

Cary's got some ideas about using str_index in the .o file to reduce
those last two relocations (well, replace two relocations with one
relocation (pointing to the string index) and two indicies)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204506 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 20:27:21 +00:00
Kevin Qin
c53b3dbc20 Fix an assertion caused by using inline asm with indirect register inputs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204425 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 02:14:50 +00:00
Mark Seaborn
9bb9615e1f Remove LowerInvoke's obsolete "-enable-correct-eh-support" option
This option caused LowerInvoke to generate code using SJLJ-based
exception handling, but there is no code left that interprets the
jmp_buf stack that the resulting code maintained (llvm.sjljeh.jblist).
This option has been obsolete for a while, and replaced by
SjLjEHPrepare.

This leaves the default behaviour of LowerInvoke, which is to convert
invokes to calls.

Differential Revision: http://llvm-reviews.chandlerc.com/D3136

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204388 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20 19:54:47 +00:00
Eric Christopher
56210e69eb Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204378 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20 19:16:20 +00:00
Eric Christopher
8b97f004cb Reapply DW_AT_low/high_pc patch:
Use the range machinery for DW_AT_ranges and DW_AT_high/lo_pc.

    This commit moves us from a single range per subprogram to extending
    ranges if we are:

    a) In the same section, and
    b) In the same enclosing CU.

    This means we have more fine grained ranges for compile units, and fewer
    ranges overall when we have multiple functions in the same CU
    adjacent to each other in the object file.

    Also remove all of the earlier hacks around this functionality for
    function sections etc. Also update all of the testcases to take into
    account the merging functionality.

with a fix for location entries in the debug_loc section:

Make sure that debug loc entries are relative to the low_pc
of the compile unit. This means that when we only have a single
range that the offset should be just relative to the low_pc
of the unit, for multiple ranges for a CU this means that we'll be
relative to 0 which we emit along with DW_AT_ranges.

This mostly shows up with linked binaries, so add a testcase with
multiple CUs so that our location is going to be offset of a CU
with a non-zero low_pc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204377 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20 19:16:16 +00:00
David Blaikie
b5a1fccdc5 Add comments from Eric's review of r204094.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204358 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20 17:05:45 +00:00
Eric Christopher
5a8743ef85 Revert "Use the range machinery for DW_AT_ranges and DW_AT_high/lo_pc."
This appears to trigger failures with optimization and function arguments somehow.

This reverts commit r204277.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204286 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20 00:12:06 +00:00
Eric Christopher
f2a52c372d Use the range machinery for DW_AT_ranges and DW_AT_high/lo_pc.
This commit moves us from a single range per subprogram to extending
ranges if we are:

a) In the same section, and
b) In the same enclosing CU.

This means we have more fine grained ranges for compile units, and fewer
ranges overall when we have multiple functions in the same CU
adjacent to each other in the object file.

Also remove all of the earlier hacks around this functionality for
function sections etc. Also update all of the testcases to take into
account the merging functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204277 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-19 22:42:36 +00:00
David Blaikie
56ce2f5ab8 DebugInfo: Use the comp_dir of the referencing type units when building debug_line.dwo
This isn't a complete fix - it falls back to non-comp_dir when multiple
compile units are in play. Adding a map of comp_dir to table is part of
the more general solution, but I gave up (in the short term) when I
realized I'd also have to calculate the size of each type unit so as to
produce correct DW_AT_stmt_list attributes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204202 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-19 00:11:28 +00:00
Jim Grosbach
e133cd2ea2 MachO: Emit a version-min load command when possible.
When deployment target version information is available, emit it to the
target streamer for inclusion in the object file.

rdar://11337778

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204191 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 22:09:08 +00:00
Eric Christopher
18d3426b89 More header and forward declaration cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204183 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 21:44:12 +00:00
Eric Christopher
a673745a34 Add back the headers we're getting via (likely) transitive includes.
We really do use these things in the header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204180 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 20:58:35 +00:00
Eric Christopher
7f22dc90ad Fix for coding style.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204177 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 20:39:54 +00:00
Eric Christopher
994c303f24 Remove a bunch of unnecessary includes and forward declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204176 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 20:37:10 +00:00
Raul E. Silvera
370981ad17 Add support for scalarizing/splitting vector bswap.
Summary:
  SLP Vectorization of intrinsics (r203707) has exposed cases where the
  expansion of vector bswap is failing (PR19151).

Reviewers: hfinkel

CC: chandlerc

Differential Revision: http://llvm-reviews.chandlerc.com/D3104

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204163 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 17:49:12 +00:00
Adrian Prantl
e1ea4faca1 Debug info: Remove OdrMemberMap from DwarfDebug, it's not necessary.
Follow-up to r203982.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204162 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 17:41:15 +00:00
Andrea Di Biagio
6077ca9abb [DAGCombiner] teach how to simplify xor/and/or nodes according to the following rules:
1)  (AND (shuf (A, C, Mask), shuf (B, C, Mask)) -> shuf (AND (A, B), C, Mask)
 2)  (OR  (shuf (A, C, Mask), shuf (B, C, Mask)) -> shuf (OR  (A, B), C, Mask)
 3)  (XOR (shuf (A, C, Mask), shuf (B, C, Mask)) -> shuf (XOR (A, B), V_0, Mask)

 4)  (AND (shuf (C, A, Mask), shuf (C, B, Mask)) -> shuf (C, AND (A, B), Mask)
 5)  (OR  (shuf (C, A, Mask), shuf (C, B, Mask)) -> shuf (C, OR  (A, B), Mask)
 6)  (XOR (shuf (C, A, Mask), shuf (C, B, Mask)) -> shuf (V_0, XOR (A, B), Mask)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204160 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 17:12:59 +00:00
Adrian Prantl
ff5abbb4d3 DwarfDebug: Only unique retained types instead of all types.
This is a follow-up to r203983 based on feedback from dblaikie and mren (Thanks!)
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204107 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 02:35:03 +00:00
Adrian Prantl
5e8144df32 Switch the type field in DIVariable and DIGlobalVariable over to DITypeRefs.
This allows us to catch more opportunities for ODR-based type uniquing
during LTO.
Paired commit with CFE which updates some testcases to verify the new
DIBuilder behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204106 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 02:34:58 +00:00
Adrian Prantl
4d82ca7462 Replace unnecessary #include directive with forward declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204104 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 02:34:52 +00:00
Eric Christopher
635ed6dfe9 Add explanatory comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204103 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 02:18:27 +00:00
Eric Christopher
b005e96324 Shorten DotDebugLocEntry to just DebugLocEntry and reformat.
No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204102 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 02:18:24 +00:00
David Blaikie
c5b39af329 DebugInfo: Avoid emitting standard opcode lengths in debug_line.dwo headers where opcodes are never used anyway
Introduce a slightly tighter wrapper around the header structure that
handles this use case. (MCDwarfDwoLineTable)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204101 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 02:13:23 +00:00
David Blaikie
9c1e56a84d DebugInfo: Implement debug_line.dwo for file names used in type units during -gsplit-dwarf
This removes an attribute (and more importantly, a relocation) from
skeleton type units and removes some unnecessary file names from the
debug_line section that remains in the .o (and linked executable) file.

There's still a few places we could shave off some more space here:

* use compilation dir of the underlying compilation unit (since all the
  type units share that compilation dir - though this would be more
  complicated in LTO cases where they don't (keep a map of compilation
  dir->line table header?))

* Remove some of the unnecessary header fields from the line table since
  they're not needed in this situation (about 12 bytes per table).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204099 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 01:17:26 +00:00
David Blaikie
2a12c4e5bd DebugInfo: Do not rely on the compilation dir (index 0) for files in line tables shared between compilation units
When emitting assembly there's no support for emitting separate line
tables for each compilation unit - so LLVM emits .loc directives
producing a single line table.

Line tables have an implicit directory (index 0) equal to the
compilation directory (DW_AT_comp_dir) of the compilation unit that
references them.

If multiple compilation units (with possibly disparate compilation
directories) reference the same line table, we must avoid relying on
this ambiguous directory.

Achieve this my simply not setting the compilation directory on the line
table when we're in this situation (multiple units while emitting
assembly).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204094 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 00:11:48 +00:00
David Blaikie
1881227389 DebugInfo: Move getOrCreateSourceID from DwarfDebug to DwarfCompileUnit
We still do a few lookups into the line table mapping in MCContext that
could be factored out into a single lookup (rather than looking it up
once for the table label, once to set the compilation unit, once for
each time we need a file ID, etc... ) but assembly output complicates
that somewhat as we still need a virtual dispatch back to the
MCAsmStreamer in that case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204092 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17 23:53:25 +00:00
David Blaikie
2879a6caa8 DebugInfo: Move line table zero-directory-index (compilation dir) handling into MCDwarf
Our handling of compilation directory in DwarfDebug was broken
(incorrectly using the 'last' compilation directory (that of the last
CU in the metadata list) for all function emission in any CU). By moving
this handling down into MCDwarf the issue is fixed as the compilation
dir is tracked correctly per line table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204089 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17 23:29:40 +00:00
Owen Anderson
92fca73d52 Switch a number of loops in lib/CodeGen over to range-based for-loops, now that
the MachineRegisterInfo iterators are compatible with it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204075 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17 19:36:09 +00:00
Matt Arsenault
94bdb453a4 Make DAGCombiner work on vector bitshifts with constant splat vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204071 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17 18:58:01 +00:00
David Blaikie
daeeb37373 DebugInfo: Use MC line table file entry uniquing for non-asm input as well.
See r204027 for the precursor to this that applied to asm debug info.

This required some non-obvious API changes to handle the case of asm
output (we never go asm->asm so this didn't come up in r204027): the
modification of the file/directory name by MCDwarfLineTableHeader needed
to be reflected in the MCAsmStreamer caller so it could print the
appropriate .file directive, so those StringRef parameters are now
non-const ref (in/out) parameters rather than just const.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204069 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17 18:13:58 +00:00
Adam Nemet
8c8fe42a0d [VectorLegalizer/X86] Don't unvectorize fp_to_uint for v8f32->v8i16
Rather than LegalizeAction::Expand, this needs LegalizeAction::Promote to get
promoted to fp_to_sint v8f32->v8i32.  This is a legal operation on AVX.

For that to work properly, we also need to teach the legalizer about the
specific promotion required here.  The default vector promotion uses
bitcasting to a vector type of the same total size.  We want to promote the
vector element type, effectively widening the operation and then truncating
the result.  This is analogous to the current logic of how int_to_fp is
promoted.

The change also factors out some code from the int_to_fp promotion code to
ValueType::widenIntegerVectorElementType.  This is now shared between
int_to_fp and fp_to_int.

There is no longer need for the custom lowering of fp_to_sint f32->v8i16 in
X86.  It can now go through the new target-independent fp_to_*int promotion
logic.

I also checked that no other target uses Promote for these ops yet, so there
shouldn't be any unexpected change in behavior.

Fixes <rdar://problem/16202247>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204058 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17 17:06:14 +00:00
Lang Hames
3dd951e842 [X86] New and improved VZeroUpperInserter optimization.
- Adds support for inserting vzerouppers before tail-calls.
  This is enabled implicitly by having MachineInstr::copyImplicitOps preserve
  regmask operands, which allows VZeroUpperInserter to see where tail-calls use
  vector registers.

- Fixes a bug that caused the previous version of this optimization to miss some
  vzeroupper insertion points in loops. (Loops-with-vector-code that followed
  loops-without-vector-code were mistakenly overlooked by the previous version).

- New algorithm never revisits instructions.

Fixes <rdar://problem/16228798>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204021 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17 01:22:54 +00:00
Arnaud A. de Grandmaison
3c143dde40 Remove some dead assignements found by scan-build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204013 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-15 22:13:15 +00:00
Adrian Prantl
1d8c02bef3 Debug info: Unique types before emitting them to DWARF, where applicable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203983 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14 23:08:29 +00:00
Adrian Prantl
7e1a3830ca Debug Info: Fix LTO type uniquing for C++ member declarations
based on the ODR.

This adds an OdrMemberMap to DwarfDebug which is used to unique C++
member function declarations based on the unique identifier of their
containing class and their mangled name.
We can't use the usual DIRef mechanism here because DIScopes are indexed
using their entire MDNode, including decl_file and decl_line, which need
not be unique (see testcase).

Prior to this change multiple redundant member function declarations would
end up in the same uniqued DW_TAG_class_type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203982 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14 23:08:25 +00:00
Adrian Prantl
be4056d0a5 typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203980 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14 23:08:17 +00:00
Eric Christopher
f90e07f6c3 Remove command line option for CU hashing. This is on by default now.
Fix up testcases and use of flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203973 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14 21:20:07 +00:00
Eric Christopher
82899d9d60 If we see that we're emitting code for a function that doesn't have
any lexical scopes then go ahead and turn on DW_AT_ranges for the
compile unit since we would be claiming to describe in the CU
a range for which we don't have information in the CU otherwise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203969 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14 20:53:49 +00:00
Eric Christopher
895ec9ed94 Remove the -generate-dwarf-cu-ranges flag.
Rewrite a couple of testcases to cover areas that would be normally
by turning it on into testcases that will follow the logic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203968 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14 20:53:43 +00:00
David Blaikie
2bc7715df9 DwarfDebug: Remove some needless recursion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203946 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14 16:33:32 +00:00
Owen Anderson
b6f478aa66 Revert r203883 (which was more of a bandaid) and fix the real underlying
issue in that the new MachineRegisterInfo bundle iterators didn't
dereference to the START of the bundle, while the old skipBundle()
method did.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203890 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14 05:02:18 +00:00
Pete Cooper
757ed6daf4 Fix issue with r203865. The old behaviour would get a MachineOperand then find the MI for the bundle the MI was in. The new behaviour was failing to get the parent bundle and instead just used the MI from the MachineOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203883 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14 02:28:05 +00:00
Eric Christopher
70506c5fdd Use DW_AT_linkage_name when we're emitting DWARF4 or above.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203867 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13 23:26:25 +00:00
Rafael Espindola
1f21e0dd0d Remove the linker_private and linker_private_weak linkages.
These linkages were introduced some time ago, but it was never very
clear what exactly their semantics were or what they should be used
for. Some investigation found these uses:

* utf-16 strings in clang.
* non-unnamed_addr strings produced by the sanitizers.

It turns out they were just working around a more fundamental problem.
For some sections a MachO linker needs a symbol in order to split the
section into atoms, and llvm had no idea that was the case. I fixed
that in r201700 and it is now safe to use the private linkage. When
the object ends up in a section that requires symbols, llvm will use a
'l' prefix instead of a 'L' prefix and things just work.

With that, these linkages were already dead, but there was a potential
future user in the objc metadata information. I am still looking at
CGObjcMac.cpp, but at this point I am convinced that linker_private
and linker_private_weak are not what they need.

The objc uses are currently split in

* Regular symbols (no '\01' prefix). LLVM already directly provides
whatever semantics they need.
* Uses of a private name (start with "\01L" or "\01l") and private
linkage. We can drop the "\01L" and "\01l" prefixes as soon as llvm
agrees with clang on L being ok or not for a given section. I have two
patches in code review for this.
* Uses of private name and weak linkage.

The last case is the one that one could think would fit one of these
linkages. That is not the case. The semantics are

* the linker will merge these symbol by *name*.
* the linker will hide them in the final DSO.

Given that the merging is done by name, any of the private (or
internal) linkages would be a bad match. They allow llvm to rename the
symbols, and that is really not what we want. From the llvm point of
view, these objects should really be (linkonce|weak)(_odr)?.

For now, just keeping the "\01l" prefix is probably the best for these
symbols. If we one day want to have a more direct support in llvm,
IMHO what we should add is not a linkage, it is just a hidden_symbol
attribute. It would be applicable to multiple linkages. For example,
on weak it would produce the current behavior we have for objc
metadata. On internal, it would be equivalent to private (and we
should then remove private).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203866 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13 23:18:37 +00:00
Owen Anderson
bf63022492 Phase 2 of the great MachineRegisterInfo cleanup. This time, we're changing
operator* on the by-operand iterators to return a MachineOperand& rather than
a MachineInstr&.  At this point they almost behave like normal iterators!

Again, this requires making some existing loops more verbose, but should pave
the way for the big range-based for-loop cleanups in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203865 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13 23:12:04 +00:00
Ekaterina Romanova
ed2ca70ccf Fix for http://llvm.org/bugs/show_bug.cgi?id=18590
This patch fixes the bug in peephole optimization that folds a load which defines one vreg into the one and only use of that vreg. With debug info, a DBG_VALUE that referenced the vreg considered to be a use, preventing the optimization. The fix is to ignore DBG_VALUE's during the optimization, and undef a DBG_VALUE that references a vreg that gets removed.
Patch by Trevor Smigiel!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203829 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13 18:47:12 +00:00
Manuel Jacob
f8909fa140 CodeGenPrep: sink extends of illegal types into use block.
Summary:
This helps the instruction selector to lower an i64 * i64 -> i128
multiplication into a single instruction on targets which support it.

This is an update of D2973 which was reverted because of a bug reported
as PR19084.

Reviewers: t.p.northover, chapuni

Reviewed By: t.p.northover

CC: llvm-commits, alex, chapuni

Differential Revision: http://llvm-reviews.chandlerc.com/D3021

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203797 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13 13:36:25 +00:00
Owen Anderson
76604af774 Phase 1 of refactoring the MachineRegisterInfo iterators to make them suitable
for use with C++11 range-based for-loops.

The gist of phase 1 is to remove the skipInstruction() and skipBundle()
methods from these iterators, instead splitting each iterator into a version
that walks operands, a version that walks instructions, and a version that
walks bundles.  This has the result of making some "clever" loops in lib/CodeGen
more verbose, but also makes their iterator invalidation characteristics much
more obvious to the casual reader. (Making them concise again in the future is a
good motivating case for a pre-incrementing range adapter!)

Phase 2 of this undertaking with consist of removing the getOperand() method,
and changing operator*() of the operand-walker to return a MachineOperand&.  At
that point, it should be possible to add range views for them that work as one
might expect.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203757 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13 06:02:25 +00:00
Rafael Espindola
38048cdb1c Reject alias to undefined symbols in the verifier.
On ELF and COFF an alias is just another name for a position in the file.
There is no way to refer to a position in another file, so an alias to
undefined is meaningless.

MachO currently doesn't support aliases. The spec has a N_INDR, which when
implemented will have a different set of restrictions. Adding support for
it shouldn't be harder than any other IR extension.

For now, having the IR represent what is actually possible with current
tools makes it easier to fix the design of GlobalAlias.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203705 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 20:15:49 +00:00
Eric Christopher
365f0455a6 When computing the size of a base type be conservative if the type
is a declaration and return the size of the type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203690 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 18:18:05 +00:00
Eric Christopher
097963a442 Use values we've already computed, update comment.
No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203681 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 17:14:46 +00:00
Eric Christopher
020026c5f6 Turn on hashing by default for split dwarf compile units.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203680 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 17:14:43 +00:00
David Blaikie
a3802ac246 DebugInfo: Use common line/file attribute construction code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203676 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 16:51:06 +00:00
Patrik Hagglund
792a1d7191 Replace '#include ValueTypes.h' with forward declarations.
In some cases the include is pushed "downstream" (or removed if
unused).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203644 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 08:00:24 +00:00
David Blaikie
9d3e746b85 DebugInfo: Omit pubnames/pubtypes when compiling with -gmlt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203634 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 03:34:38 +00:00
David Blaikie
1c7fef193f DebugInfo: Do not emit pubnames/pubtypes sections if they are empty
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203622 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 23:35:06 +00:00
David Blaikie
ef953d6399 DebugInfo: Avoid re-looking up the DwarfUnit when emitting pubnames/pubtypes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203620 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 23:23:39 +00:00
David Blaikie
e98b0e466f DebugInfo: Refactor emitDebugPubNames/Types into a common implementation
I could fold the callers into their one call site, but the indirection
(given how verbose choosing the section is) seemed helpful.

The use of a member function pointer's a bit "tricky", but seems limited
enough, the call sites are simple/clean/clear, and there's only one use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203619 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 23:18:15 +00:00
David Blaikie
0932a749a3 Accept Twine's to AsmPrinter::getTempSymbol (refactoring for an incoming change)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203617 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 23:12:08 +00:00
David Blaikie
667376028f DebugInfo: Remove unused labels now that we just emit DW_AT_gnu_pubnames as a flag (as of r203082)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203612 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 22:24:33 +00:00
Benjamin Kramer
dabc5073b2 Remove copy ctors that did the same thing as the default one.
The code added nothing but potentially disabled move semantics and made
types non-trivially copyable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203563 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 11:32:49 +00:00
Tim Northover
ca396e391e IR: add a second ordering operand to cmpxhg for failure
The syntax for "cmpxchg" should now look something like:

	cmpxchg i32* %addr, i32 42, i32 3 acquire monotonic

where the second ordering argument gives the required semantics in the case
that no exchange takes place. It should be no stronger than the first ordering
constraint and cannot be either "release" or "acq_rel" (since no store will
have taken place).

rdar://problem/15996804

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203559 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 10:48:52 +00:00
Matt Arsenault
99b683ba6c Fix non 2-space indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203514 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 00:01:25 +00:00
Raul E. Silvera
6df2b69098 When analyzing vectors of element type that require legalization,
the legalization cost must be included to get an accurate
estimation of the total cost of the scalarized vector.
The inaccurate cost triggered unprofitable SLP vectorization on
32-bit X86.

Summary:
Include legalization overhead when computing scalarization cost

Reviewers: hfinkel, nadav

CC: chandlerc, rnk, llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2992

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203509 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-10 22:59:13 +00:00
Craig Topper
3b89e528c4 [C++11] Remove 'virtual' keyword from methods marked with 'override' keyword.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203444 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-10 05:29:18 +00:00
Chandler Carruth
436906ab3c [TTI] There is actually no realistic way to pop TTI implementations off
the stack of the analysis group because they are all immutable passes.
This is made clear by Craig's recent work to use override
systematically -- we weren't overriding anything for 'finalizePass'
because there is no such thing.

This is kind of a lame restriction on the API -- we can no longer push
and pop things, we just set up the stack and run. However, I'm not
invested in building some better solution on top of the existing
(terrifying) immutable pass and legacy pass manager.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203437 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-10 02:45:14 +00:00
Benjamin Kramer
e07a3f5707 StackColoring: Use range-based for loops.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203415 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 15:44:45 +00:00
Benjamin Kramer
1ceef0ef50 MachineModuleInfo: Turn nested std::pairs into a proper struct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203414 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 15:44:39 +00:00
NAKAMURA Takumi
e086782817 Revert r203230, "CodeGenPrep: sink extends of illegal types into use block."
It choked i686 stage2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203386 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 11:01:07 +00:00
Chandler Carruth
36b699f2b1 [C++11] Add range based accessors for the Use-Def chain of a Value.
This requires a number of steps.
1) Move value_use_iterator into the Value class as an implementation
   detail
2) Change it to actually be a *Use* iterator rather than a *User*
   iterator.
3) Add an adaptor which is a User iterator that always looks through the
   Use to the User.
4) Wrap these in Value::use_iterator and Value::user_iterator typedefs.
5) Add the range adaptors as Value::uses() and Value::users().
6) Update *all* of the callers to correctly distinguish between whether
   they wanted a use_iterator (and to explicitly dig out the User when
   needed), or a user_iterator which makes the Use itself totally
   opaque.

Because #6 requires churning essentially everything that walked the
Use-Def chains, I went ahead and added all of the range adaptors and
switched them to range-based loops where appropriate. Also because the
renaming requires at least churning every line of code, it didn't make
any sense to split these up into multiple commits -- all of which would
touch all of the same lies of code.

The result is still not quite optimal. The Value::use_iterator is a nice
regular iterator, but Value::user_iterator is an iterator over User*s
rather than over the User objects themselves. As a consequence, it fits
a bit awkwardly into the range-based world and it has the weird
extra-dereferencing 'operator->' that so many of our iterators have.
I think this could be fixed by providing something which transforms
a range of T&s into a range of T*s, but that *can* be separated into
another patch, and it isn't yet 100% clear whether this is the right
move.

However, this change gets us most of the benefit and cleans up
a substantial amount of code around Use and User. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203364 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 03:16:01 +00:00
Craig Topper
d659d34219 [C++11] Add 'override' keyword to virtual methods that override their base class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203339 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-08 06:31:39 +00:00
David Blaikie
5af111c380 DebugInfo: Use DW_FORM_data4 for DW_AT_high_pc in DW_TAG_lexical_blocks
Suggested by Adrian Prantl in code review for r203187

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203323 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-08 00:58:20 +00:00
Eric Christopher
b1c8844101 Add support for hashing location information for CU level hashes.
Add a testcase based on sret.cpp where we can now hash the entire
compile unit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203319 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-08 00:29:41 +00:00
Adam Nemet
d07494f102 [DAGCombiner] Distribute TRUNC through AND in rotation amount
This is already done for shifts.  Allow it for rotations as well. E.g.:

   (rotl:i32 x, (trunc (and y, 31))) -> (rotl:i32 x, (and (trunc y), 31))

Use the newly factored-out distributeTruncateThroughAnd.

With this patch and some X86.td tweaks we should be able to remove redundant
masking of the rotation amount like in the example above.  HW implicitly
performs this masking.

The testcase will be added as part of the X86 patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203316 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 23:56:30 +00:00
Adam Nemet
316d3e3085 [DAGCombiner] Recognize another rotation idiom
This is the new idiom:

  x<<(y&31) | x>>((0-y)&31)

which is recognized as:

  x ROTL (y&31)

The change refines matchRotateSub.  In
Neg & (OpSize - 1) == (OpSize - Pos) & (OpSize - 1), if Pos is
Pos' & (OpSize - 1) we can just use Pos' instead of Pos.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203315 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 23:56:28 +00:00
Adam Nemet
622f350944 [DAGCombiner] Slightly improve readability of matchRotateSub
Slightly change the wording in the function comment. Originally, it can be
misunderstood as we turned the input into two subsequent rotates.

Better connect the comment which talks about Mask and the code which used
LoBits.  Renamed variable to MaskLoBits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203314 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 23:56:24 +00:00
Arnold Schwaighofer
aa5b17b359 ISel: Make VSELECT selection terminate in cases where the condition type has to
be split and the result type widened.

When the condition of a vselect has to be split it makes no sense widening the
vselect and thereby widening the condition. We end up in an endless loop of
widening (vselect result type) and splitting (condition mask type) doing this.
Instead, split both the condition and the vselect and widen the result.

I ran this over the test suite with i686 and mattr=+sse and saw no regressions.

Fixes PR18036.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203311 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 23:25:55 +00:00
Adrian Prantl
bd86fbe0d7 Remove unnecessary test for Darwin and update testcase to be a little less
horrible/fragile.
rdar://problem/16264854

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203309 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 23:07:21 +00:00
Eric Christopher
e373dfa819 Add a virtual destructor to quiet a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203307 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 22:53:36 +00:00
Eric Christopher
a8c247ca54 Actually add the header file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203305 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 22:43:09 +00:00
Eric Christopher
096eaf857e Two part patch:
First: refactor out the emission of entries into the .debug_loc section
into its own routine.

Second: add a new class ByteStreamer that can be used to either emit
using an AsmPrinter or hash using DIEHash the series of bytes that
would be emitted. Use this in all of the location emission routines
for the .debug_loc section.

No functional change intended outside of a few additional comments
in verbose assembly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203304 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 22:40:37 +00:00
Eric Christopher
a8d9fe2248 Add include guards and make public a few routines that add values
to the hash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203303 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 22:40:30 +00:00
Adrian Prantl
d013411d96 Revert "Remove unnecessary check for Darwin. rdar://problem/16264854"
This breaks linux buildbots. Go figure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203300 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 22:18:23 +00:00
Adrian Prantl
1630c3cd32 Remove unnecessary check for Darwin. rdar://problem/16264854
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203297 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 22:04:42 +00:00
David Blaikie
9623e46f00 DebugInfo: Use DW_FORM_data4 for DW_AT_high_pc in inlined functions
Suggested by Adrian Prantl in code review for r203187.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203296 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 22:00:56 +00:00
Benjamin Kramer
e1362f1ebd [C++11] Convert sort predicates into lambdas.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203288 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 21:35:39 +00:00
Eric Christopher
6a90a1e19c Fix up formatting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203286 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 21:27:42 +00:00
Benjamin Kramer
adb294d284 [C++11] DwarfDebug: Turn single-use functors into lambdas.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203276 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 19:41:22 +00:00
Benjamin Kramer
3bfc4d8e13 [C++11] DwarfDebug: Use range-based for loops.
It has a lot of them with complex types. C++11 really shines here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203270 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 19:09:39 +00:00
David Blaikie
5ba79a9952 DebugInfo: Refactor high_pc/low_pc construction into reusable function
For incoming improvements to inlined functions and lexical blocks
suggested by Adrian Prantl in review of r203187.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203263 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 18:49:45 +00:00
David Blaikie
f7952d3a5f DebugInfo: Restrict DW_AT_high_pc encoding as data4 offset to DWARF 4 as per spec
Code review feedback to r203187 from Oliver Stannard. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203256 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 18:04:24 +00:00
Tim Northover
fa9e4b52f4 CodeGenPrep: sink extends of illegal types into use block.
This helps the instruction selector to lower an i64 * i64 -> i128
multiplication into a single instruction on targets which support it.

Patch by Manuel Jacob.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203230 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 11:04:30 +00:00
Craig Topper
490750b0cf Remove unused method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203221 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 09:26:53 +00:00
Craig Topper
9f998de891 [C++11] Add 'override' keyword to virtual methods that override their base class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203220 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 09:26:03 +00:00
David Majnemer
508e0c4d34 MC: Remove superfluous section attribute flag definitions
Summary:
llvm/MC/MCSectionMachO.h and llvm/Support/MachO.h both had the same
definitions for the section flags.  Instead, grab the definitions out of
support.

No functionality change.

Reviewers: grosbach, Bigcheese, rafael

Reviewed By: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2998

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203211 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 07:36:05 +00:00
Rafael Espindola
7d7d99622f Replace PROLOG_LABEL with a new CFI_INSTRUCTION.
The old system was fairly convoluted:
* A temporary label was created.
* A single PROLOG_LABEL was created with it.
* A few MCCFIInstructions were created with the same label.

The semantics were that the cfi instructions were mapped to the PROLOG_LABEL
via the temporary label. The output position was that of the PROLOG_LABEL.
The temporary label itself was used only for doing the mapping.

The new CFI_INSTRUCTION has a 1:1 mapping to MCCFIInstructions and points to
one by holding an index into the CFI instructions of this function.

I did consider removing MMI.getFrameInstructions completelly and having
CFI_INSTRUCTION own a MCCFIInstruction, but MCCFIInstructions have non
trivial constructors and destructors and are somewhat big, so the this setup
is probably better.

The net result is that we don't create temporary labels that are never used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203204 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 06:08:31 +00:00
David Blaikie
4b102527fa DebugInfo: Limit r203187 to non-darwin as lldb can't handle this yet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203192 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 02:19:41 +00:00
Eric Christopher
d5c1fb9676 Move some dwarf emission routines to AsmPrinterDwarf.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203191 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 01:44:14 +00:00
Eric Christopher
0e42ae9d8b 80-column fixups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203190 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 01:44:12 +00:00
David Blaikie
34fa5640b8 DebugInfo: Emit DW_TAG_subprogram's DW_AT_high_pc as an offset from the low_pc
This removes a relocation from each subprogram, reducing link times,
etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203187 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 01:30:55 +00:00
Rafael Espindola
b52d0c0d74 Remove shouldEmitUsedDirectiveFor.
Clang now uses llvm.compiler.used for these cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203174 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 22:47:08 +00:00
Andrea Di Biagio
e54158504f [X86] Teach the DAGCombiner how to fold a OR of two shufflevector nodes.
This patch teaches the DAGCombiner how to fold a binary OR between two
shufflevector into a single shuffle vector when possible.

The rules are:
  1. fold (or (shuf A, V_0, MA), (shuf B, V_0, MB)) -> (shuf A, B, Mask1)
  2. fold (or (shuf A, V_0, MA), (shuf B, V_0, MB)) -> (shuf B, A, Mask2)

The DAGCombiner can take advantage of the fact that OR is commutative and
compute two possible shuffle masks (Mask1 and Mask2) for the resulting
shuffle node.

Before folding a dag according to either rule 1 or 2, DAGCombiner verifies
that the resulting shuffle mask is legal for the target.
DAGCombiner would firstly try to fold according to 1.; If not possible
then it will try to fold according to 2.
If both Mask1 and Mask2 are illegal then we conservatively don't fold
the OR instruction.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203156 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 20:19:52 +00:00
Eric Christopher
27cfb7a41d Constify a few things with DotDebugLocEntry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203150 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 19:51:16 +00:00
Eric Christopher
6c43168ce3 Move DIEEntry handling inside the main switch statement.
No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203142 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 18:59:42 +00:00
Matt Arsenault
161e3a80b2 R600: Fix extloads from i8 / i16 to i64.
This appears to only be working for global loads. Private
and local break for other reasons.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203135 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 17:34:12 +00:00
Rafael Espindola
371e07f1a9 Micro optimization: this code only needs to look at eh labels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203127 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 16:31:40 +00:00
Ahmed Charles
f4ccd11075 Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes
overloads to various functions which are used by those projects and llvm
which have OwningPtr's as parameters. This should allow out of tree
projects some time to move. There are also no changes to libs/Target,
which should help out of tree targets have time to move, if necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 05:51:42 +00:00
David Blaikie
ca8b562f2d DebugInfo: Tag units as having been indexed in GNU pubnames by using a DW_AT_GNU_pubnames of DW_FORM_flag(_present) rather than sec_offsets to the pubnames/types sections
This is consistent with GDB ToT and reduces the number of relocations in
(type and compile) units, substantially reducing relocations and debug
size in fission + type units builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203082 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 05:47:39 +00:00
David Blaikie
4b2ab80c3e DebugInfo: Shrink pubnames/pubtypes in the presence of type units by only emitting pub sections for compile units
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203057 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 01:42:00 +00:00
Eric Christopher
b29a86a832 Add some helpful comments on DIEValue types that we expect to hash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203055 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 01:32:56 +00:00
Chandler Carruth
f4ec8bfaec [Layering] Move DebugInfo.h into the IR library where its implementation
already lives.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203046 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 00:46:21 +00:00
Eric Christopher
028462964b Rewrite the attribute hashing algorithm to use the type of the value
pointed to by the attribute, rather than the form as a first
step to determining how to hash the values. No functional change
intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203044 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 00:38:32 +00:00
Chandler Carruth
7cf9764966 [Layering] Move DIBuilder.h into the IR library where its implementation
already lives.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203038 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 00:22:06 +00:00
Eric Christopher
001e676e4b Remove the last of the special case code for emitting attributes.
This works by moving the existing code into the DIEValue hierarchy
and using the DwarfDebug pointer off of the AsmPrinter to access
any global information we need.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203033 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 00:00:56 +00:00
Eric Christopher
ec3c85e043 constify a few accessors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203032 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 00:00:53 +00:00
Eric Christopher
26148a62c3 Remove special case in the DIEValue printing since it only existed
for verbose asm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203031 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 00:00:49 +00:00
Eric Christopher
517aaf27d7 Add a DIELocList class to handle pointers into the location list.
This enables us to figure out where in the debug_loc section our
locations are so that we can eventually hash them. It also helps
remove some special case code in emission. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203018 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 22:41:20 +00:00
Rafael Espindola
fc5436c951 Always print the implicit .text at the start of an asm file.
Before llvm-mc would print it, but llc was assuming that it would produce
another section changing directive before one was needed. That assumption is
false with inline asm.

Fixes PR19049.

Another option would be to always create the section, but in the asm printer
avoid printing sections changes during initialization. That would work, but
* We do use the fact that llvm-mc prints it in testing. The tests can be changed
  if needed.
* A quick poll on IRC suggest that most developers prefer the implicit .text to
  be printed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203001 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 20:09:15 +00:00
Chandler Carruth
b810517338 [Layering] Move DebugLoc.h into the IR library. The implementation
already lived there and it is where it belongs -- this is the in-memory
debug location representation.

This is just cleanup -- Modules can actually cope with this, but that
doesn't make it right. After chatting with folks that have out-of-tree
stuff, going ahead and moving the rest of the headers seems preferable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202960 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 10:30:38 +00:00
Ahmed Charles
1a6eca243f [C++11] Replace OwningPtr::take() with OwningPtr::release().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202957 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 10:19:29 +00:00
Andrew Trick
a6ace00520 Make stackmap machineinstrs clobber the scratch regs too.
Patchpoints already did this. Doing it for stackmaps is a convenience
for the runtime in the event that it needs to scratch register to
patch or perform a runtime call thunk.

Unlike patchpoints, we just assume the AnyRegCC calling
convention. This is the only language and target independent calling
convention specific to stackmaps so makes sense.  Although the calling
convention is not currently used to select the scratch registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202943 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 07:08:16 +00:00
Hans Wennborg
a9b2552fd9 Fix unused variable in FunctionLoweringInfo.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202932 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 03:21:23 +00:00
Hans Wennborg
2f471c83a0 Check for dynamic allocas and inline asm that clobbers sp before building
selection dag (PR19012)

In X86SelectionDagInfo::EmitTargetCodeForMemcpy we check with MachineFrameInfo
to make sure that ESI isn't used as a base pointer register before we choose to
emit rep movs (which clobbers esi).

The problem is that MachineFrameInfo wouldn't know about dynamic allocas or
inline asm that clobbers the stack pointer until SelectionDAGBuilder has
encountered them.

This patch fixes the problem by checking for such things when building the
FunctionLoweringInfo.

Differential Revision: http://llvm-reviews.chandlerc.com/D2954

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202930 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 02:43:26 +00:00
Eric Christopher
e6d0bedb06 Make the DIEValue constructor even more explicit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202926 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 02:14:02 +00:00
Eric Christopher
8b3fad9343 Use a bool for whether or not an abbreviation has children rather than
using a full uint16_t with the flag value... which happens to be
0 or 1. Update the class for bool values and rename functions slightly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202921 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 01:44:58 +00:00
Eric Christopher
33a9132fd4 Use dwarf::Attribute instead of a bare uint16_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202920 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 01:10:59 +00:00
Eric Christopher
d3190ef439 Expand slightly on comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202919 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 00:43:43 +00:00
Eric Christopher
9ad8924df3 Unindent namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202918 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 00:43:41 +00:00
Adam Nemet
f48dbd869e [DAGCombiner] Factor out distributeTruncateThroughAnd
Currently this code is duplicated across visitSHL, visitSRA and visitSRL.  The
plan is to add rotates as clients to this new function.

There is no functional change intended here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202908 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 23:28:31 +00:00
Chandler Carruth
8f124fe884 [Modules] Move the LeakDetector header into the IR library where the
source file had already been moved. Also move the unittest into the IR
unittest library.

This may seem an odd thing to put in the IR library but we only really
use this with instructions and it needs the LLVM context to work, so it
is intrinsically tied to the IR library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202842 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 12:46:06 +00:00
Chandler Carruth
03e36d752c [Modules] Move CFG.h to the IR library as it defines graph traits over
IR types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202827 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 11:45:46 +00:00
Chandler Carruth
7225e27b4c [Modules] Move ValueMap to the IR library. While this class does not
directly care about the Value class (it is templated so that the key can
be any arbitrary Value subclass), it is in fact concretely tied to the
Value class through the ValueHandle's CallbackVH interface which relies
on the key type being some Value subclass to establish the value handle
chain.

Ironically, the unittest is already in the right library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202824 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 11:26:31 +00:00
Chandler Carruth
eb3d76da81 [Modules] Move ValueHandle into the IR library where Value itself lives.
Move the test for this class into the IR unittests as well.

This uncovers that ValueMap too is in the IR library. Ironically, the
unittest for ValueMap is useless in the Support library (honestly, so
was the ValueHandle test) and so it already lives in the IR unittests.
Mmmm, tasty layering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202821 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 11:17:44 +00:00
Chandler Carruth
df3d8e8b4d [Modules] Move the LLVM IR pattern match header into the IR library, it
obviously is coupled to the IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202818 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 11:08:18 +00:00
Chandler Carruth
4bbfbdf7d7 [Modules] Move CallSite into the IR library where it belogs. It is
abstracting between a CallInst and an InvokeInst, both of which are IR
concepts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202816 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 11:01:28 +00:00
Chandler Carruth
bd7cba0d81 [Modules] Move GetElementPtrTypeIterator into the IR library. As its
name might indicate, it is an iterator over the types in an instruction
in the IR.... You see where this is going.

Another step of modularizing the support library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202815 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 10:40:04 +00:00
Chandler Carruth
1decd56b8d [cleanup] Re-sort all the includes with utils/sort_includes.py.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202811 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 10:07:28 +00:00
Benjamin Kramer
9efaf2f2da [C++11] Use std::tie to simplify compare operators.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202751 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-03 19:58:30 +00:00
Diego Novillo
6f8c0c0613 Add DWARF discriminator support to DILexicalBlocks.
This adds support for emitting discriminators from DILexicalBlocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202736 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-03 18:53:17 +00:00
Lang Hames
98b5aaeebb Re-apply r202551, which introduced new PBQP solver.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202735 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-03 18:50:05 +00:00
Benjamin Kramer
a4f0aad951 [C++11] Replace llvm::tie with std::tie.
The old implementation is no longer needed in C++11.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202644 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 13:30:33 +00:00
Benjamin Kramer
d628f19f5d [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.
Remove the old functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202636 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 12:27:27 +00:00
Craig Topper
629b96cb4f Switch all uses of LLVM_OVERRIDE to just use 'override' directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202621 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 09:09:27 +00:00