platform/upstream/llvm.git
9 years agoCOFF: Use short identifiers. NFC.
Rui Ueyama [Sat, 25 Jul 2015 21:54:50 +0000 (21:54 +0000)]
COFF: Use short identifiers. NFC.

llvm-svn: 243229

9 years agoCOFF: Fix image base address for 32-bit.
Rui Ueyama [Sat, 25 Jul 2015 21:42:33 +0000 (21:42 +0000)]
COFF: Fix image base address for 32-bit.

0x140000000 or 0x180000000 are not correct image base addresses
for 32-bit. They are actually much smaller.

llvm-svn: 243228

9 years ago[libclang] Use lambdas instead of explicit structs when storing arguments.
Benjamin Kramer [Sat, 25 Jul 2015 20:55:44 +0000 (20:55 +0000)]
[libclang] Use lambdas instead of explicit structs when storing arguments.

This boilerplate code was necessary to move arguments between threads in
C++98, lambdas make this much easier. No functionality change intended.

llvm-svn: 243227

9 years ago[InstCombine][SSE4A] Standardized references to Length/Width and Index/Start to match...
Simon Pilgrim [Sat, 25 Jul 2015 20:41:00 +0000 (20:41 +0000)]
[InstCombine][SSE4A] Standardized references to Length/Width and Index/Start to match AMD docs. NFCI.

llvm-svn: 243226

9 years ago[AST] Rename RecordLayoutBuilder to ItaniumRecordLayoutBuilder
David Majnemer [Sat, 25 Jul 2015 20:18:14 +0000 (20:18 +0000)]
[AST] Rename RecordLayoutBuilder to ItaniumRecordLayoutBuilder

RecordLayoutBuilder is an inaccruate name because it does not build all
records.  It only builds layouts for targets using the Itanium C++ ABI.

llvm-svn: 243225

9 years agoEnable clang tests requiring "clang-driver" on mingw.
Yaron Keren [Sat, 25 Jul 2015 20:05:21 +0000 (20:05 +0000)]
Enable clang tests requiring "clang-driver" on mingw.
At least on my mingw system they do pass, let's see what the bots think.

llvm-svn: 243224

9 years ago[InstCombine] Split off SSE4a tests.
Simon Pilgrim [Sat, 25 Jul 2015 17:14:01 +0000 (17:14 +0000)]
[InstCombine] Split off SSE4a tests.

These aren't vector demanded bits tests. More tests to follow.

llvm-svn: 243223

9 years ago[VTableBuilder] Use range-based for loops. No functional change intended
Benjamin Kramer [Sat, 25 Jul 2015 17:10:49 +0000 (17:10 +0000)]
[VTableBuilder] Use range-based for loops. No functional change intended

llvm-svn: 243222

9 years ago[VTableBuilder] Turn functors into lambdas
Benjamin Kramer [Sat, 25 Jul 2015 16:31:30 +0000 (16:31 +0000)]
[VTableBuilder] Turn functors into lambdas

No functional change intended.

llvm-svn: 243221

9 years agoAdd missing namespace specifiers.
Benjamin Kramer [Sat, 25 Jul 2015 15:44:23 +0000 (15:44 +0000)]
Add missing namespace specifiers.

llvm-svn: 243220

9 years agoUpgrade for Clang API change.
Benjamin Kramer [Sat, 25 Jul 2015 15:33:17 +0000 (15:33 +0000)]
Upgrade for Clang API change.

llvm-svn: 243219

9 years agoCapture 'this' so GCC 4.7 can find a static members.
Benjamin Kramer [Sat, 25 Jul 2015 15:27:04 +0000 (15:27 +0000)]
Capture 'this' so GCC 4.7 can find a static members.

llvm-svn: 243218

9 years ago[AST] Turn the callbacks of lookupInBases and forallBases into a function_ref
Benjamin Kramer [Sat, 25 Jul 2015 15:07:25 +0000 (15:07 +0000)]
[AST] Turn the callbacks of lookupInBases and forallBases into a function_ref

This lets us pass functors (and lambdas) without void * tricks. On the
downside we can't pass CXXRecordDecl's Find* members (which are now type
safe) to lookupInBases directly, but a lambda trampoline is a small
price to pay. No functionality change intended.

llvm-svn: 243217

9 years ago[X86][SSE] Added additional vector sign/zero load extension tests.
Simon Pilgrim [Sat, 25 Jul 2015 14:07:20 +0000 (14:07 +0000)]
[X86][SSE] Added additional vector sign/zero load extension tests.

llvm-svn: 243216

9 years agoFix formatting of recent alias-analysis commit
Tobias Grosser [Sat, 25 Jul 2015 12:31:03 +0000 (12:31 +0000)]
Fix formatting of recent alias-analysis commit

llvm-svn: 243215

9 years agoPrevectorize the schedule of the band (or the point loop in case of tiling)
Tobias Grosser [Sat, 25 Jul 2015 12:28:56 +0000 (12:28 +0000)]
Prevectorize the schedule of the band (or the point loop in case of tiling)

