Commit Graph

6076 Commits

Author SHA1 Message Date
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
Dan Gohman
f94b5edc45 Extend CaptureTracking to indicate when a value is never stored, even
if it is not ultimately captured. Teach BasicAliasAnalysis that a 
local object address which does not escape and is never stored does
not alias with a value resulting from a load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89398 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 21:57:48 +00:00
Dan Gohman
dab249b3b7 Enable hoisting of loads from constant memory by default. In cases where
they are lowered to instruction sequences more complex than a simple
load, such that CodeGen cannot rematerialize them, a reload from a
spill slot is likely to be cheaper than the complex sequence.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89374 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 19:00:10 +00:00
Jim Grosbach
d0b552cc56 Eliminate duplicate phi nodes in loops. Loop rotation, for example, can introduce these, and it's beneficial to later passes to clean them up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89298 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 02:03:18 +00:00
Jim Grosbach
20f4d34fe3 Make EliminateDuplicatePHINodes() available as a utility function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89297 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 02:02:10 +00:00
Jim Grosbach
5023095799 grammar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89145 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 21:37:04 +00:00
Jim Grosbach
464ecfee71 80-column violations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89123 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 19:05:35 +00:00
Evan Cheng
076e085698 Generalize OptimizeLoopTermCond to optimize more loop terminating icmp to use postinc iv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89116 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 18:10:11 +00:00
Jim Grosbach
56a1f806af Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89110 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 17:53:56 +00:00
Devang Patel
76e3e50b8a Remove debug info attached with an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 00:47:06 +00:00
David Greene
f941d29077 Fix an expensive-checks error.
The Mask and LHSMask may not be of the same size, so don't do the
transformation if they're different.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88972 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-16 21:52:23 +00:00
Duncan Sands
f63c41033a CreateIntCast takes an "isSigned" parameter. Pass "true" for it, rather than
a name.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88908 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-16 12:32:28 +00:00
Chris Lattner
4e447ebc58 make PRE of loads preserve the alignment of the moved load instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88865 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 19:58:31 +00:00
Chris Lattner
1fb5630474 fix a bug handling 'not x' when x is undef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88864 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 19:57:43 +00:00
Nick Lewycky
feb8018764 Revert r88830 and r88831 which appear to have caused a selfhost buildbot some
grief. I suspect this patch merely exposed a bug else.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88841 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 07:47:32 +00:00
Nick Lewycky
df772f257f Teach instcombine to look for booleans in wider integers when it encounters a
zext(icmp). It may be able to optimize that away. This fixes one of the cases
in PR5438.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 05:55:17 +00:00
Nick Lewycky
e79fddedca Remove LLVMContext from reassociate. It was threaded through every function but
ultimately never used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88763 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 07:25:54 +00:00
Dan Gohman
4ec01b268e Add an option for running GVN with redundant load processing disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88742 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 02:27:51 +00:00
Owen Anderson
98538b4bea Re-enable this code, since redundant PHIs are now being better nuked.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87042 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 23:22:41 +00:00
Chris Lattner
4ff4141a9e use isInstructionTriviallyDead, as pointed out by Duncan
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87035 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 21:58:18 +00:00
Chris Lattner
dbab4dc942 implement a nice little efficiency hack in the inliner. Since we're now
running IPSCCP early, and we run functionattrs interlaced with the inliner,
we often (particularly for small or noop functions) completely propagate
all of the information about a call to its call site in IPSSCP (making a call
dead) and functionattrs is smart enough to realize that the function is
readonly (because it is interlaced with inliner).

To improve compile time and make the inliner threshold more accurate, realize
that we don't have to inline dead readonly function calls.  Instead, just 
delete the call.  This happens all the time for C++ codes, here are some
counters from opt/llvm-ld counting the number of times calls were deleted vs
inlined on various apps:

Tramp3d opt:
  5033 inline                - Number of call sites deleted, not inlined
 24596 inline                - Number of functions inlined
llvm-ld:
  667 inline           - Number of functions deleted because all callers found
  699 inline           - Number of functions inlined

483.xalancbmk opt:
  8096 inline                - Number of call sites deleted, not inlined
 62528 inline                - Number of functions inlined
llvm-ld:
   217 inline           - Number of allocas merged together
  2158 inline           - Number of functions inlined

471.omnetpp:
  331 inline                - Number of call sites deleted, not inlined
 8981 inline                - Number of functions inlined
llvm-ld:
  171 inline           - Number of functions deleted because all callers found
  629 inline           - Number of functions inlined


Deleting a call is much faster than inlining it, and is insensitive to the
size of the callee. :)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86975 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 07:56:08 +00:00
Evan Cheng
586f69a118 - Teach LSR to avoid changing cmp iv stride if it will create an immediate that
cannot be folded into target cmp instruction.
- Avoid a phase ordering issue where early cmp optimization would prevent the
  later count-to-zero optimization.
- Add missing checks which could cause LSR to reuse stride that does not have
  users.
- Fix a bug in count-to-zero optimization code which failed to find the pre-inc
  iv's phi node.
