oota-llvm.git
11 years ago Fix a SCEV update problem.
Shuxin Yang [Mon, 8 Jul 2013 17:33:13 +0000 (17:33 +0000)]
 Fix a SCEV update problem.

 The symptom is seg-fault, and the root cause is that a SCEV contains a SCEVUnknown
which has null-pointer to a llvm::Value.

 This is how the problem take place:
 ===================================
  1). In the pristine input IR, there are two relevant instrutions Op1 and Op2,
     Op1's corresponding SCEV (denoted as SCEV(op1)) is a SCEVUnknown, and
     SCEV(Op2) contains SCEV(Op1).  None of these instructions are dead.

     Op1 : V1 = ...
     ...
     Op2 : V2 = ... // directly or indirectly (data-flow) depends on Op1

  2) Optimizer (LSR in my case) generates an instruction holding the equivalent
     value of Op1, making Op1 dead.
     Op1': V1' = ...
     Op1: V1 = ... ; now dead)
     Op2 : V2 = ... //Now deps on Op1', but the SCEV(Op2) still contains SCEV(Op1)

  3) Op1 is deleted, and call-back function is called to reset
     SCEV(Op1) to indicate it is invalid. However, SCEV(Op2) is not
     invalidated as well.

  4) Following pass get the cached, invalid SCEV(Op2), and try to manipulate it,
     and cause segfault.

 The fix:
 ========
 It seems there is no clean yet inexpensive fix. I write to dev-list
soliciting good solution, unforunately no ack. So, I decide to fix this
problem in a brute-force way:

  When ScalarEvolution::getSCEV is called, check if the cached SCEV
contains a invalid SCEVUnknow, if yes, remove the cached SCEV, and
re-evaluate the SCEV from scratch.

  I compile buch of big *.c and *.cpp, fortunately, I don't see any increase
in compile time.

 Misc:
=====
 The reduced test-case has 2357 lines of code+other-stuff, too big to commit.

 rdar://14283433

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

11 years agoDebugInfo: Simplify Address Pool index handling.
David Blaikie [Mon, 8 Jul 2013 17:33:10 +0000 (17:33 +0000)]
DebugInfo: Simplify Address Pool index handling.

Since the pool indexes are necessarily sequential and contiguous, just
insert things in the right place rather than having to sort the sequence
after the fact.

No functionality change.

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

11 years agoRevert: "Use Clang's __has_* macros in Compiler.h to test for features"
Quentin Colombet [Mon, 8 Jul 2013 17:32:13 +0000 (17:32 +0000)]
Revert: "Use Clang's __has_* macros in Compiler.h to test for features"

This reverts r185831 and 185833.

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

11 years agoPPC: Mark vector FREM as Expand by default
Hal Finkel [Mon, 8 Jul 2013 17:30:25 +0000 (17:30 +0000)]
PPC: Mark vector FREM as Expand by default

Another bug found by llvm-stress! This fixes crashing with:
  LLVM ERROR: Cannot select: v4f32 = frem ...

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

11 years agoclang-format this enum.
Rafael Espindola [Mon, 8 Jul 2013 16:55:56 +0000 (16:55 +0000)]
clang-format this enum.

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

11 years agoWe now always create files with the correct permissions. Simplify the interface.
Rafael Espindola [Mon, 8 Jul 2013 16:42:01 +0000 (16:42 +0000)]
We now always create files with the correct permissions. Simplify the interface.

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

11 years agoAttempt to fix Compiler.h for some self-hosting bots
Reid Kleckner [Mon, 8 Jul 2013 16:36:29 +0000 (16:36 +0000)]
Attempt to fix Compiler.h for some self-hosting bots

I tested r185831 by self-hosting clang with a recent clang, and got no
warnings.  I haven't been able to reproduce the problem locally.

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

11 years agoCreate files with the correct permission instead of changing it afterwards.
Rafael Espindola [Mon, 8 Jul 2013 16:16:51 +0000 (16:16 +0000)]
Create files with the correct permission instead of changing it afterwards.

No intended functionality change.

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

11 years agoUse Clang's __has_* macros in Compiler.h to test for features
Reid Kleckner [Mon, 8 Jul 2013 15:31:29 +0000 (15:31 +0000)]
Use Clang's __has_* macros in Compiler.h to test for features

When targetting Windows, clang does not define __GNUC__, and as a result
we don't use our attributes with it.  This leads to warnings about
unused functions that are already annotated with LLVM_ATTRIBUTE_UNUSED.
Rather than testing for __clang__, we can use its __has_attribute and
__has_builtin macros directlty.

While I'm here, conditionally define and use __GNUC_PREREQ for gcc
version checks.  Spelling the check out with three comparisons is
verbose and error prone.

Reviewers: aaron.ballman

Differential Revision: http://llvm-reviews.chandlerc.com/D1080

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

11 years agoCreate files with the correct permission instead of changing it afterwards.
Rafael Espindola [Mon, 8 Jul 2013 15:22:09 +0000 (15:22 +0000)]
Create files with the correct permission instead of changing it afterwards.

Not intended functionality change.

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

