diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-06-18 19:08:25 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-06-18 19:08:25 +0000 |
| commit | e4bbddaec8689e1b24f25e88958bea700e989542 (patch) | |
| tree | 054adb83b829924d4a01d719429d91d42d885e77 /llvm/lib/Analysis/ConstantFolding.cpp | |
| parent | b4125f7d51da2bb55d3b850dba9a69c201c3422c (diff) | |
Vendor import of llvm-project branch release/12.x llvmorg-12.0.1-rc2-0-ge7dac564cd0e, a.k.a. 12.0.1 rc2.llvmorg-12.0.1-rc2-0-ge7dac564cd0e
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
| -rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index f73890d548f0..cc1ce4c65821 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/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; } |
