make reassociate more careful about not leaving around dead mul's

llvm-svn: 92370
This commit is contained in:
Chris Lattner 2009-12-31 19:34:45 +00:00
parent ed18917665
commit 1d8979422a
1 changed files with 7 additions and 1 deletions

View File

@ -530,7 +530,13 @@ Value *Reassociate::RemoveFactorFromExpression(Value *V, Value *Factor) {
return 0;
}
if (Factors.size() == 1) return Factors[0].Op;
// If this was just a single multiply, remove the multiply and return the only
// remaining operand.
if (Factors.size() == 1) {
ValueRankMap.erase(BO);
BO->eraseFromParent();
return Factors[0].Op;
}
RewriteExprTree(BO, Factors);
return BO;