- Remove, tighten, loosen some incorrect checks disable valid transformations.
- Quite a bit of code clean up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86969 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 07:35:05 +00:00
Chris Lattner
66c04c48de use getPredicateOnEdge to fold comparisons through PHI nodes,
which implements GCC PR18046.  This also gets us 360 more
jump threads on 176.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 05:24:05 +00:00
Chris Lattner
f496e79f44 various fixes to the lattice transfer functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 04:57:13 +00:00
Chris Lattner
0e0ff29271 switch jump threading to use getPredicateOnEdge in one place
making the new LVI stuff smart enough to subsume some special
cases in the old code.  Disable them when LVI is around, the
testcase still passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86951 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 04:37:50 +00:00
Daniel Dunbar
dfa9261f68 Add the braces gcc suggested.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86933 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:52:56 +00:00
Chris Lattner
87e9f59c7a with the new code we can thread non-instruction values. This
allows us to handle the test10 testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 01:41:34 +00:00
Chris Lattner
1c96b4187b this argument can be an arbitrary value, it doesn't need to be an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 01:37:43 +00:00
Chris Lattner
38392bbeb8 expose edge information and switch j-t to use it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86920 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 01:29:10 +00:00
Chris Lattner
2ad00bf99d pass TD into a SimplifyCmpInst call. Add another case that
uses LVI info when -enable-jump-threading-lvi is passed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86886 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 22:31:38 +00:00
Duncan Sands
a3da922a27 Don't trivially delete unused calls to llvm.invariant.start. This allows
llvm.invariant.start to be used without necessarily being paired with a call
to llvm.invariant.end.  If you run the entire optimization pipeline then such
calls are in fact deleted (adce does it), but that's actually a good thing since
we probably do want them to be zapped late in the game.  There should really be
an integration test that checks that the llvm.invariant.start call lasts long
enough that all passes that do interesting things with it get to do their stuff
before it is deleted.  But since no passes do anything interesting with it yet
this will have to wait for later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86840 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 15:34:13 +00:00
Chris Lattner
f8fb7c26ee remove the now dead condprop pass, PR3906.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 05:56:35 +00:00
Chris Lattner
cc4d3b25f3 stub out some LazyValueInfo interfaces, and have JumpThreading
start using them in a trivial way when -enable-jump-threading-lvi
is passed.  enable-jump-threading-lvi will be my playground for 
awhile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86789 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 02:08:33 +00:00
Chris Lattner
b14b88a40a add a fixme
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86766 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 00:21:58 +00:00
Evan Cheng
f40888dc9b Block terminator may be a switch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86761 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 00:00:21 +00:00
Devang Patel
53bb5c95af Implement support to debug inlined functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86748 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 23:06:00 +00:00
Chris Lattner
055d046f48 implement a TODO by teaching jump threading about "xor x, 1".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86739 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 22:39:16 +00:00
Chris Lattner
40d8c28b27 move some generally useful functions out of jump threading
into libanalysis and transformutils.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 22:26:15 +00:00
Chris Lattner
103f2434b8 fix a crash in SCCP handling extractvalue of an array, pointed out and
tracked down by Stephan Reiter!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86726 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 22:02:09 +00:00
Chris Lattner
6f84a5feee improve comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86723 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 21:45:09 +00:00
Chris Lattner
f3183f6da6 Make jump threading eliminate blocks that just contain phi nodes,
debug intrinsics, and an unconditional branch when possible.  This
reuses the TryToSimplifyUncondBranchFromEmptyBlock function split
out of simplifycfg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 21:40:01 +00:00
Evan Cheng
81ebdcf7dd Generalize lsr code that optimize loop to count down towards zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 21:14:05 +00:00
Duncan Sands
650c64383e Add defensive break.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 19:36:40 +00:00
Duncan Sands
e3f749b166 Fix obvious typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 18:21:37 +00:00
Chris Lattner
6b583919d9 clarify logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86689 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 17:00:47 +00:00
Duncan Sands
710c37c494 Teach DSE to eliminate useless trampolines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86683 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 13:49:50 +00:00
Duncan Sands
e9097f7438 Add brackets to make gcc-4.4 happy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86681 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 09:32:10 +00:00
Victor Hernandez
8e345a1c41 Update computeArraySize() to use ComputeMultiple() to determine the array size associated with a malloc; also extend PerformHeapAllocSRoA() to check if the optimized malloc's arg had its highest bit set, so that it is safe for ComputeMultiple() to look through sext instructions while determining the optimized malloc's array size
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86676 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 08:32:25 +00:00
Chris Lattner
c22d4d1500 unify the code that determines whether it is a good idea to change the type
of a computation.  This fixes some infinite loops when dealing with TD that
has no native types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86670 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 07:23:37 +00:00
Nick Lewycky
7cef178176 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86668 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 07:00:43 +00:00
Nick Lewycky
58571d663c Reapply r86359, "Teach dead store elimination that certain intrinsics write to
memory just like a store" with bug fixed (partial-overwrite.ll is the
regression test).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86667 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 06:46:40 +00:00
Chris Lattner
dce94d92df refactor TryToSimplifyUncondBranchFromEmptyBlock out of SimplifyCFG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86666 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 05:59:26 +00:00