Commit Graph

841 Commits

Author SHA1 Message Date
Chandler Carruth
1de43ede89 Fix the remaining TCL-style quotes found in the testsuite. This is
another mechanical change accomplished though the power of terrible Perl
scripts.

I have manually switched some "s to 's to make escaping simpler.

While I started this to fix tests that aren't run in all configurations,
the massive number of tests is due to a really frustrating fragility of
our testing infrastructure: things like 'grep -v', 'not grep', and
'expected failures' can mask broken tests all too easily.

Essentially, I'm deeply disturbed that I can change the testsuite so
radically without causing any change in results for most platforms. =/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159547 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 19:09:46 +00:00
Chandler Carruth
49589f0d0e Convert the uses of '|&' to use '2>&1 |' instead, which works on old
versions of Bash. In addition, I can back out the change to the lit
built-in shell test runner to support this.

This should fix the majority of fallout on Darwin, but I suspect there
will be a few straggling issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159544 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 18:37:59 +00:00
Chandler Carruth
4177e6fff5 Convert all tests using TCL-style quoting to use shell-style quoting.
This was done through the aid of a terrible Perl creation. I will not
paste any of the horrors here. Suffice to say, it require multiple
staged rounds of replacements, state carried between, and a few
nested-construct-parsing hacks that I'm not proud of. It happens, by
luck, to be able to deal with all the TCL-quoting patterns in evidence
in the LLVM test suite.

If anyone is maintaining large out-of-tree test trees, feel free to poke
me and I'll send you the steps I used to convert things, as well as
answer any painful questions etc. IRC works best for this type of thing
I find.

Once converted, switch the LLVM lit config to use ShTests the same as
Clang. In addition to being able to delete large amounts of Python code
from 'lit', this will also simplify the entire test suite and some of
lit's architecture.

Finally, the test suite runs 33% faster on Linux now. ;]
For my 16-hardware-thread (2x 4-core xeon e5520): 36s -> 24s

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159525 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 12:47:22 +00:00
Nick Lewycky
4d3bba5be4 If the step value is a constant zero, the loop isn't going to terminate. Fixes
the assert reported in PR13228!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159393 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-28 23:44:57 +00:00
Andrew Trick
fe3516f9a5 SCEV: Handle a corner case reducing AddRecExpr * AddRecExpr
If integer overflow causes one of the terms to reach zero, that can
force the entire expression to zero.

Fixes PR12929: cast<Ty>() argument of incompatible type

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157673 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-30 03:35:20 +00:00
Andrew Trick
8aa22019ca SCEV: Add MarkPendingLoopPredicates to avoid recursive isImpliedCond.
getUDivExpr attempts to simplify by checking for overflow.
isLoopEntryGuardedByCond then evaluates the loop predicate which
may lead to the same getUDivExpr causing endless recursion.

Fixes PR12868: clang 3.2 segmentation fault.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157092 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-19 00:48:25 +00:00
Bill Wendling
75920ad424 FileCheck-ize tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155434 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-24 10:45:44 +00:00
Bill Wendling
c6490d138f FileCheck-ize these tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155433 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-24 10:36:42 +00:00
Bill Wendling
d5cc8b81ca FileCheck-ize these tests. Harden some of them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155432 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-24 09:15:38 +00:00
Benjamin Kramer
86df062791 Revert "SCEV: When expanding a GEP the final addition to the base pointer has NUW but not NSW."
This isn't right either, reverting for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154910 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-17 06:33:57 +00:00
Benjamin Kramer
c77764591b SCEV: When expanding a GEP the final addition to the base pointer has NUW but not NSW.
Found by inspection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154262 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-07 17:19:26 +00:00
Rafael Espindola
8f3fabe0fe Handle intrinsics in GlobalsModRef. Fixes pr12351.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153604 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 21:31:24 +00:00
Andrew Trick
eb6dd23c95 SCEV fix: Handle loop invariant loads.
Fixes PR11882: NULL dereference in ComputeLoadConstantCompareExitLimit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153480 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 22:33:59 +00:00
Andrew Trick
54e3adea34 Test scalar evolution directly instead of testing the result of
canonical indvars.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153256 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-22 17:09:31 +00:00
Eli Friedman
cd38485b8a Duncan pointed out that if the alignment isn't explicitly specified, it defaults to the ABI alignment. Given that, make this code a bit more aggressive in such cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151584 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-27 23:16:46 +00:00
Eli Friedman
1680a24e53 Teach BasicAA about the LLVM IR rules that allow reading past the end of an object given sufficient alignment. Fixes PR12098.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151553 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-27 20:46:07 +00:00
Rafael Espindola
c9ae8cc24c Change the implementation of dominates(inst, inst) to one based on what the
verifier does. This correctly handles invoke.
Thanks to Duncan, Andrew and Chris for the comments.
Thanks to Joerg for the early testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151469 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-26 02:19:19 +00:00
Eli Bendersky
0f0c411079 Replace all instances of dg.exp file with lit.local.cfg, since all tests are run with LIT now and now Dejagnu. dg.exp is no longer needed.
Patch reviewed by Daniel Dunbar. It will be followed by additional cleanup patches.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150664 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-16 06:28:33 +00:00
Nick Lewycky
b48a18903a Change CaptureTracking to pass a Use* instead of a Value* when a value is
captured. This allows the tracker to look at the specific use, which may be
especially interesting for function calls.

Use this to fix 'nocapture' deduction in FunctionAttrs. The existing one does
not iterate until a fixpoint and does not guarantee that it produces the same
result regardless of iteration order. The new implementation builds up a graph
of how arguments are passed from function to function, and uses a bottom-up walk
on the argument-SCCs to assign nocapture. This gets us nocapture more often, and
does so rather efficiently and independent of iteration order.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147327 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-28 23:24:21 +00:00
Chandler Carruth
51f40a725b Make the unreachable probability much much heavier. The previous
probability wouldn't be considered "hot" in some weird loop structures
or other compounding probability patterns. This makes it much harder to
confuse, but isn't really a principled fix. I'd actually like it if we
could model a zero probability, as it would make this much easier to
reason about. Suggestions for how to do this better are welcome.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147142 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-22 09:26:37 +00:00
Chandler Carruth
ddbc274169 Manually upgrade the test suite to specify the flag to cttz and ctlz.
I followed three heuristics for deciding whether to set 'true' or
'false':

- Everything target independent got 'true' as that is the expected
  common output of the GCC builtins.
- If the target arch only has one way of implementing this operation,
  set the flag in the way that exercises the most of codegen. For most
  architectures this is also the likely path from a GCC builtin, with
  'true' being set. It will (eventually) require lowering away that
  difference, and then lowering to the architecture's operation.
- Otherwise, set the flag differently dependending on which target
  operation should be tested.

Let me know if anyone has any issue with this pattern or would like
specific tests of another form. This should allow the x86 codegen to
just iteratively improve as I teach the backend how to differentiate
between the two forms, and everything else should remain exactly the
same.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 11:59:10 +00:00
Andrew Trick
ecb35ece5c SCEV fix. In general, Add/Mul expressions should not inherit NSW/NUW.
This reverts r139450, fixes r139453, and adds much needed comments and a
unit test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145367 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 02:16:38 +00:00
Andrew Trick
d2b5e2dd44 Filecheckize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145363 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 02:05:23 +00:00
Chris Lattner
d2bf432b2b Upgrade syntax of tests using volatile instructions to use 'load volatile' instead of 'volatile load', which is archaic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145171 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-27 06:54:59 +00:00
Nick Lewycky
89d093d5b6 Don't forget to check FlagNW when determining whether an AddRecExpr will wrap
or not. Patch by Brendon Cahoon!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144173 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-09 07:11:37 +00:00
Benjamin Kramer
588d84c4df 2>&1 doesn't work here, it just creates an empty file called "&1"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143117 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-27 18:27:45 +00:00
Duncan Sands
f8a9eb1fa6 Restore commits 142790 and 142843 - they weren't breaking the build
bots.  Original commit messages:
- Reapply r142781 with fix. Original message:

  Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
  loop header when computing the trip count.

  With this, we now constant evaluate:
    struct ListNode { const struct ListNode *next; int i; };
    static const struct ListNode node1 = {0, 1};
    static const struct ListNode node2 = {&node1, 2};
    static const struct ListNode node3 = {&node2, 3};
    int test() {
      int sum = 0;
      for (const struct ListNode *n = &node3; n != 0; n = n->next)
        sum += n->i;
      return sum;
    }

