[DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))
authorGuozhi Wei <carrot@google.com>
Sat, 7 Apr 2018 23:36:10 +0000 (23:36 +0000)
committerGuozhi Wei <carrot@google.com>
Sat, 7 Apr 2018 23:36:10 +0000 (23:36 +0000)
commit0eb86c8efc0a3a21b4bdcad64c58d4a3e2fa7c35
tree62044ce308506307a194ffa1151cf4f77ad01300
parente46ac5fb9dcbfd805bf1181dc6babcae0a5c9210
[DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))

In our real world application, we found the following optimization is missed in DAGCombiner

(zext (and/or/xor (shl/shr (load x), cst), cst)) -> (and/or/xor (shl/shr (zextload x), (zext cst)), (zext cst))

If the user of original zext is an add, it may enable further lea optimization on x86.

This patch add a new function CombineZExtLogicopShiftLoad to do this optimization.

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

llvm-svn: 329516
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/zext-logic-shift-load.ll [new file with mode: 0644]
llvm/test/CodeGen/ARM/zext-logic-shift-load.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/zext-logicop-shift-load.ll [new file with mode: 0644]