[PATCH] D15497: [InstCombine] Bitreverse/Bswap: Allow ORs of base values

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 07:49:17 PST 2015


jmolloy created this revision.
jmolloy added reviewers: hfinkel, sbaranga, sanjoy.
jmolloy added subscribers: majnemer, llvm-commits.
jmolloy set the repository for this revision to rL LLVM.

Previously, we'd only recognize bitreversals or byteswaps where the generated value starts off as zero:

  int2_t b = 0;
  if (a & 1) b |= 2;
  if (a & 2) b |= 1;
  return b;

But with not much work we can also support starting the generated value as the reversal value:

  int2_t b = a;
  if (a & 1) b |= 2;
  if (a & 2) b |= 1;
  return b;

Repository:
  rL LLVM

http://reviews.llvm.org/D15497

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15497.42721.patch
Type: text/x-patch
Size: 5162 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151214/45d98d84/attachment.bin>


More information about the llvm-commits mailing list