platform/upstream/llvm.git
10 years agoUse native ::pid_t in Linux ProcessMonitor (local debugging).
Todd Fiala [Tue, 1 Jul 2014 16:30:53 +0000 (16:30 +0000)]
Use native ::pid_t in Linux ProcessMonitor (local debugging).

There were a few places where we were not catching the possibility of negative
error codes in waitpid() calls.  This change fixes those remaining after
the llgs branch fixes to ProcessMonitor.

Change by Shawn Best.

llvm-svn: 212107

10 years ago[PeepholeOptimzer] Fix a typo in a comment.
Quentin Colombet [Tue, 1 Jul 2014 16:23:44 +0000 (16:23 +0000)]
[PeepholeOptimzer] Fix a typo in a comment.
Spotted by Amara Emerson.

llvm-svn: 212106

10 years agoRemove unused typedef. GCC warns about this.
Benjamin Kramer [Tue, 1 Jul 2014 15:39:32 +0000 (15:39 +0000)]
Remove unused typedef. GCC warns about this.

llvm-svn: 212105

10 years agoGlobalOpt: Don't swap private for internal linkage
David Majnemer [Tue, 1 Jul 2014 15:26:50 +0000 (15:26 +0000)]
GlobalOpt: Don't swap private for internal linkage

There were transforms whose *intent* was to downgrade the linkage of
external objects to have internal linkage.

However, it fired on things with private linkage as well.

llvm-svn: 212104

10 years agoGlobalOpt: FileCheck-ize test
David Majnemer [Tue, 1 Jul 2014 15:26:47 +0000 (15:26 +0000)]
GlobalOpt: FileCheck-ize test

No functionality change.

llvm-svn: 212103

10 years agoRephrase loop so it doesn't leave unused bools around in Release mode.
Benjamin Kramer [Tue, 1 Jul 2014 14:46:44 +0000 (14:46 +0000)]
Rephrase loop so it doesn't leave unused bools around in Release mode.

llvm-svn: 212102

10 years agoAvoid revocations when possible.
Rafael Espindola [Tue, 1 Jul 2014 14:34:30 +0000 (14:34 +0000)]
Avoid revocations when possible.

This is a small targeted fix for pr20119. The code needs quiet a bit of
refactoring and I added some FIXMEs about it, but I want to get the testcase
passing first.

llvm-svn: 212101

10 years ago[PeepholeOptimizer] Advanced rewriting of copies to avoid cross register banks
Quentin Colombet [Tue, 1 Jul 2014 14:33:36 +0000 (14:33 +0000)]
[PeepholeOptimizer] Advanced rewriting of copies to avoid cross register banks
copies.

This patch extends the peephole optimization introduced in r190713 to produce
register-coalescer friendly copies when possible.

This extension taught the existing cross-bank copy optimization how to deal
with the instructions that generate cross-bank copies, i.e., insert_subreg,
extract_subreg, reg_sequence, and subreg_to_reg.
E.g.
b = insert_subreg e, A, sub0 <-- cross-bank copy
...
C = copy b.sub0 <-- cross-bank copy

Would produce the following code:
b = insert_subreg e, A, sub0 <-- cross-bank copy
...
C = copy A <-- same-bank copy

This patch also introduces a new helper class for that: ValueTracker.
This class implements the logic to look through the copy related instructions
and get the related source.

For now, the advanced rewriting is disabled by default as we are lacking the
semantic on target specific instructions to catch the motivating examples.

Related to <rdar://problem/12702965>.

llvm-svn: 212100

10 years ago[RegAllocGreedy] Provide a flag to disable the local reassignment heuristic.
Quentin Colombet [Tue, 1 Jul 2014 14:08:37 +0000 (14:08 +0000)]
[RegAllocGreedy] Provide a flag to disable the local reassignment heuristic.
By default, no functionality change.

Before evicting a local variable, this heuristic tries to find another (set of)
local(s) that can be reassigned to a free color.

In some extreme cases (large basic blocks with tons of local variables), the
compilation time is dominated by the local interference checks that this
heuristic must perform, with no code gen gain.
E.g., the motivating example takes 4 minutes to compile with this heuristic, 12
seconds without.

Improving the situation will likely require to make drastic changes to the
register allocator and/or the interference check framework.

For now, provide this flag to better understand the impact of that heuristic.

<rdar://problem/17444599>

llvm-svn: 212099

10 years agoRemove CleanupHackLevel from CGException.
Logan Chien [Tue, 1 Jul 2014 11:47:10 +0000 (11:47 +0000)]
Remove CleanupHackLevel from CGException.

This patch removes the dead code, and refines the
getEHResumeBlock() slightly.

The CleanupHackLevel was a hack to the old exception
handling intrinsics, which have several issues with function
inliner.

Since LLVM 3.0, the new landingpad and resume instructions
are added to LLVM IR.  With the new exception handling
mechanism, most of the issues are fixed now.  We should
always use these instructions to implement the exception
handling code nowadays, and we don't need the hack any more.

Besides, the `CleanupHackLevel` is a compile-time constant,
thus other cases have been considered as dead code for a while.

llvm-svn: 212097

10 years ago[Driver][Mips] MIPS ABI names "32" and "64" used as arguments of the "-mabi"
Simon Atanasyan [Tue, 1 Jul 2014 10:59:09 +0000 (10:59 +0000)]
[Driver][Mips] MIPS ABI names "32" and "64" used as arguments of the "-mabi"
command line option only. Internally we convert them to the "o32" and "n64"
respectively. So we do not need to refer them anywhere after that conversion.

No functional changes.

llvm-svn: 212096

10 years agoRemove obsolete function TargetRegistry::getClosestTargetForJIT()
Alp Toker [Tue, 1 Jul 2014 10:47:13 +0000 (10:47 +0000)]
Remove obsolete function TargetRegistry::getClosestTargetForJIT()

This was kept around "for compatibility through 2.6" in 2009 and is not used or
tested.

llvm-svn: 212095

10 years ago[mach-o]: make the default dylib install-name the output filename.
Tim Northover [Tue, 1 Jul 2014 08:41:45 +0000 (08:41 +0000)]
[mach-o]: make the default dylib install-name the output filename.

llvm-svn: 212094

10 years ago[mach-o] add representation for LC_ID_DYLIB to MachONormalizedFile
Tim Northover [Tue, 1 Jul 2014 08:15:41 +0000 (08:15 +0000)]
[mach-o] add representation for LC_ID_DYLIB to MachONormalizedFile

It still needs to be tied into BinaryReader, but this allows reasonably
sensible creation of SharedLibrary atoms on MachO.

llvm-svn: 212093

10 years agoEnable test/CodeGen/indirect-goto.c in 64b for local arrays
Gerolf Hoflehner [Tue, 1 Jul 2014 05:10:06 +0000 (05:10 +0000)]
Enable test/CodeGen/indirect-goto.c in 64b for local arrays

In 32b mode the reference count for block addresses
is not zero. This prevents inlining and constant
folding and causes the test to fail. Changing
the triple allows runnning the test in 64b mode.

The array in foo2 is now local instead of static until
at lower optimization levels the interprocedural constant
propagator is invoked before the global optimizer.

llvm-svn: 212092

10 years agoTemporarily disable the indirect-goto.c test.
Bob Wilson [Tue, 1 Jul 2014 04:56:06 +0000 (04:56 +0000)]
Temporarily disable the indirect-goto.c test.

llvm r212077 causes this test to fail. We need to reorder some passes and
possibly make other changes to reenable the optimization being tested here.

llvm-svn: 212091

10 years agoPR15677 - Crash in template diffing. Check that expression is evaluatable before...
Nikola Smiljanic [Tue, 1 Jul 2014 04:17:53 +0000 (04:17 +0000)]
PR15677 - Crash in template diffing. Check that expression is evaluatable before evaluating it.

llvm-svn: 212090

10 years agoRevert "DebugInfo: Ensure that all debug location scope chains from instructions...
David Blaikie [Tue, 1 Jul 2014 04:11:45 +0000 (04:11 +0000)]
Revert "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself."

This reverts commit r212085.

This breaks the sanitizer bot... & I thought I'd tried pretty hard not
to do that. Guess I need to try harder.

llvm-svn: 212089

10 years agoMachineScheduler: better book-keeping for asserts.
Andrew Trick [Tue, 1 Jul 2014 03:23:13 +0000 (03:23 +0000)]
MachineScheduler: better book-keeping for asserts.

Fixes another test case under PR20057.

llvm-svn: 212088

10 years agoclang-interpreter: use LLVM interpreter if JIT is unavailable
Alp Toker [Tue, 1 Jul 2014 03:19:50 +0000 (03:19 +0000)]
clang-interpreter: use LLVM interpreter if JIT is unavailable

Update the strategy in r212083 to try JIT first and otherwise fall back to the
interpreter. This gives the best of both worlds and still builds fine with no
targets enabled.

Requires supporting changes from LLVM r212086.

llvm-svn: 212087

10 years agoExecutionEngine::create(): fix interpreter fallback when JIT is unavailable
Alp Toker [Tue, 1 Jul 2014 03:18:49 +0000 (03:18 +0000)]
ExecutionEngine::create(): fix interpreter fallback when JIT is unavailable

ForceInterpreter=false shouldn't disable the interpreter completely because it
can still be necessary to interpret if the target doesn't support JIT.

No obvious way to test this in LLVM, but this matches what
LLVMCreateExecutionEngineForModule() does and fixes the clang-interpreter
example in the clang source tree which uses the ExecutionEngine.

llvm-svn: 212086

10 years agoDebugInfo: Ensure that all debug location scope chains from instructions within a...
David Blaikie [Tue, 1 Jul 2014 03:11:59 +0000 (03:11 +0000)]
DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself.

Originally committed in r211723, reverted in r211724 due to failure
cases found and fixed (ArgumentPromotion: r211872, Inlining: r212065),
and I now believe the invariant actually holds for some reasonable
amount of code (but I'll keep an eye on the buildbots and see what
happens... ).

Original commit message:

PR20038: DebugInfo: Inlined call sites where the caller has debug info
but the call itself has no debug location.

This situation does bad things when inlined, so I've fixed Clang not to
produce inlinable call sites without locations when the caller has debug
info (in the one case where I could find that this occurred). This
updates the PR20038 test case to be what clang now produces, and readds
the assertion that had to be removed due to this bug.

I've also beefed up the debug info verifier to help diagnose these
issues in the future, and I hope to add checks to the inliner to just
assert-fail if it encounters this situation. If, in the future, we
decide we have to cope with this situation, the right thing to do is
probably to just remove all the DebugLocs from the inlined instructions.

llvm-svn: 212085

10 years agodriver: add link dependency on CodeGen
Alp Toker [Tue, 1 Jul 2014 02:42:02 +0000 (02:42 +0000)]
driver: add link dependency on CodeGen

Fix the build when no targets are enabled. This dependency is incurred by two
unfortunate entries in LinkAllPasses.h included from cc1_main.cpp:

  llvm::createJumpInstrTablesPass();
  llvm::createCodeGenPreparePass();

llvm-svn: 212084

10 years agoclang-interpreter: interpret instead of JITing
Alp Toker [Tue, 1 Jul 2014 02:41:55 +0000 (02:41 +0000)]
clang-interpreter: interpret instead of JITing

Fixes the build when no targets are selected, or no native target is built.

This also better matches up with the description/title of the example and
demonstrates how clang can be used to run C++ on constrained environments
without file IO or executable memory permissions (e.g. iOS apps).

A comment is added explaining how to extend the demo with JIT support as
needed.

llvm-svn: 212083

10 years agoAdd the way to disable MSan unit tests for _mm_* intrinsics
Alexey Samsonov [Tue, 1 Jul 2014 01:38:52 +0000 (01:38 +0000)]
Add the way to disable MSan unit tests for _mm_* intrinsics

llvm-svn: 212082

10 years agoFix .seh_stackalloc 0
Reid Kleckner [Tue, 1 Jul 2014 00:42:47 +0000 (00:42 +0000)]
Fix .seh_stackalloc 0

seh_stackalloc 0 is not representable in Win64 SEH info, so emitting it
is a bug.

Reviewers: rnk

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

Patch by Vadim Chugunov!

llvm-svn: 212081

10 years ago[FIX] Don't consider reductions which are partially outside the SCoP
Johannes Doerfert [Tue, 1 Jul 2014 00:32:29 +0000 (00:32 +0000)]
[FIX] Don't consider reductions which are partially outside the SCoP

  + Test case

llvm-svn: 212080

10 years agoGlobalOpt: Handle non-zero offsets for aliases
David Majnemer [Tue, 1 Jul 2014 00:30:56 +0000 (00:30 +0000)]
GlobalOpt: Handle non-zero offsets for aliases

An alias with an aliasee of a non-zero GEP is not trivially replacable
with it's aliasee.

llvm-svn: 212079

10 years agoIR: Add a helper to check for LinkOnceODRLinkage
David Majnemer [Tue, 1 Jul 2014 00:30:52 +0000 (00:30 +0000)]
IR: Add a helper to check for LinkOnceODRLinkage

llvm-svn: 212078

10 years agoSuppress inlining when the block address is taken
Gerolf Hoflehner [Tue, 1 Jul 2014 00:19:34 +0000 (00:19 +0000)]
Suppress inlining when the block address is taken

Inlining functions with block addresses can cause many problem and requires a
rich infrastructure to support including escape analysis.  At this point the
safest approach to address these problems is by blocking inlining from
happening.

Background:
There have been reports on Ruby segmentation faults triggered by inlining
functions with block addresses like

//Ruby code snippet
vm_exec_core() {
    finish_insn_seq_0 = &&INSN_LABEL_finish;
    INSN_LABEL_finish:
      ;
}

This kind of scenario can also happen when LLVM picks a subset of blocks for
inlining, which is the case with the actual code in the Ruby environment.

LLVM suppresses inlining for such functions when there is an indirect branch.
The attached patch does so even when there is no indirect branch.  Note that
user code like above would not make much sense: using the global for jumping
across function boundaries would be illegal.

Why was there a segfault:

In the snipped above the block with the label is recognized as dead So it is
eliminated. Instead of a block address the cloner stores a constant (sic!) into
the global resulting in the segfault (when the global is used in a goto).

Why had it worked in the past then:

By luck. In older versions vm_exec_core was also inlined but the label address
used was the block label address in vm_exec_core.  So the global jump ended up
in the original function rather than in the caller which accidentally happened
to work.

Test case ./tools/clang/test/CodeGen/indirect-goto.c will fail as a result
of this commit.

rdar://17245966

llvm-svn: 212077

10 years agoFix Windows build after llgs upstream.
Zachary Turner [Tue, 1 Jul 2014 00:18:46 +0000 (00:18 +0000)]
Fix Windows build after llgs upstream.

With _HAS_EXCEPTIONS=0, Windows' version of <thread> will fail to
compile because it calls __uncaught_exception(), which is compiled
out due to _HAS_EXCEPTIONS=0.  This just creates a stub version
of __uncaught_exception() which always fails.

