Dale Johannesen
							
						 
						
							 
							
							
							
							
								
							
							
								09f410b6d7 
								
							 
						 
						
							
							
								
								Split ParameterAttributes.h, putting the complicated  
							
							 
							
							... 
							
							
							
							stuff into ParamAttrsList.h.  Per feedback from
ParamAttrs changes.
llvm-svn: 47504 
							
						 
						
							2008-02-22 22:17:59 +00:00  
						
					 
				
					
						
							
							
								 
								Zhou Sheng
							
						 
						
							 
							
							
							
							
								
							
							
								3b8eb704fc 
								
							 
						 
						
							
							
								
								Fixed a typo.  
							
							 
							
							... 
							
							
							
							llvm-svn: 47478 
							
						 
						
							2008-02-22 10:00:35 +00:00  
						
					 
				
					
						
							
							
								 
								Anton Korobeynikov
							
						 
						
							 
							
							
							
							
								
							
							
								18991d78fa 
								
							 
						 
						
							
							
								
								Fix newly-introduced 4.3 warnings  
							
							 
							
							... 
							
							
							
							llvm-svn: 47375 
							
						 
						
							2008-02-20 12:07:57 +00:00  
						
					 
				
					
						
							
							
								 
								Anton Korobeynikov
							
						 
						
							 
							
							
							
							
								
							
							
								1bfd121321 
								
							 
						 
						
							
							
								
								Make Transforms to be 4.3 warnings-clean  
							
							 
							
							... 
							
							
							
							llvm-svn: 47371 
							
						 
						
							2008-02-20 11:26:25 +00:00  
						
					 
				
					
						
							
							
								 
								Dale Johannesen
							
						 
						
							 
							
							
							
							
								
							
							
								89268bc6e2 
								
							 
						 
						
							
							
								
								Expand ParameterAttributes to 32 bits (in preparation  
							
							 
							
							... 
							
							
							
							for adding alignment info, not there yet).  Clean up
interfaces to reference ParameterAttributes consistently.
llvm-svn: 47342 
							
						 
						
							2008-02-19 21:38:47 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								0fe6bce9ce 
								
							 
						 
						
							
							
								
								fdiv/frem of undef can produce undef, because the undef operand  
							
							 
							
							... 
							
							
							
							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 
							
						 
						
							2008-02-19 06:12:18 +00:00  
						
					 
				
					
						
							
							
								 
								Nick Lewycky
							
						 
						
							 
							
							
							
							
								
							
							
								fefd0202c9 
								
							 
						 
						
							
							
								
								Correctly fold divide-by-constant, even when faced with overflow.  
							
							 
							
							... 
							
							
							
							llvm-svn: 47287 
							
						 
						
							2008-02-18 22:48:05 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								1e3c501cb8 
								
							 
						 
						
							
							
								
								Transforming -A + -B  -->  -(A + B) isn't safe for FP, thanks  
							
							 
							
							... 
							
							
							
							to Dale for noticing this!
llvm-svn: 47276 
							
						 
						
							2008-02-18 17:50:16 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								024f8c8f09 
								
							 
						 
						
							
							
								
								optimize away stackrestore calls that have no intervening alloca or call.  
							
							 
							
							... 
							
							
							
							llvm-svn: 47258 
							
						 
						
							2008-02-18 06:12:38 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								cc22601bc3 
								
							 
						 
						
							
							
								
								Fold (-x + -y) -> -(x+y) which promotes better association, fixing  
							
							 
							
							... 
							
							
							
							the second half of PR2047
llvm-svn: 47244 
							
						 
						
							2008-02-17 21:03:36 +00:00  
						
					 
				
					
						
							
							
								 
								Dan Gohman
							
						 
						
							 
							
							
							
							
								
							
							
								1ee8dc97d9 
								
							 
						 
						
							
							
								
								Rename APInt's isPositive to isNonNegative, to reflect what it  
							
							 
							
							... 
							
							
							
							actually does.
