summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Constants.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-10-29 09:25:36 -0400
committerSanjay Patel <spatel@rotateright.com>2019-10-29 09:28:47 -0400
commit09feea972d0f2c7b4f16719f3c70ac0795770330 (patch)
tree6ec5808f89ecb96925fd995af6c80d201b378c87 /llvm/lib/IR/Constants.cpp
parentc6e04328814168c32764eb33736ee900b84996fe (diff)
downloadbcm5719-llvm-09feea972d0f2c7b4f16719f3c70ac0795770330.tar.gz
bcm5719-llvm-09feea972d0f2c7b4f16719f3c70ac0795770330.zip
[IR] move/change null-check to assert
This should trigger a dereference before null-check warning, but I don't see it when building with clang. In any case, the current and known future users of this helper require non-null args, so I'm converting the 'if' to an assert.
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r--llvm/lib/IR/Constants.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index ab4e478f700..eb40b291b00 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -596,8 +596,9 @@ void Constant::removeDeadConstantUsers() const {
}
Constant *Constant::replaceUndefsWith(Constant *C, Constant *Replacement) {
+ assert(C && Replacement && "Expected non-nullptr constant arguments");
Type *Ty = C->getType();
- if (C && match(C, m_Undef())) {
+ if (match(C, m_Undef())) {
assert(Ty == Replacement->getType() && "Expected matching types");
return Replacement;
}
OpenPOWER on IntegriCloud