llvm-svn: 212076

10 years agoAArch64: Follow-up to r212073
Duncan P. N. Exon Smith [Tue, 1 Jul 2014 00:05:37 +0000 (00:05 +0000)]
AArch64: Follow-up to r212073

In r212073 I missed a call of `use_begin()` that assumed the wrong
semantics.  It's not clear to me at all what this code does without the
fix, so I'm not sure how to write a testcase.

llvm-svn: 212075

10 years agoFixup Windows build breaks for the llgs upstream.
Todd Fiala [Mon, 30 Jun 2014 23:51:35 +0000 (23:51 +0000)]
Fixup Windows build breaks for the llgs upstream.

Also moves NativeRegisterContextLinux* files into the Linux directory.
These, like NativeProcessLinux, should only be built on Linux or a cross
compiler with proper headers.

llvm-svn: 212074

10 years agoAArch64: Actually do address type promotion
Duncan P. N. Exon Smith [Mon, 30 Jun 2014 23:42:14 +0000 (23:42 +0000)]
AArch64: Actually do address type promotion

AArch64AddressTypePromotion was doing nothing because it was using the
old semantics of `Use` and `uses()`, when it really wanted to get at the
`users()`.

llvm-svn: 212073

10 years ago[mach-o] improve errors when mixing architectures
Nick Kledzik [Mon, 30 Jun 2014 22:57:33 +0000 (22:57 +0000)]
[mach-o] improve errors when mixing architectures

llvm-svn: 212072

10 years agoFix apparent thinko in r209744: allocator stats can be zero
Alexey Samsonov [Mon, 30 Jun 2014 22:40:58 +0000 (22:40 +0000)]
Fix apparent thinko in r209744: allocator stats can be zero

llvm-svn: 212071

10 years agoFix libc++ bug #20039: 'Constructing std::function from empty compatible std::functio...
Marshall Clow [Mon, 30 Jun 2014 21:27:51 +0000 (21:27 +0000)]
Fix libc++ bug #20039: 'Constructing std::function from empty compatible std::function results in half-empty state' Thanks to Agustin Berge for the report, and for his and Eric Fiselier's work on a fix.

llvm-svn: 212070

10 years agoAdd lldb-gdbserver support for Linux x86_64.
Todd Fiala [Mon, 30 Jun 2014 21:05:18 +0000 (21:05 +0000)]
Add lldb-gdbserver support for Linux x86_64.

This change brings in lldb-gdbserver (llgs) specifically for Linux x86_64.
(More architectures coming soon).

Not every debugserver option is covered yet.  Currently
the lldb-gdbserver command line can start unattached,
start attached to a pid (process-name attach not supported yet),
or accept lldb attaching and launching a process or connecting
by process id.

The history of this large change can be found here:
https://github.com/tfiala/lldb/tree/dev-tfiala-native-protocol-linux-x86_64

Until mid/late April, I was not sharing the work and continued
to rebase it off of head (developed via id tfiala@google.com).  I switched over to
user todd.fiala@gmail.com in the middle, and once I went to github, I did
merges rather than rebasing so I could share with others.

llvm-svn: 212069

10 years ago[mach-o] x86_64 relocation code review fixes
Nick Kledzik [Mon, 30 Jun 2014 20:44:47 +0000 (20:44 +0000)]
[mach-o] x86_64 relocation code review fixes

llvm-svn: 212068

10 years agoConvert some byval argpromotion grep tests to FileCheck
Reid Kleckner [Mon, 30 Jun 2014 20:44:28 +0000 (20:44 +0000)]
Convert some byval argpromotion grep tests to FileCheck

Surprisingly, the i32* byval parameter is not transformed by
argpromotion.

llvm-svn: 212067

10 years agoDo not define __STRICT_ANSI__ in clang-cl
Ehsan Akhgari [Mon, 30 Jun 2014 20:36:33 +0000 (20:36 +0000)]
Do not define __STRICT_ANSI__ in clang-cl

llvm-svn: 212066

10 years agoDebugInfo: Preserve debug location information when transforming a call into an invok...
David Blaikie [Mon, 30 Jun 2014 20:30:39 +0000 (20:30 +0000)]
DebugInfo: Preserve debug location information when transforming a call into an invoke during inlining.

This both improves basic debug info quality, but also fixes a larger
hole whenever we inline a call/invoke without a location (debug info for
the entire inlining is lost and other badness that the debug info
emission code is currently working around but shouldn't have to).

llvm-svn: 212065

10 years ago[UBSan] Don't link UBSan runtime into shared libraries.
Alexey Samsonov [Mon, 30 Jun 2014 20:27:16 +0000 (20:27 +0000)]
[UBSan] Don't link UBSan runtime into shared libraries.

It used to be a feature of UBSan (it could sanitize a standalone
shared object instead of the whole program), but now it causes
more problems, like PR20165.

llvm-svn: 212064

10 years agoRemove unnecessary datalayout string from a test case.
David Blaikie [Mon, 30 Jun 2014 20:26:12 +0000 (20:26 +0000)]
Remove unnecessary datalayout string from a test case.

llvm-svn: 212063

10 years agoSpeculatively fix some code handling Power64 MachO files
Reid Kleckner [Mon, 30 Jun 2014 20:12:59 +0000 (20:12 +0000)]
Speculatively fix some code handling Power64 MachO files

MSVC was warning on a switch containing only default labels.  In this
instance, it looks like it uncovered a real bug.  :)

