Commit Graph

35187 Commits

Author SHA1 Message Date
Chris Lattner 643b817d92 Use the GV version of getNameWithPrefix in TargetLoweringObjectFileCOFF::
SelectSectionForGlobal, unbreaking weak globals with no-name.

llvm-svn: 93336
2010-01-13 19:19:17 +00:00
Evan Cheng af0ad65ff2 Commit some changes I had managed to lose last night while refactoring the code. Avoid change use of PHI instructions because it's not legal to insert any instructions before them.
This fixes PR6027.

llvm-svn: 93335
2010-01-13 19:16:39 +00:00
Chris Lattner a9365352cf just finish MCizing FnStubInfo which cleans it up and simplifies it.
llvm-svn: 93334
2010-01-13 19:13:16 +00:00
Chris Lattner 45faea454d don't call getNameWithPrefix repeatedly and unnecesarily.
llvm-svn: 93333
2010-01-13 19:05:36 +00:00
Chris Lattner 9148f36e90 properly use MCSymbol to print the strings aquired from getNameWithPrefix.
llvm-svn: 93332
2010-01-13 19:00:57 +00:00
Benjamin Kramer 2e06b93f43 Introduce Twine::toStringRef, a variant of toVector which avoids the copy if the
twine can be represented as a single StringRef. Use the new methode to simplify
some twine users.

