Commit Graph

98011 Commits

Author SHA1 Message Date
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
Chris Lattner fb888622c3 revert r122164, I'm going to go with a different approach.
llvm-svn: 122168
2010-12-19 04:23:03 +00:00
Rafael Espindola ee54636f0a Fixed version of 122160 (the previous one would fold undefined symbols).
llvm-svn: 122167
2010-12-19 04:18:56 +00:00
Greg Clayton 6ad07dd9e9 Improved our argument parsing abilities to be able to handle stuff more like
a shell would interpret it. A few examples that we now handle correctly

INPUT: "Hello "world
OUTPUT: "Hello World"

INPUT: "Hello "' World'
OUTPUT: "Hello World"

INPUT: Hello" World"
OUTPUT: "Hello World"

This broke the setting of dictionary values for the "settings set" command
for things like:

(lldb) settings set target.process.env-vars ["MY_ENV_VAR"]=YES

since we would drop the quotes. I fixed the user settings controller to use
a regular expression so it can accept any of the following inputs for
dictionary setting:

settings set target.process.env-vars ["MY_ENV_VAR"]=YES
settings set target.process.env-vars [MY_ENV_VAR]=YES
settings set target.process.env-vars MY_ENV_VAR=YES

We might want to eventually drop the first two syntaxes, but I won't make
that decision right now.

This allows more natural setting of the envirorment variables:

settings set target.process.env-vars MY_ENV_VAR=YES ABC=DEF CWD=/tmp

llvm-svn: 122166
2010-12-19 03:41:24 +00:00
Rafael Espindola 9a2d4e04c7 Revert 122160 while I debug it.
llvm-svn: 122165
2010-12-19 03:22:05 +00:00
Chris Lattner 583ec6fa44 first step to fixing PR8642: don't fold away empty basic blocks
which have trapping constant exprs in them due to PHI nodes.
Eliminating them can cause the constant expr to be evalutated
on new paths if the input edges are critical.

llvm-svn: 122164
2010-12-19 03:02:34 +00:00
Chris Lattner 2b43f2df2b move this test into the ARM test so that it is only run when the arm backend
is enabled.

llvm-svn: 122163
2010-12-19 02:58:14 +00:00
John McCall 4f5019e670 Motions towards simplifying how we deal with attribute-qualified function types.
llvm-svn: 122162
2010-12-19 02:44:49 +00:00
Zhongxing Xu 7e2a9fd620 If the initializer is an rvalue and the variable is a const reference,
create a temporary object for it.

llvm-svn: 122161
2010-12-19 02:26:37 +00:00
Rafael Espindola 6fd80a5593 Move all folding to AttemptToFoldSymbolOffsetDifference.
llvm-svn: 122160
2010-12-19 02:15:04 +00:00
Michael J. Spencer d3f7af5181 Support/PathV1: Clarify deprecation warning.
llvm-svn: 122159
2010-12-18 22:23:24 +00:00
Michael J. Spencer fce1fe16e0 Fix whitespace.
llvm-svn: 122158
2010-12-18 22:23:15 +00:00
Michael J. Spencer ca93d8406d Support/PathV1: Deprecate get{Basename,Dirname,Suffix}.
llvm-svn: 122157
2010-12-18 22:23:07 +00:00
Chris Lattner 6b8b4855ff simplify this a bit.
llvm-svn: 122156
2010-12-18 20:22:49 +00:00
Anton Korobeynikov 3eb4fedecf Restore the behavior of frame lowering before my refactoring.
It turns out that ppc backend has really weird interdependencies
over different hooks and all stuff is fragile wrt small changes.
This should fix PR8749

llvm-svn: 122155
2010-12-18 19:53:14 +00:00
Benjamin Kramer 4b4f3557de Just rename the functions, relying on matching a instruction that has the same name as a symbol is way too fragile.
llvm-svn: 122154
2010-12-18 14:23:57 +00:00
Benjamin Kramer 5f6219d929 Test more than just label names and make test work on non-x86 hosts.
llvm-svn: 122153
2010-12-18 14:07:28 +00:00
Eric Christopher 8786aab475 Header warning patrol.
llvm-svn: 122152
2010-12-18 10:54:29 +00:00
Roman Divacky 71d29167ea Add support for lexing single quotes like 'c'.
This fixed 8615.

llvm-svn: 122150
2010-12-18 08:56:37 +00:00
Owen Anderson c15ab07cff Revert r122143 through r122140, which collectively broke the LLVMC tests on
the buildbots.

llvm-svn: 122149
2010-12-18 07:37:18 +00:00
Rafael Espindola b403e098a1 Merge isAbsolute into IsSymbolRefDifferenceFullyResolved.
llvm-svn: 122148
2010-12-18 06:27:54 +00:00
Rafael Espindola 8396dd0893 Remove the MCObjectFormat class.
llvm-svn: 122147
2010-12-18 05:37:28 +00:00
Zhongxing Xu 1b47773e1f The evaluation of dereference and address-of is identical.
llvm-svn: 122146
2010-12-18 05:16:43 +00:00
Rafael Espindola 2140ff508f Add a test that shows that we produce no fixups when computing the difference
of two symbols in the same fragment.

llvm-svn: 122145
2010-12-18 05:07:45 +00:00
Rafael Espindola 293a7c1840 Add a FIXME and explain a hack.
llvm-svn: 122144
2010-12-18 04:19:20 +00:00
Michael J. Spencer 092b55542f Support/PathV1: Clarify deprecation warning.
llvm-svn: 122143
2010-12-18 04:13:54 +00:00
Michael J. Spencer 01cf728ea9 Fix whitespace.
llvm-svn: 122142
2010-12-18 04:13:46 +00:00
Michael J. Spencer 4f63507d05 Support/PathV1: Deprecate get{Basename,Dirname,Suffix}.
llvm-svn: 122141
2010-12-18 04:13:36 +00:00
Michael J. Spencer e47230f9b5 Replace all uses of PathV1::get{Basename,Dirname,Suffix} with their PathV2 equivalents.
llvm-svn: 122140
2010-12-18 04:13:32 +00:00
Rafael Espindola 1ea7f18caa Fix the note.
llvm-svn: 122139
2010-12-18 04:01:45 +00:00
Rafael Espindola 5004f4a9b5 Revert 122011, 122012, 122013, 122023 adding back an important optimization.
I added a note, but suggestions on how to add a test are really welcome.

llvm-svn: 122138
2010-12-18 03:57:21 +00:00
John McCall ec00cd9713 Fix test. I added one last test and then forget to re-check.
llvm-svn: 122137
2010-12-18 03:52:04 +00:00