[AMDGPU] Convert shl (add) into add (shl)
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Tue, 23 May 2017 15:59:58 +0000 (15:59 +0000)
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Tue, 23 May 2017 15:59:58 +0000 (15:59 +0000)
commita96ec3f36016eee02c346e9b8100f31f28a6f079
tree0480a9f477e61611ef9b69acfeeb9769c9d38253
parentbf35e6ab2aae9b3d529d0659248ebb1af1a330d6
[AMDGPU] Convert shl (add) into add (shl)

shl (or|add x, c2), c1 => or|add (shl x, c1), (c2 << c1)
This allows to fold a constant into an address in some cases as
well as to eliminate second shift if the expression is used as
an address and second shift is a result of a GEP.

Differential Revision: https://reviews.llvm.org/D33432

llvm-svn: 303641
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
llvm/test/CodeGen/AMDGPU/shl-add-to-add-shl.ll [new file with mode: 0644]