[PATCH] D88429: [InstCombine] visitTrunc - trunc (*shr (trunc A), C) --> trunc(*shr A, C)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 10:19:08 PDT 2020


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:862
+    // removed by the trunc.
+    if (C->ule(MaxShiftAmt)) {
+      auto *ShAmt = ConstantInt::get(AType, C->getZExtValue());
----------------
Do you want to deal with non-splats from the getgo?
See `m_SpecificInt_ICMP()`


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:867
+                         : Builder.CreateLShr(A, ShAmt);
+      return CastInst::CreateTruncOrBitCast(Shift, DestTy);
+    }
----------------
I think you can preserve `exact`ness of the shift.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88429



More information about the llvm-commits mailing list