[GlobalISel] Fix store merging incorrectly classifying an unknown index expr as 0...
authorAmara Emerson <amara@apple.com>
Tue, 30 Apr 2024 21:42:14 +0000 (05:42 +0800)
committerTom Stellard <tstellar@redhat.com>
Wed, 1 May 2024 18:35:12 +0000 (11:35 -0700)
commitece9d35f1a705ab8d66895c6d985907f2b9a2c0c
tree4fdcf55b17a1ef4da7c91ffac1b51dc8d7f1a9c1
parenta7b8b890600a33e0c88d639f311f1d73ccb1c8d2
[GlobalISel] Fix store merging incorrectly classifying an unknown index expr as 0. (#90375)

During analysis, we incorrectly leave the offset part of an address info
struct
as zero, when in actual fact we failed to decompose it into base +
offset.
This results in incorrectly assuming that the address is adjacent to
another store
addr. To fix this we wrap the offset in an optional<> so we can
distinguish between
real zero and unknown.

Fixes issue #90242

(cherry picked from commit 19f4d68252b70c81ebb1686a5a31069eda5373de)
llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h
llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
llvm/test/CodeGen/AArch64/GlobalISel/store-merging.ll
llvm/test/CodeGen/AArch64/GlobalISel/store-merging.mir