oota-llvm.git
11 years agoDon't try to install c-index-test with BUILD_CLANG_ONLY. rdar://12492703
Bob Wilson [Wed, 24 Oct 2012 22:56:32 +0000 (22:56 +0000)]
Don't try to install c-index-test with BUILD_CLANG_ONLY. rdar://12492703

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

11 years agoFix a compiler warning with an unused variable.
Micah Villmow [Wed, 24 Oct 2012 22:32:26 +0000 (22:32 +0000)]
Fix a compiler warning with an unused variable.

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

11 years ago[ms-inline asm] Add support for parsing the '.' operator. Given,
Chad Rosier [Wed, 24 Oct 2012 22:21:50 +0000 (22:21 +0000)]
[ms-inline asm] Add support for parsing the '.' operator.  Given,

[register].field

The operator returns the value at the location pointed to by register plus the
offset of field within its structure or union.  This patch only handles
immediate fields (i.e., [eax].4).  The original displacement has to be a
MCConstantExpr as well.
Part of rdar://12470415 and rdar://12470514

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

11 years agoTidy up. No functional change intended.
Chad Rosier [Wed, 24 Oct 2012 22:13:37 +0000 (22:13 +0000)]
Tidy up.  No functional change intended.

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

11 years agoDon't use stack unwinding to provide the location information for
Joerg Sonnenberger [Wed, 24 Oct 2012 22:03:59 +0000 (22:03 +0000)]
Don't use stack unwinding to provide the location information for
SetTheory, but pass down the location explicitly.

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

11 years agoUpdate GVN to support vectors of pointers.
Hal Finkel [Wed, 24 Oct 2012 21:22:30 +0000 (21:22 +0000)]
Update GVN to support vectors of pointers.

GVN will now generate ptrtoint instructions for vectors of pointers.
Fixes PR14166.

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

11 years agoMake LegalizeKind public so that we can use it outside of TargetLowering.
Nadav Rotem [Wed, 24 Oct 2012 20:59:17 +0000 (20:59 +0000)]
Make LegalizeKind public so that we can use it outside of TargetLowering.

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

11 years agowhitespace
Nadav Rotem [Wed, 24 Oct 2012 20:58:40 +0000 (20:58 +0000)]
whitespace

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

11 years agoDocument the -force-vector-width flag.
Nadav Rotem [Wed, 24 Oct 2012 20:47:55 +0000 (20:47 +0000)]
Document the -force-vector-width flag.

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

11 years agoLoopVectorizer: Add a basic cost model which uses the VTTI interface.
Nadav Rotem [Wed, 24 Oct 2012 20:36:32 +0000 (20:36 +0000)]
LoopVectorizer: Add a basic cost model which uses the VTTI interface.

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

11 years agoFix a miscompilation caused by a typo. When turning a adde with negative value
Evan Cheng [Wed, 24 Oct 2012 19:53:01 +0000 (19:53 +0000)]
Fix a miscompilation caused by a typo. When turning a adde with negative value
into a sbc with a positive number, the immediate should be complemented, not
negated. Also added a missing pattern for ARM codegen.

rdar://12559385

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

11 years agogetSmallConstantTripMultiple should never return zero.
Hal Finkel [Wed, 24 Oct 2012 19:46:44 +0000 (19:46 +0000)]
getSmallConstantTripMultiple should never return zero.

When the trip count is -1, getSmallConstantTripMultiple could return zero,
and this would cause runtime loop unrolling to assert. Instead of returning
zero, one is now returned (consistent with the existing overflow cases).
Fixes PR14167.

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

11 years agoMake ~Operator() protected so subclasses can inherit it and not have
Kaelyn Uhrain [Wed, 24 Oct 2012 19:17:42 +0000 (19:17 +0000)]
Make ~Operator() protected so subclasses can inherit it and not have
a bunch of errors for all the Operator subclasses such as:

include/llvm/Operator.h:76:7: error: deleted function 'virtual llvm::OverflowingBinaryOperator::~OverflowingBinaryOperator()'
include/llvm/Operator.h:43:3: error: overriding non-deleted function 'virtual llvm::Operator::~Operator()'
include/llvm/Operator.h:76:7: error: 'virtual llvm::OverflowingBinaryOperator::~OverflowingBinaryOperator()' is implicitly deleted because the default definition would be ill-formed:
include/llvm/Operator.h:43:3: error: 'virtual llvm::Operator::~Operator()' is private
include/llvm/Operator.h:76:7: error: within this context

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

11 years agoImprove DenseMap checks for power of 2 growth. Thanks for the tip Jakob
Pete Cooper [Wed, 24 Oct 2012 18:50:44 +0000 (18:50 +0000)]
Improve DenseMap checks for power of 2 growth.  Thanks for the tip Jakob

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

11 years agoAdd some cleanup to the DataLayout changes requested by Chandler.
Micah Villmow [Wed, 24 Oct 2012 18:36:13 +0000 (18:36 +0000)]
Add some cleanup to the DataLayout changes requested by Chandler.

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

11 years agoOpt does not need to initialize the Asm printer/parser
Nadav Rotem [Wed, 24 Oct 2012 17:55:53 +0000 (17:55 +0000)]
Opt does not need to initialize the Asm printer/parser

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

11 years agoDelete the empty directory that was accidently added in 166578.
Micah Villmow [Wed, 24 Oct 2012 17:27:47 +0000 (17:27 +0000)]
Delete the empty directory that was accidently added in 166578.

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

11 years agoBack out r166591, not sure why this made it through since I cancelled the command...
Micah Villmow [Wed, 24 Oct 2012 17:25:11 +0000 (17:25 +0000)]
Back out r166591, not sure why this made it through since I cancelled the command. Bleh, sorry about this!

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

11 years agoOpt needs to initialize the different targets.
Nadav Rotem [Wed, 24 Oct 2012 17:23:50 +0000 (17:23 +0000)]
Opt needs to initialize the different targets.

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

11 years agoImplement a basic VectorTargetTransformInfo interface to be used by the loop and...
Nadav Rotem [Wed, 24 Oct 2012 17:22:41 +0000 (17:22 +0000)]
Implement a basic VectorTargetTransformInfo interface to be used by the loop and bb vectorizers for modeling the cost of instructions.

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

11 years ago[ms-inline asm] Create a register operand, rather than a memory operand when we
Chad Rosier [Wed, 24 Oct 2012 17:22:29 +0000 (17:22 +0000)]
[ms-inline asm] Create a register operand, rather than a memory operand when we
see the offsetof operator.  Previously, we were matching something like MOVrm
in the front-end and later matching MOVrr in the back-end.  This change makes
things more consistent.  It also fixes cases where we can't match against a
memory operand as the source (test cases coming).
Part of rdar://12470317

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

11 years agoDelete a directory that wasn't supposed to be checked in yet.
Micah Villmow [Wed, 24 Oct 2012 17:20:04 +0000 (17:20 +0000)]
Delete a directory that wasn't supposed to be checked in yet.

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

11 years agoAdd in support for getIntPtrType to get the pointer type based on the address space.
Micah Villmow [Wed, 24 Oct 2012 15:52:52 +0000 (15:52 +0000)]
Add in support for getIntPtrType to get the pointer type based on the address space.
This checkin also adds in some tests that utilize these paths and updates some of the
clients.

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

11 years agoSpecial calling conventions for Intel OpenCL built-in library.
Elena Demikhovsky [Wed, 24 Oct 2012 14:46:16 +0000 (14:46 +0000)]
Special calling conventions for Intel OpenCL built-in library.

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

11 years ago[CMake] Introduce LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR.
NAKAMURA Takumi [Wed, 24 Oct 2012 12:26:08 +0000 (12:26 +0000)]
[CMake] Introduce LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR.

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

11 years agoAdd a testcase that would have noticed the typo fixed in commit 166475.
Duncan Sands [Wed, 24 Oct 2012 07:17:20 +0000 (07:17 +0000)]
Add a testcase that would have noticed the typo fixed in commit 166475.

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

11 years agoTeach DAG combine to fold (buildvec (Xint2fp x)) to (Xint2fp (buildvec x))
Michael Liao [Wed, 24 Oct 2012 04:14:18 +0000 (04:14 +0000)]
Teach DAG combine to fold (buildvec (Xint2fp x)) to (Xint2fp (buildvec x))

- If more than 1 elemennts are defined and target supports the vectorized
  conversion, use the vectorized one instead to reduce the strength on
  conversion operation.

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

