Commit Graph

6227 Commits

Author SHA1 Message Date
Chris Lattner
f9ead87c68 add missing line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92384 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 01:54:08 +00:00
Chris Lattner
d27f911b23 add a few trivial instcombines for llvm.powi.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92383 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 01:52:15 +00:00
Chris Lattner
9506c930aa When factoring multiply expressions across adds, factor both
positive and negative forms of constants together.  This 
allows us to compile:

int foo(int x, int y) {
    return (x-y) + (x-y) + (x-y);
}

into:

_foo:                                                       ## @foo
	subl	%esi, %edi
	leal	(%rdi,%rdi,2), %eax
	ret

instead of (where the 3 and -3 were not factored):

_foo:
        imull   $-3, 8(%esp), %ecx
        imull   $3, 4(%esp), %eax
        addl    %ecx, %eax
        ret

this started out as:
    movl    12(%ebp), %ecx
    imull   $3, 8(%ebp), %eax
    subl    %ecx, %eax
    subl    %ecx, %eax
    subl    %ecx, %eax
    ret

This comes from PR5359.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92381 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 01:13:15 +00:00
Chris Lattner
9046193e55 clean up some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92377 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 00:04:26 +00:00
Chris Lattner
f55e7f54b1 switch from std::map to DenseMap for rank data structures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92375 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 00:01:34 +00:00
Chris Lattner
3523993451 reuse negates where possible instead of always creating them from scratch.
This allows us to optimize test12 into:

define i32 @test12(i32 %X) {
  %factor = mul i32 %X, -3                        ; <i32> [#uses=1]
  %Z = add i32 %factor, 6                         ; <i32> [#uses=1]
  ret i32 %Z
}

instead of:

define i32 @test12(i32 %X) {
  %Y = sub i32 6, %X                              ; <i32> [#uses=1]
  %C = sub i32 %Y, %X                             ; <i32> [#uses=1]
  %Z = sub i32 %C, %X                             ; <i32> [#uses=1]
  ret i32 %Z
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92373 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 20:34:32 +00:00
Chris Lattner
f31e2e92a8 we don't need a smallptrset to detect duplicates, the values are
sorted, so we can just do a linear scan.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92372 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 19:49:01 +00:00
Chris Lattner
1e7558b656 make reassociate more careful about not leaving around dead mul's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 19:34:45 +00:00
Chris Lattner
f8a447de16 remove debug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92369 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 19:25:19 +00:00
Chris Lattner
69e98e2c0f teach reassociate to factor x+x+x -> x*3. While I'm at it,
fix RemoveDeadBinaryOp to actually do something.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 19:24:52 +00:00
Chris Lattner
9f7b7089be change reassociate to use SmallVector for its key datastructures
instead of std::vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 18:40:32 +00:00
Chris Lattner
9cd1bc4f8b change an if to an assert, fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 18:18:46 +00:00
Chris Lattner
94285e620b move the rest of the add optimization code out to OptimizeAdd,
improve some comments, simplify a bit of code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 18:17:13 +00:00
Chris Lattner
9fdaefad58 factor statistic updating better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 17:51:05 +00:00
Chris Lattner
13a754ce92 simple fix for an incorrect factoring which causes a
miscompilation, PR5458.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92354 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 08:33:49 +00:00
Chris Lattner
f3f55a9bc1 factor code out into helper functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 07:59:34 +00:00
Chris Lattner
8d93b259f6 switch some std::vector's to smallvector. Reduce nesting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 07:48:51 +00:00
Chris Lattner
ec531233a1 use more modern datastructures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92344 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 07:33:14 +00:00
Chris Lattner
1befe643b2 clean up -debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 07:17:37 +00:00
Chris Lattner
f0908a351a fix Analysis/DebugInfo.h to not include Metadata.h. Do this
by moving one method out of line and eliminating redundant checks
from other methods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92337 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 03:02:08 +00:00
Chris Lattner
5d0cacdbb6 rename "elements" of metadata to "operands". "Elements" are
things that occur in types.  "operands" are things that occur
in values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:22:29 +00:00
Benjamin Kramer
fda08e1308 Use an array instead of a SmallVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 11:04:52 +00:00
Chris Lattner
19f2dc436d prune #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92260 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 09:12:29 +00:00
Chris Lattner
081134741b Final step in the metadata API restructuring: move the
getMDKindID/getMDKindNames methods to LLVMContext (and add
convenience methods to Module), eliminating MetadataContext.
Move the state that it maintains out to LLVMContext.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 09:01:33 +00:00
Chris Lattner
101e2cab0b remove useless argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 08:03:58 +00:00
Chris Lattner
3990b121cf This is a major cleanup of the instruction metadata interfaces that
I asked Devang to do back on Sep 27.  Instead of going through the
MetadataContext class with methods like getMD() and getMDs(), just
ask the instruction directly for its metadata with getMetadata()
and getAllMetadata().

This includes a variety of other fixes and improvements: previously
all Value*'s were bloated because the HasMetadata bit was thrown into
value, adding a 9th bit to a byte.  Now this is properly sunk down to
the Instruction class (the only place where it makes sense) and it
will be folded away somewhere soon.

This also fixes some confusion in getMDs and its clients about 
whether the returned list is indexed by the MDID or densely packed.
This is now returned sorted and densely packed and the comments make
this clear.

This introduces a number of fixme's which I'll follow up on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 23:41:32 +00:00
Chris Lattner
a53cfd16f0 split code that doesn't need to be templated out of IRBuilder into a new
non-templated IRBuilderBase class.  Move that large CreateGlobalString
out of line, eliminating the need to #include GlobalVariable.h in IRBuilder.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 21:28:46 +00:00
Chris Lattner
0eb419800a rename getMDKind -> getMDKindID, make it autoinsert if an MD Kind
doesn't exist already, eliminate registerMDKind.  Tidy up a bunch
of random stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92225 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 20:45:51 +00:00
Chris Lattner
5660846f15 Metadata.h doesn't need to include ValueHandle.h anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92211 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 08:20:46 +00:00
Chris Lattner
8047d9a6be move an optimization for memcmp out of simplifylibcalls and into
SDISel.  This optimization was causing simplifylibcalls to 
introduce type-unsafe nastiness.  This is the first step, I'll be 
expanding the memcmp optimizations shortly, covering things that
we really really wouldn't want simplifylibcalls to do.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 00:37:38 +00:00
Chris Lattner
98d67d7d7e reorder to follow a normal fall-through style, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92084 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 23:24:51 +00:00
David Greene
63c9463c62 Remove dump routine and the associated Debug.h from a header. Patch up
other files to compensate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92075 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 22:58:38 +00:00
Eric Christopher
d060b2576a Update objectsize intrinsic and associated dependencies. Fix
lowering code and update testcases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91979 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 02:51:48 +00:00
Chris Lattner
aadadb3973 Fix the Convert to scalar to not insert dead loads in the store case. The
load is needed when we have a small store into a large alloca (at which 
point we get a load/insert/store sequence), but when you do a full-sized
store, this load ends up being dead.

This dead load is bad in really large nasty testcases where the load ends
up causing mem2reg to insert large chains of dependent phi nodes which only
ADCE can delete.  Instead of doing this, just don't insert the dead load.

This fixes rdar://6864035



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91917 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 19:33:28 +00:00
Chris Lattner
97eee027f9 fix some fixme's by using twines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91916 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 19:23:33 +00:00
Bob Wilson
f27a4cd783 Generalize SROA to allow the first index of a GEP to be non-zero. Add a
missing check that an array reference doesn't go past the end of the array,
and remove some redundant checks for in-bound array and vector references
that are no longer needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91897 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 06:57:14 +00:00
Chris Lattner
1a0e7081c3 Implement PR5795 by merging duplicated return blocks. This could go further
by merging all returns in a function into a single one, but simplifycfg 
currently likes to duplicate the return (an unfortunate choice!)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91890 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 06:07:30 +00:00
Chris Lattner
0ee443d169 The phi translated pointer can be computed when returning a partially cached result
instead of stored.  This reduces memdep memory usage, and also eliminates a bunch of
weakvh's.  This speeds up gvn on gcc.c-torture/20001226-1.c from 23.9s to 8.45s (2.8x)
on a different machine than earlier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 04:25:02 +00:00
Eric Christopher
f734be2ba4 Whitespace fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91875 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 01:23:51 +00:00
Daniel Dunbar
eddfaaf07e Add suggested parentheses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91853 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 23:27:57 +00:00
Chris Lattner
d2191e549b Add a fastpath to Load GVN to special case when we have exactly one dominating
load to avoid even messing around with SSAUpdate at all.  In this case (which
is very common, we can just use the input value directly).

This speeds up GVN time on gcc.c-torture/20001226-1.c from 36.4s to 16.3s,
which still isn't great, but substantially better and this is a simple speedup
that applies to lots of different cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91851 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 23:15:48 +00:00
Chris Lattner
5362c545e8 refactor some code out to a new helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91849 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 23:04:33 +00:00
Chris Lattner
25bceead50 improve indentation avoid a pointless conversion from weakvh to trackingvh,
no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91848 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 22:43:03 +00:00
Bob Wilson
3c3af5d155 Remove special-case SROA optimization of variable indexes to one-element and
two-element arrays.  After restructuring the SROA code, it was not safe to
do this without adding more checking.  It is not clear that this special-case
has really been useful, and removing this simplifies the code quite a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 18:39:47 +00:00
Chris Lattner
3cf4d90f3d revert r89298, which was committed without a testcase. I think
the underlying PHI node insertion issue in SSAUpdate is fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91821 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 07:45:57 +00:00
Chris Lattner
4c1e3da0cd fix PR5837 by having SSAUpdate reuse phi nodes for the
'GetValueInMiddleOfBlock' case, instead of inserting 
duplicates.

A similar fix is almost certainly needed by the machine-level
SSAUpdate implementation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91820 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 07:16:11 +00:00
Chris Lattner
b109b5c148 give instcombine some helper functions for matching MIN and MAX, and
implement some optimizations for MIN(MIN()) and MAX(MAX()) and 
MIN(MAX()) etc.  This substantially improves the code in PR5822 but
doesn't kick in much elsewhere.  2 max's were optimized in 
pairlocalalign and one in smg2000.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91814 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 06:03:05 +00:00
Chris Lattner
3bf6815556 enhance x-(-A) -> x+A to preserve NUW/NSW.
Use the presence of NSW/NUW to fold "icmp (x+cst), x" to a constant in
cases where it would otherwise be undefined behavior.

Surprisingly (to me at least), this triggers hundreds of the times in
a few benchmarks: lencode, ldecode, and 466.h264ref seem to *really*
like this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91812 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 04:04:05 +00:00
Chris Lattner
2799bafb98 Optimize all cases of "icmp (X+Cst), X" to something simpler. This triggers
a bunch in lencode, ldecod, spass, 176.gcc, 252.eon, among others.  It is 
also the first part of PR5822


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91811 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 03:19:28 +00:00
Douglas Gregor
cabdd7425d Fix a bunch of little errors that Clang complains about when its being pedantic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91764 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-19 07:05:23 +00:00
Chris Lattner
0ebc6ce974 fix PR5827 by disabling the phi slicing transformation in a case
where instcombine would have to split a critical edge due to a
phi node of an invoke.  Since instcombine can't change the CFG,
it has to bail out from doing the transformation.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91763 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-19 07:01:15 +00:00
Bob Wilson
e88728d757 Update my SROA changes in response to review.
* change FindElementAndOffset to return a uint64_t instead of unsigned, and
  to identify the type to be used for that result in a GEP instruction.
* move "isa<ConstantInt>" to be first in conditional.
* replace some dyn_casts with casts.
* add a comment about handling mem intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91762 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-19 06:53:17 +00:00
Bob Wilson
b742defa0a Reapply 91459 with a simple fix for the problem that broke the x86_64-darwin
bootstrap.  This also replaces the WeakVH references that Chris objected to
with normal Value references.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91711 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 20:14:40 +00:00
Eli Friedman
97b087c778 Optimize icmp of null and select of two constants even if the select has
multiple uses.  (The construct in question was found in gcc.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 08:22:35 +00:00
Dan Gohman
ad12b2698b Eliminte unnecessary uses of <cstdio>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91666 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 03:25:51 +00:00
Dan Gohman
92329c7fbe Add Loop contains utility methods for testing whether a loop
contains another loop, or an instruction. The loop form is
substantially more efficient on large loops than the typical
code it replaces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91654 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 01:24:09 +00:00
Dan Gohman
3ca735450d Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91653 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 01:20:44 +00:00
Dan Gohman
6a27e1550d Don't pass const pointers by reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91647 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 00:38:08 +00:00
Dan Gohman
34d2b90d09 Update a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91645 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 00:28:43 +00:00
Dan Gohman
6bec5bb344 Reapply LoopStrengthReduce and IVUsers cleanups, excluding the part
of 91296 that caused trouble -- the Processed list needs to be
preserved for the livetime of the pass, as AddUsersIfInteresting
is called from other passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91641 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 00:06:20 +00:00
Eli Friedman
b17cb06c35 Allow instcombine to combine "sext(a) >u const" to "a >u trunc(const)".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91631 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 22:42:29 +00:00
Eli Friedman
8e4b197e0b Make the ptrtoint comparison simplification work if one side is a global.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91624 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 21:27:47 +00:00
Eli Friedman
0c826d98b3 Slightly generalize transformation of memmove(a,a,n) so that it also applies
to memcpy. (Such a memcpy is technically illegal, but in practice is safe
and is generated by struct self-assignment in C code.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 21:07:31 +00:00
Bob Wilson
39c88a641b Re-revert 91459. It's breaking the x86_64 darwin bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91607 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 18:34:24 +00:00
Evan Cheng
04149f7ffd Revert 91280-91283, 91286-91289, 91291, 91293, 91295-91296. It apparently introduced a non-deterministic behavior in the optimizer somewhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91598 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 09:39:49 +00:00
Daniel Dunbar
2674089cef Reapply r91459, it was only unmasking the bug, and since TOT is still broken having it reverted does no good.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91559 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 20:09:53 +00:00
Daniel Dunbar
fca55c8ac7 Revert "Reapply 91184 with fixes and an addition to the testcase to cover the
problem", this broke llvm-gcc bootstrap for release builds on
x86_64-apple-darwin10.

This reverts commit db22309800b224a9f5f51baf76071d7a93ce59c9.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91534 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 10:56:17 +00:00
Chris Lattner
24604110ef reapply my strstr optimization. I have reproduced the x86-64 bootstrap
miscompile (i386.o miscompares) but it happens both with and without
this patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91532 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 09:32:05 +00:00
Chris Lattner
0001517d9d revert my strstr optimization, I'm told it breaks x86-64 bootstrap.
Will reapply with a fix when I get a chance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91486 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 00:46:02 +00:00
Bob Wilson
970eaf2520 Reapply 91184 with fixes and an addition to the testcase to cover the problem
found last time.  Instead of trying to modify the IR while iterating over it,
I've change it to keep a list of WeakVH references to dead instructions, and
then delete those instructions later.  I also added some special case code to
detect and handle the situation when both operands of a memcpy intrinsic are
referencing the same alloca.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91459 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 22:00:51 +00:00
Chris Lattner
ad6b1fdaf9 optimize strstr, PR5783
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91438 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 19:14:40 +00:00
Dan Gohman
a0cefcfcac Delete an unused function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91432 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 16:30:09 +00:00
Chris Lattner
099b41f342 add some other xforms that should be done as part of PR5783
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91428 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 09:05:13 +00:00
Chris Lattner
4bbf4ee149 Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91421 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 07:26:43 +00:00
Dan Gohman
30844c3950 Fix a thinko; isNotAlreadyContainedIn had a built-in negative, so the
condition was inverted when the code was converted to contains().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91295 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 17:31:01 +00:00
Dan Gohman
c71c0e958c Remove unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 17:19:06 +00:00
Dan Gohman
d3222b4224 Instead of having a ScalarEvolution pointer member in BasedUser, just pass
the ScalarEvolution pointer into the functions which need it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91289 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 17:12:51 +00:00
Dan Gohman
a77d588c75 Don't bother cleaning up if there's nothing to clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91288 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 17:10:44 +00:00
Dan Gohman
6dc1ef3923 Delete an unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91287 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 17:08:09 +00:00
Dan Gohman
1ed8bb3556 LSR itself doesn't need LoopInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 17:02:34 +00:00
Dan Gohman
c398365349 LSR itself doesn't need DominatorTree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91282 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 16:57:08 +00:00
Dan Gohman
67b94fb73d Remove the code in LSR that manually hoists expansions out of loops;
SCEVExpander does this automatically.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91281 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 16:52:55 +00:00
Dan Gohman
b058ceda56 Minor code cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91280 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 16:37:29 +00:00
Chris Lattner
a59adc4015 revert r91184, because it causes a crash on a .bc file I just
sent to Bob.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14 05:11:02 +00:00
Chandler Carruth
0daf77e803 Don't leave pointers uninitialized in the default constructor. GCC complains
about the potential use of these uninitialized members under certain conditions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-13 07:04:45 +00:00
Bob Wilson
73a1b67cb9 Revise scalar replacement to be more flexible about handle bitcasts and GEPs.
While scanning through the uses of an alloca, keep track of the current offset
relative to the start of the alloca, and check memory references to see if
the offset & size correspond to a component within the alloca.  This has the
nice benefit of unifying much of the code from isSafeUseOfAllocation,
isSafeElementUse, and isSafeUseOfBitCastedAllocation.  The code to rewrite
the uses of a promoted alloca, after it is determined to be safe, is
reorganized in the same way.

Also, when rewriting GEP instructions, mark them as "in-bounds" since all the
indices are known to be safe.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91184 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 23:47:40 +00:00
Eric Christopher
3472ae1e7b Make sure the immediate dominator isn't NULL through iterations
of the loop. We could get to this condition via indirect
branches.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91009 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 00:25:41 +00:00
Chris Lattner
16f244e982 Fix PR5744, a case where we were getting the pointer size instead of the
value size.  This only manifested when memdep inprecisely returns clobber,
which is do to a caching issue in the PR5744 testcase.  We can 'efficiently
emulate' this by using '-no-aa'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91004 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 00:11:45 +00:00
Chris Lattner
b6760b4a1e allow this to build when the #if 0's are enabled. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90999 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 00:04:46 +00:00
Dan Gohman
f68d0c1bbe Dereference loopHeader after checking for null rather than before.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 22:55:01 +00:00
Chris Lattner
af064aeee6 fix hte last remaining known (by me) phi translation bug. When we reanalyze
clobbers to forward pieces of large stores to small loads, we need to consider
the properly phi translated pointer in the store block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90978 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 18:21:46 +00:00
Chris Lattner
b2c6ae8c0b change GetStoreValueForLoad to use IRBuilder, which is cleaner and
implicitly constant folds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90977 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 18:13:28 +00:00
Bob Wilson
efc58e7933 Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90975 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 18:05:27 +00:00
Chris Lattner
4ca70fe15f change AnalyzeLoadFromClobberingMemInst/AnalyzeLoadFromClobberingStore
to require the load ty/ptr to be passed in, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90960 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 07:37:07 +00:00
Chris Lattner
03f17da4da change AnalyzeLoadFromClobberingWrite and clients to pass in type
and pointer instead of the load.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 07:34:10 +00:00
Chris Lattner
e18b97121c change NonLocalDepEntry from being a typedef for an std::pair to be its
own small class.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90956 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 07:08:01 +00:00
Chris Lattner
b3f927f6dd add some aborts to #if 0's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 02:41:54 +00:00
Chris Lattner
05e15f8897 Switch GVN and memdep to use PHITransAddr, which correctly handles
phi translation of complex expressions like &A[i+1].  This has the
following benefits:

1. The phi translation logic is all contained in its own class with
   a strong interface and verification that it is self consistent.

2. The logic is more correct than before.  Previously, if intermediate
   expressions got PHI translated, we'd miss the update and scan for
   the wrong pointers in predecessor blocks.  @phi_trans2 is a testcase
   for this.

3. We have a lot less code in memdep.

We can handle phi translation across blocks of things like @phi_trans3,
which is pretty insane :).

This patch should fix the miscompiles of 255.vortex, and I tested it 
with a bootstrap of llvm-gcc, llvm-test and dejagnu of course.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90926 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 01:59:31 +00:00
Bob Wilson
65ab34f3f2 Some superficial cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90866 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 18:27:03 +00:00
Bob Wilson
78c50b8cd6 Clean up dead operands left around after SROA replaces a mem intrinsic.
I'm not aware that this does anything significant on its own, but it's
needed for another patch that I'm working on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90864 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 18:22:03 +00:00
Duncan Sands
7a154cf228 Teach GlobalOpt to delete aliases with internal linkage (after
forwarding any uses).  GlobalDCE can also do this, but is only
run at -O3.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90850 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 10:10:20 +00:00
Nick Lewycky
87f8e49027 Remove unnecessary #include "llvm/LLVMContext.h".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90836 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 05:45:41 +00:00
Chris Lattner
08bc2701a2 fix PR5698
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90708 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 17:17:23 +00:00
Chris Lattner
bc9a28dd54 constant fold loads from memcpy's from global constants. This is important
because clang lowers nontrivial automatic struct/array inits to memcpy from
a global array.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90698 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 05:29:56 +00:00
Chris Lattner
cb9cbc4949 add support for forwarding mem intrinsic values to non-local loads.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90697 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 04:54:31 +00:00
Chris Lattner
faf815b938 Handle forwarding local memsets to loads. For example, we optimize this:
short x(short *A) {
  memset(A, 1, sizeof(*A)*100);
  return A[42];
}

to 'return 257' instead of doing the load.  



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90695 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 01:57:02 +00:00
Nick Lewycky
83e8ec73e1 Generalize this optimization to work on equality comparisons between any two
integers that are constant except for a single bit (the same n-th bit in each).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90646 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 05:00:00 +00:00
Bob Wilson
39fdd6947c Fix up some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90603 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 21:57:37 +00:00
Bob Wilson
d614a1f0a8 Fix 80-column violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 21:51:35 +00:00
Chris Lattner
45305d4ff6 add an assert to make it really clear what this is doing. Return singularval as
a compile time perf optimization to avoid a load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90507 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 01:03:32 +00:00
Bob Wilson
4a8ee23a81 Fix a comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90487 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 21:47:07 +00:00
Owen Anderson
c9f2027adb Fix this crasher, and add a FIXME for a missed optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90408 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 03:43:29 +00:00
Chris Lattner
7896c9f436 improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90365 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 00:50:42 +00:00
Jim Grosbach
43a8241b65 Move EliminateDuplicatePHINodes() from SimplifyCFG.cpp to Local.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90324 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 17:06:45 +00:00
Andreas Neustifter
059a983531 Cheap, mostly strict, stable sorting.
This is necessary for tests so the results are comparable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90320 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 15:57:15 +00:00
Owen Anderson
9ff5a23186 Cleanup/remove some parts of the lifetime region handling code in memdep and GVN,
per Chris' comments.  Adjust testcases to match.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90304 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 07:35:19 +00:00
Chris Lattner
720e790480 factor some code better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90299 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 06:44:58 +00:00
Chris Lattner
65a9ab4f8f formatting cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90298 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 06:35:55 +00:00
Chris Lattner
bf796323b2 tidy up, remove dependence on order of evaluation of function args from EmitMemCpy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90297 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 06:05:42 +00:00
Chris Lattner
46875c0bfb fix PR5640 by tracking whether a block is the header of a loop more
precisely, which prevents us from infinitely peeling the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90211 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 06:04:43 +00:00
Benjamin Kramer
e6f329476c Revert r90089 for now, it's breaking selfhost.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90097 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 21:17:48 +00:00
Benjamin Kramer
4aac07e898 Fix two FIXMEs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 20:29:30 +00:00
Chris Lattner
cd188e9665 add testcases for the foo_with_overflow op xforms added recently and
fix bugs exposed by the tests.  Testcases from Alastair Lynn!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90056 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 02:57:29 +00:00
Chris Lattner
3f40e23392 Implement PR5634.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90046 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 00:51:17 +00:00
Chris Lattner
0c264b16b0 reenable load address insertion in load pre. This allows us to
handle cases like this:
void test(int N, double* G) {
  long j;
  for (j = 1; j < N - 1; j++)
      G[j+1] = G[j] + G[j+1];
}

where G[1] isn't live into the loop.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90041 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28 16:08:18 +00:00
Chris Lattner
dd696052f0 Enhance InsertPHITranslatedPointer to be able to return a list of newly
inserted instructions.  No functionality change until someone starts using it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90039 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28 15:39:14 +00:00
Chris Lattner
971fd57f7d disable value insertion for now, I need to figure out how
to inform GVN about the newly inserted values.  This fixes 
PR5631.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90022 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 22:50:07 +00:00
Chris Lattner
6f7b210b25 Rework InsertPHITranslatedPointer to handle the recursive case, this
fixes PR5630 and sets the stage for the next phase of goodness (testcase
pending).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90019 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 22:05:15 +00:00
Chris Lattner
8aee8efc0c factor some logic out of instcombine into a new SimplifyAddInst method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90011 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 17:42:22 +00:00
Chris Lattner
8976e5950f fix PR5436 by making the 'simple' case of SRoA not promote out of range
array indexes.  The "complex" case of SRoA still handles them, and correctly.

This fixes a weirdness where we'd correctly avoid transforming A[0][42] if
the 42 was too large, but we'd only do it if it was one gep, not two separate
ones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90007 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 16:37:41 +00:00
Chris Lattner
616613d7a4 teach GVN's load PRE to insert computations of the address in predecessors
where it is not available.  It's unclear how to get this inserted 
computation into GVN's scalar availability sets, Owen, help? :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89997 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 08:25:10 +00:00
Chris Lattner
62deff066c Fix phi translation in load PRE to agree with the phi
translation done by memdep, and reenable gep translation 
again.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 06:31:14 +00:00
Chris Lattner
c514c1f521 factor some instcombine simplifications for getelementptr out to a new
SimplifyGEPInst method in InstructionSimplify.h.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 00:29:05 +00:00
Chris Lattner
998e25a143 fix crash on Transforms/InstCombine/intrinsics.ll introduced by r89970
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89972 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 22:08:06 +00:00
Chris Lattner
21f83a2f95 Fix PR5471 by removing an instcombine xform. Some pieces of the code
generates store to undef and some generates store to null as the idiom
for undefined behavior.  Since simplifycfg zaps both, don't remove the
undefined behavior in instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 22:04:42 +00:00
Chris Lattner
2bbac75e5a implement a bunch of xforms for overflow intrinsics, based on a patch
by Alastair Lynn.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 21:42:47 +00:00
Edward O'Callaghan
25798439da Reverting patch in revision 89758, initial attempt at fixing PR5373 has proven to be bogus.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89844 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25 05:38:41 +00:00
Edward O'Callaghan
de8d3b73c8 Fix for PR5373, Credit to Jakub Staszak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89758 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 11:51:52 +00:00
Dan Gohman
01b97dd01e Make ConstantFoldConstantExpression recursively visit the entire
ConstantExpr, not just the top-level operator. This allows it to
fold many more constants.

Also, make GlobalOpt call ConstantFoldConstantExpression on
GlobalVariable initializers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89659 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 16:22:21 +00:00
Dan Gohman
8f3817f505 Fix a use of an invalidated iterator in the case where there are multiple
adjacent uses of a dead basic block from the same user. This fixes PR5596.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89658 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 16:13:39 +00:00
Nick Lewycky
ce2c51b670 Pull LLVMContext out of PromoteMemToReg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89645 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 03:50:44 +00:00
Nick Lewycky
2e0316fcf0 Remove LLVMContext and its include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 03:34:29 +00:00
Nick Lewycky
ae3d802953 Remove unused LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 03:29:18 +00:00
Nick Lewycky
55bd8bd6eb Reapply r88830 with a bugfix: this transform only applies to icmp eq/ne. This
fixes part of PR5438.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89639 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 03:17:33 +00:00
Eric Christopher
80bf1d5278 Add more optimizations for object size checking, enable handling of
object size intrinsic and verify return type is correct. Collect various
code in one place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89523 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21 01:01:30 +00:00
Dan Gohman
a58a04921d Make Loop::getLoopLatch() work on loops which don't have preheaders, as
it may be used in contexts where preheader insertion may have failed due
to an indirectbr.

Make LoopSimplify's LoopSimplify::SeparateNestedLoop properly fail in
the case that it would require splitting an indirectbr edge.

These fix PR5502.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89484 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 20:51:18 +00:00
Dan Gohman
6a2392131e Fix IPSCCP's code for deleting dead blocks to tolerate outstanding
blockaddress users. This fixes PR5569.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89483 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 20:19:14 +00:00
Daniel Dunbar
f7751c134a Revert "Add some rough optimizations for checking routines.", it buildeth not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89482 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 20:17:30 +00:00
Eric Christopher
3bcaa8ac95 Add some rough optimizations for checking routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89479 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 19:57:37 +00:00
Duncan Sands
76700ba64c Fix PR5563, an expensive checks failure when running on
tests/Transforms/InstCombine/shufflemask-undef.ll.  If
anyone cares, the use of 2*e here (and the equivalent
all over the place in instcombine) seems wrong, though
harmless: it should really be twice the length of the
input vector.  I think shufflevector used to require
that the mask have the same length as the input, but I
don't think that's true any more.  I don't care enough
about vectors to do anything about this...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89456 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 13:19:51 +00:00