Contributed-by: Roman Gareev <gareevroman@gmail.com>
llvm-svn: 243214

9 years ago[Modules] Wrap the main ModuleManager visitor in a function_ref.
Benjamin Kramer [Sat, 25 Jul 2015 12:14:04 +0000 (12:14 +0000)]
[Modules] Wrap the main ModuleManager visitor in a function_ref.

Avoids the awkward passing of an opaque void *UserData argument. No
functional change intended.

llvm-svn: 243213

9 years ago[X86][SSE] Added additional vector sign/zero extension tests.
Simon Pilgrim [Sat, 25 Jul 2015 11:17:35 +0000 (11:17 +0000)]
[X86][SSE] Added additional vector sign/zero extension tests.

llvm-svn: 243212

9 years ago[Mips] Define _DYNAMIC_LINKING symbol if output is a is dynamically linked executable...
Simon Atanasyan [Sat, 25 Jul 2015 10:18:52 +0000 (10:18 +0000)]
[Mips] Define _DYNAMIC_LINKING symbol if output is a is dynamically linked executable file

llvm-svn: 243211

9 years ago[Mips] Remove redundant separate functions to calculate relocations. Do
Simon Atanasyan [Sat, 25 Jul 2015 10:18:44 +0000 (10:18 +0000)]
[Mips] Remove redundant separate functions to calculate relocations. Do
that inline.

No functional changes.

llvm-svn: 243210

9 years ago[Mips] Remove duplicated code by joining the same functions
Simon Atanasyan [Sat, 25 Jul 2015 10:18:39 +0000 (10:18 +0000)]
[Mips] Remove duplicated code by joining the same functions

llvm-svn: 243209

9 years ago[Mips] Do not sign-extend addends read from RELA relocation records
Simon Atanasyan [Sat, 25 Jul 2015 10:18:33 +0000 (10:18 +0000)]
[Mips] Do not sign-extend addends read from RELA relocation records

llvm-svn: 243208

9 years ago[clang-cl] Add fallback support for /Zl
David Majnemer [Sat, 25 Jul 2015 06:07:59 +0000 (06:07 +0000)]
[clang-cl] Add fallback support for /Zl

llvm-svn: 243207

9 years ago[CodeGen] Don't UBSan-ize the argument to __builtin_frame_address
David Majnemer [Sat, 25 Jul 2015 05:57:24 +0000 (05:57 +0000)]
[CodeGen] Don't UBSan-ize the argument to __builtin_frame_address

__builtin_frame_address requires its argument to be a constant
expression which already implies that it cannot have undefined behavior.
However, we used EmitScalarExpr to emit the argument causing UBSan to
try to check for overflow.

Instead, use the constant expression emission system.

This fixes PR24256.

llvm-svn: 243206

9 years agoCOFF: ARM: Support import functions.
Rui Ueyama [Sat, 25 Jul 2015 03:39:29 +0000 (03:39 +0000)]
COFF: ARM: Support import functions.

llvm-svn: 243205

9 years agoCOFF: ARM: Implement BLX23T relocation.
Rui Ueyama [Sat, 25 Jul 2015 03:25:28 +0000 (03:25 +0000)]
COFF: ARM: Implement BLX23T relocation.

llvm-svn: 243204

9 years ago[LoopUnswitch] Improve loop unswitch pass to find trivial unswitch conditions more...
Chen Li [Sat, 25 Jul 2015 03:21:06 +0000 (03:21 +0000)]
[LoopUnswitch] Improve loop unswitch pass to find trivial unswitch conditions more effectively

Summary:
This patch improves trivial loop unswitch.

The current trivial loop unswitch only checks if loop header's terminator contains a trivial unswitch condition. But if the loop header only has one reachable successor (due to intentionally or unintentionally missed code simplification), we should consider the successor as part of the loop header. Therefore, instead of stopping at loop header's terminator, we should keep traversing its successors within loop until reach a *real* conditional branch or switch (whose condition can not be constant folded). This change will enable a single -loop-unswitch pass to unswitch multiple trivial conditions (unswitch one trivial condition could open opportunity to unswitch another one in the same loop), while the old implementation can unswitch only one per pass.

Reviewers: reames, broune

Subscribers: llvm-commits

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

llvm-svn: 243203

9 years agoCOFF: ARM: Implement BRANCH24T relocation.
Rui Ueyama [Sat, 25 Jul 2015 03:19:34 +0000 (03:19 +0000)]
COFF: ARM: Implement BRANCH24T relocation.

llvm-svn: 243202

9 years agoCOFF: ARM: Implement MOV32T relocation.
Rui Ueyama [Sat, 25 Jul 2015 03:03:46 +0000 (03:03 +0000)]
COFF: ARM: Implement MOV32T relocation.

llvm-svn: 243201

