Speculatively revert commits 142790 and 142843 to see if it fixes
authorDuncan Sands <baldrick@free.fr>
Tue, 25 Oct 2011 09:26:43 +0000 (09:26 +0000)
committerDuncan Sands <baldrick@free.fr>
Tue, 25 Oct 2011 09:26:43 +0000 (09:26 +0000)
commit526c80bae4d9902fea9efd787c2f212bf111e85e
tree27b6a7b3feef5e328ef8a72f13ef6a7648452d32
parent000b9bdd3396ca322413c4e419d41cd3a6235e74
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
lib/Analysis/ScalarEvolution.cpp
test/Analysis/ScalarEvolution/load.ll
test/Analysis/ScalarEvolution/trip-count11.ll [deleted file]