summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* De-tabify.Bill Wendling2008-02-261-22/+22
| | | | llvm-svn: 47599
* Split ParameterAttributes.h, putting the complicatedDale Johannesen2008-02-221-1/+1
| | | | | | | stuff into ParamAttrsList.h. Per feedback from ParamAttrs changes. llvm-svn: 47504
* Fixed a typo.Zhou Sheng2008-02-221-1/+1
| | | | llvm-svn: 47478
* Fix newly-introduced 4.3 warningsAnton Korobeynikov2008-02-201-2/+2
| | | | llvm-svn: 47375
* Make Transforms to be 4.3 warnings-cleanAnton Korobeynikov2008-02-201-14/+23
| | | | llvm-svn: 47371
* Expand ParameterAttributes to 32 bits (in preparationDale Johannesen2008-02-191-8/+13
| | | | | | | for adding alignment info, not there yet). Clean up interfaces to reference ParameterAttributes consistently. llvm-svn: 47342
* fdiv/frem of undef can produce undef, because the undef operand Chris Lattner2008-02-191-4/+11
| | | | | | | can be a SNaN. We could be more aggressive and turn this into unreachable, but that is less nice, and not really worth it. llvm-svn: 47313
* Correctly fold divide-by-constant, even when faced with overflow.Nick Lewycky2008-02-181-2/+27
| | | | llvm-svn: 47287
* Transforming -A + -B --> -(A + B) isn't safe for FP, thanksChris Lattner2008-02-181-4/+6
| | | | | | to Dale for noticing this! llvm-svn: 47276
* optimize away stackrestore calls that have no intervening alloca or call.Chris Lattner2008-02-181-10/+18
| | | | llvm-svn: 47258
* Fold (-x + -y) -> -(x+y) which promotes better association, fixingChris Lattner2008-02-171-2/+10
| | | | | | the second half of PR2047 llvm-svn: 47244
* Rename APInt's isPositive to isNonNegative, to reflect what itDan Gohman2008-02-131-6/+6
| | | | | | actually does. llvm-svn: 47090
* Fix a bug compiling PR1978 (perhaps not the only one though) whichChris Lattner2008-02-051-54/+5
| | | | | | | | | was incorrectly simplifying "x == (gep x, 1, i)" into false, even though i could be negative. As it turns out, all the code to handle this already existed, we just need to disable the incorrect optimization case and let the general case handle it. llvm-svn: 46739
* There are some cases where icmp(add) can be folded into a new icmp. Handle them.Nick Lewycky2008-02-031-0/+32
| | | | llvm-svn: 46687
* Hack on vectors too.Nick Lewycky2008-02-031-1/+1
| | | | llvm-svn: 46684
* Fold away one multiply in instcombine. This would normally be caught inNick Lewycky2008-02-031-0/+24
| | | | | | reassociate anyways, but they could be generated during instcombine's run. llvm-svn: 46683
* eliminate additions of 0.0 when they are obviously dead. This has to be ↵Chris Lattner2008-01-291-0/+47
| | | | | | | | careful to avoid turning -0.0 + 0.0 -> -0.0 which is incorrect. llvm-svn: 46499
* Handle some more combinations of extend and icmp. Fixes PR1940.Nick Lewycky2008-01-281-8/+12
| | | | llvm-svn: 46431
* Fix PR1932 by disabling an xform invalid for fdiv.Chris Lattner2008-01-281-9/+10
| | | | llvm-svn: 46429
* Fold fptrunc(add (fpextend x), (fpextend y)) -> add(x,y), as GCC does.Chris Lattner2008-01-271-3/+75
| | | | llvm-svn: 46406
* Enable the fix I just checked in, silly me.Nick Lewycky2008-01-221-1/+0
| | | | llvm-svn: 46247
* Multiply can be evaluated in a different type, so long as the target type hasNick Lewycky2008-01-221-0/+10
| | | | | | a smaller bitwidth. llvm-svn: 46244
* I noticed that the trampoline straightening transformation couldDuncan Sands2008-01-141-21/+28
| | | | | | | | | drop attributes on varargs call arguments. Also, it could generate invalid IR if the transformed call already had the 'nest' attribute somewhere (this can never happen for code coming from llvm-gcc, but it's a theoretical possibility). Fix both problems. llvm-svn: 45973
* Turn a memcpy from a double* into a load/store of double instead ofChris Lattner2008-01-141-9/+46
| | | | | | | | | | a load/store of i64. The later prevents promotion/scalarrepl of the source and dest in many cases. This fixes the 300% performance regression of the byval stuff on stepanov_v1p2. llvm-svn: 45945
* factor memcpy/memmove simplification out to its own SimplifyMemTransfer Chris Lattner2008-01-131-35/+42
| | | | | | method, no functionality change. llvm-svn: 45944
* simplify some code. If we can infer alignment for source and dest that are Chris Lattner2008-01-131-21/+22
| | | | | | | greater than memcpy alignment, and if we lower to load/store, use the best alignment info we have. llvm-svn: 45943
* simplify some code by adding a InsertBitCastBefore method,Chris Lattner2008-01-131-30/+25
| | | | | | make memmove->memcpy conversion a bit simpler. llvm-svn: 45942
* Fix PR1907, a nasty miscompilation because instcombine didn'tChris Lattner2008-01-131-2/+8
| | | | | | | realize that ne & sgt was a signed comparison (it was only looking at whether the left compare was signed). llvm-svn: 45937
* When turning a call to a bitcast function into a direct call,Duncan Sands2008-01-131-12/+17
| | | | | | | if this becomes a varargs call then deal correctly with any parameter attributes on the newly vararg call arguments. llvm-svn: 45931
* Implement PR1795, an instcombine hack for forming GEPs with integer pointer ↵Chris Lattner2008-01-081-3/+53
| | | | | | arithmetic. llvm-svn: 45745
* Small cleanup for handling of type/parameter attributeDuncan Sands2008-01-071-8/+11
| | | | | | incompatibility. llvm-svn: 45704
* The transform that tries to turn calls to bitcast functions intoDuncan Sands2008-01-061-10/+45
| | | | | | | | | direct calls bails out unless caller and callee have essentially equivalent parameter attributes. This is illogical - the callee's attributes should be of no relevance here. Rework the logic, which incidentally fixes a crash when removed arguments have attributes. llvm-svn: 45658
* When transforming a call to a bitcast function intoDuncan Sands2008-01-061-45/+16
| | | | | | | | | | | a direct call with cast parameters and cast return value (if any), instcombine was prepared to cast any non-void return value into any other, whether castable or not. Add a new predicate for testing whether casting is valid, and check it both for the return value and (as a cleanup) for the parameters. llvm-svn: 45657
* remove a couple more unsafe xforms in the face of overflow.Chris Lattner2008-01-051-9/+0
| | | | llvm-svn: 45613
* remove the (x-y) < 0 comparison xform, it miscompiles Chris Lattner2008-01-051-11/+5
| | | | | | | things that are not equality comparisons, for example: (2147479553+4096)-2147479553 < 0 != (2147479553+4096) < 2147479553 llvm-svn: 45612
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Disable null pointer folding transforms for non-generic address spaces. This ↵Christopher Lamb2007-12-291-3/+9
| | | | | | should probably be a target-specific predicate based on address space. That way for targets where this isn't applicable the predicate can be optimized away. llvm-svn: 45403
* Repair a transform that Chris noticed a bug in. Thanks to Nicholas for ↵Owen Anderson2007-12-281-5/+12
| | | | | | pointing out my stupid mistakes when writing this patch. :-) llvm-svn: 45384
* disable this instcombine xform, it miscompiles:Chris Lattner2007-12-281-0/+2
| | | | | | | | | | | | | | | | | | | define i32 @main() { entry: %z = alloca i32 ; <i32*> [#uses=2] store i32 0, i32* %z %tmp = load i32* %z ; <i32> [#uses=1] %sub = sub i32 %tmp, 1 ; <i32> [#uses=1] %cmp = icmp ult i32 %sub, 0 ; <i1> [#uses=1] %retval = select i1 %cmp, i32 1, i32 0 ; <i32> [#uses=1] ret i32 %retval } into ret 1, instead of ret 0. Christopher, please investigate. llvm-svn: 45383
* implement InstCombine/shift-trunc-shift.ll. This allowsChris Lattner2007-12-221-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | us to compile: #include <math.h> int t1(double d) { return signbit(d); } into: _t1: movd %xmm0, %rax shrq $63, %rax ret instead of: _t1: movd %xmm0, %rax shrq $32, %rax shrl $31, %eax ret on x86-64. llvm-svn: 45311
* Implement review feedback, including additional transformsChristopher Lamb2007-12-201-17/+15
| | | | | | | | | (icmp slt (sub A B) 1) -> (icmp sle A B) icmp sgt (sub A B) -1) -> (icmp sge A B) and add testcase. llvm-svn: 45256
* simplify this code with the new m_Zero() pattern. Make sure the select onlyChris Lattner2007-12-201-18/+10
| | | | | | has a single use, and generalize it to not require N to be a constant. llvm-svn: 45250
* When inlining through an 'nounwind' call, mark inlinedDuncan Sands2007-12-191-9/+2
| | | | | | | | | calls 'nounwind'. It is important for correct C++ exception handling that nounwind markings do not get lost, so this transformation is actually needed for correctness. llvm-svn: 45218
* Fold subtracts into integer compares vs. zero. This improves generate code ↵Christopher Lamb2007-12-181-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | for this case on X86 from _foo: movl $99, %ecx movl 4(%esp), %eax subl %eax, %ecx xorl %edx, %edx testl %ecx, %ecx cmovs %edx, %eax ret to _foo: xorl %ecx, %ecx movl 4(%esp), %eax cmpl $99, %eax cmovg %ecx, %eax ret llvm-svn: 45173
* Fix commentsChristopher Lamb2007-12-181-4/+2
| | | | llvm-svn: 45170
* Remove an orthogonal transformation of the selection condition from my most ↵Christopher Lamb2007-12-181-30/+2
| | | | | | recent submission. llvm-svn: 45169
* Rename isNoReturn to doesNotReturn, and isNoUnwind toDuncan Sands2007-12-181-1/+1
| | | | | | doesNotThrow. llvm-svn: 45160
* Fix typos.Christopher Lamb2007-12-181-1/+1
| | | | llvm-svn: 45159
* Fold certain additions through selects (and their compares) so as to ↵Christopher Lamb2007-12-181-0/+61
| | | | | | | | eliminate subtractions. This code is often produced by the SMAX expansion in SCEV. This implements test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll llvm-svn: 45158
* Change the PointerType api for creating pointer types. The old functionality ↵Christopher Lamb2007-12-171-12/+20
| | | | | | of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space. llvm-svn: 45082
OpenPOWER on IntegriCloud