Make FindAvailableLoadedValue TBAA aware
authorThomas Preud'homme <thomasp@graphcore.ai>
Mon, 22 Mar 2021 20:28:41 +0000 (20:28 +0000)
committerThomas Preud'homme <thomasp@graphcore.ai>
Wed, 24 Mar 2021 17:20:26 +0000 (17:20 +0000)
commit3b52c04e82fada6483337dfd6a033f336fbc73ec
tree42587cd941afb4d04be3cabe40facac4dc0ca955
parent7654bb6303d290b19cad29137be810e69a0bf917
Make FindAvailableLoadedValue TBAA aware

FindAvailableLoadedValue() relies on FindAvailablePtrLoadStore() to run
the alias analysis when searching for an equivalent value. However,
FindAvailablePtrLoadStore() calls the alias analysis framework with a
memory location for the load constructed from an address and a size,
which thus lacks TBAA metadata info. This commit modifies
FindAvailablePtrLoadStore() to accept an optional memory location as
parameter to allow FindAvailableLoadedValue() to create it based on the
load instruction, which would then have TBAA metadata info attached.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D99206
llvm/include/llvm/Analysis/Loads.h
llvm/lib/Analysis/Loads.cpp
llvm/lib/Transforms/Scalar/JumpThreading.cpp
llvm/test/Transforms/InstCombine/load-no-aliasing.ll