llvm-svn: 93317
2010-01-13 12:45:23 +00:00
Evan Cheng b5499d09d1 Re-enable extension optimization pass.
llvm-svn: 93313
2010-01-13 08:45:40 +00:00
Chris Lattner ede8ad45bc upgrade and MC'ize a few uses of makeNameProper.
llvm-svn: 93310
2010-01-13 08:08:33 +00:00
Chris Lattner 4cd281dab1 MC'ize this a bit and upgrade APIs
llvm-svn: 93309
2010-01-13 08:04:24 +00:00
Chris Lattner b0dc959e1d add a fixme, ELF MCSection isn't quite right and weak unnamed globals are broken
on linux (even though they are pointless, they shouldn't ICE).

llvm-svn: 93308
2010-01-13 08:02:14 +00:00
Evan Cheng ceb5a4e8f6 For now, avoid issuing extract_subreg to reuse lower 8-bit, it's not safe in 32-bit.
llvm-svn: 93307
2010-01-13 08:01:32 +00:00
Evan Cheng 957b8beaaa Add comment; refactor; avoid pulling in DT if it's not used.
llvm-svn: 93306
2010-01-13 07:59:13 +00:00
Chris Lattner f0a401fcf0 eliminate some uses of Mangler::makeNameProper.
llvm-svn: 93305
2010-01-13 07:56:59 +00:00
Chris Lattner 98b05e017b don't add the \1 to the name.
llvm-svn: 93304
2010-01-13 07:50:21 +00:00
Chris Lattner 25d8ed3773 remove uses of deprecated functions, this generates slightly
different BlockAddress labels, but nothing semantically important.

Add a FIXME that BlockAddress codegen is broken if the LLVM BB has 
an empty name (e.g. strip was run).

llvm-svn: 93303
2010-01-13 07:30:49 +00:00
Chris Lattner 2b630fe822 use the new form of getNameWithPrefix, not makeNameProper.
Among other things, this would do very weird things if the 
basic block name had (e.g.) a space in it on darwin:
makeNameProper would add quotes, then the mcsymbol would 
escape the quotes.

llvm-svn: 93302
2010-01-13 07:16:53 +00:00
Chris Lattner 1126534dce add new isSingleStringRef()/getSingleStringRef() methods to twine,
and use them to avoid a copy of a string in getNameWithPrefix in
the common case.  It seems like Value::setName and other places 
should use this as well?

llvm-svn: 93301
2010-01-13 07:12:06 +00:00
Chris Lattner 33535b3250 ugh, my last patch just sped up a method and changed all the clients
that I want to completely eliminate.  Add fixme's so I remember this
in the future, and add the missing helper that they should be upgraded
to use instead.

llvm-svn: 93300
2010-01-13 07:01:09 +00:00
Chris Lattner 209aecad0c change Mangler::makeNameProper to return its result in a SmallVector
instead of returning it in an std::string.  Based on this change:

1. Change TargetLoweringObjectFileCOFF::getCOFFSection to take a StringRef
2. Change a bunch of targets to call makeNameProper with a smallstring,
   making several of them *much* more efficient.
3. Rewrite Mangler::makeNameProper to not build names and then prepend
   prefixes, not use temporary std::strings, and to avoid other crimes.

llvm-svn: 93298
2010-01-13 06:38:18 +00:00
Chris Lattner b252cbb04c my mistake, Mangler::makeNameProper wants to take a twine, not a stringref!
llvm-svn: 93296
2010-01-13 05:02:57 +00:00
Chris Lattner 04a7ce850d change makeNameProper to take a stringref instead of std::string.
llvm-svn: 93295
2010-01-13 04:55:33 +00:00
Chris Lattner 8e26d19cb3 fix assert in AsmPrinter::EmitGlobalConstantLargeInt to match reality.
llvm-svn: 93293
2010-01-13 04:39:46 +00:00
Chris Lattner 4581a4f03a reduce nesting and code duplication in AsmPrinter::EmitGlobalConstantLargeInt.
llvm-svn: 93292
2010-01-13 04:38:16 +00:00
Chris Lattner a32ba6d056 reduce indentation and add a fast-path to EmitGlobalConstant for 8-byte
integers on 64-bit systems.

llvm-svn: 93291
2010-01-13 04:34:19 +00:00
Chris Lattner 7e0c164b5e reduce indentation and use early exits in AsmPrinter::EmitConstantValueOnly
llvm-svn: 93290
2010-01-13 04:29:19 +00:00
Victor Hernandez 013a91ddfe Revert 93270 pending investigation of how stray non-constant values end up in ValueEnumerator's ValueList during WriteConstants()
llvm-svn: 93289
2010-01-13 03:18:30 +00:00
Evan Cheng d7d8f6d000 Disable opt-ext pass to unbreak the build for now.
llvm-svn: 93286
2010-01-13 01:51:43 +00:00
Evan Cheng 7a4bac3000 Remove debug option I accidentally left in.
llvm-svn: 93285
2010-01-13 01:43:20 +00:00
Ted Kremenek 451a965a78 Update CMake file.
llvm-svn: 93283
2010-01-13 01:02:47 +00:00
Jakob Stoklund Olesen a94837dc24 Remove the JustSP single-register regclass.
It was only being used by instructions with the t_addrmode_sp addressing mode,
and that is pattern matched in a way that guarantees SP is used. There is
never any register allocation done from this class.

llvm-svn: 93280
2010-01-13 00:43:06 +00:00
Evan Cheng 30bebff456 Add a quick pass to optimize sign / zero extension instructions. For targets where the pre-extension values are available in the subreg of the result of the extension, replace the uses of the pre-extension value with the result + extract_subreg.
For now, this pass is fairly conservative. It only perform the replacement when both the pre- and post- extension values are used in the block. It will miss cases where the post-extension values are live, but not used.

llvm-svn: 93278
2010-01-13 00:30:23 +00:00
Dale Johannesen 7b1a7ed330 Further progration of metadata operands. The
dumper doesn't really do what I want yet, but
at least it doesn't crash now.

llvm-svn: 93272
2010-01-13 00:00:24 +00:00
Victor Hernandez fc4aefb129 Make WriteConstants() more robust against stray values in ValueEnumerator's ValueList
llvm-svn: 93270
2010-01-12 23:37:59 +00:00
Bob Wilson 5b562906ac Fix a comment typo.
llvm-svn: 93261
2010-01-12 22:18:56 +00:00
Chris Lattner 573da8ac90 1) Use the new SimplifyInstructionsInBlock routine instead of the copy
in JT.

2) When cloning blocks for PHI or xor conditions, use
instsimplify to simplify the code as we go.  This allows us to 
squish common cases early in JT which opens up opportunities for
subsequent iterations, and allows it to completely simplify the
testcase.

llvm-svn: 93253
2010-01-12 20:41:47 +00:00
Chris Lattner 7c743f2c74 add a helper function.
llvm-svn: 93251
2010-01-12 19:40:54 +00:00
Devang Patel f76941ed83 Use Twine, instead of StringRef, for consistency.
llvm-svn: 93249
2010-01-12 18:57:56 +00:00
Devang Patel 943ddf666d Use ilist_tratis to autoinsert and remove NamedMDNode from MDSymbolTable.
llvm-svn: 93247
2010-01-12 18:34:06 +00:00
Evan Cheng 08557ef5f4 Eliminate or_not_add and just use AddedComplexity so isel tries or_is_add patterns first.
llvm-svn: 93245
2010-01-12 18:31:19 +00:00
Duncan Sands b7168c270e Revert commit 93204, since it causes the assembler to barf
on x86-64 linux with messages like this:
Error: Incorrect register `%r14' used with `l' suffix

