[SelectionDAG] Replace error prone index check in BaseIndexOffset::computeAliasing
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Mon, 20 Sep 2021 09:32:01 +0000 (11:32 +0200)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Tue, 5 Oct 2021 10:15:55 +0000 (12:15 +0200)
commit8ed0e6b2cf941aa29628acdf718e82618d60bfc0
tree9c1438ef718082bf1c45dafad3646b0e9c3569ad
parent1896fb2cfffcf120eb28cefb67ac3d56035adc43
[SelectionDAG] Replace error prone index check in BaseIndexOffset::computeAliasing

Deriving NoAlias based on having the same index in two BaseIndexOffset
expressions seemed weird (and as shown in the added unittest the
correctness of doing so depended on undocumented pre-conditions that
the user of BaseIndexOffset::computeAliasing would need to take care
of.

This patch removes the code that dereived NoAlias based on indices
being the same. As a compensation, to avoid regressions/diffs in
various lit test, we also add a new check. The new check derives
NoAlias in case the two base pointers are based on two different
GlobalValue:s (neither of them being a GlobalAlias).

Reviewed By: niravd

Differential Revision: https://reviews.llvm.org/D110256
llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp