oota-llvm.git
9 years ago[GlobalMerge] Look at uses to create smaller global sets.
Ahmed Bougacha [Sat, 18 Apr 2015 01:21:58 +0000 (01:21 +0000)]
[GlobalMerge] Look at uses to create smaller global sets.

Instead of merging everything together, look at the users of
GlobalVariables, and try to group them by function, to create
sets of globals used "together".

Using that information, a less-aggressive alternative is to keep merging
everything together *except* globals that are only ever used alone, that
is, those for which it's clearly non-profitable to merge with others.

In my testing, grouping by Function is too aggressive, but grouping by
BasicBlock is too conservative.  Anything in-between isn't trivially
available, so stick with Function grouping for now.

cl::opts are added for testing; both enabled by default.

A few of the testcases aren't testing the merging proper, but just
various edge cases when merging does occur.  Update them to use the
previous grouping behavior. Also, one of the tests is unrelated to
GlobalMerge; change it accordingly.
While there, switch to r234666' flags rather than the brutal -O3.

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

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

9 years agoDebugInfo: Delete DIDescriptor (but not its subclasses)
Duncan P. N. Exon Smith [Sat, 18 Apr 2015 00:35:36 +0000 (00:35 +0000)]
DebugInfo: Delete DIDescriptor (but not its subclasses)

Delete `DIDescriptor` and update the remaining users.  I'll follow-up by
deleting subclasses in manageable groups (top-down).

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

9 years agodocs: Update Kaleidoscope for recent DI changes
Duncan P. N. Exon Smith [Sat, 18 Apr 2015 00:01:35 +0000 (00:01 +0000)]
docs: Update Kaleidoscope for recent DI changes

This has been bit-rotting, so fix it up.  I'll have to edit this again
once the MD* classes have been renamed to DI* -- I'll try to remember to
do that with the commit that renames them.

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

9 years ago[AArch64] Don't force MVT::Untyped when selecting LD1LANEpost.
Ahmed Bougacha [Fri, 17 Apr 2015 23:43:33 +0000 (23:43 +0000)]
[AArch64] Don't force MVT::Untyped when selecting LD1LANEpost.

The result is either an Untyped reg sequence, on ldN with N > 1, or
just the type of the input vector, on ld1.  Don't force Untyped.
Instead, just use the type of the reg sequence.

This mirrors the behavior of createTuple, which feeds the LD1*_POST.

The narrow code path wasn't actually covered by tests, because V64
insert_vector_elt are widened to V128 before the LD1LANEpost combine
has the chance to run, usually.

The only case where it does run on V64 vectors is if the vector ops
legalizer ran.  So, tickle the code with a ctpop.

Fixes PR23265.

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

9 years agoFix another typo in r235224 testcase. NFC.
Ahmed Bougacha [Fri, 17 Apr 2015 23:38:46 +0000 (23:38 +0000)]
Fix another typo in r235224 testcase.  NFC.

Third time's the charm!

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

9 years agoFix build wanrings and line endings
Andrew Kaylor [Fri, 17 Apr 2015 23:20:24 +0000 (23:20 +0000)]
Fix build wanrings and line endings

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

9 years agoDebugInfo: Remove DIDescriptor from the DebugInfo API
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 23:20:10 +0000 (23:20 +0000)]
DebugInfo: Remove DIDescriptor from the DebugInfo API

Stop using `DIDescriptor` and its subclasses in the `DebugInfoFinder`
API, as well as the rest of the API hanging around in `DebugInfo.h`.

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

9 years ago[WinEH] Fixes for a few cppeh failures.
Andrew Kaylor [Fri, 17 Apr 2015 23:05:43 +0000 (23:05 +0000)]
[WinEH] Fixes for a few cppeh failures.

Differential Review: http://reviews.llvm.org/D9065

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

9 years ago[LoopAccesses] Improve debug output
Adam Nemet [Fri, 17 Apr 2015 22:43:10 +0000 (22:43 +0000)]
[LoopAccesses] Improve debug output

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

9 years ago[PDB] Support executables and source/line info.
Zachary Turner [Fri, 17 Apr 2015 22:40:36 +0000 (22:40 +0000)]
[PDB] Support executables and source/line info.

Previously DebugInfoPDB could only load data for a PDB given a
path to the PDB.  It could not open an EXE and find the matching
PDB and verify it matched, etc.  This patch adds support for that
so that we can simply load debug information for a PDB directly.

Additionally, this patch extends DebugInfoPDB to support getting
source and line information for symbols.

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

9 years ago[opaque pointer type] Access the pointee of the result type from the GEP rather than...
David Blaikie [Fri, 17 Apr 2015 22:32:20 +0000 (22:32 +0000)]
[opaque pointer type] Access the pointee of the result type from the GEP rather than pulling it out of the pointer result type

The implementation of this GEP::getResultElementType will be refactored
to either rely on a member variable, or recompute the value from the
indicies (any preferences?).

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

9 years ago[opaque pointer type] Query the GEP for its source element type directly rather than...
David Blaikie [Fri, 17 Apr 2015 22:32:17 +0000 (22:32 +0000)]
[opaque pointer type] Query the GEP for its source element type directly rather than finding it through the pointer type of the first operand in the Verifier

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

9 years ago[opaque pointer type] Avoid creating (and then unwrapping) a pointer type to compute...
David Blaikie [Fri, 17 Apr 2015 22:32:16 +0000 (22:32 +0000)]
[opaque pointer type] Avoid creating (and then unwrapping) a pointer type to compute the result type of a GEP

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

