[PATCH] D38037: [InstCombine] Compacting or instructions whose operands are shift instructions

Omer Paparo Bivas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 07:12:32 PDT 2017


opaparo created this revision.

Adding two kinds of transformations:

1. Change order of or instructions to group together identical opcodes and constants:
  - (or (or (op1 A C1)(op2 B C2)) (or (op1 D C1)(op2 E C2))) --> (or (or (op1 A C1)(op1 D C1)) (or (op2 B C2)(op2 E C2)))
2. Or of shifts and ands:
  - ((V<<C3)&C1) | ((V<<C4)&C2) --> ((V&C5)<<C3) | ((V&C5)<<C4), if C5 = C1>>C3 == C2>>C4, for both logical shifts
  - ((V&C5)<<C3) | ((V<<C4)&C2) --> ((V&C5)<<C3) | ((V&C5)<<C4)
  - ((V<<C3)&C1) | ((V&C5)<<C4) --> ((V&C5)<<C3) | ((V&C5)<<C4)

For the first transformation note that although op1 and op2 are not limited to shifts, cases where they are shifts will greatly benefit from it.


Repository:
  rL LLVM

https://reviews.llvm.org/D38037

Files:
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  test/Transforms/InstCombine/or-or-shift.ll
  test/Transforms/InstCombine/or-xor.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38037.115835.patch
Type: text/x-patch
Size: 10134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170919/3391e87c/attachment.bin>


More information about the llvm-commits mailing list