diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index d5ce86aca0c8..de4c118b69dd 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -350,8 +350,9 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB,PredValueInfo &Result){ // Invert the known values. for (unsigned i = 0, e = Result.size(); i != e; ++i) - Result[i].first = - cast(ConstantExpr::getNot(Result[i].first)); + if (Result[i].first) + Result[i].first = + cast(ConstantExpr::getNot(Result[i].first)); return true; } }