diff options
| author | Dan Gohman <gohman@apple.com> | 2008-07-25 00:04:14 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2008-07-25 00:04:14 +0000 |
| commit | 9268601d8a7b4e77f15cab9750684a945dc3a9de (patch) | |
| tree | 79ff0ffde1334eaf3034c8c5cf1f06ed70cb324e /llvm/lib/CodeGen | |
| parent | 09b0448dbc863d63d5494bb3d88365fde4703dab (diff) | |
| download | bcm5719-llvm-9268601d8a7b4e77f15cab9750684a945dc3a9de.tar.gz bcm5719-llvm-9268601d8a7b4e77f15cab9750684a945dc3a9de.zip | |
Use AliasAnalysis::pointsToConstantMemory in SDISel to avoid unnecessary
dependencies with constant load nodes. This allows them to be scheduled
freely.
llvm-svn: 54001
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index fdc3d25bd58..ac9e399e9d6 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2885,9 +2885,15 @@ void SelectionDAGLowering::visitLoad(LoadInst &I) { return; SDOperand Root; + bool ConstantMemory = false; if (I.isVolatile()) + // Serialize volatile loads with other side effects. 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. Root = DAG.getRoot(); } @@ -2905,12 +2911,14 @@ void SelectionDAGLowering::visitLoad(LoadInst &I) { Chains[i] = L.getValue(1); } - SDOperand Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, - &Chains[0], NumValues); - if (isVolatile) - DAG.setRoot(Chain); - else - PendingLoads.push_back(Chain); + if (!ConstantMemory) { + SDOperand Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, + &Chains[0], NumValues); + if (isVolatile) + DAG.setRoot(Chain); + else + PendingLoads.push_back(Chain); + } setValue(&I, DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], NumValues), &Values[0], NumValues)); |