11 years agoAdd custom conversion from v2u32 to v2f32 in 32-bit mode
Michael Liao [Wed, 24 Oct 2012 04:09:32 +0000 (04:09 +0000)]
Add custom conversion from v2u32 to v2f32 in 32-bit mode

- As there's no 64-bit GPRs in 32-bit mode, a custom conversion from v2u32 to
  v2f32 is added to improve the efficiency of the code generated.

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

11 years ago[mips] Make sure sret argument is returned in register V0.
Akira Hatanaka [Wed, 24 Oct 2012 02:10:54 +0000 (02:10 +0000)]
[mips] Make sure sret argument is returned in register V0.

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

11 years agoChange x86_fastcallcc to require inreg markers. This allows it to known
Rafael Espindola [Wed, 24 Oct 2012 01:58:48 +0000 (01:58 +0000)]
Change x86_fastcallcc to require inreg markers. This allows it to known
the difference from "int x" (which should go in registers and
"struct y {int x;}" (which should not).

Clang will be updated in the next patches.

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

11 years agoKeep coding standard. Don't evaluate getNumOperands() every time.
Jakub Staszak [Wed, 24 Oct 2012 00:38:25 +0000 (00:38 +0000)]
Keep coding standard. Don't evaluate getNumOperands() every time.

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

11 years agoFix ODR violations: a virtual function must be defined, even if it's never
Richard Smith [Wed, 24 Oct 2012 00:30:41 +0000 (00:30 +0000)]
Fix ODR violations: a virtual function must be defined, even if it's never
called. Provide an (asserting) definition of Operator's private destructor.
Remove destructors from all classes derived from Operator. We don't need them
for safety, because their implicit definitions would be ill-formed (they'd call
Operator's private destructor), and we don't need them to avoid emitting
vtables, because we don't do anything with Operator subclasses which would
trigger vtable instantiation.

The Operator hierarchy is still a complete disaster with regard to undefined
behavior, but this at least allows LLVM to link when using Clang's
-fcatch-undefined-behavior with a new vptr-based type checking mechanism.

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

11 years ago[ms-inline asm] Offset operator - the size should be based on the size of a
Chad Rosier [Tue, 23 Oct 2012 23:42:06 +0000 (23:42 +0000)]
[ms-inline asm] Offset operator - the size should be based on the size of a
pointer, not the size of the variable.
Part of rdar://12470317

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

11 years ago[ms-inline asm] Clean up comment.
Chad Rosier [Tue, 23 Oct 2012 23:34:28 +0000 (23:34 +0000)]
[ms-inline asm] Clean up comment.

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

11 years ago[ms-inline asm] When parsing inline assembly we set the base register to a
Chad Rosier [Tue, 23 Oct 2012 23:31:33 +0000 (23:31 +0000)]
[ms-inline asm] When parsing inline assembly we set the base register to a
non-zero value as we don't know the actual value at this point.  This is
necessary to get the matching correct in some cases.  However, the actual value
set as the base register doesn't matter, since we're just matching not emitting.

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

11 years agoClean up code and put transformation on (build_vec (ext x)) into a helper func
Michael Liao [Tue, 23 Oct 2012 23:06:52 +0000 (23:06 +0000)]
Clean up code and put transformation on (build_vec (ext x)) into a helper func

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

11 years ago[Support/StringSet] Fix memory leak when inserted key already exists.
Michael J. Spencer [Tue, 23 Oct 2012 22:55:54 +0000 (22:55 +0000)]
[Support/StringSet] Fix memory leak when inserted key already exists.

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

11 years agoMake branch heavy code for generating marked up disassembly simpler
Kevin Enderby [Tue, 23 Oct 2012 22:52:52 +0000 (22:52 +0000)]
Make branch heavy code for generating marked up disassembly simpler
and easier to read by adding a couple helper functions.  Suggestion by
Chandler Carruth and seconded by Meador Inge!

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

11 years agoFix PR14161
Michael Liao [Tue, 23 Oct 2012 21:40:15 +0000 (21:40 +0000)]
Fix PR14161

- Check index being extracted to be constant 0 before simplfiying.
  Otherwise, retain the original sequence.

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

11 years agoCMake: Include private headers / tablegen files in generated Xcode projects.
Jordan Rose [Tue, 23 Oct 2012 21:36:55 +0000 (21:36 +0000)]
CMake: Include private headers / tablegen files in generated Xcode projects.

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

11 years agoMake the indirect branch optimization deterministic. No functionality change.
Nadav Rotem [Tue, 23 Oct 2012 21:05:33 +0000 (21:05 +0000)]
Make the indirect branch optimization deterministic. No functionality change.

Patch by Daniel Reynaud.

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

11 years agoSilence -Wsign-compare
Matt Beaumont-Gay [Tue, 23 Oct 2012 19:46:36 +0000 (19:46 +0000)]
Silence -Wsign-compare

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

11 years agoChange DenseMap to use a power of 2 growth if one is given instead of the next power...
Pete Cooper [Tue, 23 Oct 2012 19:34:36 +0000 (19:34 +0000)]
Change DenseMap to use a power of 2 growth if one is given instead of the next power of 2.  This was causing DenseMaps to grow 4x instead of 2x.  I'll keep an eye on the buildbots as this could impact performance

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

11 years agoFixed bug in SmallDenseMap where it wouldn't leave enough space for an empty bucket...
Pete Cooper [Tue, 23 Oct 2012 18:47:35 +0000 (18:47 +0000)]
Fixed bug in SmallDenseMap where it wouldn't leave enough space for an empty bucket if the number of values was exactly equal to the small capacity.  This led to an infinite loop when finding a non-existent element

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

11 years agoUse the AliasAnalysis isIdentifiedObj because it also understands mallocs and c+...
Nadav Rotem [Tue, 23 Oct 2012 18:44:18 +0000 (18:44 +0000)]
Use the AliasAnalysis isIdentifiedObj because it also understands mallocs and c++ news.

PR14158.

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

11 years agoIgnore unreachable blocks when doing memory dependence analysis on non-local
Bill Wendling [Tue, 23 Oct 2012 18:37:11 +0000 (18:37 +0000)]
Ignore unreachable blocks when doing memory dependence analysis on non-local
loads. It's not really profitable and may result in GVN going into an infinite
loop when it hits constructs like this:

     %x = gep %some.type %x, ...

Found via an LTO build of LLVM.

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

11 years ago[ms-inline asm] Add an implementation of the offset operator. This is a follow
Chad Rosier [Tue, 23 Oct 2012 17:43:43 +0000 (17:43 +0000)]
[ms-inline asm] Add an implementation of the offset operator.  This is a follow
on patch to r166433.
rdar://12470317

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

11 years agoAdd custom UINT_TO_FP from v4i8/v4i16/v8i8/v8i16 to v4f32/v8f32
Michael Liao [Tue, 23 Oct 2012 17:36:08 +0000 (17:36 +0000)]
Add custom UINT_TO_FP from v4i8/v4i16/v8i8/v8i16 to v4f32/v8f32

- Replace v4i8/v8i8 -> v8f32 DAG combine with custom lowering to reduce
  DAG combine overhead.
- Extend the support to v4i16/v8i16 as well.

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

11 years agoEnable lowering ZERO_EXTEND/ANY_EXTEND to PMOVZX from SSE4.1
Michael Liao [Tue, 23 Oct 2012 17:34:00 +0000 (17:34 +0000)]
Enable lowering ZERO_EXTEND/ANY_EXTEND to PMOVZX from SSE4.1

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

11 years agoGrammar.
Eric Christopher [Tue, 23 Oct 2012 17:19:15 +0000 (17:19 +0000)]
Grammar.

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

11 years agoUse ilist rather than std::list for Node and Edge lists in the PBQP graph. This
Lang Hames [Tue, 23 Oct 2012 17:10:51 +0000 (17:10 +0000)]
Use ilist rather than std::list for Node and Edge lists in the PBQP graph. This
should fix an issue (described at http://stackoverflow.com/questions/10065384/instantiation-of-a-list-with-an-incomplete-type-in-a-typedef)
that was preventing LLVMCodeGen from building with libc++ in C++11 mode.

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

11 years agoTest commit access
Quentin Colombet [Tue, 23 Oct 2012 16:03:18 +0000 (16:03 +0000)]
Test commit access

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

11 years agoThis is another TLC patch for separating code for the Darwin and ELF ABIs
Bill Schmidt [Tue, 23 Oct 2012 15:51:16 +0000 (15:51 +0000)]
This is another TLC patch for separating code for the Darwin and ELF ABIs
for the PowerPC target, and factoring the results.  This will ease future
maintenance of both subtargets.

PPCTargetLowering::LowerCall_Darwin_Or_64SVR4() has grown a lot of special-case
code for the different ABIs, making maintenance difficult.  This is getting
worse as we repair errors in the 64-bit ELF ABI implementation, while avoiding
changes to the Darwin ABI logic.  This patch splits the routine into
LowerCall_Darwin() and LowerCall_64SVR4(), allowing both versions to be
significantly simplified.  I've factored out chunks of similar code where it
made sense to do so.  I also performed similar factoring on
LowerFormalArguments_Darwin() and LowerFormalArguments_64SVR4().

There are no functional changes in this patch, and therefore no new test
cases have been developed.

Built and tested on powerpc64-unknown-linux-gnu with no new regressions.

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

11 years agoFix typo that somehow escaped both testing and code inspection.
Duncan Sands [Tue, 23 Oct 2012 09:07:02 +0000 (09:07 +0000)]
Fix typo that somehow escaped both testing and code inspection.

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

11 years agoTransform code like this
Duncan Sands [Tue, 23 Oct 2012 08:28:26 +0000 (08:28 +0000)]
Transform code like this
 %V = mul i64 %N, 4
 %t = getelementptr i8* bitcast (i32* %arr to i8*), i32 %V
into
 %t1 = getelementptr i32* %arr, i32 %N
 %t = bitcast i32* %t1 to i8*
incorporating the multiplication into the getelementptr.
This happens all the time in dragonegg, for example for
  int foo(int *A, int N) {
    return A[N];
  }
because gcc turns this into byte pointer arithmetic before it hits the plugin:
  D.1590_2 = (long unsigned int) N_1(D);
  D.1591_3 = D.1590_2 * 4;
  D.1592_5 = A_4(D) + D.1591_3;
  D.1589_6 = *D.1592_5;
  return D.1589_6;
The D.1592_5 line is a POINTER_PLUS_EXPR, which is turned into a getelementptr
on a bitcast of A_4 to i8*, so this becomes exactly the kind of IR that the
transform fires on.

An analogous transform (with no testcases!) already existed for bitcasts of
arrays, so I rewrote it to share code with this one.

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

11 years agoPer the C++ standard, we need to include the definition of llvm::Calculate in
Richard Smith [Tue, 23 Oct 2012 06:19:46 +0000 (06:19 +0000)]
Per the C++ standard, we need to include the definition of llvm::Calculate in
every TU where it's implicitly instantiated, even if there's an implicit
instantiation for the same types available in another TU.

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

11 years agoAdd a comment which explains why the assert fired and how to fix it.
Nadav Rotem [Tue, 23 Oct 2012 04:35:40 +0000 (04:35 +0000)]
Add a comment which explains why the assert fired and how to fix it.

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

11 years agoimplement setXX patterns
Reed Kotler [Tue, 23 Oct 2012 01:35:48 +0000 (01:35 +0000)]
implement setXX patterns

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

11 years agoFix typo.
Julien Lerouge [Tue, 23 Oct 2012 00:38:15 +0000 (00:38 +0000)]
Fix typo.

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

11 years agoExplain why DenseMap is still used here instead of MapVector.
Julien Lerouge [Tue, 23 Oct 2012 00:23:46 +0000 (00:23 +0000)]
Explain why DenseMap is still used here instead of MapVector.

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

11 years ago[ms-inline-asm] Implement _emit directive (which is roughly equivalent to .byte).
Eli Friedman [Mon, 22 Oct 2012 23:58:19 +0000 (23:58 +0000)]
[ms-inline-asm] Implement _emit directive (which is roughly equivalent to .byte).

<rdar://problem/12470345>.

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

11 years agoWhen a block ends in an indirect branch, add its successors to the machine basic...
Bill Wendling [Mon, 22 Oct 2012 23:30:04 +0000 (23:30 +0000)]
When a block ends in an indirect branch, add its successors to the machine basic block.

The CFG of the machine function needs to know that the targets of the indirect
branch are successors to the indirect branch.
<rdar://problem/12529625>

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

11 years agoAdd support for annotated disassembly output for X86 and arm.
Kevin Enderby [Mon, 22 Oct 2012 22:31:46 +0000 (22:31 +0000)]
Add support for annotated disassembly output for X86 and arm.

Per the October 12, 2012 Proposal for annotated disassembly output sent out by
Jim Grosbach this set of changes implements this for X86 and arm.  The llvm-mc
tool now has a -mdis option to produced the marked up disassembly and a couple
of small example test cases have been added.

rdar://11764962

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

11 years ago[ms-inline asm] Don't rewrite out parts of an inline-asm skipped by .if 0 and friends.
Eli Friedman [Mon, 22 Oct 2012 20:50:25 +0000 (20:50 +0000)]
[ms-inline asm] Don't rewrite out parts of an inline-asm skipped by .if 0 and friends.
It's unnecessary and makes the generated assembly less faithful to the original source.

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

11 years ago[ms-inline asm] Add the isOffsetOf() function.
Chad Rosier [Mon, 22 Oct 2012 19:50:35 +0000 (19:50 +0000)]
[ms-inline asm] Add the isOffsetOf() function.
Part of rdar://12470317

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

11 years agoIterating over a DenseMap<std::pair<BasicBlock*, unsigned>, PHINode*> is not
Julien Lerouge [Mon, 22 Oct 2012 19:43:56 +0000 (19:43 +0000)]
Iterating over a DenseMap<std::pair<BasicBlock*, unsigned>, PHINode*> is not
deterministic, replace it with a DenseMap<std::pair<unsigned, unsigned>,
PHINode*> (we already have a map from BasicBlock to unsigned).

<rdar://problem/12541389>

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

11 years ago[ms-inline asm] Add support for parsing the offset operator. Callback for
Chad Rosier [Mon, 22 Oct 2012 19:42:52 +0000 (19:42 +0000)]
[ms-inline asm] Add support for parsing the offset operator.  Callback for
CodeGen in the front-end not implemented yet.
rdar://12470317

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

11 years agoDon't crash if the load/store pointer is not a GEP.
Nadav Rotem [Mon, 22 Oct 2012 18:27:56 +0000 (18:27 +0000)]
Don't crash if the load/store pointer is not a GEP.

Fix by Shivarama Rao <Shivarama.Rao@amd.com>

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

11 years agoAdd a testcase for the previous commit.
Nadav Rotem [Mon, 22 Oct 2012 18:16:55 +0000 (18:16 +0000)]
Add a testcase for the previous commit.

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

11 years agoRevert r166407 because it caused analyzer tests to crash and broke self-host bots.
Argyrios Kyrtzidis [Mon, 22 Oct 2012 18:16:14 +0000 (18:16 +0000)]
Revert r166407 because it caused analyzer tests to crash and broke self-host bots.

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

11 years agoBBVectorize should ignore unreachable blocks.
Hal Finkel [Mon, 22 Oct 2012 18:00:55 +0000 (18:00 +0000)]
BBVectorize should ignore unreachable blocks.

Unreachable blocks can have invalid instructions. For example,
jump threading can produce self-referential instructions in
unreachable blocks. Also, we should not be spending time
optimizing unreachable code. Fixes PR14133.

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

11 years agoAdd the "ForceSizeOpt" attribute.
Nadav Rotem [Mon, 22 Oct 2012 17:33:31 +0000 (17:33 +0000)]
Add the "ForceSizeOpt" attribute.

Patch by Quentin Colombet <qcolombet@apple.com>

Original description:
"""
The attached patch is the first step to have a better control on Oz related optimizations.
The Oz optimization level focuses on code size, thus I propose to add an attribute called ForceSizeOpt.
"""

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

11 years agoRename a variable.
Nadav Rotem [Mon, 22 Oct 2012 04:53:05 +0000 (04:53 +0000)]
Rename a variable.

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

11 years agoVectorizer: optimize the generation of selects. If the condition is uniform, generate...
Nadav Rotem [Mon, 22 Oct 2012 04:38:00 +0000 (04:38 +0000)]
Vectorizer: optimize the generation of selects. If the condition is uniform, generate a scalar-cond select (i1 as selector).

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

11 years agoUpdate the loop vectorizer docs.
Nadav Rotem [Mon, 22 Oct 2012 03:52:53 +0000 (03:52 +0000)]
Update the loop vectorizer docs.

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

11 years agoReapply r166405, teaching tailcallelim to be smarter about nocapture, with a
Nick Lewycky [Mon, 22 Oct 2012 03:03:52 +0000 (03:03 +0000)]
Reapply r166405, teaching tailcallelim to be smarter about nocapture, with a
very small but very important bugfix:
  bool shouldExplore(Use *U) {
    Value *V = U->get();
    if (isa<CallInst>(V) || isa<InvokeInst>(V))
    [...]
should have read:
  bool shouldExplore(Use *U) {
    Value *V = U->getUser();
    if (isa<CallInst>(V) || isa<InvokeInst>(V))
Fixes PR14143!

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

11 years agoRevert r166405, "Teach TailRecursionElimination to consider 'nocapture' when deciding...
NAKAMURA Takumi [Mon, 22 Oct 2012 00:48:51 +0000 (00:48 +0000)]
Revert r166405, "Teach TailRecursionElimination to consider 'nocapture' when deciding whether"

It broke selfhosting stage2 in several builders.

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

11 years agoTeach TailRecursionElimination to consider 'nocapture' when deciding whether
Nick Lewycky [Sun, 21 Oct 2012 23:51:22 +0000 (23:51 +0000)]
Teach TailRecursionElimination to consider 'nocapture' when deciding whether
calls can be marked tail.

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

11 years agoDataLayout should use itself when calculating the size of a vector.
Hal Finkel [Sun, 21 Oct 2012 20:38:03 +0000 (20:38 +0000)]
DataLayout should use itself when calculating the size of a vector.

This is important for vectors of pointers because only DataLayout,
not the underlying vector type, knows how to calculate the size
of the pointers in the vector. Fixes PR14138.

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

11 years agoRevert r166390 "LoopIdiom: Replace custom dependence analysis with LoopDependenceAnal...
Benjamin Kramer [Sun, 21 Oct 2012 19:31:16 +0000 (19:31 +0000)]
Revert r166390 "LoopIdiom: Replace custom dependence analysis with LoopDependenceAnalysis."

It passes all tests, produces better results than the old code but uses the
wrong pass, LoopDependenceAnalysis, which is old and unmaintained. "Why is it
still in tree?", you might ask. The answer is obviously: "To confuse developers."

Just swapping in the new dependency pass sends the pass manager into an infinte
loop, I'll try to figure out why tomorrow.

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

11 years agoDon't crash when the Assignments vector is empty.
Jakob Stoklund Olesen [Sun, 21 Oct 2012 19:05:03 +0000 (19:05 +0000)]
Don't crash when the Assignments vector is empty.

Reported by Vincent Lejeune using an out-of-tree target.

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

11 years agoAvoid an extra hash lookup when inserting a value into the widen map.
Anders Carlsson [Sun, 21 Oct 2012 16:26:35 +0000 (16:26 +0000)]
Avoid an extra hash lookup when inserting a value into the widen map.

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

11 years agoSimplify code. No functionality change.
Jakub Staszak [Sun, 21 Oct 2012 15:36:03 +0000 (15:36 +0000)]
Simplify code. No functionality change.

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

11 years agoSimplify code. No functionality change.
Jakub Staszak [Sun, 21 Oct 2012 15:29:19 +0000 (15:29 +0000)]
Simplify code. No functionality change.

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

11 years agoLoopIdiom: Replace custom dependence analysis with LoopDependenceAnalysis.
Benjamin Kramer [Sun, 21 Oct 2012 15:03:07 +0000 (15:03 +0000)]
LoopIdiom: Replace custom dependence analysis with LoopDependenceAnalysis.

Requires a lot less code and complexity on loop-idiom's side and the more
precise analysis can catch more cases, like the one I included as a test case.
This also fixes the edge-case miscompilation from PR9481. I'm not entirely
sure that all cases are handled that the old checks handled but LDA will
certainly become smarter in the future.

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

11 years agoFix a bug in the vectorization of wide load/store operations.
Nadav Rotem [Sun, 21 Oct 2012 06:49:10 +0000 (06:49 +0000)]
Fix a bug in the vectorization of wide load/store operations.
We used a SCEV to detect that A[X] is consecutive. We assumed that X was
the induction variable. But X can be any expression that uses the induction
for example: X = i + 2;

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

11 years agoAdd support for reduction variables that do not start at zero.
Nadav Rotem [Sun, 21 Oct 2012 05:52:51 +0000 (05:52 +0000)]
Add support for reduction variables that do not start at zero.
This is important for nested-loop reductions such as :

In the innermost loop, the induction variable does not start with zero:

for (i = 0 .. n)
 for (j = 0 .. m)
  sum += ...

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

11 years agoDocument change. Describe the pass and some papers that inspired the design of the...
Nadav Rotem [Sun, 21 Oct 2012 04:04:25 +0000 (04:04 +0000)]
Document change. Describe the pass and some papers that inspired the design of the pass.

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

11 years agoVectorizer: fix a bug in the classification of induction/reduction phis.
Nadav Rotem [Sun, 21 Oct 2012 02:38:01 +0000 (02:38 +0000)]
Vectorizer: fix a bug in the classification of induction/reduction phis.

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

11 years agoAllow the commuted form of tied-operand constraints in tablegen ("$dst = $src",
Lang Hames [Sat, 20 Oct 2012 22:44:13 +0000 (22:44 +0000)]
Allow the commuted form of tied-operand constraints in tablegen ("$dst = $src",
rather than "$src = $dst").

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

11 years agoFix an infinite loop in the loop-vectorizer.
Nadav Rotem [Sat, 20 Oct 2012 20:45:01 +0000 (20:45 +0000)]
Fix an infinite loop in the loop-vectorizer.

PR14134.

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

11 years agoDocument current Doxygen use practices in Coding Standards. Mostly it is
Dmitri Gribenko [Sat, 20 Oct 2012 13:27:43 +0000 (13:27 +0000)]
Document current Doxygen use practices in Coding Standards.  Mostly it is
obvious stuff and most new code being committed conforms to that.  Some old
code does not; this might cause confusion and this is the motivation to
document the correct guidelines.

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

11 years agoSymbol hygiene: Make sure declarations and definitions match, make helper functions...
Benjamin Kramer [Sat, 20 Oct 2012 12:53:26 +0000 (12:53 +0000)]
Symbol hygiene: Make sure declarations and definitions match, make helper functions static.

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

11 years agoSROA: Simplify code. No functionality change.
Benjamin Kramer [Sat, 20 Oct 2012 12:04:57 +0000 (12:04 +0000)]
SROA: Simplify code. No functionality change.

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

11 years agoInstCombine: Fix an edge case where constant icmps could sneak into ConstantFoldInstO...
Benjamin Kramer [Sat, 20 Oct 2012 08:43:52 +0000 (08:43 +0000)]
InstCombine: Fix an edge case where constant icmps could sneak into ConstantFoldInstOperands and crash.

Have to refactor the ConstantFolder interface one day to define bugs like this away. Fixes PR14131.

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

11 years agoVectorize: teach cavVectorizeMemory to distinguish between A[i]+=x and A[B[i]]+=x.
Nadav Rotem [Sat, 20 Oct 2012 08:26:33 +0000 (08:26 +0000)]
Vectorize: teach cavVectorizeMemory to distinguish between A[i]+=x and A[B[i]]+=x.
If the pointer is consecutive then it is safe to read and write. If the pointer is non-loop-consecutive then
it is unsafe to vectorize it because we may hit an ordering issue.

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

11 years agoFix a typo
Nadav Rotem [Sat, 20 Oct 2012 05:03:27 +0000 (05:03 +0000)]
Fix a typo

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

11 years agoVectorizer: refactor the memory checks to a new function. No functionality change.
Nadav Rotem [Sat, 20 Oct 2012 04:59:06 +0000 (04:59 +0000)]
Vectorizer: refactor the memory checks to a new function. No functionality change.

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

11 years agoVectorization docs.
Nadav Rotem [Sat, 20 Oct 2012 02:34:34 +0000 (02:34 +0000)]
Vectorization docs.

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

11 years ago[ms-inline asm] Rename AsmOpRewrite to just AsmRewrite to be more generic. No functio...
Chad Rosier [Sat, 20 Oct 2012 01:02:45 +0000 (01:02 +0000)]
[ms-inline asm] Rename AsmOpRewrite to just AsmRewrite to be more generic. No functional change intended.

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