summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit1d8979422a8086dcc4a4f03a0e744edd56a70e91 (patch)
tree5a95d0f5bd429d474126d0dc6bfa1f84ff37e3fd /llvm/lib/Transforms
parented18917665cb1501d64692da405b7eecaedbf6e7 (diff)
downloadbcm5719-llvm-1d8979422a8086dcc4a4f03a0e744edd56a70e91.tar.gz
bcm5719-llvm-1d8979422a8086dcc4a4f03a0e744edd56a70e91.zip
make reassociate more careful about not leaving around dead mul's
llvm-svn: 92370
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/Reassociate.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp
index 8596dc70dad..365c9f79582 100644
--- a/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud