platform/upstream/llvm.git
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!

llvm-svn: 235242

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

llvm-svn: 235241

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`.

llvm-svn: 235240

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

llvm-svn: 235239

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

llvm-svn: 235238

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.

llvm-svn: 235237

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?).

llvm-svn: 235236

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

llvm-svn: 235235

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

llvm-svn: 235234

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

llvm-svn: 235233

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

llvm-svn: 235232

9 years agoChange AArch64 i128 returns to use [2 x i64] when possible.
Pete Cooper [Fri, 17 Apr 2015 22:16:24 +0000 (22:16 +0000)]
Change AArch64 i128 returns to use [2 x i64] when possible.

Something like { void*, void * } would be passed to a function as a [2 x i64], but returned as an i128.  This patch unifies the 2 behaviours so that we also return it as a [2 x i64].

This is better for the quality of the IR, and the size of the final LLVM binary as we tend to want to insert/extract values from these types and do so with the insert/extract instructions is less IR than shifting, truncating, and or'ing values.

Reviewed by Tim Northover.

llvm-svn: 235231

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.

llvm-svn: 235230

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?

llvm-svn: 235229

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.

llvm-svn: 235228

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.

llvm-svn: 235227

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.

llvm-svn: 235226

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

llvm-svn: 235225

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, ..)

llvm-svn: 235224

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.

llvm-svn: 235223

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.

llvm-svn: 235222

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.

llvm-svn: 235221

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

llvm-svn: 235220

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.

llvm-svn: 235219

9 years agoWhitespace-only tweaks to Colin's r235109 patch to match the lldb
Jason Molenda [Fri, 17 Apr 2015 19:15:02 +0000 (19:15 +0000)]
Whitespace-only tweaks to Colin's r235109 patch to match the lldb
coding style a little more closely.

llvm-svn: 235218

9 years agoDelete dead code (again).
Rui Ueyama [Fri, 17 Apr 2015 18:58:34 +0000 (18:58 +0000)]
Delete dead code (again).

llvm-svn: 235217

9 years agoDelete dead code.
Rui Ueyama [Fri, 17 Apr 2015 18:54:29 +0000 (18:54 +0000)]
Delete dead code.

llvm-svn: 235216

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

llvm-svn: 235215

9 years agoTestMiBreak - func isn't always ??.
Chaoren Lin [Fri, 17 Apr 2015 17:33:43 +0000 (17:33 +0000)]
TestMiBreak - func isn't always ??.

Summary: Caused a failure because it showed up as `__printf`.

Reviewers: ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 235214

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

llvm-svn: 235213

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.

llvm-svn: 235212

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

llvm-svn: 235211

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

llvm-svn: 235210

9 years agoAdd a missing forward def of CheckerManager. NFC.
Pete Cooper [Fri, 17 Apr 2015 17:00:16 +0000 (17:00 +0000)]
Add a missing forward def of CheckerManager.  NFC.

This file doesn't include CheckerManager or forward declare it, so is sensitive to include order.

llvm-svn: 235209

9 years agoFix the MiVarTestCase.test_lldbmi_var_create_register test to expect 32bit value...
Ilia K [Fri, 17 Apr 2015 16:55:36 +0000 (16:55 +0000)]
Fix the MiVarTestCase.test_lldbmi_var_create_register test to expect 32bit value on 32bit systems

llvm-svn: 235204

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.

llvm-svn: 235203

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).

llvm-svn: 235202

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.

llvm-svn: 235201

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

llvm-svn: 235200

9 years agotest commit.
Aidan Dodds [Fri, 17 Apr 2015 16:12:58 +0000 (16:12 +0000)]
test commit.

llvm-svn: 235199

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

llvm-svn: 235198

9 years agoFix the MiVarTestCase.test_lldbmi_var_create_register test on 32bit systems
Ilia K [Fri, 17 Apr 2015 15:45:32 +0000 (15:45 +0000)]
Fix the MiVarTestCase.test_lldbmi_var_create_register test on 32bit systems

llvm-svn: 235197

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

llvm-svn: 235196

9 years agoMI support for '-var-create $regname' command.
Ilia K [Fri, 17 Apr 2015 14:49:54 +0000 (14:49 +0000)]
MI support for '-var-create $regname' command.

Summary:
This command is currently processed using expression evaluation, meaning the variable binds to the result of the expression not the register.
Therefore any subsequent calls to '-var-assign' will not update the register. Fixed by detecting '$' prefix for registers according to specification.

Thanks, Ewan

Patch from ewan@codeplay.com

Reviewers: EwanCrawford

Subscribers: lldb-commits, deepak2427

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

llvm-svn: 235195

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

llvm-svn: 235194

9 years agoUse non-blocking waitpid in NativeProcessLinux
Pavel Labath [Fri, 17 Apr 2015 14:07:49 +0000 (14:07 +0000)]
Use non-blocking waitpid in NativeProcessLinux

Summary:
This is the first phase of the merging of Monitor and Operation threads in NativeProcessLinux
(which is necessary since the two threads race inside Linux kernel). Here, I reimplement the
Monitor thread do use non-blocking waitpid calls, which enables later addition of code from the
operation thread.

Test Plan: Ran the test suite a couple of times, no regressions detected.

Reviewers: vharron, ovyalov, tberghammer

Subscribers: lldb-commits

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

llvm-svn: 235193

9 years ago[clang-tidy] Remove static StringSet in favor of binary search.
Benjamin Kramer [Fri, 17 Apr 2015 13:52:08 +0000 (13:52 +0000)]
[clang-tidy] Remove static StringSet in favor of binary search.

The number of strings is so small that performance doesn't matter and adding
the thread safe static initialization and destruction overhead is just not
worth it. No functional change intended.

llvm-svn: 235192

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!

llvm-svn: 235191

9 years agoRemove the assertion as it was useless and broken.
Sylvestre Ledru [Fri, 17 Apr 2015 13:21:39 +0000 (13:21 +0000)]
Remove the assertion as it was useless and broken.

Enforcing the assert caused the following tests to fail:
Clang :: Analysis__bstring.c
Clang :: Analysis__comparison-implicit-casts.cpp
Clang :: Analysis__malloc-interprocedural.c
Clang :: Analysis__malloc.c
Clang :: Analysis__redefined_system.c
Clang :: Analysis__string.c
Clang :: Analysis__weak-functions.c

llvm-svn: 235190

9 years agoUse lazy regex in lldb-mi tests
Ilia K [Fri, 17 Apr 2015 13:21:34 +0000 (13:21 +0000)]
Use lazy regex in lldb-mi tests

This patch also fixes the timing issue in MiBreakTestCase.test_lldbmi_break_insert_function test.

llvm-svn: 235189

9 years agoFix a bad assert. Found by coverity. CID 1101110
Sylvestre Ledru [Fri, 17 Apr 2015 13:08:54 +0000 (13:08 +0000)]
Fix a bad assert. Found by coverity. CID 1101110

llvm-svn: 235188

9 years agoUse C++11 non-static member initialization.
Rui Ueyama [Fri, 17 Apr 2015 12:53:16 +0000 (12:53 +0000)]
Use C++11 non-static member initialization.

llvm-svn: 235187

9 years ago[MSVC] Mimic MSVC whitespace collapse for incompatible token pasting
Will Wilson [Fri, 17 Apr 2015 12:43:57 +0000 (12:43 +0000)]
[MSVC] Mimic MSVC whitespace collapse for incompatible token pasting

In public MS headers for XAudio, clang would fail to generate a valid UUID due to the UUID components being combined with the '-' UUID separators. Clang would attempting to recover but would preserve the leading whitespace from the tokens after each failed paste leading to spaces creeping into the UUID and causing an error in the __declspace(uuid()) parsing.

Reference: Microsoft DirectX SDK (June 2010)\Include\XAudio2.h(51)

Resolves http://llvm.org/pr23071

llvm-svn: 235186

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.

llvm-svn: 235185

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.

llvm-svn: 235184

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

llvm-svn: 235183

9 years ago[ARM] Implement R_ARM_TLS_IE32 for dynamic executable
Denis Protivensky [Fri, 17 Apr 2015 11:30:29 +0000 (11:30 +0000)]
[ARM] Implement R_ARM_TLS_IE32 for dynamic executable

llvm-svn: 235182

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.

llvm-svn: 235181

9 years ago[ARM] Test R_ARM_TLS_LE32 for dynamic executable
Denis Protivensky [Fri, 17 Apr 2015 11:24:11 +0000 (11:24 +0000)]
[ARM] Test R_ARM_TLS_LE32 for dynamic executable

llvm-svn: 235180

9 years agoFix cmake build on osx after r235109
Colin Riley [Fri, 17 Apr 2015 11:20:30 +0000 (11:20 +0000)]
Fix cmake build on osx after r235109

llvm-svn: 235179

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.

llvm-svn: 235178

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.

llvm-svn: 235177

9 years agotest commit
Sagar Thakur [Fri, 17 Apr 2015 10:14:16 +0000 (10:14 +0000)]
test commit

llvm-svn: 235176

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.

llvm-svn: 235175

9 years agoFollow-up to r235046: selectany only causes a definition if it's not inherited.
Nico Weber [Fri, 17 Apr 2015 09:50:28 +0000 (09:50 +0000)]
Follow-up to r235046: selectany only causes a definition if it's not inherited.

(For example needed to parse system header inputscope.h, which first has
an extern "C" selectany IID and then later an extern "C" declaration of that
same IID.)

llvm-svn: 235174

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

llvm-svn: 235173

9 years agoMake several test case arm32 compatible
Tamas Berghammer [Fri, 17 Apr 2015 09:37:06 +0000 (09:37 +0000)]
Make several test case arm32 compatible

llvm-svn: 235172

9 years agoFix mapping symbol handling on arm 32/64
Tamas Berghammer [Fri, 17 Apr 2015 09:36:59 +0000 (09:36 +0000)]
Fix mapping symbol handling on arm 32/64

The debug info section contains some $d mapping symbol what is
overlapping with code sections in other sections of the object file
causing problem in the address class detection. This CL ignores these
symboles from the address class map as the debug info sections don't use
this map.

Differential revision: http://reviews.llvm.org/D9050

llvm-svn: 235171

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)

llvm-svn: 235170

9 years agoXFAILing TestPrintStackTraces on linux to stabilize the build bot
Pavel Labath [Fri, 17 Apr 2015 09:05:26 +0000 (09:05 +0000)]
XFAILing TestPrintStackTraces on linux to stabilize the build bot

llvm-svn: 235169

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.

llvm-svn: 235168

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.

llvm-svn: 235167

9 years agoMove fixit for const init from note to diag, weaken to warning in MS mode.
Nico Weber [Fri, 17 Apr 2015 08:32:38 +0000 (08:32 +0000)]
Move fixit for const init from note to diag, weaken to warning in MS mode.

r235046 turned "extern __declspec(selectany) int a;" from a declaration into
a definition to fix PR23242 (required for compatibility with mc.exe output).
However, this broke parsing Windows headers: A  d3d11 headers contain something
like

  struct SomeStruct {};
  extern const __declspec(selectany) SomeStruct some_struct;

This is now a definition, and const objects either need an explicit default
ctor or an initializer so this errors out with

  d3d11.h(1065,48) :
    error: default initialization of an object of const type
           'const CD3D11_DEFAULT' without a user-provided default constructor

(cl.exe just doesn't implement this rule, independent of selectany.)

To work around this, weaken this error into a warning for selectany decls
in microsoft mode, and recover with zero-initialization.

Doing this is a bit hairy since it adds a fixit on an error emitted
by InitializationSequence – this means it needs to build a correct AST, which
in turn means InitializationSequence::Failed() cannot return true when this
fixit is applied. As a workaround, the patch adds a fixit member to
InitializationSequence, and InitializationSequence::Perform() prints the
diagnostic if the fixit member is set right after its call to Diagnose.
That function is usually called when InitializationSequences are used –
InitListChecker::PerformEmptyInit() doesn't call it, but the InitListChecker
case never performs default-initialization, so this is technically OK.

This is the alternative, original fix for PR20208 that got reviewed in the
thread "[patch] Improve diagnostic on default-initializing const variables
(PR20208)".  This change basically reverts r213725, adds the original fix for
PR20208, and makes the error a warning in Microsoft mode.

llvm-svn: 235166

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

llvm-svn: 235165

9 years agoUses the target platform to determine the platform context.
Robert Flack [Fri, 17 Apr 2015 08:02:18 +0000 (08:02 +0000)]
Uses the target platform to determine the platform context.

Uses the target platform to determine the platform context to use. This fixes an
early failure in some tests when running on a different remote target.

Test Plan:
./dotest.py $DOTEST_OPTS -t -p TestGlobalVariables.py|TestSharedLib.py
Running on macosx -> linux, this fails at a later stage in the test - rather
than in registerSharedLibrariesWithTarget looking for a library without the
correct "lib" prefix and ".so" suffix.

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

llvm-svn: 235164

9 years agoRevert file unintentionally changed in r235162.
Daniel Jasper [Fri, 17 Apr 2015 08:01:41 +0000 (08:01 +0000)]
Revert file unintentionally changed in r235162.

llvm-svn: 235163

9 years agoclang-format: Add default fallback style.
Daniel Jasper [Fri, 17 Apr 2015 07:59:19 +0000 (07:59 +0000)]
clang-format: Add default fallback style.

Thanks to Michael Schlottke.

llvm-svn: 235162

9 years ago[MS ABI] Use the right types for filter and finally blocks
David Majnemer [Fri, 17 Apr 2015 06:57:25 +0000 (06:57 +0000)]
[MS ABI] Use the right types for filter and finally blocks

The type for abnormal_termination can't be an i1, it an i8.
Filter functions return 'LONG', not 'int'.

llvm-svn: 235161

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.

llvm-svn: 235160

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

llvm-svn: 235159

9 years agoAdd a "force_kill" arg to Process::Destroy(). This is needed after
Jason Molenda [Fri, 17 Apr 2015 05:01:58 +0000 (05:01 +0000)]
Add a "force_kill" arg to Process::Destroy().  This is needed after
the changes in r233255/r233258.  Normally if lldb attaches to
a running process, when we call Process::Destroy, we want to detach
from the process.  If lldb launched the process itself, ::Destroy
should kill it.

However, if we attach to a process and the driver calls SBProcess::Kill()
(which calls Destroy), we need to kill it even if we didn't launch it
originally.

The force_kill param allows for the SBProcess::Kill method to force the
behavior of Destroy.

<rdar://problem/20424439>

llvm-svn: 235158

9 years agoFix a bug where argdumper would not launch inferiors correctly in the presence of...
Enrico Granata [Fri, 17 Apr 2015 01:50:11 +0000 (01:50 +0000)]
Fix a bug where argdumper would not launch inferiors correctly in the presence of arguments of the form word1\ word2 (vs. the quoted form "word1 word2")

Fixes rdar://20493444

llvm-svn: 235157

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.

llvm-svn: 235156

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

llvm-svn: 235155

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.

llvm-svn: 235154

9 years agoFix "help language", the languages printer was assuming the
Jim Ingham [Fri, 17 Apr 2015 00:44:36 +0000 (00:44 +0000)]
Fix "help language", the languages printer was assuming the
eLanguageType numbers would be sequential, but vendor types
are not and the printer went crazy.

llvm-svn: 235153

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.

llvm-svn: 235152

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

llvm-svn: 235151

9 years agoImprove const-ness
David Blaikie [Fri, 17 Apr 2015 00:19:34 +0000 (00:19 +0000)]
Improve const-ness

This allows callers to pass a char ** (such as the one coming from the
standard decreed main declaration - even though everyone usually puts
const on that themselves).

llvm-svn: 235150

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.

llvm-svn: 235149

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.

llvm-svn: 235148

9 years ago[opaque pointer types] Explicit non-pointer type for call expressions
David Blaikie [Thu, 16 Apr 2015 23:25:00 +0000 (23:25 +0000)]
[opaque pointer types] Explicit non-pointer type for call expressions

(migration for recent LLVM change to textual IR for calls)

llvm-svn: 235147

9 years ago[opaque pointer types] Explicit non-pointer type for call expressions
David Blaikie [Thu, 16 Apr 2015 23:24:52 +0000 (23:24 +0000)]
[opaque pointer types] Explicit non-pointer type for call expressions

(migration for recent LLVM change to textual IR for calls)

llvm-svn: 235146

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))

llvm-svn: 235145

9 years agoDefine LIBXML2_DEFINED in the Xcode project for Xcode builds so Darwin builds can...
Greg Clayton [Thu, 16 Apr 2015 23:13:26 +0000 (23:13 +0000)]
Define LIBXML2_DEFINED in the Xcode project for Xcode builds so Darwin builds can take advantage of the new GDB register info from the target XML.

Also add "#if defined( LIBXML2_DEFINED )" around code that already used libxml2 in SymbolVendorMacOSX.cpp.

Cleaned up some warnings in ProcessGDBRemote.cpp.

llvm-svn: 235144

9 years agoFix warnings about construction ordering.
Greg Clayton [Thu, 16 Apr 2015 23:11:06 +0000 (23:11 +0000)]
Fix warnings about construction ordering.

llvm-svn: 235143

9 years agoUse a singleton accessor for the static list of alternate mangling prefixes so we...
Greg Clayton [Thu, 16 Apr 2015 23:10:22 +0000 (23:10 +0000)]
Use a singleton accessor for the static list of alternate mangling prefixes so we don't have a global constructor. Apple build systems like for shared libraries to have no global constructors.

llvm-svn: 235142

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.

llvm-svn: 235141

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.

llvm-svn: 235140

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

llvm-svn: 235139