Skip to content

[LoopVectorize] Fails on OpenMP SIMD Prefix Sum #135576

Open
@orpheezt

Description

@orpheezt

On clang 19.1.7

void prefix_scan_omp_simd(uint64_t n, const float *const __restrict src,
                          float *const __restrict dst, const double init) {
  auto acc = init;
#pragma omp simd reduction(inscan, + : acc)
  for (uint64_t i = 0; i < n; ++i) {
    acc += src[i];
#pragma omp scan inclusive(acc)
    dst[i] = acc;
  }
}

The following code is emitting the warning

warning: loop not vectorized: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
   15 | #pragma omp simd reduction(inscan, + : acc)
      | ^
1 warning generated.

While on gcc it suceeds.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions