summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Now that SROA can form alloca's for dynamic vector accesses, further improve ↵Pete Cooper2012-06-171-33/+62
| | | | | | it to be able to replace operations on these vector alloca's with insert/extract element insts llvm-svn: 158623
* Teach BBVectorize to combine, when possible, or discard metadata when fusing ↵Hal Finkel2012-06-161-0/+49
| | | | | | | | | | | | instructions. The present implementation handles only TBAA and FP metadata, discarding everything else. For debug metadata, the current behavior is maintained (the debug metadata associated with one of the instructions will be kept, discarding that attached to the other). This should address PR 13040. llvm-svn: 158606
* Fix crash from r158529 on Bullet.Pete Cooper2012-06-161-0/+55
| | | | | | | | Dynamic GEPs created by SROA needed to insert extra "i32 0" operands to index through structs and arrays to get to the vector being indexed. llvm-svn: 158590
* Unit test for LSR kind=Special fix: r158536.Andrew Trick2012-06-151-0/+102
| | | | llvm-svn: 158570
* Allow SROA to split up an array of vectors into multiple vectors, even when ↵Pete Cooper2012-06-151-0/+83
| | | | | | the vectors are dynamically indexed llvm-svn: 158529
* Some optimizations done by globalopt are safe only for internal linkage, notRafael Espindola2012-06-151-0/+12
| | | | | | | | linkonce linkage. For example, it is not valid to add unnamed_addr. This also fixes a crash in g++.dg/opt/static5.C. llvm-svn: 158528
* Fix issues (infinite loop and/or crash) with self-referential instructions, forDuncan Sands2012-06-151-0/+25
| | | | | | | example degenerate phi nodes and binops that use themselves in unreachable code. Thanks to Charles Davis for the testcase that uncovered this can of worms. llvm-svn: 158508
* Recommit r158407: Allow SROA to look at a vector type and see if the offset ↵Pete Cooper2012-06-141-7/+18
| | | | | | is out of range to be replaced with a scalar access. Now with additional fix and test for indexing into a vector inside a struct llvm-svn: 158479
* Implement the isSafeToDiscardIfUnused predicate and use it in globalopt andRafael Espindola2012-06-141-4/+20
| | | | | | | globaldce. Globaldce was already removing linkonce globals, but globalopt was not. llvm-svn: 158476
* Revert r158454: Allow SROA to look at a vector type... Its breaking the ↵Pete Cooper2012-06-141-18/+7
| | | | | | | | vectorise buildbot This reverts commit 12c1f86ffa731e2952c80d2cc577000c96b8962c. llvm-svn: 158462
* Recommit r158407: Allow SROA to look at a vector type and see if the offset ↵Pete Cooper2012-06-141-7/+18
| | | | | | is out of range to be replaced with a scalar access. Now with additional fix and test for indexing into a vector inside a struct llvm-svn: 158454
* InstCombine: fix a bug when combining (fcmp cc0 x, y) && (fcmp cc1 x, y).Manman Ren2012-06-141-0/+11
| | | | | | uno && ueq was converted to ueq, it should be converted to uno. llvm-svn: 158441
* Revert "Allow SROA to look at a vector type and see if the offset is out of ↵Pete Cooper2012-06-131-4/+7
| | | | | | | | range to be replaced with a scalar access" This reverts commit 51786e0aaec76b973205066bd44f7f427b21969f. llvm-svn: 158408
* Allow SROA to look at a vector type and see if the offset is out of range to ↵Pete Cooper2012-06-131-7/+4
| | | | | | be replaced with a scalar access llvm-svn: 158407
* It is possible for several constants which aren't individually absorbing toDuncan Sands2012-06-131-0/+11
| | | | | | | combine to the absorbing element. Thanks to nbjoerg on IRC for pointing this out. llvm-svn: 158399
* SimplifyCFG: fold unconditional branch to its predecessor if profitable.Manman Ren2012-06-131-0/+33
| | | | | | | | | | This patch extends FoldBranchToCommonDest to fold unconditional branches. For unconditional branches, we fold them if it is easy to update the phi nodes in the common successors. rdar://10554090 llvm-svn: 158392
* Use std::map rather than SmallMap because SmallMap assumes that the value hasDuncan Sands2012-06-122-13/+16
| | | | | | | POD type, causing memory corruption when mapping to APInts with bitwidth > 64. Merge another crash testcase into crash.ll while there. llvm-svn: 158369
* Now that Reassociate's LinearizeExprTree can look through arbitrary expressionDuncan Sands2012-06-121-0/+252
| | | | | | | | | | | | | | | | | topologies, it is quite possible for a leaf node to have huge multiplicity, for example: x0 = x*x, x1 = x0*x0, x2 = x1*x1, ... rapidly gives a value which is x raised to a vast power (the multiplicity, or weight, of x). This patch fixes the computation of weights by correctly computing them no matter how big they are, rather than just overflowing and getting a wrong value. It turns out that the weight for a value never needs more bits to represent than the value itself, so it is enough to represent weights as APInts of the same bitwidth and do the right overflow-avoiding dance steps when computing weights. As a side-effect it reduces the number of multiplies needed in some cases of large powers. While there, in view of external uses (eg by the vectorizer) I made LinearizeExprTree static, pushing the rank computation out into users. This is progress towards fixing PR13021. llvm-svn: 158358
* InstCombine: Turn (zext A) == (B & (1<<X)-1) into A == (trunc B), narrowing ↵Benjamin Kramer2012-06-101-0/+22
| | | | | | | | | | | | | | | | | | | | the compare. This saves a cast, and zext is more expensive on platforms with subreg support than trunc is. This occurs in the BSD implementation of memchr(3), see PR12750. On the synthetic benchmark from that bug stupid_memchr and bsd_memchr have the same performance now when not inlining either function. stupid_memchr: 323.0us bsd_memchr: 321.0us memchr: 479.0us where memchr is the llvm-gcc compiled bsd_memchr from osx lion's libc. When inlining is enabled bsd_memchr still regresses down to llvm-gcc memchr time, I haven't fully understood the issue yet, something is grossly mangling the loop after inlining. llvm-svn: 158297
* canonicalize:Nuno Lopes2012-06-081-0/+24
| | | | | | | | | | | | | | -%a + 42 into 42 - %a previously we were emitting: -(%a + 42) This fixes the infinite loop in PR12338. The generated code is still not perfect, though. Will work on that next llvm-svn: 158237
* Revert commit 158073 while waiting for a fix. The issue is that reassociateDuncan Sands2012-06-081-0/+21
| | | | | | | | | | | | | | | | can move instructions within the instruction list. If the instruction just happens to be the one the basic block iterator is pointing to, and it is moved to a different basic block, then we get into an infinite loop due to the iterator running off the end of the basic block (for some reason this doesn't fire any assertions). Original commit message: Grab-bag of reassociate tweaks. Unify handling of dead instructions and instructions to reoptimize. Exploit this to more systematically eliminate dead instructions (this isn't very useful in practice but is convenient for analysing some testcase I am working on). No need for WeakVH any more: use an AssertingVH instead. llvm-svn: 158199
* Fix a bug in FoldSelectOpOp. Bitcast ops may change the number of vector ↵Nadav Rotem2012-06-071-0/+11
| | | | | | elements, which may disagree with the select condition type. llvm-svn: 158166
* Adding a missing -S to the opt invocation.Meador Inge2012-06-071-1/+1
| | | | llvm-svn: 158128
* Spell optimization name correclty.Bill Wendling2012-06-061-1/+1
| | | | llvm-svn: 158123
* Another testcase for r156548.Bill Wendling2012-06-061-0/+162
| | | | | | <rdar://problem/10889741> llvm-svn: 158121
* Fix combine of uno && ord -> false so that the ordering of the fcmps doesn'tChad Rosier2012-06-061-0/+10
| | | | | | | matter. rdar://11579835 llvm-svn: 158084
* Grab-bag of reassociate tweaks. Unify handling of dead instructions andDuncan Sands2012-06-061-4/+6
| | | | | | | | | instructions to reoptimize. Exploit this to more systematically eliminate dead instructions (this isn't very useful in practice but is convenient for analysing some testcase I am working on). No need for WeakVH any more: use an AssertingVH instead. llvm-svn: 158073
* Remove extraneous CHECK-NOTs from previous commit and add a new test case.Chad Rosier2012-06-061-2/+10
| | | | llvm-svn: 158045
* FileCheckize this test.Chad Rosier2012-06-061-2/+18
| | | | llvm-svn: 158044
* When gvn decides to replace an instruction with another, we have to patch theRafael Espindola2012-06-044-0/+306
| | | | | | | | | | | | replacement to make it at least as generic as the instruction being replaced. This includes: * dropping nsw/nuw flags * getting the least restrictive tbaa and fpmath metadata * merging ranges Fixes PR12979. llvm-svn: 157958
* BoundsChecking: fix a bug when the handling of recursive PHIs failed and ↵Nuno Lopes2012-06-012-1/+49
| | | | | | | | | | could leave dangling references in the cache add regression tests for this problem. Can already compile & run: PHP, PCRE, and ICU (i.e., all the software I tried) llvm-svn: 157822
* add -bounds-checking-multiple-traps option to make one trap BB per checkNuno Lopes2012-05-311-0/+12
| | | | | | disabled by default for now; we can discusse the default value (& name) later llvm-svn: 157777
* revamp BoundsChecking considerably:Nuno Lopes2012-05-311-1/+1
| | | | | | | | | | | | - compute size & offset at the same time. The side-effects of this are that we now support negative GEPs. It's now approaching a phase that it can be reused by other passes (e.g., lowering of the objectsize intrinsic) - use APInt throughout to handle wrap-arounds - add support for PHI instrumentation - add a cache (required for recursive PHIs anyway) - remove hoisting support for now, since it was wrong in a few cases sorry for the churn here.. tests will follow soon. llvm-svn: 157775
* Enhance the sinking code to handle diamond patterns. Patch byDuncan Sands2012-05-311-0/+26
| | | | | | Carlo Alberto Ferraris. llvm-svn: 157736
* Teach SCEV's icmp simplification logic that a-b == 0 is equivalent to a == b.Benjamin Kramer2012-05-301-0/+42
| | | | | | | | | | | | | | | This also required making recursive simplifications until nothing changes or a hard limit (currently 3) is hit. With the simplification in place indvars can canonicalize loops of the form for (unsigned i = 0; i < a-b; ++i) into for (unsigned i = 0; i != a-b; ++i) which used to fail because SCEV created a weird umax expr for the backedge taken count. llvm-svn: 157701
* InstCombine: Fix infinite loop when encountering switch on trivial icmp.Benjamin Kramer2012-05-281-0/+39
| | | | | | | | | | | | The test case feeds the following into InstCombine's visitSelect: %tobool8 = icmp ne i32 0, 0 %phitmp = select i1 %tobool8, i32 3, i32 0 Then instcombine replaces the right side of the switch with 0, doesn't notice that nothing changes and tries again indefinitely. This fixes PR12897. llvm-svn: 157587
* PR12967: Don't crash when trying to fold a shift that's larger than the ↵Benjamin Kramer2012-05-271-0/+61
| | | | | | type's size. llvm-svn: 157548
* Since commit 157467, if reassociate isn't actually going to change an expressionDuncan Sands2012-05-261-0/+38
| | | | | | | | | | | then it doesn't alter the instructions composing it, however it would continue to move the instructions to just before the expression root. Ensure it doesn't move them either, so now it really does nothing if there is nothing to do. That commit also ensured that nsw etc flags weren't cleared if the expression was not being changed. Tweak this a bit so that it doesn't clear flags on the initial part of a computation either if that part didn't change but later bits did. llvm-svn: 157518
* bounds checking: add support for byval argumentsNuno Lopes2012-05-251-0/+9
| | | | llvm-svn: 157498
* boundschecking:Nuno Lopes2012-05-253-0/+75
| | | | | | | add support for select add experimental support for alloc_size metadata llvm-svn: 157481
* Make the reassociation pass more powerful so that it can handle expressionsDuncan Sands2012-05-251-1/+5
| | | | | | | | | | | | | | | | | with arbitrary topologies (previously it would give up when hitting a diamond in the use graph for example). The testcase from PR12764 is now reduced from a pile of additions to the optimal 1617*%x0+208. In doing this I changed the previous strategy of dropping all uses for expression leaves to one of dropping all but one use. This works out more neatly (but required a bunch of tweaks) and is also safer: some recently fixed bugs during recursive linearization were because the linearization code thinks it completely owns a node if it has no uses outside the expression it is linearizing. But if the node was also in another expression that had been linearized (and thus all uses of the node from that expression dropped) then the conclusion that it is completely owned by the expression currently being linearized is wrong. Keeping one use from within each linearized expression avoids this kind of mistake. llvm-svn: 157467
* PR1255 related changes (case ranges):Stepan Dyatkovskiy2012-05-241-4/+93
| | | | | | | LowerSwitch::Clusterify : main functinality was replaced with CRSBuilder::optimize, so big part of Clusterify's code was reduced. test/Transform/LowerSwitch/feature.ll - this test was refactored: grep + count was replaced with FileCheck usage. llvm-svn: 157384
* Fix typo in flag to opt, and also a CHECK-NEXT that doesn't follow aKaelyn Uhrain2012-05-231-2/+2
| | | | | | | | CHECK. The latter error was hidden by the former, and the test harness used by e.g. "make check" silently ignored that opt was printing an error message about an unknown flag instead of running on the test file. llvm-svn: 157341
* BoundsChecking: add a couple of simple tests and fix a bug in branch emitionNuno Lopes2012-05-231-0/+78
| | | | llvm-svn: 157329
* Fix the inliner so that the optsize function attribute don't alter thePatrik Hägglund2012-05-231-0/+33
| | | | | | | | inline threshold if the global inline threshold is lower (as for -Oz). Reviewed by Chandler Carruth and Bill Wendling. llvm-svn: 157323
* LSR fix: add a missing phi check during IV hoisting.Andrew Trick2012-05-221-0/+57
| | | | | | Fixes PR12898: SCEVExpander crash. llvm-svn: 157263
* revert my previous patches that introduced an additional parameter to the ↵Nuno Lopes2012-05-224-100/+20
| | | | | | | | objectsize intrinsic. After a lot of discussion, we realized it's not the best option for run-time bounds checking llvm-svn: 157255
* Fix PR12858, a crash due to GVN's PRE not fully removing an instruction from theDuncan Sands2012-05-221-0/+33
| | | | | | | | | | | | leader table. That's because it wasn't expecting instructions to turn up as leader for a value number that is not its own, but equality propagation could create this situation. One solution is to have the leader table use a WeakVH but this slows down GVN by about 5%. Instead just have equality propagation not add instructions to the leader table, only constants and arguments. In theory this might cause GVN to run more (each time it changes something it runs again) but it doesn't seem to occur enough to cause a slow down. llvm-svn: 157251
* Do not pass an invalid domtree to SimplifyInstruction fromPeter Collingbourne2012-05-201-0/+25
| | | | | | LoopUnswitch. Fixes PR12887. llvm-svn: 157140
* Do not eliminate allocas whose alignment exceeds that of thePeter Collingbourne2012-05-191-0/+36
| | | | | | | copied-in constant, as a subsequent user may rely on over alignment. Fixes PR12885. llvm-svn: 157134
OpenPOWER on IntegriCloud