9 years ago[opaque pointer type] Use the parsed explicit pointee type when error-checking geps...
David Blaikie [Fri, 17 Apr 2015 22:32:13 +0000 (22:32 +0000)]
[opaque pointer type] Use the parsed explicit pointee type when error-checking geps during LL parsing

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

9 years ago[MemCpyOpt] Optimize double-storing by memset+memcpy.
Ahmed Bougacha [Fri, 17 Apr 2015 22:20:57 +0000 (22:20 +0000)]
[MemCpyOpt] Optimize double-storing by memset+memcpy.

A common idiom in some code is to do the following:

  memset(dst, 0, dst_size);
  memcpy(dst, src, src_size);

Some of the memset is redundant; instead, we can do:

  memcpy(dst, src, src_size);
  memset(dst + src_size, 0,
         dst_size <= src_size ? 0 : dst_size - src_size);

Original patch by: Joel Jones
Differential Revision: http://reviews.llvm.org/D498

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

9 years ago[LangRef] Remove redundant and inconsistent condition.
Sean Silva [Fri, 17 Apr 2015 21:58:55 +0000 (21:58 +0000)]
[LangRef] Remove redundant and inconsistent condition.

Just above, 'op2' is stated to be unsigned, so 'negative' doesn't make
sense (and is handled by "larger than" anyway). The descriptions for
lshr and ashr don't say 'negative or' either.

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

9 years agoAsmPrinter: Create a unified .debug_loc stream
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 21:34:47 +0000 (21:34 +0000)]
AsmPrinter: Create a unified .debug_loc stream

This commit removes `DebugLocList` and replaces it with
`DebugLocStream`.

  - `DebugLocEntry` no longer contains its byte/comment streams.
  - The `DebugLocEntry` list for a variable/inlined-at pair is allocated
    on the stack, and released right after `DebugLocEntry::finalize()`
    (possible because of the refactoring in r231023).  Now, only one
    list is in memory at a time now.
  - There's a single unified stream for the `.debug_loc` section that
    persists, stored in the new `DebugLocStream` data structure.

The last point is important: this collapses the nested `SmallVector<>`s
from `DebugLocList` into unified streams.  We previously had something
like the following:

    vec<tuple<Label, CU,
              vec<tuple<BeginSym, EndSym,
                        vec<Value>,
                        vec<char>,
                        vec<string>>>>>

A `SmallVector` can avoid allocations, but is statically fairly large
for a vector: three pointers plus the size of the small storage, which
is the number of elements in small mode times the element size).
Nesting these is expensive, since an inner vector's size contributes to
the element size of an outer one.  (Nesting any vector is expensive...)

In the old data structure, the outer vector's *element* size was 632B,
excluding allocation costs for when the middle and inner vectors
exceeded their small sizes.  312B of this was for the "three" pointers
in the vector-tree beneath it.  If you assume 1M functions with an
average of 10 variable/inlined-at pairs each (in an LTO scenario),
that's almost 6GB (besides inner allocations), with almost 3GB for the
"three" pointers.

This came up in a heap profile a little while ago of a `clang -flto -g`
bootstrap, with `DwarfDebug::collectVariableInfo()` using something like
10-15% of the total memory.

With this commit, we have:

    tuple<vec<tuple<Label, CU, Offset>>,
          vec<tuple<BeginSym, EndSym, Offset, Offset>>,
          vec<char>,
          vec<string>>

The offsets are used to create `ArrayRef` slices of adjacent
`SmallVector`s.  This reduces the number of vectors to four (unrelated
to the number of variable/inlined-at pairs), and caps the number of
allocations at the same number.

Besides saving memory and limiting allocations, this is NFC.

I don't know my way around this code very well yet, but I wonder if we
could go further: why stream to a side-table, instead of directly to the
output stream?

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

9 years agoAArch64: Add test for returning [2 x i64] in registers. NFC.
Pete Cooper [Fri, 17 Apr 2015 21:31:25 +0000 (21:31 +0000)]
AArch64: Add test for returning [2 x i64] in registers.  NFC.

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

9 years agoCompute A-B when A or B is weak.
Rafael Espindola [Fri, 17 Apr 2015 21:15:17 +0000 (21:15 +0000)]
Compute A-B when A or B is weak.

Similar to r235222, but for the weak symbol case.

In an "ideal" assembler/object format an expression would always refer to the
final value and A-B would only be computed from a section in the same
comdat as A and B with A and B strong.

Unfortunately that is not the case with debug info on ELF, so we need an
heuristic.  Since we need an heuristic, we may as well use the same one as
gas:

* call weak_sym : produces a relocation, even if in the same section.
* A - weak_sym and weak_sym -A: don't produce a relocation if we can
  compute it.

This fixes pr23272 and changes the fix of pr22815 to match what gas does.

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

9 years agoFix typo in r235224 testcase. NFC.
Ahmed Bougacha [Fri, 17 Apr 2015 21:11:58 +0000 (21:11 +0000)]
Fix typo in r235224 testcase. NFC.

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

9 years agoRemove dead code, NFC
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 21:06:49 +0000 (21:06 +0000)]
Remove dead code, NFC

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

9 years ago[AArch64] Avoid vector->load dependency cycles when creating LD1*post.
Ahmed Bougacha [Fri, 17 Apr 2015 21:02:30 +0000 (21:02 +0000)]
[AArch64] Avoid vector->load dependency cycles when creating LD1*post.

They would break the SelectionDAG.
Note that the opposite load->vector dependency is already obvious in:
  (LD1*post vec, ..)

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

9 years ago[WinEH] Reusing HandlerType entries leads to small CatchHigh values
David Majnemer [Fri, 17 Apr 2015 20:12:09 +0000 (20:12 +0000)]
[WinEH] Reusing HandlerType entries leads to small CatchHigh values

