Index: llvm/trunk/lib/Analysis/ScalarEvolution.cpp =================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp @@ -6144,7 +6144,7 @@ // to obey basic rules for definitions dominating uses which this // analysis depends on. if (!DT.isReachableFromEntry(I->getParent())) - return getUnknown(V); + return getUnknown(UndefValue::get(V->getType())); } else if (ConstantInt *CI = dyn_cast(V)) return getConstant(CI); else if (isa(V)) Index: llvm/trunk/test/Analysis/ScalarEvolution/unreachable-code.ll =================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/unreachable-code.ll +++ llvm/trunk/test/Analysis/ScalarEvolution/unreachable-code.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s ; CHECK: %t = add i64 %t, 1 -; CHECK: --> %t +; CHECK: --> undef define void @foo() { entry: