diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-06-19 10:06:00 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-06-19 18:09:28 +0000 |
commit | 23408297fbf3089f0388a8873b02fa75ab3f5bb9 (patch) | |
tree | 73e65506c89dcf58daeb8b774b921a8d688d133b /contrib/llvm-project/llvm/lib/IR/Constants.cpp | |
parent | cac129e6030095c33e95c5ce1cdcb9c5c21efce9 (diff) | |
parent | e4bbddaec8689e1b24f25e88958bea700e989542 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/IR/Constants.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/IR/Constants.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/lib/IR/Constants.cpp b/contrib/llvm-project/llvm/lib/IR/Constants.cpp index 6fd205c654a8..9f05917cf7cc 100644 --- a/contrib/llvm-project/llvm/lib/IR/Constants.cpp +++ b/contrib/llvm-project/llvm/lib/IR/Constants.cpp @@ -803,6 +803,18 @@ Constant *Constant::mergeUndefsWith(Constant *C, Constant *Other) { return C; } +bool Constant::isManifestConstant() const { + if (isa<ConstantData>(this)) + return true; + if (isa<ConstantAggregate>(this) || isa<ConstantExpr>(this)) { + for (const Value *Op : operand_values()) + if (!cast<Constant>(Op)->isManifestConstant()) + return false; + return true; + } + return false; +} + //===----------------------------------------------------------------------===// // ConstantInt //===----------------------------------------------------------------------===// |