9 years agoAdd some initial logging for when lldb is searching for binaries,
Jason Molenda [Sat, 25 Jul 2015 02:39:42 +0000 (02:39 +0000)]
Add some initial logging for when lldb is searching for binaries,
dSYMs, or reading binaries out of memory to the 'Host' log channel.
There's more to be done here, both for Mac and for other platforms,
but the initial set of new loggings are useful enough to check in
at this point.

llvm-svn: 243200

9 years agoCOFF: ARM: Set correct entry point address.
Rui Ueyama [Sat, 25 Jul 2015 02:25:14 +0000 (02:25 +0000)]
COFF: ARM: Set correct entry point address.

llvm-svn: 243199

9 years ago[AArch64][FastISel] Always use an AND instruction when truncating to non-legal types.
Juergen Ributzka [Sat, 25 Jul 2015 02:16:53 +0000 (02:16 +0000)]
[AArch64][FastISel] Always use an AND instruction when truncating to non-legal types.

When truncating to non-legal types (such as i16, i8 and i1) always use an AND
instruction to mask out the upper bits. This was only done when the source type
was an i64, but not when the source type was an i32.

This commit fixes this and adds the missing i32 truncate tests.

This fixes rdar://problem/21990703.

llvm-svn: 243198

9 years agoCOFF: Handle base relocation as a tuple of relocation type and RVA. NFC.
Rui Ueyama [Sat, 25 Jul 2015 01:44:32 +0000 (01:44 +0000)]
COFF: Handle base relocation as a tuple of relocation type and RVA. NFC.

On x64 and x86, we use only one base relocation type, so we handled
base relocations just as a list of RVAs. That doesn't work well for
ARM becuase we have to handle two types of base relocations on ARM.
This patch changes the type of base relocation from uint32_t to
{reltype, uint32_t} to make it easy to port this code to ARM.

llvm-svn: 243197

9 years ago[SemaTemplate] Detect instantiation of unparsed exceptions.
Davide Italiano [Sat, 25 Jul 2015 01:19:32 +0000 (01:19 +0000)]
[SemaTemplate] Detect instantiation of unparsed exceptions.

This fixes the clang crash reported in PR24000.

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

llvm-svn: 243196

9 years agoCOFF: Split ImportThunkChunk into x86 and x64. NFC.
Rui Ueyama [Sat, 25 Jul 2015 01:16:06 +0000 (01:16 +0000)]
COFF: Split ImportThunkChunk into x86 and x64. NFC.

This change should make it easy to port this code to ARM.

llvm-svn: 243195

9 years agoCOFF: Do not align import thunks on 16-byte boundaries on x86.
Rui Ueyama [Sat, 25 Jul 2015 01:16:04 +0000 (01:16 +0000)]
COFF: Do not align import thunks on 16-byte boundaries on x86.

Looks like MSVC linker aligns them only on x64.

llvm-svn: 243194

9 years agoShorten the lldb timeout, we were seeing occasional failure because
Jim Ingham [Sat, 25 Jul 2015 00:52:38 +0000 (00:52 +0000)]
Shorten the lldb timeout, we were seeing occasional failure because
lldb didn't wake up before the target function got a chance to complete.

<rdar://problem/21990308>

llvm-svn: 243193

9 years agoFix PPCMaterializeInt to check the size of the integer based on the
Eric Christopher [Sat, 25 Jul 2015 00:48:08 +0000 (00:48 +0000)]
Fix PPCMaterializeInt to check the size of the integer based on the
extension property we're requesting - zero or sign extended.

This fixes cases where we want to return a zero extended 32-bit -1
and not be sign extended for the entire register. Also updated the
already out of date comment with the current behavior.

llvm-svn: 243192

9 years agoPPCMaterializeInt should only take a ConstantInt so represent this in the prototype
Eric Christopher [Sat, 25 Jul 2015 00:48:06 +0000 (00:48 +0000)]
PPCMaterializeInt should only take a ConstantInt so represent this in the prototype
and fix up all uses.

llvm-svn: 243191

9 years agoAdd initial CODE_OWNERS.TXT file
Nick Kledzik [Sat, 25 Jul 2015 00:44:37 +0000 (00:44 +0000)]
Add initial CODE_OWNERS.TXT file

llvm-svn: 243190

9 years agoFix test case.
Akira Hatanaka [Sat, 25 Jul 2015 00:33:57 +0000 (00:33 +0000)]
Fix test case.

This is a follow-up to r243185, which made changes to pass subtarget
feature "+reserve-x18" instead of backend option "-aarch64-reserve-x18".

llvm-svn: 243189

9 years agoCOFF: Don't assume !is64() means i386.
Rui Ueyama [Sat, 25 Jul 2015 00:20:06 +0000 (00:20 +0000)]
COFF: Don't assume !is64() means i386.

In many places we assumed that is64() means AMD64 and i386 otherwise.
This assumption is not sound because Windows also supports ARM.
The linker doesn't support ARM yet, but this is a first step.

llvm-svn: 243188

9 years agoSpecify a language to use when parsing expressions.
Dawn Perchik [Sat, 25 Jul 2015 00:19:39 +0000 (00:19 +0000)]
Specify a language to use when parsing expressions.

This patch adds the option -l/--language to the expression command, for
use when setting the language options or choosing an alternate FE. If
not specified, the target.language setting is used.

Reviewed by: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11447

llvm-svn: 243187

9 years ago[AArch64] Define subtarget feature "reserve-x18", which is used to decide
Akira Hatanaka [Sat, 25 Jul 2015 00:18:31 +0000 (00:18 +0000)]
[AArch64] Define subtarget feature "reserve-x18", which is used to decide
whether register x18 should be reserved.

This change is needed because we cannot use a backend option to set
cl::opt "aarch64-reserve-x18" when doing LTO.

Out-of-tree projects currently using cl::opt option "-aarch64-reserve-x18"
to reserve x18 should make changes to add subtarget feature "reserve-x18"
to the IR.

rdar://problem/21529937

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

llvm-svn: 243186

9 years ago[AArch64] Pass subtarget feature "+reserve-x18" instead of passing backend
Akira Hatanaka [Sat, 25 Jul 2015 00:18:00 +0000 (00:18 +0000)]
[AArch64] Pass subtarget feature "+reserve-x18" instead of passing backend
option "-aarch64-reserve-x18".

This change is needed since backend options do not make it to the backend
when doing LTO and are not capable of changing the behavior of code-gen
passes on a per-function basis.

rdar://problem/21529937

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

llvm-svn: 243185

9 years ago[ELF2] Remove broken test.
Michael J. Spencer [Sat, 25 Jul 2015 00:09:22 +0000 (00:09 +0000)]
[ELF2] Remove broken test.

The exact error the system returns for this case is varies between OS's and file systems.

llvm-svn: 243184

9 years agoDI/Verifier: Fix argument bitrot in DILocalVariable
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 23:59:25 +0000 (23:59 +0000)]
DI/Verifier: Fix argument bitrot in DILocalVariable

Add a verifier check that `DILocalVariable`s of tag
`DW_TAG_arg_variable` always have a non-zero 'arg:' field, and those of
tag `DW_TAG_auto_variable` always have a zero 'arg:' field.  These are
the only configurations that are properly understood by the backend.

(Also, fix the bad examples in LangRef and test/Assembler, and fix the
bug in Kaleidoscope Ch8.)

A large number of testcases seem to have bitrotted their way forward
from some ancient version of the debug info hierarchy that didn't have
`arg:` parameters.  If you have out-of-tree testcases that start failing
in the verifier and you don't care enough to get the `arg:` right, you
may have some luck just calling:

    sed -e 's/, arg: 0/, arg: 1/'

or some such, but I hand-updated the ones in tree.

llvm-svn: 243183

9 years agoCOFF: Implement Safe SEH support for x86.
Rui Ueyama [Fri, 24 Jul 2015 23:51:14 +0000 (23:51 +0000)]
COFF: Implement Safe SEH support for x86.

An object file compatible with Safe SEH contains a .sxdata section.
The section contains a list of symbol table indices, each of which
is an exception handler function. A safe SEH-enabled executable
contains a list of exception handler RVAs. So, what the linker has
to do to support Safe SEH is basically to read the .sxdata section,
interpret the contents as a list of symbol indices, unique-fy and
sort their RVAs, and then emit that list to .rdata. This patch
implements that feature.

llvm-svn: 243182

9 years agoMake sure we resolve ~ in paths coming from the plist in a dSYM before adding them
Jim Ingham [Fri, 24 Jul 2015 23:40:32 +0000 (23:40 +0000)]
Make sure we resolve ~ in paths coming from the plist in a dSYM before adding them
to the path remappings.
Also don't add the paths to the path mapping when DebugSymbols tells up about files, since
we'll just do that again when we read in the dSYM.

<rdar://problem/21986208>

llvm-svn: 243181

9 years agoUse double-checked locking to avoid locking the Module mutex if we don't need to...
Greg Clayton [Fri, 24 Jul 2015 23:38:01 +0000 (23:38 +0000)]
Use double-checked locking to avoid locking the Module mutex if we don't need to. This avoid a deadlock we were seeing in Xcode.

<rdar://problem/21512067>

llvm-svn: 243180

9 years agoNormalize whitespace in makefiles
Michael Kruse [Fri, 24 Jul 2015 23:30:31 +0000 (23:30 +0000)]
Normalize whitespace in makefiles

Tabs for rules and space for line continuations.

llvm-svn: 243179

9 years agoCOFF: Fix base relocation type for x86.
Rui Ueyama [Fri, 24 Jul 2015 23:24:45 +0000 (23:24 +0000)]
COFF: Fix base relocation type for x86.

llvm-svn: 243178

9 years agoCOFF: Fix __ImageBase symbol relocation.
Rui Ueyama [Fri, 24 Jul 2015 22:58:44 +0000 (22:58 +0000)]
COFF: Fix __ImageBase symbol relocation.

