llvm-project/llvm/lib
Chris Lattner f50aa6ae5c Implement rdar://6480391, extending of equality icmp's to avoid a truncation.
I noticed this in the code compiled for a routine using std::map, which produced
this code:
	%25 = tail call i32 @memcmp(i8* %24, i8* %23, i32 6) nounwind readonly
	%.lobit.i = lshr i32 %25, 31		; <i32> [#uses=1]
	%tmp.i = trunc i32 %.lobit.i to i8		; <i8> [#uses=1]
	%toBool = icmp eq i8 %tmp.i, 0		; <i1> [#uses=1]
	br i1 %toBool, label %bb3, label %bb4
which compiled to:

	call	L_memcmp$stub
	shrl	$31, %eax
	testb	%al, %al
	jne	LBB1_11	## 

with this change, we compile it to:

	call	L_memcmp$stub
	testl	%eax, %eax
	js	LBB1_11

This triggers all the time in common code, with patters like this:

	%169 = and i32 %ply, 1		; <i32> [#uses=1]
	%170 = trunc i32 %169 to i8		; <i8> [#uses=1]
	%toBool = icmp ne i8 %170, 0		; <i1> [#uses=1]

 	%7 = lshr i32 %6, 24		; <i32> [#uses=1]
	%9 = trunc i32 %7 to i8		; <i8> [#uses=1]
	%10 = icmp ne i8 %9, 0		; <i1> [#uses=1]

etc

llvm-svn: 61985
2009-01-09 07:47:06 +00:00
..
Analysis ValueTracker can't assume that an alloca with no specified alignment 2009-01-08 19:28:38 +00:00
Archive Tidy up #includes, deleting a bunch of unnecessary #includes. 2009-01-05 17:59:02 +00:00
AsmParser 61949 accidentally introduced an escaped newline. Fix this by making 2009-01-08 23:51:48 +00:00
Bitcode revert to functionally equivalent formulation 2009-01-07 23:07:22 +00:00
CodeGen Convert DwarfWriter into a pass. 2009-01-08 23:40:34 +00:00
Debugger Tidy up #includes, deleting a bunch of unnecessary #includes. 2009-01-05 17:59:02 +00:00
ExecutionEngine Tidy up #includes, deleting a bunch of unnecessary #includes. 2009-01-05 17:59:02 +00:00
Linker Make comments and code for QuietWarnings and QuietErrors 2008-10-25 17:57:20 +00:00
Support Tweak --version to include the date and time. 2008-12-23 18:41:47 +00:00
System Don't use plain %x to print pointer values. I had changed it from %p 2008-12-05 23:39:24 +00:00
Target Add load-folding table entries for MOVDQA. 2009-01-09 02:40:34 +00:00
Transforms Implement rdar://6480391, extending of equality icmp's to avoid a truncation. 2009-01-09 07:47:06 +00:00
VMCore Use mayBeOverridden here, in anticipation of the 2009-01-08 20:55:49 +00:00
Makefile remove attribution from lib Makefiles. 2007-12-29 20:09:26 +00:00