platform/upstream/llvm.git
9 years agoARM: set preferred aggregate alignment to 32 universally.
Tim Northover [Tue, 14 Oct 2014 20:57:29 +0000 (20:57 +0000)]
ARM: set preferred aggregate alignment to 32 universally.

Before, ARM and Thumb mode code had different preferred alignments, which could
lead to some rather unexpected results. There's justification for reducing it
from the default 64-bits (wasted space), but I don't think there is for going
below 32-bits.

There's no actual ABI change here, just to reassure people.

llvm-svn: 219720

9 years agoARM: set preferred aggregate alignment to 32 universally.
Tim Northover [Tue, 14 Oct 2014 20:57:26 +0000 (20:57 +0000)]
ARM: set preferred aggregate alignment to 32 universally.

Before, ARM and Thumb mode code had different preferred alignments, which could
lead to some rather unexpected results. There's justification for reducing it
from the default 64-bits (wasted space), but I don't think there is for going
below 32-bits.

There's no actual ABI change here, just to reassure people.

llvm-svn: 219719

9 years ago[CFL-AA] CFL-AA should not assert on an va_arg instruction
Hal Finkel [Tue, 14 Oct 2014 20:51:26 +0000 (20:51 +0000)]
[CFL-AA] CFL-AA should not assert on an va_arg instruction

The CFL-AA implementation was missing a visit* routine for va_arg instructions,
causing it to assert when run on a function that had one. For now, handle these
in a conservative way.

Fixes PR20954.

llvm-svn: 219718

9 years agoOptimize away fabs() calls when input is squared (known positive).
Sanjay Patel [Tue, 14 Oct 2014 20:43:11 +0000 (20:43 +0000)]
Optimize away fabs() calls when input is squared (known positive).

Eliminate library calls and intrinsic calls to fabs when the input
is a squared value.

Note that no unsafe-math / fast-math assumptions are needed for
this optimization.

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

llvm-svn: 219717

9 years ago[FastISel][AArch64] Fix sign-/zero-extend folding when SelectionDAG is involved.
Juergen Ributzka [Tue, 14 Oct 2014 20:36:02 +0000 (20:36 +0000)]
[FastISel][AArch64] Fix sign-/zero-extend folding when SelectionDAG is involved.

Sign-/zero-extend folding depended on the load and the integer extend to be
both selected by FastISel. This cannot always be garantueed and SelectionDAG
might interfer. This commit adds additonal checks to load and integer extend
lowering to catch this.

Related to rdar://problem/18495928.

llvm-svn: 219716

9 years agoAdd complex multiply/divide functions to arm64 iOS libclang_rt libraries.
Bob Wilson [Tue, 14 Oct 2014 20:33:36 +0000 (20:33 +0000)]
Add complex multiply/divide functions to arm64 iOS libclang_rt libraries.

Clang r219557 introduces libcalls to complex multiply/divide functions.
Since these functions are not available in iOS for arm64 devices, add them to
the static libraries.

llvm-svn: 219715

9 years agoFactor code into CXXRecordDecl::getTemplateInstantiationPattern() helper
Reid Kleckner [Tue, 14 Oct 2014 20:28:40 +0000 (20:28 +0000)]
Factor code into CXXRecordDecl::getTemplateInstantiationPattern() helper

This moves some code from SemaType.cpp's hasVisibleDefinition() into
DeclCXX.cpp so that it can be used elsewhere. I found one other instance
of code trying to do the same thing, there are probably more. Search for
getInstantiatedFrom() to try to find more.

No functionality change.

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 219714

9 years agoInstCombine: Don't miscompile X % ((Pow2 << A) >>u B)
David Majnemer [Tue, 14 Oct 2014 20:28:40 +0000 (20:28 +0000)]
InstCombine: Don't miscompile X % ((Pow2 << A) >>u B)

We assumed that A must be greater than B because the right hand side of
a remainder operator must be nonzero.

However, it is possible for A to be less than B if Pow2 is a power of
two greater than 1.

Take for example:
i32 %A = 0
i32 %B = 31
i32 Pow2 = 2147483648

((Pow2 << 0) >>u 31) is non-zero but A is less than B.

This fixes PR21274.

llvm-svn: 219713

9 years agoPatch to warn on interger overflow in presence of
Fariborz Jahanian [Tue, 14 Oct 2014 20:27:05 +0000 (20:27 +0000)]
Patch to warn on interger overflow in presence of
implicit casts. Reviewed by Reid Kleckner.
rdar://18405357

llvm-svn: 219712

9 years agoFixed stdio redirection within LLDB to "do the right thing" in all cases.
Greg Clayton [Tue, 14 Oct 2014 20:18:05 +0000 (20:18 +0000)]
Fixed stdio redirection within LLDB to "do the right thing" in all cases.

The main issue was if you didn't specify all three (stdin/out/err), you would get file actions added to the launch that would always use the pseudo terminal. This is now fixed.

Also fixed the test suite test that handles IO to test redirecting things individually and all together and in other combinations to make sure we don't regress.

<rdar://problem/18638226>

llvm-svn: 219711

9 years agoReapply "R600: Add new intrinsic to read work dimensions"
Jan Vesely [Tue, 14 Oct 2014 20:05:26 +0000 (20:05 +0000)]
Reapply "R600: Add new intrinsic to read work dimensions"

