[InstSimplify] Replace calls to null with undef
Calling null is undefined behavior, we can simplify the resulting value
to undef.
llvm-svn: 273777
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 746b740..b52ffee 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4009,7 +4009,8 @@
FunctionType *FTy = cast<FunctionType>(Ty);
// call undef -> undef
- if (isa<UndefValue>(V))
+ // call null -> undef
+ if (isa<UndefValue>(V) || isa<ConstantPointerNull>(V))
return UndefValue::get(FTy->getReturnType());
Function *F = dyn_cast<Function>(V);