[Mlir-commits] [mlir] Revert "[mlir][math] Add FP software implementation lowering pass: math-to-apfloat" (PR #172714)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Dec 17 10:53:26 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-func
Author: Maksim Levental (makslevental)
<details>
<summary>Changes</summary>
Reverts llvm/llvm-project#<!-- -->171221
Broken builder https://lab.llvm.org/buildbot/#/builders/138/builds/23270
---
Patch is 42.84 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/172714.diff
17 Files Affected:
- (removed) mlir/include/mlir/Conversion/MathToAPFloat/MathToAPFloat.h (-21)
- (modified) mlir/include/mlir/Conversion/Passes.h (-1)
- (modified) mlir/include/mlir/Conversion/Passes.td (-15)
- (modified) mlir/include/mlir/Dialect/Func/Utils/Utils.h (-16)
- (removed) mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeLists.txt (-49)
- (removed) mlir/lib/Conversion/ArithAndMathToAPFloat/MathToAPFloat.cpp (-219)
- (removed) mlir/lib/Conversion/ArithAndMathToAPFloat/Utils.cpp (-22)
- (removed) mlir/lib/Conversion/ArithAndMathToAPFloat/Utils.h (-21)
- (renamed) mlir/lib/Conversion/ArithToAPFloat/ArithToAPFloat.cpp (+67-25)
- (added) mlir/lib/Conversion/ArithToAPFloat/CMakeLists.txt (+19)
- (modified) mlir/lib/Conversion/CMakeLists.txt (+1-1)
- (modified) mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp (+2-5)
- (modified) mlir/lib/Dialect/Func/Utils/Utils.cpp (-39)
- (modified) mlir/lib/ExecutionEngine/APFloatWrappers.cpp (+1-64)
- (removed) mlir/test/Conversion/ArithAndMathToAPFloat/math-to-apfloat.mlir (-66)
- (renamed) mlir/test/Conversion/ArithToApfloat/arith-to-apfloat.mlir ()
- (removed) mlir/test/Integration/Dialect/Math/CPU/test-apfloat-emulation.mlir (-68)
``````````diff
diff --git a/mlir/include/mlir/Conversion/MathToAPFloat/MathToAPFloat.h b/mlir/include/mlir/Conversion/MathToAPFloat/MathToAPFloat.h
deleted file mode 100644
index 86179a1611d5e..0000000000000
--- a/mlir/include/mlir/Conversion/MathToAPFloat/MathToAPFloat.h
+++ /dev/null
@@ -1,21 +0,0 @@
-//===- MathToAPFloat.h - Math to APFloat impl conversion ---*- C++ ------*-===//
-//
-// Part of the APFloat Project, under the Apache License v2.0 with APFloat
-// Exceptions. See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH APFloat-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MLIR_CONVERSION_MATHTOAPFLOAT_MATHTOAPFLOAT_H
-#define MLIR_CONVERSION_MATHTOAPFLOAT_MATHTOAPFLOAT_H
-
-#include <memory>
-
-namespace mlir {
-class Pass;
-
-#define GEN_PASS_DECL_MATHTOAPFLOATCONVERSIONPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
-#endif // MLIR_CONVERSION_MATHTOAPFLOAT_MATHTOAPFLOAT_H
diff --git a/mlir/include/mlir/Conversion/Passes.h b/mlir/include/mlir/Conversion/Passes.h
index 05ec2f8ce2538..82bdfd02661a6 100644
--- a/mlir/include/mlir/Conversion/Passes.h
+++ b/mlir/include/mlir/Conversion/Passes.h
@@ -44,7 +44,6 @@
#include "mlir/Conversion/IndexToLLVM/IndexToLLVM.h"
#include "mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h"
#include "mlir/Conversion/LinalgToStandard/LinalgToStandard.h"
-#include "mlir/Conversion/MathToAPFloat/MathToAPFloat.h"
#include "mlir/Conversion/MathToEmitC/MathToEmitCPass.h"
#include "mlir/Conversion/MathToFuncs/MathToFuncs.h"
#include "mlir/Conversion/MathToLLVM/MathToLLVM.h"
diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td
index 7f24e58671aab..fcbaf3ccc1486 100644
--- a/mlir/include/mlir/Conversion/Passes.td
+++ b/mlir/include/mlir/Conversion/Passes.td
@@ -775,21 +775,6 @@ def ConvertMathToLibmPass : Pass<"convert-math-to-libm", "ModuleOp"> {
];
}
-//===----------------------------------------------------------------------===//
-// MathToAPFloat
-//===----------------------------------------------------------------------===//
-
-def MathToAPFloatConversionPass
- : Pass<"convert-math-to-apfloat", "ModuleOp"> {
- let summary = "Convert Math ops to APFloat runtime library calls";
- let description = [{
- This pass converts supported Math ops to APFloat-based runtime library
- calls (APFloatWrappers.cpp). APFloat is a software implementation of
- floating-point mathmetic operations.
- }];
- let dependentDialects = ["math::MathDialect", "func::FuncDialect"];
-}
-
//===----------------------------------------------------------------------===//
// MathToLLVM
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Dialect/Func/Utils/Utils.h b/mlir/include/mlir/Dialect/Func/Utils/Utils.h
index 079c1f461b6ed..00d50874a2e8d 100644
--- a/mlir/include/mlir/Dialect/Func/Utils/Utils.h
+++ b/mlir/include/mlir/Dialect/Func/Utils/Utils.h
@@ -67,22 +67,6 @@ FailureOr<FuncOp> lookupFnDecl(SymbolOpInterface symTable, StringRef name,
FunctionType funcT,
SymbolTableCollection *symbolTables = nullptr);
-/// Create a FuncOp decl and insert it into `symTable` operation. If
-/// `symbolTables` is provided, then the decl will be inserted into the
-/// SymbolTableCollection.
-FuncOp createFnDecl(OpBuilder &b, SymbolOpInterface symTable, StringRef name,
- FunctionType funcT, bool setPrivate,
- SymbolTableCollection *symbolTables = nullptr);
-
-/// Helper function to look up or create the symbol for a runtime library
-/// function with the given parameter types. Returns an int64_t, unless a
-/// different result type is specified.
-FailureOr<FuncOp>
-lookupOrCreateFnDecl(OpBuilder &b, SymbolOpInterface symTable, StringRef name,
- TypeRange paramTypes,
- SymbolTableCollection *symbolTables = nullptr,
- Type resultType = {});
-
} // namespace func
} // namespace mlir
diff --git a/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeLists.txt b/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeLists.txt
deleted file mode 100644
index bad8226ac88ec..0000000000000
--- a/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeLists.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-add_mlir_library(ArithAndMathToAPFloatUtils
- Utils.cpp
- PARTIAL_SOURCES_INTENDED
-
- LINK_LIBS PUBLIC
- MLIRArithDialect
- )
-
-add_mlir_conversion_library(MLIRArithToAPFloat
- ArithToAPFloat.cpp
- PARTIAL_SOURCES_INTENDED
-
- ADDITIONAL_HEADER_DIRS
- ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/ArithToLLVM
-
- DEPENDS
- MLIRConversionPassIncGen
-
- LINK_COMPONENTS
- Core
-
- LINK_LIBS PUBLIC
- ArithAndMathToAPFloatUtils
- MLIRArithDialect
- MLIRArithTransforms
- MLIRFuncDialect
- MLIRFuncUtils
- MLIRVectorDialect
- )
-
-add_mlir_conversion_library(MLIRMathToAPFloat
- MathToAPFloat.cpp
- PARTIAL_SOURCES_INTENDED
-
- ADDITIONAL_HEADER_DIRS
- ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/MathToLLVM
-
- DEPENDS
- MLIRConversionPassIncGen
-
- LINK_COMPONENTS
- Core
-
- LINK_LIBS PUBLIC
- ArithAndMathToAPFloatUtils
- MLIRMathDialect
- MLIRFuncDialect
- MLIRFuncUtils
- )
diff --git a/mlir/lib/Conversion/ArithAndMathToAPFloat/MathToAPFloat.cpp b/mlir/lib/Conversion/ArithAndMathToAPFloat/MathToAPFloat.cpp
deleted file mode 100644
index 20d82863c518e..0000000000000
--- a/mlir/lib/Conversion/ArithAndMathToAPFloat/MathToAPFloat.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-//===- MathToAPFloat.cpp - Mathmetic to APFloat Conversion ----------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "mlir/Conversion/MathToAPFloat/MathToAPFloat.h"
-#include "Utils.h"
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Dialect/Func/Utils/Utils.h"
-#include "mlir/Dialect/Math/IR/Math.h"
-#include "mlir/Dialect/Math/Transforms/Passes.h"
-#include "mlir/Dialect/Vector/IR/VectorOps.h"
-#include "mlir/IR/PatternMatch.h"
-#include "mlir/IR/Verifier.h"
-#include "mlir/Transforms/WalkPatternRewriteDriver.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_MATHTOAPFLOATCONVERSIONPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
-using namespace mlir;
-using namespace mlir::func;
-
-struct AbsFOpToAPFloatConversion final : OpRewritePattern<math::AbsFOp> {
- AbsFOpToAPFloatConversion(MLIRContext *context, SymbolOpInterface symTable,
- PatternBenefit benefit = 1)
- : OpRewritePattern<math::AbsFOp>(context, benefit), symTable(symTable) {}
-
- LogicalResult matchAndRewrite(math::AbsFOp op,
- PatternRewriter &rewriter) const override {
- // Cast operands to 64-bit integers.
- auto operand = op.getOperand();
- auto floatTy = dyn_cast<FloatType>(operand.getType());
- if (!floatTy)
- return rewriter.notifyMatchFailure(op,
- "only scalar FloatTypes supported");
- if (floatTy.getIntOrFloatBitWidth() > 64) {
- return rewriter.notifyMatchFailure(op,
- "bitwidth > 64 bits is not supported");
- }
- // Get APFloat function from runtime library.
- auto i32Type = IntegerType::get(symTable->getContext(), 32);
- auto i64Type = IntegerType::get(symTable->getContext(), 64);
- FailureOr<FuncOp> fn = lookupOrCreateFnDecl(
- rewriter, symTable, "_mlir_apfloat_abs", {i32Type, i64Type});
- if (failed(fn))
- return fn;
- Location loc = op.getLoc();
- rewriter.setInsertionPoint(op);
- auto intWType = rewriter.getIntegerType(floatTy.getWidth());
- Value operandBits = arith::ExtUIOp::create(
- rewriter, loc, i64Type,
- arith::BitcastOp::create(rewriter, loc, intWType, operand));
-
- // Call APFloat function.
- Value semValue = getAPFloatSemanticsValue(rewriter, loc, floatTy);
- SmallVector<Value> params = {semValue, operandBits};
- Value negatedBits = func::CallOp::create(rewriter, loc, TypeRange(i64Type),
- SymbolRefAttr::get(*fn), params)
- ->getResult(0);
-
- // Truncate result to the original width.
- Value truncatedBits =
- arith::TruncIOp::create(rewriter, loc, intWType, negatedBits);
- rewriter.replaceOp(
- op, arith::BitcastOp::create(rewriter, loc, floatTy, truncatedBits));
- return success();
- }
-
- SymbolOpInterface symTable;
-};
-
-template <typename OpTy>
-struct IsOpToAPFloatConversion final : OpRewritePattern<OpTy> {
- IsOpToAPFloatConversion(MLIRContext *context, const char *APFloatName,
- SymbolOpInterface symTable,
- PatternBenefit benefit = 1)
- : OpRewritePattern<OpTy>(context, benefit), symTable(symTable),
- APFloatName(APFloatName) {};
-
- LogicalResult matchAndRewrite(OpTy op,
- PatternRewriter &rewriter) const override {
- // Cast operands to 64-bit integers.
- auto operand = op.getOperand();
- auto floatTy = dyn_cast<FloatType>(operand.getType());
- if (!floatTy)
- return rewriter.notifyMatchFailure(op,
- "only scalar FloatTypes supported");
- if (floatTy.getIntOrFloatBitWidth() > 64) {
- return rewriter.notifyMatchFailure(op,
- "bitwidth > 64 bits is not supported");
- }
- // Get APFloat function from runtime library.
- auto i1 = IntegerType::get(symTable->getContext(), 1);
- auto i32Type = IntegerType::get(symTable->getContext(), 32);
- auto i64Type = IntegerType::get(symTable->getContext(), 64);
- std::string funcName =
- (llvm::Twine("_mlir_apfloat_is") + APFloatName).str();
- FailureOr<FuncOp> fn = lookupOrCreateFnDecl(
- rewriter, symTable, funcName, {i32Type, i64Type}, nullptr, i1);
- if (failed(fn))
- return fn;
- Location loc = op.getLoc();
- rewriter.setInsertionPoint(op);
- auto intWType = rewriter.getIntegerType(floatTy.getWidth());
- Value operandBits = arith::ExtUIOp::create(
- rewriter, loc, i64Type,
- arith::BitcastOp::create(rewriter, loc, intWType, operand));
-
- // Call APFloat function.
- Value semValue = getAPFloatSemanticsValue(rewriter, loc, floatTy);
- SmallVector<Value> params = {semValue, operandBits};
- rewriter.replaceOpWithNewOp<func::CallOp>(op, TypeRange(i1),
- SymbolRefAttr::get(*fn), params);
- return success();
- }
-
- SymbolOpInterface symTable;
- const char *APFloatName;
-};
-
-struct FmaOpToAPFloatConversion final : OpRewritePattern<math::FmaOp> {
- FmaOpToAPFloatConversion(MLIRContext *context, SymbolOpInterface symTable,
- PatternBenefit benefit = 1)
- : OpRewritePattern<math::FmaOp>(context, benefit), symTable(symTable) {};
-
- LogicalResult matchAndRewrite(math::FmaOp op,
- PatternRewriter &rewriter) const override {
- // Cast operands to 64-bit integers.
- auto floatTy = cast<FloatType>(op.getResult().getType());
- if (!floatTy)
- return rewriter.notifyMatchFailure(op,
- "only scalar FloatTypes supported");
- if (floatTy.getIntOrFloatBitWidth() > 64) {
- return rewriter.notifyMatchFailure(op,
- "bitwidth > 64 bits is not supported");
- }
-
- auto i32Type = IntegerType::get(symTable->getContext(), 32);
- auto i64Type = IntegerType::get(symTable->getContext(), 64);
- FailureOr<FuncOp> fn = lookupOrCreateFnDecl(
- rewriter, symTable, "_mlir_apfloat_fused_multiply_add",
- {i32Type, i64Type, i64Type, i64Type});
- if (failed(fn))
- return fn;
- Location loc = op.getLoc();
- rewriter.setInsertionPoint(op);
-
- auto intWType = rewriter.getIntegerType(floatTy.getWidth());
- auto int64Type = rewriter.getI64Type();
- Value operand = arith::ExtUIOp::create(
- rewriter, loc, int64Type,
- arith::BitcastOp::create(rewriter, loc, intWType, op.getA()));
- Value multiplicand = arith::ExtUIOp::create(
- rewriter, loc, int64Type,
- arith::BitcastOp::create(rewriter, loc, intWType, op.getB()));
- Value addend = arith::ExtUIOp::create(
- rewriter, loc, int64Type,
- arith::BitcastOp::create(rewriter, loc, intWType, op.getC()));
-
- // Call APFloat function.
- Value semValue = getAPFloatSemanticsValue(rewriter, loc, floatTy);
- SmallVector<Value> params = {semValue, operand, multiplicand, addend};
- auto resultOp =
- func::CallOp::create(rewriter, loc, TypeRange(rewriter.getI64Type()),
- SymbolRefAttr::get(*fn), params);
-
- // Truncate result to the original width.
- Value truncatedBits = arith::TruncIOp::create(rewriter, loc, intWType,
- resultOp->getResult(0));
- rewriter.replaceOpWithNewOp<arith::BitcastOp>(op, floatTy, truncatedBits);
- return success();
- }
-
- SymbolOpInterface symTable;
-};
-
-namespace {
-struct MathToAPFloatConversionPass final
- : impl::MathToAPFloatConversionPassBase<MathToAPFloatConversionPass> {
- using Base::Base;
-
- void runOnOperation() override;
-};
-
-void MathToAPFloatConversionPass::runOnOperation() {
- MLIRContext *context = &getContext();
- RewritePatternSet patterns(context);
-
- patterns.add<AbsFOpToAPFloatConversion>(context, getOperation());
- patterns.add<IsOpToAPFloatConversion<math::IsFiniteOp>>(context, "finite",
- getOperation());
- patterns.add<IsOpToAPFloatConversion<math::IsInfOp>>(context, "infinite",
- getOperation());
- patterns.add<IsOpToAPFloatConversion<math::IsNaNOp>>(context, "nan",
- getOperation());
- patterns.add<IsOpToAPFloatConversion<math::IsNormalOp>>(context, "normal",
- getOperation());
- patterns.add<FmaOpToAPFloatConversion>(context, getOperation());
-
- LogicalResult result = success();
- ScopedDiagnosticHandler scopedHandler(context, [&result](Diagnostic &diag) {
- if (diag.getSeverity() == DiagnosticSeverity::Error) {
- result = failure();
- }
- // NB: if you don't return failure, no other diag handlers will fire (see
- // mlir/lib/IR/Diagnostics.cpp:DiagnosticEngineImpl::emit).
- return failure();
- });
- walkAndApplyPatterns(getOperation(), std::move(patterns));
- if (failed(result))
- return signalPassFailure();
-}
-} // namespace
diff --git a/mlir/lib/Conversion/ArithAndMathToAPFloat/Utils.cpp b/mlir/lib/Conversion/ArithAndMathToAPFloat/Utils.cpp
deleted file mode 100644
index 2b5857367dc40..0000000000000
--- a/mlir/lib/Conversion/ArithAndMathToAPFloat/Utils.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===- Utils.cpp - Utils for APFloat Conversion ---------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "Utils.h"
-
-#include "mlir/Dialect/Arith/IR/Arith.h"
-#include "mlir/IR/Builders.h"
-#include "mlir/IR/BuiltinTypeInterfaces.h"
-#include "mlir/IR/Location.h"
-#include "mlir/IR/Value.h"
-
-mlir::Value mlir::getAPFloatSemanticsValue(OpBuilder &b, Location loc,
- FloatType floatTy) {
- int32_t sem = llvm::APFloatBase::SemanticsToEnum(floatTy.getFloatSemantics());
- return arith::ConstantOp::create(b, loc, b.getI32Type(),
- b.getIntegerAttr(b.getI32Type(), sem));
-}
diff --git a/mlir/lib/Conversion/ArithAndMathToAPFloat/Utils.h b/mlir/lib/Conversion/ArithAndMathToAPFloat/Utils.h
deleted file mode 100644
index 5f11d24261b43..0000000000000
--- a/mlir/lib/Conversion/ArithAndMathToAPFloat/Utils.h
+++ /dev/null
@@ -1,21 +0,0 @@
-//===- Utils.h - Utils for APFloat Conversion - C++ -----------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MLIR_CONVERSION_ARITHANDMATHTOAPFLOAT_UTILS_H_
-#define MLIR_CONVERSION_ARITHANDMATHTOAPFLOAT_UTILS_H_
-
-namespace mlir {
-class Value;
-class OpBuilder;
-class Location;
-class FloatType;
-
-Value getAPFloatSemanticsValue(OpBuilder &b, Location loc, FloatType floatTy);
-} // namespace mlir
-
-#endif // MLIR_CONVERSION_ARITHANDMATHTOAPFLOAT_UTILS_H_
diff --git a/mlir/lib/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.cpp b/mlir/lib/Conversion/ArithToAPFloat/ArithToAPFloat.cpp
similarity index 88%
rename from mlir/lib/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.cpp
rename to mlir/lib/Conversion/ArithToAPFloat/ArithToAPFloat.cpp
index b9ba94ef08098..79816fc6e3bf1 100644
--- a/mlir/lib/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.cpp
+++ b/mlir/lib/Conversion/ArithToAPFloat/ArithToAPFloat.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/ArithToAPFloat/ArithToAPFloat.h"
-#include "Utils.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Arith/Transforms/Passes.h"
@@ -26,6 +25,47 @@ namespace mlir {
using namespace mlir;
using namespace mlir::func;
+static FuncOp createFnDecl(OpBuilder &b, SymbolOpInterface symTable,
+ StringRef name, FunctionType funcT, bool setPrivate,
+ SymbolTableCollection *symbolTables = nullptr) {
+ OpBuilder::InsertionGuard g(b);
+ assert(!symTable->getRegion(0).empty() && "expected non-empty region");
+ b.setInsertionPointToStart(&symTable->getRegion(0).front());
+ FuncOp funcOp = FuncOp::create(b, symTable->getLoc(), name, funcT);
+ if (setPrivate)
+ funcOp.setPrivate();
+ if (symbolTables) {
+ SymbolTable &symbolTable = symbolTables->getSymbolTable(symTable);
+ symbolTable.insert(funcOp, symTable->getRegion(0).front().begin());
+ }
+ return funcOp;
+}
+
+/// Helper function to look up or create the symbol for a runtime library
+/// function with the given parameter types. Returns an int64_t, unless a
+/// different result type is specified.
+static FailureOr<FuncOp>
+lookupOrCreateApFloatFn(OpBuilder &b, SymbolOpInterface symTable,
+ StringRef name, TypeRange paramTypes,
+ SymbolTableCollection *symbolTables = nullptr,
+ Type resultType = {}) {
+ if (!resultType)
+ resultType = IntegerType::get(symTable->getContext(), 64);
+ std::string funcName = (llvm::Twine("_mlir_apfloat_") + name).str();
+ auto funcT = FunctionType::get(b.getContext(), paramTypes, {resultType});
+ FailureOr<FuncOp> func =
+ lookupFnDecl(symTable, funcName, funcT, symbolTables);
+ // Failed due to type mismatch.
+ if (failed(func))
+ return func;
+ // Successfully matched existing decl.
+ if (*func)
+ return *func;
+
+ return createFnDecl(b, symTable, funcName, funcT,
+ /*setPrivate=*/true, symbolTables);
+}
+
/// Helper function to look up or create the symbol for a runtime library
/// function for a binary arithmetic operation.
///
@@ -41,9 +81,14 @@ lookupOrCreateBinaryFn(OpBuilder &b, SymbolOpInterface symTable, StringRef name,
SymbolTableCollection *symbolTables = nullptr) {
auto i32Type = IntegerType::get(symTable->getContext(), 32);
auto i64Type = IntegerType::get(symTable->getContext(), 64);
- std::string funcName = (llvm::Twine("_mlir_apfloat_") + name).str();
- return lookupOrCreateFnDecl(b, symTable, funcName,
- ...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/172714
More information about the Mlir-commits
mailing list