Commit Graph

1850 Commits

Author SHA1 Message Date
Matthijs Kooijman
227c27dd06 Replace two manual loops with calls to CallSite::hasArguments (no functional changes).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51947 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 16:57:50 +00:00
Chris Lattner
32a9e7a265 Add #includes required by GCC 4.3, thanks for Zhongxing Xu
for reporting this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51926 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 04:46:14 +00:00
Chris Lattner
d82e511aec Remove unneeded code I added.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 18:39:07 +00:00
Wojciech Matyjewicz
98e3a6829a Fixes PR2395. Looking for a constant in a GEP tail (when the first GEP
is longer than the second one) should stop after finding one. Added break 
instruction guarantees it. It also changes difference between offsets to 
absolute value of this difference in the condition.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51875 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 17:26:12 +00:00
Chris Lattner
833f25d79e move CannotBeNegativeZero to ValueTracking. Simplify some signbit comparisons.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51864 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 01:29:46 +00:00
Chris Lattner
173234a68f move ComputeMaskedBits, MaskedValueIsZero, and ComputeNumSignBits
out of instcombine into a new file in libanalysis.  This also teaches
ComputeNumSignBits about the number of sign bits in a constantint.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51863 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 01:18:21 +00:00
Owen Anderson
6bd15ce03f Remember to update the reverse non-local cache when cleaning up dirty entries. This fixes PR2397.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51846 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-01 21:03:52 +00:00
Owen Anderson
d8f34fa3d6 Make ping more aggressive in finding nonlocal caching errors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51845 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-01 20:51:41 +00:00
Dan Gohman
5bd91232c3 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51718 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 00:08:18 +00:00
Dan Gohman
5a56bf631e Fix a copy+paste error in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51717 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 00:02:02 +00:00
Owen Anderson
9491195710 Add newline at end of file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51701 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 21:05:16 +00:00
Owen Anderson
5771d6c16d Force postdom to be linked into opt and bugpoint, even though it is no longer used by any passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51686 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 17:00:13 +00:00
Gabor Greif
3e93e630aa convert another operand loop to iterator formulation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51661 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 00:51:08 +00:00
Dan Gohman
ef61af01df Use Function::getEntryBlock instead of Function::begin, for clarity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51613 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 20:55:29 +00:00
Dan Gohman
b22d6ac348 Print debug output when any edge becomes executable, including
the first visited edge.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51612 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 20:47:30 +00:00
Duncan Sands
43e2a03530 Fix some constructs that gcc-4.4 warns about.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 11:50:51 +00:00
Nick Lewycky
04b35e8532 Don't treat values as signed when looking at loop steppings in HowForToNonZero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-25 23:43:32 +00:00
Nick Lewycky
3dfd7bf511 "ret (constexpr)" can't be folded into a Constant. Add a method to
Analysis/ConstantFolding to fold ConstantExpr's, then make instcombine use it
to try to use targetdata to fold constant expressions on void instructions.