CatchHigh may be smaller than TryHigh if we reuse an outlined catch
handler for two different invokes with different EH states.  We have no
evidence which shows that CatchHigh must be greater than TryHigh or
TryLow.  We can revisit this if we turn out to be wrong.

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

9 years agoCompute A-B if both A and B are in the same comdat section.
Rafael Espindola [Fri, 17 Apr 2015 20:05:17 +0000 (20:05 +0000)]
Compute A-B if both A and B are in the same comdat section.

Part of pr23272.

A small annoyance with the assembly syntax we implement is that given an
expression there is no way to know if what is desired is the value of that
expression for the symbols in this file or for the final values of those
symbols in a link.

The first case is useful for use in sections that get discarded or ignored
if the section they are describing is discarded.

For axample, consider A-B where A and B are in the same comdat section.

We can compute the value of the difference in the section that is present in
the current .o and if that section survives to the final DSO the value will
still will be correct.

But the section is in a comdat. Another section from another object file
might be used istead. We know that that section will define A and B, but
we have no idea what the value of A-B might be.

In practice we have to assume that the intention is to compute the value
in the current section since otherwise the is no way to create something like
the debug aranges section.

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

9 years ago[opaque pointer types] Use the pointee type loaded from bitcode when constructing...
David Blaikie [Fri, 17 Apr 2015 19:56:21 +0000 (19:56 +0000)]
[opaque pointer types] Use the pointee type loaded from bitcode when constructing a LoadInst

Now (with a few carefully placed suppressions relating to general type
serialization, etc) we can round trip a simple load through bitcode and
textual IR without calling getElementType on a PointerType.

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

9 years agoFix build errors introduced by r235215
Pirama Arumuga Nainar [Fri, 17 Apr 2015 19:51:44 +0000 (19:51 +0000)]
Fix build errors introduced by r235215

Summary:
- Handle TypePromoteFloat in switch statements
- Move an expression into an assert to avoid unused variable in
  non-assert builds.

Reviewers: srhines, ab

Subscribers: llvm-commits

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

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

9 years agoSuppressing the C4324 warnings generated by MSVC. This is the only declarative instan...
Aaron Ballman [Fri, 17 Apr 2015 19:35:44 +0000 (19:35 +0000)]
Suppressing the C4324 warnings generated by MSVC. This is the only declarative instance that would generate the warning, but it accounted for about 525+ warnings due to template instantiations. This is a marginal-value warning which we may decide to disable more broadly, but since this header is in Support and may be used out of tree, it's a low burden for us to be warning-free in this case.

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

9 years agoAdd support to promote f16 to f32
Pirama Arumuga Nainar [Fri, 17 Apr 2015 18:36:25 +0000 (18:36 +0000)]
Add support to promote f16 to f32

Summary:
This patch adds legalization support to operate on FP16 as a load/store type
and do operations on it as floats.

Tests for ARM are added to test/CodeGen/ARM/fp16-promote.ll

Reviewers: srhines, t.p.northover

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

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

9 years ago[mips][FastISel] Implement FastMaterializeAlloca in Mips fast-isel.
Vasileios Kalintiris [Fri, 17 Apr 2015 17:29:58 +0000 (17:29 +0000)]
[mips][FastISel] Implement FastMaterializeAlloca in Mips fast-isel.

Summary: Implement the method FastMaterializeAlloca in Mips fast-isel

Based on a patch by Reed Kotler.

Test Plan:
Passes test-suite at O0/O2 for mips32 r1/r2
fastalloca.ll

Reviewers: dsanders, rkotler

Subscribers: rfuhler, llvm-commits

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

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

9 years ago[WinEH] Allow CatchHigh to be equal to TryHigh
David Majnemer [Fri, 17 Apr 2015 17:20:30 +0000 (17:20 +0000)]
[WinEH] Allow CatchHigh to be equal to TryHigh

Catch blocks which are empty may be in the same state as their try
blocks.  It is not meaningful to give the catch block its own state
number in this case because it can't do anything exceptional.

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

9 years ago[LTO API] add lto_codegen_set_should_internalize.
Manman Ren [Fri, 17 Apr 2015 17:10:09 +0000 (17:10 +0000)]
[LTO API] add lto_codegen_set_should_internalize.

When debugging LTO issues with ld64, we use -save-temps to save the merged
optimized bitcode file, then invoke ld64 again on the single bitcode file.
The saved bitcode file is already internalized, so we can call
lto_codegen_set_should_internalize and skip running internalization again.

rdar://20227235

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

9 years ago[X86, AVX] add an exedepfix entry for vmovq == vmovlps == vmovlpd
Sanjay Patel [Fri, 17 Apr 2015 17:02:37 +0000 (17:02 +0000)]
[X86, AVX] add an exedepfix entry for vmovq == vmovlps == vmovlpd

This is the AVX extension of r235014:
http://llvm.org/viewvc/llvm-project?view=revision&revision=235014

Review:
http://reviews.llvm.org/D8691

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

9 years agoAsmPrinter: Store MDExpression directly instead of MDNode, NFC
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 16:36:10 +0000 (16:36 +0000)]
AsmPrinter: Store MDExpression directly instead of MDNode, NFC

Clean up `DebugLocEntry::Value::Expression`'s type while I'm messing
around in here anyway.

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

9 years agoAsmPrinter: Stop storing MDLocalVariable in DebugLocEntry
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 16:33:37 +0000 (16:33 +0000)]
AsmPrinter: Stop storing MDLocalVariable in DebugLocEntry

Stop storing the `MDLocalVariable` in the `DebugLocEntry::Value`s.  We
generate the list of `DebugLocEntry`s separately for each
variable/inlined-at pair, so the variable never actually changes here.

This is effectively NFC (aside from saving some memory and CPU time).

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

9 years agoAsmPrinter: Calculate type upfront for location lists, NFC
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 16:28:58 +0000 (16:28 +0000)]
AsmPrinter: Calculate type upfront for location lists, NFC

We can calculate the variable type up front before calling
`DebugLocEntry::finalize()`.  In fact, since we only care about the type
if it's an `MDBasicType`, don't even bother resolving it using the type
identifier map.

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

9 years ago[opaque pointer type] Serialize the type of an llvm::Function as a function type...
David Blaikie [Fri, 17 Apr 2015 16:28:26 +0000 (16:28 +0000)]
[opaque pointer type] Serialize the type of an llvm::Function as a function type rather than a function pointer type

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

9 years agoAdd support for v1i128 type.
Kit Barton [Fri, 17 Apr 2015 16:11:05 +0000 (16:11 +0000)]
Add support for v1i128 type.
The v1i128 type is needed for the quadword add/substract instructions introduced
in POWER8. Futhermore, the PowerPC ABI specifies that parameters of type v1i128
are to be passed in a single vector register, while parameters of type i128 are
passed in pairs of GPRs. Thus, it is necessary to be able to differentiate
between v1i128 and i128 in LLVM.

http://reviews.llvm.org/D8564

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

9 years agoAdd the i128 builtin type to LLVM.
Kit Barton [Fri, 17 Apr 2015 15:32:15 +0000 (15:32 +0000)]
Add the i128 builtin type to LLVM.
The i128 type is needed as a builtin type in order to support the v1i128 vector
type. The PowerPC ABI requires that the i128 and v1i128 types are handled
differently when passed as parameters to functions (i128 is passed in pairs of
GPRs, v1i128 is passed in a single vector register).

http://reviews.llvm.org/D8564

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

9 years ago[mips][FastISel] Implement shift ops for Mips fast-isel.
Vasileios Kalintiris [Fri, 17 Apr 2015 14:29:21 +0000 (14:29 +0000)]
[mips][FastISel] Implement shift ops for Mips fast-isel.

Summary:
Add shift operators implementation to fast-isel for Mips.  These are shift ops
for non legal forms, i.e. i8 and i16.

Based on a patch by Reed Kotler.

Test Plan:

Reviewers: dsanders

Subscribers: echristo, rfuhler, llvm-commits

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

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

9 years agoFix TRUNCATE splitting helper logic.
James Molloy [Fri, 17 Apr 2015 13:51:40 +0000 (13:51 +0000)]
Fix TRUNCATE splitting helper logic.

This is a followon to r233681 - I'd misunderstood the semantics of FTRUNC,
and had confused it with (FP_ROUND ..., 0).

Thanks for Ahmed Bougacha for his post-commit review!

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

9 years agoMove AliasedSymbol to MachObjectWriter.
Rafael Espindola [Fri, 17 Apr 2015 12:28:43 +0000 (12:28 +0000)]
Move AliasedSymbol to MachObjectWriter.

It was only used by MachO.
Part of pr19627.

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

9 years agoRevert r235177 as the Handle is used to fail GetExitCodeProcess on purpose.
Yaron Keren [Fri, 17 Apr 2015 12:11:15 +0000 (12:11 +0000)]
Revert r235177 as the Handle is used to fail GetExitCodeProcess on purpose.
Avoid double closing of the handle by testing GetLastErr for
ERROR_INVALID_HANDLE and not calling CloseHandle(PI.ProcessHandle) then.

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

9 years ago[mips] Teach the delay slot filler to remove needless KILL instructions.
Vasileios Kalintiris [Fri, 17 Apr 2015 12:01:02 +0000 (12:01 +0000)]
[mips] Teach the delay slot filler to remove needless KILL instructions.

Summary:
Previously, the presence of KILL instructions would block valid candidates
from filling a specific delay slot. With the elimination of the KILL
instructions, in the appropriate range, we are able to fill more slots and
keep the information from future def/use analysis consistent.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: hfinkel, llvm-commits

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

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

9 years agoAdd a proper fix for pr23025.
Rafael Espindola [Fri, 17 Apr 2015 11:27:13 +0000 (11:27 +0000)]
Add a proper fix for pr23025.

Instead of avoiding looking past every global symbol, only do so
if the symbol is in a comdat.

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

9 years ago[mc] Clean up emission of byte sequences
Benjamin Kramer [Fri, 17 Apr 2015 11:12:43 +0000 (11:12 +0000)]
[mc] Clean up emission of byte sequences

No functional change intended.

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

9 years agoEliminate superfluous CloseHandle(PI.ProcessHandle).
Yaron Keren [Fri, 17 Apr 2015 11:09:18 +0000 (11:09 +0000)]
Eliminate superfluous CloseHandle(PI.ProcessHandle).
This handle will always be closed few lines later, resulting in
an error for the second CloseHandle.

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

9 years agolli/OrcLazyJIT.cpp: Use <cstdio> for printf(3) introduced in r234908.
NAKAMURA Takumi [Fri, 17 Apr 2015 10:01:30 +0000 (10:01 +0000)]
lli/OrcLazyJIT.cpp: Use <cstdio> for printf(3) introduced in r234908.

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

9 years ago[mips] Move ABI-dependent register selections to MipsABIInfo. NFC.
Daniel Sanders [Fri, 17 Apr 2015 09:50:21 +0000 (09:50 +0000)]
[mips] Move ABI-dependent register selections to MipsABIInfo. NFC.

Summary:
For example, a common idiom was 'isN64 ? Mips::SP_64 : Mips::SP'. This has
been moved to MipsABIInfo and replaced with 'ABI.GetStackPtr()'.

There are others that should also be moved. This patch sticks to the ones that
are obviously non-functional. The others have minor mistakes that need fixing
at the same time, mostly involving checks for 64-bit GPR's instead of checks
for 64-bit pointers.

Reviewers: tomatabacu

Reviewed By: tomatabacu

Subscribers: llvm-commits

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

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

9 years agoRevert r235154-r235156, they cause asserts when building win64 code (http://crbug...
Nico Weber [Fri, 17 Apr 2015 09:10:43 +0000 (09:10 +0000)]
Revert r235154-r235156, they cause asserts when building win64 code (crbug.com/477988)

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

9 years agoAdd a reduced testcase from pr23025.
Rafael Espindola [Fri, 17 Apr 2015 09:05:25 +0000 (09:05 +0000)]
Add a reduced testcase from pr23025.

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

9 years agoDon't walk aliases from global to local symbols in comdats.
Rafael Espindola [Fri, 17 Apr 2015 08:46:11 +0000 (08:46 +0000)]
Don't walk aliases from global to local symbols in comdats.

This fixes pr23196.

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

9 years agoWrite relocation sections contiguously.
Rafael Espindola [Fri, 17 Apr 2015 08:11:38 +0000 (08:11 +0000)]
Write relocation sections contiguously.

Linkers normally read all the relocations upfront to compute the references
between sections. Putting them together is a bit more cache friendly.

I benchmarked linking a Release+Asserts clang with gold on a vm. I tried all
4 combinations of --gc-sections/no --gc-section hot and cold cache.

I cleared the cache with

echo 3 > /proc/sys/vm/drop_caches

and warmed it up by running the link once before timing the subsequent ones.

With cold cache and --gc-sections the time goes from

1.86130781665 +- 0.01713126697463843 seconds
to
1.82370735105 +- 0.014127522318814516 seconds

With cold cache and no --gc-sections the time goes from

1.6087245435500002 +- 0.012999066825178644 seconds
to
1.5687122041500001 +- 0.013145850126026619 seconds

With hot cache and no --gc-sections the time goes from

0.926200939 ( +-  0.33% ) seconds
to
0.907200079 ( +-  0.31% ) seconds

With hot cache and gc sections the time goes from

1.183038049 ( +-  0.34% ) seconds
to
1.147355862 ( +-  0.39% ) seconds

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

9 years ago[opaque pointer type] Explicit pointee type for call instruction
David Blaikie [Fri, 17 Apr 2015 06:40:14 +0000 (06:40 +0000)]
[opaque pointer type] Explicit pointee type for call instruction

Use an extra bit in the CCInfo to flag the newer version of the
instructiont hat includes the type explicitly.

Tested the newer error cases I added, but didn't add tests for the finer
granularity improvements to existing error paths.

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

9 years agoNarrow down the type of CallInst::getFunctionType to a FunctionType
David Blaikie [Fri, 17 Apr 2015 06:40:11 +0000 (06:40 +0000)]
Narrow down the type of CallInst::getFunctionType to a FunctionType

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

9 years agoFix test failure due to racing commits
Reid Kleckner [Fri, 17 Apr 2015 01:09:53 +0000 (01:09 +0000)]
Fix test failure due to racing commits

It looks like r235145 changed the .ll syntax for variadic calls. Update
tests to use the new syntax.

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

9 years agoFix unused variable warning
Reid Kleckner [Fri, 17 Apr 2015 01:03:30 +0000 (01:03 +0000)]
Fix unused variable warning

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

9 years ago[SEH] Reimplement x64 SEH using WinEHPrepare
Reid Kleckner [Fri, 17 Apr 2015 01:01:27 +0000 (01:01 +0000)]
[SEH] Reimplement x64 SEH using WinEHPrepare

This now emits simple, unoptimized xdata tables for __C_specific_handler
based on the handlers listed in @llvm.eh.actions calls produced by
WinEHPrepare.

This adds support for running __finally blocks when exceptions are
thrown, and removes the old landingpad fan-in codepath.

I ran some manual execution tests on small basic test cases with and
without optimization, as well as on Chrome base_unittests, which uses a
small amount of SEH.  I'm sure there are bugs, and we may need to
revert.

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

9 years agoDebugInfo: Fixup r235149 after IR change in r235145
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 00:37:53 +0000 (00:37 +0000)]
DebugInfo: Fixup r235149 after IR change in r235145

This shouldn't have used varargs anyway; change the functions to be
`void`.  Also remove my accidentally-committed directory path.

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

9 years ago[NaryReassociate] run NaryReassociate iteratively
Jingyue Wu [Fri, 17 Apr 2015 00:25:10 +0000 (00:25 +0000)]
[NaryReassociate] run NaryReassociate iteratively

Summary:
An alternative is to use a worklist approach. However, that approach
would break the traversing order so that we couldn't lookup SeenExprs
efficiently. I don't see a clear winner here, so I picked the easier approach.

Along with two minor improvements:
1. preserves ScalarEvolution by forgetting instructions replaced
2. removes dead code locally avoiding the need of running DCE afterwards

Test Plan: add to slsr-add.ll a test that requires multiple iterations

Reviewers: broune, dberlin, atrick, meheff

Reviewed By: atrick

Subscribers: llvm-commits

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

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

9 years agoDebugInfo: Simplify testcase from LiveDebugVariables fix in r235140
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 00:18:46 +0000 (00:18 +0000)]
DebugInfo: Simplify testcase from LiveDebugVariables fix in r235140

This testcase is less brittle and exactly tests for the misbehaviour.
Thanks to David Blaikie for the suggestion.

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

9 years ago[AArch64] Don't assert on f16 in DUP PerfectShuffle generator.
Ahmed Bougacha [Thu, 16 Apr 2015 23:57:07 +0000 (23:57 +0000)]
[AArch64] Don't assert on f16 in DUP PerfectShuffle generator.

Found by code inspection, but breaking i16 at least breaks other tests.
They aren't checking this in particular though, so also add some
explicit tests for the already working types.

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

9 years ago[opaque pointer type] Add textual IR support for explicit type parameter to the call...
David Blaikie [Thu, 16 Apr 2015 23:24:18 +0000 (23:24 +0000)]
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction

See r230786 and r230794 for similar changes to gep and load
respectively.

Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.

When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.

This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.

This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).

No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.

This leaves /only/ the varargs case where the explicit type is required.

Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.

About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.

import fileinput
import sys
import re

pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")

def conv(match, line):
  if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
    return line
  return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]

for line in sys.stdin:
  sys.stdout.write(conv(re.search(pat, line), line))

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

9 years agoFor llvm-objdump, dump the (__OBJC,__protocol) section for Objc1 32-bit Mach-O files
Kevin Enderby [Thu, 16 Apr 2015 22:33:20 +0000 (22:33 +0000)]
For llvm-objdump, dump the (__OBJC,__protocol) section for Objc1 32-bit Mach-O files
with the -section option as objc_protocol_t structs.

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

9 years agoDebugInfo: Fix UserValue::match() in LiveDebugVariables after r235050
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 22:27:54 +0000 (22:27 +0000)]
DebugInfo: Fix UserValue::match() in LiveDebugVariables after r235050

r235050 dropped the inlined-at field from `MDLocalVariable`, deferring
to the `!dbg` attachments.  Fix `UserValue` to take the `!dbg` into
account when differentiating between variables.

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

9 years agoAsmPrinter: Remove dead code, NFC
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 22:14:20 +0000 (22:14 +0000)]
AsmPrinter: Remove dead code, NFC

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

9 years agoAsmPrinter: Simplify logic for debug info intrinsics' !dbg attachments
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 22:12:59 +0000 (22:12 +0000)]
AsmPrinter: Simplify logic for debug info intrinsics' !dbg attachments

These are required, so just assume they're there.

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

9 years agoUpdating symbol wildcards one more time.
Chris Bieneman [Thu, 16 Apr 2015 21:58:22 +0000 (21:58 +0000)]
Updating symbol wildcards one more time.

This should catch all C++ symbols containing llvm in the name.

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

9 years agoDisable AArch64 fast-isel on big-endian call vector returns.
Pete Cooper [Thu, 16 Apr 2015 21:19:36 +0000 (21:19 +0000)]
Disable AArch64 fast-isel on big-endian call vector returns.

A big-endian vector return needs a byte-swap which we aren't doing right now.

For now just bail on these cases to get correctness back.

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

9 years ago[IR] Introduce a dereferenceable_or_null(N) attribute.
Sanjoy Das [Thu, 16 Apr 2015 20:29:50 +0000 (20:29 +0000)]
[IR] Introduce a dereferenceable_or_null(N) attribute.

Summary:
If a pointer is marked as dereferenceable_or_null(N), LLVM assumes it
is either `null` or `dereferenceable(N)` or both.  This change only
introduces the attribute and adds a token test case for the `llvm-as`
/ `llvm-dis`.  It does not hook up other parts of the optimizer to
actually exploit the attribute -- those changes will come later.

For pointers in address space 0, `dereferenceable(N)` is now exactly
equivalent to `dereferenceable_or_null(N)` && `nonnull`.  For other
address spaces, `dereferenceable(N)` is potentially weaker than
`dereferenceable_or_null(N)` && `nonnull` (since we could have a null
`dereferenceable(N)` pointer).

The motivating case for this change is Java (and other managed
languages), where pointers are either `null` or dereferenceable up to
some usually known-at-compile-time constant offset.

Reviewers: rafael, hfinkel

Reviewed By: hfinkel

Subscribers: nicholas, llvm-commits

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

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

9 years ago[NFC] [MachO] remove extra semicolons
Jingyue Wu [Thu, 16 Apr 2015 18:43:44 +0000 (18:43 +0000)]
[NFC] [MachO] remove extra semicolons

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

9 years ago[NaryReassociate] speeds up candidate searching
Jingyue Wu [Thu, 16 Apr 2015 18:42:31 +0000 (18:42 +0000)]
[NaryReassociate] speeds up candidate searching

Summary:
This fixes a left-over efficiency issue in D8950.

As Andrew and Daniel suggested, we can store the candidates in a stack
and pop the top element when it does not dominate the current
instruction. This reduces the worst-case time complexity to O(n).

Test Plan: a new test in nary-add.ll that exercises this optimization.

Reviewers: broune, dberlin, meheff, atrick

Reviewed By: atrick

Subscribers: llvm-commits, sanjoy

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

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

9 years agoProperly escaping the quotes so that bash doesn't do stupid things with the wildcards.
Chris Bieneman [Thu, 16 Apr 2015 18:36:32 +0000 (18:36 +0000)]
Properly escaping the quotes so that bash doesn't do stupid things with the wildcards.

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

9 years agoCleanup based on rnk's feedback.
Chris Bieneman [Thu, 16 Apr 2015 18:08:33 +0000 (18:08 +0000)]
Cleanup based on rnk's feedback.

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

9 years ago[X86, SSE] instcombine common cases of insertps intrinsics into shuffles
Sanjay Patel [Thu, 16 Apr 2015 17:52:13 +0000 (17:52 +0000)]
[X86, SSE] instcombine common cases of insertps intrinsics into shuffles

