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/Analysis/ConstantFolding.cpp | |
parent | cac129e6030095c33e95c5ce1cdcb9c5c21efce9 (diff) | |
parent | e4bbddaec8689e1b24f25e88958bea700e989542 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp b/contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp index f73890d548f0..cc1ce4c65821 100644 --- a/contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp +++ b/contrib/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp @@ -1808,19 +1808,6 @@ double getValueAsDouble(ConstantFP *Op) { return APF.convertToDouble(); } -static bool isManifestConstant(const Constant *c) { - if (isa<ConstantData>(c)) { - return true; - } else if (isa<ConstantAggregate>(c) || isa<ConstantExpr>(c)) { - for (const Value *subc : c->operand_values()) { - if (!isManifestConstant(cast<Constant>(subc))) - return false; - } - return true; - } - return false; -} - static bool getConstIntOrUndef(Value *Op, const APInt *&C) { if (auto *CI = dyn_cast<ConstantInt>(Op)) { C = &CI->getValue(); @@ -1845,7 +1832,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name, // We know we have a "Constant" argument. But we want to only // return true for manifest constants, not those that depend on // constants with unknowable values, e.g. GlobalValue or BlockAddress. - if (isManifestConstant(Operands[0])) + if (Operands[0]->isManifestConstant()) return ConstantInt::getTrue(Ty->getContext()); return nullptr; } |