Add the extracted constant offset using GEP
authorJingyue Wu <jingyue@google.com>
Fri, 23 May 2014 18:39:40 +0000 (18:39 +0000)
committerJingyue Wu <jingyue@google.com>
Fri, 23 May 2014 18:39:40 +0000 (18:39 +0000)
commitbbb6e4a8854a951d6c947fc059feb643e2199639
treef1d8b1fb5df799c543cffeb9b020aa9905992fb7
parent8e30e4b9b7d6e82aa1f1def07cfba78fef6c1084
Add the extracted constant offset using GEP

Fixed a TODO in r207783.

Add the extracted constant offset using GEP instead of ugly
ptrtoint+add+inttoptr. Using GEP simplifies future optimizations and makes IR
easier to understand.

Updated all affected tests, and added a new test in split-gep.ll to cover a
corner case where emitting uglygep is necessary.

llvm-svn: 209537
llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
llvm/test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep-and-gvn.ll
llvm/test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep.ll