- Now that we look at all the header PHIs, we need to consider all the header PHIs
  when deciding that the loop has stopped evolving. Fixes miscompile in the gcc
  torture testsuite!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142919 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 12:28:52 +00:00
Chandler Carruth
45baf6bb85 Fix the API usage in loop probability heuristics. It was incorrectly
classifying many edges as exiting which were in fact not. These mainly
formed edges into sub-loops. It was also not correctly classifying all
returning edges out of loops as leaving the loop. With this match most
of the loop heuristics are more rational.

Several serious regressions on loop-intesive benchmarks like perlbench's
loop tests when built with -enable-block-placement are fixed by these
updated heuristics. Unfortunately they in turn uncover some other
regressions. There are still several improvemenst that should be made to
loop heuristics including trip-count, and early back-edge management.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142917 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 09:47:41 +00:00
Duncan Sands
526c80bae4 Speculatively revert commits 142790 and 142843 to see if it fixes
the dragonegg and llvm-gcc self-host buildbots.  Original commit
messages:
- Reapply r142781 with fix. Original message:

  Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
  loop header when computing the trip count.

  With this, we now constant evaluate:
    struct ListNode { const struct ListNode *next; int i; };
    static const struct ListNode node1 = {0, 1};
    static const struct ListNode node2 = {&node1, 2};
    static const struct ListNode node3 = {&node2, 3};
    int test() {
      int sum = 0;
      for (const struct ListNode *n = &node3; n != 0; n = n->next)
        sum += n->i;
      return sum;
    }

- Now that we look at all the header PHIs, we need to consider all the header PHIs
when deciding that the loop has stopped evolving. Fixes miscompile in the gcc
torture testsuite!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142916 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 09:26:43 +00:00
Nick Lewycky
3846163aee Now that we look at all the header PHIs, we need to consider all the header PHIs
when deciding that the loop has stopped evolving. Fixes miscompile in the gcc
torture testsuite!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142843 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 21:02:38 +00:00
Chandler Carruth
de1c9bb450 Remove return heuristics from the static branch probabilities, and
introduce no-return or unreachable heuristics.

The return heuristics from the Ball and Larus paper don't work well in
practice as they pessimize early return paths. The only good hitrate
return heuristics are those for:
 - NULL return
 - Constant return
 - negative integer return

Only the last of these three can possibly require significant code for
the returning block, and even the last is fairly rare and usually also
a constant. As a consequence, even for the cold return paths, there is
little code on that return path, and so little code density to be gained
by sinking it. The places where sinking these blocks is valuable (inner
loops) will already be weighted appropriately as the edge is a loop-exit
branch.

All of this aside, early returns are nearly as common as all three of
these return categories, and should actually be predicted as taken!
Rather than muddy the waters of the static predictions, just remain
silent on returns and let the CFG itself dictate any layout or other
issues.

However, the return heuristic was flagging one very important case:
unreachable. Unfortunately it still gave a 1/4 chance of the
branch-to-unreachable occuring. It also didn't do a rigorous job of
finding those blocks which post-dominate an unreachable block.

This patch builds a more powerful analysis that should flag all branches
to blocks known to then reach unreachable. It also has better worst-case
runtime complexity by not looping through successors for each block. The
previous code would perform an N^2 walk in the event of a single entry
block branching to N successors with a switch where each successor falls
through to the next and they finally fall through to a return.

