Attempt to fold trunc (*shr (trunc A), C) --> trunc(*shr A, C) iff the shift amount if small enough that all zero/sign bits created by the shift are removed by the last trunc.
Helps fix the regressions encountered in D88316.
Paths
| Differential D88429
[InstCombine] visitTrunc - trunc (*shr (trunc A), C) --> trunc(*shr A, C) ClosedPublic Authored by RKSimon on Sep 28 2020, 10:12 AM.
Details Summary Attempt to fold trunc (*shr (trunc A), C) --> trunc(*shr A, C) iff the shift amount if small enough that all zero/sign bits created by the shift are removed by the last trunc. Helps fix the regressions encountered in D88316.
Diff Detail
Event Timeline
Comment Actions Please can you post the alive proof you're basing this on?
lebedev.ri added inline comments.
This revision now requires changes to proceed.Sep 29 2020, 8:55 AM Comment Actions LGTM, but please see https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20200928/835878.html
This revision is now accepted and ready to land.Sep 29 2020, 9:52 AM Closed by commit rG0cf48a70651c: [InstCombine] visitTrunc - trunc (*shr (trunc A), C) --> trunc(*shr A, C) (authored by RKSimon). · Explain WhySep 29 2020, 10:29 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 295037 llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/test/Transforms/InstCombine/trunc-shift-trunc.ll
|
I do not understand why this isn't just unsigned MaxShiftAmt = AWidth - DestWidth;