This is very similar to D8486 / r232852 (vperm2). If we treat insertps intrinsics
as shufflevectors, we can optimize them better.

I've left all but the full zero case of the zero mask variants out of this patch.
I don't think those can be converted into a single shuffle in all cases, but I'd
be happy to be proven wrong as I was for vperm2f128.

Either way, we'd need to support whatever sequence we come up with for those cases
in the backend before converting them here.

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

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

9 years agoFixing windows bots.
Chris Bieneman [Thu, 16 Apr 2015 17:40:51 +0000 (17:40 +0000)]
Fixing windows bots.

Third time's the try.

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

9 years agoBetter fix to the windows conditional.
Chris Bieneman [Thu, 16 Apr 2015 17:26:50 +0000 (17:26 +0000)]
Better fix to the windows conditional.

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

9 years agoFix Windows bots.
Chris Bieneman [Thu, 16 Apr 2015 17:25:17 +0000 (17:25 +0000)]
Fix Windows bots.

Turns out Windows is special. All library installs are RUNTIME.

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

9 years agoFor llvm-objdump added support for printing Objc1 32-bit runtime meta data
Kevin Enderby [Thu, 16 Apr 2015 17:19:59 +0000 (17:19 +0000)]
For llvm-objdump added support for printing Objc1 32-bit runtime meta data
with the existing -objc-meta-data and -macho options for Mach-O files.

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

9 years ago[WinEH] Handle a landingpad, resume, and cleanup all rolled into a BB
Reid Kleckner [Thu, 16 Apr 2015 17:02:23 +0000 (17:02 +0000)]
[WinEH] Handle a landingpad, resume, and cleanup all rolled into a BB

This happens a lot with simple cleanups after SimplifyCFG.

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

9 years agoEditorial changes in the programmers manual.
Charlie Turner [Thu, 16 Apr 2015 17:01:23 +0000 (17:01 +0000)]
Editorial changes in the programmers manual.

VMCore was renamed to IR back in 2013. The relevant "core"
implementations were moved into the lib/IR directory at the same time.

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

9 years agoDebugInfo: Allow DebugLocs to be constructed from const
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 16:56:29 +0000 (16:56 +0000)]
DebugInfo: Allow DebugLocs to be constructed from const

Allow `const`-qualified pointers to be used to construct `DebugLoc`s, as
a convenience.

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

9 years agoFixing llvm-shlib's LLVM_DYLIB_EXPORT_ALL to work with Darwin fat binaries.
Chris Bieneman [Thu, 16 Apr 2015 16:56:22 +0000 (16:56 +0000)]
Fixing llvm-shlib's LLVM_DYLIB_EXPORT_ALL to work with Darwin fat binaries.

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

9 years agoFixing a mis-use of the CMake install command.
Chris Bieneman [Thu, 16 Apr 2015 16:56:18 +0000 (16:56 +0000)]
Fixing a mis-use of the CMake install command.

The CMake install command is defined as:

install(TARGETS targets... [EXPORT <export-name>]
        [[ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE|
          PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE]
         [DESTINATION <dir>]
         [INCLUDES DESTINATION [<dir> ...]]
         [PERMISSIONS permissions...]
         [CONFIGURATIONS [Debug|Release|...]]
         [COMPONENT <component>]
         [OPTIONAL] [NAMELINK_ONLY|NAMELINK_SKIP]
        ] [...])

This means it can only take one parameter from the set of RUNTIME, LIBRARY, or ARCHIVE. If you set more than one of these it seems to gobble up the extra arguments and ignore the COMPONENT argument.

This adds a check to only set LIBRARY or ARCHIVE based on whether or not the library being built is shared.

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

9 years agoDebugInfo: Remove DIDescriptor from the DIBuilder API
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 16:36:23 +0000 (16:36 +0000)]
DebugInfo: Remove DIDescriptor from the DIBuilder API

As a step toward killing `DIDescriptor` and its subclasses, remove it
from the `DIBuilder` API.  Replace the subclasses with appropriate
pointers from the new debug info hierarchy.  There are a couple of
possible surprises in type choices for out-of-tree frontends:

  - Subroutine types: `MDSubroutineType`, not `MDCompositeTypeBase`.
  - Composite types: `MDCompositeType`, not `MDCompositeTypeBase`.
  - Scopes: `MDScope`, not `MDNode`.
  - Generic debug info nodes: `DebugNode`, not `MDNode`.

This is part of PR23080.

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

9 years agoRevert the switch lowering change (r235101, r235103, r235106)
Hans Wennborg [Thu, 16 Apr 2015 15:43:26 +0000 (15:43 +0000)]
Revert the switch lowering change (r235101, r235103, r235106)

Looks like it broke the sanitizer-ppc64-linux1 build. Reverting for now.

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

9 years ago[AArch64] Add v8.1a "Virtualization Host Extensions"
Vladimir Sukharev [Thu, 16 Apr 2015 15:38:58 +0000 (15:38 +0000)]
[AArch64] Add v8.1a "Virtualization Host Extensions"

Reviewers: t.p.northover

Subscribers: llvm-commits

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

Patch by: Tom Coxon

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

9 years agoAdd a triple to test/DebugInfo/unconditional-branch.ll (PR23252)
Hans Wennborg [Thu, 16 Apr 2015 15:35:44 +0000 (15:35 +0000)]
Add a triple to test/DebugInfo/unconditional-branch.ll (PR23252)

This started failing on Windows after my switch lowering change in r235101.

I suspect the error is unrelated, so adding a triple to pacify it
until it can be fixed. See the PR for details.

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

