[NVPTX] run LSR before straight-line optimizations
authorJingyue Wu <jingyue@google.com>
Thu, 23 Jul 2015 04:59:07 +0000 (04:59 +0000)
committerJingyue Wu <jingyue@google.com>
Thu, 23 Jul 2015 04:59:07 +0000 (04:59 +0000)
commiteb653bd9d1acc484934bc10d078f6f1fdc08441d
treea6c728d9a1458283d02160e7447cd24fe3a6c9e4
parenta95022a4f375f052546c9cff1c3f91b88ee5e1b5
[NVPTX] run LSR before straight-line optimizations

Summary:
Straight-line optimizations can simplify the loop body and make LSR's
cost analysis more precise. This significantly improves several Eigen3
CUDA benchmarks.

With this change, EigenContractionKernel runs up to 40% faster
(https://bitbucket.org/eigen/eigen/src/753ceee5f206ff7dde9f6a41a5a420749fc9406f/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h?at=default#cl-502).
EigenConvolutionKernel2D runs up to 10% faster
(https://bitbucket.org/eigen/eigen/src/753ceee5f206ff7dde9f6a41a5a420749fc9406f/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h?at=default#cl-605).

I have some difficulties writing small tests that benefit from this
reordering due to a seemingly issue with LSR (being discussed at
http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-July/088244.html).

See the review thread for the compilation time impact of GVN.

Reviewers: eliben, jholewinski

Subscribers: llvm-commits, jholewinski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242982 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/NVPTX/NVPTXTargetMachine.cpp