OSDN Git Service

[InstCombine] In foldSelectICmpAnd, if we need to to truncate from the 'and' type...
authorCraig Topper <craig.topper@intel.com>
Sat, 5 Aug 2017 01:45:17 +0000 (01:45 +0000)
committerCraig Topper <craig.topper@intel.com>
Sat, 5 Aug 2017 01:45:17 +0000 (01:45 +0000)
commita64054eb6169b8bf3cb261dc21068e4d14ad02eb
tree79bd0f59841312f61741c91718124577534edad6
parentb2f312fddff09a3d812fbb8853677cccd9ae117f
[InstCombine] In foldSelectICmpAnd, if we need to to truncate from the 'and' type to the 'select' type, do it after shifting right instead of just bailing.

Previously we were always trying to emit the zext or truncate before any shift. This meant if the 'and' mask was larger than the size of the truncate we would skip the transformation.

Now we shift the result of the and right first leaving the bit within the range of the truncate.

This matches what we are doing in foldSelectICmpAndOr for the same problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310159 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineSelect.cpp
test/Transforms/InstCombine/select-with-bitwise-ops.ll