__ImageBase is a special symbol whose value is the image base address.
Previously, we handled __ImageBase symbol as an absolute symbol.

Absolute symbols point to specific locations in memory and the locations
never change even if an image is base-relocated. That means that we
don't have base relocation entries for absolute symbols.

This is not a case for __ImageBase. If an image is base-relocated, its
base address changes, and __ImageBase needs to be shifted as well.
So we have to have base relocations for __ImageBase. That means that
__ImageBase is not really an absolute symbol but a different kind of
symbol.

In this patch, I introduced a new type of symbol -- DefinedRelative.
DefinedRelative is similar to DefinedAbsolute, but it has not a VA but RVA
and is a subject of base relocation. Currently only __ImageBase is of
the new symbol type.

llvm-svn: 243176

9 years agoLog socket communications to LIBLLDB_LOG_COMMUNICATION instead of
Jason Molenda [Fri, 24 Jul 2015 22:42:03 +0000 (22:42 +0000)]
Log socket communications to LIBLLDB_LOG_COMMUNICATION instead of
the Host channel.

http://reviews.llvm.org/D11497

llvm-svn: 243175

9 years agoSome fixes to get LLDB compiling with MSVC 2015.
Zachary Turner [Fri, 24 Jul 2015 22:32:22 +0000 (22:32 +0000)]
Some fixes to get LLDB compiling with MSVC 2015.

llvm-svn: 243174

9 years agoMIR Serialization: Serialize MachineFrameInfo's callee saved information.
Alex Lorenz [Fri, 24 Jul 2015 22:22:50 +0000 (22:22 +0000)]
MIR Serialization: Serialize MachineFrameInfo's callee saved information.

This commit serializes the callee saved information from the class
'MachineFrameInfo'. This commit extends the YAML mappings for the fixed and
the ordinary stack objects and adds an optional 'callee-saved-register'
attribute. This attribute is used to serialize the callee save information.

llvm-svn: 243173

9 years agoHandle loop with negtive induction variable increment
Lawrence Hu [Fri, 24 Jul 2015 22:01:49 +0000 (22:01 +0000)]
Handle loop with negtive induction variable increment

This patch extend LoopReroll pass to hand the loops which
is similar to the following:

      while (len > 1) {
            sum4 += buf[len];
            sum4 += buf[len-1];
            len -= 2;
        }

llvm-svn: 243171

9 years ago[CMake] Workaround for PR24222: don't fail if we can't target COMPILER_RT_TEST_TARGET...
Alexey Samsonov [Fri, 24 Jul 2015 22:01:07 +0000 (22:01 +0000)]
[CMake] Workaround for PR24222: don't fail if we can't target COMPILER_RT_TEST_TARGET_TRIPLE unless it was explicitly set.

Summary:
Although we assume that we can always target host triple, relax
this check to avoid failing at configure-time for cases when we are
not able to correctly infer/verify host triple for some reasons.

See http://llvm.org/bugs/show_bug.cgi?id=24222 for more details.

Reviewers: hans

Subscribers: llvm-commits

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

llvm-svn: 243170

9 years agoReplacing some diagnostic string literals with tablegen equivalents because the wordi...
Aaron Ballman [Fri, 24 Jul 2015 21:49:29 +0000 (21:49 +0000)]
Replacing some diagnostic string literals with tablegen equivalents because the wording is identical; NFC.

llvm-svn: 243169

9 years agoAdd isl_ffs.c to file list in autoconf builds
Michael Kruse [Fri, 24 Jul 2015 21:40:22 +0000 (21:40 +0000)]
Add isl_ffs.c to file list in autoconf builds

In most configurations it doesn't contain any symbol, but add for
completeness.

llvm-svn: 243168

9 years agoRemove unnecessary null check. NFC.
Pete Cooper [Fri, 24 Jul 2015 21:38:01 +0000 (21:38 +0000)]
Remove unnecessary null check.  NFC.

Since both places which set this variable do so with dyn_cast, and not
dyn_cast_or_null, its impossible to get a nullptr here, so we can remove
the check.

llvm-svn: 243167

9 years agoAdd option eTypeOptionHideEmptyAggregates.
Siva Chandra [Fri, 24 Jul 2015 21:30:58 +0000 (21:30 +0000)]
Add option eTypeOptionHideEmptyAggregates.

Summary:
For certain data structures, when the synthetic child provider returns
zero children, a summary like "Empty instance of <typename>" could be
more appropriate than something like "size=0 {}". This new option helps
hide the trailing "{}".

This is also exposed with a -h option for the command "type summary add".

Reviewers: granata.enrico

Subscribers: lldb-commits

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

llvm-svn: 243166

9 years agoLibompMicroTests.cmake: Invoke 'test' instead of using '[ x -eq y ]'
Hans Wennborg [Fri, 24 Jul 2015 21:24:48 +0000 (21:24 +0000)]
LibompMicroTests.cmake: Invoke 'test' instead of using '[ x -eq y ]'

