diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-02-17 19:40:32 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-02-17 19:40:32 +0000 |
| commit | 0c56a548edd6f1270040b71ec366a1b328f13df5 (patch) | |
| tree | 0ef7149075e7523a5164549ac1512607fb13d980 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | |
| parent | 7b5d9e221730498e3cece45deecd73ccb7090f02 (diff) | |
| download | bcm5719-llvm-0c56a548edd6f1270040b71ec366a1b328f13df5.tar.gz bcm5719-llvm-0c56a548edd6f1270040b71ec366a1b328f13df5.zip | |
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.
llvm-svn: 20228
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index e5266c294f8..285f810bfbe 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/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:: |