llvm-svn: 93242
2010-01-12 17:46:16 +00:00
Duncan Sands 0067d6bbbe Fix typo.
llvm-svn: 93235
2010-01-12 08:30:46 +00:00
Duncan Sands fd75e12954 Tweak commit 91745, which changed target data for both Mingw and Cygwin,
to not touch Cygwin: the change caused llvm-gcc build failures due to
long double getting the wrong size.  Patch by Aaron Gray.

llvm-svn: 93234
2010-01-12 08:21:07 +00:00
Dan Gohman c119580307 Reapply the MOV64r0 patch, with a fix: MOV64r0 clobbers EFLAGS.
llvm-svn: 93229
2010-01-12 04:42:54 +00:00
Dan Gohman d49763d200 Update a partially obsolete comment.
llvm-svn: 93228
2010-01-12 04:32:35 +00:00
Dan Gohman f9d6d53823 Fix a typo in a comment.
llvm-svn: 93227
2010-01-12 04:30:26 +00:00
Chris Lattner af7855d571 tidy up
llvm-svn: 93222
2010-01-12 02:07:50 +00:00
Chris Lattner eb73bdb2e1 Teach jump threading to duplicate small blocks when the branch
condition is a xor with a phi node.  This eliminates nonsense
like this from 176.gcc in several places:

 LBB166_84:
        testl   %eax, %eax
-       setne   %al
-       xorb    %cl, %al
-       notb    %al
-       testb   $1, %al
-       je      LBB166_85
+       je      LBB166_69
+       jmp     LBB166_85

This is rdar://7391699

llvm-svn: 93221
2010-01-12 02:07:17 +00:00
Evan Cheng 4216615f99 Add TargetInstrInfo::isCoalescableInstr. It returns true if the specified
instruction is copy like where the source and destination registers can
overlap. This is to be used by the coalescable to coalesce the source and
destination registers of instructions like X86::MOVSX64rr32. Apparently
some crazy people believe the coalescer is too simple.

llvm-svn: 93210
2010-01-12 00:09:37 +00:00
Chris Lattner 6a19ed0b86 some cleanup, and make it obvious that ProcessJumpOnPHI only works
on branches by renaming it and checking for a branch at the call site.

llvm-svn: 93208
2010-01-11 23:41:09 +00:00
Evan Cheng 42b07e9600 Add manual ISD::OR fastisel selection routines. TableGen is no longer autogen them after 93152 and 93191.
llvm-svn: 93204
2010-01-11 22:59:27 +00:00
Chris Lattner d1a3efedd8 reenable the piece that turns trunc(zext(x)) -> x even if zext has multiple uses,
codegen has no apparent problem with the trunc version of this, because it turns
into a simple subreg idiom

llvm-svn: 93202
2010-01-11 22:49:40 +00:00
Chris Lattner a6b1356cf9 Disable folding sext(trunc(x)) -> x (and other similar cast/cast cases) when the
trunc has multiple uses.  Codegen is not able to coalesce the subreg case 
correctly and so this leads to higher register pressure and spilling (see PR5997).

This speeds up 256.bzip2 from 8.60 -> 8.04s on my machine, ~7%.

llvm-svn: 93200
2010-01-11 22:45:25 +00:00
Victor Hernandez 9d75c966e0 Consolidate ConvertGlobalValIDToValue, ConvertGlobalOrMetadataValIDToValue, and ConvertValIDToValue into a more powerful ConvertValIDToValue() that does all three's work
llvm-svn: 93197
2010-01-11 22:31:58 +00:00
Evan Cheng 99789a7a76 Extend r93152 to work on OR r, r. If the source set bits are known not to overlap, then select as an ADD instead.
llvm-svn: 93191
2010-01-11 22:03:29 +00:00
Evan Cheng 7bdf339602 Revert 93158. It's breaking quite a few x86_64 tests.
llvm-svn: 93185
2010-01-11 21:13:41 +00:00
Jakob Stoklund Olesen d2a1bee2d4 Avoid adding PHI arguments for a predecessor that has gone away when a BRCOND was constant folded.
This fixes PR5980.

