OSDN Git Service

[InstCombine] Optimize away the unnecessary multi-use sign-extend
authorBhramar Vatsa <Bhramar.Vatsa@synopsys.com>
Tue, 1 Dec 2020 13:35:04 +0000 (16:35 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Tue, 1 Dec 2020 13:54:00 +0000 (16:54 +0300)
commitfd679107d670d8fd31b62245b433187b4d72a9d0
treef47cb850d3db3a99567ed0f9278f4bc29e5934e6
parent94ead0190ff18be337c5c84abccc315fd68f41fc
[InstCombine] Optimize away the unnecessary multi-use sign-extend

C.f. https://bugs.llvm.org/show_bug.cgi?id=47765

Added a case for handling the sign-extend (Shl+AShr) for multiple uses,
to optimize it away for an individual use,
when the demanded bits aren't affected by sign-extend.

https://rise4fun.com/Alive/lgf

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D91343
llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/test/Transforms/InstCombine/and.ll