[llvm-commits] [llvm] r54001 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Dan Gohman gohman at apple.com
Thu Jul 24 17:04:14 PDT 2008


Author: djg
Date: Thu Jul 24 19:04:14 2008
New Revision: 54001

URL: http://llvm.org/viewvc/llvm-project?rev=54001&view=rev
Log:
Use AliasAnalysis::pointsToConstantMemory in SDISel to avoid unnecessary
dependencies with constant load nodes. This allows them to be scheduled
freely.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=54001&r1=54000&r2=54001&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Jul 24 19:04:14 2008
@@ -2885,9 +2885,15 @@
     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 @@
     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));





More information about the llvm-commits mailing list