Commit Graph

102 Commits

Author SHA1 Message Date
Nick Lewycky 625c6f79b2 Don't brute-force analyze cubic or higher polynomials.
If this patch causes a performance regression for anyone, please let me know,
and it can be fixed in a different way with much more effort.

llvm-svn: 59384
2008-11-16 04:14:25 +00:00
Nick Lewycky 7b14e20a5e Don't crash analyzing certain quadratics (addrec of {X,+,Y,+,1}).
We're still waiting on code that actually analyzes them properly.

llvm-svn: 58592
2008-11-03 02:43:49 +00:00
Duncan Sands 9c40c28926 Rationalize the names of passes that print information:
-callgraph => print-callgraph
    -callscc   => print-callgraph-sccs
    -cfgscc    => print-cfg-sccs
    -externalfnconstants => print-externalfnconstants
    -print               => print-function
    -print-alias-sets (no change)
    -print-callgraph     => dot-callgraph
    -print-cfg           => dot-cfg
    -print-cfg-only      => dot-cfg-only
    -print-dom-info (no change)
    -printm              => print-module
    -printusedtypes      => print-used-types

llvm-svn: 56487
2008-09-23 12:47:39 +00:00
Duncan Sands 310077034a Remove the MarkModRef pass (use AddReadAttrs instead).
Unfortunately this means removing one regression test
of GlobalsModRef because I couldn't work out how to
perform it without MarkModRef.

llvm-svn: 56342
2008-09-19 08:23:44 +00:00
Duncan Sands af25ee7ffc Add a new pass AddReadAttrs which works out which functions
can get the readnone/readonly attributes, and gives them it.
The plan is to remove markmodref (which did the same thing
by querying GlobalsModRef) and delete the analogous
functionality from GlobalsModRef.

llvm-svn: 56341
2008-09-19 08:17:05 +00:00
Duncan Sands 938e8f60d6 Teach -callgraph to always print the callgraph (as the
description says it does), not just when -analyze is
used as well.  This means printing to stderr, so adjust
some tests.

llvm-svn: 56337
2008-09-19 07:57:09 +00:00
Dan Gohman dc5f5cbe59 Finally re-apply r46959. This is made feasible by the combination
of r56230, r56232, and r56246.

llvm-svn: 56247
2008-09-16 18:52:57 +00:00
Dan Gohman 162568842e Fix spacing in the grep line for this test, following the recent
SCEV-whitespace changes.

llvm-svn: 56234
2008-09-16 01:37:08 +00:00
Dan Gohman f9081a2cd5 Teach ScalarEvolution to consider loop preheaders in the search for
an if statement that guards a loop, to allow indvars to avoid smax
operations in more situations.

llvm-svn: 56232
2008-09-15 22:18:04 +00:00
Dan Gohman 81313fd8d1 Fix WriteAsOperand to not emit a leading space character. Adjust
its callers to emit a space character before calling it when a
space is needed.

This fixes several spurious whitespace issues in
ScalarEvolution's debug dumps. See the test changes for
examples.

This also fixes odd space-after-tab indentation in the output
for switch statements, and changes calls from being printed like
this:
  call void @foo( i32 %x )
to this:
  call void @foo(i32 %x)

llvm-svn: 56196
2008-09-14 17:21:12 +00:00
Duncan Sands 9ddb3145ae Fix PR2792: treat volatile loads as writing memory somewhere.
Treat stores as reading memory, just to play safe.

llvm-svn: 56188
2008-09-13 12:45:50 +00:00
Duncan Sands c189e79440 Correct callgraph construction. It has two problems:
(1) code left over from the days of ConstantPointerRef:
if a use of a function is a GlobalValue then that is
not considered a reason to add an edge from the external
node, even though the use may be as an initializer for
an externally visible global!  There might be some point
to this behaviour when the use is by an alias (though the
code predated aliases by some centuries), but I think
PR2782 is a better way of handling that.  (2) If function
F calls function G, and also G is a parameter to the
call, then an F->G edge is not added to the callgraph.
While this doesn't seem to matter much, adding such an
edge makes the callgraph more regular.
In addition, the new code should be faster as well as
simpler.

llvm-svn: 55987
2008-09-09 12:40:47 +00:00
Duncan Sands b86a788862 Testcase for commits 55700 and 55714.
llvm-svn: 55715
2008-09-03 19:38:41 +00:00
Duncan Sands 0eca0571f8 Since onlyReadsMemory returns true if in fact
doesNotAccessMemory, check doesNotAccessMemory
first, since otherwise functions may be
marked readonly rather than readnone.

llvm-svn: 55697
2008-09-03 15:31:24 +00:00
Duncan Sands 42c644ef03 Cleanup GlobalsModRef a bit. When analysing the
callgraph, when one member of a SCC calls another
then the analysis would drop to mod-ref because
there is (usually) no function info for the callee
yet; fix this.  Teach the analysis about function
attributes, in particular the readonly attribute
(which requires being careful about globals).

llvm-svn: 55696
2008-09-03 12:55:42 +00:00
Owen Anderson 2a6adfa4f0 Remove GCSE and LoadVN from the testsuite.
llvm-svn: 54832
2008-08-16 00:00:54 +00:00
Dan Gohman 2a62fd96a6 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.