11 years ago[PowerPC] Support time base instructions
Ulrich Weigand [Mon, 8 Jul 2013 15:20:38 +0000 (15:20 +0000)]
[PowerPC] Support time base instructions

This adds support for the old-style time base instructions;
while new programs are supposed to use mfspr, the mftb instructions
are still supported and in use by existing assembler files.

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

11 years ago[PowerPC] Support basic compare mnemonics
Ulrich Weigand [Mon, 8 Jul 2013 14:49:37 +0000 (14:49 +0000)]
[PowerPC] Support basic compare mnemonics

This adds support for the basic mnemoics (with the L operand) for the
fixed-point compare instructions.  These are defined as aliases for the
already existing CMPW/CMPD patterns, depending on the value of L.

This requires use of InstAlias patterns with immediate literal operands.
To make this work, we need two further changes:

 - define a RegisterPrefix, because otherwise literals 0 and 1 would
   be parsed as literal register names

 - provide a PPCAsmParser::validateTargetOperandClass routine to
   recognize immediate literals (like ARM does)

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

11 years agoFixes problem when calling llvm-ar from an unmodifiable directory.
Manuel Klimek [Mon, 8 Jul 2013 14:44:57 +0000 (14:44 +0000)]
Fixes problem when calling llvm-ar from an unmodifiable directory.

This fixes a regression introduced by r185726: the new call to get
a unique file does not prepend the system temporary directory, so
we need to anchor on the file that the temporary file gets moved
to to ensure we're on the same file system.

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

11 years agoImprove the comment from r185794 (re: PromoteIntRes_BUILD_VECTOR)
Hal Finkel [Mon, 8 Jul 2013 14:40:04 +0000 (14:40 +0000)]
Improve the comment from r185794 (re: PromoteIntRes_BUILD_VECTOR)

In response to Duncan's review, I believe that the original comment was not as
clear as it could be. Hopefully, this is better.

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

11 years ago[PowerPC] Fix PR16556 (handle undef ppcf128 in LowerFP_TO_INT).
Bill Schmidt [Mon, 8 Jul 2013 14:22:45 +0000 (14:22 +0000)]
[PowerPC] Fix PR16556 (handle undef ppcf128 in LowerFP_TO_INT).

PPCTargetLowering::LowerFP_TO_INT() expects its source operand to be
either an f32 or f64, but this is not checked.  A long double
(ppcf128) operand will normally be custom-lowered to a conversion to
f64 in this context.  However, this isn't the case for an UNDEF node.

This patch recognizes a ppcf128 as a legal source operand for
FP_TO_INT only if it's an undef, in which case it creates an undef of
the target type.

At some point we might want to do a wholesale custom lowering of
ISD::UNDEF when the type is ppcf128, but it's not really clear that's
a great idea, and probably more work than it's worth for a situation
that only arises in the case of a programming error.  At this point I
think simple is best.

The test case comes from PR16556, and is a crash-test only.

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

11 years agoConvert an OCaml binding grep test to FileCheck
Reid Kleckner [Mon, 8 Jul 2013 14:14:22 +0000 (14:14 +0000)]
Convert an OCaml binding grep test to FileCheck

I shaved this yak because I mistakenly thought that this was one of the
last grep tests.  Turns out my search was skipping .ll files, for which
there are ~1200 more tests using grep.

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

11 years agoInstCombine: Fold X-C1 <u 2 -> (X & -2) == C1
David Majnemer [Mon, 8 Jul 2013 11:53:08 +0000 (11:53 +0000)]
InstCombine: Fold X-C1 <u 2 -> (X & -2) == C1

Back in r179493 we determined that two transforms collided with each
other.  The fix back then was to reorder the transforms so that the
preferred transform would give it a try and then we would try the
secondary transform.  However, it was noted that the best approach would
canonicalize one transform into the other, removing the collision and
allowing us to optimize IR given to us in that form.

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

11 years agoReuse %rax after calling __chkstk on win64
Nico Rieck [Mon, 8 Jul 2013 11:20:11 +0000 (11:20 +0000)]
Reuse %rax after calling __chkstk on win64

Reapply this as I reverted the wrong commit.

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

11 years agoRevert "Proper va_arg/va_copy lowering on win64"
Nico Rieck [Mon, 8 Jul 2013 11:19:44 +0000 (11:19 +0000)]
Revert "Proper va_arg/va_copy lowering on win64"

This reverts commit 2b52880592a525cfe04d8f9008a35da8c2ea94c3.

Needs review.

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

11 years ago[SystemZ] Remove unwanted part from last commit
Richard Sandiford [Mon, 8 Jul 2013 09:55:36 +0000 (09:55 +0000)]
[SystemZ] Remove unwanted part from last commit

I was originally going to use MVC for memmove too, but that's less of
a clear win.  Remove some accidental left-overs in the previous commit.

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

11 years ago[SystemZ] Use MVC for memcpy
Richard Sandiford [Mon, 8 Jul 2013 09:35:23 +0000 (09:35 +0000)]
[SystemZ] Use MVC for memcpy

Use MVC for memcpy in cases where a single MVC is enough.  Using MVC is
a win for longer copies too, but I'll leave that for later.

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

