]> granicus.if.org Git - llvm/commit
[InstCombine] Fix a nasty miscompile introduced w/masked.gather demanded elts
authorPhilip Reames <listmail@philipreames.com>
Fri, 12 Apr 2019 18:26:56 +0000 (18:26 +0000)
committerPhilip Reames <listmail@philipreames.com>
Fri, 12 Apr 2019 18:26:56 +0000 (18:26 +0000)
commit11c890ecc7d43d455e97ab5032eeb6870bbc8d29
tree6c775b981249cae062c06160bce96166944e65c4
parent18746175864bf76a311c682af228873beede500c
[InstCombine] Fix a nasty miscompile introduced w/masked.gather demanded elts

This fixes a miscompile which was introduced in r356510 (https://reviews.llvm.org/D57372).

The problem is that the original patch removed pointer operands where the load results we're demanded, but without considering the legality of the load itself.  If the masked.gather had active, but undemanded, lanes, then we could end up creating a load which loaded from an undef address.  The result could be a segfault, or, in theory, an arbitrary read from a random memory location into an used register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358299 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
test/Transforms/InstCombine/masked_intrinsics.ll