Make SCEV's brute force analysis stronger in two ways. Firstly, we should be
authorNick Lewycky <nicholas@mxc.ca>
Sat, 22 Oct 2011 19:58:20 +0000 (19:58 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Sat, 22 Oct 2011 19:58:20 +0000 (19:58 +0000)
commit614fef6d5a1e24d01ffe7247b1841fd7e08e1e85
treefde79a92e8e5d07bd5b179e32d877d8557ebf9f6
parent5eebf6ff2052c2ee928abaf387b6458a765393c4
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
lib/Analysis/ScalarEvolution.cpp
test/Analysis/ScalarEvolution/load.ll [new file with mode: 0644]