llvm-svn: 47090 
							
						 
						
							2008-02-13 22:09:18 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								682a7dc653 
								
							 
						 
						
							
							
								
								Fix a bug compiling PR1978 (perhaps not the only one though) which  
							
							 
							
							... 
							
							
							
							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 
							
						 
						
							2008-02-05 04:45:32 +00:00  
						
					 
				
					
						
							
							
								 
								Nick Lewycky
							
						 
						
							 
							
							
							
							
								
							
							
								3b59214320 
								
							 
						 
						
							
							
								
								There are some cases where icmp(add) can be folded into a new icmp. Handle them.  
							
							 
							
							... 
							
							
							
							llvm-svn: 46687 
							
						 
						
							2008-02-03 16:33:09 +00:00  
						
					 
				
					
						
							
							
								 
								Nick Lewycky
							
						 
						
							 
							
							
							
							
								
							
							
								c7a4ba044b 
								
							 
						 
						
							
							
								
								Hack on vectors too.  
							
							 
							
							... 
							
							
							
							llvm-svn: 46684 
							
						 
						
							2008-02-03 08:19:11 +00:00  
						
					 
				
					
						
							
							
								 
								Nick Lewycky
							
						 
						
							 
							
							
							
							
								
							
							
								e6e3a7f6ea 
								
							 
						 
						
							
							
								
								Fold away one multiply in instcombine. This would normally be caught in  
							
							 
							
							... 
							
							
							
							reassociate anyways, but they could be generated during instcombine's run.
llvm-svn: 46683 
							
						 
						
							2008-02-03 07:42:09 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								17819d971e 
								
							 
						 
						
							
							
								
								eliminate additions of 0.0 when they are obviously dead.  This has to be careful to  
							
							 
							
							... 
							
							
							
							avoid turning -0.0 + 0.0 -> -0.0 which is incorrect.
llvm-svn: 46499 
							
						 
						
							2008-01-29 06:52:45 +00:00  
						
					 
				
					
						
							
							
								 
								Nick Lewycky
							
						 
						
							 
							
							
							
							
								
							
							
								8ea81e8ba4 
								
							 
						 
						
							
							
								
								Handle some more combinations of extend and icmp. Fixes PR1940.  
							
							 
							
							... 
							
							
							
							llvm-svn: 46431 
							
						 
						
							2008-01-28 03:48:02 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								710b441174 
								
							 
						 
						
							
							
								
								Fix PR1932 by disabling an xform invalid for fdiv.  
							
							 
							
							... 
							
							
							
							llvm-svn: 46429 
							
						 
						
							2008-01-28 00:58:18 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								fa1e7eef30 
								
							 
						 
						
							
							
								
								Fold fptrunc(add (fpextend x), (fpextend y)) -> add(x,y), as GCC does.  
							
							 
							
							... 
							
							
							
							llvm-svn: 46406 
							
						 
						
							2008-01-27 05:29:54 +00:00  
						
					 
				
					
						
							
							
								 
								Nick Lewycky
							
						 
						
							 
							
							
							
							
								
							
							
								f069264164 
								
							 
						 
						
							
							
								
								Enable the fix I just checked in, silly me.  
							
							 
							
							... 
							
							
							
							llvm-svn: 46247 
							
						 
						
							2008-01-22 05:42:02 +00:00  
						
					 
				
					
						
							
							
								 
								Nick Lewycky
							
						 
						
							 
							
							
							
							
								
							
							
								78712e5b59 
								
							 
						 
						
							
							
								
								Multiply can be evaluated in a different type, so long as the target type has  
							
							 
							
							... 
							
							
							
							a smaller bitwidth.
llvm-svn: 46244 
							
						 
						
							2008-01-22 05:08:48 +00:00  
						
					 
				
					
						
							
							
								 
								Duncan Sands
							
						 
						
							 
							
							
							
							
								
							
							
								b5ca2e9fcb 
								
							 
						 
						
							
							
								
								I noticed that the trampoline straightening transformation could  
							
							 
							
							... 
							
							
							
							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 
							
						 
						
							2008-01-14 19:52:09 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								92bd785323 
								
							 
						 
						
							
							
								
								Turn a memcpy from a double* into a load/store of double instead of  
							
							 
							
							... 
							
							
							
							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 
							
						 
						
							2008-01-14 00:28:35 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								57974c8d51 
								
							 
						 
						
							
							
								
								factor memcpy/memmove simplification out to its own SimplifyMemTransfer  
							
							 
							
							... 
							
							
							
							method, no functionality change.
llvm-svn: 45944 
							
						 
						
							2008-01-13 23:50:23 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								8c5cdddfb9 
								
							 
						 
						
							
							
								
								simplify some code.  If we can infer alignment for source and dest that are  
							
							 
							
							... 
							
							
							
							greater than memcpy alignment, and if we lower to load/store, use the best 
alignment info we have.
llvm-svn: 45943 
							
						 
						
							2008-01-13 22:30:28 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								5a86612d3f 
								
							 
						 
						
							
							
								
								simplify some code by adding a InsertBitCastBefore method,  
							
							 
							
							... 
							
							
							
							make memmove->memcpy conversion a bit simpler.
