[JumpThreading] Fix handling of aliasing metadata.
authorEli Friedman <eli.friedman@gmail.com>
Mon, 8 Aug 2016 04:10:22 +0000 (04:10 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 8 Aug 2016 04:10:22 +0000 (04:10 +0000)
commit02419a98499704e98236cda2e9b1b3c996ad4908
treef9c507ee5717bd9a24076682962c5fac36b7c944
parentd931b9f20060ce3751614e889fa4629db13e9e66
[JumpThreading] Fix handling of aliasing metadata.

Summary:
The correctness fix here is that when we CSE a load with another load,
we need to combine the metadata on the two loads. This matches the
behavior of other passes, like instcombine and GVN.

There's also a minor optimization improvement here: for load PRE, the
aliasing metadata on the inserted load should be the same as the
metadata on the original load. Not sure why the old code was throwing
it away.

Issue found by inspection.

Differential Revision: http://reviews.llvm.org/D21460

llvm-svn: 277977
llvm/include/llvm/Analysis/Loads.h
llvm/include/llvm/Transforms/Utils/Local.h
llvm/lib/Analysis/Loads.cpp
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/lib/Transforms/Scalar/JumpThreading.cpp
llvm/lib/Transforms/Utils/Local.cpp
llvm/test/Transforms/JumpThreading/thread-loads.ll