llvm-svn: 93184
2010-01-11 21:02:33 +00:00
Benjamin Kramer 93ad708a46 Remove unused string functions.
llvm-svn: 93183
2010-01-11 20:33:12 +00:00
Evan Cheng c5f8184eec Do not turn 8-bit OR to ADD since ADD8ri is not 3-addressfiable.
llvm-svn: 93182
2010-01-11 20:18:04 +00:00
Mon P Wang ec57c81e64 Disable transformation of select of two loads to a select of address and then a load if the
loads are not in the default address space because the transformation discards src value info.

llvm-svn: 93180
2010-01-11 20:12:49 +00:00
Benjamin Kramer 6bf8240762 Add StrInStrNoCase, a StringRef version of CStrInCStrNoCase.
llvm-svn: 93174
2010-01-11 19:45:18 +00:00
Devang Patel 8992323bb9 s/NextValueNo/NextMDValueNo while processing metadata.
llvm-svn: 93165
2010-01-11 18:52:33 +00:00
Benjamin Kramer 0ef736fef2 Turns out llvm-gcc still uses SplitString with a vector. Add it back until I
have a fix.

llvm-svn: 93163
2010-01-11 18:44:35 +00:00
Benjamin Kramer c6fe3c3273 Reimplement getToken and SplitString as "StringRef helper functions"
- getToken is modeled after StringRef::split but it can split on multiple
  separator chars and skips leading seperators.
- SplitString is a StringRef::split variant for more than 2 elements with the
  same behaviour as getToken.

llvm-svn: 93161
2010-01-11 18:03:24 +00:00
Dan Gohman e99a3c191e Use a 32-bit and with implicit zero-extension instead of a 64-bit and if it
has an immediate with at least 32 bits of leading zeros, to avoid needing to
materialize that immediate in a register first.

FileCheckize, tidy, and extend a testcase to cover this case.

This fixes rdar://7527390.

llvm-svn: 93160
2010-01-11 17:58:34 +00:00
Dan Gohman 3a55686345 Re-instate MOV64r0 and MOV16r0, with adjustments to work with the
new AsmPrinter. This is perhaps less elegant than describing them
in terms of MOV32r0 and subreg operations, but it allows the
current register to rematerialize them.

llvm-svn: 93158
2010-01-11 17:37:57 +00:00
Dan Gohman f6e8369a5b Pattern top-level operators don't need to be restricted to a
single user. The _su forms are intended for non-top-level nodes.

llvm-svn: 93155
2010-01-11 17:21:05 +00:00
Dan Gohman 40ea3e5ce2 Reword this comment to reference a more fundamental issue.
llvm-svn: 93154
2010-01-11 17:14:46 +00:00
Evan Cheng 64d9f40557 Select an OR with immediate as an ADD if the input bits are known zero. This allow the instruction to be 3address-fied if needed.
llvm-svn: 93152
2010-01-11 17:03:47 +00:00
David Greene 206351a1ff Implement a feature (-vector-unaligned-mem) to allow targets to
ignore alignment requirements for SIMD memory operands.  This
is useful on architectures like the AMD 10h that do not trap on
unaligned references if a status bit is twiddled at startup time.

llvm-svn: 93151
2010-01-11 16:29:42 +00:00
Victor Hernandez 9ce5b5134d Respond to Chris' review:
Make InsertDbgValueIntrinsic() and get Offset take and recieve a uint64_t.
Get constness correct for getVariable() and getValue().

llvm-svn: 93149
2010-01-11 07:45:19 +00:00
Chris Lattner 9518869423 add one more bitfield optimization, allowing clang to generate
good code on PR4216:

_test_bitfield:                                             ## @test_bitfield
	orl	$32962, %edi
	movl	$4294941946, %eax
	andq	%rdi, %rax
	ret

instead of:

_test_bitfield:
        movl    $4294941696, %ecx
        movl    %edi, %eax
        orl     $194, %edi
        orl     $32768, %eax
        andq    $250, %rdi
        andq    %rax, %rcx
        movq    %rdi, %rax
        orq     %rcx, %rax
        ret

Evan is looking into the remaining andq+imm -> andl optimization.

