[InstCombine] Fix miscompilation in PR83947 (#83993)
authorYingwei Zheng <dtcxzyw2333@gmail.com>
Tue, 5 Mar 2024 14:34:04 +0000 (22:34 +0800)
committerTom Stellard <tstellar@redhat.com>
Wed, 13 Mar 2024 05:05:53 +0000 (22:05 -0700)
commit3f8711fc5e01685f0a751ef296d16cf9a1f4fd4d
tree273a38764bdc88051b3ba85e9a9a5e7a27a2731b
parent9b9aee16d4dcf1b4af49988ebd7918fa4ce77e44
[InstCombine] Fix miscompilation in PR83947 (#83993)

https://github.com/llvm/llvm-project/blob/762f762504967efbe159db5c737154b989afc9bb/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp#L394-L407

Comment from @topperc:
> This transforms assumes the mask is a non-zero splat. We only know its
a splat and not provably all 0s. The mask is a constexpr that includes
the address of the global variable. We can't resolve the constant
expression to an exact value.

Fixes #83947.
llvm/include/llvm/Analysis/VectorUtils.h
llvm/lib/Analysis/VectorUtils.cpp
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/masked_intrinsics.ll
llvm/test/Transforms/InstCombine/pr83947.ll [new file with mode: 0644]