[PATCH] Teach DAGCombier how to fold according to rule (shl (zext (shr A, X)), X) => (zext (shl (shr A, X), X))

Andrea Di Biagio Andrea_DiBiagio at sn.scee.net
Thu Sep 12 08:59:09 PDT 2013


andreadb added you to the CC list for the revision "Teach DAGCombier how to fold according to rule  (shl (zext (shr A, X)), X)  =>  (zext (shl (shr A, X), X))".

Hi all,

This patch teaches DAGCombiner how to fold dags according to the rule:
(shl (zext (shr A, X)), X) => (zext (shl (shr A, X), X)) 

The rule only triggers when there are no other uses of the zext to avoid
materializing more instructions.

This rule canonicalizes the dag in input moving the zeroextend outside 
the sequence shl/shr. This helps the DAGCombiner understanding that the shl/shr
sequence can then be converted into a AND. 

Please let me know what do you think.

Thanks,
Andrea Di Biagio

http://llvm-reviews.chandlerc.com/D1660

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/X86/dagcombine-shifts.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1660.1.patch
Type: text/x-patch
Size: 4966 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130912/68d166b6/attachment.bin>


More information about the llvm-commits mailing list