llvm-svn: 45942 
							
						 
						
							2008-01-13 22:23:22 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								5bc253c8f2 
								
							 
						 
						
							
							
								
								Fix PR1907, a nasty miscompilation because instcombine didn't  
							
							 
							
							... 
							
							
							
							realize that ne & sgt  was a signed comparison (it was only 
looking at whether the left compare was signed).
llvm-svn: 45937 
							
						 
						
							2008-01-13 20:59:02 +00:00  
						
					 
				
					
						
							
							
								 
								Duncan Sands
							
						 
						
							 
							
							
							
							
								
							
							
								781f6549db 
								
							 
						 
						
							
							
								
								When turning a call to a bitcast function into a direct call,  
							
							 
							
							... 
							
							
							
							if this becomes a varargs call then deal correctly with any
parameter attributes on the newly vararg call arguments.
llvm-svn: 45931 
							
						 
						
							2008-01-13 08:02:44 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								2940c5c56d 
								
							 
						 
						
							
							
								
								Implement PR1795, an instcombine hack for forming GEPs with integer pointer arithmetic.  
							
							 
							
							... 
							
							
							
							llvm-svn: 45745 
							
						 
						
							2008-01-08 07:23:51 +00:00  
						
					 
				
					
						
							
							
								 
								Duncan Sands
							
						 
						
							 
							
							
							
							
								
							
							
								b18c30acec 
								
							 
						 
						
							
							
								
								Small cleanup for handling of type/parameter attribute  
							
							 
							
							... 
							
							
							
							incompatibility.
llvm-svn: 45704 
							
						 
						
							2008-01-07 17:16:06 +00:00  
						
					 
				
					
						
							
							
								 
								Duncan Sands
							
						 
						
							 
							
							
							
							
								
							
							
								404eb05247 
								
							 
						 
						
							
							
								
								The transform that tries to turn calls to bitcast functions into  
							
							 
							
							... 
							
							
							
							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 
							
						 
						
							2008-01-06 18:27:01 +00:00  
						
					 
				
					
						
							
							
								 
								Duncan Sands
							
						 
						
							 
							
							
							
							
								
							
							
								55e5090fe8 
								
							 
						 
						
							
							
								
								When transforming a call to a bitcast function into  
							
							 
							
							... 
							
							
							
							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 
							
						 
						
							2008-01-06 10:12:28 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								e666bc272d 
								
							 
						 
						
							
							
								
								remove a couple more unsafe xforms in the face of overflow.  
							
							 
							
							... 
							
							
							
							llvm-svn: 45613 
							
						 
						
							2008-01-05 01:22:42 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								db026d703b 
								
							 
						 
						
							
							
								
								remove the (x-y) < 0 comparison xform, it miscompiles  
							
							 
							
							... 
							
							
							
							things that are not equality comparisons, for example:
   (2147479553+4096)-2147479553 < 0    !=   (2147479553+4096) < 2147479553
