Skip to content

Commit

Permalink
[flang] Fixed buildbot failured after D140236.
Browse files Browse the repository at this point in the history
Removed unused functions searchFunctionInLibrary and getFuncOp.

Differential Revision: https://reviews.llvm.org/D140236
  • Loading branch information
vzakhari committed Dec 17, 2022
1 parent b926e35 commit 1a9dec0
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions flang/lib/Lower/IntrinsicCall.cpp
Expand Up @@ -1686,44 +1686,6 @@ class FunctionDistance {
bool infinite = false; // When forbidden conversion or wrong argument number
};

/// Build mlir::func::FuncOp from runtime symbol description and add
/// fir.runtime attribute.
static mlir::func::FuncOp getFuncOp(mlir::Location loc,
fir::FirOpBuilder &builder,
const RuntimeFunction &runtime) {
mlir::func::FuncOp function = builder.addNamedFunction(
loc, runtime.symbol, runtime.typeGenerator(builder.getContext()));
function->setAttr("fir.runtime", builder.getUnitAttr());
return function;
}

/// Select runtime function that has the smallest distance to the intrinsic
/// function type and that will not imply narrowing arguments or extending the
/// result.
/// If nothing is found, the mlir::func::FuncOp will contain a nullptr.
static mlir::func::FuncOp searchFunctionInLibrary(
mlir::Location loc, fir::FirOpBuilder &builder,
const Fortran::common::StaticMultimapView<RuntimeFunction> &lib,
llvm::StringRef name, mlir::FunctionType funcType,
const RuntimeFunction **bestNearMatch,
FunctionDistance &bestMatchDistance) {
std::pair<const RuntimeFunction *, const RuntimeFunction *> range =
lib.equal_range(name);
for (auto iter = range.first; iter != range.second && iter; ++iter) {
const RuntimeFunction &impl = *iter;
mlir::FunctionType implType = impl.typeGenerator(builder.getContext());
if (funcType == implType)
return getFuncOp(loc, builder, impl); // exact match

FunctionDistance distance(funcType, implType);
if (distance.isSmallerThan(bestMatchDistance)) {
*bestNearMatch = &impl;
bestMatchDistance = std::move(distance);
}
}
return {};
}

using RtMap = Fortran::common::StaticMultimapView<MathOperation>;
static constexpr RtMap mathOps(mathOperations);
static_assert(mathOps.Verify() && "map must be sorted");
Expand Down

0 comments on commit 1a9dec0

Please sign in to comment.