This effectively reverts revert 219707. After fixing the test to work with
new function name format and renamed intrinsic.

Reviewed-by: Tom Stellard <tom@stellard.net>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 219710

9 years agoUse llvm::make_unique.
Rui Ueyama [Tue, 14 Oct 2014 19:43:37 +0000 (19:43 +0000)]
Use llvm::make_unique.

llvm-svn: 219709

9 years agoRevert "r216914 - Revert: [APFloat] Fixed a bug in method 'fusedMultiplyAdd'"
Hal Finkel [Tue, 14 Oct 2014 19:23:07 +0000 (19:23 +0000)]
Revert "r216914 - Revert: [APFloat] Fixed a bug in method 'fusedMultiplyAdd'"

Reapply r216913, a fix for PR20832 by Andrea Di Biagio. The commit was reverted
because of buildbot failures, and credit goes to Ulrich Weigand for isolating
the underlying issue (which can be confirmed by Valgrind, which does helpfully
light up like the fourth of July). Uli explained the problem with the original
patch as:

  It seems the problem is calling multiplySignificand with an addend of category
  fcZero; that is not expected by this routine.  Note that for fcZero, the
  significand parts are simply uninitialized, but the code in (or rather, called
  from) multiplySignificand will unconditionally access them -- in effect using
  uninitialized contents.

This version avoids using a category == fcZero addend within
multiplySignificand, which avoids this problem (the Valgrind output is also now
clean).

Original commit message:

[APFloat] Fixed a bug in method 'fusedMultiplyAdd'.

When folding a fused multiply-add builtin call, make sure that we propagate the
correct result in the case where the addend is zero, and the two other operands
are finite non-zero.

Example:
  define double @test() {
    %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0.0)
    ret double %1
  }

Before this patch, the instruction simplifier wrongly folded the builtin call
in function @test to constant 'double 7.0'.
With this patch, method 'fusedMultiplyAdd' correctly evaluates the multiply and
propagates the expected result (i.e. 56.0).

Added test fold-builtin-fma.ll with the reproducible from PR20832 plus extra
test cases to verify the behavior of method 'fusedMultiplyAdd' in the presence
of NaN/Inf operands.

This fixes PR20832.

llvm-svn: 219708

9 years agoRevert "R600: Add new intrinsic to read work dimensions"
Rafael Espindola [Tue, 14 Oct 2014 18:58:04 +0000 (18:58 +0000)]
Revert "R600: Add new intrinsic to read work dimensions"

This reverts commit r219705.

CodeGen/R600/work-item-intrinsics.ll was failing on linux.

llvm-svn: 219707

9 years agoRemove unused member variable.
Rafael Espindola [Tue, 14 Oct 2014 18:53:16 +0000 (18:53 +0000)]
Remove unused member variable.

Fixes pr20904.

llvm-svn: 219706

9 years agoR600: Add new intrinsic to read work dimensions
Jan Vesely [Tue, 14 Oct 2014 18:52:07 +0000 (18:52 +0000)]
R600: Add new intrinsic to read work dimensions

v2: Add SI lowering
    Add test

v3: Place work dimensions after the kernel arguments.
v4: Calculate offset while lowering arguments
v5: rebase
v6: change prefix to AMDGPU

Reviewed-by: Tom Stellard <tom@stellard.net>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 219705

9 years agoR600: FMA is VecALU only instruction
Jan Vesely [Tue, 14 Oct 2014 18:52:04 +0000 (18:52 +0000)]
R600: FMA is VecALU only instruction

Reviewed-by: Tom Stellard <tom@stellard.net>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 219704

9 years agoFinish getting Mips fast-isel to match up with AArch64 fast-isel
Reed Kotler [Tue, 14 Oct 2014 18:27:58 +0000 (18:27 +0000)]
Finish getting Mips fast-isel to match up with AArch64 fast-isel

Summary:
In order to facilitate use of common code, checking by reviewers of other fast-isel ports, and hopefully to eventually move most of Mips and other fast-isel ports into target independent code, I've tried to get the two implementations to line up.

There is no functional code change. Just methods moved in the file to be in the same order as in AArch64.

Test Plan: No functional change.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits, aemerson, rfuhler

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

llvm-svn: 219703

9 years agoDebugInfo: Ensure that all debug location scope chains from instructions within a...
David Blaikie [Tue, 14 Oct 2014 18:22:52 +0000 (18:22 +0000)]
DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself.

Let me tell you a tale...

Originally committed in r211723 after discovering a nasty case of weird
scoping due to inlining, this was reverted in r211724 after it fired in
ASan/compiler-rt.

(minor diversion where I accidentally committed/reverted again in
r211871/r211873)

After further testing and fixing bugs in ArgumentPromotion (r211872) and
Inlining (r212065) it was recommitted in r212085. Reverted in r212089
after the sanitizer buildbots still showed problems.

Fixed another bug in ArgumentPromotion (r212128) found by this
assertion.

Recommitted in r212205, reverted in r212226 after it crashed some more
on sanitizer buildbots.

Fix clang some more in r212761.

Recommitted in r212776, reverted in r212793. ASan failures.
Recommitted in r213391, reverted in r213432, trying to reproduce flakey
ASan build failure.

Fixed bugs in r213805 (ArgPromo + DebugInfo), r213952
(LiveDebugVariables strips dbg_value intrinsics in functions not
described by debug info).

