Skip to content

Commit ac95da4

Browse files
committed
address review feedback
1 parent 0725151 commit ac95da4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

clang/lib/CIR/CodeGen/CIRGenFunction.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -555,22 +555,19 @@ cir::FuncOp CIRGenFunction::generateCode(clang::GlobalDecl gd, cir::FuncOp fn,
555555
// When generating code for a builtin with an inline declaration, use a
556556
// mangled name to hold the actual body, while keeping an external
557557
// declaration in case the function pointer is referenced somewhere.
558-
std::string fdInlineName = fn.getName().str() + ".inline";
558+
std::string fdInlineName = (cgm.getMangledName(funcDecl) + ".inline").str();
559559
cir::FuncOp clone =
560560
mlir::cast_or_null<cir::FuncOp>(cgm.getGlobalValue(fdInlineName));
561561
if (!clone) {
562562
mlir::OpBuilder::InsertionGuard guard(builder);
563563
builder.setInsertionPoint(fn);
564564
clone = builder.create<cir::FuncOp>(fn.getLoc(), fdInlineName,
565565
fn.getFunctionType());
566-
clone.setLinkageAttr(cir::GlobalLinkageKindAttr::get(
567-
&cgm.getMLIRContext(), cir::GlobalLinkageKind::InternalLinkage));
566+
clone.setLinkage(cir::GlobalLinkageKind::InternalLinkage);
568567
clone.setSymVisibility("private");
569-
clone.setInlineKindAttr(cir::InlineAttr::get(
570-
&cgm.getMLIRContext(), cir::InlineKind::AlwaysInline));
568+
clone.setInlineKind(cir::InlineKind::AlwaysInline);
571569
}
572-
fn.setLinkageAttr(cir::GlobalLinkageKindAttr::get(
573-
&cgm.getMLIRContext(), cir::GlobalLinkageKind::ExternalLinkage));
570+
fn.setLinkage(cir::GlobalLinkageKind::ExternalLinkage);
574571
fn.setSymVisibility("private");
575572
fn = clone;
576573
} else {
@@ -584,6 +581,8 @@ cir::FuncOp CIRGenFunction::generateCode(clang::GlobalDecl gd, cir::FuncOp fn,
584581
if (auto inlineFn = mlir::cast_or_null<cir::FuncOp>(
585582
cgm.getGlobalValue(inlineName))) {
586583
// Replace all uses of the .inline function with the regular function
584+
// FIXME: This performs a linear walk over the module. Introduce some
585+
// caching here.
587586
if (inlineFn
588587
.replaceAllSymbolUses(fn.getSymNameAttr(), cgm.getModule())
589588
.failed())

0 commit comments

Comments
 (0)