Commit Graph

15780 Commits

Author SHA1 Message Date
Andrew Trick
3d74dea4bd Add support for stack map generation in the X86 backend.
Originally implemented by Lang Hames.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193811 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-31 22:11:56 +00:00
Manman Ren
b8b70e10a2 Debug Info: remove duplication of DIEs when a DIE can be shared across CUs.
We add a map in DwarfDebug to map MDNodes that are shareable across CUs to the
corresponding DIEs: MDTypeNodeToDieMap. These DIEs can be shared across CUs,
that is why we keep the maps in DwarfDebug instead of CompileUnit.

We make the assumption that if a DIE is not added to an owner yet, we assume
it belongs to the current CU. Since DIEs for the type system are added to
their owners immediately after creation, and other DIEs belong to the current
CU, the assumption should be true.

A testing case is added to show that we only create a single DIE for a type
MDNode and we use ref_addr to refer to the type DIE.

We also add a testing case to show ref_addr relocations for non-darwin
platforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193779 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-31 17:54:35 +00:00
Andrew Trick
2343e3b228 Lower stackmap intrinsics directly to their target opcode in the DAG builder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193769 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-31 17:18:24 +00:00
Andrew Trick
cf940ceff7 whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193765 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-31 17:18:07 +00:00
Rafael Espindola
83dd2ae095 Remove the --shrink-wrap option.
It had no tests, was unused and was "experimental at best".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193749 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-31 14:07:59 +00:00
Jim Grosbach
0e536ee4ca Legalize: Improve legalization of long vector extends.
When an extend more than doubles the size of the elements (e.g., a zext
from v16i8 to v16i32), the normal legalization method of splitting the
vectors will run into problems as by the time the destination vector is
legal, the source vector is illegal. The end result is the operation
often becoming scalarized, with the typical horrible performance. For
example, on x86_64, the simple input of:
define void @bar(<16 x i8> %a, <16 x i32>* %p) nounwind {
  %tmp = zext <16 x i8> %a to <16 x i32>
  store <16 x i32> %tmp, <16 x i32>*%p
  ret void
}

Generates:
  .section  __TEXT,__text,regular,pure_instructions
  .section  __TEXT,__const
  .align  5
LCPI0_0:
  .long 255                     ## 0xff
  .long 255                     ## 0xff
  .long 255                     ## 0xff
  .long 255                     ## 0xff
  .long 255                     ## 0xff
  .long 255                     ## 0xff
  .long 255                     ## 0xff
  .long 255                     ## 0xff
  .section  __TEXT,__text,regular,pure_instructions
  .globl  _bar
  .align  4, 0x90
_bar:
  vpunpckhbw  %xmm0, %xmm0, %xmm1
  vpunpckhwd  %xmm0, %xmm1, %xmm2
  vpmovzxwd %xmm1, %xmm1
  vinsertf128 $1, %xmm2, %ymm1, %ymm1
  vmovaps LCPI0_0(%rip), %ymm2
  vandps  %ymm2, %ymm1, %ymm1
  vpmovzxbw %xmm0, %xmm3
  vpunpckhwd  %xmm0, %xmm3, %xmm3
  vpmovzxbd %xmm0, %xmm0
  vinsertf128 $1, %xmm3, %ymm0, %ymm0
  vandps  %ymm2, %ymm0, %ymm0
  vmovaps %ymm0, (%rdi)
  vmovaps %ymm1, 32(%rdi)
  vzeroupper
  ret

So instead we can check if there are legal types that enable us to split
more cleverly when the input vector is already legal such that we don't
turn it into an illegal type. If the extend is such that it's more than
doubling the size of the input we check if
  - the number of vector elements is even,
  - the source type is legal,
  - the type of a split source is illegal,
  - the type of an extended (by doubling element size) source is legal, and
  - the type of that extended source when split is legal.
If the conditions are met, instead of just splitting both the
destination and the source types, we create an extend that only goes up
one "step" (doubling the element width), and the continue legalizing the
rest of the operation normally. The result is that this operates as a
new, more effecient, termination condition for the loop of "split the
operation until the destination type is legal."

With this change, the above example now compiles to:
_bar:
  vpxor %xmm1, %xmm1, %xmm1
  vpunpcklbw  %xmm1, %xmm0, %xmm2
  vpunpckhwd  %xmm1, %xmm2, %xmm3
  vpunpcklwd  %xmm1, %xmm2, %xmm2
  vinsertf128 $1, %xmm3, %ymm2, %ymm2
  vpunpckhbw  %xmm1, %xmm0, %xmm0
  vpunpckhwd  %xmm1, %xmm0, %xmm3
  vpunpcklwd  %xmm1, %xmm0, %xmm0
  vinsertf128 $1, %xmm3, %ymm0, %ymm0
  vmovaps %ymm0, 32(%rdi)
  vmovaps %ymm2, (%rdi)
  vzeroupper
  ret

This generalizes a custom lowering that was added a while back to the
ARM backend. That lowering is no longer necessary, and is removed. The
testcases for it, however, provide excellent ARM tests for this change
and so remain.

rdar://14735100

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193727 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-31 00:20:48 +00:00
Matt Arsenault
4f17f88071 Fix CodeGen for unaligned loads with address spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193721 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 23:30:05 +00:00
Rafael Espindola
2cc546db18 Produce .weak_def_can_be_hidden for some linkonce_odr values
With this patch llvm produces a weak_def_can_be_hidden for linkonce_odr
if they are also unnamed_addr or don't have their address taken.

There is not a lot of documentation about .weak_def_can_be_hidden, but
from the old discussion about linkonce_odr_auto_hide and the name of
the directive this looks correct: these symbols can be hidden.

