aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-17 19:40:32 +0000
committerChris Lattner <sabre@nondot.org>2005-02-17 19:40:32 +0000
commitaa781b34040f07db00fb4b59cb567e6ad9ef5861 (patch)
tree99830f89f2e67c1cfd1914ef0b3973485c6e2f5f
parent1a84bd38efa9d3f638781e2502b2bee150a3471c (diff)
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20228 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index e5266c294f..285f810bfb 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -852,7 +852,14 @@ static BasicBlock *IsOnlyUsedInOneBasicBlock(Argument *A) {
++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::