From 82114b98c9da043d97a39a07255518dbc00ba522 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 6 Nov 2009 19:21:48 +0000 Subject: [PATCH] Fix a problem discovered on self host. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86278 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/JumpThreading.cpp | 2 +- test/Transforms/JumpThreading/crash.ll | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp index f52110f8851..4918b73c5fd 100644 --- a/lib/Transforms/Scalar/JumpThreading.cpp +++ b/lib/Transforms/Scalar/JumpThreading.cpp @@ -267,7 +267,7 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB,PredValueInfo &Result){ ConstantInt *CI = dyn_cast(V); Result.resize(TheFirstPHI->getNumIncomingValues()); for (unsigned i = 0, e = Result.size(); i != e; ++i) - Result.push_back(std::make_pair(CI, TheFirstPHI->getIncomingBlock(i))); + Result[i] = std::make_pair(CI, TheFirstPHI->getIncomingBlock(i)); return true; } diff --git a/test/Transforms/JumpThreading/crash.ll b/test/Transforms/JumpThreading/crash.ll index 862b40378bc..7e2a2a047d1 100644 --- a/test/Transforms/JumpThreading/crash.ll +++ b/test/Transforms/JumpThreading/crash.ll @@ -170,3 +170,25 @@ bb32.i: ret i32 1 } + +define fastcc void @test5(i1 %tmp, i32 %tmp1) nounwind ssp { +entry: + br i1 %tmp, label %bb12, label %bb13 + + +bb12: + br label %bb13 + +bb13: + %.lcssa31 = phi i32 [ undef, %bb12 ], [ %tmp1, %entry ] + %A = and i1 undef, undef + br i1 %A, label %bb15, label %bb61 + +bb15: + ret void + + +bb61: + ret void +} +