[all-commits] [llvm/llvm-project] d50366: [InstCombine] improve matching for sext-lshr-trunc...

RotateRight via All-commits all-commits at lists.llvm.org
Mon Jun 8 11:43:54 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d50366d29f25fb2297b7561092132ecf74a391e9
      https://github.com/llvm/llvm-project/commit/d50366d29f25fb2297b7561092132ecf74a391e9
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-06-08 (Mon, 08 Jun 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    M llvm/test/Transforms/InstCombine/cast.ll

  Log Message:
  -----------
  [InstCombine] improve matching for sext-lshr-trunc patterns, part 2

Similar to rG42f488b63a04

This is intended to preserve the logic of the existing transform,
but remove unnecessary restrictions on uses and types.

https://rise4fun.com/Alive/oS0

  Name: narrow input
  Pre: C1 <= width(C1) - 24
  %B = sext i8 %A
  %C = lshr %B, C1
  %r = trunc %C to i24
  =>
  %s = ashr i8 %A, trunc(umin(C1, 7))
  %r = sext i8 %s to i24

  Name: wide input
  Pre: C1 <= width(C1) - 24
  %B = sext i24 %A
  %C = lshr %B, C1
  %r = trunc %C to i8
  =>
  %s = ashr i24 %A, trunc(umin(C1, 23))
  %r = trunc i24 %s to i8




More information about the All-commits mailing list