I was getting this cmake error on Mac OS X:

  CMake Error: Error in cmake code at
  /tmp/openmp/runtime/cmake/LibompMicroTests.cmake:140:
  Parse error.  Function missing ending ")".  Instead found bad character with text "[".

Perhaps invoking 'test' is less confusing for cmake.

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

llvm-svn: 243165

9 years agoUse make_range(rbegin(), rend()) to allow foreach loops. NFC.
Pete Cooper [Fri, 24 Jul 2015 21:13:43 +0000 (21:13 +0000)]
Use make_range(rbegin(), rend()) to allow foreach loops.  NFC.

Instead of the pattern

for (auto I = x.rbegin(), E = x.end(); I != E; ++I)

we can use make_range to construct the reverse range and iterate using
that instead.

llvm-svn: 243163

9 years agoDI: Fix unit tests after r243160
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 21:11:06 +0000 (21:11 +0000)]
DI: Fix unit tests after r243160

These always empty fields are gone, so don't test that they're empty.

llvm-svn: 243162

9 years ago[ELF2] Add a new ELF linker based on the new PE/COFF linker.
Michael J. Spencer [Fri, 24 Jul 2015 21:03:07 +0000 (21:03 +0000)]
[ELF2] Add a new ELF linker based on the new PE/COFF linker.

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

llvm-svn: 243161

9 years agoDI: Remove unnecessary DICompositeTypeBase
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 20:56:36 +0000 (20:56 +0000)]
DI: Remove unnecessary DICompositeTypeBase

Remove unnecessary and confusing common base class for `DICompositeType`
and `DISubroutineType`.

While at a high-level `DISubroutineType` is a sort of composite of other
types, it has no shared code paths, and its fields are completely
disjoint.  This relationship was left over from the old debug info
hierarchy.

llvm-svn: 243160

9 years agoDI: Simplify DebugInfoFinder::processType(), NFC
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 20:56:10 +0000 (20:56 +0000)]
DI: Simplify DebugInfoFinder::processType(), NFC

Handle `DISubroutineType` up-front rather than as part of a branch for
`DICompositeTypeBase`.  The only shared code path was looking through
the base type, but `DISubroutineType` can never have a base type.

This also removes the last use of `DICompositeTypeBase`, since we can
strengthen the cast to `DICompositeType`.

llvm-svn: 243159

9 years agoDI: Remove dead code: getDICompositeType()
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 20:46:46 +0000 (20:46 +0000)]
DI: Remove dead code: getDICompositeType()

llvm-svn: 243158

9 years agoAsmPrinter: Use DICompositeType in updateAcceleratorTables(), NFC
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 20:45:26 +0000 (20:45 +0000)]
AsmPrinter: Use DICompositeType in updateAcceleratorTables(), NFC

`DISubroutineType` is impossible at this `dyn_cast` site, since we're
only dealing with named types and `DISubroutineType` cannot be named.
Strengthen the `dyn_cast` to `DICompositeType`.

llvm-svn: 243157

9 years agoMIR Serialization: Serialize the simple virtual register allocation hints.
Alex Lorenz [Fri, 24 Jul 2015 20:35:40 +0000 (20:35 +0000)]
MIR Serialization: Serialize the simple virtual register allocation hints.

This commit serializes the virtual register allocations hints of type 0.
These hints specify the preferred physical registers for allocations.

llvm-svn: 243156

9 years agoDI: Make getOrCreateLimitedType() return DICompositeType, NFC
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 20:34:41 +0000 (20:34 +0000)]
DI: Make getOrCreateLimitedType() return DICompositeType, NFC

Change `getOrCreateLimitedType()` to return a `DICompositeType` and
remove the casts from its callers.  Inside, I've strengthened a `cast`
from `DICompositeTypeBase`, but the casts in the callers already prove
that this is safe.  There should be no functionality change here.

llvm-svn: 243155

9 years agoMake the lit configuration Python 3 compatible
Michael Kruse [Fri, 24 Jul 2015 20:33:22 +0000 (20:33 +0000)]
Make the lit configuration Python 3 compatible

by using the same techniques as LLVM's lit configuration.

llvm-svn: 243154

9 years agoSelect the highest version of the mingw toolchain found using Generic_GCC::GCCVersion
Yaron Keren [Fri, 24 Jul 2015 20:18:27 +0000 (20:18 +0000)]
Select the highest version of the mingw toolchain found using Generic_GCC::GCCVersion
similar to the way Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple works.

llvm-svn: 243153

9 years agoDI: Remove DIDerivedTypeBase
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 20:16:36 +0000 (20:16 +0000)]
DI: Remove DIDerivedTypeBase

Remove an unnecessary (and confusing) common subclass for
`DIDerivedType` and `DICompositeType`.  These classes aren't really
related, and even in the old debug info hierarchy, there was a
long-standing FIXME to separate them.

llvm-svn: 243152

