Commit Graph

69 Commits

Author SHA1 Message Date
Chris Lattner
9f8a6a7498 give form-memset a significantly more sane heuristic, enable it by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-29 04:36:18 +00:00
Chris Lattner
7f0965e7da make memset inference significantly more powerful: it can now handle
memsets that initialize "structs of arrays" and other store sequences
that are not sequential.  This is still only enabled if you pass 
-form-memset-from-stores.  The flag is not heavily tested and I haven't
analyzed the perf regressions when -form-memset-from-stores is passed
either, but this causes no make check regressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-28 06:45:13 +00:00
Evan Cheng
88ffdddcc4 Temporarily disabling memset forming optimization. Add an option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48720 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 05:28:38 +00:00
Chris Lattner
b017c9e89c implement an initial hack at a straight-line store -> memset optimization.
This fires dozens of times across spec and multisource, but I don't know
if it actually speeds stuff up.  Hopefully the testers will show something
nice :)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48680 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 05:37:16 +00:00
Chris Lattner
d27290d733 implement the logic for memset insertion and store deletion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48679 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 04:13:49 +00:00
Chris Lattner
641dae19eb This is a partially implemented and currently disabled start of a store
merging optimization.  Nothing to see here, hopefully more later :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 00:31:52 +00:00
Chris Lattner
8e1e95cb04 the size of a smallvector shouldn't be part of the interface to these methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48662 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 22:01:16 +00:00
Chris Lattner
2e60701b9d make gvn marginally faster by reallocating the lastSeenLoad map for
each basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48660 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 21:33:23 +00:00
Chris Lattner
88365bb404 Minor cleanups and shrinkification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48658 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 21:14:38 +00:00
Owen Anderson
8a97fddbc2 Fix a bug in GVN that Duncan noticed, where we potentially need to insert a
pointer bitcast when performing return slot optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48343 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 22:07:10 +00:00
Owen Anderson
6bb0bd52ec Improve the return slot optimization to be both more aggressive (not limited to sret parameters), and
safer (when the passed pointer might be invalid).  Thanks to Duncan and Chris for the idea behind this, 
and extra thanks to Duncan for helping me work out the trap-safety.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48280 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 07:37:44 +00:00
Owen Anderson
77db50f68f Fix an issue where GVN had the sizes of the two memcpy's reverse, resulting
in an invalid transformation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 23:06:17 +00:00
Owen Anderson
c0808a7e1d Fix an issue where GVN was performing the return slot optimization when it was
not safe.  This is fixed by more aggressively checking that the return slot is
not used elsewhere in the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-25 04:08:09 +00:00
Owen Anderson
0f7ea1ab10 Fix an issue where GVN would try to use an instruction before its definition when performing return slot optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-25 00:40:41 +00:00
Anton Korobeynikov
07e6e56f57 Make Transforms to be 4.3 warnings-clean
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47371 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 11:26:25 +00:00
Owen Anderson
61d30a821f When performing return slot optimization, remember to inform memdep when we're removing the memcpy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 08:23:02 +00:00
Owen Anderson
967552e7ec Refactor this method a bit, and correct a test that was completely wrong but happened to work out anyways. :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47321 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 07:07:51 +00:00
Chris Lattner
e42ce73c37 isa+cast -> dyncast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47320 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 06:53:20 +00:00
Chris Lattner
0a76a621a4 simplify this code again, try 2 :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 06:52:38 +00:00
Owen Anderson
9cffa9a6ed Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 06:51:23 +00:00
Owen Anderson
61c24e96b1 Major improvements to yesterday's return slot optimization. Remove some unneccessary constraints,
and add some others that should have been in from the first place.  Document the whole thing better.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47315 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 06:35:43 +00:00
Owen Anderson
fa113f8155 Factor the profitability check for return slot optimization out into a static function.
At some point in the future, this check will become smarter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47310 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 03:27:34 +00:00
Owen Anderson
c0755a6f98 An sret parameter is required to be the first parameter, so there's no need to loop
over all the parameters of the callee looking for it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47309 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 03:15:29 +00:00
Owen Anderson
7acc0af95a Cleanup some of my patches from yesterday. Refactor the check for which xform
to apply to a memcpy into processInstruction.  Also, fix a bug in the check due to
missing braces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47307 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 03:09:45 +00:00
Owen Anderson
c2580ab9b0 Fix Transforms/GVN/memcpy.ll, which Chris broke in r47275 by reordering the branches. memcpy's are a kind of CallInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 02:53:23 +00:00
Chris Lattner
913b19f6fc minor code simplification, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47275 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 17:47:29 +00:00
Owen Anderson
5aa4f2a085 Add support to GVN for performing sret return slot optimization. This means that, if an sret function tail calls
another sret function, it should pass its own sret parameter to the tail callee, allowing it to fill in the correct
return value.  llvm-gcc does not emit this by default.  Instead, it allocates space in the caller for the sret of
the tail call and then uses memcpy to copy the result into the caller's sret parameter.  This optimization detects
and optimizes that case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 09:24:53 +00:00
Nick Lewycky
95f0ba2703 Fix PR2032. Inform the alias analysis of changes to the underlying program.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47111 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 07:11:24 +00:00
Owen Anderson
30b4bd4d10 Re-apply the patch to improve the optimizations of memcpy's, with several
bugs fixed.  This now passes PPC bootstrap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47026 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 21:15:18 +00:00
Eli Friedman
b6c36e4058 Fix for bug 1996: optimize out loads of undef. This code basically just
checks for a malloc/alloca immediately followed by a load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 12:08:14 +00:00
Bill Wendling
e00fec554b Temporarily reverting:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080128/057882.html

This is causing a miscompilation on PPC G5 and just now seeing it on iMac x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 20:03:07 +00:00
Owen Anderson
6f7a52d300 Allow GVN to hack on memcpy's, making them open to further optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 02:59:58 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Owen Anderson
5fc4abac3d Fix several cache coherence bugs in MemDep/GVN that were found. Also add some (disabled) debugging code
to make such problems easier to diagnose in the future, written by Duncan Sands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44695 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 01:37:09 +00:00
Duncan Sands
dff6710717 Integrate the readonly/readnone logic more deeply
into alias analysis.  This meant updating the API
which now has versions of the getModRefBehavior,
doesNotAccessMemory and onlyReadsMemory methods
which take a callsite parameter.  These should be
used unless the callsite is not known, since in
general they can do a better job than the versions
that take a function.  Also, users should no longer
call the version of getModRefBehavior that takes
both a function and a callsite.  To reduce the
chance of misuse it is now protected.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44487 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-01 07:51:45 +00:00
Owen Anderson
1fb136464d Fix a miscompilation in spiff on PPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44437 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 18:02:22 +00:00
Owen Anderson
a16bbc9aa7 Fix another bug that was causing siod to fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44325 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-26 07:17:19 +00:00
Owen Anderson
00a6d1448d Allow GVN to eliminate read-only function calls when it can detect that they are redundant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44323 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-26 02:26:36 +00:00
Owen Anderson
b388ca9544 Allow GVN to eliminate redundant calls to functions without side effects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43147 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-18 19:39:33 +00:00
Owen Anderson
ce4d88aa64 Add partial caching of non-local memory dependence queries. This provides a modest
speedup for GVN.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42185 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-21 03:53:52 +00:00
Chris Lattner
76c1b97e40 Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfo
Add a new DenseMapInfo::isEqual method to allow clients to redefine
the equality predicate used when probing the hash table.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42042 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 18:34:04 +00:00
Owen Anderson
2486686689 Be more careful when constant-folding PHI nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41998 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16 08:04:16 +00:00
Owen Anderson
1defe2df5d Factor out some code into a helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41131 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 22:51:56 +00:00
Owen Anderson
62bc33c954 Add some more comments to GVN.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41129 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 22:02:55 +00:00
Owen Anderson
31f496755a Eliminate PHI nodes with constant values during normal GVN processing, even when
they're not related to eliminating a load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41081 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 18:33:27 +00:00
Owen Anderson
36057c7834 Be more aggressive in pruning unnecessary PHI nodes when doing PHI construction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41080 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 18:16:29 +00:00
Owen Anderson
3e75a42ee2 Make GVN iterative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41078 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 18:04:11 +00:00
Owen Anderson
8e8278e7fe Fix a case where GVN was failing to return true when it had, in fact, modified
the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41077 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-14 17:59:48 +00:00
Owen Anderson
9528f11481 Make NonLocal and None const in the right way. :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40961 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 04:42:44 +00:00
Owen Anderson
8cad423d94 Change the None and NonLocal markers in memdep to be const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40946 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 21:39:39 +00:00