llvm-6502/lib/Transforms/InstCombine
Chris Lattner 784f333aef Add an instcombine to clean up a common pattern produced
by the SRoA "promote to large integer" code, eliminating
some type conversions like this:

   %94 = zext i16 %93 to i32                       ; <i32> [#uses=2]
   %96 = lshr i32 %94, 8                           ; <i32> [#uses=1]
   %101 = trunc i32 %96 to i8                      ; <i8> [#uses=1]

This also unblocks other xforms from happening, now clang is able to compile:

struct S { float A, B, C, D; };
float foo(struct S A) { return A.A + A.B+A.C+A.D; }

into:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	pshufd	$1, %xmm0, %xmm2
	addss	%xmm0, %xmm2
	movdqa	%xmm1, %xmm3
	addss	%xmm2, %xmm3
	pshufd	$1, %xmm1, %xmm0
	addss	%xmm3, %xmm0
	ret

on x86-64, instead of:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	movd	%xmm0, %rax
	shrq	$32, %rax
	movd	%eax, %xmm2
	addss	%xmm0, %xmm2
	movapd	%xmm1, %xmm3
	addss	%xmm2, %xmm3
	movd	%xmm1, %rax
	shrq	$32, %rax
	movd	%eax, %xmm0
	addss	%xmm3, %xmm0
	ret

This seems pretty close to optimal to me, at least without
using horizontal adds.  This also triggers in lots of other
code, including SPEC.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 18:31:05 +00:00
..
CMakeLists.txt split and/or/xor out into one overly-large (2000LOC) file. However, I think 2010-01-05 07:50:36 +00:00
InstCombine.h Reapply r110396, with fixes to appease the Linux buildbot gods. 2010-08-06 18:33:48 +00:00
InstCombineAddSub.cpp Floating-point add, sub, and mul are now spelled fadd, fsub, and fmul, 2010-03-02 01:11:08 +00:00
InstCombineAndOrXor.cpp Re-apply the infamous r108614, with a fix pointed out by Dirk Steinke. 2010-08-02 09:32:13 +00:00
InstCombineCalls.cpp PR7853: fix a silly mistake introduced in r101899, and add a test to make sure 2010-08-09 20:49:43 +00:00
InstCombineCasts.cpp Add an instcombine to clean up a common pattern produced 2010-08-27 18:31:05 +00:00
InstCombineCompares.cpp PR7750: !CExpr->isNullValue() only properly computes whether CExpr is nonnull 2010-07-29 18:03:33 +00:00
InstCombineLoadStoreAlloca.cpp Re-apply r111568 with a fix for the clang self-host. 2010-08-20 18:24:43 +00:00
InstCombineMulDivRem.cpp Floating-point add, sub, and mul are now spelled fadd, fsub, and fmul, 2010-03-02 01:11:08 +00:00
InstCombinePHI.cpp cache result of operator* 2010-07-12 14:15:58 +00:00
InstCombineSelect.cpp Remove the rest of my instcombine changes. Back to the drawing board on this one. 2010-07-16 16:39:00 +00:00
InstCombineShifts.cpp use ArgOperand API 2010-06-24 00:44:01 +00:00
InstCombineSimplifyDemanded.cpp use ArgOperand API 2010-06-28 16:45:00 +00:00
InstCombineVectorOps.cpp Temporarily revert r110987 as it's causing some miscompares in 2010-08-17 22:55:27 +00:00
InstCombineWorklist.h I got tired of VISIBILITY_HIDDEN colliding with the gcc enum. Rename it 2010-05-11 20:16:09 +00:00
InstructionCombining.cpp Fix batch of converting RegisterPass<> to INTIALIZE_PASS(). 2010-07-21 22:09:45 +00:00
Makefile make -fno-rtti the default unless a directory builds with REQUIRES_RTTI. 2010-01-24 20:43:08 +00:00