Recommitted in r214761, reverted in r214999, flakey failure on Windows
buildbot.

Fixed DeadArgElimination + DebugInfo bug in r219210.

Recommitted in r219215, reverted in r219512, failure on ObjC++ atomic
properties in the test-suite on Darwin.

Fixed ObjC++ atomic properties issue in Clang in r219690.

[This commit is provided 'as is' with no hope that this is the last time
I commit this change either expressed or implied]

llvm-svn: 219702

9 years agoSkip asan test on FreeBSD
Ed Maste [Tue, 14 Oct 2014 18:04:47 +0000 (18:04 +0000)]
Skip asan test on FreeBSD

The build fails due to missing asan runtime in the FreeBSD base system.
Instead of marking it expected fail, just skip until we have the runtime
available.

llvm.org/pr21136

llvm-svn: 219701

9 years agoRemove method that is identical to the base class one.
Rafael Espindola [Tue, 14 Oct 2014 17:38:38 +0000 (17:38 +0000)]
Remove method that is identical to the base class one.

llvm-svn: 219700

9 years ago[UBSan] XFAIL test added in r219642 on Darwin
Alexey Samsonov [Tue, 14 Oct 2014 17:31:15 +0000 (17:31 +0000)]
[UBSan] XFAIL test added in r219642 on Darwin

llvm-svn: 219699

9 years agoR600/SI: Use DS offsets for constant addresses
Matt Arsenault [Tue, 14 Oct 2014 17:21:19 +0000 (17:21 +0000)]
R600/SI: Use DS offsets for constant addresses

Use 0 as the base address for a constant address, so if
we have a constant address we can save moves and form
read2/write2s.

llvm-svn: 219698

9 years agoCodeGen: correct block mangling in ObjC
Saleem Abdulrasool [Tue, 14 Oct 2014 17:20:18 +0000 (17:20 +0000)]
CodeGen: correct block mangling in ObjC

Mangling for blocks defined within blocks in an ObjectiveC context were also
broken by SVN r219393.  Because the code in mangleName assumed that the code was
either C or C++, we would trigger assertions when trying to mangle the inner
blocks in an ObjectiveC context.

Add a test and use the ObjectiveC specific mangling when dealing with an
ObjectiveC method declaration.

llvm-svn: 219697

9 years agoCodeGen: correct mangling for blocks
Saleem Abdulrasool [Tue, 14 Oct 2014 17:20:14 +0000 (17:20 +0000)]
CodeGen: correct mangling for blocks

This addresses a regression introduced with SVN r219393.  A block may be
contained within another block.  In such a scenario, we would end up within a
BlockDecl, which is not a NamedDecl (as the names are synthesised).  The cast to
a NamedDecl of the DeclContext would then assert as the types are unrelated.

Restore the mangling behaviour to that prior to SVN r219393.  If the current
block is contained within a BlockDecl, walk up to the parent DeclContext,
recursively, until we have a non-BlockDecl.  This is expected to be a NamedDecl.
Add in a couple of asserts to ensure that the assumption that we only encounter
a block within a NamedDecl or a BlockDecl.

llvm-svn: 219696

9 years agoRevert "Fix stuff... again."
David Blaikie [Tue, 14 Oct 2014 17:13:09 +0000 (17:13 +0000)]
Revert "Fix stuff... again."

Accidental commit.

This reverts commit r219693.

llvm-svn: 219695

9 years agoRevert some parts of r196288 that were confusing and untested.
David Blaikie [Tue, 14 Oct 2014 17:12:02 +0000 (17:12 +0000)]
Revert some parts of r196288 that were confusing and untested.

If we figure out why they should be here, let's add some testing of some
kind so we can better demonstrate why it's needed.

llvm-svn: 219694

9 years agoFix stuff... again.
David Blaikie [Tue, 14 Oct 2014 17:11:59 +0000 (17:11 +0000)]
Fix stuff... again.

llvm-svn: 219693

9 years agoFormatting for prior commit
David Blaikie [Tue, 14 Oct 2014 17:09:38 +0000 (17:09 +0000)]
Formatting for prior commit

llvm-svn: 219692

9 years ago[SystemZ] Address review comments for r219679
Ulrich Weigand [Tue, 14 Oct 2014 16:46:45 +0000 (16:46 +0000)]
[SystemZ] Address review comments for r219679

llvm-svn: 219691

9 years agoDebugInfo: Don't leak location information from one function into the prologue of...
David Blaikie [Tue, 14 Oct 2014 16:43:46 +0000 (16:43 +0000)]
DebugInfo: Don't leak location information from one function into the prologue of the next function.

CodeGenFunction objects aren't really designed to be reused for more
than one function, and doing so can leak debug info location information
from one function into the prologue of the next.

Add an assertion in to catch reuses of CodeGenFunction, which
surprisingly only caught the ObjC atomic getter/setter cases. Fix those
and add a test to demonstrate the issue.

The test is a bit slim, because we're just testing for the absence of a
debug location on the prologue instructions, which by itself probably
wouldn't be the end of the world - but the particular debug location
that was ending up there was for the previous function's last
instruction. This produced debug info for another function within this
function, which is something I'm trying to remove all cases of as its a
substantial source of bugs, especially around inlining (see r219215).

llvm-svn: 219690

9 years agoFix dotest.py test runner exit code to return non-zero on failure/error.
Todd Fiala [Tue, 14 Oct 2014 16:17:02 +0000 (16:17 +0000)]
Fix dotest.py test runner exit code to return non-zero on failure/error.

