[EarlyCSE] Fix crash when optimizing masked loads/stores
authorFraser Cormack <fraser@codeplay.com>
Thu, 12 Jan 2023 15:35:24 +0000 (15:35 +0000)
committerFraser Cormack <fraser@codeplay.com>
Thu, 12 Jan 2023 17:31:36 +0000 (17:31 +0000)
commitd808ad822a5b49594d5a4955d4d9b3a59a50d360
treed460944a6f32e20f0e6db2495673a60db1849468
parent187d2cdafb493a54c95ff64f989c0fdfa1a27331
[EarlyCSE] Fix crash when optimizing masked loads/stores

With opaque pointers, it is possible for EarlyCSE to encounter masked
load/store intrinsics which access the same pointer value but with
different incompatible types. These cannot form valid replacements
(without explicit casting, which we don't yet do even for regular
load/store instructions) so should be prevented.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D141613
llvm/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/test/Transforms/EarlyCSE/opaque-ptr.ll