summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
Commit message (Collapse)AuthorAgeFilesLines
* Enhance MemDep: When alias analysis returns a partial alias result,Chris Lattner2011-04-261-24/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | return it as a clobber. This allows GVN to do smart things. Enhance GVN to be smart about the case when a small load is clobbered by a larger overlapping load. In this case, forward the value. This allows us to compile stuff like this: int test(void *P) { int tmp = *(unsigned int*)P; return tmp+*((unsigned char*)P+1); } into: _test: ## @test movl (%rdi), %ecx movzbl %ch, %eax addl %ecx, %eax ret which has one load. We already handled the case where the smaller load was from a must-aliased base pointer. llvm-svn: 130180
* Remove unused STL header includes.Jay Foad2011-04-231-1/+0
| | | | llvm-svn: 130068
* Fix another case of <rdar://problem/9184212> that only occurs with codeCameron Zwarich2011-04-201-31/+44
| | | | | | | generated by llvm-gcc, since llvm-gcc uses 2 i64s for passing a 4 x float vector on ARM rather than an i64 array like Clang. llvm-svn: 129878
* The bitcast case here is actually handled uniformly earlier in the function, soCameron Zwarich2011-04-201-8/+3
| | | | | | delete it. llvm-svn: 129877
* Cleanup some code to better use an early return style in preparation for addingCameron Zwarich2011-04-201-6/+10
| | | | | | more cases. llvm-svn: 129876
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-156-8/+8
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129558
* Fix an infinite alternation in JumpThreading where two transforms would ↵Owen Anderson2011-04-141-3/+15
| | | | | | | | | | repeatedly undo each other. The solution is to perform more aggressive constant folding to make one of the edges just folded away rather than trying to thread it. Fixes <rdar://problem/9284786>. Discovered with CSmith. llvm-svn: 129538
* Cleanup r129509 based on comments by ChrisMon P Wang2011-04-141-7/+6
| | | | llvm-svn: 129532
* Cleanup r129472 by using a utility routine as suggested by Eli.Mon P Wang2011-04-141-51/+43
| | | | llvm-svn: 129509
* fix a couple -Wsign-compare warnings.Chris Lattner2011-04-141-2/+2
| | | | llvm-svn: 129501
* Vectors with different number of elements of the same element type can haveMon P Wang2011-04-131-6/+64
| | | | | | | | the same allocation size but different primitive sizes(e.g., <3xi32> and <4xi32>). When ScalarRepl promotes them, it can't use a bit cast but should use a shuffle vector instead. llvm-svn: 129472
* Fixed the revision 129449.Junjie Gu2011-04-131-1/+1
| | | | llvm-svn: 129450
* Passing unroll parameters (unroll-count, threshold, and partial unroll) via ↵Junjie Gu2011-04-131-12/+23
| | | | | | | | | LoopUnroll class's ctor. Doing so will allow multiple context with different loop unroll parameters to run. This is a minor change and no effect on existing application. llvm-svn: 129449
* Add the alias analysis to the C api.Rafael Espindola2011-04-131-0/+9
| | | | llvm-svn: 129447
* Reapply r129401 with patch for clang.Bill Wendling2011-04-131-3/+0
| | | | llvm-svn: 129419
* Revert r129401 for now. Clang is using the old way of doing things.Bill Wendling2011-04-121-0/+3
| | | | llvm-svn: 129403
* Remove the unaligned load intrinsics in favor of using native unaligned loads.Bill Wendling2011-04-121-3/+0
| | | | | | | | | Now that we have a first-class way to represent unaligned loads, the unaligned load intrinsics are superfluous. First part of <rdar://problem/8460511>. llvm-svn: 129401
* Fix reassociate to use a worklist instead of recursing when newDan Gohman2011-04-121-59/+67
| | | | | | | | | reassociation opportunities are exposed. This fixes a bug where the nested reassociation expects to be the IR to be consistent, but it isn't, because the outer reassociation has disconnected some of the operands. rdar://9167457 llvm-svn: 129324
* Don't include Operator.h from InstrTypes.h.Jay Foad2011-04-111-0/+1
| | | | llvm-svn: 129271
* fix PR9523, a crash in looprotate on a non-canonical loop made out of ↵Chris Lattner2011-04-091-1/+5
| | | | | | indirectbr. llvm-svn: 129203
* Fix a bug where RecursivelyDeleteTriviallyDeadInstructions couldChris Lattner2011-04-091-3/+18
| | | | | | | delete the instruction pointed to by CGP's current instruction iterator, leading to a crash on the testcase. This fixes PR9578. llvm-svn: 129200
* Expose more passes to the C API.Rafael Espindola2011-04-071-0/+16
| | | | llvm-svn: 129087
* PR9634: Don't unconditionally tell the AliasSetTracker that the PreheaderLoadEli Friedman2011-04-071-21/+4
| | | | | | | | | | | is equivalent to any other relevant value; it isn't true in general. If it is equivalent, the LoopPromoter will tell the AST the equivalence. Also, delete the PreheaderLoad if it is unused. Chris, since you were the last one to make major changes here, can you check that this is sane? llvm-svn: 129049
* * The DSE code that tested for overlapping needed to take into account the factBill Wendling2011-03-301-1/+3
| | | | | | | | | | | | that one of the numbers is signed while the other is unsigned. This could lead to a wrong result when the signed was promoted to an unsigned int. * Add the data layout line to the testcase so that it will test the appropriate thing. Patch by David Terei! llvm-svn: 128577
* Remove PHINode::reserveOperandSpace(). Instead, add a parameter toJay Foad2011-03-307-15/+11
| | | | | | PHINode::Create() giving the (known or expected) number of operands. llvm-svn: 128537
* (Almost) always call reserveOperandSpace() on newly created PHINodes.Jay Foad2011-03-307-8/+16
| | | | llvm-svn: 128535
* DSE: Remove an early exit optimization that depended on the ordering of a ↵Benjamin Kramer2011-03-291-13/+0
| | | | | | | | SmallPtrSet. Fixes PR9569 and will hopefully make selfhost on ASLR-enabled systems more deterministic. llvm-svn: 128482
* Do some simple copy propagation through integer loads and stores when promotingCameron Zwarich2011-03-291-9/+14
| | | | | | | vector types. This helps a lot with inlined functions when using the ARM soft float ABI. Fixes <rdar://problem/9184212>. llvm-svn: 128453
* Simplification noticed by Frits.Bill Wendling2011-03-261-3/+2
| | | | llvm-svn: 128333
* Rework the logic that determines if a store completely overlaps an ealier store.Bill Wendling2011-03-261-15/+23
| | | | | | | | | | | There are two ways that a later store can comletely overlap a previous store: 1. They both start at the same offset, but the earlier store's size is <= the later's size, or 2. The earlier store's offset is > the later's offset, but it's offset + size doesn't extend past the later's offset + size. llvm-svn: 128332
* Fix a typo and add a test.Cameron Zwarich2011-03-261-1/+1
| | | | llvm-svn: 128331
* PR9561: A store with a negative offset (via GEP) could erroniously say that itBill Wendling2011-03-261-0/+2
| | | | | | | completely overlaps a previous store, thus mistakenly deleting that store. Check for this condition. llvm-svn: 128319
* Debug intrinsics must be skipped at the beginning and ends of blocks, lest theyCameron Zwarich2011-03-241-2/+6
| | | | | | affect the generated code. llvm-svn: 128217
* It is enough for the CallInst to have no uses to be made a tail call with a retCameron Zwarich2011-03-241-1/+1
| | | | | | void; it doesn't need to have a void type. llvm-svn: 128212
* s/UpdateDT/ModifiedDT/gDevang Patel2011-03-241-8/+8
| | | | llvm-svn: 128211
* Do early taildup of ret in CodeGenPrepare for potential tail calls that have aCameron Zwarich2011-03-241-17/+37
| | | | | | void return type. This fixes PR9487. llvm-svn: 128197
* Use an early return instead of a long if block.Cameron Zwarich2011-03-241-51/+51
| | | | llvm-svn: 128196
* When UpdateDT is set, DT is invalid, which could cause problems when trying toCameron Zwarich2011-03-241-2/+3
| | | | | | use it later. I couldn't make a test that hits this with the current code. llvm-svn: 128195
* Check for TLI so that -codegenprepare can be used from opt.Cameron Zwarich2011-03-241-0/+3
| | | | llvm-svn: 128194
* Fix PR9464 by correcting some math that just happened to be right in most casesCameron Zwarich2011-03-231-11/+10
| | | | | | that were hit in practice. llvm-svn: 128146
* Re-apply r127953 with fixes: eliminate empty return block if it has no ↵Evan Cheng2011-03-211-10/+122
| | | | | | predecessors; update dominator tree if cfg is modified. llvm-svn: 127981
* Revert r127953, "SimplifyCFG has stopped duplicating returns into predecessorsDaniel Dunbar2011-03-191-99/+4
| | | | | | to canonicalize IR", it broke a lot of things. llvm-svn: 127954
* SimplifyCFG has stopped duplicating returns into predecessors to canonicalize IREvan Cheng2011-03-191-4/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to have single return block (at least getting there) for optimizations. This is general goodness but it would prevent some tailcall optimizations. One specific case is code like this: int f1(void); int f2(void); int f3(void); int f4(void); int f5(void); int f6(void); int foo(int x) { switch(x) { case 1: return f1(); case 2: return f2(); case 3: return f3(); case 4: return f4(); case 5: return f5(); case 6: return f6(); } } => LBB0_2: ## %sw.bb callq _f1 popq %rbp ret LBB0_3: ## %sw.bb1 callq _f2 popq %rbp ret LBB0_4: ## %sw.bb3 callq _f3 popq %rbp ret This patch teaches codegenprep to duplicate returns when the return value is a phi and where the phi operands are produced by tail calls followed by an unconditional branch: sw.bb7: ; preds = %entry %call8 = tail call i32 @f5() nounwind br label %return sw.bb9: ; preds = %entry %call10 = tail call i32 @f6() nounwind br label %return return: %retval.0 = phi i32 [ %call10, %sw.bb9 ], [ %call8, %sw.bb7 ], ... [ 0, %entry ] ret i32 %retval.0 This allows codegen to generate better code like this: LBB0_2: ## %sw.bb jmp _f1 ## TAILCALL LBB0_3: ## %sw.bb1 jmp _f2 ## TAILCALL LBB0_4: ## %sw.bb3 jmp _f3 ## TAILCALL rdar://9147433 llvm-svn: 127953
* Remove TargetData and ValueTracking includes. I didn't mean for them to ↵Andrew Trick2011-03-181-4/+0
| | | | | | sneak in my last checkin. llvm-svn: 127842
* Added isValidRewrite() to check the result of ScalarEvolutionExpander.Andrew Trick2011-03-171-37/+82
| | | | | | | | | SCEV may generate expressions composed of multiple pointers, which can lead to invalid GEP expansion. Until we can teach SCEV to follow strict pointer rules, make sure no bad GEPs creep into IR. Fixes rdar://problem/9038671. llvm-svn: 127839
* whitespaceAndrew Trick2011-03-171-18/+18
| | | | llvm-svn: 127837
* Fix a comment.Cameron Zwarich2011-03-161-3/+3
| | | | llvm-svn: 127728
* Only convert allocas to scalars if it is profitable. The profitability metric ICameron Zwarich2011-03-161-2/+16
| | | | | | | | | | | chose is having a non-memcpy/memset use and being larger than any native integer type. Originally I chose having an access of a size smaller than the total size of the alloca, but this caused some minor issues on the spirit benchmark where SRoA runs again after some inlining. This fixes <rdar://problem/8613163>. llvm-svn: 127718
* Better use initializer lists.Cameron Zwarich2011-03-161-5/+2
| | | | llvm-svn: 127716
* Add a clarifying comment.Cameron Zwarich2011-03-161-1/+1
| | | | llvm-svn: 127715
OpenPOWER on IntegriCloud