[InstCombine] Fold for masked gather when loading the same value each time.
authorCaroline Concatto <caroline.concatto@arm.com>
Mon, 13 Dec 2021 17:20:16 +0000 (17:20 +0000)
committerCaroline Concatto <caroline.concatto@arm.com>
Fri, 21 Jan 2022 14:19:51 +0000 (14:19 +0000)
commitad43217a046634be24174299beec3a28018ec3c0
tree8e83e8d134bdebe5552ff7b25f68312ffc730611
parente9211e03937751ab75bbb34e38acc330b85fb0d8
[InstCombine] Fold for masked gather when loading the same value each time.

This patch checks in the masked gather when the first operand value is a
splat and the mask is all one, because the masked gather is reloading the
same value each time. This patch replaces this pattern of masked gather by
a scalar load of the value and splats it in a vector.

Differential Revision: https://reviews.llvm.org/D115726
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/masked_intrinsics.ll