Skip to content

Commit 396acd8

Browse files
committed
[rebase] use newly added llvm linkage for mlir func
Function linkage support was a fir-dev local mlir extension: 3a1a64a It was lost in the rebase, but some upstream support was added upstream using LLVM attributes: llvm@21d43da So use it in intrinsic wrapper generation, which is the only place we need internal functions so far.
1 parent 759ed76 commit 396acd8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

flang/lib/Lower/IntrinsicCall.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "llvm/Support/CommandLine.h"
3535
#include "llvm/Support/Debug.h"
3636
#include "llvm/Support/ErrorHandling.h"
37+
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
3738
#include <algorithm>
3839
#include <string_view>
3940
#include <utility>
@@ -1466,7 +1467,9 @@ mlir::FuncOp IntrinsicLibrary::getWrapper(GeneratorType generator,
14661467
// First time this wrapper is needed, build it.
14671468
function = builder.createFunction(loc, wrapperName, funcType);
14681469
function->setAttr("fir.intrinsic", builder.getUnitAttr());
1469-
function->setAttr("linkName", builder.createInternalLinkage());
1470+
auto internalLinkage = mlir::LLVM::linkage::Linkage::Internal;
1471+
auto linkage = mlir::LLVM::LinkageAttr::get(builder.getContext(), internalLinkage);
1472+
function->setAttr("llvm.linkage", linkage);
14701473
function.addEntryBlock();
14711474

14721475
// Create local context to emit code into the newly created function

0 commit comments

Comments
 (0)