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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Chad Rosier [Sat, 20 Oct 2012 00:47:08 +0000 (00:47 +0000)]
[ms-inline asm] If the state of the parser is ignore, then don't parse the
inline assembly. Also make sure the remove the ignored statements from the IR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166357
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Fri, 19 Oct 2012 23:27:19 +0000 (23:27 +0000)]
LoopVectorize: Keep the IRBuilder on the stack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166354
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Fri, 19 Oct 2012 23:15:00 +0000 (23:15 +0000)]
[ms-inline asm] Continue parsing even when we're in an ignore block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166352
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Fri, 19 Oct 2012 23:05:40 +0000 (23:05 +0000)]
Vectorizer: Add support for loop reductions.
For example:
for (i=0; i<n; i++)
sum += A[i] + B[i] + i;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166351
91177308-0d34-0410-b5e6-
96231b3b80d8
Shuxin Yang [Fri, 19 Oct 2012 23:00:20 +0000 (23:00 +0000)]
1. Remove noreturn attribute from __builtin_debugtrap().
(The change at Clang side was committed in r166345)
2. Cosmetic change in order to conform to coding standards.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166350
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Fri, 19 Oct 2012 22:57:33 +0000 (22:57 +0000)]
[ms-inline asm] Reset the opcode prior to parsing a statement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166349
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 19 Oct 2012 22:11:40 +0000 (22:11 +0000)]
[mips] Use 64-bit registers to return an sret pointer if target ABI is N64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166344
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Fri, 19 Oct 2012 22:10:54 +0000 (22:10 +0000)]
Grammar-o.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166343
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 19 Oct 2012 21:47:33 +0000 (21:47 +0000)]
[mips] Add code to do tail call optimization.
Currently, it is enabled only if option "enable-mips-tail-calls" is given and
all of the callee's arguments are passed in registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166342
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 19 Oct 2012 21:30:15 +0000 (21:30 +0000)]
[mips] Fix TAILCALL's operand node type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166341
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Fri, 19 Oct 2012 21:28:43 +0000 (21:28 +0000)]
revert r166264 because the LTO build is still failing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166340
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 19 Oct 2012 21:18:38 +0000 (21:18 +0000)]
[mips] Delete MipsFunctionInfo::MaxCallFrameSize which is no longer used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166339
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 19 Oct 2012 21:14:34 +0000 (21:14 +0000)]
[mips] Add tail call instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166338
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 19 Oct 2012 21:11:03 +0000 (21:11 +0000)]
[mips] Make the branch nodes used in jump instructions a template parameter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166337
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 19 Oct 2012 20:59:39 +0000 (20:59 +0000)]
Add node and enum for mips tail call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166318
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Fri, 19 Oct 2012 20:57:14 +0000 (20:57 +0000)]
[ms-inline asm] Have the TargetParser callback to Sema to determine the size of
a memory operand. Retain this information and then add the sizing directives
to the IR. This allows the backend to do proper instruction selection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166316
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Liao [Fri, 19 Oct 2012 20:43:54 +0000 (20:43 +0000)]
Add 'IntrNoReturn' for longjmp intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166314
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Fri, 19 Oct 2012 20:43:44 +0000 (20:43 +0000)]
SimplifyLibcalls: The return value of ffsll is always i32, even when the input is zero.
Fixes PR13028.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166313
91177308-0d34-0410-b5e6-
96231b3b80d8
Micah Villmow [Fri, 19 Oct 2012 20:36:22 +0000 (20:36 +0000)]
Fix a build error for ocaml bindings that was introduced with the TargetData --> DataLayout changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166309
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Fri, 19 Oct 2012 20:35:42 +0000 (20:35 +0000)]
[ms-inline asm] Add a MCAsmParserSemaCallback to the TargetAsmParser.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166308
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Dunbar [Fri, 19 Oct 2012 20:29:30 +0000 (20:29 +0000)]
lit: Rename the valgrind leaks feature to match what is currently used
(vg_leak).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166306
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Dunbar [Fri, 19 Oct 2012 20:29:27 +0000 (20:29 +0000)]
lit: Remove support for XTARGET.
- The XTARGET feature (inherited from old DG tests) was just confusing (and
barely ever used). The same effect can now be achieved with a combination of
the more useful REQUIRES and XFAIL.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166305
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Dunbar [Fri, 19 Oct 2012 20:12:00 +0000 (20:12 +0000)]
lit: Add 'valgrind' and 'valgrind-leaks' features when valgrind is used.
- These can be used with the XFAIL options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166303
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Dunbar [Fri, 19 Oct 2012 20:11:56 +0000 (20:11 +0000)]
tests: Stop mangling '-vg' into the triple, we don't use this currently.
- Also, lit is going to get a valgrind feature, instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166302
91177308-0d34-0410-b5e6-
96231b3b80d8
Shuxin Yang [Fri, 19 Oct 2012 20:11:16 +0000 (20:11 +0000)]
This patch is to fix radar://
8426430. It is about llvm support of __builtin_debugtrap()
which is supposed to consistently raise SIGTRAP across all systems. In contrast,
__builtin_trap() behave differently on different systems. e.g. it raises SIGTRAP on ARM, and
SIGILL on X86. The purpose of __builtin_debugtrap() is to consistently provide "trap"
functionality, in the mean time preserve the compatibility with on gcc on __builtin_trap().
The X86 backend is already able to handle debugtrap(). This patch is to:
1) make front-end recognize "__builtin_debugtrap()" (emboddied in the one-line change to Clang).
2) In DAG legalization phase, by default, "debugtrap" will be replaced with "trap", which
make the __builtin_debugtrap() "available" to all existing ports without the hassle of
changing their code.
3) If trap-function is specified (via -trap-func=xyz to llc), both __builtin_debugtrap() and
__builtin_trap() will be expanded into the function call of the specified trap function.
This behavior may need change in the future.
The provided testing-case is to make sure 2) and 3) are working for ARM port, and we
already have a testing case for x86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166300
91177308-0d34-0410-b5e6-
96231b3b80d8