aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Teach the cost model about the optimization in r169904: Truncation of ↵Nadav Rotem2012-12-131-1/+1
| | | | | | induction variables costs the same as scalar trunc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170051 91177308-0d34-0410-b5e6-96231b3b80d8
* unHECKify test fixed by Jacob in r159003.Jakub Staszak2012-12-121-8/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170023 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify negated bit testDavid Majnemer2012-12-121-0/+26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170020 91177308-0d34-0410-b5e6-96231b3b80d8
* unHECKify test. It was fixed by Chris in 2009.Jakub Staszak2012-12-121-8/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170017 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo in test-case.Jakub Staszak2012-12-121-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170015 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo.Jakub Staszak2012-12-121-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170006 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorizer: Use the "optsize" attribute to decide if we are allowed to ↵Nadav Rotem2012-12-121-0/+170
| | | | | | increase the function size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170004 91177308-0d34-0410-b5e6-96231b3b80d8
* - Fix a problematic way in creating all-the-1 APInt.Shuxin Yang2012-12-121-0/+10
| | | | | | | - Propagate "exact" bit of [l|a]shr instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169942 91177308-0d34-0410-b5e6-96231b3b80d8
* Added a slew of SimplifyInstruction floating-point optimizations, many of ↵Michael Ilseman2012-12-122-0/+107
| | | | | | | | | | | | | | | | | | which take advantage of fast-math flags. Test cases included. fsub X, +0 ==> X fsub X, -0 ==> X, when we know X is not -0 fsub +/-0.0, (fsub -0.0, X) ==> X fsub nsz +/-0.0, (fsub +/-0.0, X) ==> X fsub nnan ninf X, X ==> 0.0 fadd nsz X, 0 ==> X fadd [nnan ninf] X, (fsub [nnan ninf] 0, X) ==> 0 where nnan and ninf have to occur at least once somewhere in this expression fmul X, 1.0 ==> X git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169940 91177308-0d34-0410-b5e6-96231b3b80d8
* PR14574. Fix a bug in the code that calculates the mask the converted PHIs ↵Nadav Rotem2012-12-111-0/+44
| | | | | | in if-conversion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169916 91177308-0d34-0410-b5e6-96231b3b80d8
* Loop Vectorize: optimize the vectorization of trunc(induction_var). The ↵Nadav Rotem2012-12-114-4/+33
| | | | | | truncation is now done on scalars. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169904 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR14565. Don't if-convert loops that have switch statements in them.Nadav Rotem2012-12-111-0/+39
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169813 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for reverse induction variables. For example:Nadav Rotem2012-12-101-4/+2
| | | | | | | | | while (i--) sum+=A[i]; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169752 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR14548: SROA was crashing on a mixture of i1 and i8 loads and stores.Chandler Carruth2012-12-102-7/+31
| | | | | | | | | | | | | | | | | | | When SROA was evaluating a mixture of i1 and i8 loads and stores, in just a particular case, it would tickle a latent bug where we compared bits to bytes rather than bits to bits. As a consequence of the latent bug, we would allow integers through which were not byte-size multiples, a situation the later rewriting code was never intended to handle. In release builds this could trigger all manner of oddities, but the reported issue in PR14548 was forming invalid bitcast instructions. The only downside of this fix is that it makes it more clear that SROA in its current form is not capable of handling mixed i1 and i8 loads and stores. Sometimes with the previous code this would work by luck, but usually it would crash, so I'm not terribly worried. I'll watch the LNT numbers just to be sure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169719 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorize: support vectorizing intrinsic callsPaul Redmond2012-12-091-0/+851
| | | | | | | | | | - added function to VectorTargetTransformInfo to query cost of intrinsics - vectorize trivially vectorizable intrinsic calls such as sin, cos, log, etc. Reviewed by: Nadav git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169711 91177308-0d34-0410-b5e6-96231b3b80d8
* - Re-enable population count loop idiom recognization Shuxin Yang2012-12-092-0/+126
| | | | | | | | - fix a bug which cause sigfault. - add two testing cases which was causing crash git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169687 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the patches adding a popcount loop idiom recognition pass.Chandler Carruth2012-12-082-82/+0
| | | | | | | | | | | | | | There are still bugs in this pass, as well as other issues that are being worked on, but the bugs are crashers that occur pretty easily in the wild. Test cases have been sent to the original commit's review thread. This reverts the commits: r169671: Fix a logic error. r169604: Move the popcnt tests to an X86 subdirectory. r168931: Initial commit adding the pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169683 91177308-0d34-0410-b5e6-96231b3b80d8
* The test unconditionally assumes a particular cpu has a backend build in the ↵David Tweed2012-12-072-0/+6
| | | | | | | | | | | target. Buildbots for some hosts may choose to build only their own backend in order to maximise testing-turnaround time. Move the test into a prefixed directory so lit's standard "backend specific" suppression can be done. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169604 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support to ValueTracking for determining that a pointer is non-nullChandler Carruth2012-12-071-0/+40
| | | | | | | | | | | | | | | | | | | | | | | by virtue of inbounds GEPs that preclude a null pointer. This is a very common pattern in the code generated by std::vector and other standard library routines which use allocators that test for null pervasively. This is one step closer to teaching Clang+LLVM to be able to produce an empty function for: void f() { std::vector<int> v; v.push_back(1); v.push_back(2); v.push_back(3); v.push_back(4); } Which is related to getting them to completely fold SmallVector push_back sequences into constants when inlining and other optimizations make that a possibility. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169573 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typos in CHECK lines.Dmitri Gribenko2012-12-062-3/+3
| | | | | | | Patch by Alexander Zinenko. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169547 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a typoShuxin Yang2012-12-051-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169345 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug in vectorization of if-converted reduction variables. If theNadav Rotem2012-12-041-0/+38
| | | | | | | | | reduction variable is not used outside the loop then we ran into an endless loop. This change checks if we found the original PHI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169324 91177308-0d34-0410-b5e6-96231b3b80d8
* For rdar://12329730, last piece.Shuxin Yang2012-12-043-4/+20
| | | | | | | | | | | | | | | | | | | | | | This change attempts to simplify (X^Y) -> X or Y in the user's context if we know that only bits from X or Y are demanded. A minimized case is provided bellow. This change will simplify "t>>16" into "var1 >>16". ============================================================= unsigned foo (unsigned val1, unsigned val2) { unsigned t = val1 ^ 1234; return (t >> 16) | t; // NOTE: t is used more than once. } ============================================================= Note that if the "t" were used only once, the expression would be finally optimized as well. However, with with this change, the optimization will take place earlier. Reviewed by Nadav, Thanks a lot! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169317 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for reduction variables when IF-conversion is enabled. Nadav Rotem2012-12-041-0/+48
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169288 91177308-0d34-0410-b5e6-96231b3b80d8
* Add the last part that is needed for vectorization of if-converted code.Nadav Rotem2012-12-041-0/+60
| | | | | | | | | | | | | | | | | | | Added the code that actually performs the if-conversion during vectorization. We can now vectorize this code: for (int i=0; i<n; ++i) { unsigned k = 0; if (a[i] > b[i]) <------ IF inside the loop. k = k * 5 + 3; a[i] = k; <---- K is a phi node that becomes vector-select. } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169217 91177308-0d34-0410-b5e6-96231b3b80d8
* rdar://12329730 (2nd part, revised)Shuxin Yang2012-12-041-1/+1
| | | | | | | | The type of shirt-right (logical or arithemetic) should remain unchanged when transforming "X << C1 >> C2" into "X << (C1-C2)" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169209 91177308-0d34-0410-b5e6-96231b3b80d8
* rdar://12329730 (2nd part)Shuxin Yang2012-12-043-4/+80
| | | | | | | | | | | | This change tries to simmplify E1 = " X >> C1 << C2" into : - E2 = "X << (C2 - C1)" if C2 > C1, or - E2 = "X >> (C1 - C2)" if C1 > C2, or - E2 = X if C1 == C2. Reviewed by Nadav. Thanks! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169182 91177308-0d34-0410-b5e6-96231b3b80d8
* SROA: Avoid struct and array types early to avoid creating an overly large ↵Benjamin Kramer2012-12-011-0/+13
| | | | | | | | | | integer type. Fixes PR14465. Differential Revision: http://llvm-reviews.chandlerc.com/D148 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169084 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert previous check in r168581, r169079 as they are still in code review ↵Zhou Sheng2012-12-011-8309/+0
| | | | | | status. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169083 91177308-0d34-0410-b5e6-96231b3b80d8
* The patch is to improve the memory footprint of pass GlobalOpt. Zhou Sheng2012-12-011-0/+8309
| | | | | | | | | | | | | Also check in a case to repeat the issue, on which 'opt -globalopt' consumes 1.6GB memory. The big memory footprint cause is that current GlobalOpt one by one hoists and stores the leaf element constant into the global array, in each iteration, it recreates the global array initializer constant and leave the old initializer alone. This may result in many obsolete constants left. For example: we have global array @rom = global [16 x i32] zeroinitializer After the first element value is hoisted and installed: @rom = global [16 x i32] [ 1, 0, 0, ... ] After the second element value is installed: @rom = global [16 x 32] [ 1, 2, 0, 0, ... ] // here the previous initializer is obsolete ... When the transform is done, we have 15 obsolete initializers left useless. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169079 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix logic to determine whether to turn a switch into a lookup table. WhenEvan Cheng2012-11-301-0/+26
| | | | | | | | | | the tables cannot fit in registers (i.e. bitmap), do not emit the table if it's using an illegal type. rdar://12779436 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168970 91177308-0d34-0410-b5e6-96231b3b80d8
* rdar://12100355 (part 1)Shuxin Yang2012-11-291-0/+76
| | | | | | | | | | | | | | | This revision attempts to recognize following population-count pattern: while(a) { c++; ... ; a &= a - 1; ... }, where <c> and <a>could be used multiple times in the loop body. TODO: On X8664 and ARM, __buildin_ctpop() are not expanded to a efficent instruction sequence, which need to be improved in the following commits. Reviewed by Nadav, really appreciate! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168931 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate puts optimizationsMeador Inge2012-11-292-15/+31
| | | | | | | | | | | | This patch migrates the puts optimizations from the simplify-libcalls pass into the instcombine library call simplifier. All the simplifiers from simplify-libcalls have now been migrated to instcombine. Yay! Just a few other bits to migrate (prototype attribute inference and a few statistics) and simplify-libcalls can finally be put to rest. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168925 91177308-0d34-0410-b5e6-96231b3b80d8
* Follow up to 168711: It's safe to base this analysis on the found compare, ↵Benjamin Kramer2012-11-291-0/+49
| | | | | | | | just return the value for the right predicate. Thanks to Andy for catching this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168921 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a typoShuxin Yang2012-11-291-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168909 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate fputs optimizationsMeador Inge2012-11-293-31/+45
| | | | | | | This patch migrates the fputs optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168893 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate fwrite optimizationsMeador Inge2012-11-292-13/+57
| | | | | | | This patch migrates the fwrite optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168892 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate fprintf optimizationsMeador Inge2012-11-294-59/+80
| | | | | | | This patch migrates the fprintf optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168891 91177308-0d34-0410-b5e6-96231b3b80d8
* Instruction::isAssociative() returns true for fmul/fadd if they are tagged ↵Shuxin Yang2012-11-291-0/+32
| | | | | | | | | "unsafe" mode. Approved by: Eli and Michael. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168848 91177308-0d34-0410-b5e6-96231b3b80d8
* Add error handling in getInt.Patrik Hägglund2012-11-281-2/+1
| | | | | | | | | | | Accordingly, update a testcase with a broken datalayout string. Also, we never parse negative numbers, because '-' is used as a separator. Therefore, use unsigned as result type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168785 91177308-0d34-0410-b5e6-96231b3b80d8
* BBVectorize: Correctly merge SubclassOptionalDataHal Finkel2012-11-281-0/+24
| | | | | | | When two instructions are combined into a vector instruction, the resulting instruction must have the most-conservative flags. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168765 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Don't replace all uses for instructions with no usesMeador Inge2012-11-271-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | My commit to migrate the printf simplifiers from the simplify-libcalls in r168604 introduced a regression reported by Duncan [1]. The problem is that in some cases the library call simplifier can return a new value that has no uses and the new value's type is different than the old value's type (which is fine because there are no uses). The specific case that triggered the bug looked something like: declare void @printf(i8*, ...) ... call void (i8*, ...)* @printf(i8* %fmt) Which we want to optimized into: call i32 @putchar(i32 104) However, the code was attempting to replace all uses of the printf with the putchar and the types differ, hence a crash. This is fixed by *just* deleting the original instruction when there are no uses. The old simplify-libcalls pass is already doing something similar. [1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-November/056338.html git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168716 91177308-0d34-0410-b5e6-96231b3b80d8
* SCEV: Even if the latch terminator is foldable we can't deduce the result of ↵Benjamin Kramer2012-11-271-0/+54
| | | | | | | | an unrelated condition with it. Fixes PR14432. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168711 91177308-0d34-0410-b5e6-96231b3b80d8
* Move sprintf simplifier tests to test/Transforms/InstCombineMeador Inge2012-11-272-48/+26
| | | | | | | The tests from SPrintF.ll should have been migrated to sprintf-1.ll in r168677, but I forgot to do it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168702 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the dependent libraries feature.Bill Wendling2012-11-272-2/+0
| | | | | | | The dependent libraries feature was never used and has bit-rotted. Remove it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168694 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm/test/Transforms/SimplifyLibCalls: FileCheck-ize 3 tests.NAKAMURA Takumi2012-11-273-6/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168691 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm/test/Transforms/SimplifyLibCalls/SPrintF.ll: Handle @sprintf() with ↵NAKAMURA Takumi2012-11-271-2/+1
| | | | | | -instcombine, not -simplify-libcalls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168690 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm/test/Transforms/SimplifyLibCalls/SPrintF.ll: Fix datalayout since r168516.NAKAMURA Takumi2012-11-273-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168689 91177308-0d34-0410-b5e6-96231b3b80d8
* Trailing linefeeds.NAKAMURA Takumi2012-11-272-2/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168688 91177308-0d34-0410-b5e6-96231b3b80d8
* test/Transforms/SimplifyLibCalls/SPrintF.ll: Suppress this for now. r168677 ↵NAKAMURA Takumi2012-11-271-0/+1
| | | | | | | | unveiled another failure. FYI, this test makes no sense with "not grep"... I saw "assertion failure" in stderr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168679 91177308-0d34-0410-b5e6-96231b3b80d8