Add an optimization that does CSE in a group of similar GEPs.
authorEli Bendersky <eliben@google.com>
Thu, 1 May 2014 18:38:36 +0000 (18:38 +0000)
committerEli Bendersky <eliben@google.com>
Thu, 1 May 2014 18:38:36 +0000 (18:38 +0000)
commit167a57ca452efbb014ebce7ecfa99501b5039611
tree6a2b1de596c6e17369a85ab06e8bf0407bc07d83
parent75bb54dcc55d1c206b37af9a91b8e479f9f75104
Add an optimization that does CSE in a group of similar GEPs.

This optimization merges the common part of a group of GEPs, so we can compute
each pointer address by adding a simple offset to the common part.

The optimization is currently only enabled for the NVPTX backend, where it has
a large payoff on some benchmarks.

Review: http://reviews.llvm.org/D3462

Patch by Jingyue Wu.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207783 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/InitializePasses.h
include/llvm/LinkAllPasses.h
include/llvm/Transforms/Scalar.h
lib/Target/NVPTX/NVPTXTargetMachine.cpp
lib/Transforms/Scalar/Scalar.cpp
lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp [new file with mode: 0644]
test/Transforms/SeparateConstOffsetFromGEP/NVPTX/lit.local.cfg [new file with mode: 0644]
test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep-and-gvn.ll [new file with mode: 0644]
test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep.ll [new file with mode: 0644]