summaryrefslogtreecommitdiff
path: root/test/Transforms
Commit message (Collapse)AuthorAge
* Followup to 132316; accept arbitrary constants, add with a constant,Stuart Hastings2011-05-31
| | | | | | | | sub with a non-constant. Fix comments, enlarge test case. rdar://problem/6501862 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132348 91177308-0d34-0410-b5e6-96231b3b80d8
* (1 - X) * (-2) -> (x - 1) * 2, for all positive nonzero powers of 2Stuart Hastings2011-05-30
| | | | | | | rdar://problem/6501862 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132316 91177308-0d34-0410-b5e6-96231b3b80d8
* Add the test case for phis in the outer landing pad during the inliner'sJohn McCall2011-05-30
| | | | | | | | forwarding of eh.resume that I promised yesterday. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132307 91177308-0d34-0410-b5e6-96231b3b80d8
* Add testcase for r132290, to check for the crasher caught by the buildbotsNick Lewycky2011-05-29
| | | | | | | doing llvm-gcc selfhost (or cross). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132292 91177308-0d34-0410-b5e6-96231b3b80d8
* Obey the isVolatile bit on memory intrinsics when analyzing uses of a globalNick Lewycky2011-05-29
| | | | | | | | | | variable. Noticed by inspection. Simulate memset in EvaluateFunction where the target of the memset and the value we're setting are both the null value. Fixes PR10047! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132288 91177308-0d34-0410-b5e6-96231b3b80d8
* ConstantFoldInstOperands doesn't like compares, hand it off to instsimplify ↵Benjamin Kramer2011-05-28
| | | | | | | | instead. Fixes PR10040. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132254 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement and document the llvm.eh.resume intrinsic, which isJohn McCall2011-05-28
| | | | | | | | | | | | | | | | | | | transformed by the inliner into a branch to the enclosing landing pad (when inlined through an invoke). If not so optimized, it is lowered DWARF EH preparation into a call to _Unwind_Resume (or _Unwind_SjLj_Resume as appropriate). Its chief advantage is that it takes both the exception value and the selector value as arguments, meaning that there is zero effort in recovering these; however, the frontend is required to pass these down, which is not actually particularly difficult. Also document the behavior of landing pads a bit better, and make it clearer that it's okay that personality functions don't always land at landing pads. This is just a fact of life. Don't write optimizations that rely on pushing things over an unwind edge. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132253 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the inliner to maintain the current de facto invoke semantics:John McCall2011-05-27
| | | | | | | | | | | | | | | | - the selector for the landing pad must provide all available information about the handlers, filters, and cleanups within that landing pad - calls to _Unwind_Resume must be converted to branches to the enclosing lpad so as to avoid re-entering the unwinder when the lpad claimed it was going to handle the exception in some way This is quite specific to libUnwind-based unwinding. In an effort to not interfere too badly with other unwinders, and with existing hacks in frontends, this only triggers on _Unwind_Resume (not _Unwind_Resume_or_Rethrow) and does nothing with selectors if it cannot find a selector call for either lpad. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132200 91177308-0d34-0410-b5e6-96231b3b80d8
* InstCombine: Make switch folding with equality compares more aggressive by ↵Benjamin Kramer2011-05-27
| | | | | | | | trying instsimplify on the arm where we know the compared value. Stuff like "x == y ? y : x&y" now folds into "x&y". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132185 91177308-0d34-0410-b5e6-96231b3b80d8
* Renamed llvm.x86.sse42.crc32 intrinsics; crc64 doesn't exist. Chad Rosier2011-05-26
| | | | | | | | | | crc32.[8|16|32] have been renamed to .crc32.32.[8|16|32] and crc64.[8|16|32] have been renamed to .crc32.64.[8|64]. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132163 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars: incremental fixes for -disable-iv-rewrite and testcases.Andrew Trick2011-05-26
| | | | | | | | | Use a proper worklist for use-def traversal without holding onto an iterator. Now that we process all IV uses, we need complete logic for resusing existing derived IV defs. See HoistStep. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132103 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9998: ashr exact %x, 31 is not equivalent to sdiv exact %x, -2147483648.Eli Friedman2011-05-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132097 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars: fixed IV cloning in -disable-iv-rewrite mode with associatedAndrew Trick2011-05-25
| | | | | | | cleanup and overdue test cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132038 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix "make check" in Release by removing debug-only options from an 'opt' ↵Cameron Zwarich2011-05-24
| | | | | | invocation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131972 91177308-0d34-0410-b5e6-96231b3b80d8
* Make LoadAndStorePromoter preserve debug info and create llvm.dbg.values whenCameron Zwarich2011-05-24
| | | | | | promoting allocas to SSA variables. Fixes <rdar://problem/9479036>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131953 91177308-0d34-0410-b5e6-96231b3b80d8
* FileCheck-ize a couple of IV unit tests.Andrew Trick2011-05-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131946 91177308-0d34-0410-b5e6-96231b3b80d8
* Test case for r130799 - indvars: Added canExpandBackEdgeTakenCount.Andrew Trick2011-05-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131939 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a really nasty basicaa mod/ref calculation bug that was causing ↵Chris Lattner2011-05-23
| | | | | | | | | miscompilation of UnitTests/ObjC/messages-2.m with the recent optimizer improvements. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131897 91177308-0d34-0410-b5e6-96231b3b80d8
* Transform any logical shift of a power of two into an exact/NUW shift whenChris Lattner2011-05-23
| | | | | | | in a known-non-zero context. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131887 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach valuetracking that byval arguments with a specified alignment areChris Lattner2011-05-23
| | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131884 91177308-0d34-0410-b5e6-96231b3b80d8
* implement PR9315, constant folding exp2 in terms of pow (since hosts withoutChris Lattner2011-05-22
| | | | | | | C99 runtimes don't have exp2). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131872 91177308-0d34-0410-b5e6-96231b3b80d8
* Carve out a place in instcombine to put transformations which work knowing ↵Chris Lattner2011-05-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131860 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR9815: I was trying to get out of "generating code and thenChris Lattner2011-05-22
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131858 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a parameter to ConstantFoldTerminator() that callers can use to ask it ↵Frits van Bommel2011-05-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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131855 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR9856, an incorrectly conservative assertion: a global can beChris Lattner2011-05-22
| | | | | | | "stored once" even if its address is compared. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131849 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR9841 by having GVN not process dead loads. This wasChris Lattner2011-05-22
| | | | | | | | causing it to get into infinite loops when it would widen a load (which can necessarily leave around dead loads). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131847 91177308-0d34-0410-b5e6-96231b3b80d8
* remove a trivial test, make some other tests less trivial.Chris Lattner2011-05-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131846 91177308-0d34-0410-b5e6-96231b3b80d8
* make this test less trivial.Chris Lattner2011-05-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131845 91177308-0d34-0410-b5e6-96231b3b80d8
* Commit test change, forgotten as part of r131838.Nick Lewycky2011-05-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131839 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach the inliner to emit llvm.lifetime.start/end, to scope the local variablesNick Lewycky2011-05-22
| | | | | | | of the inlinee to the code representing the original function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131838 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix grammar in test.Nick Lewycky2011-05-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131831 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "InstCombine: Turn mul.with.overflow(X, 2) into the cheaper ↵Benjamin Kramer2011-05-21
| | | | | | | | 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". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131798 91177308-0d34-0410-b5e6-96231b3b80d8
* InstCombine: Turn mul.with.overflow(X, 2) into the cheaper ↵Benjamin Kramer2011-05-21
| | | | | | add.with.overflow(X, X) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131789 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r131664 and fix it in instcombine instead. rdar://9467055Evan Cheng2011-05-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131708 91177308-0d34-0410-b5e6-96231b3b80d8
* Move test to Transforms/InstCombine.Stuart Hastings2011-05-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131634 91177308-0d34-0410-b5e6-96231b3b80d8
* Add test for PR9946.Rafael Espindola2011-05-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131621 91177308-0d34-0410-b5e6-96231b3b80d8
* More instcombine cleanup, towards improving debug line info.Eli Friedman2011-05-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131604 91177308-0d34-0410-b5e6-96231b3b80d8
* When forming an ICmpZero LSRUse, normalize the non-IV operandDan Gohman2011-05-18
| | | | | | | | of the comparison, so that the resulting expression is fully normalized. This fixes PR9939. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131576 91177308-0d34-0410-b5e6-96231b3b80d8
* More instcombine cleanup aimed towards improving debug line info.Eli Friedman2011-05-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131559 91177308-0d34-0410-b5e6-96231b3b80d8
* Start trying to make InstCombine preserve more debug info. The idea here is ↵Eli Friedman2011-05-18
| | | | | | | | | | | | to set the debug location on the IRBuilder, which will be then right location in most cases. This should magically give many transformations debug locations, and fixing places which are missing a debug location will usually just means changing the code creating it to use the IRBuilder. As an example, the change to InstCombineCalls catches a common case where a call to a bitcast of a function is rewritten. Chris, does this approach look reasonable? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131516 91177308-0d34-0410-b5e6-96231b3b80d8
* Drop lli, revise test.Stuart Hastings2011-05-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131452 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't do tail calls in a function that call setjmp. The stack might beRafael Espindola2011-05-16
| | | | | | corrupted when setjmp returns again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131399 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable test harder.Benjamin Kramer2011-05-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131363 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable this test while I revise it. rdar://problem/9267970Stuart Hastings2011-05-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131350 91177308-0d34-0410-b5e6-96231b3b80d8
* SimplifyCFG: Use ComputeMaskedBits to prune dead cases from switch instructions.Benjamin Kramer2011-05-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131345 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid combining GEPs that might overflow at runtime.Stuart Hastings2011-05-14
| | | | | | | | | rdar://problem/9267970 Patch by Julien Lerouge! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131339 91177308-0d34-0410-b5e6-96231b3b80d8
* The comparision "max(x,y)==x" is equivalent to "x>=y". Since the max isDuncan Sands2011-05-07
| | | | | | | | often expressed as "x >= y ? x : y", there is a good chance we can extract the existing "x >= y" from it and use that as a replacement for "max(x,y)==x". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131049 91177308-0d34-0410-b5e6-96231b3b80d8
* Move few target-dependant tests to appropriate directories.Galina Kistanova2011-05-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131002 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR9820: a read-only call differs from a load in that a load doesn'tDuncan Sands2011-05-06
| | | | | | | | return the pointer being dereferenced, it returns the pointee, but a call might return the pointer itself. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130979 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9838: Fix transform introduced in r127064 to not trigger when only one ↵Eli Friedman2011-05-05
| | | | | | side of the icmp is an exact shift. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130954 91177308-0d34-0410-b5e6-96231b3b80d8