[DAGCombiner] Discard pointer info when combining extract_vector_elt of a vector...
authorCraig Topper <craig.topper@intel.com>
Tue, 5 Feb 2019 00:22:23 +0000 (00:22 +0000)
committerCraig Topper <craig.topper@intel.com>
Tue, 5 Feb 2019 00:22:23 +0000 (00:22 +0000)
commitd4e37afe450ae1822d65223b297a4b518b9eb268
tree9e1c5b7125ccf4ae74aa6b04c0ea595c4e754637
parent4bdf82ce7990d10189501ec1a70bb4f16954b5ed
[DAGCombiner] Discard pointer info when combining extract_vector_elt of a vector load when the index isn't constant

Summary:
If the index isn't constant, this transform inserts a multiply and an add on the index to calculating the base pointer for a scalar load. But we still create a memory operand with an offset of 0 and the size of the scalar access. But the access is really to an unknown offset within the original access size.

This can cause the machine scheduler to incorrectly calculate dependencies between this load and other accesses. In the case we saw, there was a 32 byte vector store that was split into two 16 byte stores, one with offset 0 and one with offset 16. The size of the memory operand for both was 16. The scheduler correctly detected the alias with the offset 0 store, but not the offset 16 store.

This patch discards the pointer info so we don't incorrectly detect aliasing. I wasn't sure if we could keep using the original offset and size without risking some other transform on the load changing the size.

I tried to reduce a test case, but there's still a lot of memory operations needed to get the scheduler to do the bad reordering. So it looked pretty fragile to maintain.

Reviewers: efriedma

Reviewed By: efriedma

Subscribers: arphaman, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D57616

llvm-svn: 353124
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/vecloadextract.ll [new file with mode: 0755]