]> granicus.if.org Git - llvm/commit
[InstCombine][NFC] dropRedundantMaskingOfLeftShiftInput(): change how we deal with...
authorRoman Lebedev <lebedev.ri@gmail.com>
Mon, 7 Oct 2019 20:53:00 +0000 (20:53 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Mon, 7 Oct 2019 20:53:00 +0000 (20:53 +0000)
commit17520ed1e33177b9dacf0bbfac84378b223e0a14
treee6a39599e0d1929b18430846d3d38c2d6f345372
parent1c7e337a3621ef67c5f7a41db42e9f96cd74d618
[InstCombine][NFC] dropRedundantMaskingOfLeftShiftInput(): change how we deal with mask

Summary:
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.

Reviewers: spatel

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373961 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineShifts.cpp