[DAG] Fix Memory ordering check in ReduceLoadOpStore.
authorNirav Dave <niravd@google.com>
Fri, 20 Jul 2018 15:20:50 +0000 (15:20 +0000)
committerNirav Dave <niravd@google.com>
Fri, 20 Jul 2018 15:20:50 +0000 (15:20 +0000)
commit5a4e11ad9c2eb9435806f93ed371e58cdb3519ba
tree688159079c8a2254ba91ff4f8e6e89428a9471a2
parent88ad704b5ba4db7b6c55814fd90eab1ae625f7b1
[DAG] Fix Memory ordering check in ReduceLoadOpStore.

When merging through a TokenFactor we need to check that the
load may be ordered such that no other aliasing memory operations may
happen. It is not sufficient to just check that the load is a member
of the chain token factor as it there may be a indirect chain. Require
the load's chain has only one use.

This fixes PR37826.

Reviewers: spatel, davide, efriedma, craig.topper, RKSimon

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 337560
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/pr37826.ll