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

Chris Lattner lattner at cs.uiuc.edu
Thu Feb 17 11:40:45 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.30 -> 1.31
---
Log message:

Don't sink argument loads into loops or other bad places.  This disables folding of argument loads with instructions that are not in the entry block.


---
Diffs of the changes:  (+8 -1)

 SelectionDAGISel.cpp |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.30 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.31
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.30	Sat Jan 22 22:36:26 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Thu Feb 17 13:40:32 2005
@@ -852,7 +852,14 @@
        ++UI)
     if (isa<PHINode>(*UI) || cast<Instruction>(*UI)->getParent() != BB)
       return 0;  // Disagreement among the users?
-  return BB;
+
+  // Okay, there is a single BB user.  Only permit this optimization if this is
+  // the entry block, otherwise, we might sink argument loads into loops and
+  // stuff.  Later, when we have global instruction selection, this won't be an
+  // issue clearly.
+  if (BB == BB->getParent()->begin())
+    return BB;
+  return 0;
 }
 
 void SelectionDAGISel::






More information about the llvm-commits mailing list