9 years ago[AArch64] Add v8.1a "Limited Ordering Regions" extension
Vladimir Sukharev [Thu, 16 Apr 2015 15:30:43 +0000 (15:30 +0000)]
[AArch64] Add v8.1a "Limited Ordering Regions" extension

Reviewers:  t.p.northover

Subscribers: llvm-commits

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

Patch by: Tom Coxon

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

9 years ago[AArch64] Add v8.1a "Privileged Access Never" extension
Vladimir Sukharev [Thu, 16 Apr 2015 15:20:51 +0000 (15:20 +0000)]
[AArch64] Add v8.1a "Privileged Access Never" extension

Reviewers: jmolloy

Subscribers: llvm-commits

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

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

9 years agoAdd a triple to switch.ll test.
Hans Wennborg [Thu, 16 Apr 2015 15:09:33 +0000 (15:09 +0000)]
Add a triple to switch.ll test.

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

9 years ago[AArch64] Handle Cyclone-specific register in common way
Vladimir Sukharev [Thu, 16 Apr 2015 15:01:20 +0000 (15:01 +0000)]
[AArch64] Handle Cyclone-specific register in common way

Reviewers: jmolloy

Subscribers: llvm-commits

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

Patch by: Tom Coxon

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

9 years agoSwitch lowering: extract jump tables and bit tests before building binary tree (PR22262)
Hans Wennborg [Thu, 16 Apr 2015 14:49:23 +0000 (14:49 +0000)]
Switch lowering: extract jump tables and bit tests before building binary tree (PR22262)

This is a major rewrite of the SelectionDAG switch lowering. The previous code
would lower switches as a binary tre, discovering clusters of cases
suitable for lowering by jump tables or bit tests as it went along. To increase
the likelihood of finding jump tables, the binary tree pivot was selected to
maximize case density on both sides of the pivot.

By not selecting the pivot in the middle, the binary trees would not always
be balanced, leading to performance problems in the generated code.

This patch rewrites the lowering to search for clusters of cases
suitable for jump tables or bit tests first, and then builds the binary
tree around those clusters. This way, the binary tree will always be balanced.

This has the added benefit of decoupling the different aspects of the lowering:
tree building and jump table or bit tests finding are now easier to tweak
separately.

For example, this will enable us to balance the tree based on profile info
in the future.

The algorithm for finding jump tables is O(n^2), whereas the previous algorithm
was O(n log n) for common cases, and quadratic only in the worst-case. This
doesn't seem to be major problem in practice, e.g. compiling a file consisting
of a 10k-case switch was only 30% slower, and such large switches should be rare
in practice. Compiling e.g. gcc.c showed no compile-time difference.  If this
does turn out to be a problem, we could limit the search space of the algorithm.

This commit also disables all optimizations during switch lowering in -O0.

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

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

9 years ago[AArch64] Follow-up to: Refactor AArch64NamedImmMapper to become dependent on subtarg...
Vladimir Sukharev [Thu, 16 Apr 2015 14:36:13 +0000 (14:36 +0000)]
[AArch64] Follow-up to: Refactor AArch64NamedImmMapper to become dependent on subtarget features

Fixed compilation with clang on some buildbots with "-Werror -Wmissing-field-initializers"

Related to: http://reviews.llvm.org/rL235089

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

9 years ago[mips] [IAS] Preserve microMIPS label marking for objects when assigning.
Toma Tabacu [Thu, 16 Apr 2015 13:37:32 +0000 (13:37 +0000)]
[mips] [IAS] Preserve microMIPS label marking for objects when assigning.

Summary: Previously, this was only happening for functions, but because of .insn, objects can also be marked now.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

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

9 years agoSilencing a -Wunused-but-set-variable warning; NFC.
Aaron Ballman [Thu, 16 Apr 2015 13:29:36 +0000 (13:29 +0000)]
Silencing a -Wunused-but-set-variable warning; NFC.

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

9 years agoDon't depend on the order relocations are written to a .o file.
Rafael Espindola [Thu, 16 Apr 2015 12:59:30 +0000 (12:59 +0000)]
Don't depend on the order relocations are written to a .o file.

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

9 years ago[Mips] Use unique_ptr to manage ownership.
Benjamin Kramer [Thu, 16 Apr 2015 12:43:33 +0000 (12:43 +0000)]
[Mips] Use unique_ptr to manage ownership.

Required some tweaking of ValueMap to accommodate a move-only value
type. No functional change intended.

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

9 years agoMake it obvious that we're iterating over a range of pointers.
Benjamin Kramer [Thu, 16 Apr 2015 12:43:07 +0000 (12:43 +0000)]
Make it obvious that we're iterating over a range of pointers.

Found by -Wrange-loop-analysis.

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

9 years ago[AArch64] Refactor AArch64NamedImmMapper to become dependent on subtarget features.
Vladimir Sukharev [Thu, 16 Apr 2015 12:15:27 +0000 (12:15 +0000)]
[AArch64] Refactor AArch64NamedImmMapper to become dependent on subtarget features.

In order to introduce v8.1a-specific entities, Mappers should be aware of SubtargetFeatures available.

This patch introduces refactoring, that will then allow to easily introduce:

- v8.1-specific "pan" PState for PStateMapper (PAN extension)

- v8.1-specific sysregs for SysRegMapper (LOR,VHE extensions)

Reviewers: jmolloy

Subscribers: llvm-commits

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

Patch by Tom Coxon

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

9 years ago[AArch64] Fix invalid use of references to BuildMI.
James Molloy [Thu, 16 Apr 2015 11:37:40 +0000 (11:37 +0000)]
[AArch64] Fix invalid use of references to BuildMI.

This was found in GCC PR65773 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65773).

We shouldn't be taking a reference to the temporary that BuildMI returns, we must copy it.

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