HomePhabricator

[InstCombine] Fix a nasty miscompile introduced w/masked.gather demanded elts

Authored by reames on Apr 12 2019, 11:26 AM.

Description

[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.

llvm-svn: 358299

Details

Committed
reamesApr 12 2019, 11:26 AM
Parents
rG00a0d5d1de58: [CVP] Set NSW/NUW flags when simplifying with.overflow
Branches
Unknown
Tags
Unknown