Commit Graph

101366 Commits

Author SHA1 Message Date
Jim Grosbach eaf6036fb2 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

llvm-svn: 204191
2014-03-18 22:09:08 +00:00
Jim Grosbach 448334a738 Darwin: Add assembler directives to create version-min load commands.
Allow object files to be tagged with a version-min load command for iOS
or MacOSX.

Teach macho-dump to understand the version-min load commands for
testcases.

rdar://11337778

llvm-svn: 204190
2014-03-18 22:09:05 +00:00
Jim Grosbach 79f91c595d MachO: Comment fields in the version_min load command.
llvm-svn: 204189
2014-03-18 22:08:58 +00:00
Chandler Carruth 4c5001cc9c [LV] While I'm here, use range based for loops which are so much cleaner
for this kind of walk.

llvm-svn: 204188
2014-03-18 22:00:32 +00:00
Chandler Carruth ae324439d0 [LV] The actual change I intended to commit in r204148. Sorry for the
noise.

Original commit log:
Replace some dead code with an assert. When I first ported this pass
from a loop pass to a function pass I did so in the naive, recursive
way. It doesn't actually work, we need a worklist instead. When
I switched to the worklist I didn't delete the naive recursion. That
recursion was also buggy because it was dead and never really exercised.

llvm-svn: 204187
2014-03-18 21:58:38 +00:00
Chandler Carruth f73079ca89 [LV] Replace some dead code with an assert. When I first ported this
pass from a loop pass to a function pass I did so in the naive,
recursive way. It doesn't actually work, we need a worklist instead.
When I switched to the worklist I didn't delete the naive recursion.
That recursion was also buggy because it was dead and never really
exercised.

llvm-svn: 204184
2014-03-18 21:51:46 +00:00
Eric Christopher 11f806740d More header and forward declaration cleanup.
llvm-svn: 204183
2014-03-18 21:44:12 +00:00
Eric Christopher acbe42badd Add back the headers we're getting via (likely) transitive includes.
We really do use these things in the header.

llvm-svn: 204180
2014-03-18 20:58:35 +00:00
Rafael Espindola 574bfa12fa Add back r203962, r204028 and r204059.
This reverts commit r204137.

This includes a fix for handling aliases of aliases.

llvm-svn: 204178
2014-03-18 20:40:38 +00:00
Eric Christopher c0bd5f8256 Fix for coding style.
llvm-svn: 204177
2014-03-18 20:39:54 +00:00
Eric Christopher ce4a9445ec Remove a bunch of unnecessary includes and forward declarations.
llvm-svn: 204176
2014-03-18 20:37:10 +00:00
Hans Wennborg aec21ce43e X86 memcpy lowering: use "rep movs" even when esi is used as base pointer
For functions where esi is used as base pointer, we would previously fall back
from lowering memcpy with "rep movs" because that clobbers esi.

With this patch, we just store esi in another physical register, and restore
it afterwards. This adds a little bit of register preassure, but the more
efficient memcpy should be worth it.

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

llvm-svn: 204174
2014-03-18 20:04:34 +00:00
Rui Ueyama 4e39f717ff Use early returns to reduce nesting.
llvm-svn: 204171
2014-03-18 18:58:51 +00:00
Michael Zolotukhin 7ac41056c8 Fix test lsr-normalization.ll broken in r204161.
llvm-svn: 204166
2014-03-18 18:17:59 +00:00
Raul E. Silvera a9dafe6793 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

llvm-svn: 204163
2014-03-18 17:49:12 +00:00
Adrian Prantl d486b343a0 Debug info: Remove OdrMemberMap from DwarfDebug, it's not necessary.
Follow-up to r203982.

llvm-svn: 204162
2014-03-18 17:41:15 +00:00
Michael Zolotukhin ed0a7761e5 Add stride normalization to SCEV Normalize/Denormalize transformation.
llvm-svn: 204161
2014-03-18 17:34:03 +00:00
Andrea Di Biagio 28f46d9f39 [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)

llvm-svn: 204160
2014-03-18 17:12:59 +00:00
Manuel Jacob dcb78dbc82 X86: Use enums for memory operand decoding instead of integer literals.
Summary:
X86BaseInfo.h defines an enum for the offset of each operand in a memory operand
sequence.  Some code uses it and some does not.  This patch replaces (hopefully)
all remaining locations where an integer literal was used instead of this enum.
No functionality change intended.

Reviewers: nadav

CC: llvm-commits, t.p.northover

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

llvm-svn: 204158
2014-03-18 16:14:11 +00:00
Krzysztof Parzyszek 4d38c82575 Enable CFI on Hexagon.
llvm-svn: 204157
2014-03-18 16:02:37 +00:00
Bill Schmidt ff9622ef0e Fix PR19144: Incorrect offset generated for int-to-fp conversion at -O0.
When converting a signed 32-bit integer to double-precision floating point on
hardware without a lfiwax instruction, we have to instead use a lfd followed
by fcfid.  We were erroneously offsetting the address by 4 bytes in
preparation for either a lfiwax or lfiwzx when generating the lfd.  This fixes
that silly error.

This was not caught in the test suite since the conversion tests were run with
-mcpu=pwr7, which implies availability of lfiwax.  I've added another test
case for older hardware that checks the code we expect in the absence of
lfiwax and other flavors of fcfid.  There are fewer tests in this test case
because we punt to DAG selection in more cases on older hardware.  (We must
generate complex fiddly sequences in those cases, and there is marginal
benefit in duplicating that logic in fast-isel.)

llvm-svn: 204155
2014-03-18 14:32:50 +00:00
Evgeniy Stepanov 302964ee92 [msan] Origin tracking with history.
LLVM part of MSan implementation of advanced origin tracking,
when we record not only creation point, but all locations where
an uninitialized value was stored to memory, too.

llvm-svn: 204151
2014-03-18 13:30:56 +00:00
Diego Novillo 213bb00245 Tolerate unmangled names in sample profiles.
Summary:
The compiler does not always generate linkage names. If a function
has been inlined and its body elided, its linkage name may not be
generated.

When the binary executes, the profiler will use its unmangled name
when attributing samples. This results in unmangled names in the
input profile.

We are currently failing hard when this happens. However, in this case
all that happens is that we fail to attribute samples to the inlined
function. While this means fewer optimization opportunities, it should
not cause a compilation failure.

This patch accepts all valid function names, regardless of whether
they were mangled or not.

Reviewers: chandlerc

CC: llvm-commits

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

llvm-svn: 204142
2014-03-18 12:03:12 +00:00
Alexander Kornienko 64de613751 Revert r203962 and two revisions depending on it: r204028 and r204059.
The revision I'm reverting breaks handling of transitive aliases. This blocks us
and breaks sanitizer bootstrap:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/2651
(and checked locally by Alexey).

This revision is the result of:

  svn merge -r204059:204058 -r204028:204027 -r203962:203961 .

+ the regression test added to test/MC/ELF/alias.s