9 years ago__tsan::ThreadCreate takes incorrect value for detached argument
Ismail Pazarbasi [Fri, 24 Jul 2015 20:00:49 +0000 (20:00 +0000)]
__tsan::ThreadCreate takes incorrect value for detached argument

Summary:
PTHREAD_CREATE_DETACHED has a different value on Mac OS X. Since both
PTHREAD_CREATE_JOINABLE and PTHREAD_CREATE_DETACHED are non-zero,
`__tsan::ThreadCreate` always creates detached threads.

Reviewers: kcc, samsonov, glider

Subscribers: llvm-commits

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

llvm-svn: 243151

9 years agoVerifier: Sink filename check into visitMDCompositeType(), NFC
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 19:57:19 +0000 (19:57 +0000)]
Verifier: Sink filename check into visitMDCompositeType(), NFC

We really only want to check this for unions and classes (all the other
tags have been ruled out), so simplify the check and move it to the
right place.

llvm-svn: 243150

9 years agoVerifier: Remove unnecessary references to DW_TAG_subroutine_type, NFC
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 19:52:18 +0000 (19:52 +0000)]
Verifier: Remove unnecessary references to DW_TAG_subroutine_type, NFC

Remove unnecessary references to `DW_TAG_subroutine_type` in
`visitDICompositeType()` and `visitDIDerivedTypeBase()`, since
`visitDISubroutineType()` doesn't call either of those (and shouldn't,
since subroutine types are really quite special).

llvm-svn: 243149

9 years agoDI: Clarify isUnsignedDIType(), NFC
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 19:42:12 +0000 (19:42 +0000)]
DI: Clarify isUnsignedDIType(), NFC

Refactor `isUnsignedDIType()` to deal with `DICompositeType` explicitly.
Since `DW_TAG_subroutine_type` isn't handled here (the assertions about
tags rule it out), this allows strengthening the `dyn_cast` to
`DIDerivedType`.

Besides making the code clearer, this it removes a use of
`DIDerivedTypeBase`.

llvm-svn: 243148

9 years ago[libunwind] Flip order of extern "C" and attribute(visibility)
Renato Golin [Fri, 24 Jul 2015 19:29:05 +0000 (19:29 +0000)]
[libunwind] Flip order of extern "C" and attribute(visibility)

GCC doesn't seems to like having the attribute before extern, but
Clang accepts it either way. This patch makes it compile on both.

llvm-svn: 243147

9 years agoAdd const to some Type* parameters which didn't need to be mutable. NFC.
Pete Cooper [Fri, 24 Jul 2015 19:19:26 +0000 (19:19 +0000)]
Add const to some Type* parameters which didn't need to be mutable.  NFC.

We were only getting the size of the type which doesn't need to modify
the type.

llvm-svn: 243146

9 years agoRemove unused variable. NFC.
Diego Novillo [Fri, 24 Jul 2015 19:18:32 +0000 (19:18 +0000)]
Remove unused variable. NFC.

llvm-svn: 243145

9 years agoBase the sys-root/mingw/include path on sysroot and not on /usr.
Yaron Keren [Fri, 24 Jul 2015 19:18:17 +0000 (19:18 +0000)]
Base the sys-root/mingw/include path on sysroot and not on /usr.

Thanks to Richard Smith for pointing this out!

llvm-svn: 243144

9 years agoDI: Strengthen some dyn_casts to DIDerivedType, NFC
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 19:17:20 +0000 (19:17 +0000)]
DI: Strengthen some dyn_casts to DIDerivedType, NFC

The surrounding code proves in both cases that these must be
`DIDerivedType` if they're `DIDerivedTypeBase`, so strengthen the
`dyn_cast`s to the more specific type.

llvm-svn: 243143

9 years agoCompile fix; add missing ISL files
Michael Kruse [Fri, 24 Jul 2015 19:09:27 +0000 (19:09 +0000)]
Compile fix; add missing ISL files

The last ISL update added two files that we must also add to Polly.

llvm-svn: 243142

9 years agoRemove the user-count threshold when analyzing read attributes
Jingyue Wu [Fri, 24 Jul 2015 19:05:53 +0000 (19:05 +0000)]
Remove the user-count threshold when analyzing read attributes

Summary:
This threshold limited FunctionAttrs ability to prove arguments to be read-only.
In NVPTX, a specialized instruction ld.global.nc can be used to load memory
with non-coherent texture cache. We notice that in SHOC [1] benchmark, some
function arguments are not marked with readonly because FunctionAttrs reaches
a hardcoded threshold when analysis uses.

Removing this threshold won't cause significant regression in compilation time, because the worst-case time complexity of the algorithm is still O(# of instructions) for each parameter.

Patched by Xuetian Weng.

[1] https://github.com/vetter/shoc

Reviewers: nlewycky, jingyue, nicholas

Subscribers: nicholas, test, llvm-commits

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

llvm-svn: 243141

