summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-06-25 07:37:30 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-06-25 07:37:30 +0000
commitbb53d23ef8127b0be819b730e5094bd1d4b8e515 (patch)
tree625378805831c8775357f4cc7ff0f2eb834a7511 /llvm/lib
parent1fea77c6fc6ab0d5557078656be6c54eba769b42 (diff)
downloadbcm5719-llvm-bb53d23ef8127b0be819b730e5094bd1d4b8e515.tar.gz
bcm5719-llvm-bb53d23ef8127b0be819b730e5094bd1d4b8e515.zip
[InstSimplify] Replace calls to null with undef
Calling null is undefined behavior, we can simplify the resulting value to undef. llvm-svn: 273777
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 746b7409dfe..b52ffeebe61 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4009,7 +4009,8 @@ static Value *SimplifyCall(Value *V, IterTy ArgBegin, IterTy ArgEnd,
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);
OpenPOWER on IntegriCloud