summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Simplify r132022 based on Cameron's feedback.Evan Cheng2011-05-251-12/+5
| | | | llvm-svn: 132071
* indvars: fixed IV cloning in -disable-iv-rewrite mode with associatedAndrew Trick2011-05-251-52/+114
| | | | | | cleanup and overdue test cases. llvm-svn: 132038
* Forgot dyn_cast check.Evan Cheng2011-05-241-4/+4
| | | | llvm-svn: 132025
* Fix LoopUnswitch bug. RewriteLoopBodyWithConditionConstant can delete a deadEvan Cheng2011-05-241-13/+34
| | | | | | | | | | | case of a switch instruction. Back off this optimization when this would eliminate all of the predecessors to the latch. Sorry, I am unable to reduce a reasonably sized test case. rdar://9486843 llvm-svn: 132022
* Make instcombine O(N) instead of O(N^2) in code where the same simplifiable ↵Eli Friedman2011-05-241-10/+11
| | | | | | | | constant is used many times. Part of rdar://9471075. llvm-svn: 131979
* Clean up the lazy initialization of DIBuilder a bit.Cameron Zwarich2011-05-243-11/+6
| | | | llvm-svn: 131956
* Make LoadAndStorePromoter preserve debug info and create llvm.dbg.values whenCameron Zwarich2011-05-245-26/+53
| | | | | | promoting allocas to SSA variables. Fixes <rdar://problem/9479036>. llvm-svn: 131953
* When checking for signed multiplication overflow, watch out for INT_MIN and -1.Dan Gohman2011-05-231-0/+2
| | | | | | This fixes PR9845. llvm-svn: 131919
* rearrange two transforms, since one subsumes the other. Make the ↵Chris Lattner2011-05-231-16/+23
| | | | | | | | shift-exactness xform recurse. llvm-svn: 131888
* Transform any logical shift of a power of two into an exact/NUW shift whenChris Lattner2011-05-231-0/+17
| | | | | | in a known-non-zero context. llvm-svn: 131887
* use the valuetracking isPowerOfTwo function, which is more powerful than ↵Chris Lattner2011-05-231-4/+4
| | | | | | | | checking for a constant directly. Thanks to Duncan for pointing this out. llvm-svn: 131885
* Teach valuetracking that byval arguments with a specified alignment areChris Lattner2011-05-231-5/+10
| | | | | | | | | | | | | | | | | | | | | | aligned. Teach memcpyopt to not give up all hope when confonted with an underaligned memcpy feeding an overaligned byval. If the *source* of the memcpy can be determined to be adequeately aligned, or if it can be forced to be, we can eliminate the memcpy. This addresses PR9794. We now compile the example into: define i32 @f(%struct.p* nocapture byval align 8 %q) nounwind ssp { entry: %call = call i32 @g(%struct.p* byval align 8 %q) nounwind ret i32 %call } in both x86-64 and x86-32 mode. We still don't get a tailcall though, because tailcalls apparently can't handle byval. llvm-svn: 131884
* add some random notes.Chris Lattner2011-05-221-0/+5
| | | | llvm-svn: 131862
* Carve out a place in instcombine to put transformations which work knowing ↵Chris Lattner2011-05-221-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that their result is non-zero. Implement an example optimization (PR9814), which allows us to transform: A / ((1 << B) >>u 2) into: A >>u (B-2) which we compile into: _divu3: ## @divu3 leal -2(%rsi), %ecx shrl %cl, %edi movl %edi, %eax ret instead of: _divu3: ## @divu3 movb %sil, %cl movl $1, %esi shll %cl, %esi shrl $2, %esi movl %edi, %eax xorl %edx, %edx divl %esi, %eax ret llvm-svn: 131860
* Fix PR9815: I was trying to get out of "generating code and thenChris Lattner2011-05-221-44/+66
| | | | | | | | failing to form a memset, then having to delete it" but my approximation isn't safe for self recurrent loops. Instead of doign a hack, just do it the right way. llvm-svn: 131858
* Add a parameter to ConstantFoldTerminator() that callers can use to ask it ↵Frits van Bommel2011-05-225-10/+22
| | | | | | | | to also clean up the condition of any conditional terminator it folds to be unconditional, if that turns the condition into dead code. This just means it calls RecursivelyDeleteTriviallyDeadInstructions() in strategic spots. It defaults to the old behavior. I also changed -simplifycfg, -jump-threading and -codegenprepare to use this to produce slightly better code without any extra cleanup passes (AFAICT this was the only place in -simplifycfg where now-dead conditions of replaced terminators weren't being cleaned up). The only other user of this function is -sccp, but I didn't read that thoroughly enough to figure out whether it might be holding pointers to instructions that could be deleted by this. llvm-svn: 131855
* fix PR9856, an incorrectly conservative assertion: a global can beChris Lattner2011-05-221-3/+3
| | | | | | "stored once" even if its address is compared. llvm-svn: 131849
* fix PR9841 by having GVN not process dead loads. This wasChris Lattner2011-05-221-0/+5
| | | | | | | causing it to get into infinite loops when it would widen a load (which can necessarily leave around dead loads). llvm-svn: 131847
* Teach the inliner to emit llvm.lifetime.start/end, to scope the local variablesNick Lewycky2011-05-221-0/+70
| | | | | | of the inlinee to the code representing the original function. llvm-svn: 131838
* PR7952: Make isa<> use the same logic as cast<>, so that they both workEli Friedman2011-05-211-1/+1
| | | | | | consistently. llvm-svn: 131803
* Revert "InstCombine: Turn mul.with.overflow(X, 2) into the cheaper ↵Benjamin Kramer2011-05-211-14/+0
| | | | | | | | add.with.overflow(X, X)" It's better to do this in codegen, mul.with.overflow(X, 2) is more canonical because it has only one use on "X". llvm-svn: 131798
* InstCombine: Turn mul.with.overflow(X, 2) into the cheaper ↵Benjamin Kramer2011-05-211-0/+14
| | | | | | add.with.overflow(X, X) llvm-svn: 131789
* indvars: Prototyping Sign/ZeroExtend elimination without canonical IVs.Andrew Trick2011-05-202-103/+354
| | | | | | | | | | No functionality enabled by default. Use -disable-iv-rewrite. Extended IVUsers to keep track of the phi that represents the users' IV. Added the WidenIV transform to replace a narrow IV with a wide IV by doing a one-for-one replacement of IV users instead of expanding the SCEV expressions. [sz]exts are removed and truncs are inserted. llvm-svn: 131744
* indvars: minor cleanup in preparation for sign/zero extend elimination.Andrew Trick2011-05-201-18/+11
| | | | llvm-svn: 131716
* Revert r131664 and fix it in instcombine instead. rdar://9467055Evan Cheng2011-05-201-0/+4
| | | | llvm-svn: 131708
* Reapply r131605. This time with a fix, which is to use NoFolder.Devang Patel2011-05-191-30/+34
| | | | llvm-svn: 131673
* Add comment.Evan Cheng2011-05-191-0/+1
| | | | llvm-svn: 131659
* revert 131605 to fix PR9946.Rafael Espindola2011-05-191-36/+31
| | | | llvm-svn: 131620
* Make the demanded bits/elements optimizations preserve debug line information.Eli Friedman2011-05-192-15/+23
| | | | | | I'm not sure this is quite ideal, but I can't really think of any better way to do it. llvm-svn: 131616
* Use IRBuilder.Devang Patel2011-05-191-2/+2
| | | | llvm-svn: 131609
* Use IRBuilder while simplifying unreachable.Devang Patel2011-05-191-7/+8
| | | | llvm-svn: 131607
* Use IRBuilder while simplifying conditional branch.Devang Patel2011-05-181-31/+36
| | | | llvm-svn: 131605
* More instcombine cleanup, towards improving debug line info.Eli Friedman2011-05-183-10/+12
| | | | llvm-svn: 131604
* Use IRBuilder while simplifying branch.Devang Patel2011-05-181-12/+13
| | | | llvm-svn: 131598
* More instcombine simplifications towards better debug locations.Eli Friedman2011-05-182-13/+10
| | | | llvm-svn: 131596
* Use IRBuilder while simplifying return instruction.Devang Patel2011-05-181-11/+13
| | | | llvm-svn: 131580
* When forming an ICmpZero LSRUse, normalize the non-IV operandDan Gohman2011-05-181-0/+4
| | | | | | | of the comparison, so that the resulting expression is fully normalized. This fixes PR9939. llvm-svn: 131576
* Spread use of IRBuilder even more.Devang Patel2011-05-181-10/+12
| | | | llvm-svn: 131571
* Use IRBuilder while simplifying switch instruction.Devang Patel2011-05-181-15/+18
| | | | llvm-svn: 131566
* Use IRBuilder while simplifying unwind.Devang Patel2011-05-181-7/+9
| | | | llvm-svn: 131561
* More instcombine cleanup aimed towards improving debug line info.Eli Friedman2011-05-181-21/+18
| | | | llvm-svn: 131559
* Use IRBuilder while simplifying terminator.Devang Patel2011-05-181-4/+7
| | | | llvm-svn: 131552
* Use IRBuilder while simplifying unconditional branch.Devang Patel2011-05-181-6/+11
| | | | llvm-svn: 131551
* Use IRBuilder while folding two entry PHINode.Devang Patel2011-05-181-6/+8
| | | | llvm-svn: 131548
* Switch more inst insertion in instcombine to IRBuilder.Eli Friedman2011-05-181-10/+6
| | | | llvm-svn: 131547
* Set up IRBuilder for use during simplification.Devang Patel2011-05-181-0/+3
| | | | llvm-svn: 131545
* Switch more inst insertion in instcombine to IRBuilder.Eli Friedman2011-05-181-13/+6
| | | | llvm-svn: 131544
* fix typoMatt Beaumont-Gay2011-05-181-1/+1
| | | | llvm-svn: 131543
* Switch inst insertion in instcombine transform to IRBuilder.Eli Friedman2011-05-181-6/+2
| | | | llvm-svn: 131542
* Use IRBuiler while constant folding terminator.Devang Patel2011-05-181-7/+10
| | | | llvm-svn: 131541
OpenPOWER on IntegriCloud