llvm-svn: 212062

10 years agomsan: Stop stripping the 'tail' modifier off of calls
Reid Kleckner [Mon, 30 Jun 2014 20:12:27 +0000 (20:12 +0000)]
msan: Stop stripping the 'tail' modifier off of calls

This probably isn't necessary since msan started to unpoison the return
value shadow memory before all calls.

llvm-svn: 212061

10 years agoConsider module depedencies when checking a preamble in libclang
Ben Langmuir [Mon, 30 Jun 2014 20:04:14 +0000 (20:04 +0000)]
Consider module depedencies when checking a preamble in libclang

Add module dependencies (header files, module map files) to the list of
files to check when deciding whether to rebuild a preamble. That fixes
using preambles with module imports so long as they are in
non-overridden files.

My intent is to use to unify the existing dependency collectors to the
new “DependencyCollectory” interface from this commit, starting with the
DependencyFileGenerator.

llvm-svn: 212060

10 years agoobjdump: Add test for ELF file with no section table
Ed Maste [Mon, 30 Jun 2014 20:03:02 +0000 (20:03 +0000)]
objdump: Add test for ELF file with no section table

This is a test for the fix in r211904.

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

llvm-svn: 212059

10 years agoUse the newly added FindInEnvPath helper in clang
Ehsan Akhgari [Mon, 30 Jun 2014 19:56:37 +0000 (19:56 +0000)]
Use the newly added FindInEnvPath helper in clang

llvm-svn: 212058

10 years agoRefactor the code in clang to find a file in a PATH like environment variable into...
Ehsan Akhgari [Mon, 30 Jun 2014 19:54:20 +0000 (19:54 +0000)]
Refactor the code in clang to find a file in a PATH like environment variable into a helper function

llvm-svn: 212057

10 years agoFix 'platform-specific' hyphenations
Alp Toker [Mon, 30 Jun 2014 18:57:16 +0000 (18:57 +0000)]
Fix 'platform-specific' hyphenations

llvm-svn: 212056

10 years agoBuild fix for systems without futimes/futimens
Alp Toker [Mon, 30 Jun 2014 18:57:04 +0000 (18:57 +0000)]
Build fix for systems without futimes/futimens

Some versions of Android don't have futimes/futimens and this code wasn't
updated during the recent errc refactoring.

Patch by Luqman Aden!

llvm-svn: 212055

10 years agoAdd the -arch flag support to llvm-nm to select the slice out of a Mach-O
Kevin Enderby [Mon, 30 Jun 2014 18:45:23 +0000 (18:45 +0000)]
Add the -arch flag support to llvm-nm to select the slice out of a Mach-O
universal file.  This also includes support for -arch all, selecting the host
architecture by default from a universal file and checking if -arch is used
with a standard Mach-O it matches that architecture.

llvm-svn: 212054

10 years ago[x86] Add Clang support for intrinsic __rdpmc.
Andrea Di Biagio [Mon, 30 Jun 2014 18:23:58 +0000 (18:23 +0000)]
[x86] Add Clang support for intrinsic __rdpmc.

This patch adds intrinsic __rdpmc to header file 'ia32intrin.h'.
Intrinsic __rdmpc can be used to read performance monitoring counters. It is
implemented as a direct call to __builtin_ia32_rdpmc.

It takes as input a value representing the index of the performance counter to
read. The value of the performance counter is then returned as a unsigned
64-bit quantity.

llvm-svn: 212053

10 years agoR600: Move mul combine to separate function
Matt Arsenault [Mon, 30 Jun 2014 17:55:48 +0000 (17:55 +0000)]
R600: Move mul combine to separate function

llvm-svn: 212052

10 years agoR600: Remove unused declarations leftover from AMDIL
Matt Arsenault [Mon, 30 Jun 2014 17:37:17 +0000 (17:37 +0000)]
R600: Remove unused declarations leftover from AMDIL

llvm-svn: 212051

10 years agoDebug info: split out complex DIVariable address expressions into a
Adrian Prantl [Mon, 30 Jun 2014 17:17:35 +0000 (17:17 +0000)]
Debug info: split out complex DIVariable address expressions into a
separate MDNode so they can be uniqued via folding set magic. To conserve
space, DIVariable nodes are still variable-length, with the last two
fields being optional.

No functional change.
http://reviews.llvm.org/D3526

llvm-svn: 212050

10 years ago[X86] Add support for builtin to read performance monitoring counters.
Andrea Di Biagio [Mon, 30 Jun 2014 17:14:21 +0000 (17:14 +0000)]
[X86] Add support for builtin to read performance monitoring counters.

This patch adds support for a new builtin instruction called
__builtin_ia32_rdpmc.

Builtin '__builtin_ia32_rdpmc' is defined as a 'GCC builtin'; on X86, it can
be used to read performance monitoring counters. It takes as input the index
of the performance counter to read, and returns the value of the specified
performance counter as a 64-bit number.

Calls to this new builtin will map to instruction RDPMC.
The index in input to the builtin call is moved to register %ECX. The result
of the builtin call is the value of the specified performance counter (RDPMC
would return that quantity in registers RDX:RAX).

This patch:
 - Adds builtin int_x86_rdpmc as a GCCBuiltin;
 - Adds a new x86 DAG node called 'RDPMC_DAG';
 - Teaches how to lower this new builtin;
 - Adds an ISel pattern to select instruction RDPMC;
 - Fixes the definition of instruction RDPMC adding %RAX and %RDX as
   implicit definitions, and adding %ECX as implicit use;
 - Adds a LLVM test to verify that the new builtin is correctly selected.

llvm-svn: 212049

10 years ago[OCaml] Documentation improvements.
Peter Zotov [Mon, 30 Jun 2014 16:53:53 +0000 (16:53 +0000)]
[OCaml] Documentation improvements.

llvm-svn: 212048

10 years agoRemoved unused typedef for recursive_directory_iterator
Ben Langmuir [Mon, 30 Jun 2014 16:10:15 +0000 (16:10 +0000)]
Removed unused typedef for recursive_directory_iterator

llvm-svn: 212047

10 years agoFix a typo in the noexcept calculation for __compressed_pair::swap. Thanks to EricWF...
Marshall Clow [Mon, 30 Jun 2014 15:35:09 +0000 (15:35 +0000)]
Fix a typo in the noexcept calculation for __compressed_pair::swap. Thanks to EricWF for the bug report and the fix.

llvm-svn: 212046

10 years ago[AArch64] Unsized types don't specify an alignment.
Chad Rosier [Mon, 30 Jun 2014 15:03:00 +0000 (15:03 +0000)]
[AArch64] Unsized types don't specify an alignment.
PR20109

llvm-svn: 212045

10 years ago[AArch64] Convert mul x, -(pow2 +/- 1) to shift + add/sub.
Chad Rosier [Mon, 30 Jun 2014 14:51:14 +0000 (14:51 +0000)]
[AArch64] Convert mul x, -(pow2 +/- 1) to shift + add/sub.

The combine for mul x, pow2 +/- 1 is unchanged. Test cases for
both combines as well as mul x, pow2 have been added as well.

llvm-svn: 212044

10 years agomacho-dump: add code to print LC_ID_DYLIB load commands.
Tim Northover [Mon, 30 Jun 2014 14:40:57 +0000 (14:40 +0000)]
macho-dump: add code to print LC_ID_DYLIB load commands.

I want to check them in lld.

llvm-svn: 212043

10 years agoInitialize ClangTidyMessage::FileOffset field to avoid unitialized variable access...
Alexander Kornienko [Mon, 30 Jun 2014 14:29:03 +0000 (14:29 +0000)]
Initialize ClangTidyMessage::FileOffset field to avoid unitialized variable access when sorting errors on output.

llvm-svn: 212042

10 years agoclang-format: Support member function reference qualifiers.
Daniel Jasper [Mon, 30 Jun 2014 13:54:27 +0000 (13:54 +0000)]
clang-format: Support member function reference qualifiers.

Before:
  string // break
      operator()() &
  {}

After:
  string // break
  operator()() & {}

llvm-svn: 212041

10 years agoclang-format: Improve expression heuristics.
Daniel Jasper [Mon, 30 Jun 2014 13:44:47 +0000 (13:44 +0000)]
clang-format: Improve expression heuristics.

Upon encountering a binary operator inside parentheses, assume that the
parentheses contain an expression.

Before:
  MACRO('0' <= c&& c <= '9');

After:
  MACRO('0' <= c && c <= '9');

llvm-svn: 212040

10 years agoFixing a few typos in the documentation.
Aaron Ballman [Mon, 30 Jun 2014 13:43:04 +0000 (13:43 +0000)]
Fixing a few typos in the documentation.

llvm-svn: 212039

10 years agoclang-format: [JS] support free-standing functions again.
Daniel Jasper [Mon, 30 Jun 2014 13:24:54 +0000 (13:24 +0000)]
clang-format: [JS] support free-standing functions again.

This worked initially but was broken by r210887.

Before:
  function outer1(a, b) {
    function inner1(a, b) { return a; } inner1(a, b);
  } function outer2(a, b) { function inner2(a, b) { return a; } inner2(a, b); }

After:
  function outer1(a, b) {
    function inner1(a, b) { return a; }
    inner1(a, b);
  }
  function outer2(a, b) {
    function inner2(a, b) { return a; }
    inner2(a, b);
  }

Thanks to Adam Strzelecki for working on this.

llvm-svn: 212038

10 years agoRevert the LSDA change to scan_eh_tab.
Logan Chien [Mon, 30 Jun 2014 12:35:29 +0000 (12:35 +0000)]
Revert the LSDA change to scan_eh_tab.

This commit reverts the LSDA-related change in r211745.

The r211745 adds a new argument to scan_eh_tab(), i.e. lsda.
However, IMO, calling _Unwind_GetLanguageSpecificData() directly in
scan_eh_tab() was more intuitive and reduces several function call
to _Unwind_GetLanguageSpecificData() in __cxx_personality_v0().

llvm-svn: 212037

10 years ago[msan] Limit stack origin chain length.
Evgeniy Stepanov [Mon, 30 Jun 2014 11:22:42 +0000 (11:22 +0000)]
[msan] Limit stack origin chain length.

Stack origins were created with unlimited length by mistake.

llvm-svn: 212036

10 years agoMachO: stop iterating past the end of an array
Tim Northover [Mon, 30 Jun 2014 10:30:00 +0000 (10:30 +0000)]
MachO: stop iterating past the end of an array

When trying to map atom types to sections, we were iterating through an array
until we hit a sentinel value. There's no need for such dances when range-based
for loops are available.

llvm-svn: 212035

10 years ago[OPENMP] Added table with allowed nesting info for OpenMP regions (per request from...
Alexey Bataev [Mon, 30 Jun 2014 10:22:46 +0000 (10:22 +0000)]
[OPENMP] Added table with allowed nesting info for OpenMP regions (per request from Samuel F Antao).

llvm-svn: 212034

10 years agoAdded a comment to document relation of this check to -Wold-style-cast.
Alexander Kornienko [Mon, 30 Jun 2014 09:54:12 +0000 (09:54 +0000)]
Added a comment to document relation of this check to -Wold-style-cast.

llvm-svn: 212033

10 years agoMachO: re-enable writing of compact-unwind sections.
Tim Northover [Mon, 30 Jun 2014 09:49:37 +0000 (09:49 +0000)]
MachO: re-enable writing of compact-unwind sections.

This isn't really the right place to put them in final object files (that would
be __TEXT,__unwind_info), but the format is different between relocatable and
final objects, which means we really need a pass to handle the translation.

For now, re-emitting in __LD,__compact_unwind is harmless (dyld ignores it and
moves straight on to inspecting __TEXT,__eh_frame), and sidesteps an assertion
failure when processing files containing compact-unwind info.

llvm-svn: 212032

10 years agoMachO: align segment virtual addresses to page size.
Tim Northover [Mon, 30 Jun 2014 09:49:33 +0000 (09:49 +0000)]
MachO: align segment virtual addresses to page size.

Segments must occupy a multiple of the page size in memory (4096 currently). We
check for this when emitting files, but the placement algorithm broke down for
the second non-__TEXT segment encountered: the offset wasn't aligned up to 4096
before starting its layout.

llvm-svn: 212031

10 years agoMachO: calculate segment offsets in final MachO files properly.
Tim Northover [Mon, 30 Jun 2014 09:49:30 +0000 (09:49 +0000)]
MachO: calculate segment offsets in final MachO files properly.

Because of how we were calculating fileOffset and fileSize for segments, most
ended up at a single offset in a finalised MachO file. This meant the data
often didn't even get written in the final object, let alone where it would be
useful.

llvm-svn: 212030

10 years agoARM: take care not to set the ThumbFunc bit on TLS data symbols
Scott Douglass [Mon, 30 Jun 2014 09:37:24 +0000 (09:37 +0000)]
ARM: take care not to set the ThumbFunc bit on TLS data symbols

This fixes LNT SingleSource/UnitTests/Threads with -mthumb.

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

llvm-svn: 212029

10 years agoSecond part of fix in CodeGen/captured-statements-nested.c
Alexey Bataev [Mon, 30 Jun 2014 09:14:10 +0000 (09:14 +0000)]
Second part of fix in CodeGen/captured-statements-nested.c

llvm-svn: 212028

10 years agoMachO: support atomization of dylibs.
Tim Northover [Mon, 30 Jun 2014 09:11:38 +0000 (09:11 +0000)]
MachO: support atomization of dylibs.

For .dylib files, we refrain from actually creating any atoms until they're
requested via the "exports" method.

llvm-svn: 212027

10 years agoTest fix
Alexey Bataev [Mon, 30 Jun 2014 09:05:08 +0000 (09:05 +0000)]
Test fix

llvm-svn: 212026

10 years agoFixed incompatibility in CodeGen/captured-statements-nested.c with MSVC
Alexey Bataev [Mon, 30 Jun 2014 08:37:48 +0000 (08:37 +0000)]
Fixed incompatibility in CodeGen/captured-statements-nested.c with MSVC

llvm-svn: 212025

10 years agoFixed CodeGen/captured-statements-nested.c test
Alexey Bataev [Mon, 30 Jun 2014 08:17:11 +0000 (08:17 +0000)]
Fixed CodeGen/captured-statements-nested.c test

llvm-svn: 212024

10 years ago[Driver][Mips] Fix test cases - make ABI name and target triple consistent.
Simon Atanasyan [Mon, 30 Jun 2014 08:10:01 +0000 (08:10 +0000)]
[Driver][Mips] Fix test cases - make ABI name and target triple consistent.

No functional changes.

llvm-svn: 212023

