Commit Graph

228 Commits

Author SHA1 Message Date
Owen Anderson
7c856c09cd Remove GCSE and LoadVN from the testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54832 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16 00:00:54 +00:00
Dan Gohman
3837218ea0 Extend ScalarEvolution's executesAtLeastOnce logic to be able to
continue past the first conditional branch when looking for a
relevant test. This helps it avoid using MAX expressions in
loop trip counts in more cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54697 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 20:17:31 +00:00
Eli Friedman
b42a626122 PR2621: Improvements to the SCEV AddRec binomial expansion. This
version uses a new algorithm for evaluating the binomial coefficients 
which is significantly more efficient for AddRecs of more than 2 terms 
(see the comments in the code for details on how the algorithm works).  
It also fixes some bugs: it removes the arbitrary length restriction for 
AddRecs, it fixes the silent generation of incorrect code for AddRecs 
which require a wide calculation width, and it fixes an issue where we 
were incorrectly truncating the iteration count too far when evaluating 
an AddRec expression narrower than the induction variable.

There are still a few related issues I know of: I think there's 
still an issue with the SCEVExpander expansion of AddRec in terms of
the width of the induction variable used.  The hack to avoid generating 
too-wide integers shouldn't be necessary; instead, the callers should be 
considering the cost of the expansion before expanding it (in addition 
to not expanding too-wide integers, we might not want to expand 
expressions that are really expensive, especially when optimizing for 
size; calculating an length-17 32-bit AddRec currently generates about 250 
instructions of straight-line code on X86).  Also, for long 32-bit 
AddRecs on X86, CodeGen really sucks at scheduling the code.  I'm planning on 
filing follow-up PRs for these issues.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54332 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:49:06 +00:00
Eli Friedman
1fbffe0cef Another SCEV issue from PR2607; essentially the same issue, but this
time applying to the implicit comparison in smin expressions. The 
correct way to transform an inequality into the opposite 
inequality, either signed or unsigned, is with a not expression.

I looked through the SCEV code, and I don't think there are any more 
occurrences of this issue.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54194 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 04:36:32 +00:00
Eli Friedman
068acc3caa Fix for PR2607: SCEV miscomputing the loop count for loops with an
SGT exit condition.  Essentially, the correct way to flip an inequality 
in 2's complement is the not operator, not the negation operator.  
That said, the difference only affects cases involving INT_MIN.

Also, enhance the pre-test search logic to be a bit smarter about 
inequalities flipped with a not operator, so it can eliminate the smax 
from the iteration count for simple loops.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54184 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 00:04:08 +00:00
Wojciech Matyjewicz
de0f2382e4 Fix PR2088. Use modulo linear equation solver to compute loop iteration
count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53810 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-20 15:55:14 +00:00
Nick Lewycky
e637727bed XFAIL this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53793 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 15:52:06 +00:00
Wojciech Matyjewicz
5c779a46b0 While testing particular algorithms to compute loop iteration count the brute
force evaluation (ComputeIterationCountExhaustively) should be turned off.

It doesn't apply to trip-count2.ll because this file tests the brute force
evaluation.

The test for PR2364 (2008-05-25-NegativeStepToZero.ll) currently fails
showing that the patch for this bug doesn't work. I'll fix it in a few hours
with a patch for PR2088.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53792 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 13:26:15 +00:00
Nick Lewycky
59cff12f88 Stop creating extraneous smax/umax in SCEV. This removes a regression where we
started complicating many loops ('for' loops, in fact).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 07:41:32 +00:00
Chris Lattner
845f0d2f0f If we are checking to see if the result of a call aliases a
pointer derived from a local allocation, if the local allocation
never escapes, the pointers can't alias.  This implements PR2436


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52301 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 06:19:11 +00:00
Nick Lewycky
6f8abf929a Crash less. The i64 restriction in BinomialCoefficient caused some problems
with code that was expecting different bit widths for different values.

Make getTruncateOrZeroExtend a method on ScalarEvolution, and use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 04:38:55 +00:00
Matthijs Kooijman
da8bdfa92b Remove trailing whitespace after line continuations in test cases to them work.
This fixes two test cases that were not being run properly before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52179 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 15:07:07 +00:00
Matthijs Kooijman
f167bc2922 Suppress the (stderr) output of -aa-eval, this fixes 5 tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52173 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 12:39:15 +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
Owen Anderson
8cacfebb8e Move these tests into the proper directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51685 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 16:30:29 +00:00
Nick Lewycky
aadc6b68c7 Whoops -- forgot PR reference on this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51569 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 20:23:33 +00:00
Nick Lewycky
505242f9b6 Use {} instead of "" in RUN lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 01:27:08 +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
Dan Gohman
3bf19e4c42 Remove lingering references to .llx and .tr in the tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 21:15:35 +00:00
Gabor Greif
f6cadc440c sabre brings to my attention that the 'tr' suffix is also obsolete
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 21:00:03 +00:00
Gabor Greif
722243bd40 Rename the last test with .llx extension to .ll, resolve duplicate test by renaming to isnan2. Now that no test has llx ending there is no need to search for them from dg.exp too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51328 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 19:52:04 +00:00
Owen Anderson
90d2736540 Fix this test. It was testing broken behavior in that it required ADCE to eliminate
a potentially infinite loop, which is undesirable.  Instead, test the LICM behavior
that we're really interested in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51177 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-16 04:25:09 +00:00
Owen Anderson
46bb007014 Fix PR1098 by correcting the postdominators analysis.
Patch by Florian Brandner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50628 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-04 21:07:35 +00:00
Chris Lattner
5ae21fb23a rename *.llx -> *.ll, last batch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49971 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 22:32:52 +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
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
Owen Anderson
fa0e66471f The functionality being tested was removed because it was horribly unsafe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49610 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 09:51:06 +00:00
Duncan Sands
f02a8070eb Testcase for pr2169.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49344 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 17:03:16 +00:00
Duncan Sands
4c88cc9c2a Testcase for PR2160.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48655 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 20:22:11 +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
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
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
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
Tanya Lattner
dcd188d33f Remove llvm-upgrade.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47110 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 06:56:27 +00:00
Wojciech Matyjewicz
52f321f525 Now that ScalarEvolution::print writes to the correct stream, there is
no need to redirect stderr into stdout.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47009 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 15:12:40 +00:00
Wojciech Matyjewicz
2a9054cfd6 Change negative grep into positive one in my yesterday's testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47008 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 15:10:35 +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
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
Nick Lewycky
e81cd881b1 Accept both %y, %x and %x, %y as valid answers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45649 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-06 03:12:44 +00:00
Chris Lattner
f88380ba2c Fix PR1782, patch by Wojtek Matyjewicz!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44733 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 07:35:13 +00:00
Tanya Lattner
727842e9d7 Fix bug in regression tests that ignored stderr output in RUN lines. Updated tests and fixed broken run lines.
XFAILed 3 arm regressions (will file bugs)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44389 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 04:57:00 +00:00
Dan Gohman
88e84d1f20 Change grep '' to grep {}.
Change 2>&1 | to |&.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44344 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 00:10:35 +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
Nick Lewycky
c54c561c9f Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44319 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 22:41:31 +00:00
Duncan Sands
e4dc717585 Ding dong, the DoesntAccessMemoryFns and
OnlyReadsMemoryFns tables are dead!  We
get more, and more accurate, information
from gcc via the readnone and readonly
function attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44288 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 19:30:27 +00:00
Duncan Sands
920653d41e Teach alias analysis about readnone/readonly functions.
Based on a patch by Török Edwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44279 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 21:43:27 +00:00
Nick Lewycky
4ac0e8da4a Create nodes for inline asm so that we don't crash looking for the node later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44267 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 03:07:37 +00:00
Nick Lewycky
cf96db2c1d Be more careful when transforming | to +. Patch from Wojciech Matyjewicz.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44248 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-20 08:24:44 +00:00