This addresses this bug:
http://www.llvm.org/bugs/show_bug.cgi?id=21267

Which has been broken since svn r215256 on Aug 8 2014.

DO NOT REVERT THIS COMMIT EVEN IF IT CREATES TEST FAILURES.

The test failures are a result of accumulation of hidden failures
that were masked by the bug this change fixes.  Most of our test
runners as part of build testing rely on dotest.py returning non-zero to indicate
some kind of errant test run.  Thus, we have been flying blind
since Aug 8 2014.

llvm-svn: 219689

9 years ago[LVI] Check for @llvm.assume dominating the edge branch
Hal Finkel [Tue, 14 Oct 2014 16:04:49 +0000 (16:04 +0000)]
[LVI] Check for @llvm.assume dominating the edge branch

When LazyValueInfo uses @llvm.assume intrinsics to provide edge-value
constraints, we should check for intrinsics that dominate the edge's branch,
not just any potential context instructions. An assumption that dominates the
edge's branch represents a truth on that edge. This is specifically useful, for
example, if multiple predecessors assume a pointer to be nonnull, allowing us
to simplify a later null comparison.

The test case, and an initial patch, were provided by Philip Reames. Thanks!

llvm-svn: 219688

9 years agoRevert r219638, (r219640 and r219676), "Removing the static destructor from ManagedSt...
NAKAMURA Takumi [Tue, 14 Oct 2014 15:58:16 +0000 (15:58 +0000)]
Revert r219638, (r219640 and r219676), "Removing the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocation of the mutex."

It caused hang-up on msc17 builder, probably deadlock.

llvm-svn: 219687

9 years ago[AVX512] Extended avx512_binop_rm to DQ/VL subsets.
Robert Khasanov [Tue, 14 Oct 2014 15:13:56 +0000 (15:13 +0000)]
[AVX512] Extended avx512_binop_rm to DQ/VL subsets.
Added encoding tests.

llvm-svn: 219686

9 years ago[AVX512] Extended avx512_binop_rm to BW/VL subsets.
Robert Khasanov [Tue, 14 Oct 2014 14:36:19 +0000 (14:36 +0000)]
[AVX512] Extended avx512_binop_rm to BW/VL subsets.
Added encoding tests.

llvm-svn: 219685

9 years ago[AArch64] Fix crash with empty/pseudo-only blocks in A53 erratum (835769) workaround
Bradley Smith [Tue, 14 Oct 2014 14:02:41 +0000 (14:02 +0000)]
[AArch64] Fix crash with empty/pseudo-only blocks in A53 erratum (835769) workaround

llvm-svn: 219684

9 years ago[sanitizer] Fix a crash in FP unwinder on ARM.
Evgeniy Stepanov [Tue, 14 Oct 2014 13:46:07 +0000 (13:46 +0000)]
[sanitizer] Fix a crash in FP unwinder on ARM.

This change fixes 2 issues in the fast unwinder from r217079:
* A crash if a frame pointer points below current stack head, but
  inside the current thread stack limits. That memory may be
  unmapped. A check for this was lost in r217079.
* The last valid stack frame (the first one with an invalid next
  frame pointer) is always interpreted as a GCC layout frame. This
  results in garbled last PC in the (expected) case when the last
  frame has LLVM layout.

llvm-svn: 219683

9 years ago[llvm-symbolizer] Minor typedef cleanup. NFC.
Alexander Potapenko [Tue, 14 Oct 2014 13:40:44 +0000 (13:40 +0000)]
[llvm-symbolizer] Minor typedef cleanup. NFC.

llvm-svn: 219682

9 years agoFix silly commit to disable test on ARM
Renato Golin [Tue, 14 Oct 2014 12:32:47 +0000 (12:32 +0000)]
Fix silly commit to disable test on ARM

llvm-svn: 219681

9 years agoDisable failing ASAN LongJump test on ARM
Renato Golin [Tue, 14 Oct 2014 12:24:28 +0000 (12:24 +0000)]
Disable failing ASAN LongJump test on ARM

Updated the URL to reflect information on the problem as well as build the
case for ARM. This seems to be a wider problem, not ARM or PPC specific.

llvm-svn: 219680

9 years ago[SystemZ] Add test case to verify default use of integrated assembler
Ulrich Weigand [Tue, 14 Oct 2014 11:45:53 +0000 (11:45 +0000)]
[SystemZ] Add test case to verify default use of integrated assembler

llvm-svn: 219679

9 years agotsan: remove trailing whitespace
Dmitry Vyukov [Tue, 14 Oct 2014 09:46:56 +0000 (09:46 +0000)]
tsan: remove trailing whitespace

llvm-svn: 219678

9 years ago[asan] Add fast_unwind_on_check flag.
Evgeniy Stepanov [Tue, 14 Oct 2014 09:36:24 +0000 (09:36 +0000)]
[asan] Add fast_unwind_on_check flag.

Allows to specify the unwinder to use for CHECK failures. Previous behaviour
was to use the "fatal" unwinder.
As compiler-rt is built without frame pointers, only the slow unwinder
really makes sense here, and it is the default.

llvm-svn: 219677

