[Openmp-commits] [openmp] [NFC][OpenMP][OMPX] Use `[[clang::always_inline]]` instead of `inline` (PR #91294)

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Thu May 23 07:45:02 PDT 2024


shiltian wrote:

> > > Why do we need these to be always_inline? The `inline` keyword pretty much just means that the function doesn't get a symbol, which is typical for header implementations like this. Some context in the description would help.
> > 
> > 
> > `inline` almost means nothing for a compiler, which would not make an attempt if it is `-O0`. On the other hand, `always_inline` tells the compiler to try to inline the function regardless of optimization level. We want this to make sure that there is no multiple defined symbols in any case.
> 
> Well at `O0` I wouldn't expect it to matter, `always_inline` is more of a hack for things that _need_ to be inlined or else something breaks (i.e. like LDS used to require). Using `static inline` solves the symbol collision problem AFAIK.

Hmm, `static inline` is a fair point. Okay, we can postpone this and revisit if we encounter any issue.

https://github.com/llvm/llvm-project/pull/91294


More information about the Openmp-commits mailing list