Index: lib/Analysis/ScalarEvolution.cpp =================================================================== --- lib/Analysis/ScalarEvolution.cpp +++ 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 getZero(V->getType()); } else if (ConstantInt *CI = dyn_cast(V)) return getConstant(CI); else if (isa(V)) Index: test/Analysis/ScalarEvolution/unreachable-code.ll =================================================================== --- test/Analysis/ScalarEvolution/unreachable-code.ll +++ 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: --> 0 define void @foo() { entry: