[llvm-branch-commits] [openmp] [OpenMP][offload] Inline target reductions (PR #196061)

Shilei Tian via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed May 6 08:22:44 PDT 2026


================
@@ -22,15 +22,19 @@ using namespace ompx;
 
 namespace {
 
-void gpu_regular_warp_reduce(void *reduce_data, ShuffleReductFnTy shflFct) {
+[[clang::always_inline]]
+static void gpu_regular_warp_reduce(void *reduce_data,
----------------
shiltian wrote:

> > It is not a great idea to add always_line
> 
> How so? I didn't see any regression in my testing. Which situations would you expect to expose issues?

`always_inline` is to override all compiler heuristics and eventually it might not get what you want because from a user's perspective, the code might look "simple" enough to be inlined, but from compiler's perspective, the code at that time is not for whatever reason. Using `inline` hint is fine because it is a hint. I expect it to be sufficient for this case.

> And, I generally do think that needing to add always inline represents a problem with our codegen or inliner heuristics.

I tend to agree, but I think we'd better to understand why inliner doesn't think this can be inlined.

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


More information about the llvm-branch-commits mailing list