diff options
author | Sam Parker <sam.parker@arm.com> | 2018-06-08 07:49:04 +0000 |
---|---|---|
committer | Sam Parker <sam.parker@arm.com> | 2018-06-08 07:49:04 +0000 |
commit | 16f963ba0dde224471450203ed8976ee955d64a5 (patch) | |
tree | c0f7f383f27ddbc280aa5c0709c60968f61ae9c0 /llvm/lib | |
parent | b81372b56bc832390f03ea2e347f794adb599212 (diff) | |
download | bcm5719-llvm-16f963ba0dde224471450203ed8976ee955d64a5.tar.gz bcm5719-llvm-16f963ba0dde224471450203ed8976ee955d64a5.zip |
[DAGCombine] Fix for PR37667
While trying to propagate AND masks back to loads, we currently allow
one non-load node to be included as a leaf in chain. This fix now
limits that node to produce only a single data value.
Differential Revision: https://reviews.llvm.org/D47878
llvm-svn: 334268
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index d2b0fa15670..64b0ee571a2 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -3997,7 +3997,23 @@ bool DAGCombiner::SearchForAndLoads(SDNode *N, // Allow one node which will masked along with any loads found. if (NodeToMask) return false; + + // Also ensure that the node to be masked only produces one data result. NodeToMask = Op.getNode(); + if (NodeToMask->getNumValues() > 1) { + bool HasValue = false; + for (unsigned i = 0, e = NodeToMask->getNumValues(); i < e; ++i) { + MVT VT = SDValue(NodeToMask, i).getSimpleValueType(); + if (VT != MVT::Glue && VT != MVT::Other) { + if (HasValue) { + NodeToMask = nullptr; + return false; + } + HasValue = true; + } + } + assert(HasValue && "Node to be masked has no data result?"); + } } return true; } |