10 years ago[Driver][Mips] Check rejecting of invalid MIPS ABI names in the test.
Simon Atanasyan [Mon, 30 Jun 2014 08:09:54 +0000 (08:09 +0000)]
[Driver][Mips] Check rejecting of invalid MIPS ABI names in the test.

No functional changes.

llvm-svn: 212022

10 years agoundo test commit (whitespace only)
Scott Douglass [Mon, 30 Jun 2014 08:09:35 +0000 (08:09 +0000)]
undo test commit (whitespace only)

llvm-svn: 212021

10 years agotest commit (whitespace only)
Scott Douglass [Mon, 30 Jun 2014 08:07:32 +0000 (08:07 +0000)]
test commit (whitespace only)

llvm-svn: 212020

10 years agotest commit: add a comment line in GVN test file
Erik Eckstein [Mon, 30 Jun 2014 07:19:02 +0000 (07:19 +0000)]
test commit: add a comment line in GVN test file

llvm-svn: 212019

10 years agoDisable CodeGen/captured-statements-nested.c
Alexey Bataev [Mon, 30 Jun 2014 05:07:42 +0000 (05:07 +0000)]
Disable CodeGen/captured-statements-nested.c

llvm-svn: 212018

10 years agoAdd checking for the complexity guarantees in the standard
Marshall Clow [Mon, 30 Jun 2014 05:04:20 +0000 (05:04 +0000)]
Add checking for the complexity guarantees in the standard

llvm-svn: 212017

10 years agoFixed CodeGen/captured-statements-nested.c test
Alexey Bataev [Mon, 30 Jun 2014 05:02:50 +0000 (05:02 +0000)]
Fixed CodeGen/captured-statements-nested.c test

llvm-svn: 212016

10 years agoFactored out Linux proc file reading into separate class.
Todd Fiala [Mon, 30 Jun 2014 04:14:13 +0000 (04:14 +0000)]
Factored out Linux proc file reading into separate class.

Both NativeProcessLinux (in llgs branch) and Linux Host.cpp had similar code to handle /proc
file reading.  I factored that out into a new Linux-specific ProcFileReader class and added a method
that the llgs branch will use for line-by-line parsing.

This change also adds numerous Linux-specific files to Xcode that were missing from the Xcode
project files.

Related to https://github.com/tfiala/lldb/issues/27

llvm-svn: 212015

10 years agoDisable CodeGen/captured-statements-nested.c
Alexey Bataev [Mon, 30 Jun 2014 03:30:41 +0000 (03:30 +0000)]
Disable CodeGen/captured-statements-nested.c

llvm-svn: 212014

10 years agoTemp XFAIL CodeGen/captured-statements-nested.c to fix the test
Alexey Bataev [Mon, 30 Jun 2014 03:14:43 +0000 (03:14 +0000)]
Temp XFAIL CodeGen/captured-statements-nested.c to fix the test

llvm-svn: 212013

10 years agoX86: fix comment
Saleem Abdulrasool [Mon, 30 Jun 2014 03:11:18 +0000 (03:11 +0000)]
X86: fix comment

Fix a comment typo `DbgLocLImport` instead of `DLLImport`.

llvm-svn: 212012

10 years agoARM: use symbolic name for constant
Saleem Abdulrasool [Mon, 30 Jun 2014 03:11:14 +0000 (03:11 +0000)]
ARM: use symbolic name for constant

This just changes the constant value to the symbolic name corresponding to it.
NFC.

llvm-svn: 212011

10 years agoUsing of variable length arrays in captured statements and OpenMP constructs.
Alexey Bataev [Mon, 30 Jun 2014 02:55:54 +0000 (02:55 +0000)]
Using of variable length arrays in captured statements and OpenMP constructs.
Differential Revision: http://reviews.llvm.org/D4067

llvm-svn: 212010

10 years agotest: move test from CodeGen to Sema
Saleem Abdulrasool [Mon, 30 Jun 2014 02:14:37 +0000 (02:14 +0000)]
test: move test from CodeGen to Sema

Move test from CodeGen to Sema to more accurately reflect what is being tested
as pointed out by Alp.

llvm-svn: 212009

10 years agoRemove some incorrect test suppressions
Alp Toker [Mon, 30 Jun 2014 01:34:09 +0000 (01:34 +0000)]
Remove some incorrect test suppressions

These don't actually require any registered backend to run.

This commit tests the water with a handful of fixes for what is a more
widespread problem.

llvm-svn: 212008

10 years agoCodeGenAction::ExecuteAction(): check for invalid LLVM source locations
Alp Toker [Mon, 30 Jun 2014 01:33:59 +0000 (01:33 +0000)]
CodeGenAction::ExecuteAction(): check for invalid LLVM source locations

Add sign checks to deal with the fact that IR parser line/column pairs are
signed integers and sometimes invalid.

The crash path is potentially triggered by corrupt '.bc' files in practice,
though I don't have a binary input test case that can be checked-in right now.

(Unfortunately the backend itself crashes on various ill-formed '.bc' inputs so
this bandage isn't as helpful as it appears yet.)

llvm-svn: 212007