summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-02 21:46:33 +0000
committerChris Lattner <sabre@nondot.org>2010-01-02 21:46:33 +0000
commite199d2df80f9b4ea707d6a8b81bca40cfa443233 (patch)
tree8c6d7bb1c3d42394728db76dff2ac4bcac19f8d5 /llvm/lib/Transforms/Scalar
parentd423dcc9bd1830155123628afa5d31922c1779bf (diff)
downloadbcm5719-llvm-e199d2df80f9b4ea707d6a8b81bca40cfa443233.tar.gz
bcm5719-llvm-e199d2df80f9b4ea707d6a8b81bca40cfa443233.zip
theoretically the negate we find could be in a different function, check
for this case. llvm-svn: 92425
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/Reassociate.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp
index 827b47d3fee..71d787a839a 100644
--- a/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -414,6 +414,10 @@ static Value *NegateValue(Value *V, Instruction *BI) {
// non-instruction value) or right after the definition. These negates will
// be zapped by reassociate later, so we don't need much finesse here.
BinaryOperator *TheNeg = cast<BinaryOperator>(*UI);
+
+ // Verify that the negate is in this function, V might be a constant expr.
+ if (TheNeg->getParent()->getParent() != BI->getParent()->getParent())
+ continue;
BasicBlock::iterator InsertPt;
if (Instruction *InstInput = dyn_cast<Instruction>(V)) {
OpenPOWER on IntegriCloud