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
This commit is contained in:
Chris Lattner 2005-02-17 19:40:32 +00:00
parent 1a84bd38ef
commit aa781b3404

View File

@ -852,7 +852,14 @@ static BasicBlock *IsOnlyUsedInOneBasicBlock(Argument *A) {
++UI) ++UI)
if (isa<PHINode>(*UI) || cast<Instruction>(*UI)->getParent() != BB) if (isa<PHINode>(*UI) || cast<Instruction>(*UI)->getParent() != BB)
return 0; // Disagreement among the users? return 0; // Disagreement among the users?
// 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 BB;
return 0;
} }
void SelectionDAGISel:: void SelectionDAGISel::