9 years agoThreading.h: Use \tparam for template parameters. [-Wdocumentation]
NAKAMURA Takumi [Tue, 14 Oct 2014 09:34:16 +0000 (09:34 +0000)]
Threading.h: Use \tparam for template parameters. [-Wdocumentation]

llvm-svn: 219676

9 years agotsan: refactor atexit handling
Dmitry Vyukov [Tue, 14 Oct 2014 09:32:45 +0000 (09:32 +0000)]
tsan: refactor atexit handling
The current handling (manual execution of atexit callbacks)
is overly complex and leads to constant problems due to mutual ordering of callbacks.
Instead simply wrap callbacks into our wrapper to establish
the necessary synchronization.
Fixes issue https://code.google.com/p/thread-sanitizer/issues/detail?id=80

llvm-svn: 219675

9 years agoGrab the subtarget info off of the MachineFunction rather than
Eric Christopher [Tue, 14 Oct 2014 08:44:19 +0000 (08:44 +0000)]
Grab the subtarget info off of the MachineFunction rather than
indirecting through the TargetMachine.

llvm-svn: 219674

9 years agoUse the triple to figure out if this is a darwin target, not
Eric Christopher [Tue, 14 Oct 2014 08:25:26 +0000 (08:25 +0000)]
Use the triple to figure out if this is a darwin target, not
the subtarget.

llvm-svn: 219673

9 years agoRemove unnecessary TargetMachine.h includes.
Eric Christopher [Tue, 14 Oct 2014 07:22:08 +0000 (07:22 +0000)]
Remove unnecessary TargetMachine.h includes.

llvm-svn: 219672

9 years agoGrab the subtarget and subtarget dependent variables off of
Eric Christopher [Tue, 14 Oct 2014 07:22:00 +0000 (07:22 +0000)]
Grab the subtarget and subtarget dependent variables off of
MachineFunction rather than TargetMachine.

llvm-svn: 219671

9 years agoGrab the subtarget and subtarget dependent variables off of
Eric Christopher [Tue, 14 Oct 2014 07:17:23 +0000 (07:17 +0000)]
Grab the subtarget and subtarget dependent variables off of
MachineFunction rather than TargetMachine.

llvm-svn: 219670

9 years agoInstead of the TargetMachine cache the MachineFunction
Eric Christopher [Tue, 14 Oct 2014 07:17:20 +0000 (07:17 +0000)]
Instead of the TargetMachine cache the MachineFunction
and TargetRegisterInfo in the peephole optimizer. This
makes it easier to grab subtarget dependent variables off
of the MachineFunction rather than the TargetMachine.

llvm-svn: 219669

9 years agoAccess subtarget specific variables off of the MachineFunction's
Eric Christopher [Tue, 14 Oct 2014 07:00:33 +0000 (07:00 +0000)]
Access subtarget specific variables off of the MachineFunction's
cached subtarget and not the TargetMachine.

llvm-svn: 219668

9 years agoAdd lld to the parallel set of directories since it doesn't depend
Eric Christopher [Tue, 14 Oct 2014 06:56:28 +0000 (06:56 +0000)]
Add lld to the parallel set of directories since it doesn't depend
on any of the other tools directories.

llvm-svn: 219667

9 years agoAccess the subtarget off of the MachineFunction via the DAG
Eric Christopher [Tue, 14 Oct 2014 06:56:25 +0000 (06:56 +0000)]
Access the subtarget off of the MachineFunction via the DAG
scheduler or via the SelectionDAG if available. Otherwise
grab the subtarget off of the MachineFunction by going up
the parent chain.

llvm-svn: 219666

9 years ago[AArch64]Select wide immediate offset into [Base+XReg] addressing mode
Hao Liu [Tue, 14 Oct 2014 06:50:36 +0000 (06:50 +0000)]
[AArch64]Select wide immediate offset into [Base+XReg] addressing mode
e.g Currently we'll generate following instructions if the immediate is too wide:
    MOV  X0, WideImmediate
    ADD  X1, BaseReg, X0
    LDR  X2, [X1, 0]

    Using [Base+XReg] addressing mode can save one ADD as following:
    MOV  X0, WideImmediate
    LDR  X2, [BaseReg, X0]

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

llvm-svn: 219665

9 years agoRe-apply "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic...
Justin Bogner [Tue, 14 Oct 2014 06:30:31 +0000 (06:30 +0000)]
Re-apply "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"

I'd mispelled "Bitcode/BitCodes.h" before, and tested on a case
insensitive filesystem.

This reverts commit r219649, effectively re-applying r219647 and
r219648.

llvm-svn: 219664

9 years agoRemove the use and member variable of the TargetMachine from
Eric Christopher [Tue, 14 Oct 2014 06:26:57 +0000 (06:26 +0000)]
Remove the use and member variable of the TargetMachine from
MachineLICM as we can get the same data off of the MachineFunction.

llvm-svn: 219663

9 years agoHave MachineInstrBundle use the MachineFunction for subtarget
Eric Christopher [Tue, 14 Oct 2014 06:26:55 +0000 (06:26 +0000)]
Have MachineInstrBundle use the MachineFunction for subtarget
access rather than the TargetMachine.

llvm-svn: 219662

9 years agoAccess the subtarget off of the MachineFunction rather than
Eric Christopher [Tue, 14 Oct 2014 06:26:53 +0000 (06:26 +0000)]
Access the subtarget off of the MachineFunction rather than
through the TargetMachine.

llvm-svn: 219661

9 years agoUse PARALLEL_DIRS instead of DIRS in the Makefile
Eric Christopher [Tue, 14 Oct 2014 06:26:33 +0000 (06:26 +0000)]
Use PARALLEL_DIRS instead of DIRS in the Makefile
based build since the subdirectories all appear to
have no inter-directory dependencies. This speeds
up parallel makefile builds greatly.

llvm-svn: 219660

9 years agoExtend -Rmodule-build to also remark when module building finishes.
Richard Smith [Tue, 14 Oct 2014 02:08:30 +0000 (02:08 +0000)]
Extend -Rmodule-build to also remark when module building finishes.

In cases of nested module builds, or when you care how long module builds take,
this information was not previously easily available / obvious.

llvm-svn: 219658

9 years ago[modules] Merging for class-scope using-declarations.
Richard Smith [Tue, 14 Oct 2014 02:00:47 +0000 (02:00 +0000)]
[modules] Merging for class-scope using-declarations.

llvm-svn: 219657

9 years agoSwitch to select optimization for two-case switches
Marcello Maggioni [Tue, 14 Oct 2014 01:58:26 +0000 (01:58 +0000)]
Switch to select optimization for two-case switches

This is the same optimization of r219233 with modifications to support PHIs with multiple incoming edges from the same block
and a test to check that this condition is handled.

llvm-svn: 219656

9 years ago[mach-o] Add Pass to create are shim Atoms for ARM interworking.
Nick Kledzik [Tue, 14 Oct 2014 01:51:42 +0000 (01:51 +0000)]
[mach-o] Add Pass to create are shim Atoms for ARM interworking.

Arm code has two instruction encodings "thumb" and "arm".  When branching from
one code encoding to another, you need to use an instruction that switches
the instruction mode.  Usually the transition only happens at call sites, and
the linker can transform a BL instruction in BLX (or vice versa).  But if the
compiler did a tail call optimization and a function ends with a branch (not
branch and link), there is no pc-rel BX instruction.

The ShimPass looks for pc-rel B instructions that will need to switch mode.
For those cases it synthesizes a shim which does the transition, then modifies
the original atom with the B instruction to target to the shim atom.

llvm-svn: 219655

9 years agoThis adds a "batch mode" to lldb kinda like the gdb batch mode. It will quit the...
Jim Ingham [Tue, 14 Oct 2014 01:20:07 +0000 (01:20 +0000)]
This adds a "batch mode" to lldb kinda like the gdb batch mode.  It will quit the debugger
after all the commands have been executed except if one of the commands was an execution control
command that stopped because of a signal or exception.

Also adds a variant of SBCommandInterpreter::HandleCommand that takes an SBExecutionContext.  That
way you can run an lldb command targeted at a particular target, thread or process w/o having to
select same before running the command.

Also exposes CommandInterpreter::HandleCommandsFromFile to the SBCommandInterpreter API, since that
seemed generally useful.

llvm-svn: 219654

9 years agoDon't include DFAPacketizer in TargetInstrInfo, there's no reason.
Eric Christopher [Tue, 14 Oct 2014 01:13:53 +0000 (01:13 +0000)]
Don't include DFAPacketizer in TargetInstrInfo, there's no reason.

llvm-svn: 219653

9 years agoInclude map into the A15SDOptimizer rather than pick it up
Eric Christopher [Tue, 14 Oct 2014 01:13:51 +0000 (01:13 +0000)]
Include map into the A15SDOptimizer rather than pick it up
transitively from the DFAPacketizer via TargetInstrInfo.h.

llvm-svn: 219652

9 years agoRemove the TargetMachine from DFAPacketizer since it was only
Eric Christopher [Tue, 14 Oct 2014 01:03:16 +0000 (01:03 +0000)]
Remove the TargetMachine from DFAPacketizer since it was only
being used to grab subtarget specific things that we can grab
from the MachineFunction anyhow.

llvm-svn: 219650

9 years agoRevert "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"
Justin Bogner [Tue, 14 Oct 2014 00:57:34 +0000 (00:57 +0000)]
Revert "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"

The bots can't seem to find an include file. Reverting for now and
I'll look into it in a bit.

This reverts commits r219647 and r219648.

llvm-svn: 219649

9 years agoFrontend: Try to fix cmake builders after r219647
Justin Bogner [Tue, 14 Oct 2014 00:51:18 +0000 (00:51 +0000)]
Frontend: Try to fix cmake builders after r219647

Looks like I missed a dependency here.

llvm-svn: 219648

9 years agoFrontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)
Justin Bogner [Tue, 14 Oct 2014 00:40:55 +0000 (00:40 +0000)]
Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)

We currently read serialized diagnostics directly in the C API, which
makes it difficult to reuse this logic elsewhere. This extracts the
core of the serialized diagnostic parsing logic into a base class that
can be subclassed using a visitor pattern.

llvm-svn: 219647

9 years agoIntroduce Go coding standards for LLVM.
Peter Collingbourne [Tue, 14 Oct 2014 00:40:53 +0000 (00:40 +0000)]
Introduce Go coding standards for LLVM.

Rather than define our own standards, we adopt a set of best practices that
are already in use by the Go community.

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

llvm-svn: 219646

9 years agofix formatting; NFC
Sanjay Patel [Tue, 14 Oct 2014 00:33:23 +0000 (00:33 +0000)]
fix formatting; NFC