llvm-svn: 45612 
							
						 
						
							2008-01-05 01:18:20 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								f3ebc3f3d2 
								
							 
						 
						
							
							
								
								Remove attribution from file headers, per discussion on llvmdev.  
							
							 
							
							... 
							
							
							
							llvm-svn: 45418 
							
						 
						
							2007-12-29 20:36:04 +00:00  
						
					 
				
					
						
							
							
								 
								Christopher Lamb
							
						 
						
							 
							
							
							
							
								
							
							
								b053b80b79 
								
							 
						 
						
							
							
								
								Disable null pointer folding transforms for non-generic address spaces. This 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 
							
						 
						
							2007-12-29 07:56:53 +00:00  
						
					 
				
					
						
							
							
								 
								Owen Anderson
							
						 
						
							 
							
							
							
							
								
							
							
								7363914ef7 
								
							 
						 
						
							
							
								
								Repair a transform that Chris noticed a bug in.  Thanks to Nicholas for pointing out my stupid mistakes when writing this patch. :-)  
							
							 
							
							... 
							
							
							
							llvm-svn: 45384 
							
						 
						
							2007-12-28 07:42:12 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								5179819beb 
								
							 
						 
						
							
							
								
								disable this instcombine xform, it miscompiles:  
							
							 
							
							... 
							
							
							
							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 
							
						 
						
							2007-12-28 06:24:31 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								74b2ab59fd 
								
							 
						 
						
							
							
								
								implement InstCombine/shift-trunc-shift.ll.  This allows  
							
							 
							
							... 
							
							
							
							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 
							
						 
						
							2007-12-22 09:07:47 +00:00  
						
					 
				
					
						
							
							
								 
								Christopher Lamb
							
						 
						
							 
							
							
							
							
								
							
							
								7d82bc46b8 
								
							 
						 
						
							
							
								
								Implement review feedback, including additional transforms  
							
							 
							
							... 
							
							
							
							(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 
							
						 
						
							2007-12-20 07:21:11 +00:00  
						
					 
				
					
						
							
							
								 
								Chris Lattner
							
						 
						
							 
							
							
							
							
								
							
							
								16a51da0e2 
								
							 
						 
						
							
							
								
								simplify this code with the new m_Zero() pattern.  Make sure the select only  
							
							 
							
							... 
							
							
							
							has a single use, and generalize it to not require N to be a constant.
llvm-svn: 45250 
							
						 
						
							2007-12-20 01:56:58 +00:00  
						
					 
				
					
						
							
							
								 
								Duncan Sands
							
						 
						
							 
							
							
							
							
								
							
							
								aa31b92508 
								
							 
						 
						
							
							
								
								When inlining through an 'nounwind' call, mark inlined  
							
							 
							
							... 
							
							
							
							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 
							
						 
						
							2007-12-19 21:13:37 +00:00  
						
					 
				
					
						
							
							
								 
								Christopher Lamb
							
						 
						
							 
							
							
							
							
								
							
							
								f00ac6dd93 
								
							 
						 
						
							
							
								
								Fold subtracts into integer compares vs. zero. This improves generate code 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 
							
						 
						
							2007-12-18 21:32:20 +00:00  
						
					 
				
					
						
							
							
								 
								Christopher Lamb
							
						 
						
							 
							
							
							
							
								
							
							
								b7016c53d1 
								
							 
						 
						
							
							
								
								Fix comments  
							
							 
							
							... 
							
							
							
							llvm-svn: 45170 
							
						 
						
							2007-12-18 20:33:11 +00:00  
						
					 
				
					
						
							
							
								 
								Christopher Lamb
							
						 
						
							 
							
							
							
							
								
							
							
								74dbad9216 
								
							 
						 
						
							
							
								
								Remove an orthogonal transformation of the selection condition from my most recent submission.  
							
							 
							
							... 
							
							
							
							llvm-svn: 45169 
							
						 
						
							2007-12-18 20:30:28 +00:00  
						
					 
				
					
						
							
							
								 
								Duncan Sands
							
						 
						
							 
							
							
							
							
								
							
							
								3353ed09ac 
								
							 
						 
						
							
							
								
								Rename isNoReturn to doesNotReturn, and isNoUnwind to  
							
							 
							
							... 
							
							
							
							doesNotThrow.
llvm-svn: 45160 
							
						 
						
							2007-12-18 09:59:50 +00:00  
						
					 
				
					
						
							
							
								 
								Christopher Lamb
							
						 
						
							 
							
							
							
							
								
							
							
								30291f4a30 
								
							 
						 
						
							
							
								
								Fix typos.  
							
							 
							
							... 
							
							
							
							llvm-svn: 45159 
							
						 
						
							2007-12-18 09:45:40 +00:00  
						
					 
				
					
						
							
							
								 
								Christopher Lamb
							
						 
						
							 
							
							
							
							
								
							
							
								8b09a464b4 
								
							 
						 
						
							
							
								
								Fold certain additions through selects (and their compares) so as to 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 
							
						 
						
							2007-12-18 09:34:41 +00:00  
						
					 
				
					
						
							
							
								 
								Christopher Lamb
							
						 
						
							 
							
							
							
							
								
							
							
								edf0788758 
								
							 
						 
						
							
							
								
								Change the PointerType api for creating pointer types. The old functionality 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 
							
						 
						
							2007-12-17 01:12:55 +00:00  
						
					 
				
					
						
							
							
								 
								Duncan Sands
							
						 
						
							 
							
							
							
							
								
							
							
								8e4847ee95 
								
							 
						 
						
							
							
								
								Make instcombine promote inline asm calls to 'nounwind'  
							
							 
							
							... 
							
							
							
							calls.  Remove special casing of inline asm from the
inliner.  There is a potential problem: the verifier
rejects invokes of inline asm (not sure why).  If an
asm call is not marked "nounwind" in some .ll, and
instcombine is not run, but the inliner is run, then
an illegal module will be created.  This is bad but
I'm not sure what the best approach is.  I'm tempted
to remove the check in the verifier...
llvm-svn: 45073 
							
						 
						
							2007-12-16 15:51:49 +00:00