Test case added for noreturn heuristics. Also doxygen comments improved
along the way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142793 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 12:01:08 +00:00
Nick Lewycky
7c3fc57472 Reapply r142781 with fix. Original message:
Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
  loop header when computing the trip count.

  With this, we now constant evaluate:
    struct ListNode { const struct ListNode *next; int i; };
    static const struct ListNode node1 = {0, 1};
    static const struct ListNode node2 = {&node1, 2};
    static const struct ListNode node3 = {&node2, 3};
    int test() {
      int sum = 0;
      for (const struct ListNode *n = &node3; n != 0; n = n->next)
        sum += n->i;
      return sum;
    }


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142790 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 06:57:05 +00:00
Nick Lewycky
38af3d5a8d Speculatively revert r142781. Bots are showing
Assertion `i_nocapture < OperandTraits<PHINode>::operands(this) && "getOperand() out of range!"' failed.
coming out of indvars.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142786 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 04:00:25 +00:00
Nick Lewycky
795cb48f1a Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
loop header when computing the trip count.

With this, we now constant evaluate:
  struct ListNode { const struct ListNode *next; int i; };
  static const struct ListNode node1 = {0, 1};
  static const struct ListNode node2 = {&node1, 2};
  static const struct ListNode node3 = {&node2, 3};
  int test() {
    int sum = 0;
    for (const struct ListNode *n = &node3; n != 0; n = n->next)
      sum += n->i;
    return sum;
  }


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142781 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-23 23:43:14 +00:00
Chandler Carruth
14edd314af Teach the BranchProbabilityInfo pass to print its results, and use that
to bring it under direct test instead of merely indirectly testing it in
the BlockFrequencyInfo pass.

The next step is to start adding tests for the various heuristics
employed, and to start fixing those heuristics once they're under test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142778 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-23 21:21:50 +00:00
Nick Lewycky
614fef6d5a Make SCEV's brute force analysis stronger in two ways. Firstly, we should be
able to constant fold load instructions where the argument is a constant.
Second, we should be able to watch multiple PHI nodes through the loop; this
patch only supports PHIs in loop headers, more can be done here.

With this patch, we now constant evaluate:
  static const int arr[] = {1, 2, 3, 4, 5};
  int test() {
    int sum = 0;
    for (int i = 0; i < 5; ++i) sum += arr[i];
    return sum;
  }


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142731 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-22 19:58:20 +00:00
Chandler Carruth
941aa7b1e8 Generalize the reading of probability metadata to work for both branches
and switches, with arbitrary numbers of successors. Still optimized for
the common case of 2 successors for a conditional branch.

Add a test case for switch metadata showing up in the BlockFrequencyInfo pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142493 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-19 10:32:19 +00:00
Chandler Carruth
99d01c54a0 Teach the BranchProbabilityInfo analysis pass to read any metadata
encoding of probabilities. In the absense of metadata, it continues to
fall back on static heuristics.

This allows __builtin_expect, after lowering through llvm.expect
a branch instruction's metadata, to actually enter the branch
probability model. This is one component of resolving PR2577.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142492 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-19 10:30:30 +00:00
Chandler Carruth
6aa5c26c81 Add pass printing support to BlockFrequencyInfo pass. The implementation
layer already had support for printing the results of this analysis, but
the wiring was missing.

Now that printing the analysis works, actually bring some of this
analysis, and the BranchProbabilityInfo analysis that it wraps, under
test! I'm planning on fixing some bugs and doing other work here, so
having a nice place to add regression tests and a way to observe the
results is really useful.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142491 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-19 10:12:41 +00:00
Andrew Trick
0c388583fb Missing test case for r141164.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141166 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-05 06:23:32 +00:00
Nick Lewycky
1cbae18cf6 Reapply r140979 with fix! We never did get a testcase, but careful review of the
logic by David Meyer revealed this bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140992 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-03 07:10:45 +00:00
Nick Lewycky
4fcc80a486 Revert r140979 due to reports of bootstrap failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140980 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-03 05:14:59 +00:00
Nick Lewycky
8fde4f5842 Add one more case we compute a max trip count.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140979 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-03 01:03:57 +00:00
Eli Friedman
e6fadced87 PR10628: Fix getModRefInfo so it queries the underlying alias() implementation correctly while checking nocapture calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140666 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 00:34:27 +00:00
Eli Friedman
46cb5afdcd Enhance alias analysis for atomic instructions a bit. Upgrade a couple alias-analysis tests to the new atomic instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140557 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-26 20:15:28 +00:00
Andrew Trick
2e95d76f8c This test only makes sense with -enable-iv-rewrite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139576 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 02:45:26 +00:00
Eli Friedman
81ac8ddc67 Fix the logic in BasicAliasAnalysis::aliasGEP for comparing GEP's with variable differences so that it actually does something sane. Fixes PR10881.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139276 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 02:23:31 +00:00
Owen Anderson
69acc93b3d Teach BasicAA about the aliasing properties of memset_pattern16.
Fixes PR10872 and <rdar://problem/10065079>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139204 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 23:33:25 +00:00
Nick Lewycky
c103a08a11 This transform only handles two-operand AddRec's. Prevent it from trying to
handle anything more complex. Fixes PR10383 again!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139186 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 21:42:18 +00:00
Nick Lewycky
fa151a79ed The logic inside getMulExpr to simplify {a,+,b}*{c,+,d} was wrong, which was
visible given a=b=c=d=1, on iteration #1 (the second iteration). Replace it with
correct math. Fixes PR10383!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139133 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 05:05:14 +00:00
Nick Lewycky
b2840fdcd8 Revert r139126 due to selfhost failures reported by buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139130 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 02:43:13 +00:00
Nick Lewycky
77b7352db0 Teach SCEV to report a max backedge count in one interesting case in
HowFarToZero; the case for a canonical loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139126 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-05 23:25:16 +00:00
Rafael Espindola
aecfdd3068 Move the loads after the calls so that the fix for
PR10292 doesn't show that the loads don't alias
the allocas.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 23:53:58 +00:00
Rafael Espindola
4fe509431b Use CHECK-NEXT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134850 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 22:56:50 +00:00
Chris Lattner
a53616d08b Remove support for parsing the "type i32" syntax for defining a numbered
top level type without a specified number.  This syntax isn't documented
and blocks forward progress.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133371 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-19 00:03:46 +00:00
Chris Lattner
b85e4eba85 rip out a ton of intrinsic modernization logic from AutoUpgrade.cpp, which is
for pre-2.9 bitcode files.  We keep x86 unaligned loads, movnt, crc32, and the
target indep prefetch change.

As usual, updating the testsuite is a PITA.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133337 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-18 06:05:24 +00:00
Chris Lattner
d589099eec make the asmparser reject function and type redefinitions. 'Merging' hasn't been
needed since llvm-gcc 3.4 days.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133248 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-17 07:06:44 +00:00
Chris Lattner
7a1b9bdd2b Remove support for using "foo" as symbols instead of %"foo". This is ancient
syntax and has been long obsolete.  As usual, updating the tests is the nasty
part of this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133242 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-17 06:36:20 +00:00
Chris Lattner
26b0000166 manually upgrade a bunch of tests to modern syntax, and remove some that
are either unreduced or only test old syntax.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133228 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-17 03:14:27 +00:00
John McCall
410eac5536 Test case for r132797.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132962 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-14 03:02:05 +00:00
Dan Gohman
5f1312c36e Reapply r131781, now that the GVN bug with partially-aliasing loads
is disabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132632 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 06:50:18 +00:00
Dan Gohman
baddf6c8b0 Remove this test, which should have been reverted along with r131781.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132628 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 06:21:23 +00:00
Dan Gohman
9a9d218ed0 Revert r131781 again. Apparently there is more going on here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132625 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 05:11:22 +00:00
Dan Gohman
c122c625ce Reapply r131781 (revert r131809), now that some BasicAA shortcomings
it exposed are fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132611 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 00:46:31 +00:00
Dan Gohman
1fc18d71de Fix BasicAA's recursion detection so that it doesn't pessimize
queries in the case of a DAG, where a query reaches a node
visited earlier, but it's not on a cycle. This avoids
MayAlias results in cases where BasicAA is expected to
return MustAlias or PartialAlias in order to protect TBAA.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132609 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 00:31:50 +00:00
Dan Gohman
965fefa1ad When merging MustAlias and PartialAlias, chose PartialAlias instead
of conservatively choosing MayAlias.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132579 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 20:17:36 +00:00
Dan Gohman
9adf151b3d Make DecomposeGEPExpression check SimplifyInstruction only
after checking for a GEP, so that it matches what GetUnderlyingObject
does. This fixes an obscure bug turned up by bugpoint in the testcase
for PR9931.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131971 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 18:24:08 +00:00
Chris Lattner
4d9255057a I missed a checking with my GVN change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131851 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-22 07:20:02 +00:00
Duncan Sands
d22920aae8 Revert commit 131781, to see if it fixes the x86-64 dragonegg buildbot.
Original log message:
When BasicAA can determine that two pointers have the same base but
differ by a dynamic offset, return PartialAlias instead of MayAlias.
See the comment in the code for details. This fixes PR9971.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131809 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-21 20:54:46 +00:00
Dan Gohman
424b777171 When BasicAA can determine that two pointers have the same base but
differ by a dynamic offset, return PartialAlias instead of MayAlias.
See the comment in the code for details. This fixes PR9971.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131781 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-21 01:05:08 +00:00
Dan Gohman
1d7e818a38 Teach BasicAA about arm.neon.vld1 and vst1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130327 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 20:44:28 +00:00
Dan Gohman
bddc1ca18a When analyzing functions known to only access argument pointees,
only check arguments with pointer types. Update the documentation
of IntrReadArgMem reflect this.

While here, add support for TBAA tags on intrinsic calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130317 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 18:39:03 +00:00
Andrew Trick
104f4adeac Test case and comment for PR9633.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130294 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 05:42:17 +00:00
Benjamin Kramer
a42a757176 Make tests more useful.
lit needs a linter ...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130126 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-25 10:12:01 +00:00
Eli Friedman
0e382192c1 PR9634: Don't unconditionally tell the AliasSetTracker that the PreheaderLoad
is equivalent to any other relevant value; it isn't true in general.
If it is equivalent, the LoopPromoter will tell the AST the equivalence.
Also, delete the PreheaderLoad if it is unused.

Chris, since you were the last one to make major changes here, can you check
that this is sane?



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129049 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 01:35:06 +00:00
Chris Lattner
1a8b9dd7fb remove postdom frontiers, because it is dead. Forward dom frontiers are
still used by RegionInfo :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128943 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-05 21:57:17 +00:00
Anders Carlsson
fa4ebd396d Revert r128140 for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128149 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 15:51:12 +00:00
Anders Carlsson
90af342061 A global variable with internal linkage where all uses are in one function and whose address is never taken is a non-escaping local object and can't alias anything else.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128140 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 02:19:48 +00:00
Andrew Trick
c343c1e27e Propagate SCEV no-wrap flags whenever possible.
This needs review.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127638 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 00:37:00 +00:00
Andrew Trick
e62289b98f When SCEV can determine the loop test is X < X, set ExactBECount=0.
When ExactBECount is a constant, use it for MaxBECount.
When MaxBECount cannot be computed, replace it with ExactBECount.
Fixes PR9424.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127342 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 17:29:58 +00:00
Chris Lattner
8ebaf90958 teach SCEV that the scale and addition of an inbounds gep don't NSW.
This fixes a FIXME in scev-aa.ll (allowing a new no-alias result) and
generally makes things more precise.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125449 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-13 03:14:49 +00:00
Chris Lattner
1021236c74 Per discussion with Dan G, inbounds geps *certainly* can have
unsigned overflow (e.g. "gep P, -1"), and while they can have
signed wrap in theoretical situations, modelling an AddRec as
not having signed wrap is going enough for any case we can 
think of today.  In the future if this isn't enough, we can
revisit this.  Modeling them as having NUW isn't causing any
known problems either FWIW.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125410 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 21:43:33 +00:00
Dan Gohman
640b9c8fe2 Add another rdar number.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124125 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-24 17:54:01 +00:00
Nick Lewycky
76167af9b1 Simplify some code with no functionality change. Make the test a lot more
robust against smarter optimizations, using the power of FileCheck.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124081 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 20:06:05 +00:00
Nick Lewycky
630d85a78c Use value ranges to fold ext(trunc) in SCEV when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124062 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 06:20:19 +00:00
Tobias Grosser
e906921480 Implement requiredTransitive
The PassManager did not implement the transitivity of requiredTransitive. This
was unnoticed since 2006.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123942 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 21:03:22 +00:00
Nick Lewycky
5c6fc1cab7 Similarly, analyze truncate through multiply.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123842 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-19 18:56:00 +00:00
Nick Lewycky
30aa8b13c9 Add a missed SCEV fold that is required to continue analyzing the IR produced
by indvars through the scev expander.

trunc(add x, y) --> add(trunc x, y). Currently SCEV largely folds the other way
which is probably wrong, but preserved to minimize churn. Instcombine doesn't
do this fold either, demonstrating a missed optz'n opportunity on code doing
add+trunc+add.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123838 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-19 16:59:46 +00:00
Nick Lewycky
73f565e754 Add a missing SCEV simplification sext(zext x) --> zext x.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123832 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-19 15:56:12 +00:00
Dan Gohman
615da1a9bc Teach BasicAA to return PartialAlias in cases where both pointers
are pointing to the same object, one pointer is accessing the entire
object, and the other is access has a non-zero size. This prevents
TBAA from kicking in and saying NoAlias in such cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123775 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 21:16:06 +00:00
Eric Christopher
48eec43fdb Revert the testcase from the previous reverted commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123227 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 09:20:44 +00:00
Chris Lattner
e70d7c2201 add a testcase I missed in previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123143 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 23:52:31 +00:00
Chris Lattner
6d5a2411aa teach SCEV analysis of PHI nodes that PHI recurences formed
with GEP instructions are always NUW, because PHIs cannot wrap
the end of the address space.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123105 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 02:28:48 +00:00
Chris Lattner
f1859891b7 reduce indentation. Print <nuw> and <nsw> when dumping SCEV AddRec's
that have the bit set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123104 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 02:16:18 +00:00
Chris Lattner
895ace08e0 fix rdar://8813415 - a miscompilation of 164.gzip that loop-idiom
exposed.  It turns out to be a latent bug in basicaa, scary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122772 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 21:03:33 +00:00
Chris Lattner
135bf42187 filecheckize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122771 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 21:01:26 +00:00
Dan Gohman
a4bdf2ea48 -enable-tbaa is on by default now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 02:53:48 +00:00
Dan Gohman
387f28aff4 Make memcpyopt TBAA-aware.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121944 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 02:51:19 +00:00
Duncan Sands
fea3b218d6 Move Sub simplifications and additional Add simplifications out of
instcombine and into InstructionSimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121861 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 14:07:39 +00:00
Dan Gohman
0f7f194416 Reapply r121520, PartialAlias implementation for BasicAA, now that
memdep is updated to handle it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121725 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-13 22:50:24 +00:00
Dan Gohman
839c092548 Revert r121520, which may have introduced miscompilations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121573 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 21:48:28 +00:00
Dan Gohman
3bd5e52676 Implement PartialAlias checking in BasicAA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121520 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 20:47:03 +00:00
Chris Lattner
9fd9f9fd57 remove fixme comment too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120493 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 23:25:01 +00:00
Chris Lattner
7fd16cef85 check in *all* files. This is now handled by my previous DSE commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120492 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 23:23:59 +00:00
NAKAMURA Takumi
86c817e9d4 test: Check the feature 'loadable_module' with load modules in %llvmshlibdir.
%llvmshlibdir should be 'bin' on Cygming.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120282 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 07:58:32 +00:00
Dan Gohman
32d1fe52e2 Delete unneeded ssp attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118836 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 21:08:46 +00:00
Dan Gohman
56653f0df8 TBAA-enable ArgumentPromotion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118804 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 18:09:32 +00:00
Dan Gohman
5aae3dcb53 Make Sink tbaa-aware.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118788 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 16:21:47 +00:00
Dan Gohman
f00833c401 Add a testcase which demonstrates alias analysis pass precedence.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118755 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 01:03:30 +00:00
Dan Gohman
733c54da1e Fully invalidate cached results when a prior query's size or
type is insufficient for, or incompatible with, the current query.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118721 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 21:45:11 +00:00
Dan Gohman
4cf0dcfb44 Teach FunctionAttrs about the VAArg instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118627 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 20:17:38 +00:00
Dan Gohman
e5dd6624ea Add a testcase for a call which BasicAA says only accesses memory through
its arguments and which TBAA says doesn't write to memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118439 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08 20:20:11 +00:00
Dan Gohman
ea8900f5df Make FunctionAttrs TBAA-aware.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118417 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08 17:12:04 +00:00
Dan Gohman
cd5c123a1d Teach memdep to use pointsToConstantMemory to determine that loads
from constant memory don't alias any stores.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117636 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 01:14:04 +00:00
Dan Gohman
b338bcb0b4 Add a basic testcase for TBAA-aware DSE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117632 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 00:54:02 +00:00
Dan Gohman
561ac17d20 Add some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 22:04:02 +00:00
Dan Gohman
fb8096dee5 Don't pass the raw invalid pointer used to represent conflicting
TBAA information to AliasAnalysis.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116751 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 21:28:00 +00:00
Dan Gohman
992ac3e6c6 Add a basic testcase for TBAA-aware LICM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 21:00:09 +00:00
Dan Gohman
bdcbf6152b Run tbaa before basicaa, since that's how it's expected to be used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 18:45:59 +00:00
Dan Gohman
01b58f637c Make TypeBasedAliasAnalysis default to doing nothing, with a command-line
option to enable it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116722 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 18:17:47 +00:00
Dan Gohman
c1be92f3bb Make BasicAliasAnalysis a normal AliasAnalysis implementation which
does normal initialization and normal chaining. Change the default
AliasAnalysis implementation to NoAlias.

Update StandardCompileOpts.h and friends to explicitly request
BasicAliasAnalysis.

Update tests to explicitly request -basicaa.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116720 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 18:04:47 +00:00
Dan Gohman
c015723131 Add a simple testcase for tbaa.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116272 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 23:54:13 +00:00
Benjamin Kramer
3e45b77612 Remove PointerTracking tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115072 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 19:20:35 +00:00
Eli Friedman
39e30124e5 PR7959: Handle negative scales in GEPs correctly in BasicAA for non-64-bit
targets.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114015 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 20:08:03 +00:00
Chris Lattner
042ff0358d remove some noise from tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112889 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 22:35:33 +00:00
Michael J. Spencer
17d3983730 Fix constant-over-index.ll test on windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112483 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 15:08:02 +00:00
Chris Lattner
2215c607c3 refix PR1143 by making basicaa analyze zexts of indices aggresively,
which I broke with a recent patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 23:09:49 +00:00
Chris Lattner
285d06ca93 fix a buggy test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111354 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 04:55:12 +00:00
Chris Lattner
91b2307a89 fix PR7589: In brief:
gep P, (zext x) != gep P, (sext x)

DecomposeGEPExpression was getting this wrong, confusing
basicaa.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111352 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 04:28:19 +00:00
Chris Lattner
903175096e filecheckize and detrivialize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111350 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 04:25:43 +00:00
Dan Gohman
4ee87398e8 When analyzing loop exit conditions combined with and and or, don't
make any assumptions about when the two conditions will agree on when
to permit the loop to exit. This fixes PR7845.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110758 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 00:12:36 +00:00
Tobias Grosser
73362c820b RegionInfo: Do not assert if a BB is not part of the dominance tree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110665 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10 09:54:35 +00:00
Dan Gohman
e26a7b5e21 Implement a proper getModRefInfo for va_arg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110458 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 18:24:38 +00:00
Dan Gohman
130073904f Implement AccessesArguments checking in the two-callsite form
of BasicAA::getModRefInfo. This allows BasicAA to say that two
memset calls to non-aliasing memory locations don't interfere.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110393 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05 23:34:50 +00:00
Dan Gohman
5fa417c790 Fix memdep's code for reasoning about dependences between two calls. A Ref
response from getModRefInfo is not useful here. Instead, check for identical
calls only in the NoModRef case.

Reapply r110270, and strengthen it to compensate for the memdep changes.
When both calls are readonly, there is no dependence between them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05 22:09:15 +00:00
Dan Gohman
34fa82f7e8 Revert r110270 for now. It appears to uncover a memdep bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110293 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05 00:43:10 +00:00
Dan Gohman
907857d746 The trouble with testing for "ModRef" and "NoModRef" is that
one is a suffix of the other, and FileCheck accepts superstrings.
Adjust the output to avoid this problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110280 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-04 23:37:55 +00:00
Dan Gohman
3dcc91ee8c The two-callsite form of AliasAnalysis::getModRefInfo is documented
to return Ref if the left callsite only reads memory read or written
by the right callsite; fix BasicAliasAnalysis to implement this.

Add AliasAnalysisEvaluator support for testing the two-callsite
form of getModRefInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-04 22:56:29 +00:00
Tobias Grosser
f96b006367 Add new RegionInfo pass.
The RegionInfo pass detects single entry single exit regions in a function,
where a region is defined as any subgraph that is connected to the remaining
graph at only two spots.
Furthermore an hierarchical region tree is built.
Use it by calling "opt -regions analyze" or "opt -view-regions".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109089 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22 07:46:31 +00:00
Dan Gohman
9e86f4364b Remove interprocedural-basic-aa and associated code. The AliasAnalysis
interface needs implementations to be consistent, so any code which
wants to support different semantics must use a different interface.
It's not currently worthwhile to add a new interface for this new
concept.

Document that AliasAnalysis doesn't support cross-function queries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107776 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 14:27:09 +00:00
Dan Gohman
21de4c0daf Remove context sensitivity concerns from interprocedural-basic-aa, and
make it more aggressive in cases where both pointers are known to live
in the same function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107420 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 20:08:40 +00:00
Dan Gohman
70eff63008 Revert the part of r107257 which introduced new logic for using
nsw and nuw flags from IR Instructions. On further consideration,
this isn't valid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 17:27:11 +00:00
Dan Gohman
3e7f7cbea9 Add a testcase for scev-aa's new capability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107258 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 07:17:47 +00:00
Dan Gohman
af0824701b Add a few more interesting testcases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107177 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 18:17:11 +00:00
Dan Gohman
6be2bd516a Add an Intraprocedural form of BasicAliasAnalysis, which aims to
properly handles instructions and arguments defined in different
functions, or across recursive function iterations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107109 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 00:50:39 +00:00
Dan Gohman
50f424c3d0 Fix Value::stripPointerCasts and BasicAA to avoid trouble on
code in unreachable blocks, which have have use-def cycles.
This fixes PR7514.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107071 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 21:16:52 +00:00
Dan Gohman
9d4588ffad Allow "exhaustive" trip count evaluation on phi nodes with all
constant operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106537 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 13:15:46 +00:00
Dan Gohman
b92654d9c9 Fix ScalarEvolution's "exhaustive" trip count evaluation code to avoid
assuming that loops are in canonical form, as ScalarEvolution doesn't
depend on LoopSimplify itself. Also, with indirectbr not all loops can
be simplified. This fixes PR7416.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106389 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-19 14:17:24 +00:00
Dan Gohman
3bf63768e5 Revert r106304 (105548 and friends), which are the SCEVComplexityCompare
optimizations. There is still some nondeterminism remaining.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106306 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18 19:54:20 +00:00
Dan Gohman
78db186d2d Reapply 105540, 105542, and 105548, and revert r105732.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18 19:26:04 +00:00
Daniel Dunbar
ced8db2a2b Workaround SCEV non-determinism on this test, for now, to get buildbots back to
green. Dan, please revert this once the real problem is fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105732 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09 17:54:40 +00:00
Dan Gohman
4d52c6d622 Optimize ScalarEvolution's SCEVComplexityCompare predicate: don't go
scrounging through SCEVUnknown contents and SCEVNAryExpr operands;
instead just do a simple deterministic comparison of the precomputed
hash data.

Also, since this is more precise, it eliminates the need for the slow
N^2 duplicate detection code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105540 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07 19:06:13 +00:00
Dan Gohman
585c40129f Add a comment to this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26 21:37:43 +00:00
Dan Gohman
9f93d30a26 ScalarEvolution support for <= and >= loops.
Also, generalize ScalarEvolutions's min and max recognition to handle
some new forms of min and max that this change makes more common.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102234 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-24 03:09:42 +00:00
Chris Lattner
12104464f3 fix some failures my callgraph dump format change broke.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102197 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 18:38:40 +00:00
Dan Gohman
ddb3eafc32 Don't attempt to analyze values which are obviously undef. This fixes some
assertion failures in extreme cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 01:35:11 +00:00
Dan Gohman
27dead44e0 Generalize ScalarEvolution's PHI analysis to handle loops that don't
have preheaders or dedicated exit blocks, as clients may not otherwise
need to run LoopSimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101030 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 07:49:36 +00:00
Dan Gohman
b57b6f1575 Pointers to zero-sized objects don't point to overlapping objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100789 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 18:11:50 +00:00
Chris Lattner
d2075586c8 add newlines at the end of files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100705 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 22:53:17 +00:00
Mon P Wang
20adc9dc46 Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 03:10:48 +00:00
Mon P Wang
e754d3fb85 Revert r100191 since it breaks objc in clang
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100199 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 18:43:02 +00:00
Mon P Wang
e33c848fa4 Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100191 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 18:04:15 +00:00
Bob Wilson
100f090add Revert Mon Ping's change 99928, since it broke all the llvm-gcc buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99948 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 22:27:04 +00:00
Mon P Wang
808bab0169 Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
A update of langref will occur in a subsequent checkin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99928 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 20:55:56 +00:00
Dan Gohman
4ecbca558f Avoid analyzing instructions in blocks not reachable from the entry block.
They are lots of trouble, and they don't matter. This fixes PR6559.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98103 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 23:46:50 +00:00
Chris Lattner
69ece93669 remove andersen's tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97490 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 20:23:15 +00:00
Dan Gohman
00cb5b7245 Teach ScalarEvolution how to compute a tripcount for a loop with
true or false as its exit condition. These are usually eliminated by
SimplifyCFG, but the may be left around during a pass which wishes
to preserve the CFG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96683 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 18:12:07 +00:00
Dan Gohman
8a977e2edd -disable-output is no longer needed with -analyze.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94574 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 19:25:59 +00:00
Dan Gohman
52fddd3e36 Fix the the ceiling-division used in computing the MaxBECount so that it doesn't
have trouble with an intermediate add overflowing. Also, be more conservative
about the case where the induction variable in an SLT loop exit can step past
the RHS of the SLT and overflow in a single step.

Make getSignedRange more aggressive, to recover for some common cases which
the above fixes pessimized.

This addresses rdar://7561161.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94512 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 04:40:18 +00:00
Tobias Grosser
24dcbaf756 Fix PR6047
Nodes that had children outside of the post dominator tree (infinite loops)
where removed from the post dominator tree. This seems to be wrong. Leave them
in the tree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93633 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 13:38:07 +00:00
Dan Gohman
3073329c53 Use WriteAsOperand instead of getName() to print loop header names,
so that unnamed blocks are handled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93059 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 18:17:45 +00:00
Dan Gohman
aceba31b7a Delete useless trailing semicolons.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92740 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 17:55:26 +00:00
Chris Lattner
0fce29b9d1 gvn is optimizing this better now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90696 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 04:16:05 +00:00
Dan Gohman
0488ecdd16 Add a comment about A[i+(j+1)].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90185 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 01:38:10 +00:00
Chris Lattner
3c47f2de90 @test9 is a testcase for r89958. Before 89958, we misanalyzed the
first expression as P+4+4*i which we considered to possibly alias
P+4*j.  Now we correctly analyze the former one as P+1+4*i.

@test10 is a sanity test that verfies that we know that P+4+4*i != P+4*i.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89960 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 19:25:46 +00:00
Chris Lattner
1ce0eaa25f Implement PR1143 (at -m64) by making basicaa look through extensions. We
previously already handled it at -m32 because there were no i32->i64 
extensions for addressing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 18:53:33 +00:00
Chris Lattner
fa3966881f teach GetLinearExpression to be a bit more aggressive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 17:00:01 +00:00
Chris Lattner
856a72cf38 update status of this. basicaa is much improved now,
only missing the one form (in this testcase).  Dan, do you
consider this example to be important?



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 16:42:00 +00:00
Chris Lattner
5d5261c819 Teach basicaa that x|c == x+c when the c bits of x are clear. This
allows us to compile the example in readme.txt into:

LBB1_1:                                                     ## %bb
	movl	4(%rdx,%rax), %ecx
	movl	%ecx, %esi
	imull	(%rdx,%rax), %esi
	imull	%esi, %ecx
	movl	%esi, 8(%rdx,%rax)
	imull	%ecx, %esi
	movl	%ecx, 12(%rdx,%rax)
	movl	%esi, 16(%rdx,%rax)
	imull	%ecx, %esi
	movl	%esi, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

instead of:

LBB1_1: 
	movl	(%rdx,%rax), %ecx
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 8(%rdx,%rax)
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 12(%rdx,%rax)
	imull	8(%rdx,%rax), %ecx
	movl	%ecx, 16(%rdx,%rax)
	imull	12(%rdx,%rax), %ecx
	movl	%ecx, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

GCC (4.2) doesn't seem to be able to eliminate the loads in this 
testcase either, it generates:

L2:
	movl	(%rdx), %eax
	imull	4(%rdx), %eax
	movl	%eax, 8(%rdx)
	imull	4(%rdx), %eax
	movl	%eax, 12(%rdx)
	imull	8(%rdx), %eax
	movl	%eax, 16(%rdx)
	imull	12(%rdx), %eax
	movl	%eax, 20(%rdx)
	addl	$4, %ecx
	addq	$16, %rdx
	cmpl	$1002, %ecx
	jne	L2




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 16:26:43 +00:00
Chris Lattner
f6ac4d9dad teach basicaa that A[i] != A[i+1].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89951 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 16:18:10 +00:00
Chris Lattner
61d2462400 rename test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 16:08:41 +00:00
Chris Lattner
d84eb911a9 Change the other half of aliasGEP (which handles GEP differencing) to use DecomposeGEPExpression. This dramatically simplifies and shrinks the code by eliminating the horrible CheckGEPInstructions method, fixes a miscompilation (@test3) and makes the code more aggressive. In particular, we now handle the @test4 case, which is reduced from the SmallPtrSet constructor. Missing this caused us to emit a variable length memset instead of a fixed size one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 02:17:34 +00:00
Chris Lattner
4b7d0d9727 add a new random feature test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89921 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 02:16:28 +00:00
Chris Lattner
4723303c97 remove a silly condition that doesn't make a lot of sense anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 16:15:59 +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
Victor Hernandez
9d0b704e3e Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
Here is the original commit message:

This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.

Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 00:16:28 +00:00
Victor Hernandez
df98761d08 Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 01:33:24 +00:00
Victor Hernandez
24f934d055 Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 00:03:03 +00:00
Kenneth Uildriks
b908f8ad6a Make opt default to not adding a target data string and update tests that depend on target data to supply it within the test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85900 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 15:29:06 +00:00
Edward O'Callaghan
4ea7d4c3eb Convert Analysis tests to FileCheck in regards to PR5307.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 14:54:46 +00:00
Dan Gohman
6665b0ea68 Teach BasicAA how to analyze Select instructions, and make it more
aggressive on PHI instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85158 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 21:55:43 +00:00
Dan Gohman
5639cb6b9e Update these tests to match what Loop::print now prints.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85021 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-24 23:52:07 +00:00
Chris Lattner
ec63ad6c1f fix test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 05:03:00 +00:00
Chris Lattner
e62b2633e8 tighten up test3, add test3a for the converse
transform, which isn't happening yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84402 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 04:55:26 +00:00
Chris Lattner
6e85d91144 tighten test2, add a test that it doesn't get transformed in the invalid edge case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84401 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 04:50:18 +00:00
Nick Lewycky
15d3c05adf Merge tests into modref.ll. Also add a test for r84174 at Chris' behest!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84400 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 04:41:36 +00:00
Nick Lewycky
c1a38f59b5 Add a couple new testcases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 00:42:07 +00:00
Chris Lattner
a22922d19a replace a useless test with a useful one
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84383 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 23:59:51 +00:00
Nick Lewycky
ca55ee03b0 Make use of the result of the loads even though that means adding -instcombine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84125 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 19:02:13 +00:00
Evan Cheng
681a33e26d Another BasicAA fix. If a value does not alias a GEP's base pointer, then it
cannot alias the GEP. GEP pointer alias rule states this clearly:
A pointer value formed from a getelementptr instruction is associated with the
addresses associated with the first operand of the getelementptr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84079 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 06:41:49 +00:00
Evan Cheng
2c4f28255b Replace test with a simpler hand crafted one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84069 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 01:45:10 +00:00
Evan Cheng
50a5914e12 Teach basic AA about PHI nodes. If all operands of a phi NoAlias another value than it's safe to declare the PHI NoAlias the value. Ditto for MustAlias.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 22:02:20 +00:00
Chris Lattner
2d175064ab don't use dead loads as tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 17:39:29 +00:00
Nick Lewycky
5c9be67cff Teach BasicAA a little something about the atomic intrinsics: they can only
modify through the pointer they're given.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 07:48:38 +00:00
Victor Hernandez
3e0c99a26f Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82784 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 18:11:52 +00:00
Victor Hernandez
96b930ddc7 Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 17:47:49 +00:00
Dan Gohman
1f96e67f78 Teach ScalarEvolution how to reason about no-wrap flags on loops
where the induction variable has a non-unit stride, such as {0,+,2}, and
there are expressions such as {1,+,2} inside the loop formed with
or or add nsw operators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82151 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 18:05:20 +00:00
Dan Gohman
cabfea2a58 Eliminate more redundant llvm-as calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81540 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 18:17:12 +00:00
Dan Gohman
f2f6ce65b7 Change tests from "opt %s" to "opt < %s" so that opt doesn't see the
input filename so that opt doesn't print the input filename in the
output so that grep lines in the tests don't unintentionally match
strings in the input filename.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 18:01:28 +00:00
Dan Gohman
fce288fc91 Eliminate more uses of llvm-as and llvm-dis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 00:09:15 +00:00
Dan Gohman
7c1a96c7a7 Convert a few more opt | llvm-dis to opt -S.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81261 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 22:41:33 +00:00
Dan Gohman
3e054fe9ef Use opt -S instead of piping bitcode output through llvm-dis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81257 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 22:34:10 +00:00
Dan Gohman
b1e1e82c54 Change these tests to feed the assembly files to opt directly, instead
of using llvm-as, now that opt supports this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81226 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 16:50:01 +00:00
Andreas Neustifter
365b18eba6 Updated tests to use ProfileVerifer to test ProfileLoader and ProfileEstimator.
(Keep disabled test disabled until selfhosted build issue is resolved.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81008 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 17:21:59 +00:00
Daniel Dunbar
b5f25967d0 Revert "--- Reverse-merging r80908 into '.':", I already "fixed" this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 23:40:10 +00:00
Bill Wendling
1c5ffdf987 --- Reverse-merging r80908 into '.':
D    test/Analysis/Profiling

--- Reverse-merging r80907 into '.':
U    lib/Analysis/ProfileInfoLoaderPass.cpp

Attempt to remove failure in the self-hosting build bot.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80966 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 23:13:46 +00:00
Daniel Dunbar
57ed2224b3 Disable some parts of the profiling-tool-chain test, which is currently failing
on a self-hosted build (although it seems to work on non-self hosted). I'll work
with Andreas to figure this out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80947 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 21:09:53 +00:00
Daniel Dunbar
3a22ff3eac Reapply profiling tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80908 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 07:38:00 +00:00
Andreas Neustifter
ca172ae477 Removed temporarily because of breaking Darwin builds.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090831/086214.html)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80799 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 16:47:24 +00:00
Andreas Neustifter
793d4a8467 Changed profiling-tool-chain.ll test to use optimal-edge-profiling instead of
edge-profiling, this is more useful since the loading of the
optimal-edge-profiling is more complicated.
The edge-profiling is tested in edge-profiling.ll where only the
instrumentation is tested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80791 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 14:24:08 +00:00
Daniel Dunbar
545898183e Don't force the triple or data layout in this test. We just have to get them
from the host and hope that works.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80751 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 02:43:11 +00:00
Chris Lattner
b2e673c563 rename test so that name reflects what it is testing for.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80519 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 21:36:39 +00:00
Chris Lattner
aaf615951c convert to filecheck format.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80518 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 21:36:06 +00:00
Torok Edwin
1cb2de3188 rm needs -f
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 14:05:07 +00:00
Torok Edwin
0debb15baf Remove the llvmprof.out from the test output, otherwise running
make check in a non-clean directory causes it to fail (for example when running
make check twice), since execution counts will differ.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 13:35:44 +00:00
Andreas Neustifter
1896727eae Remove profiling output file because two consecutive runs of make check give
error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 10:38:26 +00:00
Andreas Neustifter
cf4f7199c9 Removed unnecessary file creation during test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80356 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 10:07:41 +00:00
Andreas Neustifter
82fdcede12 Pulled all tests into one test. Removed some redundant tests. Rename.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 10:00:28 +00:00
Andreas Neustifter
798261ccf5 Readded test from r79615, this tests the complete profiling tool chain. Furhter
tests can test only parts of this system.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80348 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 06:41:00 +00:00
Dan Gohman
2385e0e22c Create a ScalarEvolution-based AliasAnalysis implementation.
This is a simple AliasAnalysis implementation which works by making
ScalarEvolution queries. ScalarEvolution has a more complete understanding
of arithmetic than BasicAA's collection of ad-hoc checks, so it handles
some cases that BasicAA misses, for example p[i] and p[i+1] within the
same iteration of a loop.

This is currently experimental. It may be that the main use for this pass
will be to help find cases where BasicAA can be profitably extended, or
to help in the development of the overall AliasAnalysis infrastructure,
however it's also possible that it could grow up to become a directly
useful pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 14:53:06 +00:00
Andreas Neustifter
4678c2d438 Removed profiling test, lli not available on all platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79633 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 15:27:35 +00:00
Andreas Neustifter
e879bdad49 Added tests for Profiling Infrastructure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79615 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 09:36:28 +00:00
Dan Gohman
7a7be366a7 Loosen up the regex for this test so that it doesn't implicitly
depend on TargetData information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79491 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-19 23:19:36 +00:00
Dan Gohman
683e922d29 Make LLVM Assembly dramatically easier to read by aligning the comments,
using formatted_raw_ostream's PadToColumn.

Before:

bb1:            ; preds = %bb
  %2 = sext i32 %i.01 to i64            ; <i64> [#uses=1]
  %3 = getelementptr double* %p, i64 %2         ; <double*> [#uses=1]
  %4 = load double* %3, align 8         ; <double> [#uses=1]
  %5 = fmul double %4, 1.100000e+00             ; <double> [#uses=1]
  %6 = sext i32 %i.01 to i64            ; <i64> [#uses=1]
  %7 = getelementptr double* %p, i64 %6         ; <double*> [#uses=1]

After:

bb1:                                        ; preds = %bb
  %2 = sext i32 %i.01 to i64                ; <i64> [#uses=1]
  %3 = getelementptr double* %p, i64 %2     ; <double*> [#uses=1]
  %4 = load double* %3, align 8             ; <double> [#uses=1]
  %5 = fmul double %4, 1.100000e+00         ; <double> [#uses=1]
  %6 = sext i32 %i.01 to i64                ; <i64> [#uses=1]
  %7 = getelementptr double* %p, i64 %6     ; <double*> [#uses=1]

Several tests required whitespace adjustments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78816 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 17:23:50 +00:00
Andreas Bolka
e2652f2cd3 Add another Strong-SIV testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08 00:21:49 +00:00
Andreas Bolka
bdab0e9695 Fix Strong-SIV testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-07 15:42:32 +00:00
Andreas Bolka
831f6f6d2a ZIV tester for LDA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 04:26:05 +00:00
Andreas Bolka
7cf85030f4 Fix LDA testcases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78153 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 04:03:29 +00:00
Andreas Bolka
c20a6fd8ce Expand LDA testcases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77926 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 23:28:14 +00:00
Andreas Bolka
7b43f5cdd1 Slightly reformat LDA tests to ease grepping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77398 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 23:40:40 +00:00
Dan Gohman
59858cf792 Change the assembly syntax for nsw, nuw, and exact, putting them
after their associated opcodes rather than before. This makes them
a little easier to read.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77194 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 16:11:46 +00:00
Dan Gohman
19378d622e When attempting to sign-extend an addrec by interpreting
the step value as unsigned, the start value and the addrec
itself still need to be treated as signed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 16:03:30 +00:00
Dan Gohman
eb490a7aa3 Teach ScalarEvolution to make use of no-overflow flags when
analyzing add recurrences.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77034 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 01:22:26 +00:00
Andreas Bolka
0dcde10f5e FileCheck'ize and expand LDA testcases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76880 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 15:56:53 +00:00
Dan Gohman
0f4b285a5b Replace the original ad-hoc code for determining whether (v pred w) implies
(x pred y) with more thorough code that does more complete canonicalization
before resorting to range checks. This helps it find more cases where
the canonicalized expressions match.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 23:03:19 +00:00
Dan Gohman
19211b47cc Add a testcase for PR4569, which is now fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76526 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 00:50:52 +00:00
Torok Edwin
969f28dfb6 Introduce a pointertracking pass.
For now this only computes the allocated size of the memory pointed to by a
pointer, and offset a pointer from allocated pointer.
The actual checkLimits part will come later, after another round of review.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 18:44:28 +00:00
Dan Gohman
08d4ec0b20 Add testcases for PR4538, PR4537, and PR4534.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75533 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13 22:30:31 +00:00
Nick Lewycky
d1ec98923e When comparing constants, consider a less wide constant to be "less complex"
than a wider one, before trying to compare their contents which will crash
if their sizes are different.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74792 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-04 17:24:52 +00:00
Andreas Bolka
e9722fc850 Array accesses are independent if the underlying arrays differ.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74499 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 02:12:10 +00:00
Andreas Bolka
c6a303052b Print pairwise dependence results, add testcases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74402 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-28 00:35:22 +00:00
Dan Gohman
e56f4a49b7 Add a testcase demoing some of ScalarEvolution's new trip count logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74049 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 01:22:30 +00:00
Dan Gohman
91380b7239 Fix a bug in the trip-count computation with And/Or. If either of the
sides is CouldNotCompute, the resulting exact count must be CouldNotCompute.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73920 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 23:28:56 +00:00
Dan Gohman
bd5ce52740 Fix llvm::ComputeNumSignBits to handle pointer types
conservatively correctly, instead of aborting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73908 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 22:02:32 +00:00
Dan Gohman
a334aa7a10 Teach ScalarEvolution how to analyze loops with multiple exit
blocks, and also exit blocks with multiple conditions (combined
with (bitwise) ands and ors). It's often infeasible to compute an
exact trip count in such cases, but a useful upper bound can often
be found.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73866 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 00:31:57 +00:00
Dan Gohman
51f53b7f5a Fix ScalarEvolution's backedge-taken count computations to check for
overflow when computing a integer division to round up.

Thanks to Nick Lewycky for noticing this!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 23:46:38 +00:00
Dan Gohman
820528331f Teach ScalarEvolution how to recognize another xor(and(x, C), C) case.
If C is a single bit and the and gets analyzed as a truncate and
zero-extend, the xor can be represnted as an add.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73664 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 00:00:20 +00:00
Dan Gohman
559254b697 Add -disable-output to a bunch of tests that don't care about the output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73633 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 20:56:26 +00:00
Dan Gohman
3034c10675 Fix ScalarEvolution's Xor handling to not assume that an And
that gets recognized with a SCEVZeroExtendExpr must be an And
with a low-bits mask. With r73540, this is no longer the case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73594 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 01:22:39 +00:00
Dan Gohman
ae3a0be92e Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72897 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 22:49:04 +00:00
Dan Gohman
72776d2190 Teach BasicAliasAnalysis to understand constant gep indices that fall
beyond their associated static array type.

I believe that this fixes a legitimate bug, because BasicAliasAnalysis
already has code to check for this condition that works for non-constant
indices, however it was missing the case of constant indices. With this
change, it checks for both.

This fixes PR4267, and miscompiles of SPEC 188.ammp and 464.h264.href.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72451 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 01:48:27 +00:00
Dan Gohman
10978bd591 Teach ScalarEvolution to recognize x^-1 in the case where non-demanded
bits have been stripped out by instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72010 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 16:29:04 +00:00
Dan Gohman
859b4824ee Make ScalarEvolution::isLoopGuardedByCond work even when the edge
entering a loop is a non-split critical edge.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72004 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 15:36:09 +00:00
Dan Gohman
04623272d2 Add nounwind to a few tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72002 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 15:16:49 +00:00
Eli Friedman
361e54d433 Allow scalar evolution to compute iteration counts for loops with a
pointer-based condition.  This fixes PR3171.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71354 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 12:32:42 +00:00
Dan Gohman
b0285932ab Fix bogus overflow checks by replacing them with actual
overflow checks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71284 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 23:11:16 +00:00
Dan Gohman
728c7f3059 Fold trunc casts into add-recurrence expressions, allowing the
add-recurrence to be exposed. Add a new SCEV folding rule to
help simplify expressions in the presence of these extra truncs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 21:03:19 +00:00
Dan Gohman
9032b78c98 When printing a SCEVUnknown with pointer type, don't print an
artificial "ptrtoint", as it tends to clutter up complicated
expressions. The cast operators now print both source and
destination types, which is usually sufficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70554 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 17:02:22 +00:00
Dan Gohman
a1af757e0a Extend ScalarEvolution's getBackedgeTakenCount to be able to
compute an upper-bound value for the trip count, in addition to
the actual trip count. Use this to allow getZeroExtendExpr and
getSignExtendExpr to fold casts in more cases.

This may eventually morph into a more general value-range
analysis capability; there are certainly plenty of places where
more complete value-range information would allow more folding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70509 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 20:47:05 +00:00
Dan Gohman
ac70ceafbc Generalize the cast-of-addrec folding to handle folding of SCEVs like
(sext i8 {-128,+,1} to i64) to i64 {-128,+,1}, where the iteration
crosses from negative to positive, but is still safe if the trip
count is within range.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70421 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 22:28:28 +00:00
Dan Gohman
3e0e31b261 Fix this test to match the new output from scalar-evolution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70410 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 21:06:20 +00:00
Dan Gohman
36b8e53fe0 Include the source type in SCEV cast expression debug output, and
print sext, zext, and trunc, instead of signextend, zeroextend,
and truncate, respectively, for consistency with the main IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 20:27:52 +00:00
Dan Gohman
87d2fe5143 Fix a grammaro in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70331 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 21:54:23 +00:00
Nick Lewycky
5cd28fad15 Simplify trunc(extend(x)) in SCEVs, just for completeness. Also fix some odd
whitespace in the same file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69870 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 05:15:08 +00:00
Owen Anderson
03dac74d40 Testcase for PR3909.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69868 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 04:33:42 +00:00
Dan Gohman
578ccf81e5 When turning (ashr(shl(x, n), n)) into sext(trunc(x)), the width of the
type to truncate to should be the number of bits of the value that are
preserved, not the number that are clobbered with sign-extension.
This fixes regressions in ldecod.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69704 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 20:18:36 +00:00
Chris Lattner
56cb12c9a7 change this to test for an alias result more directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67046 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-16 18:28:27 +00:00
Nick Lewycky
b24e6c4dd3 Add a replacement for 2009-02-12-GEPNoalias.ll that works without -debug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67011 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-14 19:40:09 +00:00
Chris Lattner
6dc3a8fd40 remove a buggy test, it is not ok to use -debug in RUN line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66918 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 18:19:34 +00:00
Dan Gohman
d4b3a37f96 Update this test for the LoopInfo::print changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65597 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 00:17:49 +00:00
Dan Gohman
46bdfb0e6b Rename ScalarEvolution's getIterationCount to getBackedgeTakenCount,
to more accurately describe what it does. Expand its doxygen comment
to describe what the backedge-taken count is and how it differs
from the actual iteration count of the loop. Adjust names and
comments in associated code accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65382 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-24 18:55:53 +00:00
Nick Lewycky
826f7cebfd BasicAA was making the assumption that a local allocation which hadn't escaped
couldn't ever be the return of call instruction. However, it's quite possible
that said local allocation is itself the return of a function call. That's
what malloc and calloc are for, actually.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64442 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 07:06:27 +00:00
Owen Anderson
fe9388ccb4 Finish making AliasAnalysis aware of the fact that most atomic intrinsics only dereference their arguments, and enhance
BasicAA to make use of this fact when computing ModRef info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63718 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 05:16:46 +00:00
Nick Lewycky
789558db70 Wind SCEV back in time, to Nov 18th. This 'fixes' PR3275, PR3294, PR3295,
PR3296 and PR3302.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 09:18:58 +00:00
Nick Lewycky
ae285bf5a6 Don't try to analyze this "backward" case. This is overly conservative
pending a correct solution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61589 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 18:54:17 +00:00
Nick Lewycky
3037eda1ef Check that the function prototypes are correct before assuming that the
parameters are pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61451 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-27 16:20:53 +00:00
Nick Lewycky
f23d0d392a Resubmit support for the 'nocapture' attribute.
The problematic part of this patch is that we were out of attribute bits,
requiring some fancy bit hacking to make it fit (by shrinking alignment)
without breaking existing users or the file format.

This change will require users to rebuild llvm-gcc to match llvm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 06:39:12 +00:00
Bill Wendling
43445c153c Remove empty test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61095 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 19:07:17 +00:00
Bill Wendling
6fa311c233 Temporarily revert r61019, r61030, and r61040. These were breaking LLVM Release
builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61094 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 19:06:48 +00:00
Nick Lewycky
1447f5ca1f Generalize support for analyzing loops to include SLE/SGE loop exit conditions
and support for non-unit strides with signed exit conditions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 08:30:01 +00:00
Chris Lattner
1314f20283 Teach basicaa to use the nocapture attribute when possible. When the
intrinsics are properly marked nocapture, the fixme should be addressed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61040 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 18:59:22 +00:00
Nick Lewycky
8bdc6920cd Revert my re-instated reverted commit, fixes the bootstrap build on x86-64 linux.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60951 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 17:09:07 +00:00
Nick Lewycky
277a147f87 Sneaky, sneaky: move the -1 to the outside of the SMax. Reinstate the
optimization of SGE/SLE with unit stride, now that it works properly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60881 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 17:40:14 +00:00
Chris Lattner
b957bda0bc Allow basicaa to walk through geps with identical indices in
parallel, allowing it to decide that P/Q must alias if A/B
must alias in things like:
 P = gep A, 0, i, 1
 Q = gep B, 0, i, 1

This allows GVN to delete 62 more instructions out of 403.gcc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60820 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 01:04:47 +00:00
Evan Cheng
28575f2113 xfail this for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60777 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 18:43:00 +00:00
Nick Lewycky
0bed364307 It's easy to handle SLE/SGE when the loop has a unit stride.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:25:04 +00:00
Nick Lewycky
02ff308aa1 Extend the 'noalias' attribute to function return values. This is intended to
indicate functions that allocate, such as operator new, or list::insert. The
actual definition is slightly less strict (for now).

No changes to the bitcode reader/writer, asm printer or verifier were needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59934 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 03:41:24 +00:00
Nick Lewycky
dd643f26c4 Add a utility function that detects whether a loop is guaranteed to be finite.
Use it to safely handle less-than-or-equals-to exit conditions in loops. These
also occur when the loop exit branch is exit on true because SCEV inverses the
icmp predicate.

Use it again to handle non-zero strides, but only with an unsigned comparison
in the exit condition.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59528 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 15:10:54 +00:00
Nick Lewycky
d72a81ee64 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59384 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 04:14:25 +00:00
Nick Lewycky
8f4d5eb9e5 Don't crash analyzing certain quadratics (addrec of {X,+,Y,+,1}).
We're still waiting on code that actually analyzes them properly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 02:43:49 +00:00
Duncan Sands
3ee8fc9649 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56487 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 12:47:39 +00:00
Duncan Sands
acdb2eeb45 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56342 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-19 08:23:44 +00:00
Duncan Sands
9f07a290b9 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56341 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-19 08:17:05 +00:00
Duncan Sands
e65d39a42c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56337 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-19 07:57:09 +00:00
Dan Gohman
70ff4cf1ba Finally re-apply r46959. This is made feasible by the combination
of r56230, r56232, and r56246.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56247 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 18:52:57 +00:00
Dan Gohman
c7e42fd5b2 Fix spacing in the grep line for this test, following the recent
SCEV-whitespace changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56234 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 01:37:08 +00:00
Dan Gohman
fd6edef87b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56232 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-15 22:18:04 +00:00
Dan Gohman
8dae138d06 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)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56196 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-14 17:21:12 +00:00
Duncan Sands
b8ca4ff643 Fix PR2792: treat volatile loads as writing memory somewhere.
Treat stores as reading memory, just to play safe.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56188 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-13 12:45:50 +00:00
Duncan Sands
99c1a7c9e1 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55987 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 12:40:47 +00:00
Duncan Sands
faf600a9ed Testcase for commits 55700 and 55714.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 19:38:41 +00:00
Duncan Sands
d0ac373660 Since onlyReadsMemory returns true if in fact
doesNotAccessMemory, check doesNotAccessMemory
first, since otherwise functions may be
marked readonly rather than readnone.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55697 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 15:31:24 +00:00
Duncan Sands
9a036b945c 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 12:55:42 +00:00
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