Also extend the icmp(inttoptr, inttoptr) folding to handle the case where
int size != ptr size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51559 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-25 20:56:15 +00:00
Dan Gohman
b64aa119d8 Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51452 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 23:43:22 +00:00
Gabor Greif
785c6af979 transform more loops to iterator form, detabify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51436 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 19:24:54 +00:00
Gabor Greif
de2d74b213 Rewrite operand loops to use iterators. This shrinks .o file (at gcc4.0.1 -O3 x86) substantially (>500 bytes). Reason still unknown.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51423 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 06:43:33 +00:00
Chris Lattner
05a24e5efe Free and vaarg are not really volatile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 03:23:06 +00:00
Gabor Greif
33e456d5f3 suppress gcc3.4.6's <no value returned> warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51372 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 14:07:30 +00:00
Chris Lattner
eb0fdc150a Fix PR2346 by marking vaarg as volatile so that licm doesn't try to
hoist them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51356 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 22:05:28 +00:00
Chris Lattner
28a8dbc35f Add a bool to isEdgeFeasible that tells it whether to treat unknown
value as undef or untracked.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51295 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 03:39:39 +00:00
Gabor Greif
7cbd8a3e92 API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51200 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-16 19:29:10 +00:00
Dan Gohman
d208a803a6 Use static and anonymous namespaces consistently with other passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51156 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-15 19:43:55 +00:00
Owen Anderson
ff5a535378 Fix memdep's handling of invokes when finding the dependency of another call
instruction.  This fixes some Ada miscompiles reported in PR2324.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 21:25:37 +00:00
Dan Gohman
844731a7f1 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 00:00:25 +00:00
Chris Lattner
4651f3de34 prune #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50962 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-12 01:13:53 +00:00
Chris Lattner
ab7d9ccf18 Add a new SparsePropagation analysis utility, which allows you to do
SCCP like sparse lattice analysis with relative ease.  Just pick your
lattice function and implement the transfer function and you're good.
Just make sure you don't break monotonicity ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50961 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-12 01:12:24 +00:00
Torok Edwin
f03893acf0 put LibCallAliasAnalysis into anonymous namespace to avoid
clashes on ::X


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50912 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09 20:35:45 +00:00
Chris Lattner
76e2e4a2bc Remove dead return. Thanks to Bill for the review!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50863 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 18:26:56 +00:00
Chris Lattner
268e7d7a94 Add support for constant folding the 'offsetof' pattern even if the
base is not zero.  This fixes test/C++Frontend/2008-05-07-CrazyOffsetOf.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50840 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 04:54:43 +00:00
Chris Lattner
029840c935 Add a new LibCallAliasAnalysis pass, which is parameterized
by an instance of LibCallInfo to provide mod/ref info of
standard library functions.  This is powerful enough to
say that 'sqrt' is readonly except that it modifies errno,
or that "printf doesn't store to memory unless the %n
constraint is present" etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50827 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 19:53:05 +00:00
Chris Lattner
14852f27e7 Add a new interface for describing the behavior of library calls. This
Currently is sufficient to describe mod/ref behavior but will hopefully
eventually be extended for other purposes.

