summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/Reassociate.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-31 18:18:46 +0000
committerChris Lattner <sabre@nondot.org>2009-12-31 18:18:46 +0000
commit9cd1bc4f8b3e98892a2b9856eccd2a2ec9afdf7f (patch)
treec1efef8c4d11bf63fd0588f39eaf80a0c457f327 /lib/Transforms/Scalar/Reassociate.cpp
parent94285e620b845e09b18939e8d6448e01e692f3ce (diff)
downloadllvm-9cd1bc4f8b3e98892a2b9856eccd2a2ec9afdf7f.tar.gz
llvm-9cd1bc4f8b3e98892a2b9856eccd2a2ec9afdf7f.tar.bz2
llvm-9cd1bc4f8b3e98892a2b9856eccd2a2ec9afdf7f.tar.xz
change an if to an assert, fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92364 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index ce14c85fe2..a75d027c50 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -700,17 +700,17 @@ Value *Reassociate::OptimizeAdd(Instruction *I, std::vector<ValueEntry> &Ops) {
// Now that we have inserted V and its sole use, optimize it. This allows
// us to handle cases that require multiple factoring steps, such as this:
// A*A*B + A*A*C --> A*(A*B+A*C) --> A*(A*(B+C))
- if (NumAddedValues > 1)
- ReassociateExpression(cast<BinaryOperator>(V));
+ assert(NumAddedValues > 1 && "Each occurrence should contribute a value");
+ ReassociateExpression(cast<BinaryOperator>(V));
// If every add operand included the factor (e.g. "A*B + A*C"), then the
// entire result expression is just the multiply "A*(B+C)".
if (Ops.empty())
return V2;
- // Otherwise, we had some input that didn't have the fact, such as
+ // Otherwise, we had some input that didn't have the factor, such as
// "A*B + A*C + D" -> "A*(B+C) + D". Add the new multiply to the list of
- // things being added.
+ // things being added by this operation.
Ops.insert(Ops.begin(), ValueEntry(getRank(V2), V2));
}