[PATCH] D68470: [InstCombine][NFC] dropRedundantMaskingOfLeftShiftInput(): change how we deal with mask

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 09:14:48 PDT 2019


lebedev.ri created this revision.
lebedev.ri added a reviewer: spatel.
lebedev.ri added a project: LLVM.
Herald added a subscriber: hiraditya.
lebedev.ri added a parent revision: D68239: [InstCombine] dropRedundantMaskingOfLeftShiftInput(): propagate undef shift amounts.

Currently, we pre-check whether we need to produce a mask or not.
This involves some rather magical constants.
I'd like to extend this fold to also handle the situation
when there's also a `trunc` before outer shift.
That will require another set of magical constants.
It's ugly.

Instead, we can just compute the mask, and check
whether mask is a pass-through (all-ones) or not.
This way we don't need to have any magical numbers.

This change is NFC other than the fact that we now compute
the mask and then check if we need (and can!) apply it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68470

Files:
  llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68470.223231.patch
Type: text/x-patch
Size: 7722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191004/4c004e3d/attachment.bin>


More information about the llvm-commits mailing list