Commit Graph

594 Commits

Author SHA1 Message Date
Benjamin Kramer
4e81d40545 Fix broken check lines.
I really need to find a way to automate this, but I can't come up with a regex
that has no false positives while handling tricky cases like custom check
prefixes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162097 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17 12:28:26 +00:00
Nadav Rotem
8dff60e96a MemoryDependenceAnalysis attempts to find the first memory dependency for function calls.
Currently, if GetLocation reports that it did not find a valid pointer (this is the case for volatile load/stores),
we ignore the result. This patch adds code to handle the cases where we did not obtain a valid pointer.

rdar://11872864  PR12899



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161802 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13 23:03:43 +00:00
Nick Lewycky
6ce2471806 Stay rational; don't assert trying to take the square root of a negative value.
If it's negative, the loop is already proven to be infinite. Fixes PR13489!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161107 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01 09:14:36 +00:00
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