Commit Graph

98042 Commits

Author SHA1 Message Date
Cameron Zwarich fc0c6b1ea9 Don't assume that an instruction ending a register's live range always reads
the register; it may be a dead def instead. Fixes PR8820.

llvm-svn: 122218
2010-12-20 01:22:37 +00:00
Chris Lattner 46b9efcad7 We lower setb to sbb with the hope that the and will go away, when it
doesn't, match it back to setb.

On a 64-bit version of the testcase before we'd get:

	movq	%rdi, %rax
	addq	%rsi, %rax
	sbbb	%dl, %dl
	andb	$1, %dl
	ret

now we get:

	movq	%rdi, %rax
	addq	%rsi, %rax
	setb	%dl
	ret

llvm-svn: 122217
2010-12-20 01:16:03 +00:00
Mon P Wang 7bcead020d Test case for r122215 when InstCombine optimizes memset
llvm-svn: 122216
2010-12-20 01:06:23 +00:00
Mon P Wang 1991c47ec1 Avoid dropping the address space when InstCombine optimizes memset
llvm-svn: 122215
2010-12-20 01:05:30 +00:00
Chris Lattner 9c26d2711b use for loop over types.
llvm-svn: 122214
2010-12-20 01:03:27 +00:00
Chris Lattner 846c20d4e6 Change the X86 backend to stop using the evil ADDC/ADDE/SUBC/SUBE nodes (which
their carry depenedencies with MVT::Flag operands) and use clean and beautiful
EFLAGS dependences instead.

We do this by changing the modelling of SBB/ADC to have EFLAGS input and outputs
(which is what requires the previous scheduler change) and change X86 ISelLowering
to custom lower ADDC and friends down to X86ISD::ADD/ADC/SUB/SBB nodes.

With the previous series of changes, this causes no changes in the testsuite, woo.

llvm-svn: 122213
2010-12-20 00:59:46 +00:00
Chris Lattner f5bb590e2d update comment.
llvm-svn: 122212
2010-12-20 00:56:59 +00:00
Chris Lattner 981afd206b Fix a bug in the scheduler's handling of "unspillable" vregs.
Imagine we see:

EFLAGS = inst1
EFLAGS = inst2 FLAGS
gpr = inst3 EFLAGS

Previously, we would refuse to schedule inst2 because it clobbers
the EFLAGS of the predecessor.  However, it also uses the EFLAGS
of the predecessor, so it is safe to emit.  SDep edges ensure that
the right order happens already anyway.

This fixes 2 testsuite crashes with the X86 patch I'm going to
commit next.

llvm-svn: 122211
2010-12-20 00:55:43 +00:00
Mon P Wang 075a16b09e Add comment for testcase for 122206
llvm-svn: 122210
2010-12-20 00:54:26 +00:00
Chris Lattner 0cfe884874 the result of CheckForLiveRegDef is dead, remove it.
llvm-svn: 122209
2010-12-20 00:51:56 +00:00
Chris Lattner ed69c6e4b9 reduce indentation, no functionality change.
llvm-svn: 122208
2010-12-20 00:50:16 +00:00
Cameron Zwarich 1b67d6c565 Ignore debug values when performing MachineVerifier liveness checks. Fixes
PR8822.

llvm-svn: 122207
2010-12-20 00:08:10 +00:00
Mon P Wang 1064992c84 Prevents PerformShuffleCombine from creating a node with an illegal type after legalize types
has run, e.g., prevent creating an i64 node from a v2i64 when i64 is not a legal type.

llvm-svn: 122206
2010-12-19 23:55:53 +00:00
Cameron Zwarich 0b111b1aee Early clobber operands are allowed to be defined at use indices. This fixes one
half of PR8813.

llvm-svn: 122205
2010-12-19 23:50:53 +00:00
Chris Lattner 4fb9dd4c74 fix an oversight caught by Frits!
llvm-svn: 122204
2010-12-19 23:24:04 +00:00
Bruno Cardoso Lopes 8e303e896e Update the Target Feature Matrix for Mips
llvm-svn: 122203
2010-12-19 22:41:43 +00:00
Cameron Zwarich 251337e1c4 Fix PR8815 by checking for an explicit clobber def tied to a use operand in
ConnectedVNInfoEqClasses::Classify().

llvm-svn: 122202
2010-12-19 22:12:45 +00:00
Chris Lattner 9edf3f50bf improve the setcc -> setcc_carry optimization to happen more
consistently by moving it out of lowering into dag combine.

