[NaryReassoc] reassociate GEP for CSE
authorJingyue Wu <jingyue@google.com>
Thu, 21 May 2015 23:17:30 +0000 (23:17 +0000)
committerJingyue Wu <jingyue@google.com>
Thu, 21 May 2015 23:17:30 +0000 (23:17 +0000)
commit41cf9ae1b8900610fdf422f62913c6885906ddc2
tree3e555207db881a34a2a3ea7b50437f1dba66f726
parentb86942cca4b8f14d34ab290b28767235165fddca
[NaryReassoc] reassociate GEP for CSE

Summary:
x = &a[i];
y = &a[i + j];

=>

y = x + j;

along with some refactoring work such as extracting method
findClosestMatchingDominator.

Depends on D9786 which provides the ScalarEvolution::getGEPExpr interface.

Test Plan: nary-gep.ll

Reviewers: meheff, broune

Reviewed By: broune

Subscribers: jholewinski, llvm-commits

Differential Revision: http://reviews.llvm.org/D9802

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237971 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/NaryReassociate.cpp
test/Transforms/NaryReassociate/NVPTX/nary-gep.ll [new file with mode: 0644]