[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp SelectionDAGISel.cpp

Jim Laskey jlaskey at apple.com
Mon Oct 16 13:52:48 PDT 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.224 -> 1.225
SelectionDAGISel.cpp updated: 1.288 -> 1.289
---
Log message:

Pass AliasAnalysis thru to DAGCombiner.

---
Diffs of the changes:  (+18 -6)

 DAGCombiner.cpp      |   15 +++++++++++----
 SelectionDAGISel.cpp |    9 +++++++--
 2 files changed, 18 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.224 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.225
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.224	Sat Oct 14 07:14:27 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Mon Oct 16 15:52:31 2006
@@ -30,6 +30,7 @@
 
 #define DEBUG_TYPE "dagcombine"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/CodeGen/SelectionDAG.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
@@ -60,6 +61,9 @@
     // Worklist of all of the nodes that need to be simplified.
     std::vector<SDNode*> WorkList;
 
+    // AA - Used for DAG load/store alias analysis.
+    AliasAnalysis &AA;
+
     /// AddUsersToWorkList - When an instruction is simplified, add all users of
     /// the instruction to the work lists because they might get more simplified
     /// now.
@@ -262,8 +266,11 @@
     SDOperand FindBetterChain(SDNode *N, SDOperand Chain);
     
 public:
-    DAGCombiner(SelectionDAG &D)
-      : DAG(D), TLI(D.getTargetLoweringInfo()), AfterLegalize(false) {}
+    DAGCombiner(SelectionDAG &D, AliasAnalysis &A)
+      : DAG(D),
+        TLI(D.getTargetLoweringInfo()),
+        AfterLegalize(false),
+        AA(A) {}
     
     /// Run - runs the dag combiner on all nodes in the work list
     void Run(bool RunningAfterLegalize); 
@@ -4133,8 +4140,8 @@
 
 // SelectionDAG::Combine - This is the entry point for the file.
 //
-void SelectionDAG::Combine(bool RunningAfterLegalize) {
+void SelectionDAG::Combine(bool RunningAfterLegalize, AliasAnalysis &AA) {
   /// run - This is the main entry point to this class.
   ///
-  DAGCombiner(*this).Run(RunningAfterLegalize);
+  DAGCombiner(*this, AA).Run(RunningAfterLegalize);
 }


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.288 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.288	Fri Oct 13 16:12:22 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Mon Oct 16 15:52:31 2006
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #define DEBUG_TYPE "isel"
+#include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/CodeGen/SelectionDAGISel.h"
 #include "llvm/CodeGen/ScheduleDAG.h"
 #include "llvm/CallingConv.h"
@@ -2951,6 +2952,7 @@
 void SelectionDAGISel::getAnalysisUsage(AnalysisUsage &AU) const {
   // FIXME: we only modify the CFG to split critical edges.  This
   // updates dom and loop info.
+  AU.addRequired<AliasAnalysis>();
 }
 
 
@@ -3546,8 +3548,11 @@
 }
 
 void SelectionDAGISel::CodeGenAndEmitDAG(SelectionDAG &DAG) {
+  // Get alias analysis for load/store combining.
+  AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
+
   // Run the DAG combiner in pre-legalize mode.
-  DAG.Combine(false);
+  DAG.Combine(false, AA);
   
   DEBUG(std::cerr << "Lowered selection DAG:\n");
   DEBUG(DAG.dump());
@@ -3560,7 +3565,7 @@
   DEBUG(DAG.dump());
   
   // Run the DAG combiner in post-legalize mode.
-  DAG.Combine(true);
+  DAG.Combine(true, AA);
   
   if (ViewISelDAGs) DAG.viewGraph();
 






More information about the llvm-commits mailing list