[PATCH] Add DAG combine for shl + add of constants.

Matt Arsenault Matthew.Arsenault at amd.com
Sat Aug 2 22:18:47 PDT 2014


Do
     (shl (add x, c1), c2) -> (add (shl x, c2), c1 << c2)
    
This is already done for multiplies, but since multiplies
by powers of two are turned into shifts, we also need
to handle it here. This not happening is interfering with folding
some constant offsets into an addressing mode.
  
This might want checks for isLegalAddImmediate to avoid
transforming an add of a legal immediate with one that isn't.

http://reviews.llvm.org/D4768

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/AArch64/arm64-shifted-sext.ll
  test/CodeGen/R600/shl_add_constant.ll
  test/CodeGen/R600/trunc.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4768.12143.patch
Type: text/x-patch
Size: 4640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140803/de16f69a/attachment.bin>


More information about the llvm-commits mailing list