Another way to reproduce the regression with clang:
  $ cat q.c
  void a1();
  void a2() __attribute__((alias("a1")));
  void a3() __attribute__((alias("a2")));
  void a1() {}

  $ ~/work/llvm-build/bin/clang-3.5-good -c q.c && mv q.o good.o && \
      ~/work/llvm-build/bin/clang-3.5-bad -c q.c && mv q.o bad.o && \
      objdump -t good.o bad.o

    good.o:     file format elf64-x86-64

    SYMBOL TABLE:
    0000000000000000 l    df *ABS*  0000000000000000 q.c
    0000000000000000 l    d  .text  0000000000000000 .text
    0000000000000000 l    d  .data  0000000000000000 .data
    0000000000000000 l    d  .bss   0000000000000000 .bss
    0000000000000000 l    d  .comment       0000000000000000 .comment
    0000000000000000 l    d  .note.GNU-stack        0000000000000000 .note.GNU-stack
    0000000000000000 l    d  .eh_frame      0000000000000000 .eh_frame
    0000000000000000 g     F .text  0000000000000006 a1
    0000000000000000 g     F .text  0000000000000006 a2
    0000000000000000 g     F .text  0000000000000006 a3



    bad.o:     file format elf64-x86-64

    SYMBOL TABLE:
    0000000000000000 l    df *ABS*  0000000000000000 q.c
    0000000000000000 l    d  .text  0000000000000000 .text
    0000000000000000 l    d  .data  0000000000000000 .data
    0000000000000000 l    d  .bss   0000000000000000 .bss
    0000000000000000 l    d  .comment       0000000000000000 .comment
    0000000000000000 l    d  .note.GNU-stack        0000000000000000 .note.GNU-stack
    0000000000000000 l    d  .eh_frame      0000000000000000 .eh_frame
    0000000000000000 g     F .text  0000000000000006 a1
    0000000000000000 g     F .text  0000000000000006 a2
    0000000000000000 g       .text  0000000000000000 a3

llvm-svn: 204137
2014-03-18 10:36:11 +00:00
Renato Golin 7c9d0508cb Add IAS/EHABI changes to release notes
llvm-svn: 204134
2014-03-18 10:16:15 +00:00
NAKAMURA Takumi a87ed3cf4c DebugIRTests: Fixup for r204130.
llvm-svn: 204132
2014-03-18 09:58:28 +00:00
Evgeniy Stepanov 2aac07349d [msan] Kill -msan-store-clean-origin flag.
Not only is it slower than the alternative, but also subtly broken.
This commit does not change the default behavior.

llvm-svn: 204131
2014-03-18 09:47:06 +00:00
Alon Mishne ad312155a6 [C++11] Change DebugInfoFinder to use range-based loops
Also changes the iterators to return actual DI type over MDNode.

llvm-svn: 204130
2014-03-18 09:41:07 +00:00
Evgeniy Stepanov dba42d6652 [msan] Remove unused code.
llvm-svn: 204125
2014-03-18 08:29:42 +00:00
Craig Topper 26696314d5 [C++11] Mark the target fast isel classes as 'final' so that the compiler can de-virtualize some of the internal calls.
llvm-svn: 204123
2014-03-18 07:27:13 +00:00
Alexey Samsonov 27dc839406 [C++11] Change the interface of getCOFF{Section,Relocation,Symbol} to make it work with range-based for loops.
Reviewers: ruiu

Reviewed By: ruiu

CC: llvm-commits

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

llvm-svn: 204120
2014-03-18 06:53:02 +00:00
NAKAMURA Takumi 7a1ac3b89b CodeGen/R600/v_cndmask.ll: Relax an expression to unbreak msvcrt.
V_CNDMASK_B32_e64 v0, v0, -1.#QNAN0e+00, s[2:3], 0, 0, 0, 0

FIXME: We really need to implement our formatter...
llvm-svn: 204118
2014-03-18 06:17:22 +00:00
NAKAMURA Takumi 4dc097ad7c DebugInfo/lto-comp-dir.ll: Tweak for dos path.
llvm-svn: 204117
2014-03-18 06:01:14 +00:00
Saleem Abdulrasool 42b233a836 ARM: add an assertion
Add an assertion that a valid section is referenced.  The potential NULL pointer
dereference was identified by the clang static analyzer.

llvm-svn: 204114
2014-03-18 05:26:55 +00:00
Adrian Prantl 0aa1aa2e9d 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.

llvm-svn: 204107
2014-03-18 02:35:03 +00:00
Adrian Prantl 1a1647cab6 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.

llvm-svn: 204106
2014-03-18 02:34:58 +00:00
Adrian Prantl 702bf5a9d9 Replace unnecessary #include directive with forward declarations.
llvm-svn: 204104
2014-03-18 02:34:52 +00:00
Eric Christopher 089793b39e Add explanatory comment.
llvm-svn: 204103
2014-03-18 02:18:27 +00:00
Eric Christopher 05135fb468 Shorten DotDebugLocEntry to just DebugLocEntry and reformat.
No functional change.

llvm-svn: 204102
2014-03-18 02:18:24 +00:00
David Blaikie 8287aff1cc 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)

llvm-svn: 204101
2014-03-18 02:13:23 +00:00
David Blaikie 4a2f95f60e 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).

llvm-svn: 204099
2014-03-18 01:17:26 +00:00
David Blaikie 9a6f9a4c68 DebugInfo: Flag test as requiring object emission support
Cleans up buildbot failures on R600 and similar.

llvm-svn: 204095
2014-03-18 00:12:25 +00:00
David Blaikie e05274d7d9 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).

llvm-svn: 204094
2014-03-18 00:11:48 +00:00
David Blaikie 0e8d401c53 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.

llvm-svn: 204092
2014-03-17 23:53:25 +00:00
David Blaikie c7f29dc068 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.

llvm-svn: 204089
2014-03-17 23:29:40 +00:00
Matt Arsenault f45faaf30d Make methods static
llvm-svn: 204085
2014-03-17 22:23:09 +00:00
Dan Gohman 172c5d3451 Use range metadata instead of introducing selects.
When GlobalOpt has determined that a GlobalVariable only ever has two values,
it would convert the GlobalVariable to a boolean, and introduce SelectInsts
at every load, to choose between the two possible values. These SelectInsts
introduce overhead and other unpleasantness.

This patch makes GlobalOpt just add range metadata to loads from such
GlobalVariables instead. This enables the same main optimization (as seen in
test/Transforms/GlobalOpt/integer-bool.ll), without introducing selects.

The main downside is that it doesn't get the memory savings of shrinking such
GlobalVariables, but this is expected to be negligible.

llvm-svn: 204076
2014-03-17 19:57:04 +00:00
Owen Anderson b36376efcb Switch a number of loops in lib/CodeGen over to range-based for-loops, now that
the MachineRegisterInfo iterators are compatible with it.

llvm-svn: 204075
2014-03-17 19:36:09 +00:00
Owen Anderson 900b4807fe Really REALLY finish adding const to the MachineRegisterInfo iterator range methods.
llvm-svn: 204074
2014-03-17 19:34:51 +00:00
Kevin Enderby 8d761cc56d Making a guess to fix the test case with r204056 to get the build bot working.
llvm-svn: 204073
2014-03-17 19:00:03 +00:00
Matt Arsenault fae02989b7 R600: Match sign_extend_inreg to BFE instructions
llvm-svn: 204072
2014-03-17 18:58:11 +00:00
Matt Arsenault 985b9de485 Make DAGCombiner work on vector bitshifts with constant splat vectors.
llvm-svn: 204071
2014-03-17 18:58:01 +00:00
Owen Anderson 76c82037bb Add one more const marker that I missed.
llvm-svn: 204070
2014-03-17 18:16:10 +00:00
David Blaikie c2df16b6d3 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.

llvm-svn: 204069
2014-03-17 18:13:58 +00:00
Owen Anderson 0a9741dce0 Mark MachineRegisterInfo's iterator range methods as const.
llvm-svn: 204067
2014-03-17 18:05:05 +00:00
Owen Anderson 44975bf391 Add iterator range definitions for the MachineRegisterInfo iterators.
llvm-svn: 204066
2014-03-17 18:01:41 +00:00
Adam Nemet 8a130a5f86 [X86] Fix unused variable warning with NDEBUG from r204058
llvm-svn: 204063
2014-03-17 17:32:53 +00:00
Saleem Abdulrasool 3f44cd7926 MC: change runtime check to an assertion
It is unclear how it would be possible to get M to be NULL in normal scenarios.
Change this to an assert rather than a runtime check as per dblakie's
suggestion.

llvm-svn: 204060
2014-03-17 17:13:57 +00:00
Saleem Abdulrasool 11543a9953 ARM IAS: support .thumb_set
This performs the equivalent of a .set directive in that it creates a symbol
which is an alias for another symbol or value which may possibly be yet
undefined.  This directive also has the added property in that it marks the
aliased symbol as being a thumb function entry point, in the same way that the
.thumb_func directive does.

The current implementation fails one test due to an unrelated issue.  Functions
within .thumb sections are not marked as thumb_func.  The result is that
the aliasee function is not valued correctly.