This isn't used by anything yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50820 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 18:21:13 +00:00
Nick Lewycky
08de613d2d Fix typo and indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 04:03:18 +00:00
Dan Gohman
4a3f6c8882 Make several variable declarations static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 01:53:16 +00:00
Dan Gohman
84b7df43fb Remove uses of llvm/System/IncludeFile.h that are no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 01:32:53 +00:00
Torok Edwin
f6055806d4 Implement destructor for PostDominatorTree to eliminate a memory leak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-03 20:25:26 +00:00
Devang Patel
201ebe3899 Add assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50596 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 22:13:33 +00:00
Dan Gohman
92c7b65c91 Fix the way AliasSet::print prints "may alias".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50051 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 19:48:48 +00:00
Duncan Sands
e47d98200e Fix a "large integer implicitly truncated to unsigned type"
warning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50033 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 07:35:28 +00:00
Dale Johannesen
a0c8fc6f28 (re)fix handling of UGT. Pointed out by Nick Lewycky.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49991 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 16:58:57 +00:00
Chris Lattner
02a260aa11 Switch to using Simplified ConstantFP::get API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49977 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 00:41:09 +00:00
Dale Johannesen
cf363181c1 Fix a scalar evolution bug. Reversing everything
does not work because of 0; 2>0 but -2U is also >0.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49928 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 21:38:31 +00:00
Owen Anderson
241f65321e Make GVN able to remove unnecessary calls to read-only functions again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49842 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 05:36:50 +00:00
Owen Anderson
1f23e16319 Major repairs to the post-dominators implementation. Patch from Florian Brandner!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 04:21:16 +00:00
Dale Johannesen
21d31a8d94 Don't assume a tail call can't reference a byval
argument to the outer function, this isn't correct.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49731 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 17:41:34 +00:00
Dan Gohman
235fc57ef2 Teach AliasSetTracker about VAArgInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 18:34:50 +00:00
Dan Gohman
f7b37b2d0e In the special case, call the comparison function instead of
manually performing the comparison. This allows the special
case to work correctly even in the case where someone is
experimenting with a different comparison function :-).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 18:23:56 +00:00
Chris Lattner
75caee2419 add a new CallGraphNode::removeCallEdgeFor method, tidy some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49617 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 19:41:25 +00:00
Dan Gohman
c04575f494 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49504 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 23:02:38 +00:00
Owen Anderson
f062f10231 Fix for PR2190. Memdep's non-local caching was checking dirtied blocks in the
wrong order.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 22:13:32 +00:00
Daniel Berlin
a2ce2e3dd9 Fix PR 2169.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49339 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 14:20:50 +00:00
Gabor Greif
051a950000 API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 20:25:17 +00:00
Dan Gohman
6faaef57b0 Set blockBegin to point to the beginning of the block,
not the end.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48999 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 22:08:00 +00:00
Erick Tryzelaar
d6d018589c Expose Function::viewCFG and Function::viewCFGOnly to bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48982 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 16:22:09 +00:00
Chris Lattner
f19f58a936 minor code cleanups, allow constant folding sinf/cosf.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48961 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-30 18:02:00 +00:00
Dan Gohman
c9235d2e85 Don't include <map> in Pass.h, which doesn't need it. This requires
adding <map> to many files that actually do need it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48667 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 23:51:57 +00:00
Devang Patel
9f83512ce8 These passes preserve CFG.
This patch fixes Benchmarks/Trimaran/enc-pc1/enc-pc1 failure reported by Grawp-PIC i386 nightly tester


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-20 23:27:18 +00:00
Andrew Lenharth
52d34d94c8 enable -analyze for andersens
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48601 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-20 15:36:44 +00:00
Devang Patel
4f4c28f75f Restore isCFGOnly property of various analysis passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48579 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-20 02:25:21 +00:00
Devang Patel
c758209153 PassInfo keep tracks whether a pass is an analysis pass or not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 21:56:59 +00:00
Devang Patel
c7fe32e840 Do not use virtual function to identify an analysis pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48520 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 00:48:41 +00:00
Daniel Berlin
d3bf1aef3f Fix PR 2160 by making sure arguments to external functions get marked as pointing to anything
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48509 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 22:22:53 +00:00
Scott Michel
acddf9d019 Dial down gcc's warnings: don't use 0UL when 0U suffices (and when the
variables and methods themselves only use unsigned.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48492 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 16:55:06 +00:00
Devang Patel
1cee94f041 Identify Analysis pass.
Do not run analysis pass again if analysis info is still available.
This fixes PR1441.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 00:39:19 +00:00
Daniel Berlin
c864edb597 Add Hybrid Cycle Detection to Andersen's analysis.
Patch by Curtis Dunham.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47959 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 19:31:47 +00:00
Gabor Greif
c0734e3c99 Fix http://llvm.org/bugs/show_bug.cgi?id=2104 by ordering lexicographically what gets printed. Be const-correct in PrintResults and uninline it too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47712 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-28 08:38:45 +00:00
Bill Wendling
f059deb8dd De-tabify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 10:51:52 +00:00
Evan Cheng
b9a905781e Temporarily reverting 46959.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47542 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-25 03:57:32 +00:00
Dan Gohman
6a551e73fd Change a C-style cast to const_cast, to avoid a -Wcast-qual warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47437 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 17:33:24 +00:00
Nick Lewycky
39442afb36 Simplify this code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47434 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 09:14:53 +00:00
Nick Lewycky
3b71165b32 GlobalValues are Constants, remove redundant code. Also fix typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47433 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 08:34:02 +00:00
Anton Korobeynikov
ae9f3a3b7c Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47367 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 11:08:44 +00:00
Nick Lewycky
178f20a685 Use getConstant for ConstantInts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47361 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 06:58:55 +00:00
Nick Lewycky
3e63076980 Add 'umax' similar to 'smax' SCEV. Closes PR2003.
Parse reversed smax and umax as smin and umin and express them with negative
or binary-not SCEVs (which are really just subtract under the hood).

Parse 'xor %x, -1' as (-1 - %x).

Remove dead code (ConstantInt::get always returns a ConstantInt).

Don't use getIntegerSCEV(-1, Ty). The first value is an int, then it gets
passed into a uint64_t. Instead, create the -1 directly from
ConstantInt::getAllOnesValue().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47360 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 06:48:22 +00:00
Duncan Sands
ec5ec88d15 Fix a compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47328 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 09:28:48 +00:00
Owen Anderson
851bfff50f In addition to arguments passed to it, memcpy (and all other calls) can ModRef pointers that alias their arguments as well. This fixes PR2057.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47317 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 06:47:18 +00:00
Chris Lattner
bb494bcb0e don't bother calling getUnderlyingObject for non-pointers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47272 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 17:28:21 +00:00
Owen Anderson
ef562471ce Since we're not checking for the more general AllocationInst first, we need to explicitly check
that Object is an Argument before casting it to one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47268 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 10:11:00 +00:00
Owen Anderson
26d914ada3 This check is not correct for mallocs, so exclude them earlier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 09:11:02 +00:00
Owen Anderson
ae708a3d91 Fix a comment, and a bug where we weren't applying the tail call logic in cases that failed the first test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 03:52:21 +00:00
Owen Anderson
9aa7c35cee Fix bugs that Chris noticed in my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47252 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 02:31:23 +00:00
Chris Lattner
0ab5a4ae55 bitcasts of pointers are always pointers.
If we see a memcpy of a pointer, make sure to check later
uses of the pointer as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47250 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 02:11:28 +00:00
Owen Anderson
9b636cb338 Teach getModRefInfo that memcpy, memmove, and memset don't "capture" memory addresses.
Also, noalias arguments are be considered "like" stack allocated ones for this purpose, because
the only way they can be modref'ed is if they escape somewhere in the current function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47247 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-17 21:29:08 +00:00
Wojciech Matyjewicz
a65ee03bb2 Fix typo. Thanks to Duncan for noticing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47062 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 12:21:32 +00:00
Wojciech Matyjewicz
3a4cbe2a41 Add comments as per review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47061 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 11:51:34 +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
Wojciech Matyjewicz
7b5b76835a Fix PR2002. Suppose n is the initial value for the induction
variable (with step 1) and m is its final value. Then, the correct trip 
count is SMAX(m,n)-n. Previously, we used SMAX(0,m-n), but m-n may 
overflow and can't in general be interpreted as signed.

Patch by Nick Lewycky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47007 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 15:09:36 +00:00
Wojciech Matyjewicz
a089b10421 If the LHS of the comparison is a loop-invariant we also want to move it
to the RHS. This simple change allows to compute loop iteration count 
for loops with condition similar to the one in the testcase (which seems 
to be quite common).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46959 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 18:37:34 +00:00
Wojciech Matyjewicz
e3320a1bcc Fix PR1798 - an error in the evaluation of SCEVAddRecExpr at an
arbitrary iteration.

The patch:
1) changes SCEVSDivExpr into SCEVUDivExpr,
2) replaces PartialFact() function with BinomialCoefficient(); the 
computations (essentially, the division) in BinomialCoefficient() are 
performed with the apprioprate bitwidth necessary to avoid overflow; 
unsigned division is used instead of the signed one.

Computations in BinomialCoefficient() require support from the code 
generator for APInts. Currently, we use a hack rounding up the 
neccessary bitwidth to the nearest power of 2. The hack is easy to turn 
off in future.

One remaining issue: we assume the divisor of the binomial coefficient 
formula can be computed accurately using 16 bits. It means we can handle 
AddRecs of length up to 9. In future, we should use APInts to evaluate 
the divisor.

Thanks to Nicholas for cooperation!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 11:03:14 +00:00
Wojciech Matyjewicz
3913187bf6 We should check that existing cast operation has the appropriate opcode before we reuse it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46908 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 18:30:13 +00:00
Tanya Lattner
63aa160b27 Throttle the non-local dependence analysis for basic blocks with more than 50 predecessors. Added command line option to play with this threshold.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46790 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 00:54:55 +00:00
Owen Anderson
a8701a6c62 Fix an obscure read-after-free bug that Duncan found.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 04:34:03 +00:00
Dan Gohman
fa9b80eb64 Avoid unnecessarily casting away const, fixing a FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 01:05:10 +00:00
Owen Anderson
9a8ff8cd0f Fix an issue where, under very specific circumstances, memdep could end up dereferencing the end
of one of its internal maps.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 01:24:05 +00:00
Chris Lattner
d087480166 getUnderlyingObject can return null, handle this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24 19:07:10 +00:00
Chris Lattner
fd68750038 Teach basicaa that 'byval' arguments define a new memory location that
can't be aliased to other known objects.  This allows us to know that byval 
pointer args don't alias globals, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46315 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24 18:00:32 +00:00