aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-05-22 16:47:11 +0000
committerDan Gohman <gohman@apple.com>2009-05-22 16:47:11 +0000
commitd6d0294e35c120bd2e78198f54caaa3c0f70f9fe (patch)
treedcc7c2cb96315718b30a83a9c20dfa9717d288a7 /lib/Transforms
parenta57bc3ba02a470ee8cf70f50389489aa80c703cb (diff)
downloadexternal_llvm-d6d0294e35c120bd2e78198f54caaa3c0f70f9fe.zip
external_llvm-d6d0294e35c120bd2e78198f54caaa3c0f70f9fe.tar.gz
external_llvm-d6d0294e35c120bd2e78198f54caaa3c0f70f9fe.tar.bz2
Teach IndVarSimplify's FixUsesBeforeDefs to handle InvokeInsts by
assuming that the use of the value is in a block dominated by the "normal" destination. LangRef.html and other documentation sources don't explicitly guarantee this, but it seems to be assumed in other places in LLVM at least. This fixes an assertion failure on the included testcase, which is derived from the Ada testsuite. FixUsesBeforeDefs is a temporary measure which I'm looking to replace with a more capable solution. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72266 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 26015cf..89742c5 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -662,7 +662,11 @@ void IndVarSimplify::FixUsesBeforeDefs(Loop *L, SCEVExpander &Rewriter) {
if (Z != NumPredsLeft.end() && Z->second != 0 && --Z->second == 0) {
SmallVector<Instruction *, 4> UseWorkList;
UseWorkList.push_back(Inst);
- BasicBlock::iterator InsertPt = next(I);
+ BasicBlock::iterator InsertPt = I;
+ if (InvokeInst *II = dyn_cast<InvokeInst>(InsertPt))
+ InsertPt = II->getNormalDest()->begin();
+ else
+ ++InsertPt;
while (isa<PHINode>(InsertPt)) ++InsertPt;
do {
Instruction *Use = UseWorkList.pop_back_val();