extract some code into a method, no functionality change

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26755 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-03-14 07:11:11 +00:00
parent ad5a3a0265
commit 895b392269

View File

@ -78,6 +78,7 @@ namespace {
private:
void BuildRankMap(Function &F);
unsigned getRank(Value *V);
void ReassociateExpression(BinaryOperator *I);
void RewriteExprTree(BinaryOperator *I, unsigned Idx,
std::vector<ValueEntry> &Ops);
Value *OptimizeExpression(BinaryOperator *I, std::vector<ValueEntry> &Ops);
@ -752,6 +753,12 @@ void Reassociate::ReassociateBB(BasicBlock *BB) {
cast<Instruction>(I->use_back())->getOpcode() == Instruction::Sub)
continue;
ReassociateExpression(I);
}
}
void Reassociate::ReassociateExpression(BinaryOperator *I) {
// First, walk the expression tree, linearizing the tree, collecting
std::vector<ValueEntry> Ops;
LinearizeExprTree(I, Ops);
@ -775,7 +782,7 @@ void Reassociate::ReassociateBB(BasicBlock *BB) {
DEBUG(std::cerr << "Reassoc to scalar: " << *V << "\n");
I->replaceAllUsesWith(V);
RemoveDeadBinaryOp(I);
continue;
return;
}
// We want to sink immediates as deeply as possible except in the case where
@ -803,7 +810,6 @@ void Reassociate::ReassociateBB(BasicBlock *BB) {
// the expression tree, removing any unneeded nodes.
RewriteExprTree(I, 0, Ops);
}
}
}