llvm-svn: 204059
2014-03-17 17:13:54 +00:00
Adam Nemet 24381f1cb7 [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>

llvm-svn: 204058
2014-03-17 17:06:14 +00:00
Tom Stellard d0084464b5 R600/SI: Fix implementation of isInlineConstant() used by the verifier
The type of the immediates should not matter as long as the encoding is
equivalent to the encoding of one of the legal inline constants.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
llvm-svn: 204056
2014-03-17 17:03:52 +00:00
Tom Stellard fbe435de63 R600/SI: Use correct dest register class for V_READFIRSTLANE_B32
This instructions writes to an 32-bit SGPR.  This change required adding
the 32-bit VCC_LO and VCC_HI registers, because the full VCC register
is 64 bits.

This fixes verifier errors on several of the indirect addressing piglit
tests.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
llvm-svn: 204055
2014-03-17 17:03:51 +00:00
Tom Stellard ca700e41ef R600/SI: Add generic checks to SIInstrInfo::verifyInstruction()
Added checks for number of operands and operand register classes.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
llvm-svn: 204054
2014-03-17 17:03:49 +00:00
Eli Bendersky 576ef3c667 Consistent use of the noduplicate attribute.
The "noduplicate" attribute of call instructions is sometimes queried directly
and sometimes through the cannotDuplicate() predicate. This patch streamlines
all queries to use the cannotDuplicate() predicate. It also adds this predicate
to InvokeInst, to mirror what CallInst has.

llvm-svn: 204049
2014-03-17 16:19:07 +00:00
Alexey Samsonov 464d2e448b [C++11] Introduce ObjectFile::symbols() to use range-based loops.
Reviewers: rafael

Reviewed By: rafael

CC: llvm-commits

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

llvm-svn: 204031
2014-03-17 07:28:19 +00:00
NAKAMURA Takumi 3b3a4d9dac llvm/test/MC/MachO/gen-dwarf-cpp.s: Relax an expression to match DOS pat.
llvm-svn: 204030
2014-03-17 05:31:54 +00:00
Rafael Espindola f863a3e2ec Consider the base pointer for setting the symbol type.
This is really a consistency fix. Since given

a = b

we propagate the information, we should propagate it too given

a = b + (1 - 1)

Fixes pr19145.

llvm-svn: 204028
2014-03-17 04:29:51 +00:00
David Blaikie c714ef4581 DebugInfo: Improve reuse of file table entries in asm debug info
The previous deduping strategy was woefully inadequate - it only
considered the most recent file used and avoided emitting a duplicate in
that case - never considering the a/b/a scenario.

It was also lacking when it came to directory paths as the previous
filename would never match the current if the filename had been split
into file and directory components.

This change builds caching functionality into the line table at the
lowest level in an optional form (a file number of 0 indicates that one
should be chosen and returned) and will eventually be reused by the
normal source level debugging DWARF emission.

llvm-svn: 204027
2014-03-17 01:52:11 +00:00
David Blaikie 8bef7cd876 Test case
llvm-svn: 204026
2014-03-17 01:52:04 +00:00
Lang Hames 205accb9e6 Deleted copy-constructor/copy-assignment broke a buildbot. Removing while I
investigate.

llvm-svn: 204025
2014-03-17 01:51:51 +00:00
Nico Rieck 8678acd5ed llvm-readobj: Print referred symbol name for CLR token definition
llvm-svn: 204024
2014-03-17 01:46:52 +00:00
Nico Rieck effcd4ba7a llvm-readobj: Add test for COFF auxiliary symbols as used by C++/CLI
llvm-svn: 204023
2014-03-17 01:46:28 +00:00
Lang Hames 135f86dcee Rename PBQP RegAllocSolver local variables to conform to LLVM coding style.
No functional change.

llvm-svn: 204022
2014-03-17 01:33:21 +00:00
Lang Hames 7c8189c6d3 [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>

llvm-svn: 204021
2014-03-17 01:22:54 +00:00
NAKAMURA Takumi 4633727686 Untabify.
llvm-svn: 204020
2014-03-16 23:58:43 +00:00
Manman Ren 2ecc453d6c Add FIXMEs to use DIScopeRef instead of DIScope for LTO type uniqueing.
llvm-svn: 204019
2014-03-16 18:44:23 +00:00
NAKAMURA Takumi f81612381e [CMake][cygming] Disable --out-implib from executables.
It doesn't make sense even with --export-all-symbols.

llvm-svn: 204017
2014-03-16 13:51:24 +00:00
David Blaikie 6107968f55 Remove named Twine.
While technically correct, we generally disallow any instance of named
Twines due to their subtlety.

llvm-svn: 204016
2014-03-16 01:36:18 +00:00
Benjamin Kramer 049784ec50 Use a fixed subtarget for test so atom scheduling can't change the addresses this test relies on.
llvm-svn: 204014
2014-03-15 23:01:29 +00:00
Arnaud A. de Grandmaison 75c9e6dedf Remove some dead assignements found by scan-build
llvm-svn: 204013
2014-03-15 22:13:15 +00:00
Benjamin Kramer 86c7741f68 Make some assertions on constant expressions static.
llvm-svn: 204011
2014-03-15 18:47:07 +00:00
Benjamin Kramer d6fa23e1db PointerIntPair: Avoid an (academic) case of undefined behavior in the DenseMapInfo specialization.
If we use a pair with an enum type this could create values outside
of the enum range. Avoid it by creating the bit pattern directly.
While there turn a dynamic assert into a static one. No functionality
change.

llvm-svn: 204010
2014-03-15 18:10:49 +00:00
Benjamin Kramer 62fb0cfb97 LSR: Compress a pair (and get rid of the DenseMapInfo for it).
Also convert a horrible hash function to use our hashing infrastructure.
No functionality change.

llvm-svn: 204008
2014-03-15 17:17:48 +00:00
Patrik Hagglund 8d09a6c674 Replace ValueTypes.h with MachineValueType.h if possible.
Utilize the previous move of MVT to a separate header for all trivial
cases (that don't need any further restructuring).

Reviewed By: Tim Northover

llvm-svn: 204003
2014-03-15 09:11:41 +00:00
Justin Bogner e3bfdc4e14 Support: Make error_category's constructor public
Since our error_category is based on the std one, we should have the
same visibility for the constructor.  This also allows us to avoid
using the _do_message implementation detail in our own categories.

llvm-svn: 203998
2014-03-15 04:05:59 +00:00
NAKAMURA Takumi 64587433ce llvm/test/Transforms/SampleProfile/syntax.ll: Suppress checking the message catalog in ENOENT. It is locale-dependent on Windows.
llvm-svn: 203997
2014-03-15 02:32:21 +00:00
NAKAMURA Takumi 6cf7e5d341 SampleProfile.cpp: Fix take #2. The issue was abuse of StringRef here.
llvm-svn: 203996
2014-03-15 01:56:17 +00:00
NAKAMURA Takumi bfb172897e SampleProfile.cpp: Quick fix to r203976 about abuse of Twine. The life of Twine was too short.
FIXME: DiagnosticInfoSampleProfile should not hold Twine&.
llvm-svn: 203990
2014-03-15 00:10:12 +00:00
Matt Arsenault ea330fbe49 R600: Remove unnecessary attempt to zext a pointer.
Private pointers are now always 32-bits.

llvm-svn: 203989
2014-03-15 00:08:26 +00:00
Matt Arsenault 74891cdefe R600: Code cleanup.
Use sign_extend_inreg and getZeroExtendInReg instead of
using the bit operations they expand into.

llvm-svn: 203988
2014-03-15 00:08:22 +00:00
Rui Ueyama cec949af13 Object/COFF: change data type of SymbolNumber from int16 to uint16.
Microsoft PE/COFF Spec clearly states that the field is of signed interger
type. However, in reality, it's unsigned. If cl.exe needs to create a large
number of sections for COMDAT sections, it will just create more than 32768
sections. Handling large section number as negative number is not correct.
I think this is a spec bug.

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

llvm-svn: 203986
2014-03-15 00:04:08 +00:00
Adrian Prantl 2e4e62e2cc Debug info: Unique types before emitting them to DWARF, where applicable.
llvm-svn: 203983
2014-03-14 23:08:29 +00:00
Adrian Prantl d1e6a4e189 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.

llvm-svn: 203982
2014-03-14 23:08:25 +00:00
Adrian Prantl 5a4b90deae Re-add checks that were in this testcase before it was converted to dwarfdump.
llvm-svn: 203981
2014-03-14 23:08:21 +00:00
Adrian Prantl e2da17fb9e typo
llvm-svn: 203980
2014-03-14 23:08:17 +00:00
Jim Grosbach 9a3284fb2f MC: don't create a backtrace for diagnostics.
For better or worse, this is currently the normal error reporting path
when dealing with backend errors from inline assembly. It's not just
internal compiler issues that come through here, so we shouldn't be
creating a backtrace on this path.

rdar://16329947

llvm-svn: 203979
2014-03-14 22:41:58 +00:00
Diego Novillo 709590838f Re-format SampleProfile.cpp with clang-format. No functional changes.
llvm-svn: 203977
2014-03-14 22:07:18 +00:00
Diego Novillo a32aa3251c Use DiagnosticInfo facility.
Summary:
The sample profiler pass emits several error messages. Instead of
just aborting the compiler with report_fatal_error, we can emit
better messages using DiagnosticInfo.

This adds a new sub-class of DiagnosticInfo to handle the sample
profiler.

Reviewers: chandlerc, qcolombet

CC: llvm-commits

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

llvm-svn: 203976
2014-03-14 21:58:59 +00:00
Eric Christopher 09d1c0f85d Remove command line option for CU hashing. This is on by default now.
Fix up testcases and use of flag.

llvm-svn: 203973
2014-03-14 21:20:07 +00:00
Eric Christopher a2a6e927c8 Make the arbitrary section name be something mach-o compatible.
llvm-svn: 203972
2014-03-14 21:16:54 +00:00
Eric Christopher 4dd947aa02 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.

llvm-svn: 203969
2014-03-14 20:53:49 +00:00
Eric Christopher 3a70d0083f 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.

llvm-svn: 203968
2014-03-14 20:53:43 +00:00
David Blaikie e76b446c05 MCDwarf: Initialize MCLineTableHeader::Label
This sometimes remains null into MCLineTableHeader::Emit where we
conditionally construct a label if one isn't provided for us. We need it
to remain null (rather than just always constructing the label) so we
can identify unused line tables... which is a bit weird and maybe we can
do away with that logic one day (& on that day we can always construct
the label up-front and just have compilation units query the line table
for its label, etc)

llvm-svn: 203967
2014-03-14 20:36:44 +00:00
David Blaikie bfdb81dc2d MCContext: Remove redundant assignment
The member variable is not initialized in the ctor so it's already
empty. No need to empty it again.

llvm-svn: 203963
2014-03-14 20:09:26 +00:00
Rafael Espindola 8953f81f67 Correctly handle an ELF symbol defined with "a = b + expr".
We were marking the symbol as absolute instead of computing b's offset + the
expression value.

This fixes pr19126.

llvm-svn: 203962
2014-03-14 20:09:04 +00:00
David Blaikie c110d4d57c Remove unnecessary StringRef::str() call where an implicit conversion works just fine.
llvm-svn: 203960
2014-03-14 19:53:39 +00:00
David Blaikie edc1753ba3 DwarfDebug: Remove some needless recursion.
llvm-svn: 203946
2014-03-14 16:33:32 +00:00
Duncan P. N. Exon Smith a824862664 x86: Add missing break to getCallPreservedMask()
This change brings getCallPreservedMask()'s logic in line with
getCalleeSavedRegs().

While this changes the control flow slightly, the change is not
currently observable.  is64Bit must be false to get to the accidental
fallthrough, but the case that we fall into (coldcc) does nothing unless
is64Bit is true.

llvm-svn: 203943
2014-03-14 16:29:21 +00:00
Duncan P. N. Exon Smith fea3c8afd6 x86: NFC: Make getCallPreservedMask() more similar to getCalleeSavedRegs()
Changing order of checks in getCallPreservedMask() to match
getCalleeSavedRegs() so that the logic is easier to compare.

llvm-svn: 203939
2014-03-14 16:09:13 +00:00
Richard Osborne fdbd8e05b2 [docs] Add links to XMOS XCore documentation.
Summary: Add links to XCore ISA and ABI documents.

CC: llvm-commits, rafael

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

llvm-svn: 203936
2014-03-14 15:53:50 +00:00
Duncan P. N. Exon Smith 8f66a3afe0 x86: getCalleeSavedRegs() would crash on 0 (so don't default to it)
The current logic assumes that MF is not 0.  Assert that it isn't, and
remove the default of 0 from the header.

llvm-svn: 203934
2014-03-14 15:38:12 +00:00
Rafael Espindola c32573b2d4 Fix a bug introduced during the transition to PathV2.
sys::fs::createUniqueFile returns an absolute path, so MakeSharedObject does
too and we don't need to add a './' prefix.

Patch by Jon McLachlan.

llvm-svn: 203931
2014-03-14 15:13:35 +00:00
Alexey Samsonov 011ffb47cf Delete unused ObjectFile::{begin,end}_symbols()
llvm-svn: 203928
2014-03-14 14:52:03 +00:00
Alexey Samsonov aa4d29571c [C++11] Introduce SectionRef::relocations() to use range-based loops
Reviewers: rafael

Reviewed By: rafael

CC: llvm-commits

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

llvm-svn: 203927
2014-03-14 14:22:49 +00:00
Patrik Hagglund 6862794206 Separate out MVT in a separate header file: MachineValueType.h
The idea behind this split of ValueTypes.h, is to make it easier to
ensure that stuff after type legalization only use MVT (rather than
EVT), by watching include dependencies.

Reviewed By: Tim Northover

llvm-svn: 203926
2014-03-14 13:41:09 +00:00
Ulrich Weigand f445399870 [ppc64] Avoid copy relocs in named rodata sections
Commit r181723 introduced code to avoid placing initialized variables
needing relocations into the .rodata section, which avoid copy relocs
that do not work as expected on ppc64 function references.

The same treatment is also needed for *named* .rodata.XXX sections.
This patch changes PPC64LinuxTargetObjectFile::SelectSectionForGlobal
to modify "Kind" *before* calling the default SelectSectionForGlobal
routine, instead of first calling the default routine and then just
checking for the (main) .rodata section afterwards.

llvm-svn: 203921
2014-03-14 12:45:22 +00:00
Alexander Potapenko b76ea32834 [ASan] Fix https://code.google.com/p/address-sanitizer/issues/detail?id=274
by ignoring globals from __TEXT,__cstring,cstring_literals during instrumenation.
Add a regression test.

llvm-svn: 203916
2014-03-14 10:41:49 +00:00
Alexey Samsonov 4d97203add Use ctor instead of initializer list to appease Windows buildbots
llvm-svn: 203915
2014-03-14 10:37:36 +00:00
Alexey Samsonov 3e13ef5296 Use temporary instead of a local variable here
llvm-svn: 203914
2014-03-14 10:20:10 +00:00
Oliver Stannard f010b9850c Generalise assembly tests to not rely on anonymous symbol names
llvm-svn: 203909
2014-03-14 09:10:26 +00:00
Evgeniy Stepanov 49e2625144 AddressSanitizer instrumentation for MOV and MOVAPS.
This is an initial version of *Sanitizer instrumentation of assembly code.

Patch by Yuri Gorshenin.

llvm-svn: 203908
2014-03-14 08:58:04 +00:00
Stepan Dyatkovskiy a53cf970a1 MergeFunctions, cmpType: fixed variable names from XXTy1 and XXTy2 to XXTyL and XXTyR.
llvm-svn: 203907
2014-03-14 08:48:52 +00:00
Stepan Dyatkovskiy 90c4436962 MergeFunctions, cmpType: Fixed comments wrapping.
llvm-svn: 203905
2014-03-14 08:17:19 +00:00
Simon Atanasyan 048baca082 [yaml2obj][ELF] Use range-based for loops.
llvm-svn: 203900
2014-03-14 06:53:30 +00:00
Simon Atanasyan 4d70d2a54a [yaml2obj][ELF] Refer to a section in the error message by its name not
index.

llvm-svn: 203899
2014-03-14 06:53:25 +00:00
Simon Atanasyan 64dadc8981 [yaml2obj][ELF] Remove unused ELFState class field.
llvm-svn: 203898
2014-03-14 06:53:21 +00:00
Simon Atanasyan a3130a4bad [yaml2obj][ELF] Assign name (.shstrtab) to the section holds sections names.
llvm-svn: 203897
2014-03-14 06:53:16 +00:00
Simon Atanasyan 23ace1f0a1 [Mips] Add one more MIPS relocation type constant.
llvm-svn: 203896
2014-03-14 06:53:10 +00:00
Owen Anderson ec5d480329 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.

llvm-svn: 203890
2014-03-14 05:02:18 +00:00
Sebastian Pop a59005be81 static link polly into tools
llvm-svn: 203886
2014-03-14 04:04:14 +00:00
Pete Cooper 7360280e5c 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
llvm-svn: 203883
2014-03-14 02:28:05 +00:00
Galina Kistanova 1b6a6f16fa Reverted r203879.
llvm-svn: 203880
2014-03-14 01:56:55 +00:00
Galina Kistanova a7419355f7 Fixed misuse of isascii. Also fixes mingw32 build, see http://msdn.microsoft.com/en-us/library/ms235417.aspx
llvm-svn: 203879
2014-03-14 01:43:46 +00:00
Eric Christopher af7eca2da4 Use DW_AT_linkage_name when we're emitting DWARF4 or above.
llvm-svn: 203867
2014-03-13 23:26:25 +00:00
Rafael Espindola 2fb5bc33a3 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).

llvm-svn: 203866
2014-03-13 23:18:37 +00:00
Owen Anderson 16c6bf49b7 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.

llvm-svn: 203865
2014-03-13 23:12:04 +00:00
Owen Anderson 9b8f9c3d95 Fix a bug in InstCombine where we would incorrectly attempt to construct a
bitcast between pointers of two different address spaces if they happened to have
the same pointer size.

llvm-svn: 203862
2014-03-13 22:51:43 +00:00
David Blaikie d9012ba118 MCDwarf: Rename MCDwarfFileTable to MCDwarfLineTable
This type now represents all the data for the DWARF line table:
directory names, file names, and the line table proper.

llvm-svn: 203858
2014-03-13 21:59:51 +00:00
David Blaikie 5cff0e6a81 MCDwarf: Extract the DWARF line table header handling into its own type
llvm-svn: 203856
2014-03-13 21:47:12 +00:00
Lang Hames 8b132433c6 Make GDBJITRegistrar thread safe. Patch by Jim Kearyn, with cleanup by
Ivan Puzyrevskiy.

Fixes PR15750. Thanks Jim and Ivan.

llvm-svn: 203853
2014-03-13 21:25:37 +00:00
Owen Anderson ee1ae96bd5 Fix a subtle issue introduced my my recent changes to MachineRegisterInfo iterators.
When initializing an iterator, we may have to step forward to find the first
operand that passes the current filter set.  When doing that stepping, we should
always step one operand at a time, even if this is by-instr or by-bundle iterator,
as we're stepping between invalid values, so the stride doesn't make sense there.

Fixes a miscompilation of YASM on Win32 reported by Hans Wennborg.  I have not
yet figured out how to reduce it to something testcase-able, because it's sensitive
to the details of how the registers get spilled.

llvm-svn: 203852
2014-03-13 21:25:10 +00:00
Kevin Enderby 3de14bc77e Add -mtriple=x86_64-linux to this test case to fix the build bots.5
The original commit was r203829.

llvm-svn: 203844
2014-03-13 20:31:19 +00:00
David Blaikie 498589c3fd MCDwarf: Sink file/directory creation down into MCDwarfFileTable form MCContext
llvm-svn: 203836
2014-03-13 19:15:04 +00:00
Stephan Tolksdorf e649335b1e Test commit - remove trailing whitespace
llvm-svn: 203834
2014-03-13 19:07:39 +00:00
David Blaikie 533490de63 MCDwarf: Oh, and move the directory string over to std::string as well
(see r203831 for similar stuff)

llvm-svn: 203833
2014-03-13 19:05:33 +00:00
David Blaikie a55ddad134 MCDwarf: Simplify MCDwarfFile to just use std::string instead of cunning use of MCContext's allocator.
There aren't /that/ many files, and we are already using various maps
and other standard containers that don't use MCContext's allocator to
store these values, so this doesn't seem to be critical and simplifies
the design (I'll be moving construction out of MCContext shortly so it'd
be annoying to have to pass the allocator around to allocate these
things... and we'll have non-MCContext users (debug_line.dwo) shortly)

llvm-svn: 203831
2014-03-13 18:55:04 +00:00
Ekaterina Romanova 8d62008ecb 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!

llvm-svn: 203829
2014-03-13 18:47:12 +00:00
David Blaikie 639f8ea397 MCDwarf: Simply MCDwarfFile since it really is just a StringRef and unsigned.
llvm-svn: 203827
2014-03-13 18:21:24 +00:00
Rafael Espindola 4269b9eed5 Use printable names to implement directional labels.
This changes the implementation of local directional labels to use a dedicated
map. With that it can then just use CreateTempSymbol, which is what the rest
of MC uses.

CreateTempSymbol doesn't do a great job at making sure the names are unique
(or being efficient when the names are not needed), but that should probably
be fixed in a followup patch.

This fixes pr18928.

llvm-svn: 203826
2014-03-13 18:09:26 +00:00
Tim Northover bc6d30f8f1 Update my e-mail address in CODE_OWNERS.TXT
llvm-svn: 203824
2014-03-13 18:04:41 +00:00
David Blaikie f4a640eaf6 Remove stale comment
llvm-svn: 203823
2014-03-13 17:58:09 +00:00
David Blaikie 11765bce2d MCDwarf: Refactor line table handling into a single data structure
This replaces several "compile unit ID -> thing" mappings in favor of
one mapping from CUID to the whole line table structure (files,
directories, and lines).

This is another step along the way to refactoring out reusable
components of line table handling for use when generating debug_line.dwo
for fission type units.

Also, might be a good basis to fold some of this handling down into
MCStreamers to avoid the special case of "One line table when doing asm
printing, line table per CU otherwise" by building it into the different
MCStreamer implementations.

llvm-svn: 203821
2014-03-13 17:55:28 +00:00
Tom Stellard 08ef1233c6 R600: LDS instructions shouldn't implicitly define OQAP
LDS instructions are pseudo instructions which model
the OQAP defs and uses within a single instruction.

This fixes a hang in the opencv MedianFilter tests.

llvm-svn: 203818
2014-03-13 17:13:04 +00:00
Mark Seaborn 3f73533a9d Cleanup: Remove use of old "-enable-correct-eh-support" option from a test
This option enables LowerInvoke's obsolete SJLJ EH support, but the
target used in this test (ARM Darwin) no longer uses the LowerInvoke
pass, so the option has no effect here.  This target currently uses
the newer SjLjEHPrepare pass instead.

This cleanup will help with removing "-enable-correct-eh-support".

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

llvm-svn: 203810
2014-03-13 16:23:00 +00:00
Hans Wennborg 89050436e6 [ARM] Use symbolic register names in .cfi directives only with IAS (PR19110)
This is a follow-up to r203635. Saleem pointed out that since symbolic register
names are much easier to read, it would be good if we could turn them off only
when we really need to because we're using an external assembler.

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

llvm-svn: 203806
2014-03-13 15:56:41 +00:00
Alexey Samsonov 48803e5ca9 [C++11] Use ObjectFile::sections() in commandline llvm tools
llvm-svn: 203802
2014-03-13 14:37:36 +00:00
Alexey Samsonov 063eb3fa2d [C++11] Introduce ObjectFile::sections().
Summary:
This adds ObjectFile::section_iterator_range, that allows to write
range-based for-loops running over all sections of a given file.
Several files from lib/ are converted to the new interface. Similar fixes
should be applied to a variety of llvm-* tools.

Reviewers: rafael

Reviewed By: rafael

CC: llvm-commits

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

llvm-svn: 203799
2014-03-13 13:52:54 +00:00
Manuel Jacob a7c48f99ae 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

llvm-svn: 203797
2014-03-13 13:36:25 +00:00
Evgeniy Stepanov 7ab838eb56 [msan] Fix handling of byval arguments in VarArg calls.
llvm-svn: 203794
2014-03-13 13:17:11 +00:00
Alexey Samsonov cd083fe151 [CMake] Put -Werror to CMAKE_CXX_FLAGS instead of using add_llvm_definitions()
add_definitions shouldn't really be used for compiler flags, and the variable
LLVM_DEFINITIONS is not appropriately used at the moment, e.g. it's not exported
to LLVMConfig.cmake

llvm-svn: 203792
2014-03-13 13:08:47 +00:00
Rafael Espindola ef174305f9 Remove utils/llvm-native-gcc.
llvm-gcc had the ability to produce native .o files long before it died.

llvm-svn: 203791
2014-03-13 12:14:10 +00:00
Elena Demikhovsky fd05667276 AVX-512: masked load/store + intrinsics for them.
llvm-svn: 203790
2014-03-13 12:05:52 +00:00
Stepan Dyatkovskiy d8eb0bcb5b First patch of patch series that improves MergeFunctions performance time from O(N*N) to
O(N*log(N)). The idea is to introduce total ordering among functions set.
That allows to build binary tree and perform function look-up procedure in O(log(N)) time. 

This patch description:
Introduced total ordering among Type instances. Actually it is improvement for existing
isEquivalentType.
0. Coerce pointer of 0 address space to integer.
1. If left and right types are equal (the same Type* value), return 0 (means equal).
2. If types are of different kind (different type IDs). Return result of type IDs
comparison, treating them as numbers.
3. If types are vectors or integers, return result of its
pointers comparison (casted to numbers).
4. Check whether type ID belongs to the next group: 
* Void 
* Float 
* Double 
* X86_FP80 
* FP128 
* PPC_FP128 
* Label 
* Metadata 
If so, return 0.
5. If left and right are pointers, return result of address space
comparison (numbers comparison).
6. If types are complex.
Then both LEFT and RIGHT will be expanded and their element types will be checked with
the same way. If we get Res != 0 on some stage, return it. Otherwise return 0.
7. For all other cases put llvm_unreachable.

llvm-svn: 203788
2014-03-13 11:54:50 +00:00
Chandler Carruth 999b92d5aa [PM] As was pointed out in review, I need to define a custom swap in
order to use the single assignment. That's probably worth doing for
a lot of these types anyways as they may have non-trivial moves and so
getting copy elision in more places seems worthwhile.

I've tried to add some tests that actually catch this mistake, and one
of the types is now well tested but the others' tests still fail to
catch this. I'll keep working on tests, but this gets the core pattern
right.

llvm-svn: 203780
2014-03-13 10:42:18 +00:00
Chandler Carruth b07f378fc8 [PM] Stop playing fast and loose with rebinding of references. However
convenient it is to imagine a world where this works, that is not C++ as
was pointed out in review. The standard even goes to some lengths to
preclude any attempt at this, for better or worse. Maybe better. =]

llvm-svn: 203775
2014-03-13 09:50:31 +00:00
Tim Northover 38a93aaaa1 AArch64: error when both positional & named operands are used.
Only one instruction pair needed changing: SMULH & UMULH. The previous
code worked, but MC was doing extra work treating Ra as a valid
operand (which then got completely overwritten in MCCodeEmitter).

No behaviour change, so no tests.

llvm-svn: 203772
2014-03-13 09:00:13 +00:00
Alexey Samsonov 96dc29c028 [C++11] DWARF parser: use SmallVector<std::unique_ptr> for parsed units in DWARFContext, and delete custom destructors
llvm-svn: 203770
2014-03-13 08:19:59 +00:00
Hal Finkel 27774d9274 [PowerPC] Initial support for the VSX instruction set
VSX is an ISA extension supported on the POWER7 and later cores that enhances
floating-point vector and scalar capabilities. Among other things, this adds
<2 x double> support and generally helps to reduce register pressure.

The interesting part of this ISA feature is the register configuration: there
are 64 new 128-bit vector registers, the 32 of which are super-registers of the
existing 32 scalar floating-point registers, and the second 32 of which overlap
with the 32 Altivec vector registers. This makes things like vector insertion
and extraction tricky: this can be free but only if we force a restriction to
the right register subclass when needed. A new "minipass" PPCVSXCopy takes care
of this (although it could do a more-optimal job of it; see the comment about
unnecessary copies below).

Please note that, currently, VSX is not enabled by default when targeting
anything because it is not yet ready for that.  The assembler and disassembler
are fully implemented and tested. However:

 - CodeGen support causes miscompiles; test-suite runtime failures:
      MultiSource/Benchmarks/FreeBench/distray/distray
      MultiSource/Benchmarks/McCat/08-main/main
      MultiSource/Benchmarks/Olden/voronoi/voronoi
      MultiSource/Benchmarks/mafft/pairlocalalign
      MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4
      SingleSource/Benchmarks/CoyoteBench/almabench
      SingleSource/Benchmarks/Misc/matmul_f64_4x4

 - The lowering currently falls back to using Altivec instructions far more
   than it should. Worse, there are some things that are scalarized through the
   stack that shouldn't be.

 - A lot of unnecessary copies make it past the optimizers, and this needs to
   be fixed.

 - Many more regression tests are needed.

Normally, I'd fix these things prior to committing, but there are some
students and other contributors who would like to work this, and so it makes
sense to move this development process upstream where it can be subject to the
regular code-review procedures.

llvm-svn: 203768
2014-03-13 07:58:58 +00:00
Hal Finkel 5457bd08cb [TableGen] Optionally forbid overlap between named and positional operands
There are currently two schemes for mapping instruction operands to
instruction-format variables for generating the instruction encoders and
decoders for the assembler and disassembler respectively: a) to map by name and
b) to map by position.

In the long run, we'd like to remove the position-based scheme and use only
name-based mapping. Unfortunately, the name-based scheme currently cannot deal
with complex operands (those with suboperands), and so we currently must use
the position-based scheme for those. On the other hand, the position-based
scheme cannot deal with (register) variables that are split into multiple
ranges. An upcoming commit to the PowerPC backend (adding VSX support) will
require this capability. While we could teach the position-based scheme to
handle that, since we'd like to move away from the position-based mapping
generally, it seems silly to teach it new tricks now. What makes more sense is
to allow for partial transitioning: use the name-based mapping when possible,
and only use the position-based scheme when necessary.

Now the problem is that mixing the two sensibly was not possible: the
position-based mapping would map based on position, but would not skip those
variables that were mapped by name. Instead, the two sets of assignments would
overlap. However, I cannot currently change the current behavior, because there
are some backends that rely on it [I think mistakenly, but I'll send a message
to llvmdev about that]. So I've added a new TableGen bit variable:
noNamedPositionallyEncodedOperands, that can be used to cause the
position-based mapping to skip variables mapped by name.

llvm-svn: 203767
2014-03-13 07:57:54 +00:00
Alexey Samsonov 1eabf98b32 [C++11] Convert DWARF parser to range-based for loops
llvm-svn: 203766
2014-03-13 07:52:54 +00:00
Saleem Abdulrasool aae4dc21ea ARM: ignore unused variable to fix -Wunused-variable builds
llvm-svn: 203765
2014-03-13 07:15:45 +00:00
Saleem Abdulrasool 324133910a MC: fix silly typo
llvm-svn: 203763
2014-03-13 07:02:46 +00:00
Saleem Abdulrasool dadf94ce84 ARM: support emission of complex SO expressions
Support to the IAS was added to actually parse and handle the complex SO
expressions.  However, the object file lowering was not updated to compensate
for the fact that the shift operand may be an absolute expression.

When trying to assemble to an object file, the lowering would fail while
succeeding when emitting purely assembly.  Add an appropriate test.

The test case is inspired by the test case provided by Jiangning Liu who also
brought the issue to light.

llvm-svn: 203762
2014-03-13 07:02:41 +00:00
Saleem Abdulrasool 9b7c0af292 Support: add support to identify WinCOFF/ARM objects
Add the Windows COFF ARM object file magic.  This enables the LLVM tools to
interact with COFF object files for Windows on ARM.

llvm-svn: 203761
2014-03-13 07:02:35 +00:00
Ted Kremenek 68af845661 [CMake] Enable a bunch of Xcode build settings that correspond to warnings that are for the most part enabled by default either by Clang or -Wall.
I personally build with these settings enabled all the time, and it
is clearer to see the actual warning flags (e.g., -Wuninitialized)
get passed by Xcode rather than seeing -Wno-uninitialized followed
by -Wall (the latter canceling out the former) and figuring out
what is going on.

Xcode will ignore build settings it doesn't understand, so this will
work on possibly older versions of Xcode that don't support all
of these settings.

llvm-svn: 203760
2014-03-13 06:37:28 +00:00
Owen Anderson abb90c9ddb 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.

llvm-svn: 203757
2014-03-13 06:02:25 +00:00
Karthik Bhat 294607e122 Fix PR18800. llvm intrinsic memcpy takes 5 arguments void @llvm.memcpy.p0i8.p0i8.i32(i8* <dest>, i8* <src>, i32 <len>, i32 <align>, i1 <isvolatile>).The test case incorrectly uses the old format resulting in isVolatile function in MemIntrinsic to crash during SROA transformation.Modified the test case to use correct signature of memcpy and memset.
llvm-svn: 203750
2014-03-13 04:50:29 +00:00
Andrew Trick dca870b20e Fix a false error reported by the tblgen backend for machine model
"ProcResource def is not included in the ProcResources".

Some of the machine model definitions were not added to the
processor's list used for diagnostics and error checking.

llvm-svn: 203749
2014-03-13 03:49:20 +00:00
Saleem Abdulrasool ac58e9fc0b MC: fix possible NULL pointer dereference
Avoid NULL pointer scenario found via clang's static analyzer.

llvm-svn: 203745
2014-03-13 02:09:51 +00:00
NAKAMURA Takumi 477a2f39cb llvm/test/BugPoint/compile-custom.ll.py: Make it py3-compatible. [PR19112]
FIXME: Get rid of invoking this.
I guess it wouldn't run on win32 due to lacking of shell support.

llvm-svn: 203740
2014-03-13 00:10:37 +00:00
Mark Seaborn 07e7486128 Fix typo in comment: "inwoke" -> "invoke"
llvm-svn: 203739
2014-03-13 00:04:17 +00:00
Arnold Schwaighofer 9ab93ac6d4 Fix whitespace in vectorizer example
llvm-svn: 203738
2014-03-12 23:58:07 +00:00
Arnold Schwaighofer 34ac9be1d7 Fix vectorizer docs.
This example is not vectorized because LLVM does not prove no-wrapping of
"a[i*7] += ...".

llvm-svn: 203734
2014-03-12 23:23:44 +00:00
NAKAMURA Takumi 8a5a590cd1 decl-derived-member.ll: Try to unbreak. Don't add -mtriple to %llc_dwarf.
llvm-svn: 203732
2014-03-12 23:08:19 +00:00
Rafael Espindola 730df071c8 Remove projects/sample.
As an example that was not actually being used, it suffered from a slow bitrot.

The two main issues with it were that it had no cmake support and
included a copy of the autoconf directory. The reality is that
autoconf is not easily composable. The lack of composabilty is why we
have clang options in llvm's configure. Suggesting that users include
a copy of autoconf/ in their projects seems a bad idea.

We are also in the process of switching to cmake, so pushing autoconf
to new project is probably not what we want.

llvm-svn: 203728
2014-03-12 22:40:22 +00:00
David Blaikie f4ad698336 MCDwarf: Remove unused parameter
llvm-svn: 203727
2014-03-12 22:35:23 +00:00
David Blaikie a55e64f84a MCDwarf: Invert the Section+CU->LineEntries mapping so the CU is the primary dimension
This makes the mapping consistent with other CU->X mappings in the
MCContext, helping pave the way to refactor all these values into a
single data structure per CU and thus a single map.

I haven't renamed the data structure as that would make the patch churn
even higher (the MCLineSection name no longer makes sense, as this
structure now contains lines for multiple sections covered by a single
CU, rather than lines for a single section in multiple CUs) and further
refactorings will follow that may remove this type entirely.

For convenience, I also gave the MCLineSection value semantics so we
didn't have to do the lazy construction, manual delete, etc.

(& for those playing at home, refactoring the line printing into a
single data structure will eventually alow that data structure to be
reused to own the debug_line.dwo line table used for type unit file name
resolution)

llvm-svn: 203726
2014-03-12 22:28:56 +00:00
Rafael Espindola 1cf777bc12 This test need the X86 backend, move it to the X86 sub directory.
llvm-svn: 203725
2014-03-12 22:03:43 +00:00
Justin Bogner ec49f9820c Back out Profile library and dependent commits
Chandler voiced some concern with checking this in without some
discussion first. Reverting for now.

This reverts r203703, r203704, r203708, and 203709.

llvm-svn: 203723
2014-03-12 22:00:57 +00:00
Michael Zolotukhin 66806aef1e PR17473:
Don't normalize an expression during postinc transformation unless it's
invertible.

llvm-svn: 203719
2014-03-12 21:31:05 +00:00
Adam Nemet d4e56073c7 [X86] Add peephole for masked rotate amount
Extend what's currently done for shift because the HW performs this masking
implicitly:

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

I use the newly factored out multiclass that was only supporting shifts so
far.

For testing I extended my testcase for the new rotation idiom.

<rdar://problem/15295856>

llvm-svn: 203718
2014-03-12 21:20:55 +00:00
Rafael Espindola f217e099bb Fix the ocaml test to not create a alias to a declaration.
llvm-svn: 203717
2014-03-12 21:20:42 +00:00
Michael Zolotukhin 15e6e543b9 Test commit
llvm-svn: 203716
2014-03-12 21:15:56 +00:00
Justin Bogner f548af539c Profile: Avoid an unnecessary __attribute__((packed))
MSVC doesn't understand it, and it wasn't really necessary anyway.

llvm-svn: 203709
2014-03-12 20:40:14 +00:00
Justin Bogner a1f278f96c Profile: Remove an inefficient and unnecessary API function
This was leftover from an approach I abandoned, but I forgot to update
it before committing.

llvm-svn: 203708
2014-03-12 20:26:37 +00:00
Raul E. Silvera 62f0236d36 Resubmit "[SLPV] Recognize vectorizable intrinsics during SLP vectorization ..."
This reverts commit 86cb795388643710dab34941ddcb5a9470ac39d8.
The problems previously found have been resolved through other CLs.

llvm-svn: 203707
2014-03-12 20:21:50 +00:00
Rafael Espindola b676e72d56 Add a triple to fix the test on OS X.
llvm-svn: 203706
2014-03-12 20:21:35 +00:00
Rafael Espindola f3336bc1d5 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.

llvm-svn: 203705
2014-03-12 20:15:49 +00:00
Justin Bogner bfee8d49c4 llvm-profdata: Use the Profile library, implement show and generate
This replaces the llvm-profdata tool with a version that uses the
recently introduced Profile library. The new tool has the ability to
generate and summarize profdata files as well as merging them.

llvm-svn: 203704
2014-03-12 20:14:17 +00:00
Justin Bogner a2e0368994 Profile: Add a library for the instrumentation based profiling format
This provides a library to work with the instrumentation based
profiling format that is used by clang's -fprofile-instr-* options and
by the llvm-profdata tool. This is a binary format, rather than the
textual one that's currently in use.

The tests are in the subsequent commits that use this.

llvm-svn: 203703
2014-03-12 20:14:05 +00:00