summaryrefslogtreecommitdiff
path: root/lib/Transforms
Commit message (Collapse)AuthorAge
* change the canonical form of "cond ? -1 : 0" to be Chris Lattner2010-01-24
| | | | | | | | | "sext cond" instead of a select. This simplifies some instcombine code, matches the policy for zext (cond ? 1 : 0 -> zext), and allows us to generate better code for a testcase on ppc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94339 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a potential overflow issue Eli pointed out.Chris Lattner2010-01-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94336 91177308-0d34-0410-b5e6-96231b3b80d8
* Speculatively revert r94322 to see if it fixes darwin selfhost buildbot.Nick Lewycky2010-01-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94331 91177308-0d34-0410-b5e6-96231b3b80d8
* third bug from PR6119: the xor dupe extension allowsChris Lattner2010-01-23
| | | | | | | | | for arbitrary terminators in predecessors, don't assume it is a conditional or uncond branch. The testcase shows an example where they can happen with switches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94323 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach DAE that even though it can't modify the function signature of anNick Lewycky2010-01-23
| | | | | | | | externally visible function, it can still find all callers of it and replace the parameters to a dead argument with undef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94322 91177308-0d34-0410-b5e6-96231b3b80d8
* add an early out to ProcessBranchOnXOR to speed it up,Chris Lattner2010-01-23
| | | | | | | | | handle the case when we can infer an input to the xor from all inputs that agree, instead of going into an infinite loop. Another part of PR6199 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94321 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a crash in jump threading, PR6119Chris Lattner2010-01-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94319 91177308-0d34-0410-b5e6-96231b3b80d8
* implement a simple instcombine xform that has been in theChris Lattner2010-01-23
| | | | | | | readme forever. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94318 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply 94059 while fixing the calling convention setupEric Christopher2010-01-23
| | | | | | | for strcpy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94287 91177308-0d34-0410-b5e6-96231b3b80d8
* In mem2reg, for all alloca/stores that get promoted where the alloca has an ↵Victor Hernandez2010-01-23
| | | | | | associated llvm.dbg.declare instrinsic, insert an llvm.dbg.var intrinsic before each store git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94260 91177308-0d34-0410-b5e6-96231b3b80d8
* Another strncmp -> StringRef.startswith simplification.Benjamin Kramer2010-01-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94203 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 94059. It is breaking the MultiSource/Benchmarks/Prolangs-C/bisonBob Wilson2010-01-22
| | | | | | | test on ARM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94198 91177308-0d34-0410-b5e6-96231b3b80d8
* Keep ignoring pointer-to-pointer bitcastsVictor Hernandez2010-01-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94194 91177308-0d34-0410-b5e6-96231b3b80d8
* Stop building RTTI information for *most* llvm libraries. NotableChris Lattner2010-01-22
| | | | | | | | | | | | | missing ones are libsupport, libsystem and libvmcore. libvmcore is currently blocked on bugpoint, which uses EH. Once it stops using EH, we can switch it off. This #if 0's out 3 unit tests, because gtest requires RTTI information. Suggestions welcome on how to fix this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94164 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert LoopStrengthReduce.cpp to pre-r94061 for now.Dan Gohman2010-01-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94123 91177308-0d34-0410-b5e6-96231b3b80d8
* No need to look through bitcasts for DbgInfoIntrinsicVictor Hernandez2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94114 91177308-0d34-0410-b5e6-96231b3b80d8
* DbgInfoIntrinsic no longer appear in an instruction's use listVictor Hernandez2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94113 91177308-0d34-0410-b5e6-96231b3b80d8
* No need to look through bitcasts for DbgInfoIntrinsicVictor Hernandez2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94112 91177308-0d34-0410-b5e6-96231b3b80d8
* DbgInfoIntrinsics no longer appear in an instruction's use list; so clean up ↵Victor Hernandez2010-01-21
| | | | | | looking for them in use iterations and remove OnlyUsedByDbgInfoIntrinsics() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94111 91177308-0d34-0410-b5e6-96231b3b80d8
* When inserting expressions for post-increment users which containDan Gohman2010-01-21
| | | | | | | | | loop-variant components, adds must be inserted after the increment. Keep track of the increment position for this case, and insert these adds in the correct location. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94110 91177308-0d34-0410-b5e6-96231b3b80d8
* Include IVUsers information in LSR's debug output.Dan Gohman2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94108 91177308-0d34-0410-b5e6-96231b3b80d8
* Prune the search for candidate formulae if the number of registerDan Gohman2010-01-21
| | | | | | | | operands exceeds the number of registers used in the initial solution, as that wouldn't lead to a profitable solution anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94107 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment.Dan Gohman2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94104 91177308-0d34-0410-b5e6-96231b3b80d8
* It turns out that this #include is needed because otherwiseChris Lattner2010-01-21
| | | | | | | | | | | ValueMapper.cpp ends up calling an out of line __ZNK4llvm12PATypeHolder3getEv, which is a template and llvm-config determines arbitrarily to use the one in libipo. This sucks, but keeping the #include is a reasonable workaround. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94103 91177308-0d34-0410-b5e6-96231b3b80d8
* unbreak the build, apparently without this transformutils starts depending ↵Chris Lattner2010-01-21
| | | | | | on libipa? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94102 91177308-0d34-0410-b5e6-96231b3b80d8
* tidy upChris Lattner2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94101 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't need to include IntrinsicInst.h any moreVictor Hernandez2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94092 91177308-0d34-0410-b5e6-96231b3b80d8
* No need to map NULL operands of metadataVictor Hernandez2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94091 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-implement the main strength-reduction portion of LoopStrengthReduction.Dan Gohman2010-01-21
| | | | | | | | | | | | | | | This new version is much more aggressive about doing "full" reduction in cases where it reduces register pressure, and also more aggressive about rewriting induction variables to count down (or up) to zero when doing so reduces register pressure. It currently uses fairly simplistic algorithms for finding reuse opportunities, but it introduces a new framework allows it to combine multiple strategies at once to form hybrid solutions, instead of doing all full-reduction or all base+index. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94061 91177308-0d34-0410-b5e6-96231b3b80d8
* Add strcpy_chk -> strcpy support for "don't know" object sizeEric Christopher2010-01-21
| | | | | | | | answers. This will update as object size checking gets better information. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94059 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify this code.Chris Lattner2010-01-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94048 91177308-0d34-0410-b5e6-96231b3b80d8
* Move per-function inline threshold calculation to a method.Jakob Stoklund Olesen2010-01-20
| | | | | | | No functional change except the forgotten test for InlineLimit.getNumOccurrences() == 0 in the CurrentThreshold2 calculation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94007 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch Elts from vector to SmallVectorVictor Hernandez2010-01-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93989 91177308-0d34-0410-b5e6-96231b3b80d8
* Map operands of all function-local metadata, not just metadata passed to ↵Victor Hernandez2010-01-20
| | | | | | llvm.dbg.declare intrinsics git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93979 91177308-0d34-0410-b5e6-96231b3b80d8
* When doing address-mode sinking, expand the base register first, ratherDan Gohman2010-01-19
| | | | | | | | | | | | | than the scaled register. This makes it more likely that subsequent AddrModeMatcher queries will match the new address the same way as the old, instead of accidentally matching what had been the base register as the new scaled register, and then failing to match the scaled register. This fixes some problems with address-mode sinking multiple muls into a block, which will be a lot more common with some upcoming LoopStrengthReduction changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93935 91177308-0d34-0410-b5e6-96231b3b80d8
* optimize ~(~X >>s Y) --> (X >>s Y), patch by Edmund GrimleyChris Lattner2010-01-19
| | | | | | | Evans! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93884 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a crash in scalarrepl for memcpy/memmove where the source and destinationBob Wilson2010-01-19
| | | | | | | | | | are the same. I had already fixed a similar problem where the source and destination were different bitcasts derived from the same alloca, but the previous fix still did not handle the case where both operands are exactly the same value. Radar 7552893. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93848 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix comment.Eric Christopher2010-01-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93831 91177308-0d34-0410-b5e6-96231b3b80d8
* my instcombine transformations to make extension elimination moreChris Lattner2010-01-18
| | | | | | | | | aggressive changed the canonical form from sext(trunc(x)) to ashr(lshr(x)), make sure to transform a couple more things into that canonical form, and catch a case where we missed turning zext/shl/ashr into a single sext. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93787 91177308-0d34-0410-b5e6-96231b3b80d8
* While mapping llvm.dbg.declare intrinsic manually map its operand, if possible,Devang Patel2010-01-18
| | | | | | | | because it points to an alloca instruction through metadata. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93757 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert some of the dynamic opcode lookups into static ones.Owen Anderson2010-01-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93693 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix comment.Owen Anderson2010-01-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93679 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a comment typo.Bob Wilson2010-01-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93560 91177308-0d34-0410-b5e6-96231b3b80d8
* When the visitSub method was split into visitSub and visitFSub, this xform wasBill Wendling2010-01-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | added to the FSub version. However, the original version of this xform guarded against doing this for floating point (!Op0->getType()->isFPOrFPVector()). This is causing LLVM to perform incorrect xforms for code like: void func(double *rhi, double *rlo, double xh, double xl, double yh, double yl){ double mh, ml; double c = 134217729.0; double up, u1, u2, vp, v1, v2; up = xh*c; u1 = (xh - up) + up; u2 = xh - u1; vp = yh*c; v1 = (yh - vp) + vp; v2 = yh - v1; mh = xh*yh; ml = (((u1*v1 - mh) + (u1*v2)) + (u2*v1)) + (u2*v2); ml += xh*yl + xl*yh; *rhi = mh + ml; *rlo = (mh - (*rhi)) + ml; } The last line was optimized away, but rl is intended to be the difference between the infinitely precise result of mh + ml and after it has been rounded to double precision. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93369 91177308-0d34-0410-b5e6-96231b3b80d8
* 1) Use the new SimplifyInstructionsInBlock routine instead of the copyChris Lattner2010-01-12
| | | | | | | | | | | | | in JT. 2) When cloning blocks for PHI or xor conditions, use instsimplify to simplify the code as we go. This allows us to squish common cases early in JT which opens up opportunities for subsequent iterations, and allows it to completely simplify the testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93253 91177308-0d34-0410-b5e6-96231b3b80d8
* add a helper function.Chris Lattner2010-01-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93251 91177308-0d34-0410-b5e6-96231b3b80d8
* tidy upChris Lattner2010-01-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93222 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach jump threading to duplicate small blocks when the branchChris Lattner2010-01-12
| | | | | | | | | | | | | | | | | | | | | condition is a xor with a phi node. This eliminates nonsense like this from 176.gcc in several places: LBB166_84: testl %eax, %eax - setne %al - xorb %cl, %al - notb %al - testb $1, %al - je LBB166_85 + je LBB166_69 + jmp LBB166_85 This is rdar://7391699 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93221 91177308-0d34-0410-b5e6-96231b3b80d8
* some cleanup, and make it obvious that ProcessJumpOnPHI only worksChris Lattner2010-01-11
| | | | | | | on branches by renaming it and checking for a branch at the call site. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93208 91177308-0d34-0410-b5e6-96231b3b80d8
* reenable the piece that turns trunc(zext(x)) -> x even if zext has multiple ↵Chris Lattner2010-01-11
| | | | | | | | | | uses, codegen has no apparent problem with the trunc version of this, because it turns into a simple subreg idiom git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93202 91177308-0d34-0410-b5e6-96231b3b80d8