aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-25 00:04:14 +0000
committerDan Gohman <gohman@apple.com>2008-07-25 00:04:14 +0000
commit8b4588fa64f0ebfbb7d2b9b4af8c682ddddf29c0 (patch)
tree63e7762e932b73c625df4a06d6dd325287694ebe /lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
parent6d69ba8a6901c69d78488cbc41f8dbf080618fde (diff)
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
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index fdc3d25bd5..ac9e399e9d 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/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));