diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-10-23 23:43:14 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-10-23 23:43:14 +0000 |
commit | 1700007eccf408aa39652792718ce939af9a45e6 (patch) | |
tree | 44920bc9cbd5c4036d87982612cc7e7ac5573469 /clang/lib/Analysis/ReachableCode.cpp | |
parent | 24cee10fb1c7921c3c6f329f3024b142f693f329 (diff) | |
download | bcm5719-llvm-1700007eccf408aa39652792718ce939af9a45e6.tar.gz bcm5719-llvm-1700007eccf408aa39652792718ce939af9a45e6.zip |
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;
}
llvm-svn: 142781
Diffstat (limited to 'clang/lib/Analysis/ReachableCode.cpp')
0 files changed, 0 insertions, 0 deletions