[AArch64] Don't reduce the width of loads if it prevents combining a shift
authorJohn Brawn <john.brawn@arm.com>
Fri, 23 Mar 2018 14:47:07 +0000 (14:47 +0000)
committerJohn Brawn <john.brawn@arm.com>
Fri, 23 Mar 2018 14:47:07 +0000 (14:47 +0000)
commite3b44f9de6b6724e147cc7577f18ef500d88c754
tree88791a019e5706ff62eb20b3b9fd192135ad98d1
parent5792e10ffb07891e6e79bd6a5dbc0863ce13074c
[AArch64] Don't reduce the width of loads if it prevents combining a shift

Loads and stores can only shift the offset register by the size of the value
being loaded, but currently the DAGCombiner will reduce the width of the load
if it's followed by a trunc making it impossible to later combine the shift.

Solve this by implementing shouldReduceLoadWidth for the AArch64 backend and
make it prevent the width reduction if this is what would happen, though do
allow it if reducing the load width will let us eliminate a later sign or zero
extend.

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

llvm-svn: 328321
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.h
llvm/test/CodeGen/AArch64/arm64-fold-lsl.ll
llvm/test/CodeGen/AArch64/arm64-register-offset-addressing.ll