llvm-svn: 93147
2010-01-11 06:55:24 +00:00
Chris Lattner 0a85420409 Extend CanEvaluateZExtd to handle and/or/xor more aggressively in the
BitsToClear case.  This allows it to promote expressions which have an
and/or/xor after the lshr, promoting cases like test2 (from PR4216) 
and test3 (random extample extracted from a spec benchmark).

clang now compiles the code in PR4216 into:

_test_bitfield:                                             ## @test_bitfield
	movl	%edi, %eax
	orl	$194, %eax
	movl	$4294902010, %ecx
	andq	%rax, %rcx
	orl	$32768, %edi
	andq	$39936, %rdi
	movq	%rdi, %rax
	orq	%rcx, %rax
	ret

instead of:

_test_bitfield:                                             ## @test_bitfield
	movl	%edi, %eax
	orl	$194, %eax
	movl	$4294902010, %ecx
	andq	%rax, %rcx
	shrl	$8, %edi
	orl	$128, %edi
	shlq	$8, %rdi
	andq	$39936, %rdi
	movq	%rdi, %rax
	orq	%rcx, %rax
	ret

which is still not great, but is progress.

llvm-svn: 93145
2010-01-11 04:05:13 +00:00
Chris Lattner 12bd8992b3 Remove the dead TD argument to CanEvaluateZExtd, and add a
new BitsToClear result which allows us to start promoting
expressions that end with a lshr-by-constant.  This is
conservatively correct and better than what we had before
(see testcases) but still needs to be extended further.

llvm-svn: 93144
2010-01-11 03:32:00 +00:00
Chris Lattner 172630abd2 improve comments, remove dead TD argument to CanEvaluateSExtd.
llvm-svn: 93143
2010-01-11 02:43:35 +00:00
Chris Lattner 7dd540ee24 teach sext optimization to handle truncs from types that are not
the dest of the sext.

llvm-svn: 93128
2010-01-10 20:30:41 +00:00
Chris Lattner 39d2daa94c teach zext optimization how to deal with truncs that don't come from
the zext dest type.  This allows us to handle test52/53 in cast.ll,
and allows llvm-gcc to generate much better code for PR4216 in -m64
mode:

_test_bitfield:                                             ## @test_bitfield
	orl	$32962, %edi
	movl	%edi, %eax
	andl	$-25350, %eax
	ret

This also fixes a bug handling vector extends, ensuring that the
mask produced is a vector constant, not an integer constant.

llvm-svn: 93127
2010-01-10 20:25:54 +00:00
Chris Lattner 5370ae7b70 fix a buggy assertion, CreateIntegerCast should allow
integer vectors as well as just integers.

llvm-svn: 93126
2010-01-10 20:21:42 +00:00
Mikhail Glushenkov ed3bd13c3a Suppress a warning on gcc 4.4.
warning: suggest parentheses around ‘&&’ within ‘||’.
llvm-svn: 93121
2010-01-10 18:48:49 +00:00
Chris Lattner 1a05fddcdc simplify CanEvaluateSExtd to return a bool now that we have a
simpler profitability predicate.

llvm-svn: 93111
2010-01-10 07:57:20 +00:00
Chris Lattner d7816780e2 the NumCastsRemoved argument to CanEvaluateSExtd is dead, remove it.
llvm-svn: 93110
2010-01-10 07:42:21 +00:00
Chris Lattner 2fff10c424 now that the cost model has changed, we can always consider
elimination of a sign extend to be a win, which simplifies 
the client of CanEvaluateSExtd, and allows us to eliminate
more casts (examples taken from real code).

llvm-svn: 93109
2010-01-10 07:40:50 +00:00
Victor Hernandez b8fd152d94 Compute isFunctionLocal in MDNode ctor or via argument in new function getWhenValsUnresolved().
Document PFS argument to ParseValID() and ConvertGlobalOrMetadataValIDToValue().

llvm-svn: 93108
2010-01-10 07:14:18 +00:00
Chris Lattner d8509424a4 change the preferred canonical form for a sign extension to be
lshr+ashr instead of trunc+sext.  We want to avoid type 
conversions whenever possible, it is easier to codegen expressions
without truncates and extensions.

