forked from OSchip/llvm-project
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
This commit is contained in:
parent
771a1f1720
commit
1ae49ee7ca
|
@ -364,7 +364,9 @@ static void MoveBelowTokenFactor(SelectionDAG *CurDAG, SDValue Load,
|
||||||
Store.getOperand(2), Store.getOperand(3));
|
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,
|
static bool isRMWLoad(SDValue N, SDValue Chain, SDValue Address,
|
||||||
SDValue &Load) {
|
SDValue &Load) {
|
||||||
|
@ -382,8 +384,9 @@ static bool isRMWLoad(SDValue N, SDValue Chain, SDValue Address,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (N.hasOneUse() &&
|
if (N.hasOneUse() &&
|
||||||
|
LD->hasNUsesOfValue(1, 1) &&
|
||||||
N.getOperand(1) == Address &&
|
N.getOperand(1) == Address &&
|
||||||
N.getNode()->isOperandOf(Chain.getNode())) {
|
LD->isOperandOf(Chain.getNode())) {
|
||||||
Load = N;
|
Load = N;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue