Skip to content

Conversation

wenju-he
Copy link
Contributor

@wenju-he wenju-he commented Oct 6, 2025

The flag was added in 8ef48d0 to suppress build warning and is no
longer needed.

It adds "no-builtins" attribute, which prevents libclc functions from
being inlined into caller that don't have the attribute.

The flag is meant to prevent folding standard library calls into optimized implementations. For libclc device targets, however, such target‑driven folding is desirable.

llvm-diff shows no change to amdgcn--amdhsa.bc and nvptx--nvidiacl.bc.

The flag was added in commit 5631a959571c to suppress build warning and
is no longer needed. It adds "no-builtins" attribute, which prevents
libclc functions from being inlined into caller that don't have the attribute.

The flag is meant to prevent folding standard library calls into
optimized implementations. For libclc device targets, however, such
target‑driven folding is desirable.

llvm-diff shows no change to amdgcn--amdhsa.bc and nvptx--nvidiacl.bc.

Co-authored-by: Mészáros Gergely <gergely.meszaros@intel.com>
@wenju-he wenju-he requested a review from Copilot October 6, 2025 12:13
@llvmbot llvmbot added the libclc libclc OpenCL library label Oct 6, 2025
@wenju-he wenju-he requested a review from frasercrmck October 6, 2025 12:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the -fno-builtin compiler flag from libclc compilation options to improve optimization opportunities. The flag was previously added to suppress build warnings but is no longer needed and was preventing libclc functions from being inlined into callers without the "no-builtins" attribute.

  • Removed -fno-builtin flag from EXTRA_OPTS in the add_libclc_builtin_set function
  • Enables better optimization by allowing standard library call folding for device targets
  • No functional changes to generated bytecode files as verified by llvm-diff

@wenju-he wenju-he requested review from arsenm and Maetveis October 6, 2025 12:14
Copy link
Contributor

@arsenm arsenm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libclc shouldn't be in the business of supplying functions considered as compiler built-ins

@wenju-he wenju-he merged commit 64574d3 into llvm:main Oct 7, 2025
11 checks passed
@wenju-he wenju-he deleted the libclc-remove--fno-builtin branch October 7, 2025 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libclc libclc OpenCL library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants