summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Enhance MemDep: When alias analysis returns a partial alias result,Chris Lattner2011-04-261-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix another case of <rdar://problem/9184212> that only occurs with codeCameron Zwarich2011-04-201-0/+15
| | | | | | | 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
* Add test cases for Jay's r129641 and fix a 32-bit-centric testcase in a file ↵Frits van Bommel2011-04-161-5/+81
| | | | | | with a 64-bit datalayout. llvm-svn: 129643
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-1510-11/+11
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129558
* Add an instcombine for constructs like a | -(b != c); a select is moreEli Friedman2011-04-141-0/+19
| | | | | | | canonical, and generally leads to better code. Found while looking at an article about saturating arithmetic. llvm-svn: 129545
* Fix an infinite alternation in JumpThreading where two transforms would ↵Owen Anderson2011-04-141-0/+31
| | | | | | | | | | 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
* Vectors with different number of elements of the same element type can haveMon P Wang2011-04-131-0/+46
| | | | | | | | 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
* Fix reassociate to use a worklist instead of recursing when newDan Gohman2011-04-121-0/+24
| | | | | | | | | 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
* remove the StructRetPromotion pass. It is unused, not maintained andChris Lattner2011-04-115-87/+0
| | | | | | | has some bugs. If this is interesting functionality, it should be reimplemented in the argpromotion pass. llvm-svn: 129314
* Add back a couple checks removed by r129128; the fact that an intitializerEli Friedman2011-04-091-0/+5
| | | | | | | is an array of structures doesn't imply it's a ConstantArray of ConstantStruct. llvm-svn: 129207
* fix PR9523, a crash in looprotate on a non-canonical loop made out of ↵Chris Lattner2011-04-091-0/+16
| | | | | | indirectbr. llvm-svn: 129203
* PR9604; try to deal with RAUW updates correctly in the AST. I'm not convincedEli Friedman2011-04-091-0/+49
| | | | | | | it's completely safe to cache the AST across LICM runs even with this fix, but this fix can't hurt. llvm-svn: 129198
* Test for r129190.Eli Friedman2011-04-091-0/+32
| | | | llvm-svn: 129197
* Do not let debug info interfer with branch folding.Devang Patel2011-04-071-0/+58
| | | | llvm-svn: 129114
* While hoisting common code from if/else, hoist debug info intrinsics if they ↵Devang Patel2011-04-071-0/+53
| | | | | | match. llvm-svn: 129078
* PR9634: Don't unconditionally tell the AliasSetTracker that the PreheaderLoadEli Friedman2011-04-072-1/+40
| | | | | | | | | | | 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
* This testcase passed even without the fix. Added the target info to make theNadav Rotem2011-04-061-0/+3
| | | | | | test fail (without the fix). Thanks Dan. llvm-svn: 128999
* InstCombine optimizes gep(bitcast(x)) even when the bitcasts casts away addressNadav Rotem2011-04-051-0/+16
| | | | | | | space info. We crash with an assert in this case. This change checks that the address space of the bitcasted pointer is the same as the gep ptr. llvm-svn: 128884
* PR9446: RecursivelyDeleteTriviallyDeadInstructions can delete the instructionEli Friedman2011-04-021-0/+32
| | | | | | | | | | | after the given instruction; make sure to handle that case correctly. (It's difficult to trigger; the included testcase involves a dead block, but I don't think that's a requirement.) While I'm here, get rid of the unnecessary warning about SimplifyInstructionsInBlock, since it should work correctly as far as I know. llvm-svn: 128782
* InstCombine: Turn icmp + sext into bitwise/integer ops when the input has ↵Benjamin Kramer2011-04-011-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | only one unknown bit. int test1(unsigned x) { return (x&8) ? 0 : -1; } int test3(unsigned x) { return (x&8) ? -1 : 0; } before (x86_64): _test1: andl $8, %edi cmpl $1, %edi sbbl %eax, %eax ret _test3: andl $8, %edi cmpl $1, %edi sbbl %eax, %eax notl %eax ret after: _test1: shrl $3, %edi andl $1, %edi leal -1(%rdi), %eax ret _test3: shll $28, %edi movl %edi, %eax sarl $31, %eax ret llvm-svn: 128732
* Instcombile optimization: extractelement(cast) -> cast(extractelement)Nadav Rotem2011-03-311-0/+27
| | | | llvm-svn: 128683
* InstCombine: APFloat can't perform arithmetic on PPC double doubles, don't ↵Benjamin Kramer2011-03-311-0/+9
| | | | | | | | even try. Thanks Eli! llvm-svn: 128676
* InstCombine: Fix transform to use the swapped predicate.Benjamin Kramer2011-03-311-1/+1
| | | | | | Thanks Frits! llvm-svn: 128628
* InstCombine: fold fcmp (fneg x), (fneg y) -> fcmp x, yBenjamin Kramer2011-03-311-0/+9
| | | | llvm-svn: 128627
* InstCombine: fold fcmp pred (fneg x), C -> fcmp swap(pred) x, -CBenjamin Kramer2011-03-311-0/+8
| | | | llvm-svn: 128626
* InstCombine: Shrink "fcmp (fpext x), C" to "fcmp x, C" if C can be ↵Benjamin Kramer2011-03-311-0/+23
| | | | | | | | losslessly converted to the type of x. Fixes PR9592. llvm-svn: 128625
* InstCombine: fold fcmp (fpext x), (fpext y) -> fcmp x, y.Benjamin Kramer2011-03-311-0/+11
| | | | llvm-svn: 128624
* * The DSE code that tested for overlapping needed to take into account the factBill Wendling2011-03-301-0/+1
| | | | | | | | | | | | 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
* Avoid turning a floating point division with a constant power of two into a ↵Benjamin Kramer2011-03-301-1/+1
| | | | | | | | | denormal multiplication. Some platforms may treat denormals as zero, on other platforms multiplication with a subnormal is slower than dividing by a normal. llvm-svn: 128555
* InstCombine: If the divisor of an fdiv has an exact inverse, turn it into an ↵Benjamin Kramer2011-03-301-0/+25
| | | | | | | | fmul. Fixes PR9587. llvm-svn: 128546
* InstCombine: Add a few missing combines for ANDs and ORs of sign bit tests.Benjamin Kramer2011-03-291-0/+79
| | | | | | | | On x86 we now compile "if (a < 0 && b < 0)" into testl %edi, %esi js IF.THEN llvm-svn: 128496
* Do some simple copy propagation through integer loads and stores when promotingCameron Zwarich2011-03-292-1/+54
| | | | | | | vector types. This helps a lot with inlined functions when using the ARM soft float ABI. Fixes <rdar://problem/9184212>. llvm-svn: 128453
* Teach the transformation that moves binary operators around selects to preserveNick Lewycky2011-03-271-0/+12
| | | | | | the subclass optional data. llvm-svn: 128388
* Constant folding support for calls to umul.with.overflow(), basically ↵Frits van Bommel2011-03-271-8/+33
| | | | | | identical to the smul.with.overflow() code. llvm-svn: 128379
* Add a small missed optimization: turn X == C ? X : Y into X == C ? C : Y. ThisNick Lewycky2011-03-271-0/+13
| | | | | | | | | | removes one use of X which helps it pass the many hasOneUse() checks. In my analysis, this turns up very often where X = A >>exact B and that can't be simplified unless X has one use (except by increasing the lifetime of A which is generally a performance loss). llvm-svn: 128373
* Fix a typo and add a test.Cameron Zwarich2011-03-261-0/+15
| | | | llvm-svn: 128331
* PR9561: A store with a negative offset (via GEP) could erroniously say that itBill Wendling2011-03-261-0/+22
| | | | | | | completely overlaps a previous store, thus mistakenly deleting that store. Check for this condition. llvm-svn: 128319
* Fix PR9464 by correcting some math that just happened to be right in most casesCameron Zwarich2011-03-231-0/+16
| | | | | | that were hit in practice. llvm-svn: 128146
* Add an optimization to GlobalOpt that eliminates calls to __cxa_atexit, if ↵Anders Carlsson2011-03-201-0/+31
| | | | | | the function passed is empty. llvm-svn: 127970
* Avoid creating canonical induction variables for non-native types.Andrew Trick2011-03-1818-18/+22
| | | | | | | | For example, on 32-bit architecture, don't promote all uses of the IV to 64-bits just because one use is a 64-bit cast. Alternate implementation of the patch by Arnaud de Grandmaison. llvm-svn: 127884
* FileCheck-ize and update test.Eli Friedman2011-03-181-6/+9
| | | | llvm-svn: 127845
* Try to not lose variable's debug info during instcombine.Devang Patel2011-03-171-0/+57
| | | | | | | This is done by lowering dbg.declare intrinsic into dbg.value intrinsic. Radar 9143931. llvm-svn: 127834
* Only convert allocas to scalars if it is profitable. The profitability metric ICameron Zwarich2011-03-161-0/+27
| | | | | | | | | | | 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
* Add native integer type TargetData to some existing tests.Cameron Zwarich2011-03-162-2/+2
| | | | llvm-svn: 127717
* Do not add PHIs with no users when creating LCSSA form. Patch by Andrew Clinton.Cameron Zwarich2011-03-152-2/+38
| | | | llvm-svn: 127674
* PR9450: Make switch optimization in SimplifyCFG not dependent on the orderingEli Friedman2011-03-151-8/+48
| | | | | | of pointers in an std::map. llvm-svn: 127650
* If we don't know how long a string is we can't fold an _chk version to theEric Christopher2011-03-151-0/+18
| | | | | | | | normal version. Fixes rdar://9123638 llvm-svn: 127636
* Teach ComputeMaskedBits about sub nsw.Benjamin Kramer2011-03-121-0/+23
| | | | llvm-svn: 127548
* Roll r127459 back in:Cameron Zwarich2011-03-111-1/+2
| | | | | | | | | | | Optimize trivial branches in CodeGenPrepare, which often get created from the lowering of objectsize intrinsics. Unfortunately, a number of tests were relying on llc not optimizing trivial branches, so I had to add an option to allow them to continue to test what they originally tested. This fixes <rdar://problem/8785296> and <rdar://problem/9112893>. llvm-svn: 127498
* Revert r127459, "Optimize trivial branches in CodeGenPrepare, which often getDaniel Dunbar2011-03-111-2/+1
| | | | | | created from the", it broke some GCC test suite tests. llvm-svn: 127477
OpenPOWER on IntegriCloud