aboutsummaryrefslogtreecommitdiffstats
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
commit935f545222cf00cdcfabaedce1033b0b01000bea (patch)
tree31149d40b0a7238e732805ad540edf50c5d7cfbb
parenta9bfe6138e5559bd1da6b85abddb63dd0c0b8568 (diff)
downloadexternal_llvm-935f545222cf00cdcfabaedce1033b0b01000bea.zip
external_llvm-935f545222cf00cdcfabaedce1033b0b01000bea.tar.gz
external_llvm-935f545222cf00cdcfabaedce1033b0b01000bea.tar.bz2
theoretically the negate we find could be in a different function, check
for this case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92425 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index 827b47d..71d787a 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/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)) {