11 years agollvm/test/CMakeLists.txt: Add llvm-cov in "check-clang".
NAKAMURA Takumi [Mon, 8 Jul 2013 08:44:36 +0000 (08:44 +0000)]
llvm/test/CMakeLists.txt: Add llvm-cov in "check-clang".

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

11 years agollvm/test/CMakeLists.txt: Reformat LLVM_TEST_DEPENDS.
NAKAMURA Takumi [Mon, 8 Jul 2013 08:44:30 +0000 (08:44 +0000)]
llvm/test/CMakeLists.txt: Reformat LLVM_TEST_DEPENDS.

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

11 years agollvm/test/Other/llvm-cov.test: It requires +Asserts to let XFAILed.
NAKAMURA Takumi [Mon, 8 Jul 2013 08:44:24 +0000 (08:44 +0000)]
llvm/test/Other/llvm-cov.test: It requires +Asserts to let XFAILed.

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

11 years agoFix PromoteIntRes_BUILD_VECTOR crash with i1 vectors
Hal Finkel [Mon, 8 Jul 2013 06:16:58 +0000 (06:16 +0000)]
Fix PromoteIntRes_BUILD_VECTOR crash with i1 vectors

This fixes a bug (found by llvm-stress) in
DAGTypeLegalizer::PromoteIntRes_BUILD_VECTOR where it assumed that the result
type would always be larger than the original operands. This is not always
true, however, with boolean vectors. For example, promoting a node of type v8i1
(where the operands will be of type i32, the type to which i1 is promoted) will
yield a node with a result vector element type of i16 (and operands of type
i32). As a result, we cannot blindly assume that we can ANY_EXTEND the operands
to the result type.

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

11 years agoRevert: Fix wrong code offset for unwind code SET_FPREG.
Kai Nacke [Mon, 8 Jul 2013 04:48:34 +0000 (04:48 +0000)]
Revert: Fix wrong code offset for unwind code SET_FPREG.

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

11 years agoRevert: Generate IMAGE_REL_AMD64_ADDR32NB relocations for SEH data structures.
Kai Nacke [Mon, 8 Jul 2013 04:46:55 +0000 (04:46 +0000)]
Revert: Generate IMAGE_REL_AMD64_ADDR32NB relocations for SEH data structures.

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

11 years agoRevert: Fix alignment of unwind data.
Kai Nacke [Mon, 8 Jul 2013 04:45:05 +0000 (04:45 +0000)]
Revert: Fix alignment of unwind data.

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

11 years agoRevert: Emit personality function and Dwarf EH data for Win64 SEH.
Kai Nacke [Mon, 8 Jul 2013 04:43:23 +0000 (04:43 +0000)]
Revert: Emit personality function and Dwarf EH data for Win64 SEH.

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

11 years agoAdd the nearbyint -> FNEARBYINT mapping to BasicTargetTransformInfo
Hal Finkel [Mon, 8 Jul 2013 03:24:07 +0000 (03:24 +0000)]
Add the nearbyint -> FNEARBYINT mapping to BasicTargetTransformInfo

This fixes an oversight that Intrinsic::nearbyint was not being mapped to
ISD::FNEARBYINT (thus fixing the over-optimistic cost we were assigning to
nearbyint calls for some targets).

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

11 years ago[objc-arc] Committed test for r185770 as per dblaikie's suggestion.
Michael Gottesman [Mon, 8 Jul 2013 02:13:47 +0000 (02:13 +0000)]
[objc-arc] Committed test for r185770 as per dblaikie's suggestion.

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

11 years agoRevert "Reuse %rax after calling __chkstk on win64"
Nico Rieck [Mon, 8 Jul 2013 01:30:57 +0000 (01:30 +0000)]
Revert "Reuse %rax after calling __chkstk on win64"

This reverts commit 01f8d579f7672872324208ac5bc4ac311e81b22e.

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

