aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-31 19:34:45 +0000
committerChris Lattner <sabre@nondot.org>2009-12-31 19:34:45 +0000
commit1e7558b65689999089f53ce40ff07564cf498c68 (patch)
treeed2e14a09fb2d6a3234138cc7cb359f3570266be /lib/Transforms
parentf8a447de162a2896a8a044931fb63de713dbc6b9 (diff)
make reassociate more careful about not leaving around dead mul's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92370 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index 8596dc70da..365c9f7958 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -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;