aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2020-04-21 14:22:13 -0400
committerSanjay Patel <spatel@rotateright.com>2020-04-21 14:23:06 -0400
commitcf30aafa2d1ed79daabe979fedf9c34affb8b2a0 (patch)
tree189f2a8843bbd81d7e48380c5344ab9cdacee4e7 /llvm/lib/Analysis/ValueTracking.cpp
parentb349098d2297f8637525ed162bf37506ed70d7c7 (diff)
downloadllvm-cf30aafa2d1ed79daabe979fedf9c34affb8b2a0.zip
llvm-cf30aafa2d1ed79daabe979fedf9c34affb8b2a0.tar.gz
llvm-cf30aafa2d1ed79daabe979fedf9c34affb8b2a0.tar.bz2
[Analysis] recognize the 'null' pointer constant as not poison
Differential Revision: https://reviews.llvm.org/D78575
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index f80ec73..e547447 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4693,8 +4693,9 @@ bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V,
if (isa<UndefValue>(C) || isa<ConstantExpr>(C))
return false;
- // TODO: Add ConstantFP and pointers.
- if (isa<ConstantInt>(C) || isa<GlobalVariable>(C) )
+ // TODO: Add ConstantFP.
+ if (isa<ConstantInt>(C) || isa<GlobalVariable>(C) ||
+ isa<ConstantPointerNull>(C))
return true;
if (C->getType()->isVectorTy())