[CVP] Remove a masking operation if range information implies it's a noop
authorPhilip Reames <listmail@philipreames.com>
Fri, 11 Oct 2019 03:48:56 +0000 (03:48 +0000)
committerPhilip Reames <listmail@philipreames.com>
Fri, 11 Oct 2019 03:48:56 +0000 (03:48 +0000)
commit2d5820cd72255e04aaef2da3c21d62396fdd7fb9
treed28b630a05471c23f29d01fd2a64a093a74a800a
parent32097c269660a0b78aa5966b8279b248dda60993
[CVP] Remove a masking operation if range information implies it's a noop

This is really a known bits style transformation, but known bits isn't context sensitive. The particular case which comes up happens to involve a range which allows range based reasoning to eliminate the mask pattern, so handle that case specifically in CVP.

InstCombine likes to generate the mask-by-low-bits pattern when widening an arithmetic expression which includes a zext in the middle.

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

llvm-svn: 374506
llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
llvm/test/Transforms/CorrelatedValuePropagation/and.ll [new file with mode: 0644]
llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll
llvm/test/Transforms/CorrelatedValuePropagation/range.ll