Add some missing patterns for matching away extended versions of setcc_c.

llvm-svn: 122201
2010-12-19 22:08:31 +00:00
Greg Clayton fff42e6241 Line tables were trying to be too clever and only use 24 bits for a line
table offset where the offset is within a section. Increased the section
offset for line table entries to be 32 bits (from 24 bits), giving each 
section a 4G offset, and increased the section index to 32 bits (from 8 bits).

llvm-svn: 122200
2010-12-19 22:07:39 +00:00
Cameron Zwarich 7e24173a3c Fix PR8811 by teaching MachineVerifier about optional defs.
llvm-svn: 122199
2010-12-19 21:37:23 +00:00
Greg Clayton 9906250fe2 Removed logging code that I accidentally left in after recent changes.
llvm-svn: 122198
2010-12-19 21:36:12 +00:00
Cameron Zwarich b5cec4f11a StrongPHIElimination will never run before TwoAddressInstructionPass.
llvm-svn: 122197
2010-12-19 21:32:29 +00:00
Chris Lattner 6dddab2ffe simplify some code to just reuse a setcc if we can instead of
going through the CSE maps to get it.

llvm-svn: 122196
2010-12-19 21:23:48 +00:00
Nick Lewycky 21dcac2128 Use the new way of silencing this warning.
llvm-svn: 122195
2010-12-19 20:57:14 +00:00
Nick Lewycky 2e998b7a6e Add missing standard includes. Patch by Joerg Sonnenberger!
llvm-svn: 122194
2010-12-19 20:49:25 +00:00
Nick Lewycky 0de20af7ba Add missing standard headers. Patch by Joerg Sonnenberger!
llvm-svn: 122193
2010-12-19 20:43:38 +00:00
Nick Lewycky b71afe82bf Add missing std:: prefixes to some calls. C++ doesn't require that <cfoo>
headers provide symbols outside namespace std and the LLVM coding standards
state that we should prefix all of them.

llvm-svn: 122192
2010-12-19 20:42:43 +00:00
Chris Lattner 440b2804ff teach MaskedValueIsZero how to analyze ADDE. This is
enough to teach it that ADDE(0,0) is known 0 except the 
low bit, for example.

llvm-svn: 122191
2010-12-19 20:38:28 +00:00
Chris Lattner b6252a376a tidy up
llvm-svn: 122190
2010-12-19 20:24:28 +00:00
Chris Lattner c37bb023b1 now that generic vector types aren't selected onto MMX operations,
we don't need -disable-mmx anymore.

llvm-svn: 122189
2010-12-19 20:19:20 +00:00
Chris Lattner ff392ab3ed now that generic vector types aren't selected onto MMX registers, these
tests don't need -disable-mmx.

llvm-svn: 122188
2010-12-19 20:12:58 +00:00
Chris Lattner ae756e1980 reduce copy/paste programming with the power of for loops.
llvm-svn: 122187
2010-12-19 20:07:10 +00:00
Chris Lattner 1e8c032a6e X86 supports i8/i16 overflow ops (except i8 multiplies), we should
generate them.  

Now we compile:

define zeroext i8 @X(i8 signext %a, i8 signext %b) nounwind ssp {
entry:
  %0 = tail call %0 @llvm.sadd.with.overflow.i8(i8 %a, i8 %b)
  %cmp = extractvalue %0 %0, 1
  br i1 %cmp, label %if.then, label %if.end

into:

_X:                                     ## @X
## BB#0:                                ## %entry
	subl	$12, %esp
	movb	16(%esp), %al
	addb	20(%esp), %al
	jo	LBB0_2

Before we were generating:

_X:                                     ## @X
## BB#0:                                ## %entry
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	movb	12(%ebp), %al
	testb	%al, %al
	setge	%cl
	movb	8(%ebp), %dl
	testb	%dl, %dl
	setge	%ah
	cmpb	%cl, %ah
	sete	%cl
	addb	%al, %dl
	testb	%dl, %dl
	setge	%al
	cmpb	%al, %ah
	setne	%al
	andb	%cl, %al
	testb	%al, %al
	jne	LBB0_2

llvm-svn: 122186
2010-12-19 20:03:11 +00:00
Chris Lattner 405c28bc7d add a general coverage test for overflow intrinsics.
llvm-svn: 122185
2010-12-19 20:01:13 +00:00
Wesley Peck 36a1f68fec 1. Add some ABI information for the Microblaze.
2. Add attibutes "interrupt_handler" and "save_volatiles" for the Microblaze target.

llvm-svn: 122184
2010-12-19 19:57:51 +00:00
Chris Lattner 3e635d2e99 move a transformation to a more logical place, simplifying it.
llvm-svn: 122183
2010-12-19 19:43:52 +00:00
Chris Lattner 5e0c0c72e9 recognize an unsigned add with overflow idiom into uadd.
This resolves a README entry and technically resolves PR4916,
but we still get poor code for the testcase in that PR because
GVN isn't CSE'ing uadd with add, filed as PR8817.

Previously we got:

_test7:                                 ## @test7
	addq	%rsi, %rdi
	cmpq	%rdi, %rsi
	movl	$42, %eax
	cmovaq	%rsi, %rax
	ret

Now we get:

_test7:                                 ## @test7
	addq	%rsi, %rdi
	movl	$42, %eax
	cmovbq	%rsi, %rax
	ret

llvm-svn: 122182
2010-12-19 19:37:52 +00:00
Chris Lattner 33dc3f0cfa optimize uadd(x, cst) into a comparison when the normal
result is dead.  This is required for my next patch to not
regress the testsuite.

llvm-svn: 122181
2010-12-19 19:35:32 +00:00
Chris Lattner 94f24db6f0 add a version of IRBuilder::SetInsertPoint that takes an instruction.
llvm-svn: 122180
2010-12-19 19:16:22 +00:00
Chris Lattner ce2995ae58 use IC.ReplaceInstUsesWith instead of a raw RAUW so that uses of
the old thing end up on the instcombine worklist.  Not doing this
can cause an extra top-level iteration of instcombine, burning
compile time.

llvm-svn: 122179
2010-12-19 18:38:44 +00:00
Chris Lattner 79874566ce generalize the sadd creation code to not require that the
sadd formed is half the size of the original type. We can
now compile this into a sadd.i8:

unsigned char X(char a, char b) {
  int res = a+b;
  if ((unsigned )(res+128) > 255U)
    abort();
  return res;
}

llvm-svn: 122178
2010-12-19 18:35:09 +00:00
Chris Lattner c56c845377 fix another miscompile in the llvm.sadd formation logic: it wasn't
checking to see if the high bits of the original add result were dead.
Inserting a smaller add and zexting back to that size is not good enough.

This is likely to be the fix for 8816.

llvm-svn: 122177
2010-12-19 18:22:06 +00:00
Cameron Zwarich 713ab37965 Remove some checks for StrongPHIElim. These checks make it impossible to use an
alternative register allocator that does not require LiveIntervals by specifying
it on the command-line for a target that has StrongPHIElimination enabled by
default.

These checks are pretty meaningless anyways, since StrongPHIElimination and
PHIElimination are never used at the same time.

llvm-svn: 122176
2010-12-19 18:03:27 +00:00
Chris Lattner f29562db25 fix a bug (possibly 8816) in the sadd forming xform: it isn't
profitable (or safe) to promote code when the add-with-constant
has other uses.

llvm-svn: 122175
2010-12-19 17:59:02 +00:00
Chris Lattner ee61c1d820 rework the code added in r122072 to pull it out to its own
helper function, clean up comments, and reduce indentation.
No functionality change.

llvm-svn: 122174
2010-12-19 17:52:50 +00:00
Francois Pichet a83957a5c9 Add support for the Microsoft uuid attribute:
example:
struct __declspec(uuid("6d5140c1-7436-11ce-8034-00aa006009fa"))
test { };

llvm-svn: 122173
2010-12-19 06:50:37 +00:00
Chris Lattner 408a684d29 Enhance LICM to promote alias sets whose pointers themselves are stored,
which doesn't affect the memory address being promoted.

llvm-svn: 122172
2010-12-19 05:57:25 +00:00
Chris Lattner 3337a81450 fix PR8602, a bug in an assertion: a volatile store *of* a pointer
does not make the alias set for that pointer volatile, just stores
*to* the pointer.

llvm-svn: 122171
2010-12-19 05:51:54 +00:00
Chris Lattner 77a8a71414 fix PR8642: if a critical edge has a PHI value that can trap,
isel is *required* to split the edge.  PHI values get evaluated
on the edge, not in their predecessor block.

llvm-svn: 122170
2010-12-19 04:58:57 +00:00
Chris Lattner eff3af9d4e remove dead header
llvm-svn: 122169
2010-12-19 04:49:11 +00:00