llvm-svn: 93107
2010-01-10 07:08:30 +00:00
Chris Lattner 2b459fe7e1 fix indentation of switch statements, no functionality change.
llvm-svn: 93106
2010-01-10 06:59:55 +00:00
Chris Lattner 127bbc715e fix pasto that broke bootstrap.
llvm-svn: 93105
2010-01-10 06:50:04 +00:00
Chris Lattner b7be7cc486 simplify CanEvaluateZExtd now that we don't care about the number of
bits known clear in the result and don't care about the # casts 
eliminated.  TD is also dead but keeping it for now.

llvm-svn: 93098
2010-01-10 02:50:04 +00:00
Chris Lattner 49d2c9764d two changes:
1) don't try to optimize a sext or zext that is only used by a trunc, let
   the trunc get optimized first.  This avoids some pointless effort in
   some common cases since instcombine scans down a block in the first pass.
2) Change the cost model for zext elimination to consider an 'and' cheaper
   than a zext.  This allows us to do it more aggressively, and for the next
   patch to simplify the code quite a bit.

llvm-svn: 93097
2010-01-10 02:39:31 +00:00
Chris Lattner f0af17dab3 enhance CanEvaluateZExtd to handle shift left and sext, allowing
more expressions to be promoted and casts eliminated.

llvm-svn: 93096
2010-01-10 02:22:12 +00:00
Chris Lattner 7723e2b10f remove an xform subsumed by EvaluateInDifferentType.
llvm-svn: 93095
2010-01-10 01:35:55 +00:00
Julien Lerouge 321098ebec Fix nondeterministic behavior.
llvm-svn: 93093
2010-01-10 01:07:22 +00:00
Chris Lattner c95a7a21b7 clean up this xform by using m_Trunc.
llvm-svn: 93092
2010-01-10 01:04:31 +00:00
Chris Lattner 883550afe8 inline and remove the rest of commonIntCastTransforms.
llvm-svn: 93091
2010-01-10 01:00:46 +00:00
Chris Lattner c3aca38468 Inline the expression type promotion/demotion stuff out of
commonIntCastTransforms into the callers, eliminating a switch,
and allowing the static predicate  methods to be moved down to
live next to the corresponding function.  No functionality 
change.

llvm-svn: 93089
2010-01-10 00:58:42 +00:00
Chris Lattner 25963c6113 "In order to ease automatic bindings generation, it would be helpful if boolean values were distinguishable from integers. The attached patch introduces "typedef int LLVMBool;", and uses LLVMBool instead of int throughout the C API, wherever a boolean value is called for."
Patch by James Y Knight!

llvm-svn: 93079
2010-01-09 22:27:07 +00:00
Chris Lattner bbddd96406 fix PR5983, reject function bodies with no blocks per the grammar.
llvm-svn: 93067
2010-01-09 19:20:07 +00:00
Jeffrey Yasskin bb857e5d68 Fix http://llvm.org/PR5729: x86-64 tail calls were putting their targets into
R11, and then asserting that the target was in R9.  Since R9 isn't reserved for
the target anymore, and is used as an argument, this patch changes the
assertion.

llvm-svn: 93065
2010-01-09 18:56:43 +00:00
Dan Gohman bc694918cc Use WriteAsOperand instead of getName() to print loop header names,
so that unnamed blocks are handled.

llvm-svn: 93059
2010-01-09 18:17:45 +00:00
David Chisnall 2c4a34aeef Fixed linking of modules containing aliases to constant bitcasts. Existing behaviour first tried to replace the aliases with the global that they aliased (rather than the bitcast), causing a crash on an assert because the types didn't match. When this was fixed, it then did the same thing creating the new alias (creating an alias with a different type to its aliasee).
Linking modules containing aliases to GEPs is still not quite right.  GEPs that are equivalent to bitcasts will be replaced by bitcasts, GEPs that are not will just break.  Aliases to GEPs that are not equivalent to bitcasts are horribly broken anyway (it might be worth adding an assert when creating the alias to prevent these being created; they just cause problems later).

llvm-svn: 93052
2010-01-09 16:27:31 +00:00
Duncan Sands a230552b94 Suppress use of uninitialized variable warning.
llvm-svn: 93046
2010-01-09 08:30:33 +00:00
Chris Lattner ab7087ad66 only factor from expressions whose uses are empty and whose
base is the right expression type.  This fixes PR5981.

llvm-svn: 93045
2010-01-09 06:01:36 +00:00