Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: don't set external linkage when @[NoInline] is specified #15424

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/compiler/crystal/codegen/fun.cr
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class Crystal::CodeGenVisitor
end
end

if @single_module && !target_def.no_inline? && !target_def.is_a?(External)
if @single_module && !target_def.is_a?(External)
context.fun.linkage = LLVM::Linkage::Internal
end

Expand Down Expand Up @@ -448,11 +448,7 @@ class Crystal::CodeGenVisitor
context.fun.add_attribute LLVM::Attribute::ReturnsTwice if target_def.returns_twice?
context.fun.add_attribute LLVM::Attribute::Naked if target_def.naked?
context.fun.add_attribute LLVM::Attribute::NoReturn if target_def.no_returns?

if target_def.no_inline?
context.fun.add_attribute LLVM::Attribute::NoInline
context.fun.linkage = LLVM::Linkage::External
end
context.fun.add_attribute LLVM::Attribute::NoInline if target_def.no_inline?
end

def setup_closure_vars(def_vars, closure_vars, context, closure_type, closure_ptr)
Expand Down