11 years agoRemove trailing whitespace from SelectionDAG/*.cpp
Stephen Lin [Mon, 8 Jul 2013 00:37:03 +0000 (00:37 +0000)]
Remove trailing whitespace from SelectionDAG/*.cpp

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

11 years agoReuse %rax after calling __chkstk on win64
Nico Rieck [Sun, 7 Jul 2013 16:48:39 +0000 (16:48 +0000)]
Reuse %rax after calling __chkstk on win64

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

11 years agoClear the builder insert point between tree-vectorization phases.
Nadav Rotem [Sun, 7 Jul 2013 14:57:18 +0000 (14:57 +0000)]
Clear the builder insert point between tree-vectorization phases.

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

11 years agoEliminate trivial redundant loads across nocapture+readonly calls to uncaptured
Nick Lewycky [Sun, 7 Jul 2013 10:15:16 +0000 (10:15 +0000)]
Eliminate trivial redundant loads across nocapture+readonly calls to uncaptured
pointer arguments.

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

11 years agoAdd missing per-argument doesNotAccessMemory accessors. No functionality change
Nick Lewycky [Sun, 7 Jul 2013 08:29:51 +0000 (08:29 +0000)]
Add missing per-argument doesNotAccessMemory accessors. No functionality change
since it has no callers today.

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

11 years agoSLPVectorizer: Implement DCE as part of vectorization.
Nadav Rotem [Sun, 7 Jul 2013 06:57:07 +0000 (06:57 +0000)]
SLPVectorizer: Implement DCE as part of vectorization.

This is a complete re-write if the bottom-up vectorization class.
Before this commit we scanned the instruction tree 3 times. First in search of merge points for the trees. Second, for estimating the cost. And finally for vectorization.
There was a lot of code duplication and adding the DCE exposed bugs. The new design is simpler and DCE was a part of the design.
In this implementation we build the tree once. After that we estimate the cost by scanning the different entries in the constructed tree (in any order). The vectorization phase also works on the built tree.

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

11 years ago[objc-arc] Remove the alias analysis part of r185764.
Michael Gottesman [Sun, 7 Jul 2013 04:18:03 +0000 (04:18 +0000)]
[objc-arc] Remove the alias analysis part of r185764.

Upon further reflection, the alias analysis part of r185764 is not a safe
change.

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

11 years ago[objc-arc] Teach the ARC optimizer that objc_sync_enter/objc_sync_exit do not modify...
Michael Gottesman [Sun, 7 Jul 2013 01:52:55 +0000 (01:52 +0000)]
[objc-arc] Teach the ARC optimizer that objc_sync_enter/objc_sync_exit do not modify the ref count of an objc object and additionally are inert for modref purposes.

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

11 years agoSelectionDAGBuilder: style fixes (add space between end parentheses and open brace)
Stephen Lin [Sat, 6 Jul 2013 21:44:25 +0000 (21:44 +0000)]
SelectionDAGBuilder: style fixes (add space between end parentheses and open brace)

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

11 years agoAdd MC support for the v8fp instructions: vmaxnm and vminnm.
Joey Gouly [Sat, 6 Jul 2013 20:50:18 +0000 (20:50 +0000)]
Add MC support for the v8fp instructions: vmaxnm and vminnm.

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

11 years agoCOFFDumper: Print uint64_t with the right format string.
Benjamin Kramer [Sat, 6 Jul 2013 20:01:46 +0000 (20:01 +0000)]
COFFDumper: Print uint64_t with the right format string.

I wish we could typecheck llvm::format.

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

11 years ago[objc-arc] When we initialize ARCRuntimeEntryPoints, make sure we reset all reference...
Michael Gottesman [Sat, 6 Jul 2013 18:43:05 +0000 (18:43 +0000)]
[objc-arc] When we initialize ARCRuntimeEntryPoints, make sure we reset all references to entrypoint declarations as well.

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

11 years agoProper va_arg/va_copy lowering on win64
Nico Rieck [Sat, 6 Jul 2013 18:08:19 +0000 (18:08 +0000)]
Proper va_arg/va_copy lowering on win64

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

11 years agoEmit personality function and Dwarf EH data for Win64 SEH.
Kai Nacke [Sat, 6 Jul 2013 17:17:31 +0000 (17:17 +0000)]
Emit personality function and Dwarf EH data for Win64 SEH.

Obviously the personality function should be emitted as language handler
instead of the hard coded _GCC_specific_handler. The language specific
data must be placed after the unwind information therefore it must not
be emitted into a separate section.

Reviewed by Charles Davis and Nico Rieck.

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

11 years agoFix alignment of unwind data.
Kai Nacke [Sat, 6 Jul 2013 17:16:50 +0000 (17:16 +0000)]
Fix alignment of unwind data.

For alignment purposes, the instruction array will always have an even
number of entries, with the final entry potentially unused (in which
case the array will be one longer than indicated by the count of unwind
codes field).

Reviewed by Charles Davis and Nico Rieck.

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

11 years agoGenerate IMAGE_REL_AMD64_ADDR32NB relocations for SEH
Kai Nacke [Sat, 6 Jul 2013 17:16:12 +0000 (17:16 +0000)]
Generate IMAGE_REL_AMD64_ADDR32NB relocations for SEH
 data structures.

The Win64 EH data structures must be of type IMAGE_REL_AMD64_ADDR32NB
instead of IMAGE_REL_AMD64_ADDR32. This is easiely achieved by adding
the VK_COFF_IMGREL32 modifier to the symbol reference.
Change also references to start and end of the SEH range of a function
as offsets to start of the function.

Reviewed by Charles Davis and Nico Rieck.

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

11 years agoFix wrong code offset for unwind code SET_FPREG.
Kai Nacke [Sat, 6 Jul 2013 17:15:36 +0000 (17:15 +0000)]
Fix wrong code offset for unwind code SET_FPREG.

The code offset for unwind code SET_FPREG is wrong because it is set
to constant 0. The fix is to do the same as for the other unwind
codes: emit a label and later the absolute difference between the
label and the begin of the prologue.
Also enables the failing test case MC/COFF/seh.s

Reviewed by Charles Davis and Nico Rieck.

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

11 years agoReassociate: Remove unnecessary default operator=.
Benjamin Kramer [Sat, 6 Jul 2013 15:10:13 +0000 (15:10 +0000)]
Reassociate: Remove unnecessary default operator=.

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

11 years agoDAGCombiner: Don't drop extension behavior when shrinking a load when unsafe.
Benjamin Kramer [Sat, 6 Jul 2013 14:05:09 +0000 (14:05 +0000)]
DAGCombiner: Don't drop extension behavior when shrinking a load when unsafe.

ReduceLoadWidth unconditionally drops extensions from loads. Limit it to the
case when all of the bits the extension would otherwise produce are dropped by
the shrink. It would be possible to shrink the load in more cases by merging
the extensions, but this isn't trivial and a very rare case. I left a TODO for
that case.

Fixes PR16551.

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

11 years agoStop putting operations after a tail call.
Tim Northover [Sat, 6 Jul 2013 12:58:45 +0000 (12:58 +0000)]
Stop putting operations after a tail call.

This prevents the emission of DAG-generated vreg definitions after a
tail call be dropping them entirely (on the grounds that nothing could
use them anyway, and they interfere with O0 CodeGen).

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

11 years agoMC: Implement COFF .linkonce directive
Nico Rieck [Sat, 6 Jul 2013 12:13:10 +0000 (12:13 +0000)]
MC: Implement COFF .linkonce directive

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

11 years ago[llvm-ar] Added llvm_unreachable to quiet -Wreturn-type warnings.
Michael Gottesman [Sat, 6 Jul 2013 02:39:51 +0000 (02:39 +0000)]
[llvm-ar] Added llvm_unreachable to quiet -Wreturn-type warnings.

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

11 years agoisKnownToBeAPowerOfTwo: Fix a typo in a comment
David Majnemer [Sat, 6 Jul 2013 02:24:59 +0000 (02:24 +0000)]
isKnownToBeAPowerOfTwo: Fix a typo in a comment

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

11 years ago[objc-arc] Performed some small cleanups in ARCRuntimeEntryPoints and added an llvm_u...
Michael Gottesman [Sat, 6 Jul 2013 02:18:56 +0000 (02:18 +0000)]
[objc-arc] Performed some small cleanups in ARCRuntimeEntryPoints and added an llvm_unreachable after the switch to quiet -Wreturn_type errors.

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

11 years ago[objc-arc] Renamed Module => TheModule in ARCRuntimeEntryPoints. Also did some small...
Michael Gottesman [Sat, 6 Jul 2013 01:57:32 +0000 (01:57 +0000)]
[objc-arc] Renamed Module => TheModule in ARCRuntimeEntryPoints. Also did some small cleanups.

This fixes an issue that came up due to -fpermissive on the bots.

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

11 years agoRemoved trailing whitespace.
Michael Gottesman [Sat, 6 Jul 2013 01:41:35 +0000 (01:41 +0000)]
Removed trailing whitespace.

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

11 years ago[objc-arc] Updated ObjCARCContract to use ARCRuntimeEntryPoints.
Michael Gottesman [Sat, 6 Jul 2013 01:39:26 +0000 (01:39 +0000)]
[objc-arc] Updated ObjCARCContract to use ARCRuntimeEntryPoints.

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

11 years ago[objc-arc] Updated ObjCARCOpts to use ARCRuntimeEntryPoints.
Michael Gottesman [Sat, 6 Jul 2013 01:39:23 +0000 (01:39 +0000)]
[objc-arc] Updated ObjCARCOpts to use ARCRuntimeEntryPoints.

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

11 years ago[objc-arc] Refactor runtime entrypoint declaration entrypoint creation.
Michael Gottesman [Sat, 6 Jul 2013 01:39:18 +0000 (01:39 +0000)]
[objc-arc] Refactor runtime entrypoint declaration entrypoint creation.

This is the first patch in a series of 3 patches which clean up how we create
runtime function declarations in the ARC optimizer when they do not exist
already in the IR.

Currently we have a bunch of duplicated code in ObjCARCOpts, ObjCARCContract
that does this. This patch refactors that code into a separate class called
ARCRuntimeEntryPoints which lazily creates the declarations for said
entrypoints.

The next two patches will consist of the work of refactoring
ObjCARCContract/ObjCARCOpts to use this new code.

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

11 years agoFix language.
Nick Lewycky [Sat, 6 Jul 2013 01:04:47 +0000 (01:04 +0000)]
Fix language.

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

11 years agoFix annotation of unlink. Should fix builder.
Nick Lewycky [Sat, 6 Jul 2013 00:59:28 +0000 (00:59 +0000)]
Fix annotation of unlink. Should fix builder.

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

11 years agoInstCombine: typo in or_icmp_eq_B_0_icmp_ult_A_B test
David Majnemer [Sat, 6 Jul 2013 00:54:07 +0000 (00:54 +0000)]
InstCombine: typo in or_icmp_eq_B_0_icmp_ult_A_B test

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

11 years agoExtend 'readonly' and 'readnone' to work on function arguments as well as
Nick Lewycky [Sat, 6 Jul 2013 00:29:58 +0000 (00:29 +0000)]
Extend 'readonly' and 'readnone' to work on function arguments as well as
functions. Make the function attributes pass add it to known library functions
and when it can deduce it.

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

11 years agoUse modern API to avoid exposing LiveInterval internals.
Jakob Stoklund Olesen [Fri, 5 Jul 2013 23:48:07 +0000 (23:48 +0000)]
Use modern API to avoid exposing LiveInterval internals.

No functional change intended.

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

11 years agoRemove dead function.
Jakob Stoklund Olesen [Fri, 5 Jul 2013 23:04:55 +0000 (23:04 +0000)]
Remove dead function.

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

11 years agoFix windows build.
Rafael Espindola [Fri, 5 Jul 2013 22:32:33 +0000 (22:32 +0000)]
Fix windows build.

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

11 years ago[TRE] Combined another test into basic.ll
Michael Gottesman [Fri, 5 Jul 2013 22:24:06 +0000 (22:24 +0000)]
[TRE] Combined another test into basic.ll

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

11 years agoRemove unique_file now that it is unused.
Rafael Espindola [Fri, 5 Jul 2013 21:19:35 +0000 (21:19 +0000)]
Remove unique_file now that it is unused.

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

11 years agoAdd a createUniqueFile function and switch llvm's users of unique_file.
Rafael Espindola [Fri, 5 Jul 2013 21:01:08 +0000 (21:01 +0000)]
Add a createUniqueFile function and switch llvm's users of unique_file.

This function is complementary to createTemporaryFile. It handles the case were
the unique file is *not* temporary: we will rename it in the end. Since we
will rename it, the file has to be in the same filesystem as the final
destination and we don't prepend the system temporary directory.

This has a small semantic difference from unique_file: the default mode is 0666.
This matches the behavior of most unix tools. For example, with this change
lld now produces files with the same permissions as ld. I will add a test
of this change when I port clang over to createUniqueFile (next commit).

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

11 years ago[TRE] Merged several tests into the the test basic.ll.
Michael Gottesman [Fri, 5 Jul 2013 20:45:13 +0000 (20:45 +0000)]
[TRE] Merged several tests into the the test basic.ll.

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

11 years agoUse sys::fs::createTemporaryFile.
Rafael Espindola [Fri, 5 Jul 2013 20:14:52 +0000 (20:14 +0000)]
Use sys::fs::createTemporaryFile.

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

11 years agoAdd a higher level createTemporaryFile function.
Rafael Espindola [Fri, 5 Jul 2013 19:56:49 +0000 (19:56 +0000)]
Add a higher level createTemporaryFile function.

This function is inspired by clang's Driver::GetTemporaryPath. It hides the
pattern used for uniquing and requires simple file names that are always
placed in the system temporary directory.

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

11 years agoARM: Add a pack pattern for matching arithmetic shift right
Arnold Schwaighofer [Fri, 5 Jul 2013 18:57:49 +0000 (18:57 +0000)]
ARM: Add a pack pattern for matching arithmetic shift right

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

11 years agoARM: Fix incorrect pack pattern
Arnold Schwaighofer [Fri, 5 Jul 2013 18:28:39 +0000 (18:28 +0000)]
ARM: Fix incorrect pack pattern

A "pkhtb x, x, y asr #num" uses the lower 16 bits of "y asr #num" and packs them
in the bottom half of "x". An arithmetic and logic shift are only equivalent in
this context if the shift amount is 16. We would be shifting in ones into the
bottom 16bits instead of zeros if "y" is negative.

radar://14338767

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

11 years agoRemove a useless declarations (found by scan-build)
Sylvestre Ledru [Fri, 5 Jul 2013 15:58:12 +0000 (15:58 +0000)]
Remove a useless declarations (found by scan-build)

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

11 years ago[SystemZ] Remove no-op MVCs
Richard Sandiford [Fri, 5 Jul 2013 14:38:48 +0000 (14:38 +0000)]
[SystemZ] Remove no-op MVCs

The stack coloring pass has code to delete stores and loads that become
trivially dead after coloring.  Extend it to cope with single instructions
that copy from one frame index to another.

The testcase happens to show an example of this kicking in at the moment.
It did occur in Real Code too though.

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

11 years ago[SystemZ] Remove redundant frame MMOs
Richard Sandiford [Fri, 5 Jul 2013 14:31:24 +0000 (14:31 +0000)]
[SystemZ] Remove redundant frame MMOs

This fixes foldMemoryOperandImpl() so that it doesn't create duplicated
frame MMOs.  I hadn't realized when writing r185434 that it was the caller's
responsibility to add these.

No behavioural change intended.

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

11 years agoFix double renaming bug in stack coloring pass
Richard Sandiford [Fri, 5 Jul 2013 14:24:47 +0000 (14:24 +0000)]
Fix double renaming bug in stack coloring pass

The stack coloring pass renumbered frame indexes with a loop of the form:

  for each frame index FI
    for each instruction I that uses FI
      for each use of FI in I
        rename FI to FI'

This caused problems if an instruction used two frame indexes F0 and F1
and if F0 was renamed to F1 and F1 to F2.  The first time we visited the
instruction we changed F0 to F1, then we changed both F1s to F2.

In other words, the problem was that SSRefs recorded which instructions
used an FI, but not which MachineOperands and MachineMemOperands within
that instruction used it.

This is easily fixed for MachineOperands by walking the instructions
once and processing each operand in turn.  There's already a loop to
do that for dead store elimination, so it seemed more efficient to
fuse the two at the block level.

MachineMemOperands are more tricky because they can be shared between
instructions.  The patch handles them by making SSRefs an array of
MachineMemOperands rather than an array of MachineInstrs.  We might end
up processing the same MachineMemOperand twice, but that's OK because
we always know from the SSRefs index what the original frame index was.

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

11 years ago[SystemZ] Enable the use of MVC for frame-to-frame spills
Richard Sandiford [Fri, 5 Jul 2013 14:02:01 +0000 (14:02 +0000)]
[SystemZ] Enable the use of MVC for frame-to-frame spills

...now that the problem that prompted the restriction has been fixed.

The original spill-02.py was a compromise because at the time I couldn't
find an example that actually failed without the two scavenging slots.
The version included here did.

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

11 years ago[PowerPC] Add some special @got@tprel fixup cases
Ulrich Weigand [Fri, 5 Jul 2013 13:49:46 +0000 (13:49 +0000)]
[PowerPC] Add some special @got@tprel fixup cases

When a target@got@tprel or target@got@tprel@l symbol variant is used in
a fixup_ppc_half16 (*not* fixup_ppc_half16ds) context, we currently fail,
since the corresponding R_PPC64_GOT_TPREL16 / R_PPC64_GOT_TPREL16_LO
relocation types do not exist.

However, since such symbol variants resolve to GOT offsets which are
always 4-aligned, we can simply instead use the _DS variants of the
relocation types, which *do* exist.

The same applies for the @got@dtprel variants.

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

11 years ago[SystemZ] Allocate a second register scavenging slot
Richard Sandiford [Fri, 5 Jul 2013 13:11:52 +0000 (13:11 +0000)]
[SystemZ] Allocate a second register scavenging slot

This is another prerequisite for frame-to-frame MVC copies.
I'll commit the patch that makes use of the slot separately.

The downside of trying to test many corner cases with each of the
available addressing modes is that a fair few tests need to account
for the new frame layout.  I do still think it's useful to have all
these tests though, since it's something that wouldn't get much coverage
otherwise.

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

11 years agoDon't create an archive if, for example, we are asked to print the index.
Rafael Espindola [Fri, 5 Jul 2013 13:03:07 +0000 (13:03 +0000)]
Don't create an archive if, for example, we are asked to print the index.

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

11 years ago[SystemZ] Clean up register scavenging code
Richard Sandiford [Fri, 5 Jul 2013 12:55:00 +0000 (12:55 +0000)]
[SystemZ] Clean up register scavenging code

SystemZ wants normal register scavenging slots, as close to the stack or
frame pointer as possible.  The only reason it was using custom code was
because PrologEpilogInserter assumed an x86-like layout, where the frame
pointer is at the opposite end of the frame from the stack pointer.
This meant that when frame pointer elimination was disabled,
the slots ended up being as close as possible to the incoming
stack pointer, which is the opposite of what we want on SystemZ.

This patch adds a new knob to say which layout is used and converts
SystemZ to use target-independent scavenging slots.  It's one of the pieces
needed to support frame-to-frame MVCs, where two slots might be required.

The ABI requires us to allocate 160 bytes for calls, so one approach
would be to use that area as temporary spill space instead.  It would need
some surgery to make sure that the slot isn't live across a call though.

I stuck to the "isFPCloseToIncomingSP - ..." style comment on the
"do what the surrounding code does" principle.  The FP case is already
covered by several Systemz/frame-* tests, which fail without the
PrologueEpilogueInserter change, so no new ones are needed.

No behavioural change intended.

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

11 years agoUse simpler version of exists.
Rafael Espindola [Fri, 5 Jul 2013 12:44:49 +0000 (12:44 +0000)]
Use simpler version of exists.

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

11 years ago[PowerPC] Make test case buildable with GNU as
Ulrich Weigand [Fri, 5 Jul 2013 12:33:03 +0000 (12:33 +0000)]
[PowerPC] Make test case buildable with GNU as

The ppc64-fixups.s test currently fails to build with GNU as, since it
does not support plain symbols as arguments to li/lis.  Rewrite the test
for R_PPC64_ADDR16 and R_PPC64_REL16 to use lwz instead.

Allowing the test case to be built with both LLVM and GNU as makes it
easier to spot unwanted difference in the output.

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

11 years ago[PowerPC] Support @tls in the asm parser
Ulrich Weigand [Fri, 5 Jul 2013 12:22:36 +0000 (12:22 +0000)]
[PowerPC] Support @tls in the asm parser

This adds support for the last missing construct to parse TLS-related
assembler code:
   add 3, 4, symbol@tls

The ADD8TLS currently hard-codes the @tls into the assembler string.
This cannot be handled by the asm parser, since @tls is parsed as
a symbol variant.  This patch changes ADD8TLS to have the @tls suffix
printed as symbol variant on output too, which allows us to remove
the isCodeGenOnly marker from ADD8TLS.  This in turn means that we
can add a AsmOperand to accept @tls marked symbols on input.

As a side effect, this means that the fixup_ppc_tlsreg fixup type
is no longer necessary and can be merged into fixup_ppc_nofixup.

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

11 years agoRemove NoOperation.
Rafael Espindola [Fri, 5 Jul 2013 12:12:43 +0000 (12:12 +0000)]
Remove NoOperation.

parseCommandLine prints and error and exists if no operation is specified, so
it never returns NoOperation.

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

11 years agoSimplify code. No functionality change.
Benjamin Kramer [Fri, 5 Jul 2013 10:20:57 +0000 (10:20 +0000)]
Simplify code. No functionality change.

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

11 years agoPR16490: fix a crash in ARMDAGToDAGISel::SelectInlineAsm.
Joey Gouly [Fri, 5 Jul 2013 10:19:40 +0000 (10:19 +0000)]
PR16490: fix a crash in ARMDAGToDAGISel::SelectInlineAsm.

In the SelectionDAG immediate operands to inline asm are constructed as
two separate operands. The first is a constant of value InlineAsm::Kind_Imm
and the second is a constant with the value of the immediate.

In ARMDAGToDAGISel::SelectInlineAsm, if we reach an operand of Kind_Imm we
should skip over the next operand too.

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

11 years agoDon't treat bitcode files specially in llvm-ar.
Rafael Espindola [Fri, 5 Jul 2013 04:19:32 +0000 (04:19 +0000)]
Don't treat bitcode files specially in llvm-ar.

We really want bitcode files to behave as regular object files in archives, so
we don't need to track that a member is bitcode.

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

11 years agoUse the raw member names in Archive::Archive.
Rafael Espindola [Fri, 5 Jul 2013 03:35:15 +0000 (03:35 +0000)]
Use the raw member names in Archive::Archive.

This a bit more efficient and avoids having a function that uses the string
table being called by a function that searches for it.

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

11 years agoAdd a --crash option to not.
Rafael Espindola [Fri, 5 Jul 2013 02:50:03 +0000 (02:50 +0000)]
Add a --crash option to not.

Now the two possible uses of not are
* not cmd
  Will return true if cmd doesn't crash and returns false.
* not --crash cmd
  Will return true if cmd crashes.

It will be used/tested in a followup commit for the clang crash recovery
testing.

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

11 years agoInstCombine: (icmp eq B, 0) | (icmp ult A, B) -> (icmp ule A, B-1)
David Majnemer [Fri, 5 Jul 2013 00:31:17 +0000 (00:31 +0000)]
InstCombine: (icmp eq B, 0) | (icmp ult A, B) -> (icmp ule A, B-1)

This transform allows us to turn IR that looks like:
  %1 = icmp eq i64 %b, 0
  %2 = icmp ult i64 %a, %b
  %3 = or i1 %1, %2
  ret i1 %3

into:
  %0 = add i64 %b, -1
  %1 = icmp uge i64 %0, %a
  ret i1 %1

which means we go from lowering:
        cmpq    %rsi, %rdi
        setb    %cl
        testq   %rsi, %rsi
        sete    %al
        orb     %cl, %al
        ret

to lowering:
        decq    %rsi
        cmpq    %rdi, %rsi
        setae   %al
        ret

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

11 years agoRemove use of asymmetric std::lower_bound comparator.
Ahmed Bougacha [Thu, 4 Jul 2013 23:20:12 +0000 (23:20 +0000)]
Remove use of asymmetric std::lower_bound comparator.

VS 2008 doesn't like it when in debug mode.

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

11 years agoDebugInfo: Consider global variables without locations to be valid
David Blaikie [Thu, 4 Jul 2013 23:15:18 +0000 (23:15 +0000)]
DebugInfo: Consider global variables without locations to be valid

We were being a bit too aggresive here in classifying global variables
with no global reference or constant value to be invalid - this would
cause LLVM to not emit the DWARF description of the global variable if
it had been optimized away, which isn't helpful for users who might
benefit from the global variable's description even if there's no
location information.

This also fixes a crasher issue here that I was unable to reduce a test
case for - involving a using decl (& subsequent
DW_TAG_imported_declaration ) of such a global variable that, once
optimized away, would crash when an attempt to emit the imported
declaration was made.

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

11 years agoUse a OwningPtr instead of a manual delete.
Rafael Espindola [Thu, 4 Jul 2013 22:15:33 +0000 (22:15 +0000)]
Use a OwningPtr instead of a manual delete.

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

11 years agoInitialize object file info before output streamer
Nico Rieck [Thu, 4 Jul 2013 21:37:26 +0000 (21:37 +0000)]
Initialize object file info before output streamer

r179494 switched to using the object file info to retrieve the default text
section for some MC streamers. It is possible that initializing an MC
streamer can request sections before the object file info is initialized
when the AutoInitSections flag is set on the streamer.

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

11 years agoMC: Add .section directive to COFF
Nico Rieck [Thu, 4 Jul 2013 21:32:07 +0000 (21:32 +0000)]
MC: Add .section directive to COFF

Supports GAS flags "abdnrswxy". No support for alignment or subsections.

Fixes PR16366.

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