9 years ago[RewriteStatepointsForGC] Adjust naming scheme to be more stable
Philip Reames [Fri, 24 Jul 2015 19:01:39 +0000 (19:01 +0000)]
[RewriteStatepointsForGC] Adjust naming scheme to be more stable

The names for instructions inserted were previous dependent on iteration order.  By deriving the names from the original instructions, we can avoid instability in tests without resorting to ordered traversals.  It also makes the IR mildly easier to read at large scale.

llvm-svn: 243140

9 years ago[asan] Only link liblog on Android when it exists.
Evgeniy Stepanov [Fri, 24 Jul 2015 19:00:16 +0000 (19:00 +0000)]
[asan] Only link liblog on Android when it exists.

With r242975, liblog is only used on certain older platforms.

llvm-svn: 243139

9 years agoDI: Strengthen block-byref cast to DIDerivedType, NFC
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 18:58:32 +0000 (18:58 +0000)]
DI: Strengthen block-byref cast to DIDerivedType, NFC

This code is visiting the members of a block-byref, and we know those
are all `DIDerivedType`.  Strengthen the cast.

llvm-svn: 243138

9 years ago[asan] Fix android system property access on aarch64.
Evgeniy Stepanov [Fri, 24 Jul 2015 18:57:44 +0000 (18:57 +0000)]
[asan] Fix android system property access on aarch64.

__system_property_get is gone from the NDK headers and libs in 64-bit
toolchains, but it is still exported by platform libc.so.

llvm-svn: 243137

9 years agoUse foreach loops for StructType::elements(). NFC.
Pete Cooper [Fri, 24 Jul 2015 18:55:49 +0000 (18:55 +0000)]
Use foreach loops for StructType::elements().  NFC.

We had a few places where we did

for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {

but those could instead do

for (auto *EltTy : STy->elements()) {

llvm-svn: 243136

9 years agoAdd const to a bunch of Type* in DataLayout. NFC.
Pete Cooper [Fri, 24 Jul 2015 18:29:09 +0000 (18:29 +0000)]
Add const to a bunch of Type* in DataLayout.  NFC.

Almost all methods in DataLayout took mutable pointers but didn't need to.
These were only accessing constant methods of the types, or using the Type*
to key a map.  Neither of these needs a mutable pointer.

llvm-svn: 243135

9 years agoDI: Only DICompositeType has getElements(), NFC
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 18:17:17 +0000 (18:17 +0000)]
DI: Only DICompositeType has getElements(), NFC

There is an assertion inside `DICompositeTypeBase::getElements()` that
`this` is not a `DISubroutineType`, leaving only `DICompositeType`.
Make that clear at the call sites.

llvm-svn: 243134

9 years agoCorrect x86_64 Android fp128 mangled name
Chih-Hung Hsieh [Fri, 24 Jul 2015 18:12:54 +0000 (18:12 +0000)]
Correct x86_64 Android fp128 mangled name

These changes are for Android x86_64 targets to be compatible with current Android g++.
https://llvm.org/bugs/show_bug.cgi?id=23897
Use 'g' and 'Cg' for "long double" and "long double _Complex" mangled type names.

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

llvm-svn: 243133

9 years agoFix double implementation of log
Tom Stellard [Fri, 24 Jul 2015 18:07:14 +0000 (18:07 +0000)]
Fix double implementation of log

We need to use M_LOG2E instead of M_LOG2E_F.

llvm-svn: 243132

9 years agoImplement accurate log2 function
Tom Stellard [Fri, 24 Jul 2015 18:07:12 +0000 (18:07 +0000)]
Implement accurate log2 function

Use the implementation was ported from the AMD builtin library rather
than LLVM Intrinsics.

This has been tested with piglit, OpenCV, and the ocl conformance tests.

llvm-svn: 243131

9 years agoUse llvm intrinsics for native_log and native_log2
Tom Stellard [Fri, 24 Jul 2015 18:07:06 +0000 (18:07 +0000)]
Use llvm intrinsics for native_log and native_log2

llvm-svn: 243130

9 years agoDI: Make StaticDataMemberCache type-safe, NFC
Duncan P. N. Exon Smith [Fri, 24 Jul 2015 18:05:58 +0000 (18:05 +0000)]
DI: Make StaticDataMemberCache type-safe, NFC

Change `StaticDataMemberCache` to store references to `DIDerivedType`
directly, and remove now-unnecessary casts from the accessors.

llvm-svn: 243129

9 years agoMIR Parser: Run the machine verifier after initializing machine functions.
Alex Lorenz [Fri, 24 Jul 2015 17:44:49 +0000 (17:44 +0000)]
MIR Parser: Run the machine verifier after initializing machine functions.

llvm-svn: 243128

9 years ago[RuntimeDyld] MachO: Add support for ARM scattered vanilla relocations.
Lang Hames [Fri, 24 Jul 2015 17:40:04 +0000 (17:40 +0000)]
[RuntimeDyld] MachO: Add support for ARM scattered vanilla relocations.

llvm-svn: 243126