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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 21 10:31:49 PDT 2021


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

Looks fine to me.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:397
+      if (C->ult(I->getType()->getScalarSizeInBits()) &&
+          C->ule(DemandedMask.countLeadingZeros())) {
+        // trunc (lshr X, C) --> lshr (trunc X), C
----------------
lebedev.ri wrote:
> I think this is only part of the check.
> https://alive2.llvm.org/ce/z/59fb7i => https://alive2.llvm.org/ce/z/s_G7u7
> 
No, ignore me.


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

https://reviews.llvm.org/D110170



More information about the llvm-commits mailing list