aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-01-26 08:40:22 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-01-26 08:40:22 +0000
commitd9e6b4a8ff25a2756c438edbec2114797fc280f3 (patch)
tree1dc3d39c41350c599ab32ac45a50d13cdd768ba5 /llvm/lib/Analysis/ScalarEvolution.cpp
parentdb9d66424425ad4d00c3bb499ad913beaeeda0f1 (diff)
downloadllvm-d9e6b4a8ff25a2756c438edbec2114797fc280f3.zip
llvm-d9e6b4a8ff25a2756c438edbec2114797fc280f3.tar.gz
llvm-d9e6b4a8ff25a2756c438edbec2114797fc280f3.tar.bz2
Fix memory corruption. If one of the SCEV creation functions calls another but
doesn't return immediately after then the insert position in UniqueSCEVs will be out of date. No test because this is a memory corruption issue. Fixes PR9051! llvm-svn: 124282
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index c10af50..c2f3ac0 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -831,6 +831,7 @@ const SCEV *ScalarEvolution::getTruncateExpr(const SCEV *Op,
}
if (!hasTrunc)
return getAddExpr(Operands, false, false);
+ UniqueSCEVs.FindNodeOrInsertPos(ID, IP); // Mutates IP, returns NULL.
}
// trunc(x1*x2*...*xN) --> trunc(x1)*trunc(x2)*...*trunc(xN) if we can
@@ -845,6 +846,7 @@ const SCEV *ScalarEvolution::getTruncateExpr(const SCEV *Op,
}
if (!hasTrunc)
return getMulExpr(Operands, false, false);
+ UniqueSCEVs.FindNodeOrInsertPos(ID, IP); // Mutates IP, returns NULL.
}
// If the input value is a chrec scev, truncate the chrec's operands.