This is an archive of the discontinued LLVM Phabricator instance.

[flang][OpenMP] Fix the types of worksharing-loop variables
ClosedPublic

Authored by peixin on May 16 2022, 8:24 PM.

Details

Summary

The types of lower bound, upper bound, and step are converted into the
type of the loop variable if necessary. OpenMP runtime requires 32-bit
or 64-bit loop variables. OpenMP loop iteration variable cannot have
more than 64 bits size and will be narrowed.

This patch is part of upstreaming code from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project. (#1256)

Co-authored-by: kiranchandramohan <kiranchandramohan@gmail.com>

Diff Detail

Event Timeline

peixin created this revision.May 16 2022, 8:24 PM
peixin requested review of this revision.May 16 2022, 8:24 PM
peixin updated this revision to Diff 429937.May 16 2022, 11:29 PM

Fix the IR check of test case.

shraiysh accepted this revision.May 18 2022, 8:12 PM

Thanks for this. LGTM. Minor comments.

flang/lib/Lower/OpenMP.cpp
129

nit: make this >64 maybe?

flang/test/Lower/OpenMP/omp-wsloop-variable.f90
31

Can we please add the same testcase without collapse? I wanted to make sure that the outer bounds in that case change to i32 and inner change to i64 and they do not interfere with each other.

This revision is now accepted and ready to land.May 18 2022, 8:12 PM
peixin updated this revision to Diff 430732.May 19 2022, 10:04 AM

Rebase and address comments.

flang/lib/Lower/OpenMP.cpp
129

Thanks for the notice. Fixed.

flang/test/Lower/OpenMP/omp-wsloop-variable.f90
31

Added the test case.

peixin updated this revision to Diff 430865.May 19 2022, 6:05 PM

Rebase and fix one clang format

peixin updated this revision to Diff 430888.May 19 2022, 11:41 PM
peixin edited the summary of this revision. (Show Details)

rebase before land