Use AliasAnalysis::pointsToConstantMemory in SDISel to avoid unnecessary

dependencies with constant load nodes. This allows them to be scheduled
freely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54001 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2008-07-25 00:04:14 +00:00
parent 6d69ba8a69
commit 8b4588fa64

View File

@ -2885,9 +2885,15 @@ void SelectionDAGLowering::visitLoad(LoadInst &I) {
return; return;
SDOperand Root; SDOperand Root;
bool ConstantMemory = false;
if (I.isVolatile()) if (I.isVolatile())
// Serialize volatile loads with other side effects.
Root = getRoot(); Root = getRoot();
else { else if (AA.pointsToConstantMemory(SV)) {
// Do not serialize (non-volatile) loads of constant memory with anything.
Root = DAG.getEntryNode();
ConstantMemory = true;
} else {
// Do not serialize non-volatile loads against each other. // Do not serialize non-volatile loads against each other.
Root = DAG.getRoot(); Root = DAG.getRoot();
} }
@ -2905,12 +2911,14 @@ void SelectionDAGLowering::visitLoad(LoadInst &I) {
Chains[i] = L.getValue(1); Chains[i] = L.getValue(1);
} }
SDOperand Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, if (!ConstantMemory) {
&Chains[0], NumValues); SDOperand Chain = DAG.getNode(ISD::TokenFactor, MVT::Other,
if (isVolatile) &Chains[0], NumValues);
DAG.setRoot(Chain); if (isVolatile)
else DAG.setRoot(Chain);
PendingLoads.push_back(Chain); else
PendingLoads.push_back(Chain);
}
setValue(&I, DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], NumValues), setValue(&I, DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], NumValues),
&Values[0], NumValues)); &Values[0], NumValues));