[PATCH] D67799: [InstCombine] Fold a shifty implementation of clamp0.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 21 08:03:02 PDT 2019


lebedev.ri requested changes to this revision.
lebedev.ri added a comment.
This revision now requires changes to proceed.

Ah, finally got it. There is more general fold here:

  Name: sub_ashr_and_nsw
    %sub = sub nsw i8 %X, %v
    %ashr = ashr i8 %sub, 7
    %r = and i8 %ashr, %v
  =>
    %cmp = icmp sle i8 %v, %X
    %r = select i1 %cmp, i8 0, i8 %v

https://rise4fun.com/Alive/urO


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67799/new/

https://reviews.llvm.org/D67799





More information about the llvm-commits mailing list