llvm-svn: 219645

9 years agoAdd some optional passes around the vectorizer to both better prepare
Chandler Carruth [Tue, 14 Oct 2014 00:31:29 +0000 (00:31 +0000)]
Add some optional passes around the vectorizer to both better prepare
the IR going into it and to clean up the IR produced by the vectorizers.

Note that these are *off by default* right now while folks collect data
on whether the performance tradeoff is reasonable.

In a build of the 'opt' binary, I see about 2% compile time regression
due to this change on average. This is in my mind essentially the worst
expected case: very little of the opt binary is going to *benefit* from
these extra passes.

I've seen several benchmarks improve in performance my small amounts due
to running these passes, and there are certain (rare) cases where these
passes make a huge difference by either enabling the vectorizer at all
or by hoisting runtime checks out of the outer loop. My primary
motivation is to prevent people from seeing runtime check overhead in
benchmarks where the existing passes and optimizers would be able to
eliminate that.

I've chosen the sequence of passes based on the kinds of things that
seem likely to be relevant for the code at each stage: rotaing loops for
the vectorizer, finding correlated values, loop invariants, and
unswitching opportunities from any runtime checks, and cleaning up
commonalities exposed by the SLP vectorizer.

I'll be pinging existing threads where some of these issues have come up
and will start new threads to get folks to benchmark and collect data on
whether this is the right tradeoff or we should do something else.

llvm-svn: 219644

9 years agoIntroduce LLVMWriteBitcodeToMemoryBuffer C API function.
Peter Collingbourne [Tue, 14 Oct 2014 00:30:59 +0000 (00:30 +0000)]
Introduce LLVMWriteBitcodeToMemoryBuffer C API function.

llvm-svn: 219643

9 years agoSanitize upcasts and conversion to virtual base.
Alexey Samsonov [Mon, 13 Oct 2014 23:59:00 +0000 (23:59 +0000)]
Sanitize upcasts and conversion to virtual base.

This change adds UBSan check to upcasts. Namely, when we
perform derived-to-base conversion, we:
1) check that the pointer-to-derived has suitable alignment
   and underlying storage, if this pointer is non-null.
2) if vptr-sanitizer is enabled, and we perform conversion to
   virtual base, we check that pointer-to-derived has a matching vptr.

llvm-svn: 219642

9 years agoResolve non-pointer isas for metaclasses.
Sean Callanan [Mon, 13 Oct 2014 23:03:49 +0000 (23:03 +0000)]
Resolve non-pointer isas for metaclasses.
Patch by Enrico Granata.
<rdar://problem/18618298>

llvm-svn: 219641

9 years agoUpdating documentation as per Chandler's feedback.
Chris Bieneman [Mon, 13 Oct 2014 23:03:45 +0000 (23:03 +0000)]
Updating documentation as per Chandler's feedback.

This goes with the earlier commit to remove the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocation of the mutex.

Summary: This is part of the ongoing work to remove static constructors and destructors.

Reviewers: chandlerc, rnk

Reviewed By: rnk

Subscribers: rnk, llvm-commits

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

llvm-svn: 219640

9 years agoInstCombine: Fix miscompile in X % -Y -> X % Y transform
David Majnemer [Mon, 13 Oct 2014 22:37:51 +0000 (22:37 +0000)]
InstCombine: Fix miscompile in X % -Y -> X % Y transform

We assumed that negation operations of the form (0 - %Z) resulted in a
negative number.  This isn't true if %Z was originally negative.
Substituting the negative number into the remainder operation may result
in undefined behavior because the dividend might be INT_MIN.

This fixes PR21256.

llvm-svn: 219639

9 years agoRemoving the static destructor from ManagedStatic.cpp by controlling the allocation...
Chris Bieneman [Mon, 13 Oct 2014 22:37:25 +0000 (22:37 +0000)]
Removing the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocation of the mutex.

This patch adds a new llvm_call_once function which is used by the ManagedStatic implementation to safely initialize a global to avoid static construction and destruction.

llvm-svn: 219638

9 years agoFix the build
David Majnemer [Mon, 13 Oct 2014 22:18:22 +0000 (22:18 +0000)]
Fix the build

llvm-svn: 219637

9 years agoMigrate another set of getSubtargetImpl away.
Eric Christopher [Mon, 13 Oct 2014 21:57:44 +0000 (21:57 +0000)]
Migrate another set of getSubtargetImpl away.

llvm-svn: 219636

9 years agoRemove unused debug info constants.
Peter Collingbourne [Mon, 13 Oct 2014 21:50:30 +0000 (21:50 +0000)]
Remove unused debug info constants.

These became unused in r219010.

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

llvm-svn: 219635

9 years agoInstCombine: Don't miscompile (x lshr C1) udiv C2
David Majnemer [Mon, 13 Oct 2014 21:48:30 +0000 (21:48 +0000)]
InstCombine: Don't miscompile (x lshr C1) udiv C2

We have a transform that changes:
  (x lshr C1) udiv C2
into:
  x udiv (C2 << C1)

However, it is unsafe to do so if C2 << C1 discards any of C2's bits.

This fixes PR21255.

llvm-svn: 219634

9 years agoMake first of several changes to bring up to AArch64 fast-isel style
Reed Kotler [Mon, 13 Oct 2014 21:46:41 +0000 (21:46 +0000)]
Make first of several changes to bring up to AArch64 fast-isel style

