[all-commits] [llvm/llvm-project] 2f6b07: [InstCombine] fold cast of right-shift if high bit...

RotateRight via All-commits all-commits at lists.llvm.org
Tue Sep 21 13:10:34 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2f6b07316f560a1f6d225919019dff2e5d6346e5
      https://github.com/llvm/llvm-project/commit/2f6b07316f560a1f6d225919019dff2e5d6346e5
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-09-21 (Tue, 21 Sep 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
    M llvm/test/Transforms/InstCombine/trunc-demand.ll

  Log Message:
  -----------
  [InstCombine] fold cast of right-shift if high bits are not demanded

(masked) trunc (lshr X, C) --> (masked) lshr (trunc X), C

Narrowing the shift should be better for analysis and can lead
to follow-on transforms as shown.

Attempt at a general proof in Alive2:
https://alive2.llvm.org/ce/z/tRnnSF

Here are a couple of the specific tests:
https://alive2.llvm.org/ce/z/bCnTp-
https://alive2.llvm.org/ce/z/TfaHnb

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




More information about the All-commits mailing list