[all-commits] [llvm/llvm-project] 5c91aa: [InstCombine] Fold or(zext(bswap(x)), shl(zext(bswa...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Tue May 5 04:33:12 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5c91aa660386ea22e0d38eb0de4c26d62073ccb3
      https://github.com/llvm/llvm-project/commit/5c91aa660386ea22e0d38eb0de4c26d62073ccb3
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2020-05-05 (Tue, 05 May 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/test/Transforms/InstCombine/or-concat.ll

  Log Message:
  -----------
  [InstCombine] Fold or(zext(bswap(x)),shl(zext(bswap(y)),bw/2)) -> bswap(or(zext(x),shl(zext(y), bw/2))

This adds a general combine that can be used to fold:

  or(zext(OP(x)), shl(zext(OP(y)),bw/2))
-->
  OP(or(zext(x), shl(zext(y),bw/2)))

Allowing us to widen 'concat-able' style or+zext patterns - I've just set this up for BSWAP but we could use this for other similar ops (BITREVERSE for instance).

We already do something similar for bitop(bswap(x),bswap(y)) --> bswap(bitop(x,y))

Fixes PR45715

Reviewed By: @lebedev.ri

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




More information about the All-commits mailing list