Summary:
Make Mips fast-isel track the form of AArch64 where practical.
This makes it easier for people to review the code, to borrow similar code, and to see how to eventually move a lot of this
 target code for fast-isels into target independent code.

These are just cosmetic changes. Should be no functional difference.

Test Plan:
make check
test-suite for 4 flavors mips32 r1/r2 , -O0/-O2

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: aemerson, llvm-commits, rfuhler

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

llvm-svn: 219633

9 years agoFix minor typos in comments.
Filipe Cabecinhas [Mon, 13 Oct 2014 21:40:52 +0000 (21:40 +0000)]
Fix minor typos in comments.

llvm-svn: 219632

9 years agoUpdate the example of using a command-line option custom parser to
Paul Robinson [Mon, 13 Oct 2014 21:11:22 +0000 (21:11 +0000)]
Update the example of using a command-line option custom parser to
match the current implementation.

Patch by Douglas Yung!

llvm-svn: 219631

9 years agoObjective-C [Sema]. Fixes a bug in comparing qualified
Fariborz Jahanian [Mon, 13 Oct 2014 21:07:45 +0000 (21:07 +0000)]
Objective-C [Sema]. Fixes a bug in comparing qualified
Objective-C pointer types. In this case, checker incorrectly
claims incompatible pointer types if redundant protocol conformance
is specified. rdar://18491222

llvm-svn: 219630

9 years agoCorrectly export _Unwind_[GS]et(GR|IP) for EHABI.
Dan Albert [Mon, 13 Oct 2014 21:01:30 +0000 (21:01 +0000)]
Correctly export _Unwind_[GS]et(GR|IP) for EHABI.

These need to have normal linkage instead of being static inline as
many libraries expect to be able to declare these and have the linker
find them rather than needing to include the header.

http://mentorembedded.github.io/cxx-abi/abi-eh.html

Also clean up some warnings while I'm here.

Reviewers: jroelofs, kledzik

Subscribers: cfe-commits

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

llvm-svn: 219629

9 years agoAdd an assertion about the integrity of the iterator.
Adrian Prantl [Mon, 13 Oct 2014 20:44:58 +0000 (20:44 +0000)]
Add an assertion about the integrity of the iterator.
Broken parent scope pointers in inlined DIVariables can cause
ensureAbstractVariableIsCreated to insert new abstract scopes, thus
invalidating the iterator in this loop and leading to hard-to-debug
crashes. Useful when manually reducing IR for testcases.

llvm-svn: 219628

9 years agoconstify the getters in SDNodeDbgValue.
Adrian Prantl [Mon, 13 Oct 2014 20:43:47 +0000 (20:43 +0000)]
constify the getters in SDNodeDbgValue.

llvm-svn: 219627

9 years agoRefactor debug statement and remove dead argument. NFC.
Chad Rosier [Mon, 13 Oct 2014 19:46:39 +0000 (19:46 +0000)]
Refactor debug statement and remove dead argument. NFC.

llvm-svn: 219626

9 years ago[analyzer] Check all 'nonnull' attributes, not just the first one.
Jordan Rose [Mon, 13 Oct 2014 19:38:02 +0000 (19:38 +0000)]
[analyzer] Check all 'nonnull' attributes, not just the first one.

Patch by Daniel Fahlgren!

llvm-svn: 219625

9 years agoFix order of evaluation bug in DynTypedMatcher::constructVariadic().
Samuel Benzaquen [Mon, 13 Oct 2014 18:17:11 +0000 (18:17 +0000)]
Fix order of evaluation bug in DynTypedMatcher::constructVariadic().

Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
If it evaluates right-to-left, the vector gets moved before we read the
kind from it.

llvm-svn: 219624

9 years agocleanup comments and remove an obsolete workaround
Adrian Prantl [Mon, 13 Oct 2014 18:04:10 +0000 (18:04 +0000)]
cleanup comments and remove an obsolete workaround

llvm-svn: 219623

9 years agoFix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.
Samuel Benzaquen [Mon, 13 Oct 2014 17:38:12 +0000 (17:38 +0000)]
Fix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.

Summary:
Change r219118 fixed the bug for anyOf and eachOf, but it is still
present for unless.
The variadic wrapper doesn't have enough information to know how to
restrict the type. Different operators handle restrict failures in
different ways.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 219622

9 years agoAdd VS2012-generated test inputs for test/tools/llvm-readobj/codeview-linetables...
Timur Iskhodzhanov [Mon, 13 Oct 2014 17:03:13 +0000 (17:03 +0000)]
Add VS2012-generated test inputs for test/tools/llvm-readobj/codeview-linetables.test

llvm-svn: 219621

9 years agoDon't lock the IOHandlerList::m_mutex in Debugger::RunIOHandler(...) since if a proce...
Greg Clayton [Mon, 13 Oct 2014 16:54:26 +0000 (16:54 +0000)]
Don't lock the IOHandlerList::m_mutex in Debugger::RunIOHandler(...) since if a process is resumed or halted, it will try to push/pop the process IOHandler and it will deadlock.

<rdar://problem/18610852>

llvm-svn: 219620

9 years agoRelinquish ownership of MS-style inline assembly.
Chad Rosier [Mon, 13 Oct 2014 16:45:21 +0000 (16:45 +0000)]
Relinquish ownership of MS-style inline assembly.

llvm-svn: 219619