summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-07-06 14:52:36 +0000
committerSanjay Patel <spatel@rotateright.com>2018-07-06 14:52:36 +0000
commite6dda2fee7eb38ee035d4bcc32496bab89bd5967 (patch)
treea0aa8fe529e8fe430b164b04ee5ca71bfe6d0e2c /llvm/lib/IR
parentb3e06faa28b0457188960a96a7c8e6f90e4ff82e (diff)
downloadbcm5719-llvm-e6dda2fee7eb38ee035d4bcc32496bab89bd5967.tar.gz
bcm5719-llvm-e6dda2fee7eb38ee035d4bcc32496bab89bd5967.zip
[Constant] add undef element query for vector constants; NFC
This is likely to be used in D48987 and similar patches, so adding it as an NFC preliminary step. llvm-svn: 336442
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Constants.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index 3ea7598c11e..032793effed 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -254,6 +254,16 @@ bool Constant::isNaN() const {
return true;
}
+bool Constant::containsUndefElement() const {
+ if (!getType()->isVectorTy())
+ return false;
+ for (unsigned i = 0, e = getType()->getVectorNumElements(); i != e; ++i)
+ if (isa<UndefValue>(getAggregateElement(i)))
+ return true;
+
+ return false;
+}
+
/// Constructor to create a '0' constant of arbitrary type.
Constant *Constant::getNullValue(Type *Ty) {
switch (Ty->getTypeID()) {
OpenPOWER on IntegriCloud