llvm-svn: 54697
2008-08-12 20:17:31 +00:00
Eli Friedman 61f67624c3 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.

llvm-svn: 54332
2008-08-04 23:49:06 +00:00
Eli Friedman 4736916aa6 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.

llvm-svn: 54194
2008-07-30 04:36:32 +00:00
Eli Friedman 5ae90441c4 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.

llvm-svn: 54184
2008-07-30 00:04:08 +00:00
Wojciech Matyjewicz f0d21cdd19 Fix PR2088. Use modulo linear equation solver to compute loop iteration
count.

llvm-svn: 53810
2008-07-20 15:55:14 +00:00
Nick Lewycky 82510bf0e3 XFAIL this test.
llvm-svn: 53793
2008-07-19 15:52:06 +00:00
Wojciech Matyjewicz a78669c2cf 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.

llvm-svn: 53792
2008-07-19 13:26:15 +00:00
Nick Lewycky b5688ccf57 Stop creating extraneous smax/umax in SCEV. This removes a regression where we
started complicating many loops ('for' loops, in fact).

llvm-svn: 53508
2008-07-12 07:41:32 +00:00
Chris Lattner b35d9b5e07 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

llvm-svn: 52301
2008-06-16 06:19:11 +00:00
Nick Lewycky ed169d531d 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.

llvm-svn: 52248
2008-06-13 04:38:55 +00:00
Matthijs Kooijman 6436685110 Remove trailing whitespace after line continuations in test cases to them work.
This fixes two test cases that were not being run properly before.

llvm-svn: 52179
2008-06-10 15:07:07 +00:00
Matthijs Kooijman d66e18aaf6 Suppress the (stderr) output of -aa-eval, this fixes 5 tests.
llvm-svn: 52173
2008-06-10 12:39:15 +00:00
Wojciech Matyjewicz 416867a81b 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.

llvm-svn: 51875
2008-06-02 17:26:12 +00:00
Owen Anderson 50d602cda2 Move these tests into the proper directory.
llvm-svn: 51685
2008-05-29 16:30:29 +00:00
Nick Lewycky a61cc6ece0 Whoops -- forgot PR reference on this test.
llvm-svn: 51569
2008-05-26 20:23:33 +00:00
Nick Lewycky be993358a7 Use {} instead of "" in RUN lines.
llvm-svn: 51561
2008-05-26 01:27:08 +00:00
Nick Lewycky 3195b393d6 Don't treat values as signed when looking at loop steppings in HowForToNonZero.
llvm-svn: 51560
2008-05-25 23:43:32 +00:00
Dan Gohman 5e7863de1b Remove lingering references to .llx and .tr in the tests.
llvm-svn: 51500
2008-05-23 21:15:35 +00:00
Gabor Greif 1e427c3264 sabre brings to my attention that the 'tr' suffix is also obsolete
llvm-svn: 51349
2008-05-20 21:00:03 +00:00
Gabor Greif f45ff35bfe 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.
llvm-svn: 51328
2008-05-20 19:52:04 +00:00
Owen Anderson a74d72d01f 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.

llvm-svn: 51177
2008-05-16 04:25:09 +00:00
Owen Anderson 9d990dd218 Fix PR1098 by correcting the postdominators analysis.
Patch by Florian Brandner.

llvm-svn: 50628
2008-05-04 21:07:35 +00:00
Chris Lattner b839c05a05 rename *.llx -> *.ll, last batch.
llvm-svn: 49971
2008-04-19 22:32:52 +00:00
Owen Anderson f9ae76d89c Make GVN able to remove unnecessary calls to read-only functions again.
llvm-svn: 49842
2008-04-17 05:36:50 +00:00
Dale Johannesen 8fc8a272e0 Don't assume a tail call can't reference a byval
argument to the outer function, this isn't correct.

llvm-svn: 49731
2008-04-15 17:41:34 +00:00
Owen Anderson b1e8bf2cad The functionality being tested was removed because it was horribly unsafe.
llvm-svn: 49610
2008-04-13 09:51:06 +00:00
Duncan Sands d6481955db Testcase for pr2169.
llvm-svn: 49344
2008-04-07 17:03:16 +00:00
Duncan Sands e37b9c0d34 Testcase for PR2160.
llvm-svn: 48655
2008-03-21 20:22:11 +00:00
Daniel Berlin 5fef9aea12 Fix PR 2160 by making sure arguments to external functions get marked as pointing to anything
llvm-svn: 48509
2008-03-18 22:22:53 +00:00
Gabor Greif f77e6977a0 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
llvm-svn: 47712
2008-02-28 08:38:45 +00:00
Evan Cheng 01d6257e81 Temporarily reverting 46959.
llvm-svn: 47542
2008-02-25 03:57:32 +00:00
Nick Lewycky 1c44ebcf86 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().

llvm-svn: 47360
2008-02-20 06:48:22 +00:00
Tanya Lattner f865dcd009 Remove llvm-upgrade.
llvm-svn: 47110
2008-02-14 06:56:27 +00:00
Wojciech Matyjewicz ddb265b905 Now that ScalarEvolution::print writes to the correct stream, there is
no need to redirect stderr into stdout.

llvm-svn: 47009
2008-02-12 15:12:40 +00:00