Testing this with the ld64 in Xcode 5 linking clang reduces the number of
exported symbols from 21053 to 19049.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193718 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 22:08:11 +00:00
David Blaikie
1d36113c05 DebugInfo: Push header handling down into CompileUnit
This is a preliminary step to handling type units by abstracting over
all (type or compile) units.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193714 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 20:42:41 +00:00
David Blaikie
8e8e6dc41f DwarfDebug: Change Abbreviations member from pointer to reference
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193699 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 17:14:24 +00:00
Juergen Ributzka
9a5df73e32 Revert "SelectionDAG: Teach the legalizer to split SETCC if VSELECT needs splitting too."
Now Hexagon and SystemZ are not happy with it :-(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193677 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 06:36:19 +00:00
Juergen Ributzka
4eced19c50 SelectionDAG: Teach the legalizer to split SETCC if VSELECT needs splitting too.
The Type Legalizer recognizes that VSELECT needs to be split, because the type
is to wide for the given target. The same does not always apply to SETCC,
because less space is required to encode the result of a comparison. As a result
VSELECT is split and SETCC is unrolled into scalar comparisons.

This commit fixes the issue by checking for VSELECT-SETCC patterns in the DAG
Combiner. If a matching pattern is found, then the result mask of SETCC is
promoted to the expected vector mask type for the given target. This mask has
usually the same size as the VSELECT return type (except for Intel KNL). Now the
type legalizer will split both VSELECT and SETCC.

This allows the following X86 DAG Combine code to sucessfully detect the MIN/MAX
pattern. This fixes PR16695, PR17002, and <rdar://problem/14594431>.

Reviewed by Nadav

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193676 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 05:48:18 +00:00
Josh Magee
62406fdc6f Reformat code with clang-format.
Differential Revision: http://llvm-reviews.chandlerc.com/D2057


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193672 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 02:25:14 +00:00
Manman Ren
38856f8bed Debug Info: code clean up.
Use EmitLabelOffsetDifference for handling on darwin platform when
non-darwin platforms use EmitLabelPlusOffset.

Also fix a bug in EmitLabelOffsetDifference where the size is hard-coded
to 4 even though Size is passed in as an argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193660 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 23:14:15 +00:00
Manman Ren
3eabc2adb7 Debug Info: support for DW_FORM_ref_addr.
To support ref_addr, we calculate the section offset of a DIE (i.e. offset
of a DIE from beginning of the debug info section). The Offset field in DIE
is currently CU-relative. To calculate the section offset, we add a
DebugInfoOffset field in CompileUnit to store the offset of a CU from beginning
of the debug info section. We set the value in DwarfUnits::computeSizeAndOffset
for each CompileUnit.

A helper function DIE::getCompileUnit is added to return the CU DIE that
the input DIE belongs to. We also add a map CUDieMap in DwarfDebug to help
finding the CU for a given CU DIE.

For a cross-referenced DIE, we first find the CU DIE it belongs to with
getCompileUnit, then we use CUDieMap to get the corresponding CU for the CU DIE.
Adding the section offset of the CU with the CU-relative offset of a DIE gives
us the seciton offset of the DIE.

We correctly emit ref_addr with relocation using EmitLabelPlusOffset when
doesDwarfUseRelocationsAcrossSections is true.

This commit handles the emission of DW_FORM_ref_addr when we have an attribute
with FORM_ref_addr. A follow-on patch will start using ref_addr when adding a
DIEEntry. This commit will be tested and verified in the follow-on patch.

Reviewed off-list by Eric, Thanks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193658 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 22:57:10 +00:00
Manman Ren
d498e5e960 Debug Info: instead of calling addToContextOwner which constructs the context
after the DIE creation, we construct the context first.

Ensure that we create the context before we create a type so that we can add
the newly created type to the parent. Remove last use of addToContextOwner
now that it's not needed.

We use createAndAddDIE to wrap around "new DIE(". Now all shareable DIEs
should be added to their parents right after the creation.

Reviewed off-list by Eric, Thanks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193657 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 22:49:29 +00:00
Josh Magee
4598b40ce6 [stackprotector] Update the StackProtector pass to perform datalayout analysis.
This modifies the pass to classify every SSP-triggering AllocaInst according to
an SSPLayoutKind (LargeArray, SmallArray, AddrOf).  This analysis is collected
by the pass and made available for use, but no other pass uses it yet.

The next patch will make use of this analysis in PEI and StackSlot
passes.  The end goal is to support ssp-strong stack layout rules.

WIP.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193653 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 21:16:16 +00:00
Rafael Espindola
93cf0939f9 Move getSymbol to TargetLoweringObjectFile.
This allows constructing a Mangler with just a TargetMachine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193630 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 17:28:26 +00:00
Rafael Espindola
ffc7dca885 Add a helper getSymbol to AsmPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193627 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 17:07:16 +00:00
Manman Ren
6b713800ff Debug Info: instead of calling addToContextOwner which constructs the context
after the DIE creation, we construct the context first.

This touches creation of namespaces and global variables. The purpose is to
handle all DIE creations similarly: constructs the context first, then creates
the DIE and immediately adds the DIE to its parent.

We use createAndAddDIE to wrap around "new DIE(".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193589 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 05:49:41 +00:00
Alp Toker
18a988e3a7 Fix "existant" typos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193579 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 02:35:28 +00:00
Manman Ren
8ef9cebb68 Debug Info: use createAndAddDIE to wrap around "new DIE" in DwarfDebug.
This commit ensures DIEs are constructed within a compile unit and
immediately added to their parents.

Reviewed off-list by Eric.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193568 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 01:03:01 +00:00
Manman Ren
bbdd02cc30 Debug Info: use createAndAddDIE for newly-created Subprogram DIEs.
More patches will be submitted to convert "new DIE(" to use createAddAndDIE in
DwarfCompileUnit.cpp. This will simplify implementation of addDIEEntry where
we have to decide between ref4 and ref_addr, because DIEs that can be shared
across CU will be added to a CU already.

Reviewed off-list by Eric.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193567 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 00:58:04 +00:00
Manman Ren
1a5e787f70 Debug Info: add a helper function createAndAddDIE.
It wraps around "new DIE(" and handles the bookkeeping part of the newly-created
DIE. It adds the DIE to its parent, and calls insertDIE if necessary. It makes
sure that bookkeeping is done at the earliest time and we should not see
parentless DIEs if all constructions of DIEs go through this helper function.

Later on, we can use an allocator for DIE allocation, and will only need to
change createAndAddDIE instead of modifying all the "new DIE(".

Reviewed off-list by Eric.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193566 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 00:53:03 +00:00
Richard Sandiford
a7be36c8eb [DAGCombiner] Respect volatility when checking for aliases
Making useAA() default to true for SystemZ showed that the combiner alias
analysis wasn't handling volatile accesses.  This hit many of the SystemZ
tests, but I arbitrarily picked one for the purpose of this patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193518 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-28 12:00:00 +00:00
Richard Sandiford
66589dcc8f Keep TBAA info when rewriting SelectionDAG loads and stores
Most SelectionDAG code drops the TBAA info when creating a new form of a
load and store (e.g. during legalization, or when converting a plain
load to an extending one).  This patch tries to catch all cases where
the TBAA information can legitimately be carried over.

The patch adds alternative forms of getLoad() and getExtLoad() that take
a MachineMemOperand instead of individual fields.  (The corresponding
getTruncStore() already exists.)  The idea is to use the MachineMemOperand
forms when all fields are carried over (size, pointer info, isVolatile,
isNonTemporal, alignment and TBAA info).  If some adjustment is being
made, e.g. to narrow the load, then we still pass the individual fields
but also pass the TBAA info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193517 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-28 11:17:59 +00:00
David Blaikie
7c0c2e56b0 DIEHash: Summary hashing of member functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193432 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25 20:04:25 +00:00
David Blaikie
a954618c6e DIEHash: Summary hashing of nested types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193427 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25 18:38:43 +00:00
Tim Northover
5a42ae81f7 LegalizeDAG: allow libcalls for max/min atomic operations
ARM processors without ldrex/strex need to be able to make libcalls for all
atomic operations, including the newer min/max versions.

The alternative would probably be expanding these operations in terms of
cmpxchg (as x86 does always), but in the configurations where this matters
code-size tends to be paramount so the libcall is more desirable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193398 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25 09:30:20 +00:00
Nadav Rotem
97541d400e Optimize concat_vectors(X, undef) -> scalar_to_vector(X).
This optimization is not SSE specific so I am moving it to DAGco.
The new scalar_to_vector dag node exposed a missing pattern in the AArch64 target that I needed to add.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193393 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25 06:41:18 +00:00
David Blaikie
5759c3a029 MCStreamer: Reimplement the virtual EmitRawText as a protected member, EmitRawTextImpl, to avoid string literal ambiguities
Also improve the implementation of EmitRawText(Twine) so it doesn't
bother using the SmallString buffer if the Twine is a simple StringRef
anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193378 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 22:43:10 +00:00
David Blaikie
9e39e0d56d DWARF emission: Remove unnecessary/redundant DIE reference code
The default case at the end of the switch handles this just fine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193374 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 22:00:44 +00:00
Eric Christopher
200bb6df7f Fix name of variable in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193373 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 21:54:58 +00:00
Eric Christopher
1f7d0d5794 Grammar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193372 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 21:20:23 +00:00
Eric Christopher
39cd7d48c0 Update misleading comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193371 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 21:05:08 +00:00
David Blaikie
377e83202c DIEHash: Const correct and use references where non-null/non-rebound.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193363 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 18:29:03 +00:00
David Blaikie
1d7d8da4cb DIEHash: Do not use shallow type hashing for unnamed types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193361 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 17:53:58 +00:00
David Blaikie
851aa948cb DIEHash: Refactor ref attribute hashing into smaller functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193360 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 17:51:43 +00:00
David Blaikie
724452e94c Remove unused debug-only member variable.
This may've been used at some point but the 'print' member function grew
an Indent parameter that entirely shadows this parameter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193358 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24 17:10:13 +00:00
Manman Ren
be87b69a5f Debug Info: code clean up.
Since we never insert DIE for DITemplateTypeParameter to a map, there is no need
to call getDIE in getOrCreateTemplateTypeParameterDIE. It is also renamed to
constructTemplateTypeParameterDIE to match with other construct functions
in CompileUnit.

Same applies to getOrCreateTemplateValueParameterDIE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193287 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-23 23:05:28 +00:00
Manman Ren
a1d25b6360 Debug Info: code clean up.
Rename createMemberDIE to constructMemberDIE to match other construct functions
in CompileUnit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193286 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-23 23:00:44 +00:00
Manman Ren
99addee733 Debug Info: code clean up.
Remove the unneeded return values from createMemberDIE, constructEnumTypeDIE,
getOrCreateTemplateTypeParameterDIE, and getOrCreateTemplateValueParameterDIE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193285 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-23 22:57:12 +00:00
Manman Ren
950f4e82af Debug Info: code clean up.
Unifying the argument ordering of private construct functions in CompileUnit to
follow constructTypeDIE(DIE &, DIBasicType),
constructTypeDIE(DIE &, DIDerivedType), constructTypeDIE(DIE &, DICompositeType),
constructSubrangeDIE and constructArrayTypeDIE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193284 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-23 22:52:22 +00:00
Manman Ren
250f4e8ec2 Remove {} from one-line block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193276 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-23 22:12:26 +00:00
Rafael Espindola
3873361e28 Reduce casting and use a fully covered switch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193272 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-23 21:24:34 +00:00
Tom Stellard
d0716b0647 SelectionDAG: Pass along the original argument/element type in ISD::InputArg
For some targets, it is useful to be able to look at the original
type of an argument without having to dig through the original IR.

This also fixes a bug in SelectionDAGBuilder where InputArg.PartOffset
was not taking into account the offset of structure elements.

Patch by: Justin Holewinski

Tom Stellard:
  - Changed the type of ArgVT to EVT, so it can store non-simple types
    like v3i32.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193214 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-23 00:44:24 +00:00
Manman Ren
d56c9db960 Debug Info: code clean up.
Remove unnecessary creation of LexicalScope in collectDeadVariables.
The created LexicialScope was only used to get isAbstractScope, which
should be false from the creation:
"new LexicalScope(NULL, DIDescriptor(SP), NULL, false);".

We can also remove a DenseMap that holds the created LexicalScopes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193196 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-22 20:59:19 +00:00
David Blaikie
c960816625 DIEHashing: Provide an assert for unreachable functionality regarding friends.
Since (as of r190716) Clang no longer emits debug info for C++ friend
declarations (and it seems GCC never has/does, which was the motivation
for the Clang change), there's no actual reachable case for implementing
the part of DWARF 4, Section 7.27 part 5 that pertains to friends.

Leave an assert here so that if/when we do have a client producing
friends and using type units, we can fill in the gap and add appropriate
(unit and feature) tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193193 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-22 20:28:55 +00:00
David Blaikie
f196208900 DWARF type hashing: pointers to members
Includes a test case/FIXME demonstrating a bug/limitation in pointer to
member hashing. To be honest I'm not sure why we don't just always use
summary hashing for referenced types... but perhaps I'm missing
something.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193175 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-22 18:14:41 +00:00
Wan Xiaofei
8c955ea858 Using FoldingSet in SelectionDAG::getVTList.
VTList has a long life cycle through the module and getVTList is frequently called. In current getVTList, sequential search over a std::vector is used, this is inefficient in big module.
This patch use FoldingSet to implement hashing mechanism when searching.

Reviewer: Nadav Rotem
Test    : Pass unit tests & LNT test suite

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193150 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-22 08:02:02 +00:00
Eric Christopher
8348b7d400 Formatting/whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193135 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-22 00:22:39 +00:00
David Blaikie
449f036a81 DWARF Type Hashing: Include reference and rvalue reference type in the declarable summary hashing path
More support for 7.25 Part 5.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193129 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 23:06:19 +00:00
David Blaikie
f1545a2197 DWARF type hashing: begin implementing Step 5, summary hashing in declarable contexts
There are several other tag types that need similar handling but to
ensure test coverage they'll be coming incrementally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193126 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 22:36:50 +00:00
Matt Arsenault
e161dc28a8 Remove unused TargetLowering field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193113 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 20:04:01 +00:00
Matt Arsenault
ff71812dfa Fix CodeGen for different size address space GEPs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193111 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 20:03:54 +00:00
Matt Arsenault
599c0afb24 Reuse variable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193107 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 19:24:15 +00:00
Reid Kleckner
82e7eda150 Fix the build in DIE.cpp with MSVC 2010
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193106 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 19:18:31 +00:00
David Blaikie
3baa3c37ce DWARF type hashing: Handle multiple (including recursive) references to the same type
This uses a map, keeping the type DIE numbering separate from the DIEs
themselves - alternatively we could do things the way GCC does if we
want to add an integer to the DIE type to record the numbering there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193105 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 18:59:40 +00:00
Eric Christopher
ef2d919f7f Fix up some old review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193095 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 17:48:51 +00:00
David Blaikie
770530babc DebugInfo: Put each kind of constant (form, attribute, tag, etc) into its own enum for ease of use.
This allows various variables to be more self-documenting and easier to
debug by being of specific types without overlapping enum values.

Precommit review by Eric Christopher.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193091 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 17:28:37 +00:00
David Blaikie
da39dd30ad DebugInfo: Hash DW_FORM_GNU_str_index as a string.
Found while adding type safety to the various DWARF enumerations (form,
attribute, tag, etc) that caused Clang to warn on an incompletely
covered switch. Converting the comment to a default/unreachable
uncovered this case of an unsupported form encoding. Seems we were
skipping fission strings entirely.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193089 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-21 16:37:22 +00:00
Peter Collingbourne
0abc36205a Emit prefix data after debug and EH directives.
This ensures that the prefix data is treated as part of the function for
the purpose of debug info.  This provides a better debugging experience,
among other things by allowing a debug info client to correctly look up
a function in debug info given a function pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193042 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-20 02:16:21 +00:00
Benjamin Kramer
53c9e5fbb9 Remove unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193038 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-19 16:32:15 +00:00
Eric Christopher
6efc043f0b Reformat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193024 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-19 01:04:47 +00:00
Eric Christopher
0ab6439c3f Fix up a few minor performance problems spotted in code review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193023 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-19 01:04:42 +00:00
Manman Ren
630c3264a6 Debug Info: add a newly-created DIE to a parent in the same function.
With this commit, all DIEs created in CompileUnit will be added to parents
inside the same function. Also make getOrCreateTemplateType|Value functions
private.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193002 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-18 21:14:19 +00:00
Manman Ren
57a964bc63 Debug Info: simplify code a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193001 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-18 20:52:22 +00:00
Eric Christopher
3c58aad3bc Revert the rest of r192749 to bring back the buildbot. These two
error messages should not be able to occur at the same time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192985 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-18 16:56:48 +00:00
Bill Schmidt
6cd04fdaae [PATCH] Fix PR17168 (DAG scheduler inserts DBG_VALUE before PHI with fast-isel)
PR17168 describes a test case that fails when compiling for debug with
fast-isel.  Investigation showed that the test was failing because a DBG_VALUE
machine instruction was placed prior to a PHI.

For this problem to occur requires the following:
 * Compile for debug
 * Compile with fast-isel
 * In a block B, fast-isel must partially succeed before punting to DAG-isel
 * B must start with a PHI
 * The first unhandled node in the DAG must not generate a machine instruction
 * A debug value with an order less than that of that first node exists

When all of these circumstances apply, the existing test that an instruction
was not inserted won't fire.  Currently it tests whether the block is empty,
or whether the last instruction generated is a phi.  When fast-isel has
partially succeeded, the last instruction generated will not be a phi.
Instead, we need to check whether the current insert position is immediately
following a phi.  This patch adds that check, and adds the test case from the
PR as a regression test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192976 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-18 14:20:11 +00:00
David Majnemer
641bea117d CodeGen: Emit a libcall if the target doesn't support 16-byte wide atomics
There are targets that support i128 sized scalars but cannot emit
instructions that modify them directly.  The proper thing to do is to
emit a libcall.

This fixes PR17481.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192957 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-18 08:03:43 +00:00
Eric Christopher
1c165b8ee3 Temporarily revert r192749 as it is causing problems for LTO and
requires a more in depth change to the IR structure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192938 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-18 01:57:30 +00:00
David Blaikie
0d87c201b1 DIEHash: Add more things (and remove one character) from the COLLECT_ATTR macro
Makes the uses more terse and requires that they use a semicolon at the
end that helps editors indent proceeding lines correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192925 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 22:14:08 +00:00
David Blaikie
47f66d5a75 DIEHash: Support for simple (non-recursive, non-reused) type references
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192924 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 22:07:09 +00:00
Richard Sandiford
f9a5e40b90 Replace sra with srl if a single sign bit is required
E.g. (and (sra (i32 x) 31) 2) -> (and (srl (i32 x) 30) 2).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192884 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 11:16:57 +00:00
Andrea Di Biagio
888cbad774 Fix edge condition in DAGCombiner to improve codegen of shift sequences.
When canonicalizing dags according to the rule
(shl (zext (shr X, c1) ), c1) ==> (zext (shl (shr X, c1), c1))

remember to add the new shl dag to the DAGCombiner worklist of nodes.
If we don't explicitly add it to the worklist of nodes to visit, we
may not trigger later on the rule that folds the shift left + logical
shift right into a AND instruction with bitmask.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192883 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 11:02:58 +00:00
Eric Christopher
9198657e1e According to the dwarf standard pubnames and pubtypes for languages
like C++ should be the fully qualified names for the type.

Add a routine that does a language specific context walk to build
up the qualified name and use it when we add types/names to the
tables. Expand the gnu pubnames testcase as it's the most complex
to make sure that qualified types are also being added.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192865 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 02:06:06 +00:00
Jack Carter
adbd3ae1df [projects/test-suite] White space and long line fixes.
No functionality changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192863 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 01:34:33 +00:00
Eric Christopher
bdfed1687b Add the subprogram DIEs to the context they're created with only
if they're a declaration, otherwise they're owned by the compile
unit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192861 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 01:31:12 +00:00
David Blaikie
88a68cbbb5 DIEHash: Include the type's context in the type hash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192856 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 00:10:34 +00:00
David Blaikie
c098708220 DIEHash: Use DW_FORM_sdata for integers, per spec.
This allows us to produce the same hash as GCC for at least some simple
examples.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192855 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 23:36:20 +00:00
David Blaikie
700b91f07c Remove ambiguity introduced in r192836
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192840 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 20:40:46 +00:00
David Blaikie
75ee00021d DIEHash: Include the trailing zero byte after the children of a DIE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192836 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 20:29:06 +00:00
Andrew Trick
81f69410cb After PostRA scheduling, don't set kill flags on undef operands.
This should fix the ATOM buildbot failing on break-avx-dep.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192824 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 18:30:23 +00:00
Benjamin Kramer
72a3ee7422 DAGCombiner: Don't fold xor into not if getNOT would introduce an illegal constant.
This happens e.g. with <2 x i64> -1 on x86_32. It cannot be generated directly
because i64 is illegal. It would be nice if getNOT would handle this
transparently, but I don't see a way to generate a legal constant there right
now. Fixes PR17487.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192795 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 14:16:19 +00:00
Richard Sandiford
5d7e93c0d4 Handle (shl (anyext (shr ...))) in SimpilfyDemandedBits
This is really an extension of the current (shl (shr ...)) -> shl optimization.
The main difference is that certain upper bits must also not be demanded.

The motivating examples are the first two in the testcase, which occur
in llvmpipe output.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192783 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 10:26:19 +00:00
Rafael Espindola
3aa342be50 Add support for metadata representing .ident directives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192764 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 01:49:05 +00:00
Eric Christopher
a486f55569 Fix a pair of bugs in the emission of pubname tables:
1) Make sure we emit static member variables by checking
at the end of createGlobalVariableDIE rather than piecemeal
in the function.
(As a note, createGlobalVariableDIE needs rewriting.)

2) Make sure we use the definition rather than declaration DIE
for two things: a) determining linkage for gnu pubnames, and b)
as the address of the DIE for global variables.
(As a note, createGlobalVariableDIE really needs rewriting.)

Adjust the testcase to make sure we're checking the correct DIEs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192761 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 01:37:49 +00:00
David Blaikie
e891775aa1 Simplify zero initialization of DIEAttrs variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192755 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-16 00:47:21 +00:00
Eric Christopher
c622824ccb Make sure we're not attempting to construct a subprogram DIE
twice and just look up the value. Fix the one case where
we were trying to create a subprogram DIE and we should already
have had one. Reflow formatting in collectDeadVariables while fixing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192749 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-15 23:31:38 +00:00
Adrian Prantl
73df4b9f57 Remove some dead code. (DarwinGDBCompat was retired in r189903).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192731 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-15 20:26:37 +00:00
Pekka Jaaskelainen
d54946ac14 Guard the debug temp variable with NDEBUG to avoid warning/error with NDEBUG defined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192709 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-15 14:40:46 +00:00
Pekka Jaaskelainen
862385112e Do not assert when trying to add a meta data operand with
MachineInstr::addOperand().



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192707 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-15 14:18:10 +00:00
Andrew Trick
51dee24ca6 Improve on r192635, ExeDepsFix for avx, and add a test case.
rdar:15221834 False AVX register dependencies cause 5x slowdown on
flops-5/6 and significant slowdown on several others.

This was blocking the switch to MI-Sched.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192669 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-15 03:39:43 +00:00
Andrew Trick
a6a9ac5aa1 Fix the ExecutionDepsFix pass to handle AVX instructions.
This pass is needed to break false dependencies. Without it, unlucky
register assignment can result in wild (5x) swings in
performance. This pass was trying to handle AVX but not getting it
right. AVX doesn't have partial register defs, it has unused register
reads in which the high bits of a source operand are copied into the
unused bits of the dest.

Fixing this requires conservative liveness analysis. This is awkard
because the pass already has its own pseudo-liveness. However, proper
liveness is expensive, and we would like to use a generic utility to
compute it. The fix only invokes liveness on-demand. It is rare to
detect a case that needs undef-read dependence breaking, but when it
happens, it can be needed many times within a very large block.

I think the existing heuristic which uses a register window of 16 is
too conservative for loop-carried false dependencies. If the loop is a
reduction. The out-of-order engine may be able to execute several loop
iterations in parallel. However, I'll leave this tuning exercise for
next time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192635 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-14 22:19:03 +00:00
Andrew Trick
966772931e LiveRegUnits: Use *MBB for consistency and convenience.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192634 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-14 22:18:59 +00:00
Andrew Trick
6c325c9133 LiveRegUnits::removeRegsInMask safety.
Clobbering is exclusive not inclusive on register units.
For liveness, we need to consider all the preserved registers.
e.g. A regmask that clobbers YMM0 may preserve XMM0.
Units are only clobbered when all super-registers are clobbered.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192623 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-14 20:45:19 +00:00
Andrew Trick
7c489ab365 Use a SparseSet in LiveRegUnits.
Some clients may add block live ins and may track liveness over a
large scope. This guarantees an efficient implementation in all cases
with no memory allocation/deallocation, independent of the number of
target registers. It could be slightly less convenient but is fine in
the expected case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192622 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-14 20:45:17 +00:00
Andrew Trick
eb3b9f8ed9 Move LiveRegUnits implementation into .cpp. Comment and format.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192621 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-14 20:45:14 +00:00
Andrew Trick
5601abb60d Convert LiveRegUnits methods to the current convention (it's new code).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192619 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-14 20:45:09 +00:00
Manman Ren
655a10d96c Debug Info: static member DIE creation.
Clean up creation of static member DIEs. We can create static member DIEs from
two places, so we call getOrCreateStaticMemberDIE from the two places.

getOrCreateStaticMemberDIE will get or create the context DIE first, then it
will check if the DIE already exists, if not, we create the static member DIE
and add it to the context.

Creation of static member DIEs are handled in a similar way as subprogram DIEs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192618 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-14 20:33:57 +00:00