Skip to content

omp simd reduction "loop not vectorized" warning for a simple loop that even seems vectorized #39892

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

Closed
llvmbot opened this issue Jan 31, 2019 · 3 comments
Labels
bugzilla Issues migrated from bugzilla

Comments

@llvmbot
Copy link
Member

llvmbot commented Jan 31, 2019

Bugzilla Link 40546
Resolution FIXED
Resolved on Feb 05, 2019 04:52
Version 8.0
OS Linux
Blocks #39678
Attachments compile with -fopenmp -O2
Reporter LLVM Bugzilla Contributor
CC @zmodem,@hfinkel,@Meinersbur
Fixed by commit(s) r353082

Extended Description

clang8 emits 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]"

for the following example, when compiled with "-fopenmp -O2". The generated code is, however, vectorized and is almost identical to the code generated by clang7, which does not emit the warning. The same problem as in clang8 is in the current clang9 (and the emitted code is identical). clang6 produces similar code, vectorizes the loop, and does not emit the warning, either.

The warning is generated twice when compiling the example, with identical texts and code locations, and counted as "2 warnings".

int maybeNotFinite(double *x, unsigned n)
{
double s = 0;

#pragma omp simd reduction(+:s)
for (unsigned i = 0; i < n; i++)
    s += x[i];
return !finite(s);

}

tested on Ubuntu 18.04.1 with clang from apt.llvm.org
clang version 8.0.0-svn352547-1exp120190130015936.13 (branches/release_80)
clang version 7.0.1-svn348686-1exp120190113235231.54 (branches/release_70)
clang version 9.0.0-svn352666-1exp1+020190130204444.773~1.gbp5cc800 (trunk)

and on clang from Ubuntu 18.04.1
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)

@Meinersbur
Copy link
Member

LoopVectorize adds llvm.loop.isvectorized, but leaves llvm.loop.vectorize.enable which is reported (for the vectorized loop and the fallback). The function hasVectorizeTransformation considers this, but with different priorization. Working on it.

@Meinersbur
Copy link
Member

Thanks for the report. See https://reviews.llvm.org/D57542 for a fix.

We should consider this for clang-8 as well.

@zmodem
Copy link
Collaborator

zmodem commented Feb 5, 2019

Thanks for the report. See https://reviews.llvm.org/D57542 for a fix.

We should consider this for clang-8 as well.

Merged the fix in r353166, thanks.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

3 participants