diff options
| author | Nate Begeman <natebegeman@mac.com> | 2009-09-16 03:20:46 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2009-09-16 03:20:46 +0000 |
| commit | 1ae49ee7ca794dca821f8df116219d715ad729db (patch) | |
| tree | 9e11985e4dcaaf7b7efdabc3644b725e579cc6ce | |
| parent | 771a1f1720f1d2e0f2d74bc0580a3697e767df9a (diff) | |
| download | bcm5719-llvm-1ae49ee7ca794dca821f8df116219d715ad729db.tar.gz bcm5719-llvm-1ae49ee7ca794dca821f8df116219d715ad729db.zip | |
Do not try and sink a load whose chain result has more than one use, when
trying to create RMW opportunities in the x86 backend. This can cause a
cycle to appear in the graph, since the other uses may eventually feed into
the TokenFactor we are sinking the load below.
llvm-svn: 81996
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp index a900a69ba71..21681f9c4d0 100644 --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -364,7 +364,9 @@ static void MoveBelowTokenFactor(SelectionDAG *CurDAG, SDValue Load, Store.getOperand(2), Store.getOperand(3)); } -/// isRMWLoad - Return true if N is a load that's part of RMW sub-DAG. +/// isRMWLoad - Return true if N is a load that's part of RMW sub-DAG. The +/// chain produced by the load must only be used by the store's chain operand, +/// otherwise this may produce a cycle in the DAG. /// static bool isRMWLoad(SDValue N, SDValue Chain, SDValue Address, SDValue &Load) { @@ -382,8 +384,9 @@ static bool isRMWLoad(SDValue N, SDValue Chain, SDValue Address, return false; if (N.hasOneUse() && + LD->hasNUsesOfValue(1, 1) && N.getOperand(1) == Address && - N.getNode()->isOperandOf(Chain.getNode())) { + LD->isOperandOf(Chain.getNode())) { Load = N; return true; } |

