OSDN Git Service

R600/SI: Fix offset folding in some cases with shifted pointers.
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 15 Aug 2014 17:49:05 +0000 (17:49 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 15 Aug 2014 17:49:05 +0000 (17:49 +0000)
commit34ef4cd65b147b45c6a8e59457c4c131365a0cef
tree4a480321c84cd26c6a540c92a16696240604d90e
parent92ee945e2e783e49161a773af0a4f99dc6147423
R600/SI: Fix offset folding in some cases with shifted pointers.

Ordinarily (shl (add x, c1), c2) -> (add (shl x, c2), c1 << c2)
is only done if the add has one use. If the resulting constant
add can be folded into an addressing mode, force this to happen
for the pointer operand.

This ends up happening a lot because of how LDS objects are allocated.
Since the globals are allocated next to each other, acessing the first
element of the second object is directly indexed by a shifted pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215739 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/R600/SIISelLowering.cpp
lib/Target/R600/SIISelLowering.h
lib/Target/R600/SIInstrInfo.cpp
lib/Target/R600/SIInstrInfo.h